diff --git a/IOB-UT-NEXT/Enums.cs b/IOB-UT-NEXT/Enums.cs index 8b141de7..4d80db55 100644 --- a/IOB-UT-NEXT/Enums.cs +++ b/IOB-UT-NEXT/Enums.cs @@ -18,6 +18,27 @@ namespace IOB_UT_NEXT OR } + /// + /// Modalità di calcolo tra serie di valori + /// + public enum calcMode + { + /// + /// NEssun processing + /// + None = 0, + + /// + /// somma dei valori + /// + sum, + + /// + /// produttoria + /// + prod + } + /// /// Elenco MODI CNC /// diff --git a/IOB-UT-NEXT/ToMapo.cs b/IOB-UT-NEXT/ToMapo.cs index e0208cb4..f4984ff4 100644 --- a/IOB-UT-NEXT/ToMapo.cs +++ b/IOB-UT-NEXT/ToMapo.cs @@ -166,7 +166,6 @@ namespace IOB_UT_NEXT /// 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 /// public string keyEStop { get; set; } = ""; + /// + /// Nome variabile x ExeMode + /// + public string keyExeMode { get; set; } = ""; + /// /// Nome variabile x pezzi FATTI /// @@ -286,9 +290,14 @@ namespace IOB_UT_NEXT public string keyRunMode { get; set; } = ""; /// - /// Nome variabile x ExeMode + /// Aree di memoria lettura /// - public string keyExeMode { get; set; } = ""; + public Dictionary mMapRead { get; set; } = new Dictionary(); + + /// + /// Aree di memoria scrittura + /// + public Dictionary mMapWrite { get; set; } = new Dictionary(); /// /// Dictionary dei nomi da cercare come "endsWith" a cui applicare la soglia indicata @@ -310,15 +319,18 @@ namespace IOB_UT_NEXT /// public bool runModeTrad { get; set; } = false; - /// - /// Aree di memoria lettura - /// - public Dictionary mMapRead { get; set; } = new Dictionary(); + #endregion Public Properties + } - /// - /// Aree di memoria scrittura - /// - public Dictionary mMapWrite { get; set; } = new Dictionary(); + /// + /// Oggetto x processing valori (elenco valori e modalità) + /// + public class calcConf + { + #region Public Properties + + public calcMode calcMode { get; set; } = calcMode.None; + public List listVal { get; set; } = new List(); #endregion Public Properties } @@ -498,6 +510,22 @@ namespace IOB_UT_NEXT /// public uint BrowseValue { get; set; } = 5001; + /// + /// Lista valori calcolati/derivati da processare + /// + public Dictionary calcValues { get; set; } = new Dictionary(); + + /// + /// Numero minimo di secondi di durata di uno status + /// + public int minSecStatusDuration { get; set; } = 1; + + /// + /// Numero minimo di secondi di attesa finale (es prima di chiedere chiusura ODL) + /// + public int minSecFinalWait { get; set; } = 30; + + /// /// Struttura dati x check condizione Contapezzi Abilitato (se vuoto = sempre abilitato) /// @@ -553,6 +581,12 @@ namespace IOB_UT_NEXT /// public List filterItemsNodeId { get; set; } = new List(); + /// + /// Elenco item flux da FILTRARE per chiave tradotta/VALORE + /// es: Cimolai / Baglietto, RunModeVal NON VOGLIO inviare quando il valore è 0 + /// + public Dictionary> fluxLogKeyValVeto { get; set; } = new Dictionary>(); + public UserIdent Identity { get; set; } = new UserIdent(); /// @@ -585,13 +619,6 @@ namespace IOB_UT_NEXT /// public WatchDogConf WatchDog { get; set; } = new WatchDogConf(); - - /// - /// Elenco item flux da FILTRARE per chiave tradotta/VALORE - /// es: Cimolai / Baglietto, RunModeVal NON VOGLIO inviare quando il valore è 0 - /// - public Dictionary> fluxLogKeyValVeto { get; set; } = new Dictionary>(); - #endregion Public Properties } diff --git a/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.ini b/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.ini index 1fb48a94..49b8a96f 100644 --- a/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.ini +++ b/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.ini @@ -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 diff --git a/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.json b/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.json index 4166f851..84e316ba 100644 --- a/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.json +++ b/IOB-WIN-NEXT/DATA/CONF/BAGLIETTO_CIMOLAI_01.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" + ] + } } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_CENTERFRIGO.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_CENTERFRIGO.ini index b8048ed3..c89908e9 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_CENTERFRIGO.ini +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_CENTERFRIGO.ini @@ -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 \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001.ini index dff0910a..ea51fe16 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001.ini +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001.ini @@ -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 \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001.json index 46d336d3..63475983 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001.json @@ -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": "#" + } } - } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001_MBlock.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001_MBlock.json index f20d1551..fc9187a2 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001_MBlock.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_001_MBlock.json @@ -1,7 +1,10 @@ { "ReadBlocks": { - "40010": 10, - "40100": 40, - "40140": 30 + "10000": 10, + "10100": 10, + "30010": 40, + "30100": 40, + "30140": 30, + "40030": 20 } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002.ini index 683a6f6f..a34896ba 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002.ini +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002.ini @@ -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 \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002.json index 46d336d3..4c0a10a3 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002.json @@ -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, diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002_MBlock.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002_MBlock.json index f20d1551..cb278e47 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002_MBlock.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_002_MBlock.json @@ -1,7 +1,9 @@ { "ReadBlocks": { - "40010": 10, - "40100": 40, - "40140": 30 + "10000": 10, + "10100": 10, + "30010": 20, + "30100": 50, + "40030": 10 } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003.ini b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003.ini index 60ac544b..7678a885 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003.ini +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003.ini @@ -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] diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003.json index 29f566b0..fd8a8853 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003.json @@ -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, diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003_MBlock.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003_MBlock.json index 088cb41e..fc9187a2 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003_MBlock.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_SAIM_003_MBlock.json @@ -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 } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_L1_P1.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_L1_P1.json index 228407df..a5ee8889 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_L1_P1.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_L1_P1.json @@ -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" } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_L2_P1.json b/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_L2_P1.json index 228407df..a5ee8889 100644 --- a/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_L2_P1.json +++ b/IOB-WIN-NEXT/DATA/CONF/GIACO_ZPACK_L2_P1.json @@ -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" } } \ No newline at end of file diff --git a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini index ea10431d..788ab6b1 100644 --- a/IOB-WIN-NEXT/DATA/CONF/MAIN.ini +++ b/IOB-WIN-NEXT/DATA/CONF/MAIN.ini @@ -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 \ No newline at end of file diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index a08be818..0ffc91af 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -25,96 +25,6 @@ namespace IOB_WIN_NEXT { public class IobGeneric { - - /// - /// Folder in cui salvare i file importati (es excel) - /// - protected string fileArchiveFolder { get; set; } = ""; - - /// - /// Folder da cui importare i file (es excel) - /// - protected string fileImportFolder { get; set; } = ""; - - /// - /// Tipologia di files da importare (default excel) - /// - protected string fileImportType { get; set; } = "*.xslx"; - - /// - /// Procedura di import file... - /// - /// - protected virtual bool importFile(string fileItem) - { - return false; - } - /// - /// Effettua eventuale file import, archiviando file importati - /// - /// - 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 /// @@ -905,6 +815,26 @@ namespace IOB_WIN_NEXT } } + /// + /// URL per chiamata generazione ODL giornalieri alla data + /// + 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; + } + } + /// /// URL per forzare split ODL... /// @@ -982,44 +912,6 @@ namespace IOB_WIN_NEXT } } - /// - /// URL per recupero dati ODL alla data... - /// - 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; - } - - - /// - /// URL per chiamata generazione ODL giornalieri alla data - /// - 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; - } - } - /// /// URL per recupero PODL correnti x macchina... /// @@ -1173,6 +1065,26 @@ namespace IOB_WIN_NEXT } } + /// + /// URL per richiesta chiusura manuale ad utente x ODL corrente (metodo GET)... + /// + 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; + } + } + /// /// URL per chiusura ODL corrente (metodo GET)... /// @@ -4095,6 +4007,23 @@ namespace IOB_WIN_NEXT return answ; } + /// + /// URL per recupero dati ODL alla data... + /// + 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; + } + /// /// Fornisce URL INPUT per i parametri richiesti /// @@ -4223,6 +4152,11 @@ namespace IOB_WIN_NEXT /// protected bool enablePzCountByIob = true; + /// + /// dizionario (opzionale) xz decodifica file da importare + /// + protected Dictionary FileDecod = new Dictionary(); + /// /// indica che è richeisto forzatamente reset contapezzi /// @@ -4405,6 +4339,21 @@ namespace IOB_WIN_NEXT } } + /// + /// Folder in cui salvare i file importati (es excel) + /// + protected string fileArchiveFolder { get; set; } = ""; + + /// + /// Folder da cui importare i file (es excel) + /// + protected string fileImportFolder { get; set; } = ""; + + /// + /// Tipologia di files da importare (default excel) + /// + protected string fileImportType { get; set; } = "*.xslx"; + /// /// 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; } + /// + /// Procedura di import file... + /// + /// + protected virtual bool importFile(string fileItem) + { + return false; + } + /// /// Recupera da server set di dati specifici x IOB /// @@ -5449,6 +5407,72 @@ namespace IOB_WIN_NEXT { } + /// + /// Effettua eventuale file import, archiviando file importati + /// + /// + 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; + } + /// /// Processa le richieste di scrittura memoria /// @@ -5667,6 +5691,19 @@ namespace IOB_WIN_NEXT // FIXME TODO FARE !!!! invio PUT del file *_alarm.json } + /// + /// Setup parametri decode file excel (opzionale) + /// + 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; + } + } + /// /// setup parametri da file di conf /// @@ -5811,24 +5848,6 @@ namespace IOB_WIN_NEXT } } - /// - /// dizionario (opzionale) xz decodifica file da importare - /// - protected Dictionary FileDecod = new Dictionary(); - - /// - /// Setup parametri decode file excel (opzionale) - /// - 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; - } - } - /// /// Cleanup stringa x impiego tipo ident da char dubbi /// @@ -5839,6 +5858,27 @@ namespace IOB_WIN_NEXT return origData.Replace(".", "").Replace(" ", "_"); } + /// + /// Effettua chiamata MP-IO per cheidere all'utente se vuole effettuare chiusura ODL + /// corrente della macchina + /// + /// + 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; + } + /// /// Effettua chiamata MP-IO per tentare chiusura ODL corrente della macchina /// @@ -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; } + /// + /// Cerca di inviare su un altro thread i vari dati accumulati... + /// + 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); + } + /// /// Effettua chiamata MP-IO per tentare setup del PODL indicato /// @@ -6809,91 +6936,6 @@ namespace IOB_WIN_NEXT } } - /// - /// Cerca di inviare su un altro thread i vari dati accumulati... - /// - 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); - } - /// /// Aggiorna un valore del dizionario in INCREMENTO e lo restituisce /// diff --git a/IOB-WIN-NEXT/IobModbusTCP.cs b/IOB-WIN-NEXT/IobModbusTCP.cs index 2289ab99..b7c5b87d 100644 --- a/IOB-WIN-NEXT/IobModbusTCP.cs +++ b/IOB-WIN-NEXT/IobModbusTCP.cs @@ -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; } diff --git a/IOB-WIN-NEXT/IobOpcUa.cs b/IOB-WIN-NEXT/IobOpcUa.cs index e471ce4f..45bddd7e 100644 --- a/IOB-WIN-NEXT/IobOpcUa.cs +++ b/IOB-WIN-NEXT/IobOpcUa.cs @@ -165,6 +165,22 @@ namespace IOB_WIN_NEXT return answ; } + /// + /// Recupera valore OPC-UA direttamente in formato double + /// + /// + /// + public double getDataItemValueDouble(string diKey) + { + double answ = 0; + string rawVal = getDataItemValue(diKey); + if (rawVal != null) + { + double.TryParse(diKey, out answ); + } + return answ; + } + /// /// Recupero dati dinamici... /// @@ -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) diff --git a/IOB-WIN-NEXT/IobOpcUaMBHCimolai.cs b/IOB-WIN-NEXT/IobOpcUaMBHCimolai.cs index 374a5279..798b2572 100644 --- a/IOB-WIN-NEXT/IobOpcUaMBHCimolai.cs +++ b/IOB-WIN-NEXT/IobOpcUaMBHCimolai.cs @@ -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 /// - /// Attività corrente (INT) da keyRunMode valore di PLC/DB231/Attivita + /// Definizione stati travel /// - 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 + /// /// Attività corrente (INT) da keyExeMode valore di PLC/DB231/InCorso /// - protected int currExe + protected int currExeMode { get { @@ -294,6 +218,30 @@ namespace IOB_WIN_NEXT } } + /// + /// Attività corrente (INT) da keyRunMode valore di PLC/DB231/Attivita + /// + 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); + /// /// Indica se abbia stato MANUAL x CIMOLAI /// @@ -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; }