From 464ad6ae84ebf52bbd318b7b2afc53e6f187f193 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Wed, 4 Aug 2021 11:25:21 +0200 Subject: [PATCH 1/2] fix gitspread --- gitSpread.bat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gitSpread.bat b/gitSpread.bat index 9f9008b1..1697dc8b 100644 --- a/gitSpread.bat +++ b/gitSpread.bat @@ -20,10 +20,10 @@ REM Faccio push remoto condizionale if %pushRemote% GTR 0 ( git push gitlab.steamware %baseBranch%:%baseBranch% ) if %pushRemote% GTR 1 ( git push gitlab.steamware %baseBranch%:develop ) -if %pushRemote% GTR 2 ( git push gitlab.steamware %baseBranch%:IOB-NET ) -if %pushRemote% GTR 2 ( git push gitlab.steamware %baseBranch%:IOB/OPC-UA ) -if %pushRemote% GTR 2 ( git push gitlab.steamware %baseBranch%:IOB/Euromap63 ) -if %pushRemote% GTR 2 ( git push gitlab.steamware %baseBranch%:IOB/MTC ) +REM if %pushRemote% GTR 2 ( git push gitlab.steamware %baseBranch%:IOB-NET ) +REM if %pushRemote% GTR 2 ( git push gitlab.steamware %baseBranch%:IOB/OPC-UA ) +REM if %pushRemote% GTR 2 ( git push gitlab.steamware %baseBranch%:IOB/Euromap63 ) +REM if %pushRemote% GTR 2 ( git push gitlab.steamware %baseBranch%:IOB/MTC ) if %pushRemote% GTR 1 ( git push gitlab.steamware %baseBranch%:IobMan ) if %pushRemote% GTR 1 ( git push gitlab.steamware %baseBranch%:master ) From 0a9ab4fe288b05a3a746c3fd6b113d6a51fc2e49 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 5 Aug 2021 18:54:26 +0200 Subject: [PATCH 2/2] Revisione metodo calcolo delle TSeries VC --- IOB-WIN-NEXT/IobGeneric.cs | 156 ++++++++++++++++++++++--------------- 1 file changed, 93 insertions(+), 63 deletions(-) diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 5527a2a8..6d3911f7 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -149,6 +149,11 @@ namespace IOB_WIN_NEXT /// public bool adpTryRestart; + /// + /// Struttura allarmi mappati + /// + public List alarmMaps = new List(); + /// /// Conf adapter corrente /// @@ -274,11 +279,6 @@ namespace IOB_WIN_NEXT /// public plcMemMap memMap; - /// - /// Struttura allarmi mappati - /// - public List alarmMaps = new List(); - /// /// Minimo numero di px da inviare in blocco /// @@ -1191,26 +1191,6 @@ namespace IOB_WIN_NEXT } } - /// - /// URL per INVIO di un update dello status di un certo allarme - /// - public string urlSendAlarm - { - get - { - string answ = ""; - try - { - answ = string.Format(@"http://{0}{1}{2}/sendAlarmBankUpdate/{3}", cIobConf.serverData.MPIP, cIobConf.serverData.MPURL, cIobConf.serverData.CMDALIVE, cIobConf.codIOB); - } - catch (Exception exc) - { - lgError(exc, "Errore in composizione urlAddPzCount"); - } - return answ; - } - } - /// /// URL per check alive... /// @@ -1455,6 +1435,26 @@ namespace IOB_WIN_NEXT } } + /// + /// URL per INVIO di un update dello status di un certo allarme + /// + public string urlSendAlarm + { + get + { + string answ = ""; + try + { + answ = string.Format(@"http://{0}{1}{2}/sendAlarmBankUpdate/{3}", cIobConf.serverData.MPIP, cIobConf.serverData.MPURL, cIobConf.serverData.CMDALIVE, cIobConf.codIOB); + } + catch (Exception exc) + { + lgError(exc, "Errore in composizione urlAddPzCount"); + } + return answ; + } + } + /// /// URL per salvataggio dati associazione Machine 2 IOB... /// @@ -2629,7 +2629,6 @@ namespace IOB_WIN_NEXT lgInfo("loadMemConf: non trovata opzione PARAM_CONF in file INI"); } - // loggo lgInfo("DONE loadMemConf"); } @@ -2773,35 +2772,6 @@ namespace IOB_WIN_NEXT sendOptVal(paramName, paramValueInt.ToString()); } - /// - /// Invio la variazione dellos tato allarmi (se avvenuta) - /// - /// - /// - /// - /// - /// - public bool sendAlarmVariations(string memAddr, int index, int lastStatus, int currStatus) - { - bool fatto = false; - if (lastStatus != currStatus) - { - // invio GET del MemoryAddress, del banco e del valore currStatus - lastUrl = $"{urlSendAlarm}?memAddr={memAddr}&index={index}&currStatus={currStatus}"; - string resp = utils.callUrlNow(lastUrl); - if (!string.IsNullOrEmpty(resp)) - { - if (resp == "OK") - { - // segnalo fatto - fatto = true; - } - } - } - return fatto; - } - - /// /// Invia messaggio a logWatcher /// @@ -2872,8 +2842,6 @@ namespace IOB_WIN_NEXT fixDefaultPar(); } - - /// /// setup gestione allarmi da conf /// @@ -2889,7 +2857,7 @@ namespace IOB_WIN_NEXT } // invio oggetto alarmMap al server x successiva decodifica - // FIXME TODO FARE !!!! invio PUT del file *_alarm.json + // FIXME TODO FARE !!!! invio PUT del file *_alarm.json } /// @@ -3638,15 +3606,49 @@ namespace IOB_WIN_NEXT /// public double getVal_TSVC(string VCName, bool doReset) { - double answ = 0; + double answ = -999999; // cerco VC... if (TSVC_Data.ContainsKey(VCName)) { - // !!!FARE!!! vero calcolo... x ora FIX a MAX... - foreach (var item in TSVC_Data[VCName].dataArray) + try { - answ = item > answ ? item : answ; + switch (TSVC_Data[VCName].Funzione) + { + case VC_func.POINT: + // prendo PRIMO + answ = TSVC_Data[VCName].dataArray.FirstOrDefault(); + break; + + case VC_func.AVG: + answ = TSVC_Data[VCName].dataArray.Average(); + break; + + case VC_func.MIN: + answ = TSVC_Data[VCName].dataArray.Min(); +#if false + answ = Double.MaxValue; + foreach (var item in TSVC_Data[VCName].dataArray) + { + answ = item > answ ? item : answ; + } +#endif + break; + + case VC_func.MAX: + default: + answ = TSVC_Data[VCName].dataArray.Max(); +#if false + answ = Double.MinValue; + foreach (var item in TSVC_Data[VCName].dataArray) + { + answ = item > answ ? item : answ; + } +#endif + break; + } } + catch + { } // ora resetto... SE richiesto... if (doReset) { @@ -4464,7 +4466,7 @@ namespace IOB_WIN_NEXT } /// - /// + /// Effettua salvataggio in LUT del valore ricevuto /// /// /// @@ -4487,6 +4489,34 @@ namespace IOB_WIN_NEXT LastTSVC[chiave] = valore; } + /// + /// Invio la variazione dellos tato allarmi (se avvenuta) + /// + /// + /// + /// + /// + /// + public bool sendAlarmVariations(string memAddr, int index, int lastStatus, int currStatus) + { + bool fatto = false; + if (lastStatus != currStatus) + { + // invio GET del MemoryAddress, del banco e del valore currStatus + lastUrl = $"{urlSendAlarm}?memAddr={memAddr}&index={index}&currStatus={currStatus}"; + string resp = utils.callUrlNow(lastUrl); + if (!string.IsNullOrEmpty(resp)) + { + if (resp == "OK") + { + // segnalo fatto + fatto = true; + } + } + } + return fatto; + } + /// /// Invia una LISTA di valori ///