diff --git a/IOB-UT-NEXT/Config/IobConfTree.cs b/IOB-UT-NEXT/Config/IobConfTree.cs index 0635f246..7423af4b 100644 --- a/IOB-UT-NEXT/Config/IobConfTree.cs +++ b/IOB-UT-NEXT/Config/IobConfTree.cs @@ -484,6 +484,21 @@ namespace IOB_UT_NEXT.Config bool doExclOptPar = bool.Parse(fIni.ReadString("OPTPAR", "DO_EXCLUDE_OPT_PAR", "true")); exclOptPar.Add("DO_EXCLUDE_OPT_PAR"); + + // se è tipo ping + if (newConfObj.General.IobType == tipoAdapter.PingWatchdog) + { + // verifico SE ci siano in optPar indicazioni x valori da inviare al poweron/poweroff + newConfObj.Special.PingConf = new PingDto(); + newConfObj.Special.PingConf.B_PowerOff = fIni.ReadInteger("OPTPAR", "B_IN_OFF", 0); + newConfObj.Special.PingConf.B_PowerOn = fIni.ReadInteger("OPTPAR", "B_IN_ON", 1); + newConfObj.Special.PingConf.VetoCheckSec = fIni.ReadInteger("OPTPAR", "VETO_PING_SEC", 5); + } + exclOptPar.Add("B_IN_OFF"); + exclOptPar.Add("B_IN_ON"); + exclOptPar.Add("VETO_PING_SEC"); + + // caricamento finale OptPar Dictionary optParRead = new Dictionary(); string[] optParRows = fIni.ReadSection("OPTPAR"); @@ -632,6 +647,7 @@ namespace IOB_UT_NEXT.Config newConfObj.Special.SiemensConf.MemSizeWrite = fIni.ReadInteger("MEMORY", "SIZE_WRITE", 0); } + // parametri opzionali OpcUA if (optParRead.ContainsKey("OPC_PARAM_CONF")) { diff --git a/IOB-UT-NEXT/Config/Special/PingDto.cs b/IOB-UT-NEXT/Config/Special/PingDto.cs new file mode 100644 index 00000000..7c10dca6 --- /dev/null +++ b/IOB-UT-NEXT/Config/Special/PingDto.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace IOB_UT_NEXT.Config.Special +{ + public class PingDto + { + #region Public Properties + + /// + /// Valore output da inviare in caso di PowerOff da check PING + /// + public int B_PowerOff { get; set; } = 0; + + /// + /// Valore output da inviare in caso di PowerOn da check PING + /// es: 1 (Emergenza a 1 se presente), 129 (B7 = Emergenza armata) + /// + public int B_PowerOn { get; set; } = 1; + + /// + /// Veto tra controlli segnale ping x evitare flood in secondi + /// + public int VetoCheckSec { get; set; } = 5; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/IOB-UT-NEXT/Config/Special/SpecializedDto.cs b/IOB-UT-NEXT/Config/Special/SpecializedDto.cs index e7ad0c98..ed5ecba5 100644 --- a/IOB-UT-NEXT/Config/Special/SpecializedDto.cs +++ b/IOB-UT-NEXT/Config/Special/SpecializedDto.cs @@ -60,5 +60,10 @@ namespace IOB_UT_NEXT.Config.Special /// public SiemensDto SiemensConf { get; set; } + /// + /// Configurazione specifica adapter PING + /// + public PingDto PingConf { get; set; } + } } diff --git a/IOB-UT-NEXT/IOB-UT-NEXT.csproj b/IOB-UT-NEXT/IOB-UT-NEXT.csproj index 8cf87a4f..d40bac24 100644 --- a/IOB-UT-NEXT/IOB-UT-NEXT.csproj +++ b/IOB-UT-NEXT/IOB-UT-NEXT.csproj @@ -173,6 +173,7 @@ + diff --git a/IOB-WIN-FORM/Iob/Generic.Protected.cs b/IOB-WIN-FORM/Iob/Generic.Protected.cs index 700da3c3..1530ef9f 100644 --- a/IOB-WIN-FORM/Iob/Generic.Protected.cs +++ b/IOB-WIN-FORM/Iob/Generic.Protected.cs @@ -3372,7 +3372,7 @@ namespace IOB_WIN_FORM.Iob rawData = JsonConvert.SerializeObject(allParam, Formatting.Indented); if (serverOk) { - // verifica se sia un IOB "parziale") + // verifica se sia un IOB "parziale" if (IOBConfFull.Device.DisabExeTask || IOBConfFull.Device.DisabStateCh) { // versione upsert diff --git a/IOB-WIN-FORM/Iob/PingWatchDog.cs b/IOB-WIN-FORM/Iob/PingWatchDog.cs index 55d6be34..21595418 100644 --- a/IOB-WIN-FORM/Iob/PingWatchDog.cs +++ b/IOB-WIN-FORM/Iob/PingWatchDog.cs @@ -14,6 +14,10 @@ namespace IOB_WIN_FORM.Iob { #region Public Constructors + private int bInOff = 0; + private int bInOn = 1; + private int vetoCheckSec = 5; + /// /// Estende l'init della classe base /// @@ -31,6 +35,10 @@ namespace IOB_WIN_FORM.Iob lastPING = adesso; lastDisconnCheck = adesso; PoweroffTimeoutSec = IOBConfFull.Device.PoweroffTimeOutSec; + // imposto i valori da inviare al controllo stato... + bInOff = IOBConfFull.Special.PingConf.B_PowerOff; + bInOn = IOBConfFull.Special.PingConf.B_PowerOn; + vetoCheckSec = IOBConfFull.Special.PingConf.VetoCheckSec; // fix coda ping PingQueue = new DataQueue("000", "PingQueue", false); lgDebug($"L'adapter effettuera' PING di controllo all'indirizzo {IOBConfFull.Device.Connect.IpAddr} per forzare stato poweroff dopo {PoweroffTimeoutSec} sec"); @@ -68,13 +76,22 @@ namespace IOB_WIN_FORM.Iob /// 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]; - if (adesso.Subtract(lastPING).TotalMilliseconds >= msVeto) + // faccio comunque ping se non ne ho collezionati a sufficienza... + if (PingQueue.Count < maxQueuePing) + { + // in primis salvo data ping comunque... + lastPING = DateTime.Now; + // salvo esito ping + bool pingOK = testPingMachine == IPStatus.Success; + addTest(pingOK); + } + + if (adesso.Subtract(lastPING).TotalSeconds >= vetoCheckSec) { try { @@ -99,11 +116,11 @@ namespace IOB_WIN_FORM.Iob if (connectionOk) { - B_input = 1; + B_input = bInOn; } else { - B_input = 0; + B_input = bInOff; } // annullo lettura bit signal IN pre/post x evitare invio automatico... B_output = B_input; @@ -116,7 +133,7 @@ namespace IOB_WIN_FORM.Iob } sw.Stop(); // fermo per una quota del tempo di attesa previsto - Task.Delay(msVeto - (int)sw.ElapsedMilliseconds + 20); + Task.Delay(vetoCheckSec - (int)sw.ElapsedMilliseconds + 20); } public override void startAdapter(bool resetQueue) diff --git a/IOB-WIN-PING/DATA/CONF/3024-PING.ini b/IOB-WIN-PING/DATA/CONF/3024-PING.ini new file mode 100644 index 00000000..bfec19d2 --- /dev/null +++ b/IOB-WIN-PING/DATA/CONF/3024-PING.ini @@ -0,0 +1,61 @@ +;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 +VETO_SIG_IN=false +B_IN_OFF=0 +B_IN_ON=129 +VETO_PING_SEC=6 + +[BRANCH] +NAME=master + +; Tags manuali +[TAGS] +Customer=JETCO +HostOS=WIN +HostName=IOB-WIN-09 +HostAddr=192.168.1.133 diff --git a/IOB-WIN-PING/DATA/CONF/FTP-PING.ini b/IOB-WIN-PING/DATA/CONF/FTP-PING.ini index 17b9926b..f0816111 100644 --- a/IOB-WIN-PING/DATA/CONF/FTP-PING.ini +++ b/IOB-WIN-PING/DATA/CONF/FTP-PING.ini @@ -48,6 +48,9 @@ DISABLE_PZCOUNT=TRUE ;MAX_ELAPSED_TIME_SEC=60 ;VETO_SEND_SNAPSHOT=3 VETO_SIG_IN=false +B_IN_OFF=0 +B_IN_ON=1 +VETO_PING_SEC=6 ;abbasso freq di base gestione timerIntMs=250 diff --git a/IOB-WIN-PING/DATA/CONF/MAIN.ini b/IOB-WIN-PING/DATA/CONF/MAIN.ini index a348446a..9768e165 100644 --- a/IOB-WIN-PING/DATA/CONF/MAIN.ini +++ b/IOB-WIN-PING/DATA/CONF/MAIN.ini @@ -15,10 +15,10 @@ CLI_INST=SteamWareSim [IOB] ;STARTLIST=PING -;STARTLIST=3024-PING ;STARTLIST=SIMUL_01 -STARTLIST=FTP-PING +;STARTLIST=FTP-PING ;STARTLIST=SIMUL_08 +STARTLIST=3024-PING MAXCNC=10 \ No newline at end of file diff --git a/IOB-WIN-PING/DATA/CONF/PING.ini b/IOB-WIN-PING/DATA/CONF/PING.ini index 1a4c140e..9dc25f5c 100644 --- a/IOB-WIN-PING/DATA/CONF/PING.ini +++ b/IOB-WIN-PING/DATA/CONF/PING.ini @@ -45,6 +45,10 @@ DISABLE_PZCOUNT=TRUE ;VETO_CHECKDIR_SEC=10 ;MAX_ELAPSED_TIME_SEC=60 ;VETO_SEND_SNAPSHOT=3 +VETO_SIG_IN=false +B_IN_OFF=0 +B_IN_ON=1 +VETO_PING_SEC=6 [BRANCH] diff --git a/IOB-WIN-PING/IOB-WIN-PING.csproj b/IOB-WIN-PING/IOB-WIN-PING.csproj index 8afe205b..21068841 100644 --- a/IOB-WIN-PING/IOB-WIN-PING.csproj +++ b/IOB-WIN-PING/IOB-WIN-PING.csproj @@ -142,6 +142,9 @@ Resources.resx True + + Always + diff --git a/IOB-WIN-PING/postBuildTgt.bat b/IOB-WIN-PING/postBuildTgt.bat index 3458a192..380311ad 100644 --- a/IOB-WIN-PING/postBuildTgt.bat +++ b/IOB-WIN-PING/postBuildTgt.bat @@ -29,23 +29,24 @@ REM copia script verso server remoto REM echo Debug remoto: effettuo robocopy sync (verificare remote per cliente) REM FINASSI -REM ROBOCOPY %2 \\10.150.0.1\Steamware\IOB-WIN-WPS-DEB /MIR +REM ROBOCOPY %2 \\10.150.0.1\Steamware\IOB-WIN-PING-DEB /MIR REM Baglietto -REM ROBOCOPY %2 \\192.168.60.15\Steamware\IOB-WIN-WPS-DEB /MIR +REM ROBOCOPY %2 \\192.168.60.15\Steamware\IOB-WIN-PING-DEB /MIR REM GIACOVELLI LOCOROTONDO -REM ROBOCOPY %2 \\192.168.1.93\Steamware\IOB-WIN-WPS-DEB /MIR +REM ROBOCOPY %2 \\192.168.1.93\Steamware\IOB-WIN-PING-DEB /MIR REM IMI Remosa -REM ROBOCOPY %2 \\192.168.0.12\Steamware\IOB-WIN-WPS-DEB /MIR +REM ROBOCOPY %2 \\192.168.0.12\Steamware\IOB-WIN-PING-DEB /MIR REM IOB-WIN-SIM -REM ROBOCOPY %2 \\IOB-WIN-SIMULA\Steamware\IOB-WIN-WPS-DEB /MIR +REM ROBOCOPY %2 \\IOB-WIN-SIMULA\Steamware\IOB-WIN-PING-DEB /MIR REM IOBVPN4MACHINE -REM ROBOCOPY %2 \\10.51.90.5\Steamware\IOB-WIN-WPS-DEB /MIR -REM ROBOCOPY %2 \\10.51.90.5\Steamware\IOB-WIN-WPS-DEB /MIR /log:RobocopyTransfer.log -REM ROBOCOPY %2 Z:\IOB-WIN-WPS-DEB /MIR -REM ROBOCOPY %2 \\10.51.90.10\Steamware\IOB-WIN-WPS-DEB /MIR -ROBOCOPY %2 \\10.51.90.9\Steamware\IOB-WIN-WPS-DEB /MIR +REM ROBOCOPY %2 \\10.51.90.5\Steamware\IOB-WIN-PING-DEB /MIR +REM ROBOCOPY %2 \\10.51.90.5\Steamware\IOB-WIN-PING-DEB /MIR /log:RobocopyTransfer.log +REM ROBOCOPY %2 Z:\IOB-WIN-PING-DEB /MIR +REM ROBOCOPY %2 \\10.51.90.10\Steamware\IOB-WIN-PING-DEB /MIR +REM ROBOCOPY %2 \\10.51.90.9\Steamware\IOB-WIN-PING-DEB /MIR +ROBOCOPY %2 \\10.51.90.16\Steamware\IOB-WIN-PING-DEB /MIR goto END