UPdate x testing Zetapack PLC

This commit is contained in:
Samuele Locatelli
2022-11-11 11:01:15 +01:00
parent 3bd8ec6d04
commit c094e97920
8 changed files with 329 additions and 49 deletions
+5
View File
@@ -328,6 +328,11 @@ namespace IOB_UT_NEXT
/// </summary>
MODBUS_TCP_IMAX_AEROMEC,
/// <summary>
/// Adapter Modubus TCP versione Zetapack (Giacovelli)
/// </summary>
MODBUS_TCP_ZETAPACK,
/// <summary>
/// Adapter MTConnect
/// </summary>
+5
View File
@@ -1646,6 +1646,11 @@ namespace IOB_WIN_NEXT
start.Enabled = true;
break;
case tipoAdapter.MODBUS_TCP_ZETAPACK:
iobObj = new IobModbusTCPZetapack(this, IOBConf);
start.Enabled = true;
break;
case tipoAdapter.MTConnect:
iobObj = new IobMTC(this, IOBConf);
start.Enabled = true;
+3 -2
View File
@@ -24,11 +24,12 @@ CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
ADDR_READ=40000
ADDR_WRITE=40000
ADDR_READ=40001
ADDR_WRITE=40001
SIZE_READ=30
SIZE_WRITE=0
HR_BASE_ADDR=40000
DELTA_BASE=0
[BLINK]
+78
View File
@@ -0,0 +1,78 @@
;Configurazione IOB-WIN
[IOB]
;Impianto Zetapack di Locorotondo (test) - Giacovelli
CNCTYPE=MODBUS_TCP_ZETAPACK
PING_MS_TIMEOUT=1000
MinDeltaSec=5
[MACHINE]
VENDOR=Zetapack
MODEL=Linea imballo
[CNC]
IP=192.168.16.11
PORT=502
[SERVER]
MPIP=http://192.168.1.7
MPURL=/MP/IO
CMDBASE=/IOB/input/
CMDFLOG=/IOB/flog/
CMDALIVE=/IOB
CMDENABLED=/IOB/enabled/
CMDADV1=?valore=
CMDREBO=/sendReboot.aspx?idxMacchina=
[MEMORY]
ADDR_READ=40001
ADDR_WRITE=40001
SIZE_READ=10
SIZE_WRITE=0
HR_BASE_ADDR=40000
DELTA_BASE=0
[BLINK]
;MAX_COUNTER_BLINK = 30
MAX_COUNTER_BLINK = 15
;bit0 = 0
;bit1 = 0
;bit2 = 1
;bit3 = 1
;bit4 = 1
;bit5 = 0
;bit6 = 0
;bit7 = 0
BLINK_FILT=0
;BLINK_FILT=28
[OPTPAR]
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
PZCOUNT_MODE=STD.DB85.DBRE16
DISABLE_PZCOUNT=TRUE
ENABLE_SEND_PZC_BLOCK=TRUE
MIN_SEND_PZC_BLOCK=0
MAX_SEND_PZC_BLOCK=100
; GEST DATI DYN
ENABLE_DYN_DATA=TRUE
FORCE_DYN_DATA=TRUE
; gestione delta minimo accettabile tra min/MAX
DELTA_VAL=0.1
; clock base (da 10ms)
timerIntMs=10
; conf parametri memoria READ/WRITE
PARAM_CONF=GIACO_ZPACK_1.json
NO_PING=FALSE
; conf blocchi memoria x READ
MEM_BLOCK=GIACO_ZPACK_1_MBlock.json
; conf aree allarme
ALARM_CONF=GIACO_ZPACK_1_alarm.json
; rimozione check limiti min/max dynData
disDynDataRangeCheck=true
[BRANCH]
NAME=master
+110
View File
@@ -0,0 +1,110 @@
{
"mMapWrite": {
},
"mMapRead": {
//"StatusWord": {
// "name": "StatusWord",
// "description": "Word di Status",
// "memAddr": "40002",
// "tipoMem": "Int",
// "index": 2,
// "size": 1,
// "func": "POINT",
// "period": 90,
// "factor": 1,
// "minVal": 0,
// "maxVal": 65536,
// "unit": "BMap"
//},
//"StatusDetWord": {
// "name": "StatusDetWord",
// "description": "Word di Status",
// "memAddr": "40005",
// "tipoMem": "Int",
// "index": 5,
// "size": 1,
// "func": "POINT",
// "period": 90,
// "factor": 1,
// "minVal": 0,
// "maxVal": 65536,
// "unit": "BMap"
//},
"FreqInverter": {
"name": "FreqInverter",
"description": "Frequenza Inverter",
"memAddr": "40011",
"tipoMem": "Real",
"index": 11,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "Hz"
},
"CDOreManuten": {
"name": "CDOreManuten",
"description": "Residuo ore a prossimo service",
"memAddr": "40013",
"tipoMem": "Int",
"index": 13,
"size": 1,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "h"
},
"COreTAsp1": {
"name": "COreTAsp1",
"description": "Totale ore funzionamento impianto",
"memAddr": "40014",
"tipoMem": "Int",
"index": 14,
"size": 1,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "h"
},
"COrePAsp1": {
"name": "COrePAsp1",
"description": "Parziale ore funzionamento impianto da ultimo service",
"memAddr": "40015",
"tipoMem": "Int",
"index": 15,
"size": 1,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "h"
},
"AmpereReale": {
"name": "AmpereReale",
"description": "Assorbimento aspiratore 1",
"memAddr": "40016",
"tipoMem": "Real",
"index": 16,
"size": 2,
"func": "MEDIAN",
"period": 90,
"factor": 1,
"minVal": 0,
"maxVal": 999999999,
"unit": "A"
}
},
"optMemPar": {
"AutoBitCond": "40002.14=1",
"EStopBitCond": "40002.9=0",
"WorkBitCond": "40002.0=1"
}
}
@@ -0,0 +1,5 @@
{
"ReadBlocks": {
"40000": 30
}
}
@@ -0,0 +1,52 @@
[
{
"description": "Allarmi Impianto",
"tipoMem": "DInt",
"memAddr": "40003",
"index": 3,
"size": 2,
"messages": [
"ALLARME VENTILATORE 1",
"ALLARME VENTILATORE 2",
"WARNING FILTRI INTASATI",
"WARNING LIVELLO FILTRO",
"ALLARME LIVELLO FILTRO",
"ALLARME TAGLIAFUOCO 1 ASPIRAZIONE ",
"ALLARME TAGLIAFUOCO 2 ASPIRAZIONE ",
"CUMULATIVO ALLARMI ALIMENTAZIONI (24V AC-DC)",
"ALLARME FUORIUSCITA IQUINANTE ",
"ALLARME TERMOVELOCIMETRICO",
"ALLARME RILEVATORE SCINTILLE",
"ALLARME SPORTELLO APERTO",
"ALLARME MOTORE VALVOLA STELLARE FILTRO",
"ALLARME MOTORE COCLEA ",
"ALLARME MOTORE VALVOLA STELLARE CALDAIA",
"ALLARME MOTORE ESTRATTORE FILTRO"
]
},
{
"description": "Allarmi Impianto",
"tipoMem": "DInt",
"memAddr": "40004",
"index": 4,
"size": 2,
"messages": [
"ALLARME MOTORE ASPIRATORE TRAVASO",
"WARNING BY-PASS 1 ASPIRAZIONE",
"WARNING BY-PASS 2 ASPIRAZIONE",
"WARNING BY-PASS 3 ASPIRAZIONE",
"WARNING BY-PASS 4 ASPIRAZIONE",
"ALLARME TERMICO VIBRATORI",
"ALLARME INTASAMENTO ESTRATTORE",
"WARNING FILTRI INTASATI PLENUM",
"CUMULATIVO ALLARMI RECUPERATORE",
"WARNING SERRANDA 1 PARTENZA ASPIRAZIONE",
"WARNING SERRANDA 2 PARTENZA ASPIRAZIONE",
"WARNING SERRANDA 3 PARTENZA ASPIRAZIONE",
"ALLARME IMPLOSIONE TUBAZIONI",
"WARNING IMPLOSIONE TUBAZIONI",
"ALLARME VENTILATORE 3",
"ALLARME INTASAMENTO TASCHE"
]
}
]
+71 -47
View File
@@ -25,7 +25,7 @@ namespace IOB_WIN_NEXT
/// <param name="IOBConf"></param>
public IobModbusTCPZetapack(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
{
lgInfo("NEW IOB ModBus TCP IMAS Aeromec");
lgInfo("NEW IOB ModBus TCP Zetapack");
// provo lettura una prima volta i dati DYN
if (currPLC != null && currPLC.Connected)
@@ -43,51 +43,8 @@ namespace IOB_WIN_NEXT
#endregion Public Constructors
#region Protected Methods
#region Protected Properties
/// <summary>
/// Restituisce status di emergenza, hard coded dall'area di allarmi
/// </summary>
protected bool EStop
{
get
{
bool answ = false;
int currStatus = 0;
// hard coded
int statusReg = 40002;
// deve avere allarmi (è un allarme EStop)
if (hasAlarms())
{
int[] listInt = new int[2];
listInt = HoldingRegisterLUT[statusReg];
currStatus = ModbusClient.ConvertRegistersToInt(listInt);
// hard coded il 5° bit
answ = ((currStatus & (1 << 9)) > 0);
}
return answ;
}
}
/// <summary>
/// Restituisce status di LAVORA, hard coded
/// </summary>
protected bool Work
{
get
{
bool answ = false;
int currStatus = 0;
// hard coded
int statusReg = 40002;
int[] listInt = new int[2];
listInt = HoldingRegisterLUT[statusReg];
currStatus = ModbusClient.ConvertRegistersToInt(listInt);
// hard coded il 5° bit
answ = ((currStatus & (1 << 0)) > 0);
return answ;
}
}
/// <summary>
/// Restituisce status di AUTOmatico, hard coded
/// </summary>
@@ -95,6 +52,8 @@ namespace IOB_WIN_NEXT
{
get
{
return testCondition("WorkBitCond");
#if false
bool answ = false;
int currStatus = 0;
// hard coded
@@ -105,9 +64,49 @@ namespace IOB_WIN_NEXT
// hard coded il 5° bit
answ = ((currStatus & (1 << 14)) > 0);
return answ;
#endif
}
}
/// <summary>
/// Restituisce status di ESTOP triggered (triggered = premuta, altrimenti armed)
/// </summary>
protected bool EStopTriggered
{
get
{
return testCondition("EStopBitCond");
}
}
/// <summary>
/// Restituisce status di LAVORA, hard coded
/// </summary>
protected bool Work
{
get
{
return testCondition("WorkBitCond");
#if false
bool answ = false;
int currStatus = 0;
// hard coded
int statusReg = 40002;
int[] listInt = new int[2];
listInt = HoldingRegisterLUT[statusReg];
currStatus = ModbusClient.ConvertRegistersToInt(listInt);
// hard coded il 5° bit
answ = ((currStatus & (1 << 0)) > 0);
return answ;
#endif
}
}
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
/// </summary>
@@ -139,8 +138,8 @@ namespace IOB_WIN_NEXT
}
if (HoldingRegisterLUT != null && HoldingRegisterLUT.Count > 0)
{
// processo dagli stati + gravi...
if (!EStop)
// se emergenza NON premuta (triggered) indico OK (armata...)
if (!EStopTriggered)
{
byteSignals += (1 << 7);
}
@@ -196,6 +195,31 @@ namespace IOB_WIN_NEXT
lgTrace("-------------------- Completato test lettura {baseAddr} --------------------");
}
/// <summary>
/// Testa la condition modbus da LUT + configurazione
/// </summary>
/// <param name="cKey"></param>
/// <returns></returns>
private bool testCondition(string cKey)
{
bool answ = false;
if (OptCheckConditions.ContainsKey(cKey))
{
int currStatus = 0;
int[] listInt = new int[2];
listInt = HoldingRegisterLUT[OptCheckConditions[cKey].BaseAddr];
currStatus = ModbusClient.ConvertRegistersToInt(listInt);
// hard coded il 9° bit a zero
answ = ((currStatus & (1 << OptCheckConditions[cKey].BitNum)) == OptCheckConditions[cKey].ValOk);
lgTrace($"testCondition for {cKey} | BaseAddr: {OptCheckConditions[cKey].BaseAddr} | BitNum: {OptCheckConditions[cKey].BitNum} | ValOk: {OptCheckConditions[cKey].ValOk}");
}
else
{
lgTrace($"testCondition error: {cKey} not found");
}
return answ;
}
private void testRead()
{
foreach (var item in memSetR)