Gestione enable slowData
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Abilitazione gestione slow data
|
||||
/// </summary>
|
||||
protected bool enableSlowData = false;
|
||||
|
||||
/// <summary>
|
||||
/// 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()
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base, impiegando il pacchetto Nuget OPC-UA foundation https://github.com/OPCFoundation/UA-.NETStandard
|
||||
/// </summary>
|
||||
@@ -29,6 +30,7 @@ namespace IOB_WIN_NEXT.IobOpc
|
||||
// gestione invio ritardato contapezzi
|
||||
pzCountDelay = utils.CRI("pzCountDelay");
|
||||
|
||||
|
||||
// inizializzo...
|
||||
subscribedItems = new List<Opc.Ua.Client.MonitoredItem>();
|
||||
|
||||
@@ -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
|
||||
/// <returns></returns>
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user