Merge branch 'release/IobMTC_02'
This commit is contained in:
@@ -545,7 +545,7 @@ namespace IOB_UT_NEXT.Iob
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Methods
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se ci sia veto log attivo e gestisce casistiche
|
||||
@@ -553,7 +553,7 @@ namespace IOB_UT_NEXT.Iob
|
||||
/// <param name="vetoSec"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
private bool checkLogVeto(int vetoSec, ref string message)
|
||||
protected bool checkLogVeto(int vetoSec, ref string message)
|
||||
{
|
||||
//verifico SE si debba fare log, altrimenti metto in coda...
|
||||
bool doVeto = true;
|
||||
@@ -584,12 +584,19 @@ namespace IOB_UT_NEXT.Iob
|
||||
// primo --> loggo
|
||||
doVeto = false;
|
||||
VetoLog.Add(message, adesso.AddSeconds(vetoSec));
|
||||
VetoLogCount.Add(message, 0);
|
||||
if (VetoLogCount.ContainsKey(message))
|
||||
{
|
||||
VetoLogCount[message]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
VetoLogCount.Add(message, 0);
|
||||
}
|
||||
}
|
||||
// restituisco esito!
|
||||
return doVeto;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
+110
-52
@@ -15,6 +15,34 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// </summary>
|
||||
public class BaseObj : IOB_UT_NEXT.Iob.BaseObj
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua logging ERROR corretto impostanto anche la variabile IOB prima di scrivere...
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="args"></param>
|
||||
public void lgError(string message, params object[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool doVeto = checkLogVeto(2, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Error(message, args);
|
||||
sendToLogWatch("ERROR", message, args);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
readErrorCurr++;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
@@ -22,6 +50,20 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// </summary>
|
||||
protected AdapterForm parentForm;
|
||||
|
||||
/// <summary>
|
||||
/// Num errori lettura correnti
|
||||
/// </summary>
|
||||
protected int readErrorCurr = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Max num errori lettura prima di disconnettere
|
||||
/// </summary>
|
||||
protected int readErrorMax = 10;
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
protected int readErrorSleepTime = 15000;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Methods
|
||||
@@ -68,33 +110,23 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="message"></param>
|
||||
protected void lgError(string message, bool sendToForm = true)
|
||||
{
|
||||
bool doVeto = checkLogVeto(2, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
try
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Error(message);
|
||||
if (sendToForm)
|
||||
bool doVeto = checkLogVeto(2, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
{
|
||||
sendToLogWatch("ERROR", message);
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Error(message);
|
||||
if (sendToForm)
|
||||
{
|
||||
sendToLogWatch("ERROR", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua logging ERROR corretto impostanto anche la variabile IOB prima di scrivere...
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <param name="args"></param>
|
||||
public void lgError(string message, params object[] args)
|
||||
{
|
||||
bool doVeto = checkLogVeto(2, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
catch
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Error(message, args);
|
||||
sendToLogWatch("ERROR", message, args);
|
||||
readErrorCurr++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,13 +138,20 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="args"></param>
|
||||
protected void lgError(Exception exception, string message, params object[] args)
|
||||
{
|
||||
bool doVeto = checkLogVeto(2, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
try
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Error(exception, message, args);
|
||||
sendToLogWatch("ERROR", message, exception, args);
|
||||
bool doVeto = checkLogVeto(2, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Error(exception, message, args);
|
||||
sendToLogWatch("ERROR", message, exception, args);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
readErrorCurr++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,17 +161,24 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="message"></param>
|
||||
protected void lgFatal(string message, bool sendToForm = true)
|
||||
{
|
||||
bool doVeto = checkLogVeto(1, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
try
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Fatal(message);
|
||||
if (sendToForm)
|
||||
bool doVeto = checkLogVeto(1, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
{
|
||||
sendToLogWatch("FATAL", message);
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Fatal(message);
|
||||
if (sendToForm)
|
||||
{
|
||||
sendToLogWatch("FATAL", message);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
readErrorCurr++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -142,13 +188,20 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="args"></param>
|
||||
protected void lgFatal(string message, params object[] args)
|
||||
{
|
||||
bool doVeto = checkLogVeto(1, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
try
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Fatal(message, args);
|
||||
sendToLogWatch("FATAL", message, args);
|
||||
bool doVeto = checkLogVeto(1, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Fatal(message, args);
|
||||
sendToLogWatch("FATAL", message, args);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
readErrorCurr++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,13 +213,20 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// <param name="args"></param>
|
||||
protected void lgFatal(Exception exception, string message, params object[] args)
|
||||
{
|
||||
bool doVeto = checkLogVeto(1, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
try
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Fatal(exception, message, args);
|
||||
sendToLogWatch("FATAL", message, exception, args);
|
||||
bool doVeto = checkLogVeto(1, ref message);
|
||||
// se non ho veto --> loggo
|
||||
if (!doVeto)
|
||||
{
|
||||
lg.Factory.Configuration.Variables["codIOB"] = cIobConf.filenameIOB;
|
||||
lg.Fatal(exception, message, args);
|
||||
sendToLogWatch("FATAL", message, exception, args);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
readErrorCurr++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,15 +410,14 @@ namespace IOB_WIN_FORM.Iob
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Verifica se ci sia veto log attivo e gestisce casistiche
|
||||
/// </summary>
|
||||
/// <param name="vetoSec"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
private bool checkLogVeto(int vetoSec, ref string message)
|
||||
protected bool checkLogVeto(int vetoSec, ref string message)
|
||||
{
|
||||
//verifico SE si debba fare log, altrimenti metto in coda...
|
||||
bool doVeto = true;
|
||||
@@ -394,7 +453,6 @@ namespace IOB_WIN_FORM.Iob
|
||||
// restituisco esito!
|
||||
return doVeto;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -4443,6 +4443,11 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// </summary>
|
||||
protected bool ENABLE_MEM_REWRITE = true;
|
||||
|
||||
/// <summary>
|
||||
/// Abilitazione restart (da opt par...)
|
||||
/// </summary>
|
||||
protected bool enableCliRestart = false;
|
||||
|
||||
/// <summary>
|
||||
/// Boolean x indicare contapezzi abilitato a livello di conf apoplicazione
|
||||
/// </summary>
|
||||
@@ -4528,6 +4533,11 @@ namespace IOB_WIN_FORM.Iob
|
||||
/// </summary>
|
||||
protected DateTime lastConnectTry;
|
||||
|
||||
/// <summary>
|
||||
/// Periodo massimo (in sec) per letture dati RAW in mancanza di eventi
|
||||
/// </summary>
|
||||
protected int lastCurrentMaxElapsed = 120;
|
||||
|
||||
/// <summary>
|
||||
/// Dizionario ULTIMI valori impostati x produzione
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
;Configurazione IOB-WIN
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
;Tornio Biglia 438 controllo Mitsubishi MTConnect
|
||||
CNCTYPE=MTConnect
|
||||
@@ -61,6 +61,10 @@ ENABLE_DATA_FILTER=TRUE
|
||||
ENABLE_MTC_RESTART=TRUE
|
||||
VETO_QUEUE_IN=15
|
||||
DISABLE_SEND_WDST=TRUE
|
||||
ENABLE_CLI_RESTART=TRUE
|
||||
MAX_ELAPSED_TIME_SEC=60
|
||||
READ_ERROR_MAX=10
|
||||
READ_ERROR_SLEEP_TIME=30000
|
||||
|
||||
; conf parametri memoria READ/WRITE
|
||||
MTC_PARAM_CONF=3024.json
|
||||
|
||||
@@ -293,12 +293,8 @@
|
||||
<None Include="DATA\CONF\GT652.json" />
|
||||
<None Include="DATA\CONF\IMI_50.ini" />
|
||||
<None Include="DATA\CONF\IMI_50.json" />
|
||||
<None Include="DATA\CONF\TEST.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\TEST.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\TEST.ini" />
|
||||
<None Include="DATA\CONF\TEST.json" />
|
||||
<None Include="NLog.config">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -315,18 +311,10 @@
|
||||
<None Include="DATA\CONF\MAIN.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIMUL_01.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIMUL_01.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIMUL_01_alarm.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIMUL_01_WD.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\SIMUL_01.ini" />
|
||||
<None Include="DATA\CONF\SIMUL_01.json" />
|
||||
<None Include="DATA\CONF\SIMUL_01_alarm.json" />
|
||||
<None Include="DATA\CONF\SIMUL_01_WD.ini" />
|
||||
<None Include="DATA\DAT\PersistData.dat">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
+82
-15
@@ -51,6 +51,26 @@ namespace IOB_WIN_MTC.Iob
|
||||
enablePzCountByIob = (getOptPar("ENABLE_PZCOUNT") == "TRUE");
|
||||
disablePzCountByIob = (getOptPar("DISABLE_PZCOUNT") == "TRUE");
|
||||
|
||||
// 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);
|
||||
}
|
||||
// init gestione reset errori lettura
|
||||
if (!string.IsNullOrEmpty(getOptPar("READ_ERROR_MAX")))
|
||||
{
|
||||
int.TryParse(getOptPar("READ_ERROR_MAX"), out readErrorMax);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(getOptPar("READ_ERROR_SLEEP_TIME")))
|
||||
{
|
||||
int.TryParse(getOptPar("READ_ERROR_SLEEP_TIME"), out readErrorSleepTime);
|
||||
}
|
||||
|
||||
// init datetime counters
|
||||
DateTime adesso = DateTime.Now;
|
||||
lastPzCountSend = adesso;
|
||||
@@ -177,6 +197,19 @@ namespace IOB_WIN_MTC.Iob
|
||||
// decodifica document gestione
|
||||
decodeToBaseBitmap();
|
||||
reportRawInput(ref currDispData);
|
||||
|
||||
// controllo read error ed eventuale disconnect
|
||||
if (readErrorCurr > readErrorMax)
|
||||
{
|
||||
lgError($"Effettuo disconnessione x superamento errori lettura UA_ref.ReadNodeString, sleetp 15 sec");
|
||||
tryDisconnect();
|
||||
Thread.Sleep(readErrorSleepTime);
|
||||
readErrorCurr = 0;
|
||||
}
|
||||
else if (readErrorCurr > 0)
|
||||
{
|
||||
readErrorCurr--;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@@ -765,58 +798,67 @@ namespace IOB_WIN_MTC.Iob
|
||||
/// Effettua log di un elenco componenti
|
||||
/// </summary>
|
||||
/// <param name="elencoComponenti"></param>
|
||||
protected void logComponentsList(List<MTConnect.Devices.IComponent> elencoComponenti)
|
||||
protected int logComponentsList(List<MTConnect.Devices.IComponent> elencoComponenti)
|
||||
{
|
||||
int found = 0;
|
||||
if (elencoComponenti != null)
|
||||
{
|
||||
foreach (var item in elencoComponenti)
|
||||
{
|
||||
lgInfo($"Component data | ID: {item.Id} | Name: {item.Name} | Type: {item.Type} | # items: {item.DataItems.Count()}");
|
||||
lgTrace($"Component data | ID: {item.Id} | Name: {item.Name} | Type: {item.Type} | # items: {item.DataItems.Count()}");
|
||||
found++;
|
||||
// se ho sottocomponenti richiamo...
|
||||
if (item.Components != null)
|
||||
{
|
||||
if (item.Components.Count() > 0)
|
||||
{
|
||||
logComponentsList(item.GetComponents().ToList());
|
||||
found += logComponentsList(item.GetComponents().ToList());
|
||||
}
|
||||
}
|
||||
if (item.DataItems.Count() > 0)
|
||||
{
|
||||
logDataItemList(item.GetDataItems().ToList());
|
||||
found += logDataItemList(item.GetDataItems().ToList());
|
||||
}
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua log di un elenco composizioni
|
||||
/// </summary>
|
||||
/// <param name="elencoComposizioni"></param>
|
||||
protected void logCompositionList(List<MTConnect.Devices.IComposition> elencoComposizioni)
|
||||
protected int logCompositionList(List<MTConnect.Devices.IComposition> elencoComposizioni)
|
||||
{
|
||||
int found = 0;
|
||||
if (elencoComposizioni != null)
|
||||
{
|
||||
foreach (var item in elencoComposizioni)
|
||||
{
|
||||
lgInfo($"Composition data | ID: {item.Id} | Name: {item.Name} | Type: {item.Type} | # items: {item.DataItems.Count()} | path: {item.IdPath}");
|
||||
lgTrace($"Composition data | ID: {item.Id} | Name: {item.Name} | Type: {item.Type} | # items: {item.DataItems.Count()} | path: {item.IdPath}");
|
||||
found++;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log elenco DataItems
|
||||
/// </summary>
|
||||
/// <param name="elencoItems"></param>
|
||||
protected void logDataItemList(List<MTConnect.Devices.IDataItem> elencoItems)
|
||||
protected int logDataItemList(List<MTConnect.Devices.IDataItem> elencoItems)
|
||||
{
|
||||
int found = 0;
|
||||
if (elencoItems != null)
|
||||
{
|
||||
// loggo devices principali...
|
||||
foreach (var item in elencoItems)
|
||||
{
|
||||
lgInfo($"Device data | ID: {item.Id} | Name: {item.Name} | Category: {item.Category} | # Type: {item.Type} | Path: {item.IdPath}");
|
||||
lgTrace($"Device data | ID: {item.Id} | Name: {item.Name} | Category: {item.Category} | # Type: {item.Type} | Path: {item.IdPath}");
|
||||
found++;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -827,25 +869,31 @@ namespace IOB_WIN_MTC.Iob
|
||||
{
|
||||
if (listDevices != null)
|
||||
{
|
||||
int numCom = 0;
|
||||
int numDev = 0;
|
||||
int numItm = 0;
|
||||
// loggo devices principali...
|
||||
foreach (var device in listDevices)
|
||||
{
|
||||
lgInfo($"Device data | ID: {device.Id} | Name: {device.Name} | UUID: {device.Uuid} | # items: {device.DataItems.Count()}");
|
||||
lgTrace($"Device data | ID: {device.Id} | Name: {device.Name} | UUID: {device.Uuid} | # items: {device.DataItems.Count()}");
|
||||
// se ho subItems descrivo pure loro...
|
||||
if (device.DataItems.Count() > 0)
|
||||
{
|
||||
logDataItemList(device.GetDataItems().ToList());
|
||||
numItm += logDataItemList(device.GetDataItems().ToList());
|
||||
}
|
||||
if (device.Components.Count() > 0)
|
||||
{
|
||||
logComponentsList(device.GetComponents().ToList());
|
||||
numCom += logComponentsList(device.GetComponents().ToList());
|
||||
}
|
||||
// All Compositions (traverse the entire Device model)
|
||||
if (device.Compositions.Count() > 0)
|
||||
{
|
||||
logCompositionList(device.GetCompositions().ToList());
|
||||
numCom += logCompositionList(device.GetCompositions().ToList());
|
||||
}
|
||||
}
|
||||
lgInfo(lineSep);
|
||||
lgInfo($"Effettuata lettura | Components: {numCom} | Devices: {numDev} | DataItems: {numItm}");
|
||||
lgInfo(lineSep);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -922,6 +970,21 @@ namespace IOB_WIN_MTC.Iob
|
||||
* B5: emergenza (dipende da state machine se riportare 1 = armata/premuta, vedere conf mtcParams.emergencyArmedTrue)
|
||||
----------------------------------------------------- */
|
||||
|
||||
DateTime adesso = DateTime.Now;
|
||||
// controllo se non ho dati buoni da > lastCurrentMaxElapsed sec --> disconnetto
|
||||
if (adesso.Subtract(lastCurrent).TotalSeconds > lastCurrentMaxElapsed)
|
||||
{
|
||||
if (enableCliRestart)
|
||||
{
|
||||
lgInfo($"Timeout per mancata comunicazione da oltre {lastCurrentMaxElapsed} sec --> disconnessione adapter MTConnect!");
|
||||
tryDisconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Attenzione: superato periodo di mancata comunicazione da oltre {lastCurrentMaxElapsed} sec ma enableCliRestart non permesso");
|
||||
}
|
||||
}
|
||||
|
||||
// Controllo booleano PING document POWERON...
|
||||
string currPowerOn = getDataItemValue(mtcParams.condPowerOn.keyName);
|
||||
// se valido il check ping lo eseguo... altrimenti lo do x buono
|
||||
@@ -991,7 +1054,6 @@ namespace IOB_WIN_MTC.Iob
|
||||
}
|
||||
}
|
||||
|
||||
DateTime adesso = DateTime.Now;
|
||||
int vFactor = 1;
|
||||
// controllo SE HO dati per fare verifiche...
|
||||
if (string.IsNullOrEmpty(currRun))
|
||||
@@ -1006,7 +1068,7 @@ namespace IOB_WIN_MTC.Iob
|
||||
// stop...
|
||||
lgInfo("Fermato MTC_ref per mancanza dati current");
|
||||
MTC_ref.Stop();
|
||||
Thread.Sleep(1000);
|
||||
Thread.Sleep(3000);
|
||||
// restart
|
||||
lgInfo("Riavviato MTC_ref per mancanza dati current");
|
||||
MTC_ref.Start();
|
||||
@@ -1382,6 +1444,7 @@ namespace IOB_WIN_MTC.Iob
|
||||
lgInfo("ASSET received");
|
||||
queueInEnabCurr = true;
|
||||
connectionOk = true;
|
||||
lastCurrent = DateTime.Now;
|
||||
foreach (var asset in doc.Assets)
|
||||
{
|
||||
// Print AssetId to the Console
|
||||
@@ -1392,6 +1455,7 @@ namespace IOB_WIN_MTC.Iob
|
||||
private void MTC_ref_ClientStarted(object sender, EventArgs e)
|
||||
{
|
||||
lgInfo($"Client Started!");
|
||||
lastCurrent = DateTime.Now;
|
||||
}
|
||||
|
||||
private void MTC_ref_ClientStopped(object sender, EventArgs e)
|
||||
@@ -1418,6 +1482,7 @@ namespace IOB_WIN_MTC.Iob
|
||||
lgInfo("CURRENT received");
|
||||
queueInEnabCurr = true;
|
||||
connectionOk = true;
|
||||
lastCurrent = DateTime.Now;
|
||||
if (document != null)
|
||||
{
|
||||
if (document.Streams != null)
|
||||
@@ -1440,6 +1505,7 @@ namespace IOB_WIN_MTC.Iob
|
||||
private void MTC_ref_ObservationReceived(object sender, MTConnect.Observations.IObservation observ)
|
||||
{
|
||||
connectionOk = true;
|
||||
lastCurrent = DateTime.Now;
|
||||
processObservation(observ, false);
|
||||
}
|
||||
|
||||
@@ -1452,6 +1518,7 @@ namespace IOB_WIN_MTC.Iob
|
||||
{
|
||||
queueInEnabCurr = true;
|
||||
connectionOk = true;
|
||||
lastCurrent = DateTime.Now;
|
||||
lgInfo("STEP 01 DevicesSuccessful reached!");
|
||||
MtcDataItemExt currDataItem = null;
|
||||
machDataItem currMapoDataItem = null;
|
||||
@@ -1521,6 +1588,7 @@ namespace IOB_WIN_MTC.Iob
|
||||
private void MTC_ref_SampleReceived(object sender, MTConnect.Streams.IStreamsResponseDocument document)
|
||||
{
|
||||
connectionOk = true;
|
||||
lastCurrent = DateTime.Now;
|
||||
lgTrace("SAMPLE received");
|
||||
checkAndSend(document, false);
|
||||
}
|
||||
@@ -1705,6 +1773,5 @@ namespace IOB_WIN_MTC.Iob
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,6 @@
|
||||
@echo off
|
||||
echo Inizio processing After Build: configurazione %1 , directory %2
|
||||
|
||||
RD /S /Q %2"\lib\ar"
|
||||
RD /S /Q %2"\lib\cs"
|
||||
RD /S /Q %2"\lib\da"
|
||||
RD /S /Q %2"\lib\de"
|
||||
RD /S /Q %2"\lib\es"
|
||||
RD /S /Q %2"\lib\fr"
|
||||
RD /S /Q %2"\lib\it"
|
||||
RD /S /Q %2"\lib\ja-JP"
|
||||
RD /S /Q %2"\lib\ko"
|
||||
RD /S /Q %2"\lib\lv"
|
||||
RD /S /Q %2"\lib\nl"
|
||||
RD /S /Q %2"\lib\pl"
|
||||
RD /S /Q %2"\lib\pt"
|
||||
RD /S /Q %2"\lib\pt-BR"
|
||||
RD /S /Q %2"\lib\ru"
|
||||
RD /S /Q %2"\lib\sk"
|
||||
RD /S /Q %2"\lib\sv"
|
||||
RD /S /Q %2"\lib\th"
|
||||
RD /S /Q %2"\lib\tr"
|
||||
RD /S /Q %2"\lib\zh"
|
||||
RD /S /Q %2"\lib\zh-TW"
|
||||
|
||||
MOVE /Y %2"ar" %2"lib\"
|
||||
MOVE /Y %2"cs" %2"lib\"
|
||||
MOVE /Y %2"da" %2"lib\"
|
||||
MOVE /Y %2"de" %2"lib\"
|
||||
MOVE /Y %2"es" %2"lib\"
|
||||
MOVE /Y %2"fr" %2"lib\"
|
||||
MOVE /Y %2"it" %2"lib\"
|
||||
MOVE /Y %2"ja-JP" %2"lib\"
|
||||
MOVE /Y %2"ko" %2"lib\"
|
||||
MOVE /Y %2"lv" %2"lib\"
|
||||
MOVE /Y %2"nl" %2"lib\"
|
||||
MOVE /Y %2"pl" %2"lib\"
|
||||
MOVE /Y %2"pt" %2"lib\"
|
||||
MOVE /Y %2"pt-BR" %2"lib\"
|
||||
MOVE /Y %2"ru" %2"lib\"
|
||||
MOVE /Y %2"sk" %2"lib\"
|
||||
MOVE /Y %2"sv" %2"lib\"
|
||||
MOVE /Y %2"th" %2"lib\"
|
||||
MOVE /Y %2"tr" %2"lib\"
|
||||
MOVE /Y %2"zh" %2"lib\"
|
||||
MOVE /Y %2"zh-TW" %2"lib\"
|
||||
|
||||
|
||||
if %1 == "Release" goto ReleaseExec
|
||||
if %1 == Release goto ReleaseExec
|
||||
if %1 == "Debug" goto DebugExec
|
||||
|
||||
@@ -1151,10 +1151,12 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
/// </summary>
|
||||
protected Dictionary<string, OpcUaDataItemExt> dataItemMem = new Dictionary<string, OpcUaDataItemExt>();
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Abilitazione restart (da opt par...)
|
||||
/// </summary>
|
||||
protected bool enableCliRestart = false;
|
||||
protected bool enableCliRestart = false;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gestione filtraggio dati
|
||||
@@ -1171,10 +1173,12 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
/// </summary>
|
||||
protected DateTime lastCurrent = DateTime.Now;
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Periodo massimo (in sec) per letture dati RAW in mancanza di eventi
|
||||
/// </summary>
|
||||
protected int lastCurrentMaxElapsed = 120;
|
||||
protected int lastCurrentMaxElapsed = 120;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto MAIN x connessione OPC-UA
|
||||
@@ -1653,8 +1657,15 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
// 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();
|
||||
if (enableCliRestart)
|
||||
{
|
||||
lgInfo($"Timeout per mancata comunicazione da oltre {lastCurrentMaxElapsed} sec --> disconnessione adapter OpcUa!");
|
||||
tryDisconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Attenzione: superato periodo di mancata comunicazione da oltre {lastCurrentMaxElapsed} sec ma enableCliRestart non permesso");
|
||||
}
|
||||
}
|
||||
|
||||
// solo se non ho veto check
|
||||
@@ -1983,6 +1994,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
|
||||
#region Private Fields
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Num errori lettura correnti
|
||||
/// </summary>
|
||||
@@ -1995,7 +2007,8 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
private int readErrorSleepTime = 15000;
|
||||
private int readErrorSleepTime = 15000;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Elenco degli items da monitorare come risultato del browse iniziale
|
||||
|
||||
@@ -248,8 +248,15 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
// 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();
|
||||
if (enableCliRestart)
|
||||
{
|
||||
lgInfo($"Timeout per mancata comunicazione da oltre {lastCurrentMaxElapsed} sec --> disconnessione adapter OpcUa!");
|
||||
tryDisconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Attenzione: superato periodo di mancata comunicazione da oltre {lastCurrentMaxElapsed} sec ma enableCliRestart non permesso");
|
||||
}
|
||||
}
|
||||
|
||||
// solo se non ho veto check
|
||||
|
||||
@@ -256,8 +256,15 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
// 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();
|
||||
if (enableCliRestart)
|
||||
{
|
||||
lgInfo($"Timeout per mancata comunicazione da oltre {lastCurrentMaxElapsed} sec --> disconnessione adapter OpcUa!");
|
||||
tryDisconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Attenzione: superato periodo di mancata comunicazione da oltre {lastCurrentMaxElapsed} sec ma enableCliRestart non permesso");
|
||||
}
|
||||
}
|
||||
|
||||
// solo se non ho veto check
|
||||
|
||||
@@ -467,8 +467,15 @@ namespace IOB_WIN_OPC_UA.IobOpc
|
||||
// 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();
|
||||
if (enableCliRestart)
|
||||
{
|
||||
lgInfo($"Timeout per mancata comunicazione da oltre {lastCurrentMaxElapsed} sec --> disconnessione adapter OpcUa!");
|
||||
tryDisconnect();
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"Attenzione: superato periodo di mancata comunicazione da oltre {lastCurrentMaxElapsed} sec ma enableCliRestart non permesso");
|
||||
}
|
||||
}
|
||||
|
||||
// solo se non ho veto check
|
||||
|
||||
Reference in New Issue
Block a user