Fix reboot OPC-UA su mancato udpate info
This commit is contained in:
@@ -18,9 +18,9 @@ namespace IOB_UT_NEXT
|
||||
/// </summary>
|
||||
public Dictionary<string, int> fileDecod { get; set; } = new Dictionary<string, int>();
|
||||
/// <summary>
|
||||
/// Lista dei path attivi x gestioni IN/OUT varie
|
||||
/// Lista dei percorsi filepath attivi x gestioni IN/OUT varie
|
||||
/// </summary>
|
||||
public Dictionary<string, string> actPath { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ ENABLE_DYN_DATA=FALSE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
ENABLE_DATA_FILTER=TRUE
|
||||
ENABLE_CLI_RESTART=TRUE
|
||||
MAX_ELAPSED_TIME_SEC=120
|
||||
MAX_TRY_PING=3
|
||||
DISABLE_SEND_WDST=TRUE
|
||||
FTP_SERVER=192.168.60.234
|
||||
|
||||
@@ -99,12 +99,17 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
bool.TryParse(getOptPar("ENABLE_CLI_RESTART"), out enableCliRestart);
|
||||
}
|
||||
// init lastCurrentMaxElapsed
|
||||
if (!string.IsNullOrEmpty(getOptPar("MAX_ELAPSED_TIME_SEC")))
|
||||
{
|
||||
int.TryParse(getOptPar("MAX_ELAPSED_TIME_SEC"), out lastCurrentMaxElapsed);
|
||||
}
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
lastWarnODL = adesso;
|
||||
lastCurrent = adesso;
|
||||
lgTrace($"Aggiornato IobOpcUa.lastCurrent: {lastCurrent}");
|
||||
lgTrace($"Aggiornato IobOpcUa.lastCurrent: {lastCurrent}");
|
||||
// ora leggo il file di conf specifico....
|
||||
string jsonFileName = getOptPar("OPC_PARAM_CONF");
|
||||
if (!string.IsNullOrEmpty(jsonFileName))
|
||||
@@ -256,7 +261,7 @@ namespace IOB_WIN_NEXT
|
||||
/// <summary>
|
||||
/// Periodo massimo (in sec) per letture dati RAW in mancanza di eventi
|
||||
/// </summary>
|
||||
protected int lastCurrentMaxElapsed { get; set; } = 120;
|
||||
protected int lastCurrentMaxElapsed = 120;
|
||||
|
||||
/// <summary>
|
||||
/// Parametri specifici MTC
|
||||
@@ -1020,10 +1025,12 @@ namespace IOB_WIN_NEXT
|
||||
// bit 0 (poweron) imposto a 1 SE pingo + PowerOn=="ON"...
|
||||
bool powerOnOk = checkPing && hasPowerOn;
|
||||
|
||||
// controllo se sono poweroff e se non ho dati buoni da > lastCurrentMaxElapsed --> disconnetto
|
||||
if (!powerOnOk && (adesso.Subtract(lastCurrent).TotalSeconds > lastCurrentMaxElapsed))
|
||||
//// controllo se sono poweroff e se non ho dati buoni da > lastCurrentMaxElapsed --> disconnetto
|
||||
//if (!powerOnOk && (adesso.Subtract(lastCurrent).TotalSeconds > lastCurrentMaxElapsed))
|
||||
// controllo se non ho dati buoni da > lastCurrentMaxElapsed sec --> disconnetto
|
||||
if (adesso.Subtract(lastCurrent).TotalSeconds > lastCurrentMaxElapsed)
|
||||
{
|
||||
lgInfo("Timeout per mancata comunicazione --> disconnessione adapter OpcUa!");
|
||||
lgInfo($"Timeout per mancata comunicazione da oltre {lastCurrentMaxElapsed} sec --> disconnessione adapter OpcUa!");
|
||||
tryDisconnect();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,16 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
CHANGE_ODL_MODE = getOptPar("CHANGE_ODL_MODE");
|
||||
}
|
||||
// gestione restart OpcUa client...
|
||||
if (!string.IsNullOrEmpty(getOptPar("ENABLE_CLI_RESTART")))
|
||||
{
|
||||
bool.TryParse(getOptPar("ENABLE_CLI_RESTART"), out enableCliRestart);
|
||||
}
|
||||
// init lastCurrentMaxElapsed
|
||||
if (!string.IsNullOrEmpty(getOptPar("MAX_ELAPSED_TIME_SEC")))
|
||||
{
|
||||
int.TryParse(getOptPar("MAX_ELAPSED_TIME_SEC"), out lastCurrentMaxElapsed);
|
||||
}
|
||||
sendKeyRichiesta = true;
|
||||
}
|
||||
|
||||
@@ -245,9 +255,12 @@ namespace IOB_WIN_NEXT
|
||||
lgTrace("WatchDog disabilitato");
|
||||
}
|
||||
|
||||
// controllo se sono poweroff e se non ho dati buoni da > 2 minuti --> disconnetto
|
||||
if (!powerOnOk && adesso.Subtract(lastCurrent).TotalMinutes > 2)
|
||||
//// controllo se sono poweroff e se non ho dati buoni da > 2 minuti --> disconnetto
|
||||
//if (!powerOnOk && adesso.Subtract(lastCurrent).TotalMinutes > 2)
|
||||
// controllo se non ho dati buoni da > lastCurrentMaxElapsed sec --> disconnetto
|
||||
if (adesso.Subtract(lastCurrent).TotalSeconds > lastCurrentMaxElapsed)
|
||||
{
|
||||
lgInfo($"Timeout per mancata comunicazione da oltre {lastCurrentMaxElapsed} sec --> disconnessione adapter OpcUa!");
|
||||
tryDisconnect();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,16 @@ namespace IOB_WIN_NEXT
|
||||
int.TryParse(strVETO_SEND_SNAPSHOT, out VETO_SEND_SNAPSHOT);
|
||||
lgInfo($"VETO_SEND_SNAPSHOT: {VETO_SEND_SNAPSHOT}");
|
||||
}
|
||||
// gestione restart OpcUa client...
|
||||
if (!string.IsNullOrEmpty(getOptPar("ENABLE_CLI_RESTART")))
|
||||
{
|
||||
bool.TryParse(getOptPar("ENABLE_CLI_RESTART"), out enableCliRestart);
|
||||
}
|
||||
// init lastCurrentMaxElapsed
|
||||
if (!string.IsNullOrEmpty(getOptPar("MAX_ELAPSED_TIME_SEC")))
|
||||
{
|
||||
int.TryParse(getOptPar("MAX_ELAPSED_TIME_SEC"), out lastCurrentMaxElapsed);
|
||||
}
|
||||
|
||||
sendKeyRichiesta = true;
|
||||
|
||||
@@ -453,9 +463,10 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
// controllo se sono poweroff e se non ho dati buoni da > 2 minuti --> disconnetto
|
||||
if (!powerOnOk && adesso.Subtract(lastCurrent).TotalMinutes > 2)
|
||||
// controllo se non ho dati buoni da > lastCurrentMaxElapsed sec --> disconnetto
|
||||
if (adesso.Subtract(lastCurrent).TotalSeconds > lastCurrentMaxElapsed)
|
||||
{
|
||||
lgInfo($"Timeout per mancata comunicazione da oltre {lastCurrentMaxElapsed} sec --> disconnessione adapter OpcUa!");
|
||||
tryDisconnect();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user