Update conf cedax:

- parametri sia write che read
- gestione parametri "doppi" (write/read)
- test scrittura modbus
This commit is contained in:
S.E.Locatelli
2022-06-28 19:18:31 +02:00
parent ae37112e92
commit 08e6c3e5f5
3 changed files with 86 additions and 17 deletions
+61 -5
View File
@@ -1,5 +1,61 @@
{
"mMapWrite": {
"Dose_Staz_1": {
"name": "Dose_Staz_1",
"description": "Dose Stazione 1",
"memAddr": "40024",
"tipoMem": "Int",
"index": 24,
"size": 1,
"func": "MEDIAN",
"period": 90,
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "%"
},
"Dose_Staz_2": {
"name": "Dose_Staz_2",
"description": "Dose Stazione 2",
"memAddr": "40025",
"tipoMem": "Int",
"index": 25,
"size": 1,
"func": "MEDIAN",
"period": 90,
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "%"
},
"Dose_Staz_3": {
"name": "Dose_Staz_3",
"description": "Dose Stazione 3",
"memAddr": "40026",
"tipoMem": "Int",
"index": 26,
"size": 1,
"func": "MEDIAN",
"period": 90,
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "%"
},
"Dose_Staz_4": {
"name": "Dose_Staz_4",
"description": "Dose Stazione 4",
"memAddr": "40027",
"tipoMem": "Int",
"index": 27,
"size": 1,
"func": "MEDIAN",
"period": 90,
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "%"
}
},
"mMapRead": {
"Stag_H2O": {
@@ -154,11 +210,11 @@
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
"unit": "%"
},
"Dose_Staz_2": {
"name": "Dose_Staz_2",
"description": "Dose Stazione 1",
"description": "Dose Stazione 2",
"memAddr": "40025",
"tipoMem": "Int",
"index": 25,
@@ -168,7 +224,7 @@
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
"unit": "%"
},
"Dose_Staz_3": {
"name": "Dose_Staz_3",
@@ -182,7 +238,7 @@
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
"unit": "%"
},
"Dose_Staz_4": {
"name": "Dose_Staz_4",
@@ -196,7 +252,7 @@
"factor": 0.01,
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
"unit": "%"
}
}
}
+15 -10
View File
@@ -4237,7 +4237,7 @@ namespace IOB_WIN_NEXT
}
answ = utils.callUrlNow(url2call);
// se vuoto faccio seconda prova...
if (string.IsNullOrEmpty(answ))
if (string.IsNullOrEmpty(answ) || answ == "[]")
{
answ = utils.callUrlNow(url2call);
}
@@ -4949,16 +4949,21 @@ namespace IOB_WIN_NEXT
// valori READ
foreach (var item in memMap.mMapRead)
{
currItem = new objItem()
// se non ci fosse aggiungo
var trovato = allParam.FirstOrDefault(x => x.uid == item.Value.name);
if (trovato == null)
{
uid = item.Value.name,
name = !string.IsNullOrEmpty(item.Value.description) ? item.Value.description : item.Value.name,
writable = false,
UM = item.Value.unit,
valMin = item.Value.minVal,
valMax = item.Value.maxVal
};
allParam.Add(currItem);
currItem = new objItem()
{
uid = item.Value.name,
name = !string.IsNullOrEmpty(item.Value.description) ? item.Value.description : item.Value.name,
writable = false,
UM = item.Value.unit,
valMin = item.Value.minVal,
valMax = item.Value.maxVal
};
allParam.Add(currItem);
}
}
// invio su cloud parametri SE sono connesso all'OPC-ua...
if (serverOk)
+10 -2
View File
@@ -788,7 +788,15 @@ namespace IOB_WIN_NEXT
case plcDataType.Int:
valInt = getScaledInt(currMem);
CurrVal = ModbusClient.ConvertIntToRegisters(valInt);
if (byteSize == 1)
{
CurrVal[0] = valInt;
}
else
{
CurrVal = ModbusClient.ConvertIntToRegisters(valInt);
}
fatto = writeInputReg(currMem.index, CurrVal);
break;
@@ -1304,7 +1312,7 @@ namespace IOB_WIN_NEXT
else
{
lutAddress--;
Array.Copy(HoldingRegisterLUT[lutAddress], 1,listInt, 0, 1);
Array.Copy(HoldingRegisterLUT[lutAddress], 1, listInt, 0, 1);
}
}
else