Merge branch 'release/IobPing'
This commit is contained in:
@@ -324,6 +324,11 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
OSAI_VB6,
|
||||
|
||||
/// <summary>
|
||||
/// Adapter tipo watchdog via ping (per impianti spenti e non rilevati)
|
||||
/// </summary>
|
||||
PingWatchdog,
|
||||
|
||||
/// <summary>
|
||||
/// Adapter SIEMENS
|
||||
/// </summary>
|
||||
|
||||
@@ -1222,6 +1222,11 @@ namespace IOB_WIN_NEXT
|
||||
start.Enabled = true;
|
||||
break;
|
||||
|
||||
case tipoAdapter.PingWatchdog:
|
||||
iobObj = new IobPing(this, IOBConf);
|
||||
start.Enabled = true;
|
||||
break;
|
||||
|
||||
case tipoAdapter.OSAI_OPEN:
|
||||
case tipoAdapter.OSAI_CNDEX:
|
||||
case tipoAdapter.OSAI_VB6:
|
||||
|
||||
@@ -71,5 +71,7 @@ CLI_INST=SteamWareSim
|
||||
;STARTLIST=OPC_UA
|
||||
;STARTLIST=SIM_PIZ03
|
||||
;STARTLIST=FOV062
|
||||
STARTLIST=FP_TR2
|
||||
STARTLIST=PING
|
||||
;STARTLIST=FP_TR2
|
||||
|
||||
MAXCNC=10
|
||||
@@ -0,0 +1,39 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=PingWatchdog
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=STEAMWARE
|
||||
MODEL=WATCHDOG
|
||||
|
||||
[CNC]
|
||||
IP=10.74.83.112
|
||||
PORT=0000
|
||||
|
||||
[SERVER]
|
||||
MPIP=http://10.74.82.218
|
||||
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]
|
||||
AUTO_CHANGE_ODL=false
|
||||
POWEROFF_TIMEOUT_SEC=180
|
||||
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
@@ -184,6 +184,7 @@
|
||||
<Compile Include="IobOmron.cs" />
|
||||
<Compile Include="IobOpcUaCMS.cs" />
|
||||
<Compile Include="IobOpcUaEwon.cs" />
|
||||
<Compile Include="IobPing.cs" />
|
||||
<Compile Include="IobSiemensAt2001.cs" />
|
||||
<Compile Include="IobSiemensComeca.cs" />
|
||||
<Compile Include="IobSiemensRobotService.cs" />
|
||||
@@ -409,6 +410,9 @@
|
||||
<None Include="DATA\CONF\PIZ08_alarm.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\PING.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIM_PIZ08.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
@@ -433,6 +433,7 @@ namespace IOB_WIN_NEXT
|
||||
if (DemoOut)
|
||||
{
|
||||
answ = (QueueIN.Count + QueueFLog.Count >= nMaxSend);
|
||||
IobOnline = answ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3589,6 +3590,7 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
currDispData.semIn = Semaforo.SR;
|
||||
processDisconnectedTask();
|
||||
}
|
||||
raiseRefresh(currDispData);
|
||||
}
|
||||
@@ -4105,6 +4107,13 @@ namespace IOB_WIN_NEXT
|
||||
public virtual void processContapezzi()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Task periodici SE disconnesso
|
||||
/// </summary>
|
||||
public virtual void processDisconnectedTask()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua processing del recupero dei valori dinamici:
|
||||
/// es: speed (RPM, feedrate) degli assi, valori pressioni, temeprature
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
using IOB_UT_NEXT;
|
||||
using MapoSDK;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_WIN_NEXT
|
||||
{
|
||||
public class IobPing : IobGeneric
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int PoweroffTimeoutSec = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Veto controllo status x log...
|
||||
/// </summary>
|
||||
protected DateTime vetoCheckStatus = DateTime.Now;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="IOBConf"></param>
|
||||
public IobPing(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
lgInfo("NEW IobPing (WatchDog)");
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
vetoCheckStatus = adesso;
|
||||
var POWEROFF_TIMEOUT_SEC = getOptPar("POWEROFF_TIMEOUT_SEC");
|
||||
if (!string.IsNullOrEmpty(POWEROFF_TIMEOUT_SEC))
|
||||
{
|
||||
int.TryParse(POWEROFF_TIMEOUT_SEC, out PoweroffTimeoutSec);
|
||||
}
|
||||
lgInfo($"L'adapter effettuera' PING di controllo all'indirizzo {IOBConf.cncIpAddr} per forzare stato poweroff dopo {PoweroffTimeoutSec} sec");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// metodo controllo ping lento, override AutoODL
|
||||
/// </summary>
|
||||
public override void processDisconnectedTask()
|
||||
{
|
||||
// effettuo check ping!
|
||||
DateTime adesso = DateTime.Now;
|
||||
if (adesso.Subtract(lastPING).TotalSeconds >= PoweroffTimeoutSec)
|
||||
{
|
||||
// invio poweroff!
|
||||
newDisplayData currDispData = new newDisplayData();
|
||||
readSemafori(ref currDispData);
|
||||
// SOLO SE ho poweroff da inviare...
|
||||
if (B_output == 0)
|
||||
{
|
||||
accodaSigIN(ref currDispData);
|
||||
// reset last ping...
|
||||
lastPING = DateTime.Now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua lettura semafori principale
|
||||
/// <paramref name="currDispData">Parametri da aggiornare x display in form</paramref>
|
||||
/// </summary>
|
||||
public override void readSemafori(ref newDisplayData currDispData)
|
||||
{
|
||||
byte[] MemBlock = new byte[2];
|
||||
try
|
||||
{
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success)
|
||||
{
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
connectionOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
connectionOk = false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// Override connessione
|
||||
/// </summary>
|
||||
public override void tryConnect()
|
||||
{
|
||||
bool doLog = (verboseLog || periodicLog);
|
||||
lgInfo("PING: tryConnect step 01");
|
||||
if (!connectionOk)
|
||||
{
|
||||
// controllo che il ping sia stato tentato almeno pingTestSec fa...
|
||||
if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
|
||||
{
|
||||
if (doLog)
|
||||
{
|
||||
lgInfo("PING: ConnKO - tryConnect");
|
||||
}
|
||||
lgInfo("PING: tryConnect step 04");
|
||||
|
||||
// se passa il ping faccio il resto...
|
||||
if (testPingMachine == IPStatus.Success)
|
||||
{
|
||||
// in primis salvo data ping...
|
||||
lastPING = DateTime.Now;
|
||||
connectionOk = true;
|
||||
lgInfo("PING OK");
|
||||
}
|
||||
else
|
||||
{
|
||||
// loggo no risposta ping ...
|
||||
connectionOk = false;
|
||||
lgInfo("PING KO");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override disconnessione
|
||||
/// </summary>
|
||||
public override void tryDisconnect()
|
||||
{
|
||||
lgInfo("Richiesta disconnessione adapter PING!");
|
||||
connectionOk = false;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user