From ae37112e92f4eb9444549bed67d1e4ff41311328 Mon Sep 17 00:00:00 2001 From: "S.E.Locatelli" Date: Tue, 28 Jun 2022 17:44:31 +0200 Subject: [PATCH] Cedax: - test lettura parametri dosaggio - ok lettura - fix lettura interi singoli da LUT --- IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001.json | 24 +++++++-------- .../DATA/CONF/GIACO_CEDAX_001_MBlock.json | 3 +- IOB-WIN-NEXT/DATA/CONF/MAIN.ini | 2 +- IOB-WIN-NEXT/IobModbusTCP.cs | 29 +++++++++++++++---- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001.json index aa2a4de8..f87b97c7 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001.json @@ -19,7 +19,7 @@ "Stag_Prod1": { "name": "Stag_Prod1", "description": "Totale Prodotto 1 Stagione", - "memAddr": "40003", + "memAddr": "41003", "tipoMem": "HLPInt", "index": 1003, "size": 2, @@ -33,7 +33,7 @@ "Stag_Prod2": { "name": "Stag_Prod2", "description": "Totale Prodotto 2 Stagione", - "memAddr": "40005", + "memAddr": "41005", "tipoMem": "HLPInt", "index": 1005, "size": 2, @@ -47,7 +47,7 @@ "Stag_Prod3": { "name": "Stag_Prod3", "description": "Totale Prodotto 3 Stagione", - "memAddr": "40007", + "memAddr": "41007", "tipoMem": "HLPInt", "index": 1007, "size": 2, @@ -61,7 +61,7 @@ "Stag_Prod4": { "name": "Stag_Prod4", "description": "Totale Prodotto 4 Stagione", - "memAddr": "40009", + "memAddr": "41009", "tipoMem": "HLPInt", "index": 1009, "size": 2, @@ -89,7 +89,7 @@ "Giorno_Prod1": { "name": "Giorno_Prod1", "description": "Totale Prodotto 1 Giorno", - "memAddr": "40013", + "memAddr": "41013", "tipoMem": "HLPInt", "index": 1013, "size": 2, @@ -103,7 +103,7 @@ "Giorno_Prod2": { "name": "Giorno_Prod2", "description": "Totale Prodotto 2 Giorno", - "memAddr": "40015", + "memAddr": "41015", "tipoMem": "HLPInt", "index": 1015, "size": 2, @@ -131,9 +131,9 @@ "Giorno_Prod4": { "name": "Giorno_Prod4", "description": "Totale Prodotto 4 Giorno", - "memAddr": "41021", + "memAddr": "41019", "tipoMem": "HLPInt", - "index": 1021, + "index": 1019, "size": 2, "func": "MEDIAN", "period": 90, @@ -145,9 +145,9 @@ "Dose_Staz_1": { "name": "Dose_Staz_1", "description": "Dose Stazione 1", - "memAddr": "41024", + "memAddr": "40024", "tipoMem": "Int", - "index": 1024, + "index": 24, "size": 1, "func": "MEDIAN", "period": 90, @@ -159,9 +159,9 @@ "Dose_Staz_2": { "name": "Dose_Staz_2", "description": "Dose Stazione 1", - "memAddr": "41025", + "memAddr": "40025", "tipoMem": "Int", - "index": 1025, + "index": 25, "size": 1, "func": "MEDIAN", "period": 90, diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001_MBlock.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001_MBlock.json index b5e46ee5..6ce9d4fd 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001_MBlock.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_CEDAX_001_MBlock.json @@ -1,5 +1,6 @@ { "ReadBlocks": { - "40999": 30 + "40016": 16, + "40999": 32 } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini index 393aa309..69ef5324 100644 --- a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini +++ b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini @@ -82,6 +82,6 @@ CLI_INST=SteamWareSim ;STARTLIST=GIACO_ICOEL_002 ;STARTLIST=GIACO_CENTERFRIGO ;STARTLIST=GIACO_NWSE -STARTLIST=GIACO_ICOEL_002 +STARTLIST=GIACO_CEDAX_001 MAXCNC=10 \ No newline at end of file diff --git a/IOB-WIN-NEXT/IobModbusTCP.cs b/IOB-WIN-NEXT/IobModbusTCP.cs index 67dc3df8..78a4141f 100644 --- a/IOB-WIN-NEXT/IobModbusTCP.cs +++ b/IOB-WIN-NEXT/IobModbusTCP.cs @@ -255,7 +255,7 @@ namespace IOB_WIN_NEXT var currState = currAlarmsState(item); // calcolo vettore stringa degli allarmi... bankVal = getAlarmState(item, currState); - bankVal = string.IsNullOrEmpty(bankVal) ? "OK":bankVal; + bankVal = string.IsNullOrEmpty(bankVal) ? "OK" : bankVal; saveAlarmString(ref outVal, bankVal, item.description); } } @@ -1293,15 +1293,32 @@ namespace IOB_WIN_NEXT if (useLUT) { int lutAddress = 40000 + item.Value.index + deltaBase; - if (HoldingRegisterLUT.ContainsKey(lutAddress)) + // se size = 1 --> devo cambiare modo recupero + if (item.Value.size == 1) { - try + if (item.Value.index % 2 == 0) { - listInt = HoldingRegisterLUT[lutAddress]; + //Array.Copy(HoldingRegisterLUT[lutAddress], listInt, 1); + Array.Copy(HoldingRegisterLUT[lutAddress], 0, listInt, 0, 1); } - catch (Exception exc) + else { - lgError($"Errore in lettura da HoldingRegisterLUT per indirizzo {lutAddress} | item {item.Key}{Environment.NewLine}{exc}"); + lutAddress--; + Array.Copy(HoldingRegisterLUT[lutAddress], 1,listInt, 0, 1); + } + } + else + { + if (HoldingRegisterLUT.ContainsKey(lutAddress)) + { + try + { + listInt = HoldingRegisterLUT[lutAddress]; + } + catch (Exception exc) + { + lgError($"Errore in lettura da HoldingRegisterLUT per indirizzo {lutAddress} | item {item.Key}{Environment.NewLine}{exc}"); + } } } }