Update OpcUa x Ewon di STEL/Mecolpress
This commit is contained in:
@@ -1218,6 +1218,11 @@ namespace IOB_WIN_NEXT
|
||||
start.Enabled = true;
|
||||
break;
|
||||
|
||||
case tipoAdapter.OpcUaEwonMonti:
|
||||
iobObj = new IobOpcUaEwonMonti(this, IOBConf);
|
||||
start.Enabled = true;
|
||||
break;
|
||||
|
||||
case tipoAdapter.PingWatchdog:
|
||||
iobObj = new IobPing(this, IOBConf);
|
||||
start.Enabled = true;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
;Centro di lavoro OpcUa
|
||||
CNCTYPE=OpcUaEwon
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=Mecolpress
|
||||
MODEL=Pressa
|
||||
|
||||
[CNC]
|
||||
IP=192.168.1.200
|
||||
PORT=4840
|
||||
GETPRGNAME=true
|
||||
|
||||
[SERVER]
|
||||
MPIP=http://192.168.1.65
|
||||
MPURL=/MP/IO
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
CMDREBO=/sendReboot.aspx?idxMacchina=
|
||||
|
||||
[MEMORY]
|
||||
ADDR_READ=DB9999.DBB0
|
||||
ADDR_WRITE=DB9999.DBB0
|
||||
SIZE_READ=0
|
||||
SIZE_WRITE=0
|
||||
;BIT0=CONN
|
||||
;BIT1=DB60.DBB1
|
||||
;BIT2=PZCOUNT.STD.DB700.DBW22
|
||||
;BIT3=DB60.DBB3
|
||||
;BIT4=DB60.DBB4
|
||||
|
||||
|
||||
[BLINK]
|
||||
;MAX_COUNTER_BLINK = 30
|
||||
MAX_COUNTER_BLINK = 15
|
||||
;bit0 = 0
|
||||
;bit1 = 0
|
||||
;bit2 = 1
|
||||
;bit3 = 1
|
||||
;bit4 = 1
|
||||
;bit5 = 0
|
||||
;bit6 = 0
|
||||
;bit7 = 0
|
||||
BLINK_FILT=0
|
||||
;BLINK_FILT=28
|
||||
|
||||
[OPTPAR]
|
||||
AUTO_CHANGE_ODL=false
|
||||
CHANGE_ODL_MODE=PZCOUNT_RESET
|
||||
PZCOUNT_MODE=OPC
|
||||
DISABLE_PZCOUNT=FALSE
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
ENABLE_DYN_DATA=FALSE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
ENABLE_DATA_FILTER=TRUE
|
||||
ENABLE_CLI_RESTART=TRUE
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
OPC_PARAM_CONF=STEL_200.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -0,0 +1,151 @@
|
||||
{
|
||||
"BrowseFullVal": "ns=4;i=5001",
|
||||
"BrowseNSIndex": 4,
|
||||
"BrowseValue": 5001,
|
||||
"keyPartCount": "tomes_17_partial_prod",
|
||||
"keyPartReq": "tomach_6_quantity",
|
||||
"keyPartId": "",
|
||||
"keyProgName": "",
|
||||
"keyRunMode": "",
|
||||
"pingAsPowerOn": true,
|
||||
"condWork": [
|
||||
{
|
||||
"keyName": "tomes_5_autom",
|
||||
"targetValue": "True"
|
||||
}
|
||||
],
|
||||
"condPowerOn": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "tomes_2_mach_on",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condReady": {
|
||||
"checkMode": "AND",
|
||||
"checkList": []
|
||||
},
|
||||
"condManual": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "tomes_6_manual",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condEStop": {
|
||||
"checkMode": "AND",
|
||||
"checkList": []
|
||||
},
|
||||
"condError": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "tomes_7_alarm",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condCountEnabled": {
|
||||
"checkMode": "AND",
|
||||
"checkList": []
|
||||
},
|
||||
"condWarmUpCoolDown": {
|
||||
"checkMode": "OR",
|
||||
"checkList": []
|
||||
},
|
||||
"condwarning": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "tomes_8_warning",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condSetup": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "tomes_3_setup",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fluxLogVeto": [
|
||||
"L2p1CommonVariable"
|
||||
],
|
||||
"itemTranslation": {
|
||||
"avail": "Machine Available",
|
||||
"rstat": "Execution Mode",
|
||||
"mode": "Controller Mode",
|
||||
"ncprog": "Program Name",
|
||||
"tomes_13_good_prod": "Pezzi Prodotta",
|
||||
"tomach_6_quantity": "Qta Richiesta",
|
||||
"fdovrd": "PATH FEED OVERRIDE",
|
||||
"rovrd": "PATH RAPID OVERRIDE"
|
||||
},
|
||||
"paramsEndThresh": {
|
||||
"InvDDone": 50
|
||||
},
|
||||
"mMapWrite": {
|
||||
"setPzComm": {
|
||||
"name": "setPzComm",
|
||||
"description": "Qty",
|
||||
"tipoMem": "Int",
|
||||
"memAddr": "ns=4;s=tomach_6_quantity",
|
||||
"index": 0,
|
||||
"size": -1
|
||||
},
|
||||
"setComm": {
|
||||
"name": "setComm",
|
||||
"description": "Commessa",
|
||||
"tipoMem": "String",
|
||||
"memAddr": "ns=4;s=tomach_4_prod_order",
|
||||
"index": 0,
|
||||
"size": 24
|
||||
},
|
||||
"setArt": {
|
||||
"name": "setArt",
|
||||
"description": "Articolo",
|
||||
"tipoMem": "String",
|
||||
"memAddr": "ns=4;s=tomach_3_code_die",
|
||||
"index": 0,
|
||||
"size": 24
|
||||
}
|
||||
},
|
||||
"subscribedItems": [
|
||||
"tomes_ 1_Watchdog",
|
||||
"tomes_2_mach_on",
|
||||
"tomes_3_setup",
|
||||
"tomes_4_impulse",
|
||||
"tomes_5_autom",
|
||||
"tomes_6_manual",
|
||||
"tomes_7_alarm",
|
||||
"tomes_8_warning",
|
||||
"tomes_10_cycle_life",
|
||||
"tomes_11_ack_new_order",
|
||||
"tomes_13_good_prod",
|
||||
"tomes_14_bad_prod_calipso",
|
||||
"tomes_15_bad_prod_startup",
|
||||
"tomes_16_bad_prod_stop",
|
||||
"tomes_17_partial_prod",
|
||||
"tomes_18_total_prod",
|
||||
"tomes_20_code_die",
|
||||
"tomes_21_order",
|
||||
"tomach_1_watchdog",
|
||||
"tomach_2_new_prod",
|
||||
"tomach_3_code_die",
|
||||
"tomach_4_prod_order",
|
||||
"tomach_6_quantity"
|
||||
],
|
||||
"WatchDog": {
|
||||
"IsEnabled": true,
|
||||
"MemConfRead": "tomes_ 1_Watchdog",
|
||||
"MemConfWrite": "tomach_1_watchdog",
|
||||
"MaxVal": 9999
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
;Centro di lavoro OpcUa
|
||||
CNCTYPE=OpcUaEwonMonti
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=Monti
|
||||
MODEL=Std
|
||||
|
||||
[CNC]
|
||||
IP=192.168.250.53
|
||||
PORT=4840
|
||||
GETPRGNAME=true
|
||||
|
||||
[SERVER]
|
||||
MPIP=http://192.168.10.7
|
||||
MPURL=/MP/IO
|
||||
CMDBASE=/IOB/input/
|
||||
CMDFLOG=/IOB/flog/
|
||||
CMDALIVE=/IOB
|
||||
CMDENABLED=/IOB/enabled/
|
||||
CMDADV1=?valore=
|
||||
CMDREBO=/sendReboot.aspx?idxMacchina=
|
||||
|
||||
[MEMORY]
|
||||
ADDR_READ=DB9999.DBB0
|
||||
ADDR_WRITE=DB9999.DBB0
|
||||
SIZE_READ=0
|
||||
SIZE_WRITE=0
|
||||
;BIT0=CONN
|
||||
;BIT1=DB60.DBB1
|
||||
;BIT2=PZCOUNT.STD.DB700.DBW22
|
||||
;BIT3=DB60.DBB3
|
||||
;BIT4=DB60.DBB4
|
||||
|
||||
|
||||
[BLINK]
|
||||
;MAX_COUNTER_BLINK = 30
|
||||
MAX_COUNTER_BLINK = 15
|
||||
;bit0 = 0
|
||||
;bit1 = 0
|
||||
;bit2 = 1
|
||||
;bit3 = 1
|
||||
;bit4 = 1
|
||||
;bit5 = 0
|
||||
;bit6 = 0
|
||||
;bit7 = 0
|
||||
BLINK_FILT=0
|
||||
;BLINK_FILT=28
|
||||
|
||||
[OPTPAR]
|
||||
AUTO_CHANGE_ODL=false
|
||||
CHANGE_ODL_MODE=PZCOUNT_RESET
|
||||
PZCOUNT_MODE=OPC
|
||||
DISABLE_PZCOUNT=FALSE
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
ENABLE_DYN_DATA=FALSE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
ENABLE_DATA_FILTER=TRUE
|
||||
ENABLE_CLI_RESTART=TRUE
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
OPC_PARAM_CONF=Tend_250_53.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -0,0 +1,121 @@
|
||||
{
|
||||
"BrowseFullVal": "ns=4;i=5001",
|
||||
"BrowseNSIndex": 4,
|
||||
"BrowseValue": 5001,
|
||||
"keyPartCount": "IO_150",
|
||||
"keyPartReq": "",
|
||||
"keyPartId": "",
|
||||
"keyProgName": "",
|
||||
"keyRunMode": "IO_129",
|
||||
"pingAsPowerOn": true,
|
||||
"condWork": [
|
||||
{
|
||||
"keyName": "IO_120.03",
|
||||
"targetValue": "True"
|
||||
}
|
||||
],
|
||||
"condPowerOn": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "IO_120.00",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condReady": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "IO_121.00",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condManual": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "IO_120.06",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condEStop": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "IO_121.02",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condError": {
|
||||
"checkMode": "AND",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "IO_120.08",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"condCountEnabled": {
|
||||
"checkMode": "AND",
|
||||
"checkList": []
|
||||
},
|
||||
"condWarmUpCoolDown": {
|
||||
"checkMode": "OR",
|
||||
"checkList": [
|
||||
{
|
||||
"keyName": "IO_120.04",
|
||||
"targetValue": "True"
|
||||
},
|
||||
{
|
||||
"keyName": "IO_120.05",
|
||||
"targetValue": "True"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fluxLogVeto": [
|
||||
"L2p1CommonVariable"
|
||||
],
|
||||
"itemTranslation": {
|
||||
"avail": "Machine Available",
|
||||
"rstat": "Execution Mode",
|
||||
"mode": "Controller Mode",
|
||||
"ncprog": "Program Name",
|
||||
"IO_150": "Qta Prodotta (metri)",
|
||||
"lpremain": "Qta Richiesta",
|
||||
"fdovrd": "PATH FEED OVERRIDE",
|
||||
"rovrd": "PATH RAPID OVERRIDE"
|
||||
},
|
||||
"paramsEndThresh": {
|
||||
"InvDDone": 50
|
||||
},
|
||||
"mMapWrite": {
|
||||
"setPzComm": {
|
||||
"name": "setPzComm",
|
||||
"description": "Qty",
|
||||
"tipoMem": "Int",
|
||||
"memAddr": "ns=4;s=IO_153",
|
||||
"index": 0,
|
||||
"size": -1
|
||||
},
|
||||
"setComm": {
|
||||
"name": "setComm",
|
||||
"description": "Commessa",
|
||||
"tipoMem": "String",
|
||||
"memAddr": "ns=4;s=ST_80",
|
||||
"index": 0,
|
||||
"size": 20
|
||||
},
|
||||
"setArt": {
|
||||
"name": "setArt",
|
||||
"description": "Articolo",
|
||||
"tipoMem": "String",
|
||||
"memAddr": "ns=4;s=ST_80",
|
||||
"index": 20,
|
||||
"size": 20
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,13 +112,13 @@
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Client.1.4.367.42\lib\net462\Opc.Ua.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Configuration, Version=1.4.367.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Configuration.1.4.367.42\lib\net462\Opc.Ua.Configuration.dll</HintPath>
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Configuration.1.4.367.75\lib\net462\Opc.Ua.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Core, Version=1.4.367.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Core.1.4.367.42\lib\net462\Opc.Ua.Core.dll</HintPath>
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Core.1.4.367.75\lib\net462\Opc.Ua.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Opc.Ua.Security.Certificates, Version=1.4.367.0, Culture=neutral, PublicKeyToken=bfa7a73c5cf4b6e8, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Security.Certificates.1.4.367.42\lib\net462\Opc.Ua.Security.Certificates.dll</HintPath>
|
||||
<HintPath>..\packages\OPCFoundation.NetStandard.Opc.Ua.Security.Certificates.1.4.367.75\lib\net462\Opc.Ua.Security.Certificates.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="RestSharp, Version=106.13.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
@@ -133,8 +133,8 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Formats.Asn1, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Formats.Asn1.5.0.0\lib\net461\System.Formats.Asn1.dll</HintPath>
|
||||
<Reference Include="System.Formats.Asn1, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Formats.Asn1.6.0.0\lib\net461\System.Formats.Asn1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.IdentityModel" />
|
||||
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
@@ -181,6 +181,7 @@
|
||||
<Compile Include="..\VersGen\VersGen.cs">
|
||||
<Link>VersGen.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="IobOpcUaEwonMonti.cs" />
|
||||
<Compile Include="TcAdsClient.cs" />
|
||||
<Compile Include="Enums.cs" />
|
||||
<Compile Include="ControlExtensions.cs" />
|
||||
@@ -256,6 +257,12 @@
|
||||
<None Include="DATA\CONF\3023.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\3024.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\3024.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\FOV062.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -463,6 +470,10 @@
|
||||
<None Include="DATA\CONF\SIM_PIZ00.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\STEL_200.ini" />
|
||||
<None Include="DATA\CONF\STEL_200.json" />
|
||||
<None Include="DATA\CONF\Tend_250_53.ini" />
|
||||
<None Include="DATA\CONF\Tend_250_53.json" />
|
||||
<None Include="DATA\CONF\TEST.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indica se sia in stato SWarmUp / CoolDown (riscaldamento/raffreddamento)
|
||||
/// Indica se sia in stato WarmUp / CoolDown (riscaldamento/raffreddamento)
|
||||
/// </summary>
|
||||
protected bool isWarmUpCoolDown
|
||||
{
|
||||
@@ -175,6 +175,27 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indica se sia in stato Warning
|
||||
/// </summary>
|
||||
protected bool isWarning
|
||||
{
|
||||
get
|
||||
{
|
||||
return checkMultiCondition(opcUaParams.condWarning.checkList, opcUaParams.condWarning.checkMode);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Indica se sia in stato Ssetup
|
||||
/// </summary>
|
||||
protected bool isSetup
|
||||
{
|
||||
get
|
||||
{
|
||||
return checkMultiCondition(opcUaParams.condSetup.checkList, opcUaParams.condSetup.checkMode);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indica se abbia stato READY (condizioni varie, es ausiliari OK)
|
||||
/// </summary>
|
||||
@@ -353,7 +374,7 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
// loggo elenco degli item sottocrivibili...
|
||||
lgInfo("---------- SUBSCRIBED NODES ----------");
|
||||
foreach (var item in nodeIdNameList)
|
||||
foreach (var item in selectedItemList)
|
||||
{
|
||||
lgInfo(item.Key);
|
||||
}
|
||||
@@ -466,9 +487,38 @@ namespace IOB_WIN_NEXT
|
||||
private void UA_ref_eh_MonItChange(object sender, opcUaMonitItemChange e)
|
||||
{
|
||||
checkAndSend(e.CurrMonitoredItem, $"{e.CurrNotify.Value}", false);
|
||||
// se abilitato watchdog...
|
||||
if (opcUaParams.WatchDog.IsEnabled)
|
||||
{
|
||||
// se fosse watchdog --> processo il mio...
|
||||
if (e.CurrMonitoredItem.DisplayName == opcUaParams.WatchDog.MemConfRead)
|
||||
{
|
||||
try
|
||||
{
|
||||
WatchDog++;
|
||||
WatchDog = WatchDog > opcUaParams.WatchDog.MaxVal ? 0 : WatchDog;
|
||||
|
||||
WriteValue commWriteVal = new WriteValue();
|
||||
commWriteVal.NodeId = new NodeId(opcUaParams.WatchDog.MemConfWrite);
|
||||
commWriteVal.AttributeId = Attributes.Value;
|
||||
commWriteVal.Value = new DataValue();
|
||||
commWriteVal.Value.Value = WatchDog;
|
||||
|
||||
List<WriteValue> nodes2Write = new List<WriteValue>();
|
||||
nodes2Write.Add(commWriteVal);
|
||||
UA_ref.WriteNodes(nodes2Write);
|
||||
}
|
||||
catch(Exception exc)
|
||||
{
|
||||
lgError($"Eccezione in gestione WatchDog, valore attuale {WatchDog}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
}
|
||||
lastCurrent = DateTime.Now;
|
||||
}
|
||||
|
||||
protected int WatchDog = 0;
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
@@ -38,8 +38,6 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
CHANGE_ODL_MODE = getOptPar("CHANGE_ODL_MODE");
|
||||
}
|
||||
// impostazioni specifiche Ewon di Monti
|
||||
forceResetInRun = true;
|
||||
sendKeyRichiesta = true;
|
||||
}
|
||||
|
||||
@@ -145,24 +143,6 @@ namespace IOB_WIN_NEXT
|
||||
/// <param name="updatedPar"></param>
|
||||
protected override void plcWriteParams(ref List<objItem> updatedPar)
|
||||
{
|
||||
#if false
|
||||
if (!testDone)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (UA_ref != null)
|
||||
{
|
||||
UA_ref.WriteTestNodes();
|
||||
testDone = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Eccezione in WriteTestNodes{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
dataConf currMem = null;
|
||||
int byteSize = 0;
|
||||
string memAddrWrite = "";
|
||||
@@ -211,7 +191,6 @@ namespace IOB_WIN_NEXT
|
||||
case plcDataType.DWord:
|
||||
int.TryParse(item.reqValue, out valInt);
|
||||
commWriteVal.Value.Value = valInt;
|
||||
memAddrWrite = currMem.memAddr;
|
||||
break;
|
||||
|
||||
case plcDataType.Real:
|
||||
@@ -220,26 +199,7 @@ namespace IOB_WIN_NEXT
|
||||
break;
|
||||
|
||||
case plcDataType.String:
|
||||
|
||||
// verifico caso speciale: se è art/comm scrivo AFFIANCATE...
|
||||
if (item.uid == "setArt" | item.uid == "setComm")
|
||||
{
|
||||
// accodo commessa + articolo con padding secondo lunghezza...
|
||||
string codArt = "";
|
||||
if (currProdData.ContainsKey("setArt"))
|
||||
{
|
||||
codArt = string.IsNullOrEmpty(currProdData["setArt"]) ? "" : currProdData["setArt"];
|
||||
}
|
||||
string codComm = "";
|
||||
if (currProdData.ContainsKey("setComm"))
|
||||
{
|
||||
codComm = string.IsNullOrEmpty(currProdData["setComm"]) ? "" : currProdData["setComm"];
|
||||
}
|
||||
// padding...
|
||||
codArt = codArt.PadRight(20, ' ');
|
||||
codComm = codComm.PadRight(20, ' ');
|
||||
commWriteVal.Value.Value = $"{codComm}{codArt}";
|
||||
}
|
||||
commWriteVal.Value.Value = item.reqValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,237 @@
|
||||
using MapoSDK;
|
||||
using Newtonsoft.Json;
|
||||
using Opc.Ua;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace IOB_WIN_NEXT
|
||||
{
|
||||
public class IobOpcUaEwonMonti : IobOpcUaEwon
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation con la gestione specifica per EWON (es Monti, Tenditalia)
|
||||
/// https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="IOBConf"></param>
|
||||
public IobOpcUaEwonMonti(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
lgInfo("Init Ewon versione Monti (tenditalia)");
|
||||
// inizializzo classe base...
|
||||
if (!string.IsNullOrEmpty(getOptPar("CHANGE_ODL_MODE")))
|
||||
{
|
||||
CHANGE_ODL_MODE = getOptPar("CHANGE_ODL_MODE");
|
||||
}
|
||||
// impostazioni specifiche Ewon di Monti
|
||||
forceResetInRun = true;
|
||||
sendKeyRichiesta = true;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua vera scrittura parametri
|
||||
/// </summary>
|
||||
/// <param name="updatedPar"></param>
|
||||
protected override void plcWriteParams(ref List<objItem> updatedPar)
|
||||
{
|
||||
#if false
|
||||
if (!testDone)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (UA_ref != null)
|
||||
{
|
||||
UA_ref.WriteTestNodes();
|
||||
testDone = true;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Eccezione in WriteTestNodes{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
dataConf currMem = null;
|
||||
int byteSize = 0;
|
||||
string memAddrWrite = "";
|
||||
string serObj = "";
|
||||
if (updatedPar != null)
|
||||
{
|
||||
List<WriteValue> nodes2Write = new List<WriteValue>();
|
||||
// controllo i parametri... ne gestisco 4...
|
||||
foreach (var item in updatedPar)
|
||||
{
|
||||
try
|
||||
{
|
||||
memAddrWrite = "";
|
||||
int valInt = 0;
|
||||
double valReal = 0;
|
||||
// cerco in area memMapWrite...
|
||||
if (memMap.mMapWrite.ContainsKey(item.uid))
|
||||
{
|
||||
// recupero!
|
||||
currMem = memMap.mMapWrite[item.uid];
|
||||
byteSize = currMem.size;
|
||||
memAddrWrite = currMem.memAddr;
|
||||
|
||||
WriteValue commWriteVal = new WriteValue();
|
||||
commWriteVal.NodeId = new NodeId(currMem.memAddr);
|
||||
commWriteVal.AttributeId = Attributes.Value;
|
||||
commWriteVal.Value = new DataValue();
|
||||
commWriteVal.Value.Value = item.reqValue;
|
||||
|
||||
// faccio preliminarmente upsertKey...
|
||||
upsertKey(currMem.name, currMem.value);
|
||||
serObj = JsonConvert.SerializeObject(item);
|
||||
lgInfo($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}");
|
||||
lgInfo($"---------------{Environment.NewLine}UPDATED PARAM:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
|
||||
serObj = JsonConvert.SerializeObject(currMem);
|
||||
lgInfo($"---------------{Environment.NewLine}MEMORY CONTENT:{Environment.NewLine}{serObj}{Environment.NewLine}---------------");
|
||||
|
||||
switch (currMem.tipoMem)
|
||||
{
|
||||
case plcDataType.Boolean:
|
||||
break;
|
||||
|
||||
case plcDataType.Int:
|
||||
case plcDataType.DInt:
|
||||
case plcDataType.Word:
|
||||
case plcDataType.DWord:
|
||||
int.TryParse(item.reqValue, out valInt);
|
||||
commWriteVal.Value.Value = valInt;
|
||||
memAddrWrite = currMem.memAddr;
|
||||
break;
|
||||
|
||||
case plcDataType.Real:
|
||||
double.TryParse(item.reqValue, out valReal);
|
||||
commWriteVal.Value.Value = valReal;
|
||||
break;
|
||||
|
||||
case plcDataType.String:
|
||||
|
||||
// verifico caso speciale: se è art/comm scrivo AFFIANCATE...
|
||||
if (item.uid == "setArt" | item.uid == "setComm")
|
||||
{
|
||||
// accodo commessa + articolo con padding secondo lunghezza...
|
||||
string codArt = "";
|
||||
if (currProdData.ContainsKey("setArt"))
|
||||
{
|
||||
codArt = string.IsNullOrEmpty(currProdData["setArt"]) ? "" : currProdData["setArt"];
|
||||
}
|
||||
string codComm = "";
|
||||
if (currProdData.ContainsKey("setComm"))
|
||||
{
|
||||
codComm = string.IsNullOrEmpty(currProdData["setComm"]) ? "" : currProdData["setComm"];
|
||||
}
|
||||
// padding...
|
||||
codArt = codArt.PadRight(20, ' ');
|
||||
codComm = codComm.PadRight(20, ' ');
|
||||
commWriteVal.Value.Value = $"{codComm}{codArt}";
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
lgInfo($"---------------{Environment.NewLine}OPC-UA data:{Environment.NewLine}NodeId: {commWriteVal.NodeId}{Environment.NewLine}Value: {commWriteVal.Value.Value}{Environment.NewLine}---------------");
|
||||
|
||||
if (!string.IsNullOrEmpty(memAddrWrite))
|
||||
{
|
||||
nodes2Write.Add(commWriteVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"Errore: memAddrWrite vuoto!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Eccezione in fase di plcWriteParams per item {item.uid} con valore {item.value}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
|
||||
if (nodes2Write.Count > 0)
|
||||
{
|
||||
UA_ref.WriteNodes(nodes2Write);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua vero processing contapezzi
|
||||
/// </summary>
|
||||
public override void processContapezzi()
|
||||
{
|
||||
if (utils.CRB("enableContapezzi"))
|
||||
{
|
||||
// check condizione validazione
|
||||
if (checkMultiCondition(opcUaParams.condCountEnabled.checkList, opcUaParams.condCountEnabled.checkMode) || opcUaParams.condCountEnabled.checkList.Count == 0)
|
||||
{
|
||||
// cerco parametro contapezzi...
|
||||
string currPzCount = getDataItemValue(opcUaParams.keyPartCount);
|
||||
|
||||
// se ho un contapezzi... processo...
|
||||
if (!string.IsNullOrEmpty(currPzCount))
|
||||
{
|
||||
int newVal = -1;
|
||||
bool fatto = Int32.TryParse(currPzCount, out newVal);
|
||||
|
||||
if (fatto)
|
||||
{
|
||||
// gestione decremento contapezzi: viene "messo via" solo SE c'è un effettivo decremento contapezzi...
|
||||
if (newVal < contapezziPLC)
|
||||
{
|
||||
pzCountResetted = true;
|
||||
// incremento contatore richiesta
|
||||
countKeyRichiesta = countKeyRichiesta + 1;
|
||||
// log
|
||||
lgInfo("Contapezzi resettato (PLC) --> pzCountResetted = true");
|
||||
}
|
||||
|
||||
// salvo nuovo valore contapezziPLC
|
||||
contapezziPLC = newVal > -1 ? newVal : contapezziPLC;
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Errore in decodifica valore contapezzi, valore rilevato: {currPzCount}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError("Errore in decodifica valore contapezzi, valore vuoto!");
|
||||
}
|
||||
}
|
||||
|
||||
if (CHANGE_ODL_MODE == "PZCOUNT_RESET")
|
||||
{
|
||||
// controllo comunque, se è ZERO il contapezzi, e sul server è maggiore il valore x ODL e NON abilitato il trigger reset --> abilito trigger...
|
||||
if (!pzCountResetted && contapezziPLC == 0 && contapezziIOB > 0)
|
||||
{
|
||||
pzCountResetted = true;
|
||||
// incremento contatore richiesta
|
||||
countKeyRichiesta = countKeyRichiesta + 1;
|
||||
// log
|
||||
lgInfo("Contapezzi resettato (PLC==0 e IOB>PLC) --> pzCountResetted = true");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,9 @@
|
||||
<package id="NLog" version="4.7.12" targetFramework="net462" />
|
||||
<package id="OmronFinsTCP.Net" version="3.0.0.0" targetFramework="net40-client" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua.Client" version="1.4.367.42" targetFramework="net462" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua.Configuration" version="1.4.367.42" targetFramework="net462" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua.Core" version="1.4.367.42" targetFramework="net462" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua.Security.Certificates" version="1.4.367.42" targetFramework="net462" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua.Configuration" version="1.4.367.75" targetFramework="net462" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua.Core" version="1.4.367.75" targetFramework="net462" />
|
||||
<package id="OPCFoundation.NetStandard.Opc.Ua.Security.Certificates" version="1.4.367.75" targetFramework="net462" />
|
||||
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net462" />
|
||||
<package id="PrettyBin" version="1.1.0" targetFramework="net461" />
|
||||
<package id="RestSharp" version="106.13.0" targetFramework="net462" />
|
||||
@@ -22,7 +22,7 @@
|
||||
<package id="Selenium.WebDriver" version="4.0.1" targetFramework="net462" />
|
||||
<package id="Selenium.WebDriver.ChromeDriver" version="95.0.4638.5401" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
<package id="System.Formats.Asn1" version="5.0.0" targetFramework="net462" />
|
||||
<package id="System.Formats.Asn1" version="6.0.0" targetFramework="net462" />
|
||||
<package id="System.IO.Compression" version="4.3.0" targetFramework="net462" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net462" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
|
||||
|
||||
Reference in New Issue
Block a user