diff --git a/IOB-UT-NEXT/RedisMan.cs b/IOB-UT-NEXT/RedisMan.cs index bdce5f00..46c4e4ea 100644 --- a/IOB-UT-NEXT/RedisMan.cs +++ b/IOB-UT-NEXT/RedisMan.cs @@ -1019,11 +1019,11 @@ namespace IOB_UT_NEXT public bool saveAndSendMessage(string memKey, string notifyChannel, string message) { bool fatto = false; - // effettuo la scrittura nell'area di memoria indicata SE passato intervallo minimo + // effettuo la scrittura nell'area di memoria indicata SE passato intervallo minimo di 5 sec bool doSave = true; if (LastKeySave.ContainsKey(memKey)) { - if (DateTime.Now.Subtract(LastKeySave[memKey]).TotalSeconds < 1) + if (DateTime.Now.Subtract(LastKeySave[memKey]).TotalSeconds < 5) { doSave = false; } @@ -1036,7 +1036,7 @@ namespace IOB_UT_NEXT { cache.StringSet(memKey, message); LastKeySave[memKey] = DateTime.Now; - Logging.Instance.Trace($"Redis Cache Key: {memKey}"); + Logging.Instance.Trace($"Redis Cache Key saved: {memKey}"); } // invio notifica tramite il canale richiesto diff --git a/IOB-WIN-NEXT/DATA/CONF/3024-PING.ini b/IOB-WIN-NEXT/DATA/CONF/3024-PING.ini new file mode 100644 index 00000000..cc4abec9 --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/3024-PING.ini @@ -0,0 +1,57 @@ +;Configurazione IOB-WIN +[IOB] +CNCTYPE=PingWatchdog +PING_MS_TIMEOUT=500 +IOB_NAME=3024 + +[MACHINE] +VENDOR=STEAMWARE +MODEL=WATCHDOG + +[CNC] +IP=192.168.0.68 +;IP=192.168.1.7 Server MP +PORT=0000 + +[SERVER] +MPIP=http://192.168.1.7 +MPURL=/MP/IO +CMDBASE=/IOB/input/ +CMDFLOG=/IOB/flog/ +CMDALIVE=/IOB +CMDENABLED=/IOB/enabled/ +CMDADV1=?valore= +CMDREBO=/sendReboot.aspx?idxMacchina= +CMD_ODL_STARTED=/IOB/getCurrOdlStart/ +CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/ +CMD_IDLE_TIME=/IOB/getIdlePeriod/ + +[MEMORY] + +[BLINK] +MAX_COUNTER_BLINK = 15 +BLINK_FILT=0 + +[OPTPAR] +timerIntMs=300 +VETO_QUEUE_IN=15 +AUTO_CHANGE_ODL=false +POWEROFF_TIMEOUT_SEC=60 +DISABLE_PZCOUNT=TRUE +;; gestioni PING +;MAX_TRY_PING=3 +;VETO_QUEUE_IN=4 +;VETO_PING_SEC=4 +;VETO_CHECKDIR_SEC=10 +;MAX_ELAPSED_TIME_SEC=60 +;VETO_SEND_SNAPSHOT=3 + +[BRANCH] +NAME=master + +; Tags manuali +[TAGS] +Customer=JETCO +HostOS=WIN +HostName=IOB-WIN-09 +HostAddr=192.168.1.133 diff --git a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini index 75b7f677..ca3e62ec 100644 --- a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini +++ b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini @@ -51,6 +51,7 @@ CLI_INST=SteamWareSim ;STARTLIST=2014 ;STARTLIST=Tend_RAMA_10_47 ;STARTLIST=3024 +;STARTLIST=3024-PING STARTLIST=2015 diff --git a/IOB-WIN-NEXT/DATA/CONF/PING.ini b/IOB-WIN-NEXT/DATA/CONF/PING.ini index dcf81672..1a4c140e 100644 --- a/IOB-WIN-NEXT/DATA/CONF/PING.ini +++ b/IOB-WIN-NEXT/DATA/CONF/PING.ini @@ -37,6 +37,14 @@ BLINK_FILT=0 VETO_QUEUE_IN=15 AUTO_CHANGE_ODL=false POWEROFF_TIMEOUT_SEC=60 +DISABLE_PZCOUNT=TRUE +;; gestioni PING +;MAX_TRY_PING=3 +;VETO_QUEUE_IN=4 +;VETO_PING_SEC=4 +;VETO_CHECKDIR_SEC=10 +;MAX_ELAPSED_TIME_SEC=60 +;VETO_SEND_SNAPSHOT=3 [BRANCH] diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index 5e643ecb..bed6ca1c 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -637,6 +637,9 @@ + + Always + diff --git a/IOB-WIN-NEXT/Iob/BaseObj.cs b/IOB-WIN-NEXT/Iob/BaseObj.cs index 07a3e6f9..9e025cb1 100644 --- a/IOB-WIN-NEXT/Iob/BaseObj.cs +++ b/IOB-WIN-NEXT/Iob/BaseObj.cs @@ -36,7 +36,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Debug(message); if (sendToForm) { @@ -56,7 +56,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Debug(message, args); sendToLogWatch("DEBUG", message, args); } @@ -72,7 +72,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Error(message); if (sendToForm) { @@ -92,7 +92,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Error(message, args); sendToLogWatch("ERROR", message, args); } @@ -110,7 +110,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Error(exception, message, args); sendToLogWatch("ERROR", message, exception, args); } @@ -126,7 +126,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Fatal(message); if (sendToForm) { @@ -146,7 +146,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Fatal(message, args); sendToLogWatch("FATAL", message, args); } @@ -164,7 +164,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Fatal(exception, message, args); sendToLogWatch("FATAL", message, exception, args); } @@ -180,7 +180,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Info(message); if (sendToForm) { @@ -200,7 +200,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Info(message, args); sendToLogWatch("INFO", message, args); } @@ -217,7 +217,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; DateTime adesso = DateTime.Now; if (adesso.Subtract(lastLogStartup).TotalMinutes > vetoLogStartupDuration) { @@ -246,7 +246,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; DateTime adesso = DateTime.Now; if (adesso.Subtract(lastLogStartup).TotalMinutes > vetoLogStartupDuration) { @@ -271,7 +271,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Trace(message); if (sendToForm) { @@ -291,7 +291,7 @@ namespace IOB_WIN_NEXT.Iob // se non ho veto --> loggo if (!doVeto) { - lg.Factory.Configuration.Variables["codIOB"] = cIobConf.codIOB; + lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB; lg.Trace(message, args); sendToLogWatch("TRACE", message, args); } diff --git a/IOB-WIN-NEXT/IobNet/Ping.cs b/IOB-WIN-NEXT/IobNet/Ping.cs index f2f76cf9..50823d43 100644 --- a/IOB-WIN-NEXT/IobNet/Ping.cs +++ b/IOB-WIN-NEXT/IobNet/Ping.cs @@ -1,8 +1,11 @@ using IOB_UT_NEXT; using MapoSDK; using System; +using System.Diagnostics; using System.Linq; using System.Net.NetworkInformation; +using System.Threading; +using System.Threading.Tasks; namespace IOB_WIN_NEXT.IobNet { @@ -68,45 +71,55 @@ namespace IOB_WIN_NEXT.IobNet /// public override void readSemafori(ref newDisplayData currDispData) { + int msVeto = 5000; + Stopwatch sw = new Stopwatch(); + DateTime adesso = DateTime.Now; + //lgInfo($"readSemafori | {adesso}"); + sw.Start(); byte[] MemBlock = new byte[2]; - try + if (adesso.Subtract(lastPING).TotalMilliseconds >= msVeto) { - currDispData.semIn = Semaforo.SV; - // in primis salvo data ping comunque... - lastPING = DateTime.Now; + try + { + currDispData.semIn = Semaforo.SV; + // in primis salvo data ping comunque... + lastPING = DateTime.Now; + // salvo esito ping + bool pingOK = testPingMachine == IPStatus.Success; + addTest(pingOK); - // salvo esito ping - bool pingOK = testPingMachine == IPStatus.Success; - addTest(pingOK); + // se passa il ping faccio il resto... + if (pingStatusOk()) + { + connectionOk = true; + lastReadPLC = DateTime.Now; + lastWatchDog = DateTime.Now; + } + else + { + connectionOk = false; + } - // se passa il ping faccio il resto... - if (pingStatusOk()) - { - connectionOk = true; - lastReadPLC = DateTime.Now; - lastWatchDog = DateTime.Now; + if (connectionOk) + { + B_input = 1; + } + else + { + B_input = 0; + } + // annullo lettura bit signal IN pre/post x evitare invio automatico... + B_output = B_input; + B_previous = B_input; } - else + catch { - connectionOk = false; + currDispData.semIn = Semaforo.SR; } - - if (connectionOk) - { - B_input = 1; - } - else - { - B_input = 0; - } - // annullo lettura bit signal IN pre/post x evitare invio automatico... - B_output = B_input; - B_previous = B_input; - } - catch - { - currDispData.semIn = Semaforo.SR; } + sw.Stop(); + // fermo per una quota del tempo di attesa previsto + Task.Delay(msVeto - (int)sw.ElapsedMilliseconds + 20); } public override void startAdapter(bool resetQueue) diff --git a/IOB-WIN-NEXT/postBuildTgt.bat b/IOB-WIN-NEXT/postBuildTgt.bat index 2bce0d9d..74b6f2a8 100644 --- a/IOB-WIN-NEXT/postBuildTgt.bat +++ b/IOB-WIN-NEXT/postBuildTgt.bat @@ -73,8 +73,8 @@ REM IOBVPN4MACHINE REM ROBOCOPY . \\10.51.90.5\Steamware\IOB-WIN-NEXT-DEB /MIR REM ROBOCOPY . \\10.51.90.5\Steamware\IOB-WIN-NEXT-DEB /MIR /log:RobocopyTransfer.log REM ROBOCOPY . Z:\IOB-WIN-NEXT-DEB /MIR -REM ROBOCOPY . \\10.51.90.9\Steamware\IOB-WIN-NEXT-DEB /MIR -ROBOCOPY . \\10.51.90.10\Steamware\IOB-WIN-NEXT-DEB /MIR +ROBOCOPY . \\10.51.90.9\Steamware\IOB-WIN-NEXT-DEB /MIR +REM ROBOCOPY . \\10.51.90.10\Steamware\IOB-WIN-NEXT-DEB /MIR goto END