From 2cef255ea9f068b2275deeb45dc18da623d2d77f Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Thu, 6 Apr 2017 13:49:43 +0200 Subject: [PATCH] Aggiunta gestione stato pompe (ON/OFF) --- MTC_Adapter/MTC_Adapter/AdapterESA.cs | 33 ++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/MTC_Adapter/MTC_Adapter/AdapterESA.cs b/MTC_Adapter/MTC_Adapter/AdapterESA.cs index 0306d44..af08d19 100644 --- a/MTC_Adapter/MTC_Adapter/AdapterESA.cs +++ b/MTC_Adapter/MTC_Adapter/AdapterESA.cs @@ -506,6 +506,37 @@ namespace MTC_Adapter currProgName = vettMemArea[bitNum].mMemAreaProgName.Value.ToString(); } } + else if (mapIOT_Byte[i].varName.StartsWith("IOT_VAC_")) + { + // recupero NUMERO + try + { + numero = Convert.ToInt32(mapIOT_Byte[i].varName.Replace("IOT_VAC_", "")); + // controllo SE ha bit = 1 รจ ON.. + string VacStat = ""; + if (((StFlag8)currByte).HasFlag((StFlag8)Math.Pow(2, bitNum))) + { + VacStat = "ON"; + } + else + { + VacStat = "OFF"; + } + // salvo in vettore SE possibile... + if (numero <= vettVacPump.Length) + { + vettVacPump[numero - 1].mVacPumpStatus.Value = VacStat; + } + else + { + lg.Error("Errore in inserimento vettore " + mapIOT_Byte[i].varName); + } + } + catch (Exception exc) + { + lg.Error(exc, "Errore in decodifica " + mapIOT_Byte[i].varName); + } + } } } @@ -676,7 +707,7 @@ namespace MTC_Adapter { numero = Convert.ToInt32(mapIOT_Word[i].varName.Replace("IOT_C_H_VAC_", "")); // salvo in vettore SE possibile... - if (numero <= vettVacAct.Length) + if (numero <= vettVacPump.Length) { vettVacPump[numero - 1].mVacPumpWrkTime.Value = ncDevice.PLC_MemoryAreaIOT_Word[byteNum]; }