Merge branch 'release/AddCimolaiStatusMan'

This commit is contained in:
Samuele E. Locatelli
2022-12-08 18:50:25 +01:00
21 changed files with 1314 additions and 719 deletions
+21
View File
@@ -18,6 +18,27 @@ namespace IOB_UT_NEXT
OR
}
/// <summary>
/// Modalità di calcolo tra serie di valori
/// </summary>
public enum calcMode
{
/// <summary>
/// NEssun processing
/// </summary>
None = 0,
/// <summary>
/// somma dei valori
/// </summary>
sum,
/// <summary>
/// produttoria
/// </summary>
prod
}
/// <summary>
/// Elenco MODI CNC
/// </summary>
+45 -18
View File
@@ -166,7 +166,6 @@ namespace IOB_UT_NEXT
/// </summary>
public void setupData()
{
// inizializzo vettore valore allarmi x banco int8 x iniziare
alarmsState = new uint[size];
alarmsMask = new uint[size];
@@ -260,6 +259,11 @@ namespace IOB_UT_NEXT
/// </summary>
public string keyEStop { get; set; } = "";
/// <summary>
/// Nome variabile x ExeMode
/// </summary>
public string keyExeMode { get; set; } = "";
/// <summary>
/// Nome variabile x pezzi FATTI
/// </summary>
@@ -286,9 +290,14 @@ namespace IOB_UT_NEXT
public string keyRunMode { get; set; } = "";
/// <summary>
/// Nome variabile x ExeMode
/// Aree di memoria lettura
/// </summary>
public string keyExeMode { get; set; } = "";
public Dictionary<string, dataConfTSVC> mMapRead { get; set; } = new Dictionary<string, dataConfTSVC>();
/// <summary>
/// Aree di memoria scrittura
/// </summary>
public Dictionary<string, dataConf> mMapWrite { get; set; } = new Dictionary<string, dataConf>();
/// <summary>
/// Dictionary dei nomi da cercare come "endsWith" a cui applicare la soglia indicata
@@ -310,15 +319,18 @@ namespace IOB_UT_NEXT
/// </summary>
public bool runModeTrad { get; set; } = false;
/// <summary>
/// Aree di memoria lettura
/// </summary>
public Dictionary<string, dataConfTSVC> mMapRead { get; set; } = new Dictionary<string, dataConfTSVC>();
#endregion Public Properties
}
/// <summary>
/// Aree di memoria scrittura
/// </summary>
public Dictionary<string, dataConf> mMapWrite { get; set; } = new Dictionary<string, dataConf>();
/// <summary>
/// Oggetto x processing valori (elenco valori e modalità)
/// </summary>
public class calcConf
{
#region Public Properties
public calcMode calcMode { get; set; } = calcMode.None;
public List<string> listVal { get; set; } = new List<string>();
#endregion Public Properties
}
@@ -498,6 +510,22 @@ namespace IOB_UT_NEXT
/// </summary>
public uint BrowseValue { get; set; } = 5001;
/// <summary>
/// Lista valori calcolati/derivati da processare
/// </summary>
public Dictionary<string, calcConf> calcValues { get; set; } = new Dictionary<string, calcConf>();
/// <summary>
/// Numero minimo di secondi di durata di uno status
/// </summary>
public int minSecStatusDuration { get; set; } = 1;
/// <summary>
/// Numero minimo di secondi di attesa finale (es prima di chiedere chiusura ODL)
/// </summary>
public int minSecFinalWait { get; set; } = 30;
/// <summary>
/// Struttura dati x check condizione Contapezzi Abilitato (se vuoto = sempre abilitato)
/// </summary>
@@ -553,6 +581,12 @@ namespace IOB_UT_NEXT
/// </summary>
public List<string> filterItemsNodeId { get; set; } = new List<string>();
/// <summary>
/// Elenco item flux da FILTRARE per chiave tradotta/VALORE
/// es: Cimolai / Baglietto, RunModeVal NON VOGLIO inviare quando il valore è 0
/// </summary>
public Dictionary<string, List<string>> fluxLogKeyValVeto { get; set; } = new Dictionary<string, List<string>>();
public UserIdent Identity { get; set; } = new UserIdent();
/// <summary>
@@ -585,13 +619,6 @@ namespace IOB_UT_NEXT
/// </summary>
public WatchDogConf WatchDog { get; set; } = new WatchDogConf();
/// <summary>
/// Elenco item flux da FILTRARE per chiave tradotta/VALORE
/// es: Cimolai / Baglietto, RunModeVal NON VOGLIO inviare quando il valore è 0
/// </summary>
public Dictionary<string,List<string>> fluxLogKeyValVeto { get; set; } = new Dictionary<string, List<string>>();
#endregion Public Properties
}
@@ -71,7 +71,6 @@ CSV_ADD_HEADER=true
VETO_SEND_SNAPSHOT=3
;NO_PING=FALSE
; conf aree allarme
ALARM_CONF=BAGLIETTO_CIMOLAI_01_alarm.json
@@ -193,5 +193,18 @@
"-1",
"0"
]
},
"minSecStatusDuration": 20,
"minSecFinalWait": 60,
"calcValues": {
"PesoTot": {
"calcMode": "sum",
"listVal": [
"PLC/DB231/peso1",
"PLC/DB231/peso2",
"PLC/DB231/peso3",
"PLC/DB231/peso4"
]
}
}
}
@@ -77,5 +77,10 @@ ALARM_CONF=GIACO_CENTERFRIGO_alarm.json
; rimozione check limiti min/max dynData
disDynDataRangeCheck=true
; conf file import
FILE_IMPORT_FOLDER=C:\GiacenzeTuri
FILE_IMPORT_TYPE=*.xlsx
FILE_ARCHIVE_FOLDER=C:\GiacenzeTuri\archivio
[BRANCH]
NAME=master
+11 -3
View File
@@ -1,6 +1,6 @@
;Configurazione IOB-WIN
[IOB]
;Impianto SAIM Locorotondo - Giacovelli
;Impianto SAIM 01 Locorotondo - Giacovelli
CNCTYPE=MODBUS_TCP_SAIM
PING_MS_TIMEOUT=1000
MinDeltaSec=5
@@ -24,11 +24,14 @@ CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
ADDR_READ=40001
ADDR_WRITE=40001
ADDR_READ=40000
ADDR_WRITE=40000
SIZE_READ=200
SIZE_WRITE=0
HR_BASE_ADDR=40000
;DELTA_BASE=1
DELTA_BASE=0
MODBUS_EXT_REG=0
[BLINK]
@@ -76,5 +79,10 @@ MEM_BLOCK=GIACO_SAIM_001_MBlock.json
; rimozione check limiti min/max dynData
disDynDataRangeCheck=true
; conf file import
FILE_IMPORT_FOLDER=C:\GiacenzeLocorotondo
FILE_IMPORT_TYPE=*.xlsx
FILE_ARCHIVE_FOLDER=C:\GiacenzeLocorotondo\archivio
[BRANCH]
NAME=master
+357 -185
View File
@@ -1,189 +1,361 @@
{
"mMapWrite": {
},
"mMapRead": {
"Sonda01": {
"name": "Sonda01",
"description": "Sonda 01",
"memAddr": "40110",
"tipoMem": "DInt",
"index": 110,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
"mMapWrite": {
"PPM_min_C1": {
"name": "PPM_min_C1",
"description": "PPM min Camera 1",
"memAddr": "40031",
"tipoMem": "Int",
"index": 31,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"PPM_max_C1": {
"name": "PPM_max_C1",
"description": "PPM MAX Camera 1",
"memAddr": "40032",
"tipoMem": "Int",
"index": 32,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
}
},
"Sonda02": {
"name": "Sonda02",
"description": "Sonda 02",
"memAddr": "40120",
"tipoMem": "DInt",
"index": 120,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda03": {
"name": "Sonda03",
"description": "Sonda 03",
"memAddr": "40130",
"tipoMem": "DInt",
"index": 130,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda04": {
"name": "Sonda04",
"description": "Sonda 04",
"memAddr": "40140",
"tipoMem": "DInt",
"index": 140,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda05": {
"name": "Sonda05",
"description": "Sonda 05",
"memAddr": "40150",
"tipoMem": "DInt",
"index": 150,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda06": {
"name": "Sonda06",
"description": "Sonda 06",
"memAddr": "40160",
"tipoMem": "DInt",
"index": 160,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper01": {
"name": "Amper01",
"description": "Amper 01",
"memAddr": "40010",
"tipoMem": "DInt",
"index": 10,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper02": {
"name": "Amper02",
"description": "Amper 02",
"memAddr": "40012",
"tipoMem": "DInt",
"index": 12,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper03": {
"name": "Amper03",
"description": "Amper 03",
"memAddr": "40014",
"tipoMem": "DInt",
"index": 14,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper04": {
"name": "Amper04",
"description": "Amper 04",
"memAddr": "40016",
"tipoMem": "DInt",
"index": 16,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper05": {
"name": "Amper05",
"description": "Amper 05",
"memAddr": "400118",
"tipoMem": "DInt",
"index": 18,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper06": {
"name": "Amper06",
"description": "Amper 06",
"memAddr": "40020",
"tipoMem": "DInt",
"index": 20,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper07": {
"name": "Amper07",
"description": "Amper 07",
"memAddr": "40022",
"tipoMem": "DInt",
"index": 22,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
"mMapRead": {
"PPM_min_C1": {
"name": "PPM_min_C1",
"description": "PPM min Camera 1",
"memAddr": "40031",
"tipoMem": "Int",
"index": 31,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"PPM_max_C1": {
"name": "PPM_max_C1",
"description": "PPM MAX Camera 1",
"memAddr": "40032",
"tipoMem": "Int",
"index": 32,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
<<
<< << < HEAD "PPM_min_C2": {
"name": "PPM_min_C2",
"description": "PPM min Camera 2",
"memAddr": "40033",
"tipoMem": "Int",
"index": 33,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"PPM_max_C2": {
"name": "PPM_max_C2",
"description": "PPM MAX Camera 2",
"memAddr": "40034",
"tipoMem": "Int",
"index": 34,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
===
=== = >>>
>>> > 3 f58a527417de7c99b3e5f3943693ff2d5b36af0 "Sonda01": {
"name": "Sonda01",
"description": "Sonda 01",
"memAddr": "30110",
"tipoMem": "Int",
"index": 110,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda02": {
"name": "Sonda02",
"description": "Sonda 02",
"memAddr": "30120",
"tipoMem": "Int",
"index": 120,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda03": {
"name": "Sonda03",
"description": "Sonda 03",
"memAddr": "30130",
"tipoMem": "Int",
"index": 130,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda04": {
"name": "Sonda04",
"description": "Sonda 04",
"memAddr": "30140",
"tipoMem": "Int",
"index": 140,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda05": {
"name": "Sonda05",
"description": "Sonda 05",
"memAddr": "30150",
"tipoMem": "Int",
"index": 150,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda06": {
"name": "Sonda06",
"description": "Sonda 06",
"memAddr": "30160",
"tipoMem": "Int",
"index": 160,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper01": {
"name": "Amper01",
"description": "Amper 01",
"memAddr": "30010",
"tipoMem": "Int",
"index": 10,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper02": {
"name": "Amper02",
"description": "Amper 02",
"memAddr": "30011",
"tipoMem": "Int",
"index": 11,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper03": {
"name": "Amper03",
"description": "Amper 03",
"memAddr": "30012",
"tipoMem": "Int",
"index": 12,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper04": {
"name": "Amper04",
"description": "Amper 04",
"memAddr": "30013",
"tipoMem": "Int",
"index": 13,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper05": {
"name": "Amper05",
"description": "Amper 05",
"memAddr": "30014",
"tipoMem": "Int",
"index": 14,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper06": {
"name": "Amper06",
"description": "Amper 06",
"memAddr": "30015",
"tipoMem": "Int",
"index": 15,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper07": {
"name": "Amper07",
"description": "Amper 07",
"memAddr": "30016",
"tipoMem": "Int",
"index": 16,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper08": {
"name": "Amper08",
"description": "Amper 08",
"memAddr": "30017",
"tipoMem": "Int",
"index": 17,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam01": {
"name": "ContCam01",
"description": "Cont Camera 01",
"memAddr": "30021",
"tipoMem": "Int",
"index": 21,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam02": {
"name": "ContCam02",
"description": "Cont Camera 02",
"memAddr": "30022",
"tipoMem": "Int",
"index": 22,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam03": {
"name": "ContCam03",
"description": "Cont Camera 03",
"memAddr": "30023",
"tipoMem": "Int",
"index": 23,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam04": {
"name": "ContCam04",
"description": "Cont Camera 04",
"memAddr": "30024",
"tipoMem": "Int",
"index": 24,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam05": {
"name": "ContCam05",
"description": "Cont Camera 05",
"memAddr": "30025",
"tipoMem": "Int",
"index": 25,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam06": {
"name": "ContCam06",
"description": "Cont Camera 06",
"memAddr": "30026",
"tipoMem": "Int",
"index": 26,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
}
}
}
}
@@ -1,7 +1,10 @@
{
"ReadBlocks": {
"40010": 10,
"40100": 40,
"40140": 30
"10000": 10,
"10100": 10,
"30010": 40,
"30100": 40,
"30140": 30,
"40030": 20
}
}
+11 -3
View File
@@ -1,6 +1,6 @@
;Configurazione IOB-WIN
[IOB]
;Impianto SAIM Locorotondo - Giacovelli
;Impianto SAIM 02 Locorotondo - Giacovelli
CNCTYPE=MODBUS_TCP_SAIM
PING_MS_TIMEOUT=1000
MinDeltaSec=5
@@ -24,11 +24,14 @@ CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
ADDR_READ=40001
ADDR_WRITE=40001
ADDR_READ=40000
ADDR_WRITE=40000
SIZE_READ=200
SIZE_WRITE=0
HR_BASE_ADDR=40000
;DELTA_BASE=1
DELTA_BASE=0
MODBUS_EXT_REG=0
[BLINK]
@@ -76,5 +79,10 @@ MEM_BLOCK=GIACO_SAIM_002_MBlock.json
; rimozione check limiti min/max dynData
disDynDataRangeCheck=true
; conf file import
FILE_IMPORT_FOLDER=C:\GiacenzeLocorotondo
FILE_IMPORT_TYPE=*.xlsx
FILE_ARCHIVE_FOLDER=C:\GiacenzeLocorotondo\archivio
[BRANCH]
NAME=master
+120 -83
View File
@@ -1,14 +1,64 @@
{
"mMapWrite": {
},
"mMapRead": {
"PPM_min_C1": {
"name": "PPM_min_C1",
"description": "PPM min Camera 1",
"memAddr": "40031",
"tipoMem": "Int",
"index": 31,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"PPM_max_C1": {
"name": "PPM_max_C1",
"description": "PPM MAX Camera 1",
"memAddr": "40032",
"tipoMem": "Int",
"index": 32,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"PPM_min_C2": {
"name": "PPM_min_C2",
"description": "PPM min Camera 2",
"memAddr": "40033",
"tipoMem": "Int",
"index": 33,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"PPM_max_C2": {
"name": "PPM_max_C2",
"description": "PPM MAX Camera 2",
"memAddr": "40034",
"tipoMem": "Int",
"index": 34,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"Sonda01": {
"name": "Sonda01",
"description": "Sonda 01",
"memAddr": "40110",
"tipoMem": "DInt",
"memAddr": "30110",
"tipoMem": "Int",
"index": 110,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -19,10 +69,10 @@
"Sonda02": {
"name": "Sonda02",
"description": "Sonda 02",
"memAddr": "40120",
"tipoMem": "DInt",
"memAddr": "30120",
"tipoMem": "Int",
"index": 120,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -33,10 +83,10 @@
"Sonda03": {
"name": "Sonda03",
"description": "Sonda 03",
"memAddr": "40130",
"tipoMem": "DInt",
"memAddr": "30130",
"tipoMem": "Int",
"index": 130,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -47,10 +97,10 @@
"Sonda04": {
"name": "Sonda04",
"description": "Sonda 04",
"memAddr": "40140",
"tipoMem": "DInt",
"memAddr": "30140",
"tipoMem": "Int",
"index": 140,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -58,42 +108,14 @@
"maxVal": 999999999,
"unit": "#"
},
"Sonda05": {
"name": "Sonda05",
"description": "Sonda 05",
"memAddr": "40150",
"tipoMem": "DInt",
"index": 150,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Sonda06": {
"name": "Sonda06",
"description": "Sonda 06",
"memAddr": "40160",
"tipoMem": "DInt",
"index": 160,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper01": {
"name": "Amper01",
"description": "Amper 01",
"memAddr": "40010",
"tipoMem": "DInt",
"memAddr": "30010",
"tipoMem": "Int",
"index": 10,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -104,10 +126,10 @@
"Amper02": {
"name": "Amper02",
"description": "Amper 02",
"memAddr": "40012",
"tipoMem": "DInt",
"index": 12,
"size": 2,
"memAddr": "30011",
"tipoMem": "Int",
"index": 11,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -118,10 +140,10 @@
"Amper03": {
"name": "Amper03",
"description": "Amper 03",
"memAddr": "40014",
"tipoMem": "DInt",
"index": 14,
"size": 2,
"memAddr": "30012",
"tipoMem": "Int",
"index": 12,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -132,10 +154,10 @@
"Amper04": {
"name": "Amper04",
"description": "Amper 04",
"memAddr": "40016",
"tipoMem": "DInt",
"index": 16,
"size": 2,
"memAddr": "30013",
"tipoMem": "Int",
"index": 13,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -143,13 +165,14 @@
"maxVal": 999999999,
"unit": "#"
},
"Amper05": {
"name": "Amper05",
"description": "Amper 05",
"memAddr": "400118",
"tipoMem": "DInt",
"index": 18,
"size": 2,
"ContCam01": {
"name": "ContCam01",
"description": "Cont Camera 01",
"memAddr": "30021",
"tipoMem": "Int",
"index": 21,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -157,27 +180,41 @@
"maxVal": 999999999,
"unit": "#"
},
"Amper06": {
"name": "Amper06",
"description": "Amper 06",
"memAddr": "40020",
"tipoMem": "DInt",
"index": 20,
"size": 2,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper07": {
"name": "Amper07",
"description": "Amper 07",
"memAddr": "40022",
"tipoMem": "DInt",
"ContCam02": {
"name": "ContCam02",
"description": "Cont Camera 02",
"memAddr": "30022",
"tipoMem": "Int",
"index": 22,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam03": {
"name": "ContCam03",
"description": "Cont Camera 03",
"memAddr": "30023",
"tipoMem": "Int",
"index": 23,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam04": {
"name": "ContCam04",
"description": "Cont Camera 04",
"memAddr": "30024",
"tipoMem": "Int",
"index": 24,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -1,7 +1,9 @@
{
"ReadBlocks": {
"40010": 10,
"40100": 40,
"40140": 30
"10000": 10,
"10100": 10,
"30010": 20,
"30100": 50,
"40030": 10
}
}
+1 -1
View File
@@ -31,7 +31,7 @@ SIZE_WRITE=0
HR_BASE_ADDR=40000
;DELTA_BASE=1
DELTA_BASE=0
MODBUS_EXT_REG=1
MODBUS_EXT_REG=0
[BLINK]
+187 -69
View File
@@ -1,42 +1,63 @@
{
"mMapWrite": {
},
"mMapRead": {
"GenStatus": {
"name": "GenStatus",
"description": "General Status bit",
"memAddr": "100000",
"tipoMem": "DInt",
"index": 0,
"size": 10,
"func": "MAX",
"period": 90,
"factor": 1,
"PPM_min_C1": {
"name": "PPM_min_C1",
"description": "PPM min Camera 1",
"memAddr": "40031",
"tipoMem": "Int",
"index": 31,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
"maxVal": 1000,
"unit": "PPM"
},
"ActiveCamera": {
"name": "ActiveCamera",
"description": "Active Camera Status bit",
"memAddr": "100100",
"tipoMem": "DInt",
"index": 0,
"size": 10,
"func": "MAX",
"period": 90,
"factor": 1,
"PPM_max_C1": {
"name": "PPM_max_C1",
"description": "PPM MAX Camera 1",
"memAddr": "40032",
"tipoMem": "Int",
"index": 32,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
"maxVal": 1000,
"unit": "PPM"
},
"PPM_min_C2": {
"name": "PPM_min_C2",
"description": "PPM min Camera 2",
"memAddr": "40033",
"tipoMem": "Int",
"index": 33,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"PPM_max_C2": {
"name": "PPM_max_C2",
"description": "PPM MAX Camera 2",
"memAddr": "40034",
"tipoMem": "Int",
"index": 34,
"size": 1,
"factor": 100,
"minVal": 0,
"maxVal": 1000,
"unit": "PPM"
},
"Sonda01": {
"name": "Sonda01",
"description": "Sonda 01",
"memAddr": "300110",
"tipoMem": "DInt",
"memAddr": "30110",
"tipoMem": "Int",
"index": 110,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -47,10 +68,10 @@
"Sonda02": {
"name": "Sonda02",
"description": "Sonda 02",
"memAddr": "300120",
"tipoMem": "DInt",
"memAddr": "30120",
"tipoMem": "Int",
"index": 120,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -61,10 +82,10 @@
"Sonda03": {
"name": "Sonda03",
"description": "Sonda 03",
"memAddr": "300130",
"tipoMem": "DInt",
"memAddr": "30130",
"tipoMem": "Int",
"index": 130,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -75,10 +96,10 @@
"Sonda04": {
"name": "Sonda04",
"description": "Sonda 04",
"memAddr": "300140",
"tipoMem": "DInt",
"memAddr": "30140",
"tipoMem": "Int",
"index": 140,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -89,10 +110,10 @@
"Sonda05": {
"name": "Sonda05",
"description": "Sonda 05",
"memAddr": "300150",
"tipoMem": "DInt",
"memAddr": "30150",
"tipoMem": "Int",
"index": 150,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -103,10 +124,10 @@
"Sonda06": {
"name": "Sonda06",
"description": "Sonda 06",
"memAddr": "300160",
"tipoMem": "DInt",
"memAddr": "30160",
"tipoMem": "Int",
"index": 160,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -114,14 +135,13 @@
"maxVal": 999999999,
"unit": "#"
},
"Amper01": {
"name": "Amper01",
"description": "Amper 01",
"memAddr": "300010",
"tipoMem": "DInt",
"memAddr": "30010",
"tipoMem": "Int",
"index": 10,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -132,10 +152,10 @@
"Amper02": {
"name": "Amper02",
"description": "Amper 02",
"memAddr": "300012",
"tipoMem": "DInt",
"index": 12,
"size": 2,
"memAddr": "30011",
"tipoMem": "Int",
"index": 11,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -146,10 +166,10 @@
"Amper03": {
"name": "Amper03",
"description": "Amper 03",
"memAddr": "300014",
"tipoMem": "DInt",
"index": 14,
"size": 2,
"memAddr": "30012",
"tipoMem": "Int",
"index": 12,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -160,10 +180,10 @@
"Amper04": {
"name": "Amper04",
"description": "Amper 04",
"memAddr": "300016",
"tipoMem": "DInt",
"index": 16,
"size": 2,
"memAddr": "30013",
"tipoMem": "Int",
"index": 13,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -174,10 +194,10 @@
"Amper05": {
"name": "Amper05",
"description": "Amper 05",
"memAddr": "3000118",
"tipoMem": "DInt",
"index": 18,
"size": 2,
"memAddr": "30014",
"tipoMem": "Int",
"index": 14,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -188,10 +208,10 @@
"Amper06": {
"name": "Amper06",
"description": "Amper 06",
"memAddr": "300020",
"tipoMem": "DInt",
"index": 20,
"size": 2,
"memAddr": "30015",
"tipoMem": "Int",
"index": 15,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -202,10 +222,108 @@
"Amper07": {
"name": "Amper07",
"description": "Amper 07",
"memAddr": "300022",
"tipoMem": "DInt",
"memAddr": "30016",
"tipoMem": "Int",
"index": 16,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"Amper08": {
"name": "Amper08",
"description": "Amper 08",
"memAddr": "30017",
"tipoMem": "Int",
"index": 17,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam01": {
"name": "ContCam01",
"description": "Cont Camera 01",
"memAddr": "30021",
"tipoMem": "Int",
"index": 21,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam02": {
"name": "ContCam02",
"description": "Cont Camera 02",
"memAddr": "30022",
"tipoMem": "Int",
"index": 22,
"size": 2,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam03": {
"name": "ContCam03",
"description": "Cont Camera 03",
"memAddr": "30023",
"tipoMem": "Int",
"index": 23,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam04": {
"name": "ContCam04",
"description": "Cont Camera 04",
"memAddr": "30024",
"tipoMem": "Int",
"index": 24,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam05": {
"name": "ContCam05",
"description": "Cont Camera 05",
"memAddr": "30025",
"tipoMem": "Int",
"index": 25,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "#"
},
"ContCam06": {
"name": "ContCam06",
"description": "Cont Camera 06",
"memAddr": "30026",
"tipoMem": "Int",
"index": 26,
"size": 1,
"func": "MAX",
"period": 90,
"factor": 1,
@@ -1,9 +1,10 @@
{
"ReadBlocks": {
"100000": 10,
"100100": 10,
"300010": 10,
"300100": 40,
"300140": 30
"10000": 10,
"10100": 10,
"30010": 40,
"30100": 40,
"30140": 30,
"40030": 20
}
}
@@ -57,6 +57,6 @@
"AlarmIntCond": "40000|0=0",
"ManualIntCond": "40000|0=1",
"EStopBitCond": "40001.0=1",
"WorkIntCond": "40000|0=2,4"
"WorkIntCond": "40000|0=2,4,5"
}
}
@@ -57,6 +57,6 @@
"AlarmIntCond": "40000|0=0",
"ManualIntCond": "40000|0=1",
"EStopBitCond": "40001.0=1",
"WorkIntCond": "40000|0=2,4"
"WorkIntCond": "40000|0=2,4,5"
}
}
+2 -2
View File
@@ -43,7 +43,7 @@ CLI_INST=SteamWareSim
;STARTLIST=FINASSI_HELPI_01
;STARTLIST=FINASSI_OMP_01
;STARTLIST=BAGLIETTO_CIMOLAI_01
STARTLIST=SIMUL_01
;STARTLIST=GIACO_SAIM_003
;STARTLIST=SIMUL_01
STARTLIST=GIACO_SAIM_003
MAXCNC=10
+276 -234
View File
@@ -25,96 +25,6 @@ namespace IOB_WIN_NEXT
{
public class IobGeneric
{
/// <summary>
/// Folder in cui salvare i file importati (es excel)
/// </summary>
protected string fileArchiveFolder { get; set; } = "";
/// <summary>
/// Folder da cui importare i file (es excel)
/// </summary>
protected string fileImportFolder { get; set; } = "";
/// <summary>
/// Tipologia di files da importare (default excel)
/// </summary>
protected string fileImportType { get; set; } = "*.xslx";
/// <summary>
/// Procedura di import file...
/// </summary>
/// <param name="fileItem"></param>
protected virtual bool importFile(string fileItem)
{
return false;
}
/// <summary>
/// Effettua eventuale file import, archiviando file importati
/// </summary>
/// <returns></returns>
protected virtual bool processFileImport()
{
bool answ = false;
if (!string.IsNullOrEmpty(fileImportFolder))
{
// verifico esistenza folders...
if (Directory.Exists(fileImportFolder))
{
// verifico archivio
string dirArchive = $"{fileImportFolder}/archive";
if (!Directory.Exists(dirArchive))
{
Directory.CreateDirectory(dirArchive);
}
// cerco files
var listFiles = Directory.GetFiles(fileImportFolder, fileImportType);
// se li trovo --> chiamo import!
if (listFiles != null && listFiles.Length > 0)
{
foreach (var fileItem in listFiles)
{
string errore = "";
answ = importFile(fileItem);
if (!answ)
{
errore = $"Errore in fase di importFile x {fileItem}";
}
else
{
// provo forzare send...
answ = svuotaCodaRawTransf(true);
if (!answ)
{
errore = $"Errore in fase di invio dati svuotaCodaRawTransf x {fileItem}";
}
else
{
// sposto file...
File.Move(fileItem, $"{dirArchive}/{Path.GetFileName(fileItem)}");
}
}
// log eventuali errori
if (!answ)
{
string dirError = $"{fileImportFolder}/errors";
if (!Directory.Exists(dirError))
{
Directory.CreateDirectory(dirError);
}
// sposto file...
File.Move(fileItem, $"{dirError}/{Path.GetFileName(fileItem)}");
// segno errore!
string fileError = $"{fileImportFolder}/errors.log";
File.AppendAllText(fileError, errore);
}
}
}
}
}
return answ;
}
#region Public Fields
/// <summary>
@@ -905,6 +815,26 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// URL per chiamata generazione ODL giornalieri alla data
/// </summary>
public string urlFixDailyOdl
{
get
{
string answ = "";
try
{
answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDALIVE}/fixDailyOdl/{cIobConf.codIOB}";
}
catch (Exception exc)
{
lgError(exc, "Errore in composizione urlFixDailyOdl");
}
return answ;
}
}
/// <summary>
/// URL per forzare split ODL...
/// </summary>
@@ -982,44 +912,6 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// URL per recupero dati ODL alla data...
/// </summary>
public string urlGetOdlAtDate(DateTime dtRif)
{
string answ = "";
try
{
answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDALIVE}/getOdlAtDate/{cIobConf.codIOB}?dateRif={dtRif:yyyyMMdd}";
}
catch (Exception exc)
{
lgError(exc, $"Errore in composizione urlGetOdlAtDate per {dtRif}{Environment.NewLine}{exc}");
}
return answ;
}
/// <summary>
/// URL per chiamata generazione ODL giornalieri alla data
/// </summary>
public string urlFixDailyOdl
{
get
{
string answ = "";
try
{
answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDALIVE}/fixDailyOdl/{cIobConf.codIOB}";
}
catch (Exception exc)
{
lgError(exc, "Errore in composizione urlFixDailyOdl");
}
return answ;
}
}
/// <summary>
/// URL per recupero PODL correnti x macchina...
/// </summary>
@@ -1173,6 +1065,26 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// URL per richiesta chiusura manuale ad utente x ODL corrente (metodo GET)...
/// </summary>
public string urlODLAskClose
{
get
{
string answ = "";
try
{
answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDALIVE}/askCloseODL/{cIobConf.codIOB}?idxOdl=";
}
catch (Exception exc)
{
lgError(exc, "Errore in composizione urlODLClose");
}
return answ;
}
}
/// <summary>
/// URL per chiusura ODL corrente (metodo GET)...
/// </summary>
@@ -4095,6 +4007,23 @@ namespace IOB_WIN_NEXT
return answ;
}
/// <summary>
/// URL per recupero dati ODL alla data...
/// </summary>
public string urlGetOdlAtDate(DateTime dtRif)
{
string answ = "";
try
{
answ = $@"{cIobConf.serverData.TRANSP}://{cIobConf.serverData.MPIP}{cIobConf.serverData.MPURL}{cIobConf.serverData.CMDALIVE}/getOdlAtDate/{cIobConf.codIOB}?dateRif={dtRif:yyyyMMdd}";
}
catch (Exception exc)
{
lgError(exc, $"Errore in composizione urlGetOdlAtDate per {dtRif}{Environment.NewLine}{exc}");
}
return answ;
}
/// <summary>
/// Fornisce URL INPUT per i parametri richiesti
/// </summary>
@@ -4223,6 +4152,11 @@ namespace IOB_WIN_NEXT
/// </summary>
protected bool enablePzCountByIob = true;
/// <summary>
/// dizionario (opzionale) xz decodifica file da importare
/// </summary>
protected Dictionary<string, int> FileDecod = new Dictionary<string, int>();
/// <summary>
/// indica che è richeisto forzatamente reset contapezzi
/// </summary>
@@ -4405,6 +4339,21 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// Folder in cui salvare i file importati (es excel)
/// </summary>
protected string fileArchiveFolder { get; set; } = "";
/// <summary>
/// Folder da cui importare i file (es excel)
/// </summary>
protected string fileImportFolder { get; set; } = "";
/// <summary>
/// Tipologia di files da importare (default excel)
/// </summary>
protected string fileImportType { get; set; } = "*.xslx";
/// <summary>
/// Variabile di appoggio GLOBALE x indicare che si può forzare reset contapezzi con
/// macchina in RUN
@@ -4904,6 +4853,15 @@ namespace IOB_WIN_NEXT
return answ;
}
/// <summary>
/// Procedura di import file...
/// </summary>
/// <param name="fileItem"></param>
protected virtual bool importFile(string fileItem)
{
return false;
}
/// <summary>
/// Recupera da server set di dati specifici x IOB
/// </summary>
@@ -5449,6 +5407,72 @@ namespace IOB_WIN_NEXT
{
}
/// <summary>
/// Effettua eventuale file import, archiviando file importati
/// </summary>
/// <returns></returns>
protected virtual bool processFileImport()
{
bool answ = false;
if (!string.IsNullOrEmpty(fileImportFolder))
{
// verifico esistenza folders...
if (Directory.Exists(fileImportFolder))
{
// verifico archivio
string dirArchive = $"{fileImportFolder}/archive";
if (!Directory.Exists(dirArchive))
{
Directory.CreateDirectory(dirArchive);
}
// cerco files
var listFiles = Directory.GetFiles(fileImportFolder, fileImportType);
// se li trovo --> chiamo import!
if (listFiles != null && listFiles.Length > 0)
{
foreach (var fileItem in listFiles)
{
string errore = "";
answ = importFile(fileItem);
if (!answ)
{
errore = $"Errore in fase di importFile x {fileItem}";
}
else
{
// provo forzare send...
answ = svuotaCodaRawTransf(true);
if (!answ)
{
errore = $"Errore in fase di invio dati svuotaCodaRawTransf x {fileItem}";
}
else
{
// sposto file...
File.Move(fileItem, $"{dirArchive}/{Path.GetFileName(fileItem)}");
}
}
// log eventuali errori
if (!answ)
{
string dirError = $"{fileImportFolder}/errors";
if (!Directory.Exists(dirError))
{
Directory.CreateDirectory(dirError);
}
// sposto file...
File.Move(fileItem, $"{dirError}/{Path.GetFileName(fileItem)}");
// segno errore!
string fileError = $"{fileImportFolder}/errors.log";
File.AppendAllText(fileError, errore);
}
}
}
}
}
return answ;
}
/// <summary>
/// Processa le richieste di scrittura memoria
/// </summary>
@@ -5667,6 +5691,19 @@ namespace IOB_WIN_NEXT
// FIXME TODO FARE !!!! invio PUT del file *_alarm.json
}
/// <summary>
/// Setup parametri decode file excel (opzionale)
/// </summary>
protected virtual void setupFileDecod()
{
// verifica se siano necessari configuraizoni speciali dalla excDecod:
// es: lettura/invio file excel
if (memMap.fileDecod != null && memMap.fileDecod.Count > 0)
{
FileDecod = memMap.fileDecod;
}
}
/// <summary>
/// setup parametri da file di conf
/// </summary>
@@ -5811,24 +5848,6 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// dizionario (opzionale) xz decodifica file da importare
/// </summary>
protected Dictionary<string, int> FileDecod = new Dictionary<string, int>();
/// <summary>
/// Setup parametri decode file excel (opzionale)
/// </summary>
protected virtual void setupFileDecod()
{
// verifica se siano necessari configuraizoni speciali dalla excDecod:
// es: lettura/invio file excel
if (memMap.fileDecod != null && memMap.fileDecod.Count > 0)
{
FileDecod = memMap.fileDecod;
}
}
/// <summary>
/// Cleanup stringa x impiego tipo ident da char dubbi
/// </summary>
@@ -5839,6 +5858,27 @@ namespace IOB_WIN_NEXT
return origData.Replace(".", "").Replace(" ", "_");
}
/// <summary>
/// Effettua chiamata MP-IO per cheidere all'utente se vuole effettuare chiusura ODL
/// corrente della macchina
/// </summary>
/// <returns></returns>
protected bool tryAskCloseODL()
{
bool fatto = false;
string fullUrl = $"{urlODLAskClose}{currIdxODL}";
try
{
// invio chiamata URL x chiusura ODL su macchina
string callResp = callUrl(fullUrl, false);
fatto = (callResp != "KO") ? true : false;
}
catch
{ }
lgInfo($"Eseguito tryAskCloseODL per {currIdxODL} | url: {fullUrl} | esito: {fatto}");
return fatto;
}
/// <summary>
/// Effettua chiamata MP-IO per tentare chiusura ODL corrente della macchina
/// </summary>
@@ -5846,17 +5886,104 @@ namespace IOB_WIN_NEXT
protected bool tryCloseODL()
{
bool fatto = false;
string fullUrl = $"{urlODLClose}{currIdxODL}";
try
{
// invio chiamata URL x reset ODL su macchina
string rawSplit = callUrl($"{urlODLClose}{currIdxODL}", false);
fatto = (rawSplit != "KO") ? true : false;
// invio chiamata URL x chiusura ODL su macchina
string callResp = callUrl(fullUrl, false);
fatto = (callResp != "KO") ? true : false;
}
catch
{ }
lgInfo($"Eseguito tryCloseODL per {currIdxODL} | url: {fullUrl} | esito: {fatto}");
return fatto;
}
/// <summary>
/// Cerca di inviare su un altro thread i vari dati accumulati...
/// </summary>
protected void trySendValues()
{
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
// verifico se risponde il server...
if (checkServerAlive)
{
bool iobOk = false;
if (utils.CRB("sendDataByThread"))
{
Task taskCheck = Task.Run(() => iobOk = checkIobEnabled);
}
else
{
iobOk = checkIobEnabled;
}
// verifico SE posso inviare dati
if (iobOk)
{
currDispData.semOut = Semaforo.SV;
// verificare come gestire il task secondario senza interferenza (chiamate
// update su FORM da thread secondari danno errori)
if (utils.CRB("sendDataByThread"))
{
// invio con thread separato...
Task taskSigIN = Task.Run(() => svuotaCodaSignIN());
Task taskFLog = Task.Run(() => svuotaCodaFLog());
Task taskRawTransf = Task.Run(() => svuotaCodaRawTransf());
Task taskULog = Task.Run(() => svuotaCodaULog());
}
else
{
// gestione queue SignalIN (invio, display)
svuotaCodaSignIN();
currDispData.counter = contapezziIOB;
raiseRefresh(currDispData);
// provo a svuotare coda contapezzi
svuotaCodaContapezzi();
currDispData.counter = contapezziIOB;
raiseRefresh(currDispData);
// gestione queue FluxLog (invio, display)
svuotaCodaFLog();
// coda RawTransf
svuotaCodaRawTransf();
// coda UserLog
svuotaCodaULog();
// refresh
raiseRefresh(currDispData);
}
// se arrivo è tutto ok...
currSendErrors = 0;
}
else
{
// mostro VETO-SEND x invio... GIALLO
currDispData.semOut = Semaforo.SG;
if (periodicLog)
{
lgInfo("IOB - VETO SEND");
}
}
}
else
{
// mostro SERVER KO x invio... ROSSO
currDispData.semOut = Semaforo.SR;
if (periodicLog)
{
lgError("IOB - SERVER NOT READY");
}
}
}
catch (Exception exc)
{
lgError($"Errore in fase trySendValues | currSendErrors: {currSendErrors}{Environment.NewLine}{exc}");
currDispData.semOut = Semaforo.SR;
}
raiseRefresh(currDispData);
}
/// <summary>
/// Effettua chiamata MP-IO per tentare setup del PODL indicato
/// </summary>
@@ -6809,91 +6936,6 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// Cerca di inviare su un altro thread i vari dati accumulati...
/// </summary>
protected void trySendValues()
{
// init obj display
newDisplayData currDispData = new newDisplayData();
try
{
// verifico se risponde il server...
if (checkServerAlive)
{
bool iobOk = false;
if (utils.CRB("sendDataByThread"))
{
Task taskCheck = Task.Run(() => iobOk = checkIobEnabled);
}
else
{
iobOk = checkIobEnabled;
}
// verifico SE posso inviare dati
if (iobOk)
{
currDispData.semOut = Semaforo.SV;
// verificare come gestire il task secondario senza interferenza (chiamate
// update su FORM da thread secondari danno errori)
if (utils.CRB("sendDataByThread"))
{
// invio con thread separato...
Task taskSigIN = Task.Run(() => svuotaCodaSignIN());
Task taskFLog = Task.Run(() => svuotaCodaFLog());
Task taskRawTransf = Task.Run(() => svuotaCodaRawTransf());
Task taskULog = Task.Run(() => svuotaCodaULog());
}
else
{
// gestione queue SignalIN (invio, display)
svuotaCodaSignIN();
currDispData.counter = contapezziIOB;
raiseRefresh(currDispData);
// provo a svuotare coda contapezzi
svuotaCodaContapezzi();
currDispData.counter = contapezziIOB;
raiseRefresh(currDispData);
// gestione queue FluxLog (invio, display)
svuotaCodaFLog();
// coda RawTransf
svuotaCodaRawTransf();
// coda UserLog
svuotaCodaULog();
// refresh
raiseRefresh(currDispData);
}
// se arrivo è tutto ok...
currSendErrors = 0;
}
else
{
// mostro VETO-SEND x invio... GIALLO
currDispData.semOut = Semaforo.SG;
if (periodicLog)
{
lgInfo("IOB - VETO SEND");
}
}
}
else
{
// mostro SERVER KO x invio... ROSSO
currDispData.semOut = Semaforo.SR;
if (periodicLog)
{
lgError("IOB - SERVER NOT READY");
}
}
}
catch (Exception exc)
{
lgError($"Errore in fase trySendValues | currSendErrors: {currSendErrors}{Environment.NewLine}{exc}");
currDispData.semOut = Semaforo.SR;
}
raiseRefresh(currDispData);
}
/// <summary>
/// Aggiorna un valore del dizionario in INCREMENTO e lo restituisce
/// </summary>
+3 -3
View File
@@ -1151,15 +1151,15 @@ namespace IOB_WIN_NEXT
{
modbusMemType currMemType = modbusMemType.NotDefined;
// determino tipo di memoria
if (baseAddr <= maxVal)
if (baseAddr < maxVal)
{
currMemType = modbusMemType.Coil;
}
else if (baseAddr <= baseMult + maxVal)
else if (baseAddr < baseMult + maxVal)
{
currMemType = modbusMemType.DiscreteInput;
}
else if (baseAddr <= 3 * baseMult + maxVal)
else if (baseAddr < 3 * baseMult + maxVal)
{
currMemType = modbusMemType.InputRegister;
}
+17 -1
View File
@@ -165,6 +165,22 @@ namespace IOB_WIN_NEXT
return answ;
}
/// <summary>
/// Recupera valore OPC-UA direttamente in formato double
/// </summary>
/// <param name="diKey"></param>
/// <returns></returns>
public double getDataItemValueDouble(string diKey)
{
double answ = 0;
string rawVal = getDataItemValue(diKey);
if (rawVal != null)
{
double.TryParse(diKey, out answ);
}
return answ;
}
/// <summary>
/// Recupero dati dinamici...
/// </summary>
@@ -531,7 +547,7 @@ namespace IOB_WIN_NEXT
return changed;
}
internal virtual void procRunMode(ref string currRun)
protected virtual void procRunMode(ref string currRun)
{
// variabili RUN... se richiesto invio runMode
if (opcUaParams.runModeSend)
+226 -103
View File
@@ -1,6 +1,5 @@
using MapoSDK;
using Newtonsoft.Json;
using Opc.Ua;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -161,90 +160,18 @@ namespace IOB_WIN_NEXT
answ = true;
}
catch
{ }
{ }
#endif
return answ;
}
#endregion Public Methods
#region Internal Methods
internal override void procRunMode(ref string currRun)
{
// variabili RUN... se richiesto invio runMode
if (opcUaParams.runModeSend)
{
currRun = $"{currAct}";
// effettuo processing SPECIFICO currAct x gestione snapshot...
if (currAct == 10)
{
if (DateTime.Now > vetoSnapshot)
{
lgInfo("--------------------------------------------");
callUrl(urlTakeSnapshot, false);
// blocco snapshot x VETO_SEND_SNAPSHOT sec...
vetoSnapshot = DateTime.Now.AddSeconds(VETO_SEND_SNAPSHOT);
lgInfo($"Effettuata richiesta salvataggio snapshot, impostato veto nuova chiamata a {vetoSnapshot}");
lgInfo("--------------------------------------------");
}
else
{
lgInfo($"NON effettuo salvataggio snapshot perché veto attivo fino a {vetoSnapshot}");
}
}
else
{
// aggiorno veto x snapshot
vetoSnapshot = DateTime.Now;
}
// invio del valore RU MODE come FLog
if (!string.IsNullOrEmpty(currRun))
{
// se ho valore --> invio
string sVal = "";
string descr = $"RunModeVal";
DateTime locTStamp = DateTime.Now;
sVal = $"Change 04: {locTStamp.ToString()} | descr: {descr} | Id: {opcUaParams.keyExeMode} | Val: {currRun}";
// cerco se sia un dato/valore in veto
bool hasVetoLK = false;
bool hasVetoLKV = false;
hasVetoLK = opcUaParams.fluxLogKeyValVeto.ContainsKey(descr);
if (hasVetoLK)
{
// se c'è controllo il valore...
var valList = opcUaParams.fluxLogKeyValVeto[descr];
hasVetoLKV = valList.Contains(currRun);
}
if (hasVetoLKV)
{
lgTrace($"NON ACCODATO sample: veto trovato per {descr}/{currRun} in fluxLogKeyValVeto ", false);
}
else
{
accodaFLog(sVal, qEncodeFLog(descr, currRun));
// se richiesto provo a tradurre
if (opcUaParams.runModeTrad)
{
string RunModeDescr = itemTranslation("RunMode", currRun);
descr = $"RunMode";
accodaFLog(sVal, qEncodeFLog(descr, RunModeDescr));
}
}
}
}
}
#endregion Internal Methods
#region Protected Fields
protected int lastAct = 0;
protected int lastExe = 0;
protected int lastExeMode = 0;
protected int VETO_SEND_SNAPSHOT = 10;
@@ -252,32 +179,29 @@ namespace IOB_WIN_NEXT
#endregion Protected Fields
#region Protected Properties
#region Protected Enums
/// <summary>
/// Attività corrente (INT) da keyRunMode valore di PLC/DB231/Attivita
/// Definizione stati travel
/// </summary>
protected int currAct
protected enum travelState
{
get
{
int answ = 0;
if (!string.IsNullOrEmpty(opcUaParams.keyExeMode))
{
string currRun = getDataItemValue(opcUaParams.keyExeMode);
if (!string.IsNullOrEmpty(currRun))
{
int.TryParse(currRun, out answ);
}
}
return answ;
}
Idle = 0,
StartOdl,
UpLift,
Move,
DownLift,
WaitClose
}
#endregion Protected Enums
#region Protected Properties
/// <summary>
/// Attività corrente (INT) da keyExeMode valore di PLC/DB231/InCorso
/// </summary>
protected int currExe
protected int currExeMode
{
get
{
@@ -294,6 +218,30 @@ namespace IOB_WIN_NEXT
}
}
/// <summary>
/// Attività corrente (INT) da keyRunMode valore di PLC/DB231/Attivita
/// </summary>
protected int currRunMode
{
get
{
int answ = 0;
if (!string.IsNullOrEmpty(opcUaParams.keyRunMode))
{
string currRun = getDataItemValue(opcUaParams.keyRunMode);
if (!string.IsNullOrEmpty(currRun))
{
int.TryParse(currRun, out answ);
}
}
return answ;
}
}
protected travelState currTravelState { get; set; } = travelState.Idle;
protected DateTime currTravelStateStart { get; set; } = DateTime.Today.AddYears(-1);
/// <summary>
/// Indica se abbia stato MANUAL x CIMOLAI
/// </summary>
@@ -390,7 +338,7 @@ namespace IOB_WIN_NEXT
* 8: Inizio comando sollevamento
* 9: Termine comando sollevamento
* 10: richiesta snapshot parametri
*
*
*------------------------------------------------------
* SEMPLIFICAZIONE POST CERTIFICAZIONE
*------------------------------------------------------
@@ -413,15 +361,15 @@ namespace IOB_WIN_NEXT
}
// verifico se aggiornare stato LAST ACTION
if (lastAct != currAct && currAct != 0)
if (lastAct != currRunMode && currRunMode != 0)
{
// registro solo azioni > 1 e < 10
if (currAct > 1 && currAct < 10)
if (currRunMode > 1 && currRunMode < 10)
{
// escludo le azioni 4 e 5 (che sono anche in concomitanza con 2-3)
if (currAct < 4 || currAct > 5)
if (currRunMode < 4 || currRunMode > 5)
{
lastAct = currAct;
lastAct = currRunMode;
}
}
}
@@ -431,10 +379,10 @@ namespace IOB_WIN_NEXT
{
// se rilevo variazione exe (curr/last)
// --> registro richiesta attreazzaggio PODL da info commessa
if (lastExe != currExe)
if (lastExeMode != currExeMode)
{
// se 0--> 1 --> registro
if (currExe == 1)
if (currExeMode == 1)
{
lgInfo("--------------------------------------------");
// prendo senza stringa PODL
@@ -455,7 +403,7 @@ namespace IOB_WIN_NEXT
lgInfo("--------------------------------------------");
}
// registro exe mode
lastExe = currExe;
lastExeMode = currExeMode;
}
}
@@ -646,6 +594,181 @@ namespace IOB_WIN_NEXT
var taskSend = iobSendFTP("");
}
protected override void procRunMode(ref string currRun)
{
// variabili RUN... se richiesto invio runMode
if (opcUaParams.runModeSend)
{
currRun = $"{currRunMode}";
// effettuo processing SPECIFICO currRunMode x gestione snapshot...
if (currRunMode == 10)
{
if (DateTime.Now > vetoSnapshot)
{
lgInfo("--------------------------------------------");
callUrl(urlTakeSnapshot, false);
// blocco snapshot x VETO_SEND_SNAPSHOT sec...
vetoSnapshot = DateTime.Now.AddSeconds(VETO_SEND_SNAPSHOT);
lgInfo($"Effettuata richiesta salvataggio snapshot, impostato veto nuova chiamata a {vetoSnapshot}");
lgInfo("--------------------------------------------");
}
else
{
lgInfo($"NON effettuo salvataggio snapshot perché veto attivo fino a {vetoSnapshot}");
}
}
else
{
// aggiorno veto x snapshot
vetoSnapshot = DateTime.Now;
}
// invio del valore RU MODE come FLog
if (!string.IsNullOrEmpty(currRun))
{
// se ho valore --> invio
string sVal = "";
string descr = $"RunModeVal";
DateTime locTStamp = DateTime.Now;
sVal = $"Change 04: {locTStamp.ToString()} | descr: {descr} | Id: {opcUaParams.keyExeMode} | Val: {currRun}";
// cerco se sia un dato/valore in veto
bool hasVetoLK = false;
bool hasVetoLKV = false;
hasVetoLK = opcUaParams.fluxLogKeyValVeto.ContainsKey(descr);
if (hasVetoLK)
{
// se c'è controllo il valore...
var valList = opcUaParams.fluxLogKeyValVeto[descr];
hasVetoLKV = valList.Contains(currRun);
}
if (hasVetoLKV)
{
lgTrace($"NON ACCODATO sample: veto trovato per {descr}/{currRun} in fluxLogKeyValVeto ", false);
}
else
{
accodaFLog(sVal, qEncodeFLog(descr, currRun));
// se richiesto provo a tradurre
if (opcUaParams.runModeTrad)
{
string RunModeDescr = itemTranslation("RunMode", currRun);
descr = $"RunMode";
accodaFLog(sVal, qEncodeFLog(descr, RunModeDescr));
}
}
}
}
//verifica preliminare durata minima stato
DateTime adesso = DateTime.Now;
bool canChange = adesso.Subtract(currTravelStateStart).TotalSeconds > opcUaParams.minSecStatusDuration;
// gestione dei macro-stati del travel... SOLO se in esecuzione da travel...
if (currExeMode > 0)
{
double pesoTot = 0;
// può cambiare stato se per ALMENO minSecStatus è rimasto nello status corrente...
if (canChange)
{
// STEP 1: verifico se sia iniziato caricamento...
if (currTravelState == travelState.Idle)
{
if (currIdxODL > 0)
{
currTravelState = travelState.StartOdl;
currTravelStateStart = adesso;
}
}
// sono nell'esecuzione ODL, controllo il resto
else
{
// nb: vedere se usare isWorkingCimolai / isManualCimolai
// verifico il valore della variabile calcolata del PESO totale...
if (dataItemMem.ContainsKey("PesoTot"))
{
pesoTot = getDataItemValueDouble("PesoTot");
}
// ...oppuresommo direttamente
else
{
pesoTot += getDataItemValueDouble("PLC/DB231/peso1");
pesoTot += getDataItemValueDouble("PLC/DB231/peso2");
pesoTot += getDataItemValueDouble("PLC/DB231/peso3");
pesoTot += getDataItemValueDouble("PLC/DB231/peso4");
}
// STEP 2: verifico se sia iniziato caricamento...
if (currTravelState == travelState.StartOdl)
{
if (pesoTot > 0)
{
currTravelState = travelState.UpLift;
currTravelStateStart = adesso;
}
}
// STEP 3: verifico se sia terminato caricamento...
else if (currTravelState == travelState.UpLift)
{
if (pesoTot == 0)
{
currTravelState = travelState.Move;
currTravelStateStart = adesso;
}
}
// STEP 4: verifico se sia terminato movimento...
else if (currTravelState == travelState.Move)
{
if (pesoTot > 0)
{
currTravelState = travelState.DownLift;
currTravelStateStart = adesso;
}
}
// STEP 5: verifico se sia terminato scaricamento...
else if (currTravelState == travelState.DownLift)
{
if (pesoTot == 0)
{
currTravelState = travelState.WaitClose;
currTravelStateStart = adesso;
}
}
}
}
// ora verifico solo condizione finale x eventuale chiusura...
bool canSendAskClose = adesso.Subtract(currTravelStateStart).TotalSeconds > opcUaParams.minSecFinalWait;
if (canSendAskClose && currTravelState == travelState.WaitClose)
{
// STEP 6: verifico se sia tolto ODL e quindi ha già chiuso...
if (currIdxODL == 0)
{
currTravelState = travelState.Idle;
currTravelStateStart = adesso;
}
// altrimenti manda richiesta chiusura
else
{
// chiama richiesta chiusura x utente
tryAskCloseODL();
// resetta contatore x nuova richeista finale eventuale...
currTravelStateStart = adesso;
}
}
}
else
{
if (canChange)
{
// altrimenti forzo a "Idle" state
currTravelState = travelState.Idle;
currTravelStateStart = adesso;
}
}
}
#endregion Protected Methods
#region Private Fields
@@ -675,7 +798,7 @@ namespace IOB_WIN_NEXT
WriteValue commWriteVal = new WriteValue();
commWriteVal.NodeId = new NodeId(item.Key);
commWriteVal.AttributeId = Attributes.Value;
commWriteVal.Value = new DataValue();
commWriteVal.Value = new DataValue();\
commWriteVal.Value.Value = item.Value;
nodes2Write.Add(commWriteVal);
@@ -685,7 +808,7 @@ namespace IOB_WIN_NEXT
answ = true;
}
catch
{ }
{ }
#endif
return answ;
}
@@ -716,7 +839,7 @@ namespace IOB_WIN_NEXT
answ = true;
}
catch
{ }
{ }
#endif
return answ;
}