Merge branch 'release/PingAddParamBit_01'

This commit is contained in:
Samuele Locatelli
2025-06-19 10:31:22 +02:00
12 changed files with 160 additions and 18 deletions
+16
View File
@@ -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<string, string> optParRead = new Dictionary<string, string>();
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"))
{
+31
View File
@@ -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
/// <summary>
/// Valore output da inviare in caso di PowerOff da check PING
/// </summary>
public int B_PowerOff { get; set; } = 0;
/// <summary>
/// Valore output da inviare in caso di PowerOn da check PING
/// es: 1 (Emergenza a 1 se presente), 129 (B7 = Emergenza armata)
/// </summary>
public int B_PowerOn { get; set; } = 1;
/// <summary>
/// Veto tra controlli segnale ping x evitare flood in secondi
/// </summary>
public int VetoCheckSec { get; set; } = 5;
#endregion Public Properties
}
}
@@ -60,5 +60,10 @@ namespace IOB_UT_NEXT.Config.Special
/// </summary>
public SiemensDto SiemensConf { get; set; }
/// <summary>
/// Configurazione specifica adapter PING
/// </summary>
public PingDto PingConf { get; set; }
}
}
+1
View File
@@ -173,6 +173,7 @@
<Compile Include="Config\IobConfTree.cs" />
<Compile Include="Config\Mem\MemAreaDto.cs" />
<Compile Include="Config\Special\ActionDto.cs" />
<Compile Include="Config\Special\PingDto.cs" />
<Compile Include="Config\Special\FtpDto.cs" />
<Compile Include="Config\Special\MemBankDto.cs" />
<Compile Include="Config\Special\SpecializedDto.cs" />
+1 -1
View File
@@ -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
+22 -5
View File
@@ -14,6 +14,10 @@ namespace IOB_WIN_FORM.Iob
{
#region Public Constructors
private int bInOff = 0;
private int bInOn = 1;
private int vetoCheckSec = 5;
/// <summary>
/// Estende l'init della classe base
/// </summary>
@@ -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
/// </summary>
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)
+61
View File
@@ -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
+3
View File
@@ -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
+2 -2
View File
@@ -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
+4
View File
@@ -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]
+3
View File
@@ -142,6 +142,9 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="DATA\CONF\3024-PING.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_07.ini" />
<None Include="DATA\CONF\SIMUL_07.json" />
<None Include="DATA\CONF\SIMUL_08.ini">
+11 -10
View File
@@ -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