diff --git a/IOB-WIN-NEXT/AdapterForm.cs b/IOB-WIN-NEXT/AdapterForm.cs index 5baa998e..920d5b7b 100644 --- a/IOB-WIN-NEXT/AdapterForm.cs +++ b/IOB-WIN-NEXT/AdapterForm.cs @@ -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; diff --git a/IOB-WIN-NEXT/DATA/CONF/STEL_200.ini b/IOB-WIN-NEXT/DATA/CONF/STEL_200.ini new file mode 100644 index 00000000..a79c8aa7 --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/STEL_200.ini @@ -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 \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/STEL_200.json b/IOB-WIN-NEXT/DATA/CONF/STEL_200.json new file mode 100644 index 00000000..6cc6df49 --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/STEL_200.json @@ -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 + } +} \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/Tend_250_53.ini b/IOB-WIN-NEXT/DATA/CONF/Tend_250_53.ini new file mode 100644 index 00000000..59aca734 --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/Tend_250_53.ini @@ -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 \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/Tend_250_53.json b/IOB-WIN-NEXT/DATA/CONF/Tend_250_53.json new file mode 100644 index 00000000..3d6c0421 --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/Tend_250_53.json @@ -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 + } + } +} \ No newline at end of file diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index 28e94542..9dd02d87 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -112,13 +112,13 @@ ..\packages\OPCFoundation.NetStandard.Opc.Ua.Client.1.4.367.42\lib\net462\Opc.Ua.Client.dll - ..\packages\OPCFoundation.NetStandard.Opc.Ua.Configuration.1.4.367.42\lib\net462\Opc.Ua.Configuration.dll + ..\packages\OPCFoundation.NetStandard.Opc.Ua.Configuration.1.4.367.75\lib\net462\Opc.Ua.Configuration.dll - ..\packages\OPCFoundation.NetStandard.Opc.Ua.Core.1.4.367.42\lib\net462\Opc.Ua.Core.dll + ..\packages\OPCFoundation.NetStandard.Opc.Ua.Core.1.4.367.75\lib\net462\Opc.Ua.Core.dll - ..\packages\OPCFoundation.NetStandard.Opc.Ua.Security.Certificates.1.4.367.42\lib\net462\Opc.Ua.Security.Certificates.dll + ..\packages\OPCFoundation.NetStandard.Opc.Ua.Security.Certificates.1.4.367.75\lib\net462\Opc.Ua.Security.Certificates.dll @@ -133,8 +133,8 @@ - - ..\packages\System.Formats.Asn1.5.0.0\lib\net461\System.Formats.Asn1.dll + + ..\packages\System.Formats.Asn1.6.0.0\lib\net461\System.Formats.Asn1.dll @@ -181,6 +181,7 @@ VersGen.cs + @@ -256,6 +257,12 @@ Always + + Always + + + Always + Always @@ -463,6 +470,10 @@ Always + + + + Always diff --git a/IOB-WIN-NEXT/IobOpcUa.cs b/IOB-WIN-NEXT/IobOpcUa.cs index 7774b151..1507b508 100644 --- a/IOB-WIN-NEXT/IobOpcUa.cs +++ b/IOB-WIN-NEXT/IobOpcUa.cs @@ -165,7 +165,7 @@ namespace IOB_WIN_NEXT } /// - /// Indica se sia in stato SWarmUp / CoolDown (riscaldamento/raffreddamento) + /// Indica se sia in stato WarmUp / CoolDown (riscaldamento/raffreddamento) /// protected bool isWarmUpCoolDown { @@ -175,6 +175,27 @@ namespace IOB_WIN_NEXT } } + /// + /// Indica se sia in stato Warning + /// + protected bool isWarning + { + get + { + return checkMultiCondition(opcUaParams.condWarning.checkList, opcUaParams.condWarning.checkMode); + } + } + /// + /// Indica se sia in stato Ssetup + /// + protected bool isSetup + { + get + { + return checkMultiCondition(opcUaParams.condSetup.checkList, opcUaParams.condSetup.checkMode); + } + } + /// /// Indica se abbia stato READY (condizioni varie, es ausiliari OK) /// @@ -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 nodes2Write = new List(); + 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 diff --git a/IOB-WIN-NEXT/IobOpcUaEwon.cs b/IOB-WIN-NEXT/IobOpcUaEwon.cs index b6c452c2..9a7ac7f2 100644 --- a/IOB-WIN-NEXT/IobOpcUaEwon.cs +++ b/IOB-WIN-NEXT/IobOpcUaEwon.cs @@ -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 /// protected override void plcWriteParams(ref List 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: diff --git a/IOB-WIN-NEXT/IobOpcUaEwonMonti.cs b/IOB-WIN-NEXT/IobOpcUaEwonMonti.cs new file mode 100644 index 00000000..d59d53fb --- /dev/null +++ b/IOB-WIN-NEXT/IobOpcUaEwonMonti.cs @@ -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 + + /// + /// 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 + /// + /// + /// + 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 + + /// + /// Effettua vera scrittura parametri + /// + /// + protected override void plcWriteParams(ref List 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 nodes2Write = new List(); + // 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 + + /// + /// Effettua vero processing contapezzi + /// + 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 + } +} \ No newline at end of file diff --git a/IOB-WIN-NEXT/packages.config b/IOB-WIN-NEXT/packages.config index 18e22bed..49053227 100644 --- a/IOB-WIN-NEXT/packages.config +++ b/IOB-WIN-NEXT/packages.config @@ -11,9 +11,9 @@ - - - + + + @@ -22,7 +22,7 @@ - +