Merge branch 'master' into FeatureOpcUaBaglietto
This commit is contained in:
@@ -48,8 +48,8 @@ BLINK_FILT=0
|
||||
;BLINK_FILT=28
|
||||
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
PZCOUNT_MODE=STD.41100.UDINT32
|
||||
;PZCOUNT_MODE=STD.Nome valore DynData
|
||||
PZCOUNT_MODE=STD.NumPacchi
|
||||
DISABLE_PZCOUNT=TRUE
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
|
||||
+29
-139
@@ -243,26 +243,6 @@ namespace IOB_WIN_NEXT
|
||||
outVal = new Dictionary<string, string>();
|
||||
tryConnect();
|
||||
}
|
||||
// refuso, gestito da getAlarmData di IobGeneric
|
||||
#if false
|
||||
// ora aggiungo (se ci fossero) gli allarmi...
|
||||
if (alarmMaps != null && alarmMaps.Count > 0)
|
||||
{
|
||||
if (hasAlarms)
|
||||
{
|
||||
string bankVal = "";
|
||||
foreach (var item in alarmMaps)
|
||||
{
|
||||
bankVal = "";
|
||||
var currState = currAlarmsState(item);
|
||||
// calcolo vettore stringa degli allarmi...
|
||||
bankVal = getAlarmState(item, currState);
|
||||
bankVal = string.IsNullOrEmpty(bankVal) ? "OK" : bankVal;
|
||||
saveAlarmString(ref outVal, bankVal, item.description);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -663,125 +643,6 @@ namespace IOB_WIN_NEXT
|
||||
return answ;
|
||||
}
|
||||
|
||||
#if false
|
||||
// refuso: usato metodo base IobGeneric
|
||||
protected override bool hasAlarms()
|
||||
{
|
||||
bool answ = false;
|
||||
int numErrors = 0;
|
||||
int currStatus = 0;
|
||||
int[] listInt = new int[2];
|
||||
if (alarmMaps != null)
|
||||
{
|
||||
// leggo a ciclo le aree degli allarmi CONFIGURATI, se ne trovo --> segnalo allarme...
|
||||
foreach (var item in alarmMaps)
|
||||
{
|
||||
// banchi in array Int16 --> scompongo
|
||||
for (int i = 0; i < item.size / 2; i++)
|
||||
{
|
||||
// verifico se usare LUT
|
||||
bool useLUT = memSetR != null && memSetR.Count > 0;
|
||||
if (useLUT)
|
||||
{
|
||||
int lutAddress = 40000 + item.index;
|
||||
if (HoldingRegisterLUT.ContainsKey(lutAddress))
|
||||
{
|
||||
try
|
||||
{
|
||||
listInt = HoldingRegisterLUT[lutAddress];
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Errore in lettura da HoldingRegisterLUT per indirizzo {lutAddress} | item {item.memAddr}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
listInt = readInputReg(item.index, item.size);
|
||||
}
|
||||
currStatus = ModbusClient.ConvertRegistersToInt(listInt);
|
||||
|
||||
// aggiornamento blink counters dato nuovo valore
|
||||
item.checkBlinkCounter(i, (uint)currStatus);
|
||||
|
||||
// calcolo indice errori
|
||||
if ((uint)(item.alarmsMask[i] & currStatus) > 0)
|
||||
{
|
||||
numErrors++;
|
||||
}
|
||||
// verifico SE sia variato... confronto allarmi filtrato stile blink per bit status:
|
||||
// - allarmi che iniziano per # IGNORATI
|
||||
// - altri allarmi con un countdown da MAX_COUNTER_BLINK a 0 per il fronte
|
||||
// di discesa
|
||||
if (item.isChanged(i, (uint)currStatus))
|
||||
{
|
||||
// registro gli allarmi attivi e trasmetto...
|
||||
if (sendAlarmVariations(item.memAddr, i, item.alarmsState[i], (uint)(item.alarmsMask[i] & currStatus), item.messages))
|
||||
{
|
||||
// se inviato --> salvo stato da current...
|
||||
item.updStatusVal(i, (uint)(item.alarmsMask[i] & currStatus));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
answ = numErrors > 0;
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Restituisce stato allarmi in formato byte[]
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
protected byte[] currAlarmsState(BaseAlarmConf item)
|
||||
{
|
||||
byte[] answ = new byte[item.size];
|
||||
int currStatus = 0;
|
||||
int[] listInt = new int[2];
|
||||
// banchi in array Int16 --> scompongo
|
||||
for (int i = 0; i < item.size / 2; i++)
|
||||
{
|
||||
// verifico se usare LUT
|
||||
bool useLUT = memSetR != null && memSetR.Count > 0;
|
||||
if (useLUT)
|
||||
{
|
||||
int lutAddress = 40000 + item.index;
|
||||
if (HoldingRegisterLUT.ContainsKey(lutAddress))
|
||||
{
|
||||
try
|
||||
{
|
||||
listInt = HoldingRegisterLUT[lutAddress];
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError($"Errore in lettura da HoldingRegisterLUT per indirizzo {lutAddress} | item {item.memAddr}{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
listInt = readInputReg(item.index, item.size);
|
||||
}
|
||||
currStatus = ModbusClient.ConvertRegistersToInt(listInt);
|
||||
|
||||
// aggiornamento blink counters dato nuovo valore
|
||||
item.checkBlinkCounter(i, (uint)currStatus);
|
||||
|
||||
// calcolo indice errori
|
||||
if ((uint)(item.alarmsMask[i] & currStatus) > 0)
|
||||
{
|
||||
var currByte = BitConverter.GetBytes(currStatus);
|
||||
// salvo nell'array di byte
|
||||
Buffer.BlockCopy(currByte, 0, answ, i * 2, 2);
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Override metodo x scrittura parametri su PLC
|
||||
/// </summary>
|
||||
@@ -932,6 +793,35 @@ namespace IOB_WIN_NEXT
|
||||
}
|
||||
}
|
||||
|
||||
public override void processContapezzi()
|
||||
{
|
||||
if ((enablePzCountByApp || enablePzCountByIob) && !(disablePzCounteByIob))
|
||||
{
|
||||
if (cIobConf.optPar.Count > 0 && !string.IsNullOrWhiteSpace(getOptPar("PZCOUNT_MODE")))
|
||||
{
|
||||
// cerco in lastDynData...
|
||||
string pzCountKey = getOptPar("PZCOUNT_MODE").Replace("STD.","");
|
||||
if (lastDynData.ContainsKey(pzCountKey))
|
||||
{
|
||||
string rawVal = lastDynData[pzCountKey];
|
||||
int pzCounter = -1;
|
||||
if (!string.IsNullOrEmpty(rawVal))
|
||||
{
|
||||
int.TryParse(rawVal, out pzCounter);
|
||||
if (pzCounter >= 0)
|
||||
{
|
||||
contapezziPLC = pzCounter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgTrace($"processContapezzi escluso: enablePzCountByApp = {enablePzCountByApp} | enablePzCountByIob: {enablePzCountByIob} | disablePzCounteByIob: {disablePzCounteByIob}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imposto parametri PLC
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user