diff --git a/IOB-WIN-NEXT/DATA/CONF/TFT_RAMA_001.ini b/IOB-WIN-NEXT/DATA/CONF/TFT_RAMA_001.ini
index a3737af9..9311f2ce 100644
--- a/IOB-WIN-NEXT/DATA/CONF/TFT_RAMA_001.ini
+++ b/IOB-WIN-NEXT/DATA/CONF/TFT_RAMA_001.ini
@@ -68,6 +68,7 @@ MAX_TRY_PING=3
DISABLE_SEND_WDST=TRUE
VETO_SEND_SNAPSHOT=3
;NO_PING=TRUE
+ENABLE_SLOW_DATA=TRUE
; conf parametri memoria READ/WRITE
OPC_PARAM_CONF=TFT_RAMA_001.json
diff --git a/IOB-WIN-NEXT/Iob/Generic.cs b/IOB-WIN-NEXT/Iob/Generic.cs
index 6e596b77..e7880fb4 100644
--- a/IOB-WIN-NEXT/Iob/Generic.cs
+++ b/IOB-WIN-NEXT/Iob/Generic.cs
@@ -1842,7 +1842,10 @@ namespace IOB_WIN_NEXT.Iob
{ }
}
processRecipeSyncArch();
- processSlowDataRead();
+ if (enableSlowData)
+ {
+ processSlowDataRead();
+ }
}
// mostra eventuali altri dati di processo...
reportDataProc();
@@ -2420,6 +2423,10 @@ namespace IOB_WIN_NEXT.Iob
lgTrace($"Effettuato processAutoDossier, esito positivo | {DateTime.Now:HH.mm.ss}");
}
}
+ ///
+ /// Abilitazione gestione slow data
+ ///
+ protected bool enableSlowData = false;
///
/// Verifica e processing x gestione ODL automatica
@@ -7886,6 +7893,12 @@ namespace IOB_WIN_NEXT.Iob
{
int.TryParse(VETO_QUEUE_IN, out vetoQueueIn);
}
+ // fix slow data
+ string ENABLE_SLOW_DATA = getOptPar("ENABLE_SLOW_DATA");
+ if (!string.IsNullOrEmpty(ENABLE_SLOW_DATA))
+ {
+ bool.TryParse(getOptPar("ENABLE_SLOW_DATA"), out enableSlowData);
+ }
}
private void svuotaCodaContapezzi()
diff --git a/IOB-WIN-NEXT/IobOpc/OpcUa.cs b/IOB-WIN-NEXT/IobOpc/OpcUa.cs
index c1183566..754cd38c 100644
--- a/IOB-WIN-NEXT/IobOpc/OpcUa.cs
+++ b/IOB-WIN-NEXT/IobOpc/OpcUa.cs
@@ -19,6 +19,7 @@ namespace IOB_WIN_NEXT.IobOpc
{
#region Public Constructors
+
///
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation https://github.com/OPCFoundation/UA-.NETStandard
///
@@ -29,6 +30,7 @@ namespace IOB_WIN_NEXT.IobOpc
// gestione invio ritardato contapezzi
pzCountDelay = utils.CRI("pzCountDelay");
+
// inizializzo...
subscribedItems = new List();
@@ -37,6 +39,12 @@ namespace IOB_WIN_NEXT.IobOpc
{
int.TryParse(getOptPar("MAX_TRY_PING"), out maxTryPing);
}
+ // fix slow data
+ string ENABLE_SLOW_DATA = getOptPar("ENABLE_SLOW_DATA");
+ if (!string.IsNullOrEmpty(ENABLE_SLOW_DATA))
+ {
+ bool.TryParse(getOptPar("ENABLE_SLOW_DATA"), out enableSlowData);
+ }
enablePzCountByApp = utils.CRB("enableContapezzi");
enablePzCountByIob = (getOptPar("ENABLE_PZCOUNT") == "TRUE");
@@ -1260,54 +1268,58 @@ namespace IOB_WIN_NEXT.IobOpc
///
protected override bool processSlowDataRead()
{
- lgInfo("Start processSlowDataRead");
bool answ = false;
- int fatto = 0;
- foreach (var item in subscribedItems)
+ if (enableSlowData)
{
- bool changed = false;
- // verifico se ho i dati complessi by design
- string currVal = "";
- if (doByteRead)
+ int fatto = 0;
+ stopwatch.Restart();
+ foreach (var item in subscribedItems)
{
- try
+ bool changed = false;
+ // verifico se ho i dati complessi by design
+ string currVal = "";
+ if (doByteRead)
{
- // restituisce i 115 byte da deserializzare... qui HACK!
- var rawVal = UA_ref.ReadNodeRaw(item.StartNodeId);
- if (rawVal != null)
+ try
{
- byteRawData = getByteRaw((DataValue)rawVal);
- changed = checkAndSendRaw(item, byteRawData, true);
+ // restituisce i 115 byte da deserializzare... qui HACK!
+ var rawVal = UA_ref.ReadNodeRaw(item.StartNodeId);
+ if (rawVal != null)
+ {
+ byteRawData = getByteRaw((DataValue)rawVal);
+ changed = checkAndSendRaw(item, byteRawData, true);
+ if (changed)
+ {
+ fatto++;
+ }
+ }
+ }
+ catch (Exception exc)
+ {
+ lgError($"Eccezione durante OpcUa.processSlowDataRead per {item.StartNodeId}{Environment.NewLine}{exc}");
+ }
+ }
+ else
+ {
+ try
+ {
+ currVal = UA_ref.ReadNode(item.StartNodeId);
+ changed = checkAndSend(item, currVal, true);
if (changed)
{
fatto++;
}
}
- }
- catch (Exception exc)
- {
- lgError($"Eccezione durante OpcUa.processSlowDataRead per {item.StartNodeId}{Environment.NewLine}{exc}");
- }
- }
- else
- {
- try
- {
- currVal = UA_ref.ReadNode(item.StartNodeId);
- changed = checkAndSend(item, currVal, true);
- if (changed)
+ catch (Exception exc)
{
- fatto++;
+ lgError($"Eccezione durante OpcUa.processSlowDataRead per {item.StartNodeId}{Environment.NewLine}{exc}");
}
}
- catch (Exception exc)
- {
- lgError($"Eccezione durante OpcUa.processSlowDataRead per {item.StartNodeId}{Environment.NewLine}{exc}");
- }
}
+ answ = subscribedItems.Count > 0;
+ stopwatch.Stop();
+ lgInfo($"End processSlowDataRead | {fatto} items changed | {stopwatch.ElapsedMilliseconds}ms");
}
- answ = subscribedItems.Count > 0;
- lgInfo($"End processSlowDataRead | {fatto} items changed");
return answ;
}