Fix modalità getOptPar x OpcUaSiemens

This commit is contained in:
Samuele Locatelli
2025-04-07 19:45:27 +02:00
parent 121aa5221c
commit 741527ec05
3 changed files with 23 additions and 11 deletions
+5
View File
@@ -51,5 +51,10 @@ namespace IOB_UT_NEXT.Config.Base
/// </summary>
public int SendPzcBlockMax { get; set; } = 100;
/// <summary>
/// Modalità set PzCount (contapezzi parziale) tra DIRECT / TASK
/// </summary>
public string SendPzCountMode { get; set; } = "";
}
}
+3 -1
View File
@@ -123,7 +123,7 @@ namespace IOB_UT_NEXT.Config
MaxErroriCheck = fIni.ReadInteger("OPTPAR", "MAX_ERR_CHECK", maxErrCheck),
MaxPingRetry = fIni.ReadInteger("OPTPAR", "MAX_PING_RETRY", 5),
MinDeltaSec = fIni.ReadInteger("IOB", "MinDeltaSec", 6),
MultiIobList= fIni.ReadString("OPTPAR", "IOB_MULTI_CNAME", ""),
MultiIobList = fIni.ReadString("OPTPAR", "IOB_MULTI_CNAME", ""),
RelVers = $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Version}",
ResetAlarmOnStart = bool.Parse(fIni.ReadString("OPTPAR", "SEND_ALARM_RESET", "false")),
SenMachineConf = bool.Parse(fIni.ReadString("OPTPAR", "SEND_MACHINE_CONF", "true")),
@@ -346,6 +346,7 @@ namespace IOB_UT_NEXT.Config
newConfObj.Counters.ResetOnSetupStop = bool.Parse(fIni.ReadString("OPTPAR", "ENABLE_PZ_RESET_stopSetup", "false"));
newConfObj.Counters.SendPzcBlockMin = int.Parse(fIni.ReadString("OPTPAR", "MIN_SEND_PZC_BLOCK", "0"));
newConfObj.Counters.SendPzcBlockMax = int.Parse(fIni.ReadString("OPTPAR", "MAX_SEND_PZC_BLOCK", "100"));
newConfObj.Counters.SendPzCountMode = fIni.ReadString("OPTPAR", "SEND_PZCNT_MODE", "DIRECT");
exclOptPar.Add("ENABLE_SEND_PZC_BLOCK");
exclOptPar.Add("ENABLE_PZ_CNT");
@@ -355,6 +356,7 @@ namespace IOB_UT_NEXT.Config
exclOptPar.Add("ENABLE_PZ_RESET_stopSetup");
exclOptPar.Add("MIN_SEND_PZC_BLOCK");
exclOptPar.Add("MAX_SEND_PZC_BLOCK");
exclOptPar.Add("SEND_PZCNT_MODE");
// allarmi...
string jsonAlarms = fIni.ReadString("OPTPAR", "ALARM_CONF", "");
+15 -10
View File
@@ -70,10 +70,18 @@ namespace IOB_WIN_OPC_UA.IobOpc
break;
case taskType.endProd:
forceDbSync = true;
// reset contapezzi inizio setup
if (IOBConfFull.Counters.ResetOnProdEnd)
{
addResetPzCount = true;
}
lgInfo($"Chiamato {tName} | addResetPzCount: {addResetPzCount}");
break;
case taskType.startSetup:
forceDbSync = true;
// se richiesto reset aggiungo!
if (IOBConfFull.OptPar.Count > 0 && getOptPar("ENABLE_PZ_RESET") == "TRUE")
// reset contapezzi inizio setup
if (IOBConfFull.Counters.ResetOnSetupStart)
{
addResetPzCount = true;
}
@@ -112,8 +120,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
lgInfo("OpcUaSiemens.resetContapezziPLC 01");
bool answ = false;
// ...SE abilitato da conf IOB
//if (IOBConfFull.OptPar.Count > 0 && getOptPar("ENABLE_PZ_RESET") == "TRUE")
if(IOBConfFull.Counters.ResetOnSetupStart || IOBConfFull.Counters.ResetOnSetupStop || IOBConfFull.Counters.EnableSetPzCount || IOBConfFull.Counters.ResetOnProdEnd)
if (IOBConfFull.Counters.ResetOnSetupStart || IOBConfFull.Counters.ResetOnSetupStop || IOBConfFull.Counters.EnableSetPzCount || IOBConfFull.Counters.ResetOnProdEnd)
{
lgInfo("OpcUaSiemens.resetContapezziPLC 02");
// imposto un veto in lettura cmq x evitare problemi
@@ -152,7 +159,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
}
else
{
lgError("Impossibile effettuare RESET contapezzi, mancanza parametro OPT:ENABLE_PZ_RESET");
lgError("Impossibile effettuare RESET contapezzi, mancanza parametri IOBConfFull.Counters.*");
}
return answ;
}
@@ -168,17 +175,15 @@ namespace IOB_WIN_OPC_UA.IobOpc
if (memMap != null && memMap.mMapWrite.ContainsKey("forceSetPzCount"))
{
// modalità invio secondo richiesta
string sendMode = getOptPar("SEND_PZCNT_MODE");
if (sendMode == "TASK")
lgDebug($"OpcUaSiemens.setcontapezziPLC | {IOBConfFull.Counters.SendPzCountMode}");
if (IOBConfFull.Counters.SendPzCountMode == "TASK")
{
lgDebug($"Generic.executeTasks | TASK");
Dictionary<string, string> task2add = new Dictionary<string, string>();
task2add.Add("forceSetPzCount", $"{newPzCount}");
executeTasks(task2add);
}
else
{
lgDebug($"Generic.executeTasks | plcWriteParams");
// provare x Donati EMCO e Siemens Rama Tenditalia
var ListTempParams = new List<objItem>();
// aggiungo reset caricamento
@@ -193,7 +198,7 @@ namespace IOB_WIN_OPC_UA.IobOpc
plcWriteParams(ref ListTempParams);
}
answ = true;
lgInfo($"Eseguito scrittura OPC-UA su nodo setcontapezziPLC | sendMode: {sendMode}");
lgInfo($"Eseguito scrittura OPC-UA su nodo setcontapezziPLC | sendMode: {IOBConfFull.Counters.SendPzCountMode}");
}
else
{