From feff6c74b4ef4808de5d44a79b4516e77adb454e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 16 Dec 2021 19:29:07 +0100 Subject: [PATCH 1/4] Aggiunto ping x pooweron x mecart --- IOB-WIN-NEXT/DATA/CONF/MECART_80.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IOB-WIN-NEXT/DATA/CONF/MECART_80.json b/IOB-WIN-NEXT/DATA/CONF/MECART_80.json index d0789d81..c0308bf7 100644 --- a/IOB-WIN-NEXT/DATA/CONF/MECART_80.json +++ b/IOB-WIN-NEXT/DATA/CONF/MECART_80.json @@ -7,7 +7,7 @@ "keyPartId": "", "keyProgName": "PartName(0)", "keyRunMode": "", - "pingAsPowerOn": false, + "pingAsPowerOn": true, "Identity": { "UserName": "CUSTOMER", "Passwd": "BLM" From 7be4c5a9e7662e1ab438c61980d05ac595f4d93d Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 16 Dec 2021 19:29:14 +0100 Subject: [PATCH 2/4] spostamento info --> trace x NON accodato --- IOB-WIN-NEXT/IobMTC.cs | 6 +++--- IOB-WIN-NEXT/IobOpcUa.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/IOB-WIN-NEXT/IobMTC.cs b/IOB-WIN-NEXT/IobMTC.cs index 8762e738..dd7df842 100644 --- a/IOB-WIN-NEXT/IobMTC.cs +++ b/IOB-WIN-NEXT/IobMTC.cs @@ -243,7 +243,7 @@ namespace IOB_WIN_NEXT { if (isVerboseLog) { - lgInfo($"NON ACCODATO sample per {dataItem.DataItemId} poiché trovato VETO in fluxLogVeto", false); + lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} poiché trovato VETO in fluxLogVeto", false); } } else @@ -283,7 +283,7 @@ namespace IOB_WIN_NEXT { if (isVerboseLog) { - lgInfo($"NON ACCODATO sample per {dataItem.DataItemId} poiché trovato VETO in fluxLogVeto", false); + lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} poiché trovato VETO in fluxLogVeto", false); } } else @@ -296,7 +296,7 @@ namespace IOB_WIN_NEXT { if (isVerboseLog) { - lgInfo($"NON ACCODATO sample per {dataItem.DataItemId} poiché verifica variazione SAMPLE ha dato esito negativo", false); + lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} poiché verifica variazione SAMPLE ha dato esito negativo", false); } } } diff --git a/IOB-WIN-NEXT/IobOpcUa.cs b/IOB-WIN-NEXT/IobOpcUa.cs index f4b62b17..85305bae 100644 --- a/IOB-WIN-NEXT/IobOpcUa.cs +++ b/IOB-WIN-NEXT/IobOpcUa.cs @@ -273,7 +273,7 @@ namespace IOB_WIN_NEXT bool isFiltered = opcUaParams.fluxLogVeto.Contains(MonIt.DisplayName); if (isFiltered) { - lgInfo($"NON ACCODATO sample per {MonIt.DisplayName} poiché trovato VETO in fluxLogVeto", false); + lgTrace($"NON ACCODATO sample per {MonIt.DisplayName} poiché trovato VETO in fluxLogVeto", false); } else { @@ -283,7 +283,7 @@ namespace IOB_WIN_NEXT } else { - lgInfo($"NON ACCODATO sample per {MonIt.DisplayName} poiché verifica variazione ha dato esito negativo", false); + lgTrace($"NON ACCODATO sample per {MonIt.DisplayName} poiché verifica variazione ha dato esito negativo", false); } } } From 13b5aa488656a19677416f1ec0f7bda20ae96dab Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 16 Dec 2021 19:31:10 +0100 Subject: [PATCH 3/4] typo fix --- IOB-WIN-NEXT/IobMTC.cs | 9 ++++----- IOB-WIN-NEXT/IobOpcUa.cs | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/IOB-WIN-NEXT/IobMTC.cs b/IOB-WIN-NEXT/IobMTC.cs index dd7df842..3ab51905 100644 --- a/IOB-WIN-NEXT/IobMTC.cs +++ b/IOB-WIN-NEXT/IobMTC.cs @@ -237,13 +237,12 @@ namespace IOB_WIN_NEXT // verifico se salvare bool changed = checkSaveItem(dataItem); // cerco se non sia un dato filtrato in FLUXLOG... - // cerco se non sia un dato filtrato in FLUXLOG... bool isFiltered = mtcParams.fluxLogVeto.Contains(dataItem.DataItemId); if (isFiltered) { if (isVerboseLog) { - lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} poiché trovato VETO in fluxLogVeto", false); + lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} - trovato VETO in fluxLogVeto", false); } } else @@ -283,7 +282,7 @@ namespace IOB_WIN_NEXT { if (isVerboseLog) { - lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} poiché trovato VETO in fluxLogVeto", false); + lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} - trovato VETO in fluxLogVeto", false); } } else @@ -296,7 +295,7 @@ namespace IOB_WIN_NEXT { if (isVerboseLog) { - lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} poiché verifica variazione SAMPLE ha dato esito negativo", false); + lgTrace($"NON ACCODATO sample per {dataItem.DataItemId} - verifica variazione SAMPLE ha dato esito negativo", false); } } } @@ -346,7 +345,7 @@ namespace IOB_WIN_NEXT // variabili RUN... string currRun = getDataItemValue(mtcParams.keyRunMode); - // controllo RUN MODE preliminare... CABLATO poiché è GENERALE x MTC + // controllo RUN MODE preliminare... CABLATO - è GENERALE x MTC if (currRun == "AUTOMATIC" || currRun == "SEMI_AUTO" || currRun == "SEMI_AUTOMATIC") { int numCond = mtcParams.condWork.Count; diff --git a/IOB-WIN-NEXT/IobOpcUa.cs b/IOB-WIN-NEXT/IobOpcUa.cs index 85305bae..dd69ee5b 100644 --- a/IOB-WIN-NEXT/IobOpcUa.cs +++ b/IOB-WIN-NEXT/IobOpcUa.cs @@ -273,7 +273,7 @@ namespace IOB_WIN_NEXT bool isFiltered = opcUaParams.fluxLogVeto.Contains(MonIt.DisplayName); if (isFiltered) { - lgTrace($"NON ACCODATO sample per {MonIt.DisplayName} poiché trovato VETO in fluxLogVeto", false); + lgTrace($"NON ACCODATO sample per {MonIt.DisplayName} - trovato VETO in fluxLogVeto", false); } else { @@ -283,7 +283,7 @@ namespace IOB_WIN_NEXT } else { - lgTrace($"NON ACCODATO sample per {MonIt.DisplayName} poiché verifica variazione ha dato esito negativo", false); + lgTrace($"NON ACCODATO sample per {MonIt.DisplayName} - verifica variazione ha dato esito negativo", false); } } } From ecbb2d0ea849a4a60067e2d5d64587a1994a77ca Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 17 Dec 2021 09:30:21 +0100 Subject: [PATCH 4/4] Ancora riorganizzaizone messaggi ed eventi su vari livelli log --- IOB-WIN-NEXT/IobGeneric.cs | 2 +- IOB-WIN-NEXT/IobOpcUa.cs | 2 +- IOB-WIN-NEXT/IobOpcUaCMS.cs | 10 +++++----- IOB-WIN-NEXT/UAClient.cs | 38 +++++++++++++++++++++---------------- 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 09689216..deb4b133 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -3634,7 +3634,7 @@ namespace IOB_WIN_NEXT if (utils.CRB("enableContapezzi")) { // rilettura contapezzi da server... - lgInfo("Ciclo VLF: pzCntReload(true)"); + lgTrace("Ciclo VLF: pzCntReload(true)"); if (!isMulti) { pzCntReload(true); diff --git a/IOB-WIN-NEXT/IobOpcUa.cs b/IOB-WIN-NEXT/IobOpcUa.cs index dd69ee5b..97882859 100644 --- a/IOB-WIN-NEXT/IobOpcUa.cs +++ b/IOB-WIN-NEXT/IobOpcUa.cs @@ -734,7 +734,7 @@ namespace IOB_WIN_NEXT int vFactor = 2; if (vetoCheckStatus < adesso) { - lgDebug($"Stato variabili checkPing: {testPingMachine}"); + lgTrace($"Stato variabili checkPing: {testPingMachine}"); // imposto veto per vetoSeconds... vetoCheckStatus = adesso.AddSeconds(vetoSeconds * vFactor); } diff --git a/IOB-WIN-NEXT/IobOpcUaCMS.cs b/IOB-WIN-NEXT/IobOpcUaCMS.cs index b7b27bf0..4a0eb835 100644 --- a/IOB-WIN-NEXT/IobOpcUaCMS.cs +++ b/IOB-WIN-NEXT/IobOpcUaCMS.cs @@ -194,10 +194,10 @@ namespace IOB_WIN_NEXT // 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}---------------"); + lgDebug($"Inizio processing plcWriteParams per {currMem.name} | valore richiesto {currMem.value}"); + lgDebug($"---------------{Environment.NewLine}UPDATED PARAM:{Environment.NewLine}{serObj}{Environment.NewLine}---------------"); serObj = JsonConvert.SerializeObject(currMem); - lgInfo($"---------------{Environment.NewLine}MEMORY CONTENT:{Environment.NewLine}{serObj}{Environment.NewLine}---------------"); + lgDebug($"---------------{Environment.NewLine}MEMORY CONTENT:{Environment.NewLine}{serObj}{Environment.NewLine}---------------"); switch (currMem.tipoMem) { @@ -252,12 +252,12 @@ namespace IOB_WIN_NEXT } else { - lgInfo($"Errore: memAddrWrite vuoto!"); + lgError($"Errore: memAddrWrite vuoto!"); } } else { - lgInfo($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write"); + lgError($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write"); } } catch (Exception exc) diff --git a/IOB-WIN-NEXT/UAClient.cs b/IOB-WIN-NEXT/UAClient.cs index bafcc513..cc101a59 100644 --- a/IOB-WIN-NEXT/UAClient.cs +++ b/IOB-WIN-NEXT/UAClient.cs @@ -185,7 +185,7 @@ namespace IOB_WIN_NEXT { eh_MonItChange(this, new opcUaMonitItemChange(monitoredItem, notification)); } - lgDebug($"Notification Received | Variable: {monitoredItem.DisplayName} | Value: {notification.Value}"); + lgTrace($"Notification Received | Variable: {monitoredItem.DisplayName} | Value: {notification.Value}"); } catch (Exception ex) { @@ -224,10 +224,16 @@ namespace IOB_WIN_NEXT protected void lgDebug(string message) { lg.Factory.Configuration.Variables["codIOB"] = currIob; - //if (isLogVerbose) - //{ lg.Info(message); - //} + } + /// + /// Effettua logging TRACE corretto impostanto anche la variabile IOB prima di scrivere... + /// + /// + protected void lgTrace(string message) + { + lg.Factory.Configuration.Variables["codIOB"] = currIob; + lg.Trace(message); } #endregion Protected Methods @@ -261,15 +267,15 @@ namespace IOB_WIN_NEXT NodeId nodeToBrowse = new NodeId(startNodeVal, startNodeNS); // Call Browse service - lgInfo($"Browsing {nodeToBrowse} node..."); + lgTrace($"Browsing {nodeToBrowse} node..."); ReferenceDescriptionCollection browseResults = browser.Browse(nodeToBrowse); // Display the results - lgInfo($"Browse returned {browseResults.Count} results:"); + lgTrace($"Browse returned {browseResults.Count} results:"); foreach (ReferenceDescription result in browseResults) { - lgDebug($" NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}"); + lgTrace($" NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}"); // se NON fa parte dell'elenco dei VETO di filterItems... if (!vetoBrowse.Contains($"{result.NodeId}")) { @@ -318,23 +324,23 @@ namespace IOB_WIN_NEXT NodeId nodeToBrowse = new NodeId(browsePath); // Call Browse service - lgInfo($"Browsing {nodeToBrowse} node..."); + lgTrace($"Browsing {nodeToBrowse} node..."); ReferenceDescriptionCollection browseResults = browser.Browse(nodeToBrowse); // Display the results - lgInfo($"Browse returned {browseResults.Count} results:"); + lgTrace($"Browse returned {browseResults.Count} results:"); foreach (ReferenceDescription result in browseResults) { // se veto --> loggo veto if (vetoBrowse.Contains($"{result.NodeId}")) { - lgDebug($"| FILTERED --> NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}"); + lgTrace($"| FILTERED --> NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}"); } // se NON fa parte dell'elenco dei VETO di filterItems... else { - lgDebug($" NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}"); + lgTrace($" NodeId = {result.NodeId}, DisplayName = {result.DisplayName.Text}, NodeClass = {result.NodeClass}, Others: {result.BinaryEncodingId} | {result.BrowseName}"); // se mancasse aggiungo... if (!nodeIdNameList.ContainsKey($"{result.NodeId}")) { @@ -449,7 +455,7 @@ namespace IOB_WIN_NEXT catch (Exception ex) { // Log Error - lgInfo($"Create Session Error : {ex.Message}"); + lgError($"Create Session Error : {ex.Message}"); return false; } } @@ -474,7 +480,7 @@ namespace IOB_WIN_NEXT } else { - lgInfo("Session not created!"); + lgError("Session not created!"); } } catch (Exception ex) @@ -603,7 +609,7 @@ namespace IOB_WIN_NEXT // Display the results. foreach (DataValue result in resultsValues) { - lgDebug($"Read Value = {result.Value} , StatusCode = {result.StatusCode}"); + lgTrace($"Read Value = {result.Value} , StatusCode = {result.StatusCode}"); } #endregion Read a node by calling the Read Service @@ -611,10 +617,10 @@ namespace IOB_WIN_NEXT #region Read the Value attribute of a node by calling the Session.ReadValue method // Read Server NamespaceArray - lgInfo("Reading Value of NamespaceArray node..."); + lgTrace("Reading Value of NamespaceArray node..."); DataValue namespaceArray = m_session.ReadValue(Variables.Server_NamespaceArray); // Display the result - lgInfo($"NamespaceArray Value = {namespaceArray}"); + lgTrace($"NamespaceArray Value = {namespaceArray}"); #endregion Read the Value attribute of a node by calling the Session.ReadValue method }