Merge branch 'release/UpdateSimAllarmi'

This commit is contained in:
Samuele Locatelli
2022-06-30 11:31:45 +02:00
15 changed files with 293 additions and 61 deletions
+114 -2
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": {
"A_Stag_H2O": {
@@ -19,7 +75,7 @@
"A_Stag_Prod1": {
"name": "A_Stag_Prod1",
"description": "Linea A Totale Prodotto 1 Stagione",
"memAddr": "41003",
"memAddr": "40003",
"tipoMem": "HLPInt",
"index": 1003,
"size": 2,
@@ -33,7 +89,7 @@
"A_Stag_Prod2": {
"name": "A_Stag_Prod2",
"description": "Linea A Totale Prodotto 2 Stagione",
"memAddr": "41005",
"memAddr": "40005",
"tipoMem": "HLPInt",
"index": 1005,
"size": 2,
@@ -169,6 +225,62 @@
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"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": "%"
}
}
}
@@ -1,5 +1,6 @@
{
"ReadBlocks": {
"40999": 30
"40016": 16,
"40999": 32
}
}
@@ -1,5 +1,47 @@
{
"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": "%"
}
},
"mMapRead": {
"Stag_H2O": {
@@ -113,6 +155,48 @@
"minVal": 0,
"maxVal": 999999999,
"unit": "l"
},
"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": "%"
}
}
}
@@ -1,5 +1,6 @@
{
"ReadBlocks": {
"40999": 30
"40016": 16,
"40999": 32
}
}
+2 -2
View File
@@ -27,7 +27,6 @@ ADDR_READ=40001
ADDR_WRITE=41000
SIZE_READ=2400
SIZE_WRITE=0
;HR_BASE_ADDR=40000
HR_BASE_ADDR=40000
DELTA_BASE=0
@@ -63,10 +62,11 @@ timerIntMs=100
minWait=50
maxWait=150
; conf parametri memoria READ/WRITE
PARAM_CONF=GIACO_CENTERFRIGO.json
NO_PING=TRUE
NO_PING=FALSE
; conf blocchi memoria x READ
MEM_BLOCK=GIACO_CENTERFRIGO_MBlock.json
; conf aree allarme
+30 -2
View File
@@ -1,5 +1,33 @@
{
"mMapWrite": {
"TestWrite": {
"name": "TestWrite",
"description": "Test Scrittura",
"memAddr": "41621",
"tipoMem": "Real",
"index": 1621,
"size": 2,
"func": "MEDIAN",
"period": 60,
"factor": 1,
"minVal": -100,
"maxVal": 100,
"unit": "°C"
},
"SetPoint_Tunnel": {
"name": "SetPoint_Tunnel",
"description": "Setpoint Tunnel",
"memAddr": "41560",
"tipoMem": "Real",
"index": 1560,
"size": 2,
"func": "MEDIAN",
"period": 60,
"factor": 1,
"minVal": -100,
"maxVal": 100,
"unit": "°C"
}
},
"mMapRead": {
"Temp_Tunnel": {
@@ -131,9 +159,9 @@
"SetPoint_Cella_04": {
"name": "SetPoint_Cella_04",
"description": "Setpoint Cella 04",
"memAddr": "42080",
"memAddr": "41840",
"tipoMem": "Real",
"index": 2080,
"index": 1840,
"size": 2,
"func": "MEDIAN",
"period": 60,
@@ -1,9 +1,8 @@
{
"ReadBlocks": {
//"41060": 4,
//"41300": 4,
"41500": 32,
"41532": 32,
"41616": 32,
"41650": 32,
"41682": 32,
"41800": 32,
@@ -21,7 +20,6 @@
"42910": 44,
"43040": 44,
"43160": 44,
"43280": 44,
//"43400": 4
"43280": 44
}
}
@@ -124,31 +124,31 @@
"##"
]
},
//{
// "description": "Allarmi Cella 04",
// "tipoMem": "DInt",
// "memAddr": "42164",
// "index": 2164,
// "size": 2,
// "messages": [
// "ALLARME ALTA TEMPERATURA AMBIENTE CELLA 04",
// "##",
// "##",
// "##",
// "##",
// "##",
// "##",
// "##",
// "##",
// "##",
// "ALLARME CUMULATIVO CELLA 04",
// "##",
// "##",
// "##",
// "##",
// "##"
// ]
//},
// {
// "description": "Allarmi Cella 04",
// "tipoMem": "DInt",
// "memAddr": "42164",
// "index": 2164,
// "size": 2,
// "messages": [
// "ALLARME ALTA TEMPERATURA AMBIENTE CELLA 04",
// "##",
// "##",
// "##",
// "##",
// "##",
// "##",
// "##",
// "##",
// "##",
// "ALLARME CUMULATIVO CELLA 04",
// "##",
// "##",
// "##",
// "##",
// "##"
// ]
// },
{
"description": "Allarmi Sala Bassa",
"tipoMem": "DInt",
@@ -3,7 +3,6 @@
;Centro di lavoro OpcUa
CNCTYPE=OpcUaOmronIcoel
PING_MS_TIMEOUT=500
IOB_NAME=GIACO_ICOEL
[MACHINE]
VENDOR=ICOEL
+1 -1
View File
@@ -69,7 +69,7 @@ ENABLE_CLI_RESTART=TRUE
SyncStateDb=localhost\sqlexpress
SyncStateUser=egalware
SyncStatePwd=egalware2022
SyncStateCTout=300
SyncStateCTout=
; clock base (da 10ms)
timerIntMs=20
+1 -1
View File
@@ -82,6 +82,6 @@ CLI_INST=SteamWareSim
;STARTLIST=GIACO_ICOEL_002
;STARTLIST=GIACO_CENTERFRIGO
;STARTLIST=GIACO_NWSE
STARTLIST=GIACO_CEDAX_001
STARTLIST=SIMUL_01
MAXCNC=10
+1 -1
View File
@@ -46,7 +46,7 @@ MIN_DURATA_ODL=240
; per il simulatore: 50|1 = WAIT 50, DURATION 1 con riferimento al PERIODO base (PER_BASE in ms, default 1 secondo)
PER_BASE=10100
SIM_PZCNT=5|1
SIM_ALARM=1000|20
SIM_ALARM=500|20
SIM_MANU=50|6
; indica gestione e simulazione bit 5 --> slow
SIM_SLOW=3600|20
+5 -10
View File
@@ -548,7 +548,7 @@ namespace IOB_WIN_NEXT
{
try
{
currPLC.WriteMultipleRegisters(startAddr, currRegVal);
currPLC.WriteMultipleRegisters(startAddr + deltaBase, currRegVal);
answ = true;
}
catch
@@ -1110,11 +1110,6 @@ namespace IOB_WIN_NEXT
/// </summary>
private double deltaVal = 0;
/// <summary>
/// Indirizzo di base x fare il calcolo di dove leggere in ModBus
/// </summary>
private int HoldRegBaseAddr = 40001;
#endregion Private Fields
#region Private Properties
@@ -1222,20 +1217,20 @@ namespace IOB_WIN_NEXT
/// <returns></returns>
private static int getScaledInt(dataConf currMem, bool isWrite = false)
{
int valInt=0;
int valInt = 0;
double temp;
// prima faccio eventuale fattore di scala...
double.TryParse(currMem.value.Replace(".",","), out temp);
double.TryParse(currMem.value.Replace(".", ","), out temp);
//int.TryParse(currMem.value, out valInt);
if (currMem.factor != 1)
{
if (isWrite)
{
valInt = (int)(temp*10 / currMem.factor)/10;
valInt = (int)(temp * 10 / currMem.factor) / 10;
}
else
{
valInt = (int)(temp*10 * currMem.factor)/10;
valInt = (int)(temp * 10 * currMem.factor) / 10;
}
}
-6
View File
@@ -46,12 +46,6 @@ namespace IOB_WIN_NEXT
{
try
{
#if false
// test lettura da eliminare
testRead();
#endif
processDynData();
}
catch (Exception exc)
+24 -4
View File
@@ -139,6 +139,11 @@ namespace IOB_WIN_NEXT
lastWarnODL = adesso;
lastEvCheck = adesso;
lastSimData = adesso;
// setup allarmi simulati
for (int i = 1; i <= 8; i++)
{
alarmMessages.Add($"Allarme {i:000}");
}
// sistemo parametri x simulazione...
if (cIobConf.optPar.Count > 0)
{
@@ -198,6 +203,10 @@ namespace IOB_WIN_NEXT
{
}
private Random rnd = new Random();
private int currSimAlarmCode = 0;
private List<string> alarmMessages = new List<string>();
/// <summary>
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
/// </summary>
@@ -329,12 +338,24 @@ namespace IOB_WIN_NEXT
{
// segnalo BIT
B_input += (1 << 3);
// se non ancora fatto, simulo insorgenza allarme
if (currSimAlarmCode == 0)
{
// simulo una bitmap di max 8 allarmi, 1..255
currSimAlarmCode = rnd.Next(1, 255);
// invio allarme, 0 --> sim
sendAlarmVariations("SIM_BANK", 0, 0, (uint)currSimAlarmCode, alarmMessages);
}
// decremento duration
bit3.duration--;
// controllo se sia scaduta la duration... in quel caso reset...
if (bit3.duration <= 0)
{
bit3 = setupSimPar("SIM_ALARM");
// invio fine allarme: sim --> 0
sendAlarmVariations("SIM_BANK", 0, (uint)currSimAlarmCode, 0, alarmMessages);
// simulo terminazione allarme
currSimAlarmCode = 0;
}
}
else if (bit6.wait <= 0)
@@ -580,7 +601,6 @@ namespace IOB_WIN_NEXT
int.TryParse(param[0], out answ.wait);
int.TryParse(param[1], out answ.duration);
// aggiongo noise, +/- 40%...
Random rnd = new Random();
int noise = rnd.Next(1, answ.wait * 40 / 100);
answ.wait += noise - (answ.wait * 20 / 100);
}
@@ -892,13 +912,13 @@ namespace IOB_WIN_NEXT
if (bit5 != null)
bit5.wait--;
if (simDich != null)
if (simDich != null)
simDich.wait--;
if (simRC != null)
if (simRC != null)
simRC.wait--;
if (simRS != null)
if (simRS != null)
simRS.wait--;
}
catch