- inclusione gestione Pro3Em oltre a 1PM (ufficio)
- incluso con SIMUL_05
- preparo x test su SIM
This commit is contained in:
Samuele Locatelli
2025-08-07 09:49:52 +02:00
parent 6409b8ca82
commit c89695eb60
15 changed files with 1258 additions and 18 deletions
+9
View File
@@ -631,6 +631,15 @@ namespace IOB_UT_NEXT
/// </summary>
Shelly,
/// <summary>
/// Shelly's Device PM1 series (Gen1)
/// </summary>
ShellyPm1,
/// <summary>
/// Shelly's Device Pro3Em series (Gen2)
/// </summary>
ShellyPro3Em,
/// <summary>
/// Adapter SIEMENS
/// </summary>
+2 -2
View File
@@ -69,8 +69,8 @@ Global
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Release|Any CPU.Build.0 = Release|Any CPU
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Release|x86.ActiveCfg = Release|Any CPU
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Release|x86.Build.0 = Release|Any CPU
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Remote_DEBUG|Any CPU.ActiveCfg = Release|Any CPU
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Remote_DEBUG|Any CPU.Build.0 = Release|Any CPU
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Remote_DEBUG|Any CPU.ActiveCfg = Remote_DEBUG|Any CPU
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Remote_DEBUG|Any CPU.Build.0 = Remote_DEBUG|Any CPU
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Remote_DEBUG|x86.ActiveCfg = Release|Any CPU
{7642AEAD-7A35-45A6-8761-81D97CD8905C}.Remote_DEBUG|x86.Build.0 = Release|Any CPU
EndGlobalSection
+7 -1
View File
@@ -34,7 +34,13 @@ namespace IOB_WIN_SHELLY
switch (tipoScelto)
{
case tipoAdapter.Shelly:
iobObj = new ShellyClient(this, IOBConfFull);
case tipoAdapter.ShellyPm1:
iobObj = new ShellyClientGen1(this, IOBConfFull);
btnStart.Enabled = true;
break;
case tipoAdapter.ShellyPro3Em:
iobObj = new ShellyClientGen2(this, IOBConfFull);
btnStart.Enabled = true;
break;
@@ -0,0 +1,67 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=ShellyPro3Em
PING_MS_TIMEOUT=500
MinDeltaSec=5
EnableRedisQueue=true
DIS_EXE_TASK=true
DIS_STATE_CH=true
IOB_NAME=LVF000
[MACHINE]
VENDOR=Shelly
MODEL=Pro3EM
[CNC]
IP=192.168.2.15
PORT=0000
[SERVER]
MPIP=http://192.168.1.64
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
CMD_ODL_STARTED=/IOB/getCurrOdlStart/
CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/
CMD_IDLE_TIME=/IOB/getIdlePeriod/
[MEMORY]
[BLINK]
MAX_COUNTER_BLINK = 15
BLINK_FILT=0
[OPTPAR]
DISABLE_SEND_WDST=TRUE
AUTO_CHANGE_ODL=false
; gestione custom timer
timerIntMs=100
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
PZCOUNT_MODE=BIT
ENABLE_PZ_RESET=TRUE
;gestione invio pezzi in blocco
ENABLE_SEND_PZC_BLOCK=TRUE
MIN_SEND_PZC_BLOCK=0
MAX_SEND_PZC_BLOCK=100
; gestione DynData
ENABLE_DYN_DATA=TRUE
FORCE_DYN_DATA=TRUE
NEW_DYN_DATA=TRUE
; conf parametri memoria READ/WRITE
PARAM_CONF=LVF_SHELLY_01.json
[BRANCH]
NAME=master
; Tags manuali
[TAGS]
Customer=LVF
HostOS=WIN
HostName=Server-MAPO-IOB
HostAddr=192.168.1.208
@@ -0,0 +1,52 @@
{
"mMapRead": {
"Tot_Energy": {
"func": "MAX",
"onlyIncr": true,
"period": 300,
"sendEnabled": true,
"name": "Tot_Energy",
"description": "Energia totale impiegata",
"memAddr": "ActEnergy",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"RT_Power": {
"func": "POINT",
"period": 60,
"sendEnabled": true,
"name": "RT_Power",
"description": "Potenza Istantanea",
"memAddr": "Power",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
}
},
"mMapWrite": {},
"DataDecodMap": {},
"FileDecod": {},
"mMapWriteLink": {},
"OptKVP": {
"shelly_tout": "5",
"fluxLogReduce": "true",
"fluxLogRedDeadBand": "4.9",
"fluxLogResendPeriod": "60"
},
"OptMemPar": {}
}
+2 -2
View File
@@ -19,7 +19,7 @@ CLI_INST=SteamWareSim
;STARTLIST=SIMUL_01,SIMUL_02,SIMUL_03,SIMUL_04
;STARTLIST=SIMUL_01
;STARTLIST=SHELLY_01
STARTLIST=SIMUL_03_SHELLY
STARTLIST=SHELLY_Pro3EM
;STARTLIST=LVF_SHELLY_01
MAXCNC=10
@@ -0,0 +1,68 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=ShellyPro3Em
PING_MS_TIMEOUT=500
MinDeltaSec=5
EnableRedisQueue=true
DIS_EXE_TASK=true
DIS_STATE_CH=true
IOB_NAME=LVF000
[MACHINE]
VENDOR=Shelly
MODEL=Pro3EM
[CNC]
IP=10.74.81.73
PORT=0000
[SERVER]
MPIP=http://10.74.82.218
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
CMD_ODL_STARTED=/IOB/getCurrOdlStart/
CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/
CMD_IDLE_TIME=/IOB/getIdlePeriod/
[MEMORY]
[BLINK]
MAX_COUNTER_BLINK = 15
BLINK_FILT=0
[OPTPAR]
DISABLE_SEND_WDST=TRUE
AUTO_CHANGE_ODL=false
; gestione custom timer
timerIntMs=100
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
PZCOUNT_MODE=BIT
ENABLE_PZ_RESET=TRUE
;gestione invio pezzi in blocco
ENABLE_SEND_PZC_BLOCK=TRUE
MIN_SEND_PZC_BLOCK=0
MAX_SEND_PZC_BLOCK=100
; gestione DynData
ENABLE_DYN_DATA=TRUE
FORCE_DYN_DATA=TRUE
NEW_DYN_DATA=TRUE
; conf parametri memoria READ/WRITE
PARAM_CONF=SHELLY_Pro3EM.json
[BRANCH]
NAME=master
; Tags manuali
[TAGS]
Customer=Steamware
HostOS=WIN
HostName=IOB-WIN-SIMULA
HostAddr=10.74.82.76
+289
View File
@@ -0,0 +1,289 @@
{
"mMapRead": {
"Tot_Energy": {
"func": "MAX",
"onlyIncr": true,
"period": 600,
"sendEnabled": true,
"name": "Tot_Energy",
"description": "Energia Totale impiegata",
"memAddr": "ActEnergy",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1000,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"Tot_Energy_PhaseA": {
"func": "MAX",
"onlyIncr": true,
"period": 1800,
"sendEnabled": true,
"name": "Tot_Energy_PhaseA",
"description": "Energia Totale Fase A",
"memAddr": "ActEnergy_PhaseA",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1000,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"Tot_Energy_PhaseB": {
"func": "MAX",
"onlyIncr": true,
"period": 1800,
"sendEnabled": true,
"name": "Tot_Energy_PhaseB",
"description": "Energia totale Fase B",
"memAddr": "ActEnergy_PhaseB",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1000,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"Tot_Energy_PhaseC": {
"func": "MAX",
"onlyIncr": true,
"period": 1800,
"sendEnabled": true,
"name": "Tot_Energy_PhaseC",
"description": "Energia totale Fase C",
"memAddr": "ActEnergy_PhaseC",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1000,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"RT_Power": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Power",
"description": "Potenza Istantanea periodo (MEDIANA)",
"memAddr": "Power",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
},
"RT_Power_PhaseA": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Power_PhaseA",
"description": "Potenza Istantanea periodo Fase A (MEDIANA)",
"memAddr": "Power_PhaseA",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
},
"RT_Power_PhaseB": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Power_PhaseB",
"description": "Potenza Istantanea periodo Fase B (MEDIANA)",
"memAddr": "Power_PhaseB",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
},
"RT_Power_PhaseC": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Power_PhaseC",
"description": "Potenza Istantanea periodo Fase C (MEDIANA)",
"memAddr": "Power_PhaseC",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
},
"RT_Current": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Current",
"description": "Corrente Istantanea periodo (MEDIANA)",
"memAddr": "Current",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999.0,
"minVal": 0.0,
"unit": "A",
"value": "",
"decodeMap": [],
"displOrdinal": 10
},
"RT_Current_PhaseA": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Current_PhaseA",
"description": "Corrente Istantanea periodo Fase A (MEDIANA)",
"memAddr": "Current_PhaseA",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999.0,
"minVal": 0.0,
"unit": "A",
"value": "",
"decodeMap": [],
"displOrdinal": 10
},
"RT_Current_PhaseB": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Current_PhaseB",
"description": "Corrente Istantanea periodo Fase B (MEDIANA)",
"memAddr": "Current_PhaseB",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999.0,
"minVal": 0.0,
"unit": "A",
"value": "",
"decodeMap": [],
"displOrdinal": 10
},
"RT_Current_PhaseC": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Current_PhaseC",
"description": "Corrente Istantanea periodo Fase C (MEDIANA)",
"memAddr": "Current_PhaseC",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999.0,
"minVal": 0.0,
"unit": "A",
"value": "",
"decodeMap": [],
"displOrdinal": 10
},
"RT_Voltage_PhaseA": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Voltage_PhaseA",
"description": "Voltaggio Fase A Istantaneo (MEDIANA)",
"memAddr": "Voltage_PhaseA",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 400.0,
"minVal": 0.0,
"unit": "V",
"value": "",
"decodeMap": [],
"displOrdinal": 21
},
"RT_Voltage_PhaseB": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Voltage_PhaseB",
"description": "Voltaggio Fase B Istantaneo (MEDIANA)",
"memAddr": "Voltage_PhaseB",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 400.0,
"minVal": 0.0,
"unit": "V",
"value": "",
"decodeMap": [],
"displOrdinal": 22
},
"RT_Voltage_PhaseC": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Voltage_PhaseC",
"description": "Voltaggio Fase C Istantaneo (MEDIANA)",
"memAddr": "Voltage_PhaseC",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 400.0,
"minVal": 0.0,
"unit": "V",
"value": "",
"decodeMap": [],
"displOrdinal": 23
}
},
"mMapWrite": {},
"DataDecodMap": {},
"FileDecod": {},
"mMapWriteLink": {},
"OptKVP": {
"shelly_tout": "5",
"fluxLogReduce": "true",
"fluxLogRedDeadBand": "4.9",
"fluxLogResendPeriod": "60"
},
"OptMemPar": {}
}
@@ -0,0 +1,68 @@
;Configurazione IOB-WIN
[IOB]
CNCTYPE=ShellyPro3Em
PING_MS_TIMEOUT=500
MinDeltaSec=5
EnableRedisQueue=true
DIS_EXE_TASK=true
DIS_STATE_CH=true
IOB_NAME=SIMUL_05
[MACHINE]
VENDOR=Shelly
MODEL=Pro3EM
[CNC]
IP=10.74.81.73
PORT=0000
[SERVER]
MPIP=http://10.74.82.218
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
CMD_ODL_STARTED=/IOB/getCurrOdlStart/
CMD_FORCLE_SPLIT_ODL=/IOB/forceSplitOdlFull/
CMD_IDLE_TIME=/IOB/getIdlePeriod/
[MEMORY]
[BLINK]
MAX_COUNTER_BLINK = 15
BLINK_FILT=0
[OPTPAR]
DISABLE_SEND_WDST=TRUE
AUTO_CHANGE_ODL=false
; gestione custom timer
timerIntMs=100
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
PZCOUNT_MODE=BIT
ENABLE_PZ_RESET=TRUE
;gestione invio pezzi in blocco
ENABLE_SEND_PZC_BLOCK=TRUE
MIN_SEND_PZC_BLOCK=0
MAX_SEND_PZC_BLOCK=100
; gestione DynData
ENABLE_DYN_DATA=TRUE
FORCE_DYN_DATA=TRUE
NEW_DYN_DATA=TRUE
; conf parametri memoria READ/WRITE
PARAM_CONF=SIMUL_05_SHELLY.json
[BRANCH]
NAME=master
; Tags manuali
[TAGS]
Customer=Steamware
HostOS=WIN
HostName=IOB-WIN-SIMULA
HostAddr=10.74.82.76
@@ -0,0 +1,289 @@
{
"mMapRead": {
"Tot_Energy": {
"func": "MAX",
"onlyIncr": true,
"period": 600,
"sendEnabled": true,
"name": "Tot_Energy",
"description": "Energia Totale impiegata",
"memAddr": "ActEnergy",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1000,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"Tot_Energy_PhaseA": {
"func": "MAX",
"onlyIncr": true,
"period": 1800,
"sendEnabled": true,
"name": "Tot_Energy_PhaseA",
"description": "Energia Totale Fase A",
"memAddr": "ActEnergy_PhaseA",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1000,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"Tot_Energy_PhaseB": {
"func": "MAX",
"onlyIncr": true,
"period": 1800,
"sendEnabled": true,
"name": "Tot_Energy_PhaseB",
"description": "Energia totale Fase B",
"memAddr": "ActEnergy_PhaseB",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1000,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"Tot_Energy_PhaseC": {
"func": "MAX",
"onlyIncr": true,
"period": 1800,
"sendEnabled": true,
"name": "Tot_Energy_PhaseC",
"description": "Energia totale Fase C",
"memAddr": "ActEnergy_PhaseC",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1000,
"maxVal": 999999999.0,
"minVal": 0.0,
"unit": "KWh",
"value": "",
"decodeMap": [],
"displOrdinal": 1
},
"RT_Power": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Power",
"description": "Potenza Istantanea periodo (MEDIANA)",
"memAddr": "Power",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
},
"RT_Power_PhaseA": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Power_PhaseA",
"description": "Potenza Istantanea periodo Fase A (MEDIANA)",
"memAddr": "Power_PhaseA",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
},
"RT_Power_PhaseB": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Power_PhaseB",
"description": "Potenza Istantanea periodo Fase B (MEDIANA)",
"memAddr": "Power_PhaseB",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
},
"RT_Power_PhaseC": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Power_PhaseC",
"description": "Potenza Istantanea periodo Fase C (MEDIANA)",
"memAddr": "Power_PhaseC",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999999.0,
"minVal": 0.0,
"unit": "W",
"value": "",
"decodeMap": [],
"displOrdinal": 2
},
"RT_Current": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Current",
"description": "Corrente Istantanea periodo (MEDIANA)",
"memAddr": "Current",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999.0,
"minVal": 0.0,
"unit": "A",
"value": "",
"decodeMap": [],
"displOrdinal": 10
},
"RT_Current_PhaseA": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Current_PhaseA",
"description": "Corrente Istantanea periodo Fase A (MEDIANA)",
"memAddr": "Current_PhaseA",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999.0,
"minVal": 0.0,
"unit": "A",
"value": "",
"decodeMap": [],
"displOrdinal": 10
},
"RT_Current_PhaseB": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Current_PhaseB",
"description": "Corrente Istantanea periodo Fase B (MEDIANA)",
"memAddr": "Current_PhaseB",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999.0,
"minVal": 0.0,
"unit": "A",
"value": "",
"decodeMap": [],
"displOrdinal": 10
},
"RT_Current_PhaseC": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Current_PhaseC",
"description": "Corrente Istantanea periodo Fase C (MEDIANA)",
"memAddr": "Current_PhaseC",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 999.0,
"minVal": 0.0,
"unit": "A",
"value": "",
"decodeMap": [],
"displOrdinal": 10
},
"RT_Voltage_PhaseA": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Voltage_PhaseA",
"description": "Voltaggio Fase A Istantaneo (MEDIANA)",
"memAddr": "Voltage_PhaseA",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 400.0,
"minVal": 0.0,
"unit": "V",
"value": "",
"decodeMap": [],
"displOrdinal": 21
},
"RT_Voltage_PhaseB": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Voltage_PhaseB",
"description": "Voltaggio Fase B Istantaneo (MEDIANA)",
"memAddr": "Voltage_PhaseB",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 400.0,
"minVal": 0.0,
"unit": "V",
"value": "",
"decodeMap": [],
"displOrdinal": 22
},
"RT_Voltage_PhaseC": {
"func": "MEDIAN",
"period": 3600,
"sendEnabled": true,
"name": "RT_Voltage_PhaseC",
"description": "Voltaggio Fase C Istantaneo (MEDIANA)",
"memAddr": "Voltage_PhaseC",
"tipoMem": "Real",
"index": 0,
"size": 0,
"factor": 1.0,
"maxVal": 400.0,
"minVal": 0.0,
"unit": "V",
"value": "",
"decodeMap": [],
"displOrdinal": 23
}
},
"mMapWrite": {},
"DataDecodMap": {},
"FileDecod": {},
"mMapWriteLink": {},
"OptKVP": {
"shelly_tout": "5",
"fluxLogReduce": "true",
"fluxLogRedDeadBand": "4.9",
"fluxLogResendPeriod": "60"
},
"OptMemPar": {}
}
+21 -2
View File
@@ -45,7 +45,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="EgwProxy.Shelly, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\EgwProxy.Shelly.3.7.2507.1012\lib\EgwProxy.Shelly.dll</HintPath>
<HintPath>..\packages\EgwProxy.Shelly.3.7.2508.708\lib\EgwProxy.Shelly.dll</HintPath>
</Reference>
<Reference Include="Flurl, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Flurl.4.0.0\lib\net461\Flurl.dll</HintPath>
@@ -136,7 +136,8 @@
<Compile Include="AdapterFormNext.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Iob\ShellyClient.cs" />
<Compile Include="Iob\ShellyClientGen2.cs" />
<Compile Include="Iob\ShellyClientGen1.cs" />
<Compile Include="Iob\GenericNext.cs" />
<Compile Include="MainFormNext.cs">
<SubType>Form</SubType>
@@ -170,6 +171,18 @@
<None Include="DATA\CONF\IOB.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_05_SHELLY.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_05_SHELLY.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SHELLY_Pro3EM.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SHELLY_Pro3EM.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\MAIN.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@@ -182,12 +195,18 @@
<None Include="DATA\CONF\SHELLY_01.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\LVF_SHELLY_01.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_03_SHELLY.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_03_SHELLY.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\LVF_SHELLY_01.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="DATA\CONF\SIMUL_04_SHELLY.ini">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@@ -19,9 +19,9 @@ using System.Threading.Tasks;
namespace IOB_WIN_SHELLY.Iob
{
/// <summary>
/// Classe gestione oggetti Shelly
/// Classe gestione oggetti Shelly tipo PM1 (Gen1)
/// </summary>
public class ShellyClient : Iob.GenericNext
public class ShellyClientGen1 : GenericNext
{
#region Public Constructors
@@ -32,9 +32,9 @@ namespace IOB_WIN_SHELLY.Iob
/// </summary>
/// <param name="caller">Form chiamante</param>
/// <param name="IobConfFull">Configurazione (v 4.x)</param>
public ShellyClient(AdapterFormNext caller, IobConfTree IobConfFull) : base(caller, IobConfFull)
public ShellyClientGen1(AdapterFormNext caller, IobConfTree IobConfFull) : base(caller, IobConfFull)
{
lgInfo("Init Iob.ShellyClient");
lgInfo("Init Iob.ShellyClientGen1");
// imposto ping a 3
maxQueuePing = 3;
// imposto
@@ -59,7 +59,7 @@ namespace IOB_WIN_SHELLY.Iob
}
var devData = IobConfFull.Device.Connect;
Shelly1PmOptions options = new Shelly1PmOptions()
ShellyOptions options = new ShellyOptions()
{
DefaultTimeout = TimeSpan.FromMilliseconds(devData.PingMsTimeout * 10),
ServerUri = new Uri($"http://{devData.IpAddr}/rpc")
@@ -98,22 +98,22 @@ namespace IOB_WIN_SHELLY.Iob
{
case "ActEnergy":
outValDbl = lastShellyResp.Value.ActEnergy.Total;
//outVal = lastShellyResp.Value.ActEnergy.Total.ToString("F3", CultureInfo.InvariantCulture);
//outVal = lastShellyRespRT.Value.ActEnergy.Total.ToString("F3", CultureInfo.InvariantCulture);
break;
case "Current":
outValDbl = lastShellyResp.Value.Current;
//outVal = lastShellyResp.Value.Current.ToString("F3", CultureInfo.InvariantCulture);
//outVal = lastShellyRespRT.Value.Current.ToString("F3", CultureInfo.InvariantCulture);
break;
case "Power":
outValDbl = lastShellyResp.Value.Power;
//outVal = lastShellyResp.Value.Power.ToString("F3", CultureInfo.InvariantCulture);
//outVal = lastShellyRespRT.Value.Power.ToString("F3", CultureInfo.InvariantCulture);
break;
case "Voltage":
outValDbl = lastShellyResp.Value.Voltage;
//outVal = lastShellyResp.Value.Voltage.ToString("F3", CultureInfo.InvariantCulture);
//outVal = lastShellyRespRT.Value.Voltage.ToString("F3", CultureInfo.InvariantCulture);
break;
default:
+372
View File
@@ -0,0 +1,372 @@
using EgwProxy.Shelly;
using EgwProxy.Shelly.Clients;
using EgwProxy.Shelly.Options;
using IOB_UT_NEXT;
using IOB_UT_NEXT.Config;
using MapoSDK;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Threading;
using System.Threading.Tasks;
namespace IOB_WIN_SHELLY.Iob
{
/// <summary>
/// Classe gestione oggetti Shelly tipo Gen2 (Pro3Em)
/// </summary>
public class ShellyClientGen2 : GenericNext
{
#region Public Constructors
/// <summary>
/// Estende l'init della classe base, impiegando il pacchetto EgwProxy.Shelly
/// - gestione dei task da svolgere da configurazione json specifica
/// - specializzazione da conf e non da codice
/// </summary>
/// <param name="caller">Form chiamante</param>
/// <param name="IobConfFull">Configurazione (v 4.x)</param>
public ShellyClientGen2(AdapterFormNext caller, IobConfTree IobConfFull) : base(caller, IobConfFull)
{
lgInfo("Init Iob.ShellyClientGen2");
// imposto ping a 3
maxQueuePing = 3;
// imposto
B_input = 0;
// init datetime counters
DateTime adesso = DateTime.Now;
lastPzCountSend = adesso;
lastWarnODL = adesso;
vetoCheckStatus = adesso;
// 2023.09.05 imposto anche primo ping e check disconnected...
lastPING = adesso;
lastDisconnCheck = adesso;
var VETO_PING_SEC = getOptPar("VETO_PING_SEC");
if (!string.IsNullOrEmpty(VETO_PING_SEC))
{
int.TryParse(VETO_PING_SEC, out vetoPingSec);
}
var POWEROFF_TIMEOUT_SEC = getOptPar("POWEROFF_TIMEOUT_SEC");
if (!string.IsNullOrEmpty(POWEROFF_TIMEOUT_SEC))
{
int.TryParse(POWEROFF_TIMEOUT_SEC, out PoweroffTimeoutSec);
}
var devData = IobConfFull.Device.Connect;
ShellyOptions options = new ShellyOptions()
{
DefaultTimeout = TimeSpan.FromMilliseconds(devData.PingMsTimeout * 10),
ServerUri = new Uri($"http://{devData.IpAddr}/rpc")
};
// init secondo il tipo di Shelly...
shellyCli = new ShellyPro3EmClient(new HttpClient(), options);
// invio conf macchina all'inizio
SendMachineConf();
}
#endregion Public Constructors
#region Public Methods
public override Dictionary<string, string> getDynData()
{
Dictionary<string, string> outData = new Dictionary<string, string>();
// verifico che non sia una chiamata troppo frequente, ogni 10 sec minimo...
if (DateTime.Now > lastReadPLC.AddSeconds(shellyCallDelay))
{
// chiama lettura status valor RT (Potenza, Corrente...)
lastShellyRespRT = Task.Run(() => ((ShellyPro3EmClient)shellyCli).GetEmStatus(CancellationToken.None, 0)).Result;
lastShellyRespEnergy = Task.Run(() => ((ShellyPro3EmClient)shellyCli).GetEmDataStatus(CancellationToken.None, 0)).Result;
// Salvo negli oggetti DynData x EnergyTotal
if (lastShellyRespEnergy.IsSuccess)
{
lastReadPLC = DateTime.Now;
// recupero da conf memMap e ciclo
foreach (var item in IOBConfFull.Memory.mMapRead)
{
//string outVal = "";
double outValDbl = 0;
// se trovo includo in dynData...
switch (item.Value.memAddr)
{
case "ActEnergy":
outValDbl = lastShellyRespEnergy.Value.TotalAll.ActEnergy;
break;
case "ActEnergy_PhaseA":
outValDbl = lastShellyRespEnergy.Value.TotalPhaseA.ActEnergy;
break;
case "ActEnergy_PhaseB":
outValDbl = lastShellyRespEnergy.Value.TotalPhaseB.ActEnergy;
break;
case "ActEnergy_PhaseC":
outValDbl = lastShellyRespEnergy.Value.TotalPhaseC.ActEnergy;
break;
default:
break;
}
// modalità saveValue x reduce fLog
saveValue(ref outData, item.Key, outValDbl);
}
}
// Salvo negli oggetti DynData x RT
if (lastShellyRespRT.IsSuccess)
{
lastReadPLC = DateTime.Now;
// recupero da conf memMap e ciclo
foreach (var item in IOBConfFull.Memory.mMapRead)
{
//string outVal = "";
double outValDbl = 0;
// se trovo includo in dynData...
switch (item.Value.memAddr)
{
case "Current":
outValDbl = lastShellyRespRT.Value.TotalCurrent;
break;
case "Current_Neutral":
outValDbl = lastShellyRespRT.Value.NeutralCurrent;
break;
case "Current_PhaseA":
outValDbl = lastShellyRespRT.Value.PhaseA.Current;
break;
case "Current_PhaseB":
outValDbl = lastShellyRespRT.Value.PhaseB.Current;
break;
case "Current_PhaseC":
outValDbl = lastShellyRespRT.Value.PhaseC.Current;
break;
case "Freq_PhaseA":
outValDbl = lastShellyRespRT.Value.PhaseA.Frequency;
break;
case "Freq_PhaseB":
outValDbl = lastShellyRespRT.Value.PhaseB.Frequency;
break;
case "Freq_PhaseC":
outValDbl = lastShellyRespRT.Value.PhaseC.Frequency;
break;
case "Power":
outValDbl = lastShellyRespRT.Value.TotalActivePower;
break;
case "Power_PhaseA":
outValDbl = lastShellyRespRT.Value.PhaseA.ActivePower;
break;
case "Power_PhaseB":
outValDbl = lastShellyRespRT.Value.PhaseB.ActivePower;
break;
case "Power_PhaseC":
outValDbl = lastShellyRespRT.Value.PhaseC.ActivePower;
break;
case "Voltage_PhaseA":
outValDbl = lastShellyRespRT.Value.PhaseA.Voltage;
break;
case "Voltage_PhaseB":
outValDbl = lastShellyRespRT.Value.PhaseB.Voltage;
break;
case "Voltage_PhaseC":
outValDbl = lastShellyRespRT.Value.PhaseC.Voltage;
break;
default:
break;
}
// modalità saveValue x reduce fLog
saveValue(ref outData, item.Key, outValDbl);
}
}
// traccio dati ricevuti
trackExchDataRaw(lastShellyRespRT, 512);
// traccio dati ricevuti
trackExchDataRaw(lastShellyRespEnergy, 256);
}
return outData;
}
/// <summary>
/// Effettua lettura semafori principale <paramref name="currDispData">Parametri da
/// aggiornare x display in form</paramref>
/// </summary>
public override void readSemafori(ref newDisplayData currDispData)
{
DateTime adesso = DateTime.Now;
// se ha risposto ad ultima chiamata --> ok
if (connectionOk && adesso.Subtract(lastReadPLC).TotalMinutes < 1)
{
B_input = 3;
// aggiungo NON emergenza...
B_input += (1 << 7);
}
else
{
B_input = 0;
}
lastReadPLC = DateTime.Now;
lastWatchDog = adesso;
}
public override void startAdapter(bool resetQueue)
{
base.startAdapter(resetQueue);
// 2023.09.05 imposto anche primo ping e check disconnected...
DateTime adesso = DateTime.Now;
lastWatchDog = adesso;
//lastPING = adesso;
lastReadPLC = adesso;
lastDisconnCheck = adesso;
// faccio un primo check POST ritardo
tryConnect();
}
/// <summary>
/// Override connessione
/// </summary>
public override void tryConnect()
{
bool doLog = (verboseLog || periodicLog);
lgDebug($"Shelly: tryConnect step 01 | connectionOk: {connectionOk}");
if (!connectionOk)
{
//// resetto coda...
//QueuePing = new DataQueue("000", "QueuePing", false);
// controllo che il ping sia stato tentato almeno pingTestSec fa...
if (DateTime.Now.Subtract(lastPING).TotalSeconds > vetoPingSec)
{
if (doLog)
{
lgInfo("Shelly: ConnKO - tryConnect");
}
lgDebug("Shelly: tryConnect step 04");
lgDebug("Shelly: Reset QueuePing");
bool pingOK = testPingMachine == IPStatus.Success;
addTest(pingOK);
// se passa il ping faccio il resto...
if (pingStatusOk() || pingOK)
{
// in primis salvo data ping...
lastPING = DateTime.Now;
connectionOk = true;
queueInEnabCurr = true;
lgInfo("Shelly - ping OK");
}
else
{
// loggo no risposta ping ...
lgError("Shelly - ping KO");
}
}
}
}
/// <summary>
/// Override disconnessione
/// </summary>
public override void tryDisconnect()
{
lgInfo("Richiesta disconnessione adapter Shelly!");
connectionOk = false;
queueInEnabCurr = false;
}
#endregion Public Methods
#region Private Fields
private static Stopwatch sw = new Stopwatch();
/// <summary>
/// Oggetto dove viene salvata ultima risposta Shelly x dati RT (potenza, correnti, ...)
/// </summary>
private ShellyResult<EgwProxy.Shelly.DTO.Gen2.EMDto> lastShellyRespRT;
/// <summary>
/// Oggetto dove viene salvata ultima risposta Shelly x dati Energia (Total per fase e globle)
/// </summary>
private ShellyResult<EgwProxy.Shelly.DTO.Gen2.EMDataDto> lastShellyRespEnergy;
private int PoweroffTimeoutSec = 100;
/// <summary>
/// Delay tra chiamate in sec
/// </summary>
private int shellyCallDelay = 1;
/// <summary>
/// Client interno x comunicazione con Shelly devices
/// </summary>
private ShellyClientBase shellyCli;
/// <summary>
/// Veto controllo status x log...
/// </summary>
private DateTime vetoCheckStatus = DateTime.Now;
#endregion Private Fields
#region Private Methods
private void addTest(bool pingOk)
{
int score = pingOk ? 1 : 0;
// controllo: se era spenta e risulta ping ok --> reset coda!
if (B_input == 0 && pingOk)
{
B_input = 1;
QueuePing = new DataQueue(IOBConfFull.General.FilenameIOB, "QueuePing", false, redisMan);
lgTrace($"QueuePing resetted on addTest");
}
QueuePing.Enqueue($"{score}");
while (QueuePing.Count > maxQueuePing)
{
string res = "";
QueuePing.TryDequeue(out res);
}
}
/// <summary>
/// Calcola status ping:
/// - se ha 50% coda richiesta -- true
/// - se ha 50% coda richiesta -- true se è maggior parte a 1 (true)
/// </summary>
/// <returns></returns>
private bool pingStatusOk()
{
bool answ = false;
long numVal = QueuePing.Count;
if (numVal > maxQueuePing / 2)
{
var listaValori = QueuePing.ToList();
long numOk = listaValori.Where(x => x == "1").Count();
long numKo = numVal - numOk;
answ = numOk >= numKo;
lgTrace($"PING ok per: {numOk} > {numKo}");
}
else
{
lgTrace($"PING check: {answ} per mancanza dati minimi test");
}
return answ;
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EgwProxy.Shelly" version="3.7.2507.1012" targetFramework="net462" />
<package id="EgwProxy.Shelly" version="3.7.2508.708" targetFramework="net462" />
<package id="Flurl" version="4.0.0" targetFramework="net462" />
<package id="Flurl.Http" version="4.0.2" targetFramework="net462" />
<package id="MapoSDK" version="6.14.2508.516" targetFramework="net462" />
+2 -1
View File
@@ -44,7 +44,8 @@ REM ROBOCOPY %2 \\10.51.90.5\Steamware\IOB-WIN-SHELLY-DEB /MIR
REM ROBOCOPY %2 \\10.51.90.5\Steamware\IOB-WIN-SHELLY-DEB /MIR /log:RobocopyTransfer.log
REM ROBOCOPY %2 Z:\IOB-WIN-SHELLY-DEB /MIR
REM ROBOCOPY %2 \\10.51.90.10\Steamware\IOB-WIN-SHELLY-DEB /MIR
ROBOCOPY %2 \\10.51.90.9\Steamware\IOB-WIN-SHELLY-DEB /MIR
REM ROBOCOPY %2 \\10.51.90.9\Steamware\IOB-WIN-SHELLY-DEB /MIR
ROBOCOPY %2 \\10.51.90.13\Steamware\IOB-WIN-SHELLY-DEB /MIR
goto END