Update conf livelli log x GWMS
This commit is contained in:
@@ -360,13 +360,13 @@ namespace IOB_WIN_NEXT
|
||||
// moltiplico x fattore conversione...
|
||||
valoreScal = valore * item.Value.factor;
|
||||
saveValue(ref outVal, valoreScal, item.Key);
|
||||
lgInfo($"getDynData: valore ricevuto | {item.Key} | val: {valore} | valoreScal: {valoreScal}");
|
||||
lgDebug($"getDynData: valore ricevuto | {item.Key} | val: {valore} | valoreScal: {valoreScal}");
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError($"getDynData: valore scartato x limiti min/max | {item.Key} | val: {valore} | valoreScal: {valoreScal} | min-max: {item.Value.minVal}-{item.Value.maxVal} | deltaVal: {deltaVal}");
|
||||
readErrorList.Add(item.Key, item.Value);
|
||||
lgInfo($"--> rimesso in coda lettura | parametro: {item.Key} | index: {item.Value.index} | size: {item.Value.size}");
|
||||
lgDebug($"--> rimesso in coda lettura | parametro: {item.Key} | index: {item.Value.index} | size: {item.Value.size}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ namespace IOB_WIN_NEXT
|
||||
stopwatch.Restart();
|
||||
rawData = currPLC.ReadHoldingRegisters(startAddr - baseAddr, numReg);
|
||||
stopwatch.Stop();
|
||||
lgInfo($"Lettura in blocco HoldingRegisters| startAddr: {startAddr} | numReg {numReg} | rawData.lenght: {rawData.Length} | {stopwatch.ElapsedMilliseconds}ms");
|
||||
lgTrace($"Lettura in blocco HoldingRegisters| startAddr: {startAddr} | numReg {numReg} | rawData.lenght: {rawData.Length} | {stopwatch.ElapsedMilliseconds}ms");
|
||||
// salvo in LUT la versione ESPLOSA 2 byte alla volta...
|
||||
if (rawData.Length > 0)
|
||||
{
|
||||
@@ -481,7 +481,7 @@ namespace IOB_WIN_NEXT
|
||||
// se > max errori --> disconnetto
|
||||
if (currReadErrors > maxReadErrors)
|
||||
{
|
||||
lgInfo($"Superato limite errori Read ({currReadErrors}) --> tryDisconnect");
|
||||
lgError($"Superato limite errori Read ({currReadErrors}) --> tryDisconnect");
|
||||
currReadErrors = 0;
|
||||
tryDisconnect();
|
||||
}
|
||||
@@ -607,32 +607,15 @@ namespace IOB_WIN_NEXT
|
||||
item.lastRead = DateTime.Now;
|
||||
item.UM = currMem.unit;
|
||||
}
|
||||
#if false
|
||||
// se configurato faccio verifica write...
|
||||
if (getOptPar("WRITE_CHECK") == "TRUE")
|
||||
{
|
||||
byte[] MemBlockRead = new byte[MemBlock.Length];
|
||||
S7ReadBB(ref MemBlockRead, memAddrWrite, MemBlock.Length);
|
||||
// se non corrispondessero loggo!
|
||||
if (!MemBlock.SequenceEqual(MemBlockRead))
|
||||
{
|
||||
lgError($"Errore: mancata corrispondenza tra dati scritti e letti:{Environment.NewLine}Write: {BitConverter.ToString(MemBlock)}{Environment.NewLine}read: {BitConverter.ToString(MemBlockRead)}");
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"Scrittura corretta: {BitConverter.ToString(MemBlockRead)}");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"Errore: memAddrWrite vuoto!");
|
||||
lgError($"Errore: memAddrWrite vuoto!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write");
|
||||
lgError($"Errore uid non trovato in area write memory: {item.uid}, ci sono {memMap.mMapWrite.Count} in area write");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -714,13 +697,13 @@ namespace IOB_WIN_NEXT
|
||||
else
|
||||
{
|
||||
contapezziIOB = 0;
|
||||
lgInfo("Contapezzi STD disabilitato: modalità {0}", getOptPar("PZCOUNT_MODE"));
|
||||
lgDebug("Contapezzi STD disabilitato: modalità {0}", getOptPar("PZCOUNT_MODE"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
contapezziIOB = 0;
|
||||
lgInfo("Parametro mancante PZCOUNT_MODE");
|
||||
lgError("Parametro mancante PZCOUNT_MODE");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -922,7 +905,7 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
case taskType.setParameter:
|
||||
// richiedo da URL i parametri WRITE da popolare
|
||||
lgInfo("Chiamata processMemWriteRequests");
|
||||
lgDebug("Chiamata processMemWriteRequests");
|
||||
|
||||
taskVal = processMemWriteRequests();
|
||||
// se restituiscce "" faccio altra prova...
|
||||
@@ -1013,16 +996,16 @@ namespace IOB_WIN_NEXT
|
||||
// se qualcosa è andato storto riprovo a caricare SOLO gli errori... 1 sola volta
|
||||
if (readErrorList.Count > 0)
|
||||
{
|
||||
lgInfo($"Attesa prima di rilettura | LUT: {useLUT}");
|
||||
lgDebug($"Attesa prima di rilettura | LUT: {useLUT}");
|
||||
// attendo 3 sec
|
||||
Thread.Sleep(3000);
|
||||
lgInfo($"Effettuo rilettura per {readErrorList.Count} variabili | LUT: {useLUT}");
|
||||
lgDebug($"Effettuo rilettura per {readErrorList.Count} variabili | LUT: {useLUT}");
|
||||
readErrorListRepeat = getDataDictionary(readErrorList, useLUT, ref outVal);
|
||||
}
|
||||
// se avessi ancora errori --> disconnetto
|
||||
if (readErrorListRepeat.Count > 0)
|
||||
{
|
||||
lgInfo($"Trovati valori non validi al secondo tentativo | LUT: {useLUT} --> invalido valori letti e resetto adapter con tryDisconnect!");
|
||||
lgError($"Trovati valori non validi al secondo tentativo | LUT: {useLUT} --> invalido valori letti e resetto adapter con tryDisconnect!");
|
||||
tryDisconnect();
|
||||
// invalido output
|
||||
outVal = new Dictionary<string, string>();
|
||||
@@ -1035,7 +1018,7 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"getDynData: {memMap.mMapRead.Count} record in mMapRead | LUT: {useLUT}");
|
||||
lgDebug($"getDynData: {memMap.mMapRead.Count} record in mMapRead | LUT: {useLUT}");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -1049,11 +1032,11 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo($"Non processo getDynData: enableTSVC = false");
|
||||
lgDebug($"Non processo getDynData: enableTSVC = false");
|
||||
}
|
||||
if (periodicLog || outVal.Count > 0)
|
||||
{
|
||||
lgInfo($"Esito getDynData: {outVal.Count} valori VALIDI in outVal");
|
||||
lgDebug($"Esito getDynData: {outVal.Count} valori VALIDI in outVal");
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
@@ -1144,12 +1127,12 @@ namespace IOB_WIN_NEXT
|
||||
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo("inizio read semafori");
|
||||
lgDebug("inizio read semafori");
|
||||
}
|
||||
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo(string.Format("RawInput[0]: {0}", utils.binaryForm(RawInput[0])));
|
||||
lgTrace(string.Format("RawInput[0]: {0}", utils.binaryForm(RawInput[0])));
|
||||
}
|
||||
|
||||
// salvo il solo BYTE dell'input decifrando il semaforo...
|
||||
@@ -1258,7 +1241,7 @@ namespace IOB_WIN_NEXT
|
||||
connectionOk = false;
|
||||
if (doLog)
|
||||
{
|
||||
lgInfo($"Attenzione: ModBusTCP controllo PING fallito per IP {cIobConf.cncIpAddr}");
|
||||
lgError($"Attenzione: ModBusTCP controllo PING fallito per IP {cIobConf.cncIpAddr}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,13 +57,13 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
int baseHold = 40001;
|
||||
int[] readTestFull = new int[2];
|
||||
lgInfo($"-------------------- Inizio test lettura {baseAddr} --------------------");
|
||||
lgTrace($"-------------------- Inizio test lettura {baseAddr} --------------------");
|
||||
try
|
||||
{
|
||||
stopwatch.Restart();
|
||||
readTestFull = currPLC.ReadHoldingRegisters(baseAddr - baseHold, numByte);
|
||||
stopwatch.Stop();
|
||||
lgInfo($"Stats lettura | {readTestFull.Length} val | {stopwatch.ElapsedMilliseconds}ms");
|
||||
lgTrace($"Stats lettura | {readTestFull.Length} val | {stopwatch.ElapsedMilliseconds}ms");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
@@ -72,9 +72,9 @@ namespace IOB_WIN_NEXT
|
||||
{
|
||||
int[] thisSet = new int[2];
|
||||
Array.Copy(readTestFull, i * 2, thisSet, 0, 2);
|
||||
lgInfo($"{baseAddr + i * 2:000} | HoldingRegisters: {thisSet[0]} / {thisSet[1]} | Val Real: {ModbusClient.ConvertRegistersToFloat(thisSet):N6}");
|
||||
lgTrace($"{baseAddr + i * 2:000} | HoldingRegisters: {thisSet[0]} / {thisSet[1]} | Val Real: {ModbusClient.ConvertRegistersToFloat(thisSet):N6}");
|
||||
}
|
||||
lgInfo("-------------------- Completato test lettura {baseAddr} --------------------");
|
||||
lgTrace("-------------------- Completato test lettura {baseAddr} --------------------");
|
||||
}
|
||||
|
||||
private void testRead()
|
||||
|
||||
Reference in New Issue
Block a user