Merge branch 'develop' into IobMan
This commit is contained in:
Binary file not shown.
+10
-13
@@ -1,7 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=TORNOS
|
||||
@@ -32,6 +31,7 @@ AREAY_SIZE=16
|
||||
;BIT0=CONN
|
||||
BIT1=Y8.6
|
||||
BIT2=PZCOUNT.D.6416.DW
|
||||
;BIT2=X7.1
|
||||
BIT3=Y8.4
|
||||
BIT4=Y8.5
|
||||
AREAD_START=0
|
||||
@@ -60,18 +60,15 @@ BLINK_FILT=0
|
||||
;BLINK_FILT=28
|
||||
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
; attenzione memoria sempre base BYTE (1604 DW --> 6416...)
|
||||
PZCOUNT_MODE=STD.D.6416.DW
|
||||
PZREQ_MODE=STD.D.6412.DW
|
||||
PZCAD_MODE=STD.D.6408.DW
|
||||
PZGTOT_MODE=STD.D.6420.DW
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=FALSE
|
||||
;PZ_DONE_MADDR=1604; pz fatti
|
||||
;PZ_REQ_MADDR=1603; pz richiesti (DW)
|
||||
;PZCOUNT_MODE=STD|BIT
|
||||
;PZCOUNT_MODE=BIT.X7.1
|
||||
PZCOUNT_MODE=STD.D.6416.DW
|
||||
;PZ_CAD_MADDR=1602; cad
|
||||
;PZ_REQ_MADDR=1603; pz richiesti (DW)
|
||||
;PZ_DONE_MADDR=1604; pz fatti
|
||||
;PZ_GTOT_MADDR=1605; pz tot macchina
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
+13
-15
@@ -1,14 +1,13 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=TORNOS
|
||||
MODEL=DT26
|
||||
|
||||
[CNC]
|
||||
; TORNOS DT26 II (IOT ENABLED)
|
||||
; TORNOS DT26 II IOT ENABLED
|
||||
IP=172.16.199.10
|
||||
PORT=8193
|
||||
GETPRGNAME=true
|
||||
@@ -32,6 +31,7 @@ AREAY_SIZE=16
|
||||
;BIT0=CONN
|
||||
BIT1=Y8.6
|
||||
BIT2=PZCOUNT.D.6416.DW
|
||||
;BIT2=X7.1
|
||||
BIT3=Y8.4
|
||||
BIT4=Y8.5
|
||||
AREAD_START=0
|
||||
@@ -50,27 +50,25 @@ PAR_SIZE=3
|
||||
MAX_COUNTER_BLINK = 15
|
||||
;bit0 = 0
|
||||
;bit1 = 0
|
||||
;bit2 = 1
|
||||
;bit2 = 0
|
||||
;bit3 = 1
|
||||
;bit4 = 1
|
||||
;bit5 = 0
|
||||
;bit6 = 0
|
||||
;bit7 = 0
|
||||
BLINK_FILT=0
|
||||
BLINK_FILT=24
|
||||
;BLINK_FILT=28
|
||||
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
; attenzione memoria sempre base BYTE (1604 DW --> 6416...)
|
||||
PZCOUNT_MODE=STD.D.6416.DW
|
||||
PZREQ_MODE=STD.D.6412.DW
|
||||
PZCAD_MODE=STD.D.6408.DW
|
||||
PZGTOT_MODE=STD.D.6420.DW
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
;PZ_DONE_MADDR=1604; pz fatti
|
||||
;PZ_REQ_MADDR=1603; pz richiesti (DW)
|
||||
;PZCOUNT_MODE=STD|BIT
|
||||
;PZCOUNT_MODE=BIT.X7.1
|
||||
PZCOUNT_MODE=STD.D.6416.DW
|
||||
;PZ_CAD_MADDR=1602; cad
|
||||
;PZ_REQ_MADDR=1603; pz richiesti (DW)
|
||||
;PZ_DONE_MADDR=1604; pz fatti
|
||||
;PZ_GTOT_MADDR=1605; pz tot macchina
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -1,7 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=CMZ
|
||||
@@ -61,12 +60,17 @@ BLINK_FILT=0
|
||||
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD|BIT
|
||||
PZCOUNT_MODE=STD.PAR.6711
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
PZCOUNT_MODE=STD.PAR.6711
|
||||
;PZ_CAD_MADDR=1602
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -1,7 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=BIGLIA
|
||||
@@ -33,7 +32,7 @@ AREAY_SIZE=12
|
||||
BIT1=Y4.5
|
||||
BIT2=PZCOUNT.PAR.6711
|
||||
BIT3=Y3.2
|
||||
BIT4=Y8.0
|
||||
BIT4=Y8.0
|
||||
BIT5=Y2.0
|
||||
AREAD_START=0
|
||||
AREAD_SIZE=9999
|
||||
@@ -67,6 +66,12 @@ PZCOUNT_MODE=STD.PAR.6711
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=5
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -1,7 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=BIGLIA
|
||||
@@ -32,7 +31,7 @@ AREAY_SIZE=12
|
||||
;BIT0=CONN
|
||||
BIT1=Y4.5
|
||||
BIT2=PZCOUNT.PAR.6711
|
||||
BIT3=Y3.2
|
||||
BIT3=Y3.2
|
||||
BIT4=Y8.0
|
||||
BIT5=Y2.0
|
||||
AREAD_START=0
|
||||
@@ -67,6 +66,12 @@ PZCOUNT_MODE=STD.PAR.6711
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=5
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -1,7 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=HANWHA
|
||||
@@ -62,10 +61,12 @@ BLINK_FILT=8
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD|BIT
|
||||
PZCOUNT_MODE=STD.PAR.6711
|
||||
;PZ_CAD_MADDR=1602
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
PZ_CAD_MADDR=1602
|
||||
PZ_REQ_MADDR=1603
|
||||
PZ_DONE_MADDR=1604
|
||||
PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
+12
-11
@@ -1,7 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=STAR
|
||||
@@ -35,13 +34,13 @@ BIT2=PZCOUNT.PAR.6711
|
||||
BIT3=Y0.2
|
||||
BIT4=Y1.2
|
||||
AREAD_START=0
|
||||
AREAD_SIZE=9999
|
||||
AREAD_SIZE=0
|
||||
AREAR_START=0
|
||||
AREAR_SIZE=64
|
||||
AREAR_SIZE=0
|
||||
AREAX_START=0
|
||||
AREAX_SIZE=64
|
||||
AREAX_SIZE=0
|
||||
AREAY_START=0
|
||||
AREAY_SIZE=64
|
||||
AREAY_SIZE=0
|
||||
PAR_START=6711
|
||||
PAR_SIZE=3
|
||||
|
||||
@@ -62,10 +61,12 @@ BLINK_FILT=8
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD|BIT
|
||||
PZCOUNT_MODE=STD.PAR.6711
|
||||
;PZ_CAD_MADDR=1602
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
PZ_CAD_MADDR=1602
|
||||
PZ_REQ_MADDR=1603
|
||||
PZ_DONE_MADDR=1604
|
||||
PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -1,11 +1,10 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=SIEMENS_TORRI
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=TORRI
|
||||
MODEL=VUOMARD V100
|
||||
MODEL=VUOMARD
|
||||
|
||||
[CNC]
|
||||
; Siemens Torri (Vuomard)
|
||||
@@ -30,11 +29,11 @@ ADDR_WRITE=DB701.DBB0
|
||||
SIZE_READ=52
|
||||
SIZE_WRITE=138
|
||||
;BIT0=CONN
|
||||
BIT1=DB700.DBB.0.1
|
||||
BIT1=DB700.DBB1
|
||||
;BIT2=PZCOUNT.STD.DB700.DBW22
|
||||
BIT3=DB700.DBB.0.3
|
||||
BIT4=DB700.DBB.0.4
|
||||
BIT5=DB700.DBB.1.4 ; bit ciclo in test == riscaldamento
|
||||
BIT3=DB700.DBB3
|
||||
BIT4=DB700.DBB4
|
||||
BIT5=DB701.DBB4 ; bit ciclo in test == riscaldamento
|
||||
|
||||
|
||||
[BLINK]
|
||||
@@ -59,6 +58,8 @@ PZCOUNT_MODE=STD.DB700.DBW22
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -1,6 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=SIEMENS_TORRI
|
||||
CNCTYPE=SIEMENS_TORRI
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
@@ -14,7 +14,7 @@ CPUTYPE=S7300
|
||||
RACK=0
|
||||
SLOT=2
|
||||
|
||||
[SERVER]
|
||||
[SERVER]
|
||||
MPIP=http://192.168.1.7
|
||||
MPURL=/MP/IO
|
||||
CMDBASE=/IOB/input/
|
||||
@@ -29,12 +29,12 @@ ADDR_READ=DB700.DBB0
|
||||
ADDR_WRITE=DB701.DBB0
|
||||
SIZE_READ=52
|
||||
SIZE_WRITE=138
|
||||
;BIT0=CONN
|
||||
BIT1=DB700.DBB.0.1
|
||||
;BIT0=CONN
|
||||
BIT1=DB700.DBB1
|
||||
;BIT2=PZCOUNT.STD.DB700.DBW22
|
||||
BIT3=DB700.DBB.0.3
|
||||
BIT4=DB700.DBB.0.4
|
||||
BIT5=DB700.DBB.1.4 ; bit ciclo in test == riscaldamento
|
||||
BIT3=DB700.DBB3
|
||||
BIT4=DB700.DBB4
|
||||
BIT5=DB701.DBB4 ;bit ciclo in test == riscaldamento
|
||||
|
||||
|
||||
[BLINK]
|
||||
@@ -59,6 +59,8 @@ PZCOUNT_MODE=STD.DB700.DBW22
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -1,7 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=TAKAHASHI
|
||||
@@ -66,6 +65,12 @@ PZCOUNT_MODE=STD.PAR.6711
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -1,7 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=SIEMENS_TORRI
|
||||
PING_MS_TIMEOUT=500
|
||||
CNCTYPE=SIEMENS_TORRI
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=TORRI
|
||||
@@ -29,12 +28,12 @@ ADDR_READ=DB700.DBB0
|
||||
ADDR_WRITE=DB701.DBB0
|
||||
SIZE_READ=52
|
||||
SIZE_WRITE=138
|
||||
;BIT0=CONN
|
||||
BIT1=DB700.DBB.0.1
|
||||
;BIT0=CONN
|
||||
BIT1=DB700.DBB1
|
||||
;BIT2=PZCOUNT.STD.DB700.DBW22
|
||||
BIT3=DB700.DBB.0.3
|
||||
BIT4=DB700.DBB.0.4
|
||||
BIT5=DB700.DBB.1.4 ; bit ciclo in test == riscaldamento
|
||||
BIT3=DB700.DBB3
|
||||
BIT4=DB700.DBB4
|
||||
BIT5=DB701.DBB4 ; bit ciclo in test == riscaldamento
|
||||
|
||||
|
||||
[BLINK]
|
||||
@@ -59,6 +58,8 @@ PZCOUNT_MODE=STD.DB700.DBW22
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=FALSE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
+14
-10
@@ -10,7 +10,8 @@ MODEL=SPRINT-32-5
|
||||
[CNC]
|
||||
; DMG MORI (IOT ENABLED)
|
||||
IP=192.168.0.12
|
||||
PORT=8193
|
||||
PORT=19000
|
||||
;PORT=8193
|
||||
GETPRGNAME=true
|
||||
|
||||
[SERVER]
|
||||
@@ -35,23 +36,24 @@ CMDREBO=/sendReboot.aspx?idxMacchina=
|
||||
;6) prog in RUN Y5.0 (pag 6 di 12)
|
||||
|
||||
[MEMORY]
|
||||
AREAG_SIZE=48
|
||||
AREAR_SIZE=0
|
||||
AREAX_SIZE=8
|
||||
AREAY_SIZE=16
|
||||
; Red: Y1.1 | Yellow: Y1.2 | Green Y1.3 | All DoorsClosed: Y4.0 (X5.1) | ..........WrkZone Y8.7 | PZ richiesti: D.7960.DW - PZ prodotti: D.7964.DW
|
||||
;BIT0=CONN
|
||||
BIT1=Y1.3
|
||||
BIT2=PZCOUNT.D.7964.DW
|
||||
BIT3=Y1.1
|
||||
BIT3=Y1.1
|
||||
BIT4=Y1.2
|
||||
BIT5=Y1.0 ; blu = feed <= 70
|
||||
;BIT6=Y5.0 ; RUN
|
||||
AREAD_START=0
|
||||
AREAD_SIZE=99 ;9999
|
||||
AREAG_SIZE=48
|
||||
AREAR_START=7500 ;0
|
||||
AREAD_SIZE=9999
|
||||
AREAR_START=0
|
||||
AREAR_SIZE=64
|
||||
AREAX_START=0
|
||||
AREAX_SIZE=8 ;64
|
||||
AREAX_SIZE=64
|
||||
AREAY_START=0
|
||||
AREAY_SIZE=16 ;64
|
||||
AREAY_SIZE=64
|
||||
PAR_START=6711
|
||||
PAR_SIZE=3
|
||||
|
||||
@@ -77,6 +79,8 @@ PZCOUNT_MODE=STD.D.7964.DW
|
||||
;PZ_REQ_MADDR=1990; pz richiesti (DW)
|
||||
;PZ_DONE_MADDR=1991; pz fatti (DW)
|
||||
;PZ_GTOT_MADDR=???; pz tot macchina
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -52,12 +52,11 @@ BLINK_FILT=0
|
||||
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
; attenzione memoria sempre base BYTE (1604 DW --> 6416...)
|
||||
; attenzione memoria sempre base BYTE (1604 DW --> 6416...)
|
||||
;PZCOUNT_MODE=STD.DB550.DBDW0
|
||||
PZCOUNT_MODE=NONE
|
||||
PZCOUNT_MODE=NONE
|
||||
DISABLE_PZCOUNT=TRUE
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
TSVC_pressCamFilt=MAX:60
|
||||
TSVC_pressLinUt=MAX:60
|
||||
TSVC_tempH2O=MAX:60
|
||||
@@ -65,6 +64,8 @@ TSVC_tempH2O=MAX:60
|
||||
;PZ_REQ_MADDR=1603
|
||||
;PZ_DONE_MADDR=1604
|
||||
;PZ_GTOT_MADDR=1605
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
NAME=develop
|
||||
@@ -55,6 +55,12 @@ PZCOUNT_MODE=NONE
|
||||
DISABLE_PZCOUNT=TRUE
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
; gestione custom timer
|
||||
timerIntMs=50
|
||||
; CONF variabili da recuperare in WebPage (stato macchina, contatori, variabili, ...)
|
||||
LUT_CONF=3018.json
|
||||
|
||||
|
||||
@@ -57,13 +57,11 @@
|
||||
"codeMapping": {
|
||||
"Spento": "00",
|
||||
"PowerOn": "01",
|
||||
"Attesa": "01",
|
||||
"Carico": "03",
|
||||
"A vuoto": "05",
|
||||
"Riserva": "09",
|
||||
"Alarm": "11",
|
||||
"STATUS_6": "20",
|
||||
"STATUS_7": "40",
|
||||
"STATUS_8": "80"
|
||||
"Alarm": "11"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -55,8 +55,14 @@ PZCOUNT_MODE=NONE
|
||||
DISABLE_PZCOUNT=TRUE
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=0
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
; gestione custom timer
|
||||
timerIntMs=50
|
||||
; CONF variabili da recuperare in WebPage (stato macchina, contatori, variabili, ...)
|
||||
LUT_CONF=3018.json
|
||||
LUT_CONF=3019.json
|
||||
|
||||
[BRANCH]
|
||||
NAME=master
|
||||
|
||||
@@ -57,13 +57,11 @@
|
||||
"codeMapping": {
|
||||
"Spento": "00",
|
||||
"PowerOn": "01",
|
||||
"Attesa": "01",
|
||||
"Carico": "03",
|
||||
"A vuoto": "05",
|
||||
"Riserva": "09",
|
||||
"Alarm": "11",
|
||||
"STATUS_6": "20",
|
||||
"STATUS_7": "40",
|
||||
"STATUS_8": "80"
|
||||
"Alarm": "11"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -5,7 +5,7 @@ PING_MS_TIMEOUT=500
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=TORRI
|
||||
MODEL=VUOMARD V110
|
||||
MODEL=GHIRINGHELLI
|
||||
|
||||
[CNC]
|
||||
; Siemens Torri (Vaumard)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
CNCTYPE=FANUC
|
||||
|
||||
[MACHINE]
|
||||
VENDOR=CITIZEN
|
||||
MODEL=GN-3200
|
||||
|
||||
[CNC]
|
||||
; CITIZEN RETTIFICA 3021
|
||||
IP=192.168.0.24
|
||||
PORT=8193
|
||||
GETPRGNAME=true
|
||||
|
||||
[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]
|
||||
; Red: Y2.0 | Yellow: Y1.7 | Green Y2.1 | riscaldamento Y7.4 | D19.1 MANCA PEZZO (SE rosso)
|
||||
;BIT0=CONN
|
||||
BIT1=Y2.1
|
||||
BIT2=PZCOUNT.PAR.6711
|
||||
BIT3=Y2.0
|
||||
BIT4=Y1.7
|
||||
BIT5=Y7.4
|
||||
AREAD_START=0
|
||||
AREAD_SIZE=0
|
||||
AREAG_SIZE=48
|
||||
AREAR_START=0
|
||||
AREAR_SIZE=0
|
||||
AREAX_START=0
|
||||
AREAX_SIZE=0
|
||||
AREAY_START=0
|
||||
AREAY_SIZE=8
|
||||
PAR_START=6711
|
||||
PAR_SIZE=3
|
||||
|
||||
[BLINK]
|
||||
;MAX_COUNTER_BLINK = 30
|
||||
MAX_COUNTER_BLINK = 15
|
||||
;bit0 = 0
|
||||
;bit1 = 0
|
||||
;bit2 = 0
|
||||
;bit3 = 0
|
||||
;bit4 = 1
|
||||
;bit5 = 0
|
||||
;bit6 = 0
|
||||
;bit7 = 0
|
||||
BLINK_FILT=0
|
||||
;BLINK_FILT=16
|
||||
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD|BIT
|
||||
PZCOUNT_MODE=STD.PAR.6711
|
||||
PZGTOT_MODE=STD.PAR.6712
|
||||
PZREQ_MODE=STD.PAR.6713
|
||||
;PZCAD_MODE=STD.D.6408.DW
|
||||
ENABLE_PZ_RESET=TRUE
|
||||
ENABLE_PZ_RESET_stopSetup=TRUE
|
||||
;gestione invio pezzi in blocco
|
||||
ENABLE_SEND_PZC_BLOCK=TRUE
|
||||
MIN_SEND_PZC_BLOCK=5
|
||||
MAX_SEND_PZC_BLOCK=100
|
||||
|
||||
[BRANCH]
|
||||
NAME=develop
|
||||
@@ -1,6 +1,6 @@
|
||||
;Configurazione IOB-WIN
|
||||
[IOB]
|
||||
;Macchina preriscaldo barre per Valvital
|
||||
;Macchina DENTATRICE per Valvital
|
||||
CNCTYPE=SIEMENS_COMUR
|
||||
PING_MS_TIMEOUT=500
|
||||
|
||||
@@ -54,7 +54,7 @@ BLINK_FILT=0
|
||||
[OPTPAR]
|
||||
;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
|
||||
; attenzione memoria sempre base BYTE (1604 DW --> 6416...)
|
||||
PZCOUNT_MODE=STD.DB111.DBD2
|
||||
PZCOUNT_MODE=SPEC.DB111.DBB2
|
||||
DISABLE_PZCOUNT=TRUE
|
||||
ENABLE_DYN_DATA=TRUE
|
||||
FORCE_DYN_DATA=TRUE
|
||||
|
||||
+48
-26
@@ -1,30 +1,52 @@
|
||||
{
|
||||
"mMapWrite": {
|
||||
"setArt": {
|
||||
"name": "setArt",
|
||||
"description": "Articolo",
|
||||
"memAddr": "DB150.DBB12",
|
||||
"tipoMem": "String",
|
||||
"index": 12,
|
||||
"size": 20
|
||||
"mMapWrite": {
|
||||
"setArt": {
|
||||
"name": "setArt",
|
||||
"description": "Articolo",
|
||||
"memAddr": "DB150.DBB12",
|
||||
"tipoMem": "String",
|
||||
"index": 12,
|
||||
"size": 20
|
||||
},
|
||||
"setComm": {
|
||||
"name": "setComm",
|
||||
"description": "Commessa",
|
||||
"memAddr": "DB150.DBB32",
|
||||
"tipoMem": "String",
|
||||
"index": 32,
|
||||
"size": 20
|
||||
},
|
||||
"setPzComm": {
|
||||
"name": "setPzComm",
|
||||
"description": "Qty",
|
||||
"memAddr": "DB150.DBB8",
|
||||
"tipoMem": "Int",
|
||||
"index": 8,
|
||||
"size": 4
|
||||
}
|
||||
},
|
||||
"setComm": {
|
||||
"name": "setComm",
|
||||
"description": "Commessa",
|
||||
"memAddr": "DB150.DBB32",
|
||||
"tipoMem": "String",
|
||||
"index": 32,
|
||||
"size": 20
|
||||
},
|
||||
"setPzComm": {
|
||||
"name": "setPzComm",
|
||||
"description": "Qty",
|
||||
"memAddr": "DB150.DBB8",
|
||||
"tipoMem": "Int",
|
||||
"index": 8,
|
||||
"size": 4
|
||||
"mMapRead": {
|
||||
"CodUte": {
|
||||
"name": "CodUte",
|
||||
"description": "Codice Utensile in Uso",
|
||||
"memAddr": "DB150.DBB56",
|
||||
"tipoMem": "Int",
|
||||
"index": 56,
|
||||
"size": 4,
|
||||
"func": "MAX",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
},
|
||||
"CodPezzo": {
|
||||
"name": "CodPezzo",
|
||||
"description": "Codice Pezzo in lavorazione",
|
||||
"memAddr": "DB150.DBB52",
|
||||
"tipoMem": "Int",
|
||||
"index": 52,
|
||||
"size": 4,
|
||||
"func": "MAX",
|
||||
"period": 60,
|
||||
"factor": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"mMapRead": {
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Gli identificatori non devono contenere caratteri di sottolineatura", Justification = "<In sospeso>", Scope = "namespace", Target = "~N:IOB_WIN")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1305:Specificare IFormatProvider", Justification = "<In sospeso>", Scope = "member", Target = "~M:IOB_WIN.IobSiemensSaet.processWhatchDog")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1303:Non passare valori letterali come parametri localizzati", Justification = "<In sospeso>", Scope = "member", Target = "~M:IOB_WIN.IobSiemensSaet.#ctor(IOB_WIN.AdapterForm,IOB_WIN.IobConfiguration)")]
|
||||
@@ -36,4 +38,11 @@
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1056:Le proprietà Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~P:IOB_WIN.MainForm.urlIob2call")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1056:Le proprietà Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~P:IOB_WIN.MainForm.urlReboot")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1056:Le proprietà Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~P:IOB_WIN.MainForm.urlUploadFile")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1056:Le proprietà Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~P:IOB_WIN.MainForm.urlUploadFileCloud")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1056:Le proprietà Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~P:IOB_WIN.MainForm.urlUploadFileCloud")]
|
||||
[assembly: SuppressMessage("Usage", "CA2211:I campi non costanti non devono essere visibili", Justification = "<In sospeso>", Scope = "member", Target = "~F:IOB_WIN.MainForm.lg")]
|
||||
[assembly: SuppressMessage("Design", "CA1055:I valori restituiti di Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~M:IOB_WIN.IobGeneric.callUrl(System.String,System.Boolean)~System.String")]
|
||||
[assembly: SuppressMessage("Design", "CA1054:I parametri Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~M:IOB_WIN.IobGeneric.callUrlWithPayload(System.String,System.String,System.Boolean)~System.String")]
|
||||
[assembly: SuppressMessage("Design", "CA1055:I valori restituiti di Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~M:IOB_WIN.IobGeneric.callUrlWithPayload(System.String,System.String,System.Boolean)~System.String")]
|
||||
[assembly: SuppressMessage("Design", "CA1055:I valori restituiti di Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~M:IOB_WIN.IobGeneric.urlDataBlock(IOB_UT.urlType)~System.String")]
|
||||
[assembly: SuppressMessage("Design", "CA1055:I valori restituiti di Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~M:IOB_WIN.IobGeneric.urlFLog(System.String)~System.String")]
|
||||
[assembly: SuppressMessage("Design", "CA1055:I valori restituiti di Uri non devono essere stringhe", Justification = "<In sospeso>", Scope = "member", Target = "~M:IOB_WIN.IobGeneric.urlInput(System.String)~System.String")]
|
||||
|
||||
+12
-4
@@ -275,10 +275,18 @@
|
||||
<None Include="DATA\CONF\SIMUL_06.json" />
|
||||
<None Include="DATA\CONF\SIMUL_07.json" />
|
||||
<None Include="DATA\CONF\SIMUL_08.json" />
|
||||
<None Include="DATA\CONF\VL23.json" />
|
||||
<None Include="DATA\CONF\VL22.json" />
|
||||
<None Include="DATA\CONF\VL21.json" />
|
||||
<None Include="DATA\CONF\VL20.json" />
|
||||
<None Include="DATA\CONF\VL23.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\VL22.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\VL21.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\VL20.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\VL25.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
||||
+1372
-1372
File diff suppressed because it is too large
Load Diff
+4328
-4296
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -583,7 +583,7 @@ namespace IOB_WIN
|
||||
/// </summary>
|
||||
/// <param name="mode"></param>
|
||||
/// <returns></returns>
|
||||
protected CNC_MODE decodeModeOsai(int mode)
|
||||
protected static CNC_MODE decodeModeOsai(int mode)
|
||||
{
|
||||
CNC_MODE answ = CNC_MODE.ND;
|
||||
switch (mode)
|
||||
|
||||
+1473
-1415
File diff suppressed because it is too large
Load Diff
+238
-229
@@ -4,240 +4,249 @@ using System.Collections.Generic;
|
||||
|
||||
namespace IOB_WIN
|
||||
{
|
||||
/// <summary>
|
||||
/// Controllo Siemens specifico x impianti COMUR
|
||||
/// </summary>
|
||||
public class IobSiemensComur : IobSiemens
|
||||
{
|
||||
/* --------------------------------------------------------------------------------
|
||||
* Controlli SIEMENS COMUR
|
||||
* - basasto su SIEMENS
|
||||
* - S7 vers 1500
|
||||
*
|
||||
* STRUTTURA MEMORIA DB150: 56 byte lettura, di cui 4 byte scrittura (4..7), vedere doc allegato
|
||||
* G:\Drive condivisi\30_Clienti\Valvital\Comunicazione PLC\COMUR Dentatrice
|
||||
*
|
||||
* Si intende tutto con DB150.DBxx
|
||||
*
|
||||
* - parametri processo PLC --> MES
|
||||
* - DBX0.0 - Macchina On: Segnale pulito di informazione sullo stato della macchina. 0->Aux OFF, 1->Aux ON
|
||||
* - DBX0.1 – Macchina in Allarme: Segnale pulito di macchina in allarme. 0->Nessun Allarme, 1->E’ presente almeno un allarme/anomalia
|
||||
* - DBX0.2 – Macchina in Ciclo: Segnale pulito sullo stato di funzionamento. 0->La macchina NON sta eseguendo un ciclo automatico, 1->La macchina sta * - eseguendo un ciclo automatico.
|
||||
* - DBX0.3 – Macchina Non in Produzione: Segnale pulito sullo stato della macchina. 0->Macchina accesa e in lavorazione automatica, 1->Macchina accesa * - ma NON sta eseguendo un ciclo automatico.
|
||||
* - DBX0.4 – Macchina In Ciclo Continuità: Segnale pulito sullo stato di funzionamento. 1->La macchina sta eseguendo un ciclo automatico con carico/ * - scarico pezzo autonomo, 0->Altrimenti.
|
||||
* - DBX0.7 – Assi In Moto: Segnale pulito sullo stato di movimento Assi. 0->Tutti gli assi della macchina sono fermi, 1->Almeno un asse si sta * - muovendo.
|
||||
* - DBX1.0 – Impulso Start Ciclo: Impulso a fronte positivo (0->1) della durata di 1’’ che rappresenta l’evento di Start Ciclo.
|
||||
* - DBX1.1 – Impulso Fine Ciclo: Impulso a fronte positivo (0->1) della durata di 1’’ che rappresenta l’evento di Fine Ciclo. Attenzione! Questo * - impulso viene generato solo se il Ciclo Automatico finisce correttamente. Non viene generato nel caso in cui il Ciclo Automatico venga interrotto da * - allarmi.
|
||||
* - DBX1.3 – Impulso Conta Pezzi: Impulso a fronte positivo (0->1) della durata di 1’’ generato al completamento di ogni programma pezzo.
|
||||
* - DBX2.0 – Preallarmi Pezzi: Segnale pulito di segnalazione Preallarme Pezzi impostabile su CN. 0->Preallarme Disattivo, 1->Preallarme Attivo
|
||||
* - DBX2.1 – Allarme Pezzi: Segnale pulito di segnalazione Allarme Pezzi impostabile su CN. 0->Allarme Disattivo, 1->Allarme Attivo.
|
||||
* - DBX2.3 – Fine Vita Utensile: Segnale pulito di segnalazione Allarme Fine Vita Creatore. 0->Allarme Disattivo, 1->Allarme Attivo.
|
||||
* - DBX2.7 – Ciclo In Attesa: Segnale pulito sullo stato di funzionamento. 1->Ciclo Automatico attivo ma tutti assi fermi, 0->Altrimenti.
|
||||
*
|
||||
* - DBD52 - Codice Pezzo In Lavorazione (4byte, REAL)
|
||||
* - DBD56 - Codice Utensile In Uso (4byte, REAL)
|
||||
*
|
||||
*
|
||||
* - parametri processo MES --> PLC
|
||||
* - DBX4.0 – Reset Contapezzi Parziale: Segnale per resettare il valore del contatore “Contapezzi parziale”. Impostare il bit a 1 per attivare la funzione (il PLC riporterà a 0 il valore quando completa l’operazione).
|
||||
*
|
||||
* - DB150.DBD8 - Numero di Pezzi da produrre per il lotto (4byte, DInt)
|
||||
* - DB150.[12.0 .. 31.7] - Codice articolo (stringa da 18 char)
|
||||
* - DB150.[32.0 .. 51.7] - Codice commessa (stringa da 18 char)
|
||||
*
|
||||
*
|
||||
* - DB111.DBD2: PartCounter INT 2.0 Conteggio Parziale di pezzi prodotti dalla macchina
|
||||
* -------------------------------------------------------------------------------- */
|
||||
|
||||
/// <summary>
|
||||
/// Classe base con i metodi x Siemens
|
||||
/// Controllo Siemens specifico x impianti COMUR
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="adpConf"></param>
|
||||
public IobSiemensComur(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
public class IobSiemensComur : IobSiemens
|
||||
{
|
||||
lgInfo("NEW IOB SIEMENS versione COMUR");
|
||||
}
|
||||
/* --------------------------------------------------------------------------------
|
||||
* Controlli SIEMENS COMUR
|
||||
* - basasto su SIEMENS
|
||||
* - S7 vers 1500
|
||||
*
|
||||
* STRUTTURA MEMORIA DB150: 56 byte lettura, di cui 4 byte scrittura (4..7), vedere doc allegato
|
||||
* G:\Drive condivisi\30_Clienti\Valvital\Comunicazione PLC\COMUR Dentatrice
|
||||
*
|
||||
* Si intende tutto con DB150.DBxx
|
||||
*
|
||||
* - parametri processo PLC --> MES
|
||||
* - DBX0.0 - Macchina On: Segnale pulito di informazione sullo stato della macchina. 0->Aux OFF, 1->Aux ON
|
||||
* - DBX0.1 – Macchina in Allarme: Segnale pulito di macchina in allarme. 0->Nessun Allarme, 1->E’ presente almeno un allarme/anomalia
|
||||
* - DBX0.2 – Macchina in Ciclo: Segnale pulito sullo stato di funzionamento. 0->La macchina NON sta eseguendo un ciclo automatico, 1->La macchina sta * - eseguendo un ciclo automatico.
|
||||
* - DBX0.3 – Macchina Non in Produzione: Segnale pulito sullo stato della macchina. 0->Macchina accesa e in lavorazione automatica, 1->Macchina accesa * - ma NON sta eseguendo un ciclo automatico.
|
||||
* - DBX0.4 – Macchina In Ciclo Continuità: Segnale pulito sullo stato di funzionamento. 1->La macchina sta eseguendo un ciclo automatico con carico/ * - scarico pezzo autonomo, 0->Altrimenti.
|
||||
* - DBX0.7 – Assi In Moto: Segnale pulito sullo stato di movimento Assi. 0->Tutti gli assi della macchina sono fermi, 1->Almeno un asse si sta * - muovendo.
|
||||
* - DBX1.0 – Impulso Start Ciclo: Impulso a fronte positivo (0->1) della durata di 1’’ che rappresenta l’evento di Start Ciclo.
|
||||
* - DBX1.1 – Impulso Fine Ciclo: Impulso a fronte positivo (0->1) della durata di 1’’ che rappresenta l’evento di Fine Ciclo. Attenzione! Questo * - impulso viene generato solo se il Ciclo Automatico finisce correttamente. Non viene generato nel caso in cui il Ciclo Automatico venga interrotto da * - allarmi.
|
||||
* - DBX1.3 – Impulso Conta Pezzi: Impulso a fronte positivo (0->1) della durata di 1’’ generato al completamento di ogni programma pezzo.
|
||||
* - DBX2.0 – Preallarmi Pezzi: Segnale pulito di segnalazione Preallarme Pezzi impostabile su CN. 0->Preallarme Disattivo, 1->Preallarme Attivo
|
||||
* - DBX2.1 – Allarme Pezzi: Segnale pulito di segnalazione Allarme Pezzi impostabile su CN. 0->Allarme Disattivo, 1->Allarme Attivo.
|
||||
* - DBX2.3 – Fine Vita Utensile: Segnale pulito di segnalazione Allarme Fine Vita Creatore. 0->Allarme Disattivo, 1->Allarme Attivo.
|
||||
* - DBX2.7 – Ciclo In Attesa: Segnale pulito sullo stato di funzionamento. 1->Ciclo Automatico attivo ma tutti assi fermi, 0->Altrimenti.
|
||||
*
|
||||
* - DBD52 - Codice Pezzo In Lavorazione (4byte, REAL)
|
||||
* - DBD56 - Codice Utensile In Uso (4byte, REAL)
|
||||
*
|
||||
*
|
||||
* - parametri processo MES --> PLC
|
||||
* - DBX4.0 – Reset Contapezzi Parziale: Segnale per resettare il valore del contatore “Contapezzi parziale”. Impostare il bit a 1 per attivare la funzione (il PLC riporterà a 0 il valore quando completa l’operazione).
|
||||
*
|
||||
* - DB150.DBD8 - Numero di Pezzi da produrre per il lotto (4byte, DInt)
|
||||
* - DB150.[12.0 .. 31.7] - Codice articolo (stringa da 18 char)
|
||||
* - DB150.[32.0 .. 51.7] - Codice commessa (stringa da 18 char)
|
||||
*
|
||||
*
|
||||
* - DB111.DBD2: PartCounter INT 2.0 Conteggio Parziale di pezzi prodotti dalla macchina
|
||||
* -------------------------------------------------------------------------------- */
|
||||
|
||||
#region Metodi specifici (da verificare/completare in implementazione)
|
||||
|
||||
/// <summary>
|
||||
/// Processo i task richiesti e li elimino dalla coda 1:1
|
||||
/// </summary>
|
||||
/// <param name="task2exe"></param>
|
||||
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
{
|
||||
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
bool taskOk = false;
|
||||
string taskVal = "";
|
||||
// inizio con 1 byte di default
|
||||
byte[] MemBlock = new byte[1];
|
||||
string memAddrWrite = "";
|
||||
if (task2exe != null)
|
||||
{
|
||||
// cerco task specifici
|
||||
foreach (var item in task2exe)
|
||||
/// <summary>
|
||||
/// Classe base con i metodi x Siemens
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="adpConf"></param>
|
||||
public IobSiemensComur(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
taskOk = false;
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY
|
||||
switch (tName)
|
||||
{
|
||||
case taskType.nihil:
|
||||
case taskType.fixStopSetup:
|
||||
case taskType.forceResetPzCount:
|
||||
case taskType.forceSetPzCount:
|
||||
case taskType.setProg:
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
break;
|
||||
case taskType.setArt:
|
||||
case taskType.setComm:
|
||||
case taskType.setPzComm:
|
||||
saveProdData(item);
|
||||
int byteSize = 0;
|
||||
// recupero dati da memMap... altrimenti NULLA
|
||||
if (memMap.mMapWrite.ContainsKey(item.Key))
|
||||
{
|
||||
dataConf currMem = memMap.mMapWrite[item.Key];
|
||||
byteSize = currMem.size;
|
||||
memAddrWrite = currMem.memAddr;
|
||||
MemBlock = new byte[byteSize];
|
||||
if (currMem.tipoMem == plcDataType.String)
|
||||
{
|
||||
saveStringOnMemBlock(ref MemBlock, item.Key, 0, byteSize);
|
||||
}
|
||||
else if (currMem.tipoMem == plcDataType.DInt)
|
||||
{
|
||||
int valDInt = 0;
|
||||
int.TryParse(item.Value, out valDInt);
|
||||
MemBlock = S7.Net.Types.DInt.ToByteArray(valDInt);
|
||||
}
|
||||
else if (currMem.tipoMem == plcDataType.Int)
|
||||
{
|
||||
short valDInt = 0;
|
||||
short.TryParse(item.Value, out valDInt);
|
||||
MemBlock = S7.Net.Types.Int.ToByteArray(valDInt);
|
||||
}
|
||||
}
|
||||
taskVal = item.Value;
|
||||
break;
|
||||
case taskType.startSetup:
|
||||
// processo scrittura BIT su DB150.DBX4.0
|
||||
MemBlock = new byte[1];
|
||||
MemBlock[0] = (byte)1;
|
||||
memAddrWrite = "DB150.DBB4";
|
||||
break;
|
||||
case taskType.stopSetup:
|
||||
// processo scrittura BIT su DB150.DBX4.0
|
||||
MemBlock = new byte[1];
|
||||
MemBlock[0] = (byte)0;
|
||||
memAddrWrite = "DB150.DBB4";
|
||||
break;
|
||||
case taskType.setParameter:
|
||||
// richiedo da URL i parametri WRITE da popolare
|
||||
lgInfo("Chiamata processMemWriteRequests");
|
||||
taskVal = processMemWriteRequests();
|
||||
// se restituiscce "" faccio altra prova...
|
||||
if (string.IsNullOrEmpty(taskVal))
|
||||
{
|
||||
// i parametri me li aspetto come stringa composta paramName|paramvalue
|
||||
if (item.Value.Contains("|"))
|
||||
{
|
||||
string[] paramsJob = item.Value.Split('|');
|
||||
taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}";
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value";
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
taskVal = "SKIPPED | NO EXEC";
|
||||
break;
|
||||
}
|
||||
// aggiungo task!
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
if (string.IsNullOrEmpty(memAddrWrite))
|
||||
{
|
||||
// scrivo comunque!
|
||||
taskOk = S7WriteBB(ref MemBlock, memAddrWrite);
|
||||
}
|
||||
if (!taskOk)
|
||||
{
|
||||
lgError($"Errore in S7WriteBB durante executeTasks: {item.Key} | {item.Value}");
|
||||
}
|
||||
lgInfo("NEW IOB SIEMENS versione COMUR");
|
||||
}
|
||||
}
|
||||
return taskDone;
|
||||
|
||||
#region Metodi specifici (da verificare/completare in implementazione)
|
||||
|
||||
/// <summary>
|
||||
/// Processo i task richiesti e li elimino dalla coda 1:1
|
||||
/// </summary>
|
||||
/// <param name="task2exe"></param>
|
||||
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
{
|
||||
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
bool taskOk = false;
|
||||
string taskVal = "";
|
||||
// inizio con 1 byte di default
|
||||
byte[] MemBlock = new byte[1];
|
||||
string memAddrWrite = "";
|
||||
if (task2exe != null)
|
||||
{
|
||||
// cerco task specifici
|
||||
foreach (var item in task2exe)
|
||||
{
|
||||
taskOk = false;
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY
|
||||
switch (tName)
|
||||
{
|
||||
case taskType.nihil:
|
||||
case taskType.fixStopSetup:
|
||||
case taskType.forceResetPzCount:
|
||||
case taskType.forceSetPzCount:
|
||||
case taskType.setProg:
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
break;
|
||||
case taskType.setArt:
|
||||
case taskType.setComm:
|
||||
case taskType.setPzComm:
|
||||
saveProdData(item);
|
||||
int byteSize = 0;
|
||||
// recupero dati da memMap... altrimenti NULLA
|
||||
if (memMap.mMapWrite.ContainsKey(item.Key))
|
||||
{
|
||||
dataConf currMem = memMap.mMapWrite[item.Key];
|
||||
byteSize = currMem.size;
|
||||
memAddrWrite = currMem.memAddr;
|
||||
MemBlock = new byte[byteSize];
|
||||
if (currMem.tipoMem == plcDataType.String)
|
||||
{
|
||||
saveStringOnMemBlock(ref MemBlock, item.Key, 0, byteSize);
|
||||
}
|
||||
else if (currMem.tipoMem == plcDataType.DInt)
|
||||
{
|
||||
int valDInt = 0;
|
||||
int.TryParse(item.Value, out valDInt);
|
||||
MemBlock = S7.Net.Types.DInt.ToByteArray(valDInt);
|
||||
}
|
||||
else if (currMem.tipoMem == plcDataType.Int)
|
||||
{
|
||||
short valDInt = 0;
|
||||
short.TryParse(item.Value, out valDInt);
|
||||
MemBlock = S7.Net.Types.Int.ToByteArray(valDInt);
|
||||
}
|
||||
}
|
||||
taskVal = item.Value;
|
||||
break;
|
||||
case taskType.startSetup:
|
||||
// processo scrittura BIT su DB150.DBX4.0
|
||||
MemBlock = new byte[1];
|
||||
MemBlock[0] = (byte)1;
|
||||
memAddrWrite = "DB150.DBB4";
|
||||
break;
|
||||
case taskType.stopSetup:
|
||||
// processo scrittura BIT su DB150.DBX4.0
|
||||
MemBlock = new byte[1];
|
||||
MemBlock[0] = (byte)0;
|
||||
memAddrWrite = "DB150.DBB4";
|
||||
break;
|
||||
case taskType.setParameter:
|
||||
// richiedo da URL i parametri WRITE da popolare
|
||||
lgInfo("Chiamata processMemWriteRequests");
|
||||
taskVal = processMemWriteRequests();
|
||||
// se restituiscce "" faccio altra prova...
|
||||
if (string.IsNullOrEmpty(taskVal))
|
||||
{
|
||||
// i parametri me li aspetto come stringa composta paramName|paramvalue
|
||||
if (item.Value.Contains("|"))
|
||||
{
|
||||
string[] paramsJob = item.Value.Split('|');
|
||||
taskVal = $"REQUEST SET PARAMETERS: {paramsJob[0]} --> {paramsJob[1]}";
|
||||
}
|
||||
else
|
||||
{
|
||||
taskVal = $"WRONG REQUEST FOR SET PARAMETERS: {item.Value} doesnt contain pipe for splitting key/value";
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
taskVal = "SKIPPED | NO EXEC";
|
||||
break;
|
||||
}
|
||||
// aggiungo task!
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
if (string.IsNullOrEmpty(memAddrWrite))
|
||||
{
|
||||
// scrivo comunque!
|
||||
taskOk = S7WriteBB(ref MemBlock, memAddrWrite);
|
||||
}
|
||||
if (!taskOk)
|
||||
{
|
||||
lgError($"Errore in S7WriteBB durante executeTasks: {item.Key} | {item.Value}");
|
||||
}
|
||||
}
|
||||
}
|
||||
return taskDone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
|
||||
/// </summary>
|
||||
protected override void decodeToBaseBitmap()
|
||||
{
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
|
||||
/* -----------------------------------------------------
|
||||
* bitmap MAPO STANDARD
|
||||
* B0: POWER_ON
|
||||
* B1: RUN
|
||||
* B2: pzCount
|
||||
* B3: allarme
|
||||
* B4: manuale
|
||||
* B5: allarme creatore
|
||||
*
|
||||
*
|
||||
* - BIT di stato
|
||||
* - DBX0.0 - Macchina On: Segnale pulito di informazione sullo stato della macchina. 0->Aux OFF, 1->Aux ON
|
||||
* - DBX0.1 – Macchina in Allarme: Segnale pulito di macchina in allarme. 0->Nessun Allarme, 1->E’ presente almeno un allarme/anomalia
|
||||
* - DBX0.2 – Macchina in Ciclo: Segnale pulito sullo stato di funzionamento. 0->La macchina NON sta eseguendo un ciclo automatico, 1->La macchina sta eseguendo un ciclo automatico.
|
||||
* - DBX0.3 – Macchina Non in Produzione: Segnale pulito sullo stato della macchina. 0->Macchina accesa e in lavorazione automatica, 1->Macchina accesa ma NON sta eseguendo un ciclo automatico.
|
||||
* - DBX0.4 – Macchina In Ciclo Continuità: Segnale pulito sullo stato di funzionamento. 1->La macchina sta eseguendo un ciclo automatico con carico/scarico pezzo autonomo, 0-> Altrimenti. NON HA SENSO perché NON HANNO il robot...
|
||||
* - DBX0.7 – Assi In Moto: Segnale pulito sullo stato di movimento Assi. 0->Tutti gli assi della macchina sono fermi, 1->Almeno un asse si sta muovendo.
|
||||
* - DBX1.0 – Impulso Start Ciclo: Impulso a fronte positivo (0->1) della durata di 1’’ che rappresenta l’evento di Start Ciclo.
|
||||
* - DBX1.1 – Impulso Fine Ciclo: Impulso a fronte positivo (0->1) della durata di 1’’ che rappresenta l’evento di Fine Ciclo. Attenzione! Questo impulso viene generato solo se il Ciclo Automatico finisce correttamente. Non viene generato nel caso in cui il Ciclo Automatico venga interrotto da allarmi.
|
||||
* - DBX1.3 – Impulso Conta Pezzi: Impulso a fronte positivo (0->1) della durata di 1’’ generato al completamento di ogni programma pezzo.
|
||||
* - DBX2.0 – Preallarmi Pezzi: Segnale pulito di segnalazione Preallarme Pezzi impostabile su CN. 0->Preallarme Disattivo, 1->Preallarme Attivo
|
||||
* - DBX2.1 – Allarme Pezzi: Segnale pulito di segnalazione Allarme Pezzi impostabile su CN. 0->Allarme Disattivo, 1->Allarme Attivo.
|
||||
* - DBX2.3 – Fine Vita Utensile: Segnale pulito di segnalazione Allarme Fine Vita Creatore. 0->Allarme Disattivo, 1->Allarme Attivo.
|
||||
* - DBX2.7 – Ciclo In Attesa: Segnale pulito sullo stato di funzionamento. 1->Ciclo Automatico attivo ma tutti assi fermi, 0->Altrimenti.
|
||||
*
|
||||
----------------------------------------------------- */
|
||||
|
||||
byte mainData = RawInput[0];
|
||||
|
||||
int byteSignals = 0;
|
||||
// bit 0 (poweron) imposto a 1 SE connected...
|
||||
if (currPLC.IsConnected)
|
||||
{
|
||||
byteSignals += (1 << 0);
|
||||
}
|
||||
if ((mainData & (1 << 2)) != 0)
|
||||
{
|
||||
byteSignals += (1 << 1);
|
||||
}
|
||||
|
||||
// controllo il bit MAIN dello status
|
||||
if ((mainData & (1 << 1)) != 0)
|
||||
{
|
||||
byteSignals += (1 << 3);
|
||||
}
|
||||
|
||||
// considero come MANUALE NON ciclo in continuo...
|
||||
if ((mainData & (1 << 3)) != 0)
|
||||
{
|
||||
byteSignals += (1 << 4);
|
||||
}
|
||||
|
||||
// salvo!
|
||||
B_input = byteSignals;
|
||||
|
||||
// log opzionale!
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo($"Trasformazione dati: RawInput:{RawInput[0]} --> B_input: {B_input}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
|
||||
/// </summary>
|
||||
protected override void decodeToBaseBitmap()
|
||||
{
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
|
||||
/* -----------------------------------------------------
|
||||
* bitmap MAPO STANDARD
|
||||
* B0: POWER_ON
|
||||
* B1: RUN
|
||||
* B2: pzCount
|
||||
* B3: allarme
|
||||
* B4: manuale
|
||||
*
|
||||
*
|
||||
* - BIT di stato
|
||||
* - DBX0.0 - Macchina On: Segnale pulito di informazione sullo stato della macchina. 0->Aux OFF, 1->Aux ON
|
||||
* - DBX0.1 – Macchina in Allarme: Segnale pulito di macchina in allarme. 0->Nessun Allarme, 1->E’ presente almeno un allarme/anomalia
|
||||
* - DBX0.2 – Macchina in Ciclo: Segnale pulito sullo stato di funzionamento. 0->La macchina NON sta eseguendo un ciclo automatico, 1->La macchina sta eseguendo un ciclo automatico.
|
||||
* - DBX0.3 – Macchina Non in Produzione: Segnale pulito sullo stato della macchina. 0->Macchina accesa e in lavorazione automatica, 1->Macchina accesa ma NON sta eseguendo un ciclo automatico.
|
||||
* - DBX0.4 – Macchina In Ciclo Continuità: Segnale pulito sullo stato di funzionamento. 1->La macchina sta eseguendo un ciclo automatico con carico/scarico pezzo autonomo, 0->Altrimenti.
|
||||
*
|
||||
----------------------------------------------------- */
|
||||
|
||||
byte mainData = RawInput[0];
|
||||
|
||||
int byteSignals = 0;
|
||||
// bit 0 (poweron) imposto a 1 SE connected...
|
||||
if (currPLC.IsConnected)
|
||||
{
|
||||
byteSignals += (1 << 0);
|
||||
}
|
||||
if ((mainData & (1 << 2)) == 1)
|
||||
{
|
||||
byteSignals += (1 << 1);
|
||||
}
|
||||
|
||||
// controllo il bit MAIN dello status
|
||||
if ((mainData & (1 << 1)) == 1)
|
||||
{
|
||||
byteSignals += (1 << 3);
|
||||
}
|
||||
|
||||
// considero come MANUALE NON ciclo in continuo...
|
||||
if ((mainData & (1 << 4)) == 0 || (mainData & (1 << 3)) == 1)
|
||||
{
|
||||
byteSignals += (1 << 4);
|
||||
}
|
||||
|
||||
// salvo!
|
||||
B_input = byteSignals;
|
||||
|
||||
// log opzionale!
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo($"Trasformazione dati: RawInput:{RawInput[0]} --> B_input: {B_input}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
+321
-449
@@ -6,275 +6,277 @@ using System.Linq;
|
||||
|
||||
namespace IOB_WIN
|
||||
{
|
||||
public class IobSiemensTorri : IobSiemens
|
||||
{
|
||||
/* --------------------------------------------------------------------------------
|
||||
* Controlli SIEMENS TORRI
|
||||
* - basasto su SIEMENS
|
||||
* - S7 vers 1200
|
||||
*
|
||||
* mod: 2019.01.19: aggiunta gestione segnale test/accensione/spegnimento (DB700.B1.4) --> mod StateMachine!
|
||||
* mod: 2019.04.06: aggiunta indicazione (IOB--> PLC) di stato setup su DB701.B0.4
|
||||
* -------------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// estende l'init della classe base con i metodi x Siemens specifici x Torri
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="adpConf"></param>
|
||||
public IobSiemensTorri(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
public class IobSiemensTorri : IobSiemens
|
||||
{
|
||||
// dovebbe fare init della classe base, VERIFICARE...
|
||||
lgInfo("NEW IOB SIEMENS versione TORRI");
|
||||
}
|
||||
/// <summary>
|
||||
/// Processo i task richiesti e li elimino dalla coda 1:1
|
||||
/// </summary>
|
||||
/// <param name="task2exe"></param>
|
||||
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
{
|
||||
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
bool taskOk = false;
|
||||
string taskVal = "";
|
||||
// inizio con 1 byte VUOTO
|
||||
byte[] MemBlock = new byte[1];
|
||||
/* --------------------------------------------------------------------------------
|
||||
* Controlli SIEMENS TORRI
|
||||
* - basasto su SIEMENS
|
||||
* - S7 vers 1200
|
||||
*
|
||||
* mod: 2019.01.19: aggiunta gestione segnale test/accensione/spegnimento (DB700.B1.4) --> mod StateMachine!
|
||||
* mod: 2019.04.06: aggiunta indicazione (IOB--> PLC) di stato setup su DB701.B0.4
|
||||
* -------------------------------------------------------------------------------- */
|
||||
|
||||
// cerco task specifici: se ho startSetup --> imposto bit DBB701.DBB0.4
|
||||
foreach (var item in task2exe)
|
||||
{
|
||||
taskOk = false;
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY
|
||||
switch (tName)
|
||||
|
||||
/// <summary>
|
||||
/// estende l'init della classe base con i metodi x Siemens specifici x Torri
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="adpConf"></param>
|
||||
public IobSiemensTorri(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
case taskType.nihil:
|
||||
case taskType.forceResetPzCount:
|
||||
case taskType.forceSetPzCount:
|
||||
case taskType.setArt:
|
||||
case taskType.setComm:
|
||||
case taskType.setProg:
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
lgInfo($"Chiamata senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
case taskType.fixStopSetup:
|
||||
taskVal = "VALUE DB701.0.4 --> 0";
|
||||
lgInfo($"Chiamata fixStopSetup: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
case taskType.startSetup:
|
||||
MemBlock[0] += (1 << 4);
|
||||
taskVal = "VALUE DB701.0.4 --> 1";
|
||||
lgInfo($"Chiamata startSetup: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
case taskType.stopSetup:
|
||||
taskVal = "VALUE DB701.0.4 --> 0";
|
||||
lgInfo($"Chiamata stopSetup: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
default:
|
||||
taskVal = "SKIPPED | NO EXEC";
|
||||
lgInfo($"Chiamata default senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
// dovebbe fare init della classe base, VERIFICARE...
|
||||
lgInfo("NEW IOB SIEMENS versione TORRI");
|
||||
}
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
}
|
||||
// scrivo comunque!
|
||||
bool fatto = S7WriteBB(ref MemBlock);
|
||||
return taskDone;
|
||||
}
|
||||
|
||||
#region da verificare
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati override in formato dictionary
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getOverrides()
|
||||
{
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
uint valDW = 0;
|
||||
// !!!FARE!!! recuperare da conf memoria, ora HARD CODED
|
||||
outVal.Add("FEED_OVER", RawInput[19].ToString());
|
||||
outVal.Add("RAPID_OVER", RawInput[20].ToString());
|
||||
outVal.Add("CURR_MODE", decodeCurrMode(RawInput[21]));
|
||||
// recupero RPM pezzo/mola !!!FARE!!! cambio nome da config, qui sono 01:conduttrice e 02:operatrice (3013), mentre sono pezzo/mola nella V100
|
||||
valDW = S7.Net.Types.DWord.FromByteArray(RawInput.Skip(24).Take(4).ToArray());
|
||||
outVal.Add("RPM_01", valDW.ToString());
|
||||
valDW = S7.Net.Types.DWord.FromByteArray(RawInput.Skip(28).Take(4).ToArray());
|
||||
outVal.Add("RPM_02", valDW.ToString());
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decodifica il resto dell'area TORRI x i dati accessori (allarmi, ...)
|
||||
/// </summary>
|
||||
protected override void decodeOtherData()
|
||||
{
|
||||
if (verboseLog)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
|
||||
/// </summary>
|
||||
protected override void decodeToBaseBitmap()
|
||||
{
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
// TORRI: leggo i primi 8 bit hard coded...
|
||||
int byteSem = RawInput[0];
|
||||
|
||||
// azzero powerOn...
|
||||
byteSem &= ~(1 << 0);
|
||||
// bit 0 (powerOn) imposto a 1 SE connected...
|
||||
if (currPLC.IsConnected)
|
||||
{
|
||||
byteSem += (1 << 0);
|
||||
}
|
||||
|
||||
// azzero i bit NON gestiti (2-5-6-7)
|
||||
byteSem &= ~(1 << 2);
|
||||
byteSem &= ~(1 << 5);
|
||||
byteSem &= ~(1 << 6);
|
||||
byteSem &= ~(1 << 7);
|
||||
// leggo bit DB700.B1.4 e lo porto al bit 5 --> ciclo test/accensione/spegnimento
|
||||
if ((RawInput[1] & (1 << 4)) != 0) //se RawInput[1] & 16-- > 5° bit-- > TEST
|
||||
{
|
||||
byteSem += (1 << 5);
|
||||
}
|
||||
// salvo infine variabile bit x invio
|
||||
B_input = byteSem;
|
||||
|
||||
|
||||
string currODL = "";
|
||||
try
|
||||
{
|
||||
currODL = utils.callUrl(urlGetCurrODL);
|
||||
// solo SE HO un ODL...
|
||||
if (string.IsNullOrEmpty(currODL) || currODL == "0")
|
||||
/// <summary>
|
||||
/// Processo i task richiesti e li elimino dalla coda 1:1
|
||||
/// </summary>
|
||||
/// <param name="task2exe"></param>
|
||||
public override Dictionary<string, string> executeTasks(Dictionary<string, string> task2exe)
|
||||
{
|
||||
if (periodicLog)
|
||||
{
|
||||
lgInfo($"SiemensTorri | Lettura ODL andata a vuoto: currODL: {currODL}");
|
||||
}
|
||||
// Verificare il protocollo: dovrebeb togliere SOLO i task eseguiti...
|
||||
Dictionary<string, string> taskDone = new Dictionary<string, string>();
|
||||
bool taskOk = false;
|
||||
string taskVal = "";
|
||||
// inizio con 1 byte VUOTO
|
||||
byte[] MemBlock = new byte[1];
|
||||
if (task2exe != null)
|
||||
{
|
||||
// cerco task specifici: se ho startSetup --> imposto bit DBB701.DBB0.4
|
||||
foreach (var item in task2exe)
|
||||
{
|
||||
taskOk = false;
|
||||
taskVal = "";
|
||||
// converto richiesta in enum...
|
||||
taskType tName = taskType.nihil;
|
||||
Enum.TryParse(item.Key, out tName);
|
||||
// controllo sulla KEY
|
||||
switch (tName)
|
||||
{
|
||||
case taskType.nihil:
|
||||
case taskType.forceResetPzCount:
|
||||
case taskType.forceSetPzCount:
|
||||
case taskType.setArt:
|
||||
case taskType.setComm:
|
||||
case taskType.setProg:
|
||||
case taskType.sendWatchDogMes2Plc:
|
||||
taskVal = $"taskReq: {tName} | key: {item.Key} | val: {item.Value} | SKIPPED | NO EXEC";
|
||||
lgInfo($"Chiamata senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
case taskType.fixStopSetup:
|
||||
taskVal = "VALUE DB701.0.4 --> 0";
|
||||
lgInfo($"Chiamata fixStopSetup: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
case taskType.startSetup:
|
||||
MemBlock[0] += (1 << 4);
|
||||
taskVal = "VALUE DB701.0.4 --> 1";
|
||||
lgInfo($"Chiamata startSetup: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
case taskType.stopSetup:
|
||||
taskVal = "VALUE DB701.0.4 --> 0";
|
||||
lgInfo($"Chiamata stopSetup: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
default:
|
||||
taskVal = "SKIPPED | NO EXEC";
|
||||
lgInfo($"Chiamata default senza processing: taskOk: {taskOk} | taskVal: {taskVal}");
|
||||
break;
|
||||
}
|
||||
taskDone.Add(item.Key, taskVal);
|
||||
}
|
||||
// scrivo comunque!
|
||||
bool fatto = S7WriteBB(ref MemBlock);
|
||||
}
|
||||
return taskDone;
|
||||
}
|
||||
else
|
||||
|
||||
#region da verificare
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati override in formato dictionary
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getOverrides()
|
||||
{
|
||||
// se variato o scaduto timeout log...
|
||||
if (periodicLog || (currIdxODL.ToString() != currODL))
|
||||
{
|
||||
lgInfo($"SiemensTorri | Lettura ODL, currODL: {currODL} --> currIdxODL prec: {currIdxODL}");
|
||||
}
|
||||
// provo a salvare nuovo ODL
|
||||
int.TryParse(currODL, out currIdxODL);
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
uint valDW = 0;
|
||||
// !!!FARE!!! recuperare da conf memoria, ora HARD CODED
|
||||
outVal.Add("FEED_OVER", RawInput[19].ToString());
|
||||
outVal.Add("RAPID_OVER", RawInput[20].ToString());
|
||||
outVal.Add("CURR_MODE", decodeCurrMode(RawInput[21]));
|
||||
// recupero RPM pezzo/mola !!!FARE!!! cambio nome da config, qui sono 01:conduttrice e 02:operatrice (3013), mentre sono pezzo/mola nella V100
|
||||
valDW = S7.Net.Types.DWord.FromByteArray(RawInput.Skip(24).Take(4).ToArray());
|
||||
outVal.Add("RPM_01", valDW.ToString());
|
||||
valDW = S7.Net.Types.DWord.FromByteArray(RawInput.Skip(28).Take(4).ToArray());
|
||||
outVal.Add("RPM_02", valDW.ToString());
|
||||
return outVal;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
|
||||
|
||||
/// <summary>
|
||||
/// Decodifica il resto dell'area TORRI x i dati accessori (allarmi, ...)
|
||||
/// </summary>
|
||||
protected override void decodeOtherData()
|
||||
{
|
||||
lgError(exc, $"Errore in fase di chiamata URL x ODL corrente | URL chiamato: {urlGetCurrODL}");
|
||||
lastWarnODL = DateTime.Now;
|
||||
if (verboseLog)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(currODL) && currODL != "0")
|
||||
{
|
||||
// ora processo il contapezzi...
|
||||
string retVal = "";
|
||||
// controllo se è passato intervallo minimo tra 2 controlli/elaborazioni x distanziare invio e ridurre letture
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
|
||||
/// <summary>
|
||||
/// Effettua decodifica aree memoria alla bitmap usata x MAPO
|
||||
/// </summary>
|
||||
protected override void decodeToBaseBitmap()
|
||||
{
|
||||
// Salvo il contapezzi della macchina
|
||||
retVal = utils.callUrlNow(urlSetPzCountMAC + lastCountCNC.ToString());
|
||||
// verifica se tutto OK, ovvero conferma i pezzi inviati
|
||||
if (retVal != lastCountCNC.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi PLC SIEMENST-TORRI: {lastCountCNC} | Contapezzi interno IOB {contapezzi} | Valore tornato: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
// TORRI: leggo i primi 8 bit hard coded...
|
||||
int byteSem = RawInput[0];
|
||||
|
||||
// se sono differenti MOSTRO...
|
||||
if (lastCountCNC != contapezzi)
|
||||
{
|
||||
// registro contapezzi
|
||||
lgInfo($"Differenza Contapezzi: CNC READ: {lastCountCNC} | Interno IOB {contapezzi}");
|
||||
}
|
||||
if ((lastCountCNC > contapezzi))
|
||||
{
|
||||
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
|
||||
contapezzi++;
|
||||
needRefreshPzCount = true;
|
||||
// salvo in semaforo!
|
||||
B_input += 1 << 2;
|
||||
// registro contapezzi
|
||||
lgInfo($"Contapezzi SIEMENST-TORRI: {lastCountCNC} | Contapezzi interno IOB {contapezzi}");
|
||||
}
|
||||
// azzero powerOn...
|
||||
byteSem &= ~(1 << 0);
|
||||
// bit 0 (powerOn) imposto a 1 SE connected...
|
||||
if (currPLC.IsConnected)
|
||||
{
|
||||
byteSem += (1 << 0);
|
||||
}
|
||||
|
||||
// Salvo il contapezzi della macchina
|
||||
retVal = utils.callUrlNow(urlSetPzCount + contapezzi.ToString());
|
||||
// verifica se tutto OK, ovvero conferma i pezzi inviati
|
||||
if (retVal != contapezzi.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi PLC SIEMENST-TORRI: {lastCountCNC} | Contapezzi interno IOB {contapezzi} | Valore tornato: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
// azzero i bit NON gestiti (2-5-6-7)
|
||||
byteSem &= ~(1 << 2);
|
||||
byteSem &= ~(1 << 5);
|
||||
byteSem &= ~(1 << 6);
|
||||
byteSem &= ~(1 << 7);
|
||||
// leggo bit DB700.B1.4 e lo porto al bit 5 --> ciclo test/accensione/spegnimento
|
||||
if ((RawInput[1] & (1 << 4)) != 0) //se RawInput[1] & 16-- > 5° bit-- > TEST
|
||||
{
|
||||
byteSem += (1 << 5);
|
||||
}
|
||||
// salvo infine variabile bit x invio
|
||||
B_input = byteSem;
|
||||
|
||||
// verifico se variato contapezzi... e se passato ritardo minimo...
|
||||
if ((lastCountCNC - contapezzi) > minSendPzCountBlock)
|
||||
{
|
||||
trySendPzCountBlock();
|
||||
}
|
||||
|
||||
// invio a server contapezzi (aggiornato)
|
||||
retVal = utils.callUrlNow(urlSetPzCount + contapezzi.ToString());
|
||||
// verifica se tutto OK
|
||||
if (retVal != contapezzi.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi SIEMENS-TORRI: lastCountCNC {lastCountCNC} | contapezzi {contapezzi} | risposta: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
string currODL = "";
|
||||
try
|
||||
{
|
||||
currODL = utils.callUrl(urlGetCurrODL);
|
||||
// solo SE HO un ODL...
|
||||
if (string.IsNullOrEmpty(currODL) || currODL == "0")
|
||||
{
|
||||
if (periodicLog)
|
||||
{
|
||||
lgInfo($"SiemensTorri | Lettura ODL andata a vuoto: currODL: {currODL}");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// se variato o scaduto timeout log...
|
||||
if (periodicLog || (currIdxODL.ToString() != currODL))
|
||||
{
|
||||
lgInfo($"SiemensTorri | Lettura ODL, currODL: {currODL} --> currIdxODL prec: {currIdxODL}");
|
||||
}
|
||||
// provo a salvare nuovo ODL
|
||||
int.TryParse(currODL, out currIdxODL);
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
|
||||
{
|
||||
lgError(exc, $"Errore in fase di chiamata URL x ODL corrente | URL chiamato: {urlGetCurrODL}");
|
||||
lastWarnODL = DateTime.Now;
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(currODL) && currODL != "0")
|
||||
{
|
||||
// ora processo il contapezzi...
|
||||
string retVal = "";
|
||||
// controllo se è passato intervallo minimo tra 2 controlli/elaborazioni x distanziare invio e ridurre letture
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
// Salvo il contapezzi della macchina
|
||||
retVal = utils.callUrlNow(urlSetPzCountMAC + lastCountCNC.ToString());
|
||||
// verifica se tutto OK, ovvero conferma i pezzi inviati
|
||||
if (retVal != lastCountCNC.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi PLC SIEMENST-TORRI: {lastCountCNC} | Contapezzi interno IOB {contapezzi} | Valore tornato: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
// se sono differenti MOSTRO...
|
||||
if (lastCountCNC != contapezzi)
|
||||
{
|
||||
// registro contapezzi
|
||||
lgInfo($"Differenza Contapezzi: CNC READ: {lastCountCNC} | Interno IOB {contapezzi}");
|
||||
}
|
||||
if ((lastCountCNC > contapezzi))
|
||||
{
|
||||
// salvo nuovo contapezzi (incremento di 1...) + richiesta refresh conteggio
|
||||
contapezzi++;
|
||||
needRefreshPzCount = true;
|
||||
// salvo in semaforo!
|
||||
B_input += 1 << 2;
|
||||
// registro contapezzi
|
||||
lgInfo($"Contapezzi SIEMENST-TORRI: {lastCountCNC} | Contapezzi interno IOB {contapezzi}");
|
||||
}
|
||||
|
||||
// Salvo il contapezzi della macchina
|
||||
retVal = utils.callUrlNow(urlSetPzCount + contapezzi.ToString());
|
||||
// verifica se tutto OK, ovvero conferma i pezzi inviati
|
||||
if (retVal != contapezzi.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi PLC SIEMENST-TORRI: {lastCountCNC} | Contapezzi interno IOB {contapezzi} | Valore tornato: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
|
||||
// verifico se variato contapezzi... e se passato ritardo minimo...
|
||||
if ((lastCountCNC - contapezzi) > minSendPzCountBlock)
|
||||
{
|
||||
trySendPzCountBlock();
|
||||
}
|
||||
|
||||
// invio a server contapezzi (aggiornato)
|
||||
retVal = utils.callUrlNow(urlSetPzCount + contapezzi.ToString());
|
||||
// verifica se tutto OK
|
||||
if (retVal != contapezzi.ToString())
|
||||
{
|
||||
// errore salvataggio contapezzi
|
||||
lgInfo($"Errore salvataggio Contapezzi SIEMENS-TORRI: lastCountCNC {lastCountCNC} | contapezzi {contapezzi} | risposta: {retVal}");
|
||||
// rileggo il counter pezzi da server
|
||||
pzCntReload(true);
|
||||
}
|
||||
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
{
|
||||
lgInfo($"Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi SIEMENST-TORRI: {lastCountCNC} | Contapezzi interno {contapezzi}");
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
// log opzionale!
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo("Trasformazione B_input: {B_input}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recupero programma in lavorazione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string getPrgName()
|
||||
{
|
||||
lgInfo($"Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi SIEMENST-TORRI: {lastCountCNC} | Contapezzi interno {contapezzi}");
|
||||
// resetto timer...
|
||||
lastPzCountSend = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
// log opzionale!
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo("Trasformazione B_input: {B_input}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Recupero programma in lavorazione
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override string getPrgName()
|
||||
{
|
||||
string prgName = "";
|
||||
string prgName = "";
|
||||
#if false
|
||||
// recupero NUOVO prgName...
|
||||
try
|
||||
@@ -289,38 +291,38 @@ namespace IOB_WIN
|
||||
lgError(string.Format("Eccezione in recupero PRG NAME MAIN:{0}{1}", Environment.NewLine, exc));
|
||||
}
|
||||
#endif
|
||||
return prgName;
|
||||
}
|
||||
return prgName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero programma in lavorazione come Dictionary FANUC...
|
||||
/// - SYSINFO: (prima KEY globale) TUTTI i valori separati da # (x fare check modifica)
|
||||
/// - altre stringhe: ogni singolo parametro / valore
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getSysInfo()
|
||||
{
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
outVal.Add("CPU", currPLC.CPU.ToString());
|
||||
outVal.Add("MAX_PDU", currPLC.MaxPDUSize.ToString());
|
||||
outVal.Add("RACK", currPLC.Rack.ToString());
|
||||
outVal.Add("SLOT", currPLC.Slot.ToString());
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in getSysInfo");
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
/// <summary>
|
||||
/// Esegue processing MODE (e nel contempo recupera altri dati dell'area G)
|
||||
/// </summary>
|
||||
public override void processMode()
|
||||
{
|
||||
if (utils.CRB("enableMode"))
|
||||
{
|
||||
/// <summary>
|
||||
/// Recupero programma in lavorazione come Dictionary FANUC...
|
||||
/// - SYSINFO: (prima KEY globale) TUTTI i valori separati da # (x fare check modifica)
|
||||
/// - altre stringhe: ogni singolo parametro / valore
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getSysInfo()
|
||||
{
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
outVal.Add("CPU", currPLC.CPU.ToString());
|
||||
outVal.Add("MAX_PDU", currPLC.MaxPDUSize.ToString());
|
||||
outVal.Add("RACK", currPLC.Rack.ToString());
|
||||
outVal.Add("SLOT", currPLC.Slot.ToString());
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in getSysInfo");
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
/// <summary>
|
||||
/// Esegue processing MODE (e nel contempo recupera altri dati dell'area G)
|
||||
/// </summary>
|
||||
public override void processMode()
|
||||
{
|
||||
if (utils.CRB("enableMode"))
|
||||
{
|
||||
#if false
|
||||
try
|
||||
{
|
||||
@@ -348,15 +350,15 @@ namespace IOB_WIN
|
||||
lgError(exc, "Errore in process Mode G43");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati dinamici...
|
||||
/// </summary>
|
||||
public override Dictionary<string, string> getDynData()
|
||||
{
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
/// <summary>
|
||||
/// Recupero dati dinamici...
|
||||
/// </summary>
|
||||
public override Dictionary<string, string> getDynData()
|
||||
{
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
#if false
|
||||
inizio = DateTime.Now;
|
||||
CncLib.Focas1.ODBDY2_1 answ = FANUC_ref.getAllDynData();
|
||||
@@ -393,165 +395,35 @@ namespace IOB_WIN
|
||||
lgError(exc, "Errore in getDynData");
|
||||
}
|
||||
#endif
|
||||
return outVal;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera ULTIMO allarme...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getCncAlarms()
|
||||
{
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
string almMsg = string.Format("{0} | {1}", currPLC.LastErrorCode.ToString(), currPLC.LastErrorString);
|
||||
outVal.Add("CNC_ALARM", almMsg);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in getCncAlarms");
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupera ULTIMO allarme...
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getCncAlarms()
|
||||
{
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
string almMsg = string.Format("{0} | {1}", currPLC.LastErrorCode.ToString(), currPLC.LastErrorString);
|
||||
outVal.Add("CNC_ALARM", almMsg);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in getCncAlarms");
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override salvataggio valori in memoria...
|
||||
/// </summary>
|
||||
/// <param name="tipo">tipo di DUMP</param>
|
||||
public override void saveMemDump(dumpType tipo)
|
||||
{
|
||||
#if false
|
||||
dump_MemAreaD();
|
||||
dump_MemAreaY();
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Override salvataggio valori in memoria...
|
||||
/// </summary>
|
||||
/// <param name="tipo">tipo di DUMP</param>
|
||||
public override void saveMemDump(dumpType tipo)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Dump PERIODICO area D della memoria
|
||||
/// </summary>
|
||||
/// <param name="memIndex">area memoria di partenza</param>
|
||||
/// <param name="memSyzeByte"></param>
|
||||
private void dump_MemAreaD(int memIndex, int memSyzeByte)
|
||||
{
|
||||
// leggo TUTTI i 9999 byte della memoria D...
|
||||
byte[] MemBlockD = new byte[memSyzeByte];
|
||||
stopwatch.Restart();
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo("START MemDump AreaD");
|
||||
}
|
||||
#if false
|
||||
FanucMemRW(R, FANUC.MemType.D, memIndex, ref MemBlockD);
|
||||
if (verboseLog) lgInfo("END MemDump AreaD");
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-MemDumpD", MemBlockD.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
// file out!
|
||||
string nomeFile = "";
|
||||
Dictionary<string, string> mappaValori = new Dictionary<string, string>();
|
||||
// salvo in file i dati letti come DWord (4byte)
|
||||
nomeFile = string.Format(@"{0}\SAMPLES\MemDump_D_DW_{1:yyyyMMdd_HHmmss}.dat", utils.dataDatDir, DateTime.Now);
|
||||
for (int i = 0; i < MemBlockD.Length / 4; i++)
|
||||
{
|
||||
mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt32(MemBlockD, i * 4).ToString());
|
||||
}
|
||||
utils.WritePlain(mappaValori, nomeFile);
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// Dump area D della memoria
|
||||
/// </summary>
|
||||
private void dump_MemAreaD()
|
||||
{
|
||||
// faccio chaimate e salvo in file dump...
|
||||
int memIndex = 0;
|
||||
// leggo TUTTI i 9999 byte della memoria D...
|
||||
byte[] MemBlockD = new byte[9999];
|
||||
stopwatch.Restart();
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo("START MemDump AreaD");
|
||||
}
|
||||
#if false
|
||||
FanucMemRW(R, FANUC.MemType.D, memIndex, ref MemBlockD);
|
||||
if (verboseLog) lgInfo("END MemDump AreaD");
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-MemDumpD", MemBlockD.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
//
|
||||
string nomeFile = "";
|
||||
// salvo in file i dati letti come BYTE
|
||||
nomeFile = string.Format(@"{0}\MemDump_D_Byte.dat", utils.dataDatDir);
|
||||
Dictionary<string, string> mappaValori = new Dictionary<string, string>();
|
||||
for (int i = 0; i < MemBlockD.Length; i++)
|
||||
{
|
||||
mappaValori.Add(i.ToString("0000"), MemBlockD[i].ToString());
|
||||
}
|
||||
utils.WritePlain(mappaValori, nomeFile);
|
||||
|
||||
// salvo in file i dati letti come DWord (4byte)
|
||||
nomeFile = string.Format(@"{0}\MemDump_D_DW.dat", utils.dataDatDir);
|
||||
mappaValori = new Dictionary<string, string>();
|
||||
for (int i = 0; i < MemBlockD.Length / 4; i++)
|
||||
{
|
||||
mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt32(MemBlockD, i * 4).ToString());
|
||||
}
|
||||
utils.WritePlain(mappaValori, nomeFile);
|
||||
|
||||
// salvo in file i dati letti come DWord (4byte)
|
||||
nomeFile = string.Format(@"{0}\MemDump_D_W.dat", utils.dataDatDir);
|
||||
mappaValori = new Dictionary<string, string>();
|
||||
for (int i = 0; i < MemBlockD.Length / 2; i++)
|
||||
{
|
||||
mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt16(MemBlockD, i * 2).ToString());
|
||||
}
|
||||
utils.WritePlain(mappaValori, nomeFile);
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// Dump area Y della memoria
|
||||
/// </summary>
|
||||
private void dump_MemAreaY()
|
||||
{
|
||||
// faccio chaimate e salvo in file dump...
|
||||
int memIndex = 0;
|
||||
// leggo TUTTI i 9999 byte della memoria Y...
|
||||
byte[] MemBlockY = new byte[10];
|
||||
stopwatch.Restart();
|
||||
if (verboseLog)
|
||||
{
|
||||
lgInfo("START MemDump AreaY");
|
||||
}
|
||||
#if false
|
||||
FanucMemRW(R, FANUC.MemType.Y, memIndex, ref MemBlockY);
|
||||
if (verboseLog) lgInfo("END MemDump AreaY");
|
||||
if (utils.CRB("recTime")) TimingData.addResult(string.Format("R{0}-MemDumpY", MemBlockY.Length), DateTime.Now.Subtract(inizio).Ticks);
|
||||
//
|
||||
string nomeFile = "";
|
||||
// salvo in file i dati letti come BYTE
|
||||
nomeFile = string.Format(@"{0}\MemDump_Y_Byte.dat", utils.dataDatDir);
|
||||
Dictionary<string, string> mappaValori = new Dictionary<string, string>();
|
||||
for (int i = 0; i < MemBlockY.Length; i++)
|
||||
{
|
||||
mappaValori.Add(i.ToString("0000"), MemBlockY[i].ToString());
|
||||
}
|
||||
utils.WritePlain(mappaValori, nomeFile);
|
||||
|
||||
// salvo in file i dati letti come DWord (4byte)
|
||||
nomeFile = string.Format(@"{0}\MemDump_Y_DW.dat", utils.dataDatDir);
|
||||
mappaValori = new Dictionary<string, string>();
|
||||
for (int i = 0; i < MemBlockY.Length / 4; i++)
|
||||
{
|
||||
mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt32(MemBlockY, i * 4).ToString());
|
||||
}
|
||||
utils.WritePlain(mappaValori, nomeFile);
|
||||
|
||||
// salvo in file i dati letti come DWord (4byte)
|
||||
nomeFile = string.Format(@"{0}\MemDump_Y_W.dat", utils.dataDatDir);
|
||||
mappaValori = new Dictionary<string, string>();
|
||||
for (int i = 0; i < MemBlockY.Length / 2; i++)
|
||||
{
|
||||
mappaValori.Add(i.ToString("0000"), BitConverter.ToUInt16(MemBlockY, i * 2).ToString());
|
||||
}
|
||||
utils.WritePlain(mappaValori, nomeFile);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
+334
-324
@@ -14,345 +14,355 @@ using System.Windows.Forms;
|
||||
|
||||
namespace IOB_WIN
|
||||
{
|
||||
/// <summary>
|
||||
/// Generica classe per implementare WebPageScraping (scaricamento web pages anche js-based x recupero informazioni)
|
||||
/// </summary>
|
||||
public class IobWPS : IobGeneric
|
||||
{
|
||||
/* --------------------------------------------------------------------------------
|
||||
* Controlli dotati di GENERICA pagina WEB in cui cercare e recuperare informazioni
|
||||
*
|
||||
* - il file di conf deve contenere l'URL di base
|
||||
* - il file di conf deve contenere COSA cercare (es il "contenitore" del dato da estrarre)
|
||||
*
|
||||
* -------------------------------------------------------------------------------- */
|
||||
|
||||
/// <summary>
|
||||
/// Vettore della frequenza di ogni status trovato... invio ogni 100 rilevazioni (modulo 100, resto == 1)
|
||||
/// Generica classe per implementare WebPageScraping (scaricamento web pages anche js-based x recupero informazioni)
|
||||
/// </summary>
|
||||
protected Dictionary<string, int> freqUnknStatus = new Dictionary<string, int>();
|
||||
/// <summary>
|
||||
/// Pagina web da scaricare
|
||||
/// </summary>
|
||||
protected string baseUri = "http://127.0.0.1";
|
||||
/// <summary>
|
||||
/// Array di configurazione degli oggetti da cercare x decodifica e recupero info
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> dataLocatorLUT;
|
||||
/// <summary>
|
||||
/// Driver per gestione chiamate crawling/scraping
|
||||
/// </summary>
|
||||
protected IWebDriver driver;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetti decodificati da pagina
|
||||
/// </summary>
|
||||
protected MonitoredItemsConf monitoredItems;
|
||||
/// <summary>
|
||||
/// Elementi da recuperare nella apgina web
|
||||
/// </summary>
|
||||
protected IWebElement element;
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base...
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="adpConf"></param>
|
||||
public IobWPS(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
public class IobWPS : IobGeneric, IDisposable
|
||||
{
|
||||
lgInfo("INIT IobWPS");
|
||||
//reloadAdapterConf();
|
||||
}
|
||||
/// <summary>
|
||||
/// Ricarica conf adapter...
|
||||
/// </summary>
|
||||
private void reloadAdapterConf()
|
||||
{
|
||||
// init obj display
|
||||
newDisplayData currDispData = new newDisplayData();
|
||||
lgInfo("BEGIN reloadAdapterConf");
|
||||
// inizializzo LUT decodifica
|
||||
string jsonConf = getOptPar("LUT_CONF");
|
||||
if (!string.IsNullOrEmpty(jsonConf))
|
||||
{
|
||||
string jsonFullPath = $"{Application.StartupPath}/DATA/CONF/{jsonConf}";
|
||||
lgInfo($"Apertura file {jsonFullPath}");
|
||||
StreamReader reader = new StreamReader(jsonFullPath);
|
||||
string jsonData = reader.ReadToEnd();
|
||||
if (!string.IsNullOrEmpty(jsonData))
|
||||
/* --------------------------------------------------------------------------------
|
||||
* Controlli dotati di GENERICA pagina WEB in cui cercare e recuperare informazioni
|
||||
*
|
||||
* - il file di conf deve contenere l'URL di base
|
||||
* - il file di conf deve contenere COSA cercare (es il "contenitore" del dato da estrarre)
|
||||
*
|
||||
* -------------------------------------------------------------------------------- */
|
||||
|
||||
/// <summary>
|
||||
/// Vettore della frequenza di ogni status trovato... invio ogni 100 rilevazioni (modulo 100, resto == 1)
|
||||
/// </summary>
|
||||
protected Dictionary<string, int> freqUnknStatus = new Dictionary<string, int>();
|
||||
/// <summary>
|
||||
/// Pagina web da scaricare
|
||||
/// </summary>
|
||||
protected string baseUri = "http://127.0.0.1";
|
||||
/// <summary>
|
||||
/// Array di configurazione degli oggetti da cercare x decodifica e recupero info
|
||||
/// </summary>
|
||||
protected Dictionary<string, string> dataLocatorLUT;
|
||||
/// <summary>
|
||||
/// Driver per gestione chiamate crawling/scraping
|
||||
/// </summary>
|
||||
protected IWebDriver driver;
|
||||
|
||||
/// <summary>
|
||||
/// Oggetti decodificati da pagina
|
||||
/// </summary>
|
||||
protected MonitoredItemsConf monitoredItems;
|
||||
/// <summary>
|
||||
/// Elementi da recuperare nella apgina web
|
||||
/// </summary>
|
||||
protected IWebElement element;
|
||||
|
||||
/// <summary>
|
||||
/// Estende l'init della classe base...
|
||||
/// </summary>
|
||||
/// <param name="caller"></param>
|
||||
/// <param name="adpConf"></param>
|
||||
public IobWPS(AdapterForm caller, IobConfiguration IOBConf) : base(caller, IOBConf)
|
||||
{
|
||||
try
|
||||
{
|
||||
monitoredItems = JsonConvert.DeserializeObject<MonitoredItemsConf>(jsonData);
|
||||
// salvo baseUri
|
||||
baseUri = monitoredItems.SrvData.baseUri;
|
||||
lgInfo($"baseUri = {baseUri}");
|
||||
// imposto a zero la bitmap x riavvio!
|
||||
B_input = 0;
|
||||
// FORZO invio dati...
|
||||
accodaSigIN(ref currDispData);
|
||||
// loggo!
|
||||
lgInfo($"init input bitmap to zero: {B_input}");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in decodifica conf json");
|
||||
}
|
||||
lgInfo("INIT IobWPS");
|
||||
//reloadAdapterConf();
|
||||
}
|
||||
reader.Dispose();
|
||||
}
|
||||
lgInfo("DONE reloadAdapterConf");
|
||||
raiseRefresh(currDispData);
|
||||
}
|
||||
|
||||
#region Metodi specifici (da verificare/completare in implementazione)
|
||||
|
||||
public override void startAdapter(bool resetQueue)
|
||||
{
|
||||
// in primis RICARICO conf specifica...
|
||||
reloadAdapterConf();
|
||||
// continuo con start...
|
||||
base.startAdapter(resetQueue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override x chiusura driver...
|
||||
/// </summary>
|
||||
/// <param name="tryRestart"></param>
|
||||
/// <param name="forceDequeue"></param>
|
||||
public override void stopAdapter(bool tryRestart, bool forceDequeue)
|
||||
{
|
||||
try
|
||||
{
|
||||
// in primis chiudo driver...
|
||||
if (driver != null)
|
||||
/// <summary>
|
||||
/// Ricarica conf adapter...
|
||||
/// </summary>
|
||||
private void reloadAdapterConf()
|
||||
{
|
||||
driver.Quit();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in tryDisconnect");
|
||||
}
|
||||
// continuo
|
||||
base.stopAdapter(tryRestart, forceDequeue);
|
||||
}
|
||||
/// <summary>
|
||||
/// Connessione
|
||||
/// </summary>
|
||||
public override void tryConnect()
|
||||
{
|
||||
// controllo ping --> segno connected...
|
||||
connectionOk = (testPingMachine == IPStatus.Success);
|
||||
if (connectionOk)
|
||||
{
|
||||
try
|
||||
{
|
||||
//var t = TaskEx.Run(() => startDriver());
|
||||
//t.Wait();
|
||||
// modalità sincrona
|
||||
startDriver();
|
||||
lgInfo("Completato start driver");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in tryConnect");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// aspetto prima di riprovare...
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Avvio del WebDriver
|
||||
/// </summary>
|
||||
private void startDriver()
|
||||
{
|
||||
if (monitoredItems.SrvData.driverName == "CHROME")
|
||||
{
|
||||
lgInfo("Starting CHROME Driver");
|
||||
// preparo opzione headless x CHROME
|
||||
var o = new ChromeOptions();
|
||||
o.AddArgument("headless");
|
||||
ChromeDriverService service = ChromeDriverService.CreateDefaultService(Application.StartupPath);
|
||||
service.HideCommandPromptWindow = true;
|
||||
driver = new ChromeDriver(service, o);
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo("Starting FIREFOX Driver");
|
||||
// preparo opzione headless x FIREFOX
|
||||
var o = new FirefoxOptions();
|
||||
o.AddArgument("-headless");
|
||||
o.SetPreference("app.update.auto", false);
|
||||
o.SetPreference("app.update.enabled", false);
|
||||
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(Application.StartupPath);
|
||||
service.HideCommandPromptWindow = true;
|
||||
driver = new FirefoxDriver(service, o);
|
||||
}
|
||||
// aggiungo timeout x JScripts
|
||||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
|
||||
driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(20);
|
||||
// imposto pagina di acquisizione
|
||||
driver.Navigate().GoToUrl(baseUri);
|
||||
}
|
||||
/// <summary>
|
||||
/// Disconnessione
|
||||
/// </summary>
|
||||
public override void tryDisconnect()
|
||||
{
|
||||
connectionOk = false;
|
||||
try
|
||||
{
|
||||
// in primis chiudo driver...
|
||||
if (driver != null)
|
||||
//if (driver != null && driver.WindowHandles.Count > 0)
|
||||
{
|
||||
driver.Quit();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in tryDisconnect");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua processing del recupero delle OVERRIDE (spindle, feedrate, rapid)
|
||||
/// </summary>
|
||||
public override void processOverride()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero dati dinamici in formato dictionary
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getDynData()
|
||||
{
|
||||
lgInfo("Chiamata getDynData x IOB WebPageScraping!");
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
/* ----------------------------------------------------------
|
||||
* Recupero dalla TUTTE le chiavi richieste...
|
||||
* */
|
||||
|
||||
string cKey = "";
|
||||
string cVal = "";
|
||||
// processo tutti i DynData...
|
||||
foreach (var item in monitoredItems.DynData)
|
||||
{
|
||||
// cerco elemento indicato
|
||||
element = driver.FindElement(By.Id(item.val));
|
||||
cVal = element.Text;
|
||||
// verifico nome o key...
|
||||
if (!string.IsNullOrEmpty(item.name))
|
||||
{
|
||||
cKey = item.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
element = driver.FindElement(By.Id(item.key));
|
||||
cKey = element.Text;
|
||||
}
|
||||
// controllo se devo inviare (per tipo di dato, x scadenza)
|
||||
if (monItem2Send(cVal, item))
|
||||
{
|
||||
item.actVal = cVal;
|
||||
item.DTScad = DateTime.Now.AddSeconds(item.sPeriod);
|
||||
// accodo!
|
||||
outVal.Add(cKey, cVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in getDynData x IOB WPS");
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua lettura semafori principale
|
||||
/// <paramref name="currDispData">Parametri da aggiornare x display in form</paramref>
|
||||
/// </summary>
|
||||
public override void readSemafori(ref newDisplayData currDispData)
|
||||
{
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
// ciclo!
|
||||
try
|
||||
{
|
||||
// controllo SE il driver SIA attivo...
|
||||
if (driver != null)
|
||||
{
|
||||
string cKey = "";
|
||||
string cVal = "";
|
||||
// IPOTESI: un UNICO oggetto decodifica status
|
||||
if (monitoredItems.Status.Count == 1)
|
||||
{
|
||||
var item = monitoredItems.Status[0];
|
||||
// cerco elemento indicato
|
||||
element = driver.FindElement(By.Id(item.val));
|
||||
cKey = element.Text;
|
||||
// verifico se mancasse il mapping...
|
||||
if (!item.codeMapping.ContainsKey(cKey))
|
||||
// init obj display
|
||||
newDisplayData currDispData = new newDisplayData();
|
||||
lgInfo("BEGIN reloadAdapterConf");
|
||||
// inizializzo LUT decodifica
|
||||
string jsonConf = getOptPar("LUT_CONF");
|
||||
if (!string.IsNullOrEmpty(jsonConf))
|
||||
{
|
||||
processUnknStatus(cKey);
|
||||
string jsonFullPath = $"{Application.StartupPath}/DATA/CONF/{jsonConf}";
|
||||
lgInfo($"Apertura file {jsonFullPath}");
|
||||
StreamReader reader = new StreamReader(jsonFullPath);
|
||||
string jsonData = reader.ReadToEnd();
|
||||
if (!string.IsNullOrEmpty(jsonData))
|
||||
{
|
||||
try
|
||||
{
|
||||
monitoredItems = JsonConvert.DeserializeObject<MonitoredItemsConf>(jsonData);
|
||||
// salvo baseUri
|
||||
baseUri = monitoredItems.SrvData.baseUri;
|
||||
lgInfo($"baseUri = {baseUri}");
|
||||
// imposto a zero la bitmap x riavvio!
|
||||
B_input = 0;
|
||||
// FORZO invio dati...
|
||||
accodaSigIN(ref currDispData);
|
||||
// loggo!
|
||||
lgInfo($"init input bitmap to zero: {B_input}");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in decodifica conf json");
|
||||
}
|
||||
}
|
||||
reader.Dispose();
|
||||
}
|
||||
lgInfo("DONE reloadAdapterConf");
|
||||
raiseRefresh(currDispData);
|
||||
}
|
||||
|
||||
#region Metodi specifici (da verificare/completare in implementazione)
|
||||
|
||||
public override void startAdapter(bool resetQueue)
|
||||
{
|
||||
// in primis RICARICO conf specifica...
|
||||
reloadAdapterConf();
|
||||
// continuo con start...
|
||||
base.startAdapter(resetQueue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Override x chiusura driver...
|
||||
/// </summary>
|
||||
/// <param name="tryRestart"></param>
|
||||
/// <param name="forceDequeue"></param>
|
||||
public override void stopAdapter(bool tryRestart, bool forceDequeue)
|
||||
{
|
||||
try
|
||||
{
|
||||
// in primis chiudo driver...
|
||||
if (driver != null)
|
||||
{
|
||||
driver.Quit();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in tryDisconnect");
|
||||
}
|
||||
// continuo
|
||||
base.stopAdapter(tryRestart, forceDequeue);
|
||||
}
|
||||
/// <summary>
|
||||
/// Connessione
|
||||
/// </summary>
|
||||
public override void tryConnect()
|
||||
{
|
||||
// controllo ping --> segno connected...
|
||||
connectionOk = (testPingMachine == IPStatus.Success);
|
||||
if (connectionOk)
|
||||
{
|
||||
try
|
||||
{
|
||||
//var t = TaskEx.Run(() => startDriver());
|
||||
//t.Wait();
|
||||
// modalità sincrona
|
||||
startDriver();
|
||||
lgInfo("Completato start driver");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in tryConnect");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ora decodifico da variabile status a valore secondo impostazione "codeMapping"
|
||||
cVal = item.codeMapping[cKey];
|
||||
B_input = int.Parse(cVal, System.Globalization.NumberStyles.HexNumber);
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
// aspetto prima di riprovare...
|
||||
Thread.Sleep(200);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
/// <summary>
|
||||
/// Avvio del WebDriver
|
||||
/// </summary>
|
||||
private void startDriver()
|
||||
{
|
||||
lgError("Errore: driver non pronto (null)");
|
||||
if (monitoredItems.SrvData.driverName == "CHROME")
|
||||
{
|
||||
lgInfo("Starting CHROME Driver");
|
||||
// preparo opzione headless x CHROME
|
||||
var o = new ChromeOptions();
|
||||
o.AddArgument("headless");
|
||||
ChromeDriverService service = ChromeDriverService.CreateDefaultService(Application.StartupPath);
|
||||
service.HideCommandPromptWindow = true;
|
||||
driver = new ChromeDriver(service, o);
|
||||
}
|
||||
else
|
||||
{
|
||||
lgInfo("Starting FIREFOX Driver");
|
||||
// preparo opzione headless x FIREFOX
|
||||
var o = new FirefoxOptions();
|
||||
o.AddArgument("-headless");
|
||||
o.SetPreference("app.update.auto", false);
|
||||
o.SetPreference("app.update.enabled", false);
|
||||
FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(Application.StartupPath);
|
||||
service.HideCommandPromptWindow = true;
|
||||
driver = new FirefoxDriver(service, o);
|
||||
}
|
||||
// aggiungo timeout x JScripts
|
||||
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
|
||||
driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(20);
|
||||
// imposto pagina di acquisizione
|
||||
driver.Navigate().GoToUrl(baseUri);
|
||||
}
|
||||
// riporto bitmap...
|
||||
reportRawInput(ref currDispData);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in readSemafori x IOB WPS");
|
||||
currDispData.semIn = Semaforo.SR;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Processo stati unknown...
|
||||
/// </summary>
|
||||
/// <param name="cKey"></param>
|
||||
private void processUnknStatus(string cKey)
|
||||
{
|
||||
// cerco se avevo già una key nella dictionary...
|
||||
if (freqUnknStatus.ContainsKey(cKey))
|
||||
{
|
||||
freqUnknStatus[cKey]++;
|
||||
// se è 1 ogni 100 (%100, resto ==1) --> loggo...
|
||||
if (freqUnknStatus[cKey] % 100 == 1)
|
||||
/// <summary>
|
||||
/// Disconnessione
|
||||
/// </summary>
|
||||
public override void tryDisconnect()
|
||||
{
|
||||
connectionOk = false;
|
||||
try
|
||||
{
|
||||
// in primis chiudo driver...
|
||||
if (driver != null)
|
||||
//if (driver != null && driver.WindowHandles.Count > 0)
|
||||
{
|
||||
driver.Quit();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Eccezione in tryDisconnect");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua processing del recupero delle OVERRIDE (spindle, feedrate, rapid)
|
||||
/// </summary>
|
||||
public override void processOverride()
|
||||
{
|
||||
lgInfo($"Errore in decodifica status: MAPPING non trovato per {cKey} | freq: {freqUnknStatus[cKey]}");
|
||||
// accodo come invio di tipo FLOG...
|
||||
string sVal = string.Format("[UnknStatus] {0}, freq: {1}", cKey, freqUnknStatus);
|
||||
// chiamo accodamento...
|
||||
accodaFLog(sVal, qEncodeFLog("UnknStatus", sVal));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// creo chiave con freq = 1
|
||||
freqUnknStatus.Add(cKey, 1);
|
||||
// log iniziale
|
||||
lgInfo($"Errore in decodifica status: MAPPING non trovato per {cKey}");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
/// Recupero dati dinamici in formato dictionary
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override Dictionary<string, string> getDynData()
|
||||
{
|
||||
lgInfo("Chiamata getDynData x IOB WebPageScraping!");
|
||||
Dictionary<string, string> outVal = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
/* ----------------------------------------------------------
|
||||
* Recupero dalla TUTTE le chiavi richieste...
|
||||
* */
|
||||
|
||||
string cKey = "";
|
||||
string cVal = "";
|
||||
// processo tutti i DynData...
|
||||
foreach (var item in monitoredItems.DynData)
|
||||
{
|
||||
// cerco elemento indicato
|
||||
element = driver.FindElement(By.Id(item.val));
|
||||
cVal = element.Text;
|
||||
// verifico nome o key...
|
||||
if (!string.IsNullOrEmpty(item.name))
|
||||
{
|
||||
cKey = item.name;
|
||||
}
|
||||
else
|
||||
{
|
||||
element = driver.FindElement(By.Id(item.key));
|
||||
cKey = element.Text;
|
||||
}
|
||||
// controllo se devo inviare (per tipo di dato, x scadenza)
|
||||
if (monItem2Send(cVal, item))
|
||||
{
|
||||
item.actVal = cVal;
|
||||
item.DTScad = DateTime.Now.AddSeconds(item.sPeriod);
|
||||
// accodo!
|
||||
outVal.Add(cKey, cVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in getDynData x IOB WPS");
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua lettura semafori principale
|
||||
/// <paramref name="currDispData">Parametri da aggiornare x display in form</paramref>
|
||||
/// </summary>
|
||||
public override void readSemafori(ref newDisplayData currDispData)
|
||||
{
|
||||
// init a zero...
|
||||
B_input = 0;
|
||||
// ciclo!
|
||||
try
|
||||
{
|
||||
// controllo SE il driver SIA attivo...
|
||||
if (driver != null)
|
||||
{
|
||||
string cKey = "";
|
||||
string cVal = "";
|
||||
// IPOTESI: un UNICO oggetto decodifica status
|
||||
if (monitoredItems.Status.Count == 1)
|
||||
{
|
||||
var item = monitoredItems.Status[0];
|
||||
// cerco elemento indicato
|
||||
element = driver.FindElement(By.Id(item.val));
|
||||
cKey = element.Text;
|
||||
// verifico se mancasse il mapping...
|
||||
if (!item.codeMapping.ContainsKey(cKey))
|
||||
{
|
||||
processUnknStatus(cKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ora decodifico da variabile status a valore secondo impostazione "codeMapping"
|
||||
cVal = item.codeMapping[cKey];
|
||||
B_input = int.Parse(cVal, System.Globalization.NumberStyles.HexNumber);
|
||||
if (currDispData != null)
|
||||
{
|
||||
currDispData.semIn = Semaforo.SV;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lgError("Errore: driver non pronto (null)");
|
||||
}
|
||||
// riporto bitmap...
|
||||
reportRawInput(ref currDispData);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lgError(exc, "Errore in readSemafori x IOB WPS");
|
||||
if (currDispData != null)
|
||||
currDispData.semIn = Semaforo.SR;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Processo stati unknown...
|
||||
/// </summary>
|
||||
/// <param name="cKey"></param>
|
||||
private void processUnknStatus(string cKey)
|
||||
{
|
||||
// cerco se avevo già una key nella dictionary...
|
||||
if (freqUnknStatus.ContainsKey(cKey))
|
||||
{
|
||||
freqUnknStatus[cKey]++;
|
||||
// se è 1 ogni 100 (%100, resto ==1) --> loggo...
|
||||
if (freqUnknStatus[cKey] % 100 == 1)
|
||||
{
|
||||
lgInfo($"Errore in decodifica status: MAPPING non trovato per {cKey} | freq: {freqUnknStatus[cKey]}");
|
||||
// accodo come invio di tipo FLOG...
|
||||
string sVal = string.Format("[UnknStatus] {0}, freq: {1}", cKey, freqUnknStatus);
|
||||
// chiamo accodamento...
|
||||
accodaFLog(sVal, qEncodeFLog("UnknStatus", sVal));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// creo chiave con freq = 1
|
||||
freqUnknStatus.Add(cKey, 1);
|
||||
// log iniziale
|
||||
lgInfo($"Errore in decodifica status: MAPPING non trovato per {cKey}");
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
driver.Dispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -237,7 +237,7 @@ namespace IOB_WIN
|
||||
/// <summary>
|
||||
/// URL per recuperare i file dell'IOB su CLOUD (SENZA IOB)
|
||||
/// </summary>
|
||||
protected string urlDownloadFileCloud
|
||||
protected static string urlDownloadFileCloud
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -264,7 +264,7 @@ namespace IOB_WIN
|
||||
/// <summary>
|
||||
/// URL per salvare i file dell'IOB su CLOUD (SENZA IOB)
|
||||
/// </summary>
|
||||
protected string urlUploadFileCloud
|
||||
protected static string urlUploadFileCloud
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
+134
-117
@@ -7,130 +7,147 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace IOB_WIN
|
||||
{
|
||||
/// <summary>
|
||||
/// Definizione area memoria SIEMENS
|
||||
/// </summary>
|
||||
public class memAreaSiemens
|
||||
{
|
||||
/// <summary>
|
||||
/// Indice DB
|
||||
/// Definizione area memoria SIEMENS
|
||||
/// </summary>
|
||||
public int DbNum = 0;
|
||||
/// <summary>
|
||||
/// Tipo Memoria (DBD, DBW...)
|
||||
/// </summary>
|
||||
public string tipoMem = "";
|
||||
/// <summary>
|
||||
/// Indice partenza memoria (es DBD0 --> 0)
|
||||
/// </summary>
|
||||
public int indiceMem = 0;
|
||||
/// <summary>
|
||||
/// Inizializza da un formato stringa
|
||||
/// </summary>
|
||||
/// <param name="strFormat"></param>
|
||||
public memAreaSiemens(string strFormat)
|
||||
public class memAreaSiemens
|
||||
{
|
||||
string[] memComp = strFormat.Split('.');
|
||||
int.TryParse(memComp[0].Replace("DB", ""), out DbNum);
|
||||
tipoMem = memComp[1].Substring(2, 1);
|
||||
int.TryParse(memComp[1].Replace("DB", "").Replace(tipoMem, ""), out indiceMem);
|
||||
/// <summary>
|
||||
/// Indice DB
|
||||
/// </summary>
|
||||
public int DbNum = 0;
|
||||
/// <summary>
|
||||
/// Tipo Memoria (DBD, DBW...)
|
||||
/// </summary>
|
||||
public string tipoMem = "";
|
||||
/// <summary>
|
||||
/// Indice partenza memoria (es DBD0 --> 0)
|
||||
/// </summary>
|
||||
public int indiceMem = 0;
|
||||
/// <summary>
|
||||
/// Inizializza da un formato stringa
|
||||
/// </summary>
|
||||
/// <param name="strFormat"></param>
|
||||
public memAreaSiemens(string strFormat)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(strFormat))
|
||||
{
|
||||
string[] memComp = strFormat.Split('.');
|
||||
int.TryParse(memComp[0].Replace("DB", ""), out DbNum);
|
||||
//tipoMem = memComp[1].Substring(2, 1);
|
||||
tipoMem = "";
|
||||
for (int i = 0; i < memComp[1].Length; i++)
|
||||
{
|
||||
if(char.IsLetter(memComp[1][i]))
|
||||
{
|
||||
tipoMem += memComp[1][i];
|
||||
}
|
||||
}
|
||||
// rimuovo DB iniziale..
|
||||
tipoMem = tipoMem.Replace("DB", "");
|
||||
// ciclo x trovare SOLO stringa
|
||||
int.TryParse(memComp[1].Replace("DB", "").Replace(tipoMem, ""), out indiceMem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Definizione area memoria FANUC
|
||||
/// </summary>
|
||||
public class memAreaFanuc
|
||||
{
|
||||
/// <summary>
|
||||
/// Nome area memoria
|
||||
/// Definizione area memoria FANUC
|
||||
/// </summary>
|
||||
public string areaName;
|
||||
/// <summary>
|
||||
/// Indice inizio array
|
||||
/// </summary>
|
||||
public int startIdx;
|
||||
/// <summary>
|
||||
/// Dimensione array memoria
|
||||
/// </summary>
|
||||
public int arraySize;
|
||||
}
|
||||
/// <summary>
|
||||
/// Definizione indirizzo memoria FANUC
|
||||
/// </summary>
|
||||
public class memAddressFanuc
|
||||
{
|
||||
/// <summary>
|
||||
/// Tipo memoria
|
||||
/// </summary>
|
||||
public FANUC.MemType mType;
|
||||
/// <summary>
|
||||
/// Posizione memoria
|
||||
/// </summary>
|
||||
public int mPos;
|
||||
/// <summary>
|
||||
/// Tipo valore
|
||||
/// </summary>
|
||||
public string vType;
|
||||
/// <summary>
|
||||
/// Inizializza da un formato stringa
|
||||
/// </summary>
|
||||
/// <param name="strFormat">Stringa TipoMem.Indice.DimMem (es D.1604.DW)</param>
|
||||
public memAddressFanuc(string strFormat)
|
||||
public class memAreaFanuc
|
||||
{
|
||||
string[] memComp = strFormat.Split('.');
|
||||
switch (memComp[0])
|
||||
{
|
||||
case "A":
|
||||
mType = FANUC.MemType.A;
|
||||
break;
|
||||
case "C":
|
||||
mType = FANUC.MemType.C;
|
||||
break;
|
||||
case "CM":
|
||||
mType = FANUC.MemType.CM;
|
||||
break;
|
||||
case "D":
|
||||
mType = FANUC.MemType.D;
|
||||
break;
|
||||
case "E":
|
||||
mType = FANUC.MemType.E;
|
||||
break;
|
||||
case "F":
|
||||
mType = FANUC.MemType.F;
|
||||
break;
|
||||
case "G":
|
||||
mType = FANUC.MemType.G;
|
||||
break;
|
||||
case "K":
|
||||
mType = FANUC.MemType.K;
|
||||
break;
|
||||
case "M":
|
||||
mType = FANUC.MemType.M;
|
||||
break;
|
||||
case "N":
|
||||
mType = FANUC.MemType.N;
|
||||
break;
|
||||
case "R":
|
||||
mType = FANUC.MemType.R;
|
||||
break;
|
||||
case "T":
|
||||
mType = FANUC.MemType.T;
|
||||
break;
|
||||
case "X":
|
||||
mType = FANUC.MemType.X;
|
||||
break;
|
||||
case "Y":
|
||||
mType = FANUC.MemType.Y;
|
||||
break;
|
||||
case "Z":
|
||||
mType = FANUC.MemType.Z;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int.TryParse(memComp[1], out mPos);
|
||||
vType = memComp[2];
|
||||
/// <summary>
|
||||
/// Nome area memoria
|
||||
/// </summary>
|
||||
public string areaName;
|
||||
/// <summary>
|
||||
/// Indice inizio array
|
||||
/// </summary>
|
||||
public int startIdx;
|
||||
/// <summary>
|
||||
/// Dimensione array memoria
|
||||
/// </summary>
|
||||
public int arraySize;
|
||||
}
|
||||
/// <summary>
|
||||
/// Definizione indirizzo memoria FANUC
|
||||
/// </summary>
|
||||
public class memAddressFanuc
|
||||
{
|
||||
/// <summary>
|
||||
/// Tipo memoria
|
||||
/// </summary>
|
||||
public FANUC.MemType mType;
|
||||
/// <summary>
|
||||
/// Posizione memoria
|
||||
/// </summary>
|
||||
public int mPos;
|
||||
/// <summary>
|
||||
/// Tipo valore
|
||||
/// </summary>
|
||||
public string vType;
|
||||
/// <summary>
|
||||
/// Inizializza da un formato stringa
|
||||
/// </summary>
|
||||
/// <param name="strFormat">Stringa TipoMem.Indice.DimMem (es D.1604.DW)</param>
|
||||
public memAddressFanuc(string strFormat)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(strFormat))
|
||||
{
|
||||
string[] memComp = strFormat.Split('.');
|
||||
switch (memComp[0])
|
||||
{
|
||||
case "A":
|
||||
mType = FANUC.MemType.A;
|
||||
break;
|
||||
case "C":
|
||||
mType = FANUC.MemType.C;
|
||||
break;
|
||||
case "CM":
|
||||
mType = FANUC.MemType.CM;
|
||||
break;
|
||||
case "D":
|
||||
mType = FANUC.MemType.D;
|
||||
break;
|
||||
case "E":
|
||||
mType = FANUC.MemType.E;
|
||||
break;
|
||||
case "F":
|
||||
mType = FANUC.MemType.F;
|
||||
break;
|
||||
case "G":
|
||||
mType = FANUC.MemType.G;
|
||||
break;
|
||||
case "K":
|
||||
mType = FANUC.MemType.K;
|
||||
break;
|
||||
case "M":
|
||||
mType = FANUC.MemType.M;
|
||||
break;
|
||||
case "N":
|
||||
mType = FANUC.MemType.N;
|
||||
break;
|
||||
case "R":
|
||||
mType = FANUC.MemType.R;
|
||||
break;
|
||||
case "T":
|
||||
mType = FANUC.MemType.T;
|
||||
break;
|
||||
case "X":
|
||||
mType = FANUC.MemType.X;
|
||||
break;
|
||||
case "Y":
|
||||
mType = FANUC.MemType.Y;
|
||||
break;
|
||||
case "Z":
|
||||
mType = FANUC.MemType.Z;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int.TryParse(memComp[1], out mPos);
|
||||
vType = memComp[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -9,7 +9,7 @@ pipeline {
|
||||
steps {
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=694']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=696']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'MAPO-IOB-WIN'
|
||||
@@ -96,7 +96,7 @@ pipeline {
|
||||
if(env.BRANCH_NAME == "IobMan") {
|
||||
env.classifier = ""
|
||||
// rimuovo vecchio zip...
|
||||
bat "del /f ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\*.zip"
|
||||
bat "del /f ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\*.zip || EXIT /B 0"
|
||||
// Compressione in .zip dell'installer...
|
||||
bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\MAPO-IOB-MAN.zip ${WORKSPACE}\\IOB-MAN\\bin\\*"
|
||||
// ora mi occupo delle operazioni di invio a NEXUS...
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Siemens-S7-Test", "Siemens-S7-Test\Siemens-S7-Test.csproj", "{A0168CBE-9DA5-4E41-82FF-AFD39C982717}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A0168CBE-9DA5-4E41-82FF-AFD39C982717}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A0168CBE-9DA5-4E41-82FF-AFD39C982717}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A0168CBE-9DA5-4E41-82FF-AFD39C982717}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A0168CBE-9DA5-4E41-82FF-AFD39C982717}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C43DB985-D122-49F0-AE6E-DADEFFC1AD3D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="appName" value="Siemens.S7.Test"/>
|
||||
<add key="verbose" value="false"/>
|
||||
<!--conf file-->
|
||||
<add key="dataPath" value="DATA"/>
|
||||
<add key="dataConfPath" value="DATA\CONF"/>
|
||||
<add key="dataDatPath" value="DATA\DAT"/>
|
||||
<add key="MMapR" value="MMapR.map"/>
|
||||
<add key="MMapW" value="MMapW.map"/>
|
||||
<add key="charSep" value="|"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
|
||||
public class BinaryFormat : IFormatProvider, ICustomFormatter
|
||||
{
|
||||
// IFormatProvider.GetFormat implementation.
|
||||
public object GetFormat(Type formatType)
|
||||
{
|
||||
// Determine whether custom formatting object is requested.
|
||||
if (formatType == typeof(ICustomFormatter))
|
||||
return this;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
// Format number in binary (B), octal (O), or hexadecimal (H).
|
||||
public string Format(string format, object arg, IFormatProvider formatProvider)
|
||||
{
|
||||
// Handle format string.
|
||||
int baseNumber;
|
||||
// Handle null or empty format string, string with precision specifier.
|
||||
string thisFmt = String.Empty;
|
||||
// Extract first character of format string (precision specifiers
|
||||
// are not supported).
|
||||
if (!String.IsNullOrEmpty(format))
|
||||
thisFmt = format.Length > 1 ? format.Substring(0, 1) : format;
|
||||
|
||||
|
||||
// Get a byte array representing the numeric value.
|
||||
byte[] bytes;
|
||||
if (arg is sbyte)
|
||||
{
|
||||
string byteString = ((sbyte)arg).ToString("X2");
|
||||
bytes = new byte[1] { Byte.Parse(byteString, System.Globalization.NumberStyles.HexNumber) };
|
||||
}
|
||||
else if (arg is byte)
|
||||
{
|
||||
bytes = new byte[1] { (byte)arg };
|
||||
}
|
||||
else if (arg is short)
|
||||
{
|
||||
bytes = BitConverter.GetBytes((short)arg);
|
||||
}
|
||||
else if (arg is int)
|
||||
{
|
||||
bytes = BitConverter.GetBytes((int)arg);
|
||||
}
|
||||
else if (arg is long)
|
||||
{
|
||||
bytes = BitConverter.GetBytes((long)arg);
|
||||
}
|
||||
else if (arg is ushort)
|
||||
{
|
||||
bytes = BitConverter.GetBytes((ushort)arg);
|
||||
}
|
||||
else if (arg is uint)
|
||||
{
|
||||
bytes = BitConverter.GetBytes((uint)arg);
|
||||
}
|
||||
else if (arg is ulong)
|
||||
{
|
||||
bytes = BitConverter.GetBytes((ulong)arg);
|
||||
}
|
||||
else if (arg is BigInteger)
|
||||
{
|
||||
bytes = ((BigInteger)arg).ToByteArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
return HandleOtherFormats(format, arg);
|
||||
}
|
||||
catch (FormatException e)
|
||||
{
|
||||
throw new FormatException(String.Format("The format of '{0}' is invalid.", format), e);
|
||||
}
|
||||
}
|
||||
|
||||
switch (thisFmt.ToUpper())
|
||||
{
|
||||
// Binary formatting.
|
||||
case "B":
|
||||
baseNumber = 2;
|
||||
break;
|
||||
case "O":
|
||||
baseNumber = 8;
|
||||
break;
|
||||
case "H":
|
||||
baseNumber = 16;
|
||||
break;
|
||||
// Handle unsupported format strings.
|
||||
default:
|
||||
try
|
||||
{
|
||||
return HandleOtherFormats(format, arg);
|
||||
}
|
||||
catch (FormatException e)
|
||||
{
|
||||
throw new FormatException(String.Format("The format of '{0}' is invalid.", format), e);
|
||||
}
|
||||
}
|
||||
|
||||
// Return a formatted string.
|
||||
string numericString = String.Empty;
|
||||
for (int ctr = bytes.GetUpperBound(0); ctr >= bytes.GetLowerBound(0); ctr--)
|
||||
{
|
||||
string byteString = Convert.ToString(bytes[ctr], baseNumber);
|
||||
if (baseNumber == 2)
|
||||
byteString = new String('0', 8 - byteString.Length) + byteString;
|
||||
else if (baseNumber == 8)
|
||||
byteString = new String('0', 4 - byteString.Length) + byteString;
|
||||
// Base is 16.
|
||||
else
|
||||
byteString = new String('0', 2 - byteString.Length) + byteString;
|
||||
|
||||
numericString += byteString + " ";
|
||||
}
|
||||
return numericString.Trim();
|
||||
}
|
||||
|
||||
private string HandleOtherFormats(string format, object arg)
|
||||
{
|
||||
if (arg is IFormattable)
|
||||
return ((IFormattable)arg).ToString(format, CultureInfo.CurrentCulture);
|
||||
else if (arg != null)
|
||||
return arg.ToString();
|
||||
else
|
||||
return String.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "charSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
# PARAMETRI della DB600
|
||||
000|P0_ID |WORD
|
||||
002|P0_SET_HMI |4BYTE
|
||||
006|P0_SET_PLC |4BYTE
|
||||
010|P0_VAL_MAX |4BYTE
|
||||
014|P0_VAL_MIN |4BYTE
|
||||
018|P0_UN_MEAS |WORD
|
||||
020|P1_ID |WORD
|
||||
022|P1_SET_HMI |4BYTE
|
||||
026|P1_SET_PLC |4BYTE
|
||||
030|P1_VAL_MAX |4BYTE
|
||||
034|P1_VAL_MIN |4BYTE
|
||||
038|P1_UN_MEAS |WORD
|
||||
@@ -0,0 +1,14 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "charSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
# PARAMETRI della DB600
|
||||
000|P0_ID |WORD
|
||||
002|P0_SET_HMI |4BYTE
|
||||
006|P0_SET_PLC |4BYTE
|
||||
010|P0_VAL_MAX |4BYTE
|
||||
014|P0_VAL_MIN |4BYTE
|
||||
018|P0_UN_MEAS |WORD
|
||||
020|P1_ID |WORD
|
||||
022|P1_SET_HMI |4BYTE
|
||||
026|P1_SET_PLC |4BYTE
|
||||
030|P1_VAL_MAX |4BYTE
|
||||
034|P1_VAL_MIN |4BYTE
|
||||
038|P1_UN_MEAS |WORD
|
||||
@@ -0,0 +1,53 @@
|
||||
Interfaccia con TORRI
|
||||
|
||||
DA PLC
|
||||
- un set di 8 bit di stato macchina
|
||||
- power on (oppure se vedo spenta...)
|
||||
- RUN (in lavorazione, semaforo verde)
|
||||
- contapezzi
|
||||
- allarme
|
||||
- in manuale
|
||||
- un set di 16 byte - 128 allarmi (da confermare)
|
||||
- ogni bit corrisponde ad un allarme, secondo tabella codificata
|
||||
- contatori pezzi
|
||||
- num pz totali
|
||||
- TempoCiclo ULTIMO pezzo
|
||||
- bit pezzo buono
|
||||
- bit pezzo scarto
|
||||
- bit pezzo da riprendere
|
||||
- misure
|
||||
- misura H1
|
||||
- misura H2
|
||||
- dati macchina
|
||||
- override speed
|
||||
- override feed
|
||||
- giri mandrino pezzo
|
||||
- giri mandrino mola
|
||||
- autospegnimento attivo (0=spento, 1 = contapezzi, 2 = fine pallet 1, 3=finepallet 2, 4 = fine pallet 1 & 2)
|
||||
- num pezzi a spegnimento (SE condizione 1 con contapezzi)
|
||||
- tempo teorico allo spegnimento
|
||||
|
||||
- bit conferma lettura stringa
|
||||
- bit conferma lettura inizio commessa
|
||||
- bit conferma lettura fine commessa
|
||||
|
||||
|
||||
VERSO PLC
|
||||
bit
|
||||
- bit che indica "nuovi dati stringa da leggere"
|
||||
- bit inizio commessa
|
||||
- bit fuine commessa
|
||||
|
||||
stringhe
|
||||
- codice commessa
|
||||
- codice articolo
|
||||
- codice programma
|
||||
- codice macchina (x controllo coerenza)
|
||||
- dir programma Fissa su macchcina o parametro
|
||||
num int
|
||||
- quantità lotto
|
||||
|
||||
|
||||
|
||||
ATTENZIONE: letture real devono essere tenute arrotondando alla 4° cifra decimale (NON OLTRE CHE INVENTA)
|
||||
Avremo 2 DB: 700 scrive PLC, 701 scrive sw esterno
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue"/>
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
</rules>
|
||||
</nlog>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Punto di ingresso principale dell'applicazione.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new TestMainForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Le informazioni generali relative a un assembly sono controllate dal seguente
|
||||
// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
|
||||
// associate a un assembly.
|
||||
[assembly: AssemblyTitle("Test-S7")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Test-S7")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
|
||||
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
|
||||
// COM, impostare su true l'attributo ComVisible per tale tipo.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
|
||||
[assembly: Guid("a0168cbe-9da5-4e41-82ff-afd39c982717")]
|
||||
|
||||
// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
|
||||
//
|
||||
// Versione principale
|
||||
// Versione secondaria
|
||||
// Numero di build
|
||||
// Revisione
|
||||
//
|
||||
// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
|
||||
// usando l'asterisco '*' come illustrato di seguito:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Siemens_S7_Test.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Siemens_S7_Test.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Siemens_S7_Test.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,128 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A0168CBE-9DA5-4E41-82FF-AFD39C982717}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>Siemens_S7_Test</RootNamespace>
|
||||
<AssemblyName>Siemens-S7-Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.4.7.0\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="S7.Net, Version=0.4.0.0, Culture=neutral, PublicKeyToken=d5812d469e84c693, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\S7netplus.0.4.0\lib\net452\S7.Net.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BinaryFormat.cs" />
|
||||
<Compile Include="connParam.cs" />
|
||||
<Compile Include="memAddress.cs" />
|
||||
<Compile Include="TestMainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TestMainForm.Designer.cs">
|
||||
<DependentUpon>TestMainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ThermoObj.cs" />
|
||||
<Compile Include="TimingData.cs" />
|
||||
<Compile Include="utils.cs" />
|
||||
<EmbeddedResource Include="TestMainForm.resx">
|
||||
<DependentUpon>TestMainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Content Include="Interfaccia.txt" />
|
||||
<Content Include="logs\.placeholder.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="NLog.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<None Include="DATA\CONF\MMapR.map">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="DATA\CONF\MMapW.map">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="NLog.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<None Include="resources\MHT\MMapR.map">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="resources\MHT\MMapW.map">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
+878
@@ -0,0 +1,878 @@
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
partial class TestMainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Variabile di progettazione necessaria.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Pulire le risorse in uso.
|
||||
/// </summary>
|
||||
/// <param name="disposing">ha valore true se le risorse gestite devono essere eliminate, false in caso contrario.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Codice generato da Progettazione Windows Form
|
||||
|
||||
/// <summary>
|
||||
/// Metodo necessario per il supporto della finestra di progettazione. Non modificare
|
||||
/// il contenuto del metodo con l'editor di codice.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.txtIP = new System.Windows.Forms.TextBox();
|
||||
this.lblIP = new System.Windows.Forms.Label();
|
||||
this.cbCpuType = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.txtMemArea = new System.Windows.Forms.TextBox();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.txtMemSize = new System.Windows.Forms.TextBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.txtNumRep = new System.Windows.Forms.TextBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.btnReadStruct = new System.Windows.Forms.Button();
|
||||
this.btnReadString = new System.Windows.Forms.Button();
|
||||
this.btnReadDWord = new System.Windows.Forms.Button();
|
||||
this.btnReadWord = new System.Windows.Forms.Button();
|
||||
this.btnReadReal = new System.Windows.Forms.Button();
|
||||
this.btnReadByte = new System.Windows.Forms.Button();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.label11 = new System.Windows.Forms.Label();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.txtSlot = new System.Windows.Forms.TextBox();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.txtRack = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.tslConn = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripProgressBar1 = new System.Windows.Forms.ToolStripProgressBar();
|
||||
this.tslRTime = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.groupBox4 = new System.Windows.Forms.GroupBox();
|
||||
this.btnStrWrite = new System.Windows.Forms.Button();
|
||||
this.btnNumWriteB = new System.Windows.Forms.Button();
|
||||
this.btnNumWriteDW = new System.Windows.Forms.Button();
|
||||
this.btnNumWriteW = new System.Windows.Forms.Button();
|
||||
this.txtWriteVal2 = new System.Windows.Forms.TextBox();
|
||||
this.label9 = new System.Windows.Forms.Label();
|
||||
this.txtWriteVal1 = new System.Windows.Forms.TextBox();
|
||||
this.label8 = new System.Windows.Forms.Label();
|
||||
this.txtWriteAddr2 = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.txtWriteAddr1 = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.txtOut = new System.Windows.Forms.TextBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.tabCtrl = new System.Windows.Forms.TabControl();
|
||||
this.tabReadTest = new System.Windows.Forms.TabPage();
|
||||
this.tabWriteTest = new System.Windows.Forms.TabPage();
|
||||
this.tabParam = new System.Windows.Forms.TabPage();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.lblThroughtput = new System.Windows.Forms.Label();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.lblTotSize = new System.Windows.Forms.Label();
|
||||
this.lblTimeMin = new System.Windows.Forms.Label();
|
||||
this.lblTimeMax = new System.Windows.Forms.Label();
|
||||
this.lblTimeAvg = new System.Windows.Forms.Label();
|
||||
this.label16 = new System.Windows.Forms.Label();
|
||||
this.label15 = new System.Windows.Forms.Label();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.cmbOutType = new System.Windows.Forms.ComboBox();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.groupBox4.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
this.tabCtrl.SuspendLayout();
|
||||
this.tabReadTest.SuspendLayout();
|
||||
this.tabWriteTest.SuspendLayout();
|
||||
this.tabParam.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
this.splitContainer1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtIP
|
||||
//
|
||||
this.txtIP.Location = new System.Drawing.Point(85, 23);
|
||||
this.txtIP.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtIP.Name = "txtIP";
|
||||
this.txtIP.Size = new System.Drawing.Size(109, 22);
|
||||
this.txtIP.TabIndex = 0;
|
||||
this.txtIP.Text = "192.168.0.102";
|
||||
this.txtIP.TextChanged += new System.EventHandler(this.txtIP_TextChanged);
|
||||
//
|
||||
// lblIP
|
||||
//
|
||||
this.lblIP.AutoSize = true;
|
||||
this.lblIP.Location = new System.Drawing.Point(16, 26);
|
||||
this.lblIP.Name = "lblIP";
|
||||
this.lblIP.Size = new System.Drawing.Size(63, 17);
|
||||
this.lblIP.TabIndex = 1;
|
||||
this.lblIP.Text = "IP ADDR";
|
||||
//
|
||||
// cbCpuType
|
||||
//
|
||||
this.cbCpuType.FormattingEnabled = true;
|
||||
this.cbCpuType.Items.AddRange(new object[] {
|
||||
"S7200",
|
||||
"S7300",
|
||||
"S7400",
|
||||
"S71200",
|
||||
"S71500"});
|
||||
this.cbCpuType.Location = new System.Drawing.Point(85, 62);
|
||||
this.cbCpuType.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.cbCpuType.Name = "cbCpuType";
|
||||
this.cbCpuType.Size = new System.Drawing.Size(109, 24);
|
||||
this.cbCpuType.TabIndex = 2;
|
||||
this.cbCpuType.Text = "S71500";
|
||||
this.cbCpuType.SelectedIndexChanged += new System.EventHandler(this.cbCpuType_SelectedIndexChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(7, 64);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(72, 17);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "CPU Type";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(9, 23);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(80, 17);
|
||||
this.label2.TabIndex = 5;
|
||||
this.label2.Text = "MEM AREA";
|
||||
//
|
||||
// txtMemArea
|
||||
//
|
||||
this.txtMemArea.Location = new System.Drawing.Point(148, 20);
|
||||
this.txtMemArea.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtMemArea.Name = "txtMemArea";
|
||||
this.txtMemArea.Size = new System.Drawing.Size(101, 22);
|
||||
this.txtMemArea.TabIndex = 4;
|
||||
this.txtMemArea.Text = "DB600.DBB20";
|
||||
this.txtMemArea.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.txtMemArea.TextChanged += new System.EventHandler(this.txtMemArea_TextChanged);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(9, 52);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(123, 17);
|
||||
this.label3.TabIndex = 7;
|
||||
this.label3.Text = "MEM SIZE (BYTE)";
|
||||
//
|
||||
// txtMemSize
|
||||
//
|
||||
this.txtMemSize.Location = new System.Drawing.Point(148, 50);
|
||||
this.txtMemSize.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtMemSize.Name = "txtMemSize";
|
||||
this.txtMemSize.Size = new System.Drawing.Size(101, 22);
|
||||
this.txtMemSize.TabIndex = 6;
|
||||
this.txtMemSize.Text = "200";
|
||||
this.txtMemSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.txtMemSize.TextChanged += new System.EventHandler(this.txtMemSize_TextChanged);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.cmbOutType);
|
||||
this.groupBox1.Controls.Add(this.txtNumRep);
|
||||
this.groupBox1.Controls.Add(this.label13);
|
||||
this.groupBox1.Controls.Add(this.btnReadStruct);
|
||||
this.groupBox1.Controls.Add(this.btnReadString);
|
||||
this.groupBox1.Controls.Add(this.btnReadDWord);
|
||||
this.groupBox1.Controls.Add(this.btnReadWord);
|
||||
this.groupBox1.Controls.Add(this.btnReadReal);
|
||||
this.groupBox1.Controls.Add(this.btnReadByte);
|
||||
this.groupBox1.Controls.Add(this.txtMemArea);
|
||||
this.groupBox1.Controls.Add(this.txtMemSize);
|
||||
this.groupBox1.Controls.Add(this.label3);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Location = new System.Drawing.Point(6, 5);
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBox1.Size = new System.Drawing.Size(672, 105);
|
||||
this.groupBox1.TabIndex = 8;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Memoria: READ testing";
|
||||
//
|
||||
// txtNumRep
|
||||
//
|
||||
this.txtNumRep.Location = new System.Drawing.Point(148, 76);
|
||||
this.txtNumRep.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtNumRep.Name = "txtNumRep";
|
||||
this.txtNumRep.Size = new System.Drawing.Size(101, 22);
|
||||
this.txtNumRep.TabIndex = 14;
|
||||
this.txtNumRep.Text = "1";
|
||||
this.txtNumRep.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// label13
|
||||
//
|
||||
this.label13.AutoSize = true;
|
||||
this.label13.Location = new System.Drawing.Point(9, 79);
|
||||
this.label13.Name = "label13";
|
||||
this.label13.Size = new System.Drawing.Size(72, 17);
|
||||
this.label13.TabIndex = 15;
|
||||
this.label13.Text = "# samples";
|
||||
//
|
||||
// btnReadStruct
|
||||
//
|
||||
this.btnReadStruct.Location = new System.Drawing.Point(405, 75);
|
||||
this.btnReadStruct.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnReadStruct.Name = "btnReadStruct";
|
||||
this.btnReadStruct.Size = new System.Drawing.Size(110, 25);
|
||||
this.btnReadStruct.TabIndex = 12;
|
||||
this.btnReadStruct.Text = "Read Struc";
|
||||
this.btnReadStruct.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
|
||||
this.btnReadStruct.UseVisualStyleBackColor = true;
|
||||
this.btnReadStruct.Click += new System.EventHandler(this.btnReadStruct_Click);
|
||||
//
|
||||
// btnReadString
|
||||
//
|
||||
this.btnReadString.Location = new System.Drawing.Point(405, 49);
|
||||
this.btnReadString.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnReadString.Name = "btnReadString";
|
||||
this.btnReadString.Size = new System.Drawing.Size(110, 25);
|
||||
this.btnReadString.TabIndex = 11;
|
||||
this.btnReadString.Text = "Read String";
|
||||
this.btnReadString.UseVisualStyleBackColor = true;
|
||||
this.btnReadString.Click += new System.EventHandler(this.btnReadString_Click);
|
||||
//
|
||||
// btnReadDWord
|
||||
//
|
||||
this.btnReadDWord.Location = new System.Drawing.Point(289, 75);
|
||||
this.btnReadDWord.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnReadDWord.Name = "btnReadDWord";
|
||||
this.btnReadDWord.Size = new System.Drawing.Size(110, 25);
|
||||
this.btnReadDWord.TabIndex = 10;
|
||||
this.btnReadDWord.Text = "Read DWord";
|
||||
this.btnReadDWord.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
|
||||
this.btnReadDWord.UseVisualStyleBackColor = true;
|
||||
this.btnReadDWord.Click += new System.EventHandler(this.btnReadDWord_Click);
|
||||
//
|
||||
// btnReadWord
|
||||
//
|
||||
this.btnReadWord.Location = new System.Drawing.Point(289, 48);
|
||||
this.btnReadWord.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnReadWord.Name = "btnReadWord";
|
||||
this.btnReadWord.Size = new System.Drawing.Size(110, 25);
|
||||
this.btnReadWord.TabIndex = 10;
|
||||
this.btnReadWord.Text = "Read Word";
|
||||
this.btnReadWord.UseVisualStyleBackColor = true;
|
||||
this.btnReadWord.Click += new System.EventHandler(this.btnReadWord_Click);
|
||||
//
|
||||
// btnReadReal
|
||||
//
|
||||
this.btnReadReal.Location = new System.Drawing.Point(405, 19);
|
||||
this.btnReadReal.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnReadReal.Name = "btnReadReal";
|
||||
this.btnReadReal.Size = new System.Drawing.Size(110, 25);
|
||||
this.btnReadReal.TabIndex = 9;
|
||||
this.btnReadReal.Text = "Read Real";
|
||||
this.btnReadReal.UseVisualStyleBackColor = true;
|
||||
this.btnReadReal.Click += new System.EventHandler(this.btnReadReal_Click);
|
||||
//
|
||||
// btnReadByte
|
||||
//
|
||||
this.btnReadByte.Location = new System.Drawing.Point(289, 19);
|
||||
this.btnReadByte.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnReadByte.Name = "btnReadByte";
|
||||
this.btnReadByte.Size = new System.Drawing.Size(110, 25);
|
||||
this.btnReadByte.TabIndex = 9;
|
||||
this.btnReadByte.Text = "Read Byte";
|
||||
this.btnReadByte.UseVisualStyleBackColor = true;
|
||||
this.btnReadByte.Click += new System.EventHandler(this.btnReadByte_Click);
|
||||
//
|
||||
// groupBox3
|
||||
//
|
||||
this.groupBox3.Controls.Add(this.label11);
|
||||
this.groupBox3.Controls.Add(this.label6);
|
||||
this.groupBox3.Controls.Add(this.txtSlot);
|
||||
this.groupBox3.Controls.Add(this.label5);
|
||||
this.groupBox3.Controls.Add(this.txtRack);
|
||||
this.groupBox3.Controls.Add(this.label4);
|
||||
this.groupBox3.Controls.Add(this.cbCpuType);
|
||||
this.groupBox3.Controls.Add(this.txtIP);
|
||||
this.groupBox3.Controls.Add(this.lblIP);
|
||||
this.groupBox3.Controls.Add(this.label1);
|
||||
this.groupBox3.Location = new System.Drawing.Point(6, 5);
|
||||
this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBox3.Size = new System.Drawing.Size(479, 105);
|
||||
this.groupBox3.TabIndex = 10;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "Parametri PLC";
|
||||
//
|
||||
// label11
|
||||
//
|
||||
this.label11.AutoSize = true;
|
||||
this.label11.Location = new System.Drawing.Point(301, 39);
|
||||
this.label11.Name = "label11";
|
||||
this.label11.Size = new System.Drawing.Size(148, 51);
|
||||
this.label11.TabIndex = 7;
|
||||
this.label11.Text = "S7-1200/S7-1500: 0/1\r\nS7-300/S7-400: 0/2\r\nSlot > 0 se eth ext";
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.Location = new System.Drawing.Point(301, 14);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Size = new System.Drawing.Size(114, 17);
|
||||
this.label6.TabIndex = 6;
|
||||
this.label6.Text = "Note Rack / Slot:";
|
||||
//
|
||||
// txtSlot
|
||||
//
|
||||
this.txtSlot.Location = new System.Drawing.Point(253, 62);
|
||||
this.txtSlot.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtSlot.Name = "txtSlot";
|
||||
this.txtSlot.Size = new System.Drawing.Size(41, 22);
|
||||
this.txtSlot.TabIndex = 5;
|
||||
this.txtSlot.Text = "1";
|
||||
this.txtSlot.TextChanged += new System.EventHandler(this.txtSlot_TextChanged);
|
||||
//
|
||||
// label5
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(208, 64);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(32, 17);
|
||||
this.label5.TabIndex = 4;
|
||||
this.label5.Text = "Slot";
|
||||
//
|
||||
// txtRack
|
||||
//
|
||||
this.txtRack.Location = new System.Drawing.Point(253, 23);
|
||||
this.txtRack.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtRack.Name = "txtRack";
|
||||
this.txtRack.Size = new System.Drawing.Size(41, 22);
|
||||
this.txtRack.TabIndex = 5;
|
||||
this.txtRack.Text = "0";
|
||||
this.txtRack.TextChanged += new System.EventHandler(this.txtRack_TextChanged);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(208, 26);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(40, 17);
|
||||
this.label4.TabIndex = 4;
|
||||
this.label4.Text = "Rack";
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tslConn,
|
||||
this.toolStripStatusLabel1,
|
||||
this.toolStripProgressBar1,
|
||||
this.tslRTime});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 583);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 13, 0);
|
||||
this.statusStrip1.Size = new System.Drawing.Size(906, 28);
|
||||
this.statusStrip1.TabIndex = 11;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// tslConn
|
||||
//
|
||||
this.tslConn.Name = "tslConn";
|
||||
this.tslConn.Size = new System.Drawing.Size(72, 22);
|
||||
this.tslConn.Text = "Conn: ND";
|
||||
//
|
||||
// toolStripStatusLabel1
|
||||
//
|
||||
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
|
||||
this.toolStripStatusLabel1.Size = new System.Drawing.Size(13, 22);
|
||||
this.toolStripStatusLabel1.Text = "|";
|
||||
//
|
||||
// toolStripProgressBar1
|
||||
//
|
||||
this.toolStripProgressBar1.Name = "toolStripProgressBar1";
|
||||
this.toolStripProgressBar1.Size = new System.Drawing.Size(100, 20);
|
||||
//
|
||||
// tslRTime
|
||||
//
|
||||
this.tslRTime.Name = "tslRTime";
|
||||
this.tslRTime.Size = new System.Drawing.Size(37, 22);
|
||||
this.tslRTime.Text = "...ms";
|
||||
//
|
||||
// groupBox4
|
||||
//
|
||||
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBox4.Controls.Add(this.btnStrWrite);
|
||||
this.groupBox4.Controls.Add(this.btnNumWriteB);
|
||||
this.groupBox4.Controls.Add(this.btnNumWriteDW);
|
||||
this.groupBox4.Controls.Add(this.btnNumWriteW);
|
||||
this.groupBox4.Controls.Add(this.txtWriteVal2);
|
||||
this.groupBox4.Controls.Add(this.label9);
|
||||
this.groupBox4.Controls.Add(this.txtWriteVal1);
|
||||
this.groupBox4.Controls.Add(this.label8);
|
||||
this.groupBox4.Controls.Add(this.txtWriteAddr2);
|
||||
this.groupBox4.Controls.Add(this.label10);
|
||||
this.groupBox4.Controls.Add(this.txtWriteAddr1);
|
||||
this.groupBox4.Controls.Add(this.label7);
|
||||
this.groupBox4.Location = new System.Drawing.Point(7, 7);
|
||||
this.groupBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBox4.Name = "groupBox4";
|
||||
this.groupBox4.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBox4.Size = new System.Drawing.Size(1809, 71);
|
||||
this.groupBox4.TabIndex = 12;
|
||||
this.groupBox4.TabStop = false;
|
||||
this.groupBox4.Text = "Memoria: WRITE param";
|
||||
//
|
||||
// btnStrWrite
|
||||
//
|
||||
this.btnStrWrite.Location = new System.Drawing.Point(799, 25);
|
||||
this.btnStrWrite.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnStrWrite.Name = "btnStrWrite";
|
||||
this.btnStrWrite.Size = new System.Drawing.Size(41, 23);
|
||||
this.btnStrWrite.TabIndex = 10;
|
||||
this.btnStrWrite.Text = "SW";
|
||||
this.btnStrWrite.UseVisualStyleBackColor = true;
|
||||
this.btnStrWrite.Click += new System.EventHandler(this.btnStrWrite_Click);
|
||||
//
|
||||
// btnNumWriteB
|
||||
//
|
||||
this.btnNumWriteB.Location = new System.Drawing.Point(329, 5);
|
||||
this.btnNumWriteB.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnNumWriteB.Name = "btnNumWriteB";
|
||||
this.btnNumWriteB.Size = new System.Drawing.Size(48, 23);
|
||||
this.btnNumWriteB.TabIndex = 10;
|
||||
this.btnNumWriteB.Text = "B";
|
||||
this.btnNumWriteB.UseVisualStyleBackColor = true;
|
||||
this.btnNumWriteB.Click += new System.EventHandler(this.btnNumWriteB_Click);
|
||||
//
|
||||
// btnNumWriteDW
|
||||
//
|
||||
this.btnNumWriteDW.Location = new System.Drawing.Point(329, 44);
|
||||
this.btnNumWriteDW.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnNumWriteDW.Name = "btnNumWriteDW";
|
||||
this.btnNumWriteDW.Size = new System.Drawing.Size(48, 23);
|
||||
this.btnNumWriteDW.TabIndex = 10;
|
||||
this.btnNumWriteDW.Text = "DW";
|
||||
this.btnNumWriteDW.UseVisualStyleBackColor = true;
|
||||
this.btnNumWriteDW.Click += new System.EventHandler(this.btnNumWriteDW_Click);
|
||||
//
|
||||
// btnNumWriteW
|
||||
//
|
||||
this.btnNumWriteW.Location = new System.Drawing.Point(329, 23);
|
||||
this.btnNumWriteW.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.btnNumWriteW.Name = "btnNumWriteW";
|
||||
this.btnNumWriteW.Size = new System.Drawing.Size(48, 23);
|
||||
this.btnNumWriteW.TabIndex = 10;
|
||||
this.btnNumWriteW.Text = "W";
|
||||
this.btnNumWriteW.UseVisualStyleBackColor = true;
|
||||
this.btnNumWriteW.Click += new System.EventHandler(this.btnNumWriteW_Click);
|
||||
//
|
||||
// txtWriteVal2
|
||||
//
|
||||
this.txtWriteVal2.Location = new System.Drawing.Point(612, 25);
|
||||
this.txtWriteVal2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtWriteVal2.Name = "txtWriteVal2";
|
||||
this.txtWriteVal2.Size = new System.Drawing.Size(187, 22);
|
||||
this.txtWriteVal2.TabIndex = 8;
|
||||
this.txtWriteVal2.Text = "SAMUELEL";
|
||||
this.txtWriteVal2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// label9
|
||||
//
|
||||
this.label9.AutoSize = true;
|
||||
this.label9.Location = new System.Drawing.Point(571, 27);
|
||||
this.label9.Name = "label9";
|
||||
this.label9.Size = new System.Drawing.Size(36, 17);
|
||||
this.label9.TabIndex = 9;
|
||||
this.label9.Text = "STR";
|
||||
//
|
||||
// txtWriteVal1
|
||||
//
|
||||
this.txtWriteVal1.Location = new System.Drawing.Point(237, 25);
|
||||
this.txtWriteVal1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtWriteVal1.Name = "txtWriteVal1";
|
||||
this.txtWriteVal1.Size = new System.Drawing.Size(85, 22);
|
||||
this.txtWriteVal1.TabIndex = 8;
|
||||
this.txtWriteVal1.Text = "987654321";
|
||||
this.txtWriteVal1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// label8
|
||||
//
|
||||
this.label8.AutoSize = true;
|
||||
this.label8.Location = new System.Drawing.Point(197, 27);
|
||||
this.label8.Name = "label8";
|
||||
this.label8.Size = new System.Drawing.Size(39, 17);
|
||||
this.label8.TabIndex = 9;
|
||||
this.label8.Text = "NUM";
|
||||
//
|
||||
// txtWriteAddr2
|
||||
//
|
||||
this.txtWriteAddr2.Location = new System.Drawing.Point(448, 25);
|
||||
this.txtWriteAddr2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtWriteAddr2.Name = "txtWriteAddr2";
|
||||
this.txtWriteAddr2.Size = new System.Drawing.Size(116, 22);
|
||||
this.txtWriteAddr2.TabIndex = 6;
|
||||
this.txtWriteAddr2.Text = "DB600.DBB2";
|
||||
this.txtWriteAddr2.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// label10
|
||||
//
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(389, 27);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(59, 17);
|
||||
this.label10.TabIndex = 7;
|
||||
this.label10.Text = "ADDR 2";
|
||||
//
|
||||
// txtWriteAddr1
|
||||
//
|
||||
this.txtWriteAddr1.Location = new System.Drawing.Point(71, 25);
|
||||
this.txtWriteAddr1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtWriteAddr1.Name = "txtWriteAddr1";
|
||||
this.txtWriteAddr1.Size = new System.Drawing.Size(123, 22);
|
||||
this.txtWriteAddr1.TabIndex = 6;
|
||||
this.txtWriteAddr1.Text = "DB600.DBB0";
|
||||
this.txtWriteAddr1.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.Location = new System.Drawing.Point(5, 27);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Size = new System.Drawing.Size(59, 17);
|
||||
this.label7.TabIndex = 7;
|
||||
this.label7.Text = "ADDR 1";
|
||||
//
|
||||
// txtOut
|
||||
//
|
||||
this.txtOut.BackColor = System.Drawing.SystemColors.Desktop;
|
||||
this.txtOut.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtOut.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtOut.ForeColor = System.Drawing.Color.Yellow;
|
||||
this.txtOut.Location = new System.Drawing.Point(4, 21);
|
||||
this.txtOut.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.txtOut.Multiline = true;
|
||||
this.txtOut.Name = "txtOut";
|
||||
this.txtOut.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtOut.Size = new System.Drawing.Size(569, 388);
|
||||
this.txtOut.TabIndex = 0;
|
||||
this.txtOut.Text = "...";
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.AutoSize = true;
|
||||
this.groupBox2.Controls.Add(this.txtOut);
|
||||
this.groupBox2.Location = new System.Drawing.Point(3, 11);
|
||||
this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.groupBox2.Size = new System.Drawing.Size(579, 428);
|
||||
this.groupBox2.TabIndex = 9;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "Risultati";
|
||||
//
|
||||
// tabCtrl
|
||||
//
|
||||
this.tabCtrl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tabCtrl.Controls.Add(this.tabReadTest);
|
||||
this.tabCtrl.Controls.Add(this.tabWriteTest);
|
||||
this.tabCtrl.Controls.Add(this.tabParam);
|
||||
this.tabCtrl.Location = new System.Drawing.Point(15, 9);
|
||||
this.tabCtrl.Name = "tabCtrl";
|
||||
this.tabCtrl.SelectedIndex = 0;
|
||||
this.tabCtrl.Size = new System.Drawing.Size(879, 143);
|
||||
this.tabCtrl.TabIndex = 13;
|
||||
//
|
||||
// tabReadTest
|
||||
//
|
||||
this.tabReadTest.Controls.Add(this.groupBox1);
|
||||
this.tabReadTest.Location = new System.Drawing.Point(4, 25);
|
||||
this.tabReadTest.Name = "tabReadTest";
|
||||
this.tabReadTest.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabReadTest.Size = new System.Drawing.Size(871, 114);
|
||||
this.tabReadTest.TabIndex = 0;
|
||||
this.tabReadTest.Text = "Read Test";
|
||||
this.tabReadTest.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tabWriteTest
|
||||
//
|
||||
this.tabWriteTest.Controls.Add(this.groupBox4);
|
||||
this.tabWriteTest.Location = new System.Drawing.Point(4, 25);
|
||||
this.tabWriteTest.Name = "tabWriteTest";
|
||||
this.tabWriteTest.Size = new System.Drawing.Size(871, 114);
|
||||
this.tabWriteTest.TabIndex = 2;
|
||||
this.tabWriteTest.Text = "Write Test";
|
||||
this.tabWriteTest.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tabParam
|
||||
//
|
||||
this.tabParam.Controls.Add(this.groupBox3);
|
||||
this.tabParam.Location = new System.Drawing.Point(4, 25);
|
||||
this.tabParam.Name = "tabParam";
|
||||
this.tabParam.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.tabParam.Size = new System.Drawing.Size(871, 114);
|
||||
this.tabParam.TabIndex = 1;
|
||||
this.tabParam.Text = "Parametri";
|
||||
this.tabParam.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// splitContainer1
|
||||
//
|
||||
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.splitContainer1.Location = new System.Drawing.Point(15, 158);
|
||||
this.splitContainer1.Name = "splitContainer1";
|
||||
//
|
||||
// splitContainer1.Panel1
|
||||
//
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lblThroughtput);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label18);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lblTotSize);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lblTimeMin);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lblTimeMax);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.lblTimeAvg);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label16);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label15);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label14);
|
||||
this.splitContainer1.Panel1.Controls.Add(this.label12);
|
||||
//
|
||||
// splitContainer1.Panel2
|
||||
//
|
||||
this.splitContainer1.Panel2.Controls.Add(this.groupBox2);
|
||||
this.splitContainer1.Size = new System.Drawing.Size(875, 422);
|
||||
this.splitContainer1.SplitterDistance = 291;
|
||||
this.splitContainer1.TabIndex = 15;
|
||||
//
|
||||
// lblThroughtput
|
||||
//
|
||||
this.lblThroughtput.AutoSize = true;
|
||||
this.lblThroughtput.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblThroughtput.Location = new System.Drawing.Point(224, 105);
|
||||
this.lblThroughtput.Name = "lblThroughtput";
|
||||
this.lblThroughtput.Size = new System.Drawing.Size(35, 17);
|
||||
this.lblThroughtput.TabIndex = 9;
|
||||
this.lblThroughtput.Text = "000";
|
||||
this.lblThroughtput.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.AutoSize = true;
|
||||
this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label18.Location = new System.Drawing.Point(19, 105);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(57, 17);
|
||||
this.label18.TabIndex = 8;
|
||||
this.label18.Text = "Kb/sec";
|
||||
//
|
||||
// lblTotSize
|
||||
//
|
||||
this.lblTotSize.AutoSize = true;
|
||||
this.lblTotSize.Location = new System.Drawing.Point(227, 20);
|
||||
this.lblTotSize.Name = "lblTotSize";
|
||||
this.lblTotSize.Size = new System.Drawing.Size(32, 17);
|
||||
this.lblTotSize.TabIndex = 7;
|
||||
this.lblTotSize.Text = "000";
|
||||
this.lblTotSize.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// lblTimeMin
|
||||
//
|
||||
this.lblTimeMin.AutoSize = true;
|
||||
this.lblTimeMin.Location = new System.Drawing.Point(227, 41);
|
||||
this.lblTimeMin.Name = "lblTimeMin";
|
||||
this.lblTimeMin.Size = new System.Drawing.Size(32, 17);
|
||||
this.lblTimeMin.TabIndex = 6;
|
||||
this.lblTimeMin.Text = "000";
|
||||
this.lblTimeMin.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// lblTimeMax
|
||||
//
|
||||
this.lblTimeMax.AutoSize = true;
|
||||
this.lblTimeMax.Location = new System.Drawing.Point(227, 75);
|
||||
this.lblTimeMax.Name = "lblTimeMax";
|
||||
this.lblTimeMax.Size = new System.Drawing.Size(32, 17);
|
||||
this.lblTimeMax.TabIndex = 5;
|
||||
this.lblTimeMax.Text = "000";
|
||||
this.lblTimeMax.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// lblTimeAvg
|
||||
//
|
||||
this.lblTimeAvg.AutoSize = true;
|
||||
this.lblTimeAvg.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblTimeAvg.Location = new System.Drawing.Point(224, 58);
|
||||
this.lblTimeAvg.Name = "lblTimeAvg";
|
||||
this.lblTimeAvg.Size = new System.Drawing.Size(35, 17);
|
||||
this.lblTimeAvg.TabIndex = 4;
|
||||
this.lblTimeAvg.Text = "000";
|
||||
this.lblTimeAvg.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// label16
|
||||
//
|
||||
this.label16.AutoSize = true;
|
||||
this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label16.Location = new System.Drawing.Point(19, 58);
|
||||
this.label16.Name = "label16";
|
||||
this.label16.Size = new System.Drawing.Size(80, 17);
|
||||
this.label16.TabIndex = 3;
|
||||
this.label16.Text = "TIME: avg";
|
||||
//
|
||||
// label15
|
||||
//
|
||||
this.label15.AutoSize = true;
|
||||
this.label15.Location = new System.Drawing.Point(19, 75);
|
||||
this.label15.Name = "label15";
|
||||
this.label15.Size = new System.Drawing.Size(73, 17);
|
||||
this.label15.TabIndex = 2;
|
||||
this.label15.Text = "TIME: max";
|
||||
//
|
||||
// label14
|
||||
//
|
||||
this.label14.AutoSize = true;
|
||||
this.label14.Location = new System.Drawing.Point(19, 41);
|
||||
this.label14.Name = "label14";
|
||||
this.label14.Size = new System.Drawing.Size(70, 17);
|
||||
this.label14.TabIndex = 1;
|
||||
this.label14.Text = "TIME: min";
|
||||
//
|
||||
// label12
|
||||
//
|
||||
this.label12.AutoSize = true;
|
||||
this.label12.Location = new System.Drawing.Point(19, 20);
|
||||
this.label12.Name = "label12";
|
||||
this.label12.Size = new System.Drawing.Size(58, 17);
|
||||
this.label12.TabIndex = 0;
|
||||
this.label12.Text = "Tot size";
|
||||
//
|
||||
// cmbOutType
|
||||
//
|
||||
this.cmbOutType.FormattingEnabled = true;
|
||||
this.cmbOutType.Items.AddRange(new object[] {
|
||||
"byte",
|
||||
"word",
|
||||
"dword",
|
||||
"real",
|
||||
"struct"});
|
||||
this.cmbOutType.Location = new System.Drawing.Point(522, 23);
|
||||
this.cmbOutType.Name = "cmbOutType";
|
||||
this.cmbOutType.Size = new System.Drawing.Size(121, 24);
|
||||
this.cmbOutType.TabIndex = 16;
|
||||
this.cmbOutType.Text = "byte";
|
||||
this.cmbOutType.SelectedIndexChanged += new System.EventHandler(this.cmbOutType_SelectedIndexChanged);
|
||||
//
|
||||
// TestMainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(906, 611);
|
||||
this.Controls.Add(this.splitContainer1);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Controls.Add(this.tabCtrl);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "TestMainForm";
|
||||
this.Text = "SIEMENS S7 TEST";
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.groupBox3.ResumeLayout(false);
|
||||
this.groupBox3.PerformLayout();
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
this.groupBox4.ResumeLayout(false);
|
||||
this.groupBox4.PerformLayout();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
this.tabCtrl.ResumeLayout(false);
|
||||
this.tabReadTest.ResumeLayout(false);
|
||||
this.tabWriteTest.ResumeLayout(false);
|
||||
this.tabParam.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.ResumeLayout(false);
|
||||
this.splitContainer1.Panel1.PerformLayout();
|
||||
this.splitContainer1.Panel2.ResumeLayout(false);
|
||||
this.splitContainer1.Panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
|
||||
this.splitContainer1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txtIP;
|
||||
private System.Windows.Forms.Label lblIP;
|
||||
private System.Windows.Forms.ComboBox cbCpuType;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.TextBox txtMemArea;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox txtMemSize;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.TextBox txtSlot;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.TextBox txtRack;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Button btnReadByte;
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel tslConn;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
|
||||
private System.Windows.Forms.ToolStripProgressBar toolStripProgressBar1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel tslRTime;
|
||||
private System.Windows.Forms.GroupBox groupBox4;
|
||||
private System.Windows.Forms.Button btnStrWrite;
|
||||
private System.Windows.Forms.Button btnNumWriteW;
|
||||
private System.Windows.Forms.TextBox txtWriteVal2;
|
||||
private System.Windows.Forms.Label label9;
|
||||
private System.Windows.Forms.TextBox txtWriteVal1;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private System.Windows.Forms.TextBox txtWriteAddr1;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.TextBox txtWriteAddr2;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Button btnReadString;
|
||||
private System.Windows.Forms.Button btnReadWord;
|
||||
private System.Windows.Forms.Button btnReadDWord;
|
||||
private System.Windows.Forms.Button btnReadReal;
|
||||
private System.Windows.Forms.Button btnNumWriteB;
|
||||
private System.Windows.Forms.Button btnNumWriteDW;
|
||||
private System.Windows.Forms.Button btnReadStruct;
|
||||
private System.Windows.Forms.TextBox txtOut;
|
||||
private System.Windows.Forms.GroupBox groupBox2;
|
||||
private System.Windows.Forms.TabControl tabCtrl;
|
||||
private System.Windows.Forms.TabPage tabReadTest;
|
||||
private System.Windows.Forms.TabPage tabWriteTest;
|
||||
private System.Windows.Forms.TabPage tabParam;
|
||||
private System.Windows.Forms.SplitContainer splitContainer1;
|
||||
private System.Windows.Forms.Label label11;
|
||||
private System.Windows.Forms.TextBox txtNumRep;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.Label lblTotSize;
|
||||
private System.Windows.Forms.Label lblTimeMin;
|
||||
private System.Windows.Forms.Label lblTimeMax;
|
||||
private System.Windows.Forms.Label lblTimeAvg;
|
||||
private System.Windows.Forms.Label label16;
|
||||
private System.Windows.Forms.Label label15;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.Label lblThroughtput;
|
||||
private System.Windows.Forms.Label label18;
|
||||
private System.Windows.Forms.ComboBox cmbOutType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,904 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using S7.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Net;
|
||||
using NLog;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Threading;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
public partial class TestMainForm : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Configurazione valori da LEGGERE dal PLC
|
||||
/// </summary>
|
||||
public otherData[] memMapR;
|
||||
/// <summary>
|
||||
/// Configurazione valori da SCRIVERE nel PLC
|
||||
/// </summary>
|
||||
public otherData[] memMapW;
|
||||
/// <summary>
|
||||
/// Byte dimensione buffer dati memoria (da file map)
|
||||
/// </summary>
|
||||
public int numByte = 0;
|
||||
/// <summary>
|
||||
/// Lungh massima stringhe
|
||||
/// </summary>
|
||||
protected int maxStrChar = 20;
|
||||
/// <summary>
|
||||
/// Oggetto PLC da ri-utilizzare...
|
||||
/// </summary>
|
||||
protected Plc currPLC;
|
||||
/// <summary>
|
||||
/// indica se serva refresh parametri e quindi PLC...
|
||||
/// </summary>
|
||||
bool needRefresh = true;
|
||||
/// <summary>
|
||||
/// Oggetto cronometro x test vari...
|
||||
/// </summary>
|
||||
protected Stopwatch sw = new Stopwatch();
|
||||
/// <summary>
|
||||
/// parametri di connessione
|
||||
/// </summary>
|
||||
protected connParam parametri;
|
||||
/// <summary>
|
||||
/// titolo x log/debug
|
||||
/// </summary>
|
||||
protected string titolo = "";
|
||||
/// <summary>
|
||||
/// contenuto x log/debug
|
||||
/// </summary>
|
||||
protected string contenuto = "";
|
||||
/// <summary>
|
||||
/// oggetto logging
|
||||
/// </summary>
|
||||
public static Logger lg;
|
||||
/// <summary>
|
||||
/// oggetto uiTimer
|
||||
/// </summary>
|
||||
protected System.Windows.Forms.Timer uiTimer = new System.Windows.Forms.Timer();
|
||||
/// <summary>
|
||||
/// Gestione statistiche
|
||||
/// </summary>
|
||||
public TimingData PerfStats;
|
||||
/// <summary>
|
||||
/// Array oggetti letti
|
||||
/// </summary>
|
||||
protected Byte[] memByteRead = new byte[0];
|
||||
|
||||
public TestMainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
myInit();
|
||||
|
||||
startUiTimer();
|
||||
}
|
||||
|
||||
private void startUiTimer()
|
||||
{
|
||||
uiTimer.Tick += UiTimer_Tick;
|
||||
uiTimer.Start();
|
||||
}
|
||||
|
||||
private void UiTimer_Tick(object sender, EventArgs e)
|
||||
{
|
||||
advProgBar();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// inizializzo
|
||||
/// </summary>
|
||||
private void myInit()
|
||||
{
|
||||
lg = LogManager.GetCurrentClassLogger();
|
||||
PerfStats = new TimingData();
|
||||
// inizializzo parametri...
|
||||
parametri = new connParam()
|
||||
{
|
||||
ipAdrr = "127.0.0.1",
|
||||
tipoCpu = CpuType.S7200,
|
||||
slot = 0,
|
||||
rack = 0
|
||||
};
|
||||
setParamPlc();
|
||||
// timer
|
||||
uiTimer.Interval = 20;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imposto parametri PLC
|
||||
/// </summary>
|
||||
private void setParamPlc()
|
||||
{
|
||||
txtOut.Text = "";
|
||||
// SE è necessario refresh...
|
||||
if (needRefresh)
|
||||
{
|
||||
lg.Info("Refreshing connection...");
|
||||
try
|
||||
{
|
||||
short.TryParse(txtSlot.Text, out parametri.slot);
|
||||
short.TryParse(txtRack.Text, out parametri.rack);
|
||||
parametri.tipoCpu = (CpuType)Enum.Parse(typeof(CpuType), cbCpuType.SelectedItem.ToString());
|
||||
parametri.ipAdrr = txtIP.Text.Trim();
|
||||
titolo = "PARAM PLC (pre connect)";
|
||||
contenuto = string.Format("IP: {0}{1}", parametri.ipAdrr, Environment.NewLine);
|
||||
contenuto += string.Format("CPU: {0}{1}", parametri.tipoCpu, Environment.NewLine);
|
||||
contenuto += string.Format("RACK: {0}{1}", parametri.rack, Environment.NewLine);
|
||||
contenuto += string.Format("SLOT: {0}", parametri.slot, Environment.NewLine);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(exc, "Errore in parse parametri");
|
||||
}
|
||||
// ora tento avvio PLC... SE PING OK...
|
||||
if (testPing() == IPStatus.Success)
|
||||
{
|
||||
try
|
||||
{
|
||||
currPLC = new Plc(parametri.tipoCpu, parametri.ipAdrr, parametri.rack, parametri.slot);
|
||||
currPLC.Open();
|
||||
if (currPLC.IsConnected) titolo = "CONNESSIONE AVVENUTA";
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
lg.Error(exc, "Errore in INIT PLC");
|
||||
}
|
||||
needRefresh = false;
|
||||
}
|
||||
// carico conf vettore memoria...
|
||||
loadMemConf();
|
||||
// mostra output
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Caricamento conf memoria DB del SIEMENS
|
||||
/// </summary>
|
||||
private void loadMemConf()
|
||||
{
|
||||
// carico conf memoria
|
||||
utils.loadConfFile(ref memMapR, filePath("MMapR"), 1, ref numByte);
|
||||
utils.loadConfFile(ref memMapW, filePath("MMapW"), 1, ref numByte);
|
||||
}
|
||||
/// <summary>
|
||||
/// Restituisce path completo file da chaive configurazione
|
||||
/// </summary>
|
||||
/// <param name="keyFile">chaive conf x file richiesto</param>
|
||||
/// <returns></returns>
|
||||
protected string filePath(string keyFile)
|
||||
{
|
||||
return string.Format(@"{0}\{1}", utils.confDir, utils.CRS(keyFile));
|
||||
}
|
||||
/// <summary>
|
||||
/// Aggiorno statistiche mostrate
|
||||
/// </summary>
|
||||
protected void updateStats()
|
||||
{
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
int numTest = 1;
|
||||
int.TryParse(txtNumRep.Text, out numTest);
|
||||
lblTimeMin.Text = $"{PerfStats.currStat.min} ms";
|
||||
lblTimeMax.Text = $"{PerfStats.currStat.max} ms";
|
||||
lblTimeAvg.Text = $"{PerfStats.currStat.avg} ms";
|
||||
lblTotSize.Text = $"{numByte * numTest / 1024} kb";
|
||||
lblThroughtput.Text = $"{numByte / (1024 * PerfStats.currStat.avg) * 1000} bps";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione lettura!
|
||||
/// </summary>
|
||||
private void eseguiLetturaByte()
|
||||
{
|
||||
PerfStats = new TimingData();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtMemArea.Text);
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
int numTest = 1;
|
||||
int.TryParse(txtNumRep.Text, out numTest);
|
||||
//tslRTime.Text = "Start reading BYTE";
|
||||
//tslRTime.Invalidate();
|
||||
// effettuo numero di test secondo indicazioni...
|
||||
for (int i = 0; i < numTest; i++)
|
||||
{
|
||||
sw.Restart();
|
||||
// eseguo test
|
||||
memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
sw.Stop();
|
||||
// salvo risultati
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
// mostro update lettura
|
||||
updateStats();
|
||||
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
titolo = string.Format("READ BLOCK MEM BYTE: {0} --> {1} byte", txtMemArea.Text, numByte);
|
||||
contenuto = "";
|
||||
string byteVal = "";
|
||||
// verifico se mostrare dati in modalità struct o meno...
|
||||
|
||||
for (int i = 0; i < memByteRead.Length; i++)
|
||||
{
|
||||
byteVal = Convert.ToString(memByteRead[i], 2).PadLeft(8, '0');
|
||||
contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, memByteRead[i], Environment.NewLine);
|
||||
}
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Esecuzione lettura WORD!
|
||||
/// </summary>
|
||||
private void eseguiLetturaWord()
|
||||
{
|
||||
PerfStats = new TimingData();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtMemArea.Text);
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
int numTest = 1;
|
||||
int.TryParse(txtNumRep.Text, out numTest);
|
||||
// effettuo numero di test secondo indicazioni...
|
||||
for (int i = 0; i < numTest; i++)
|
||||
{
|
||||
sw.Restart();
|
||||
// eseguo test
|
||||
memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
sw.Stop();
|
||||
// salvo risultati
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
// mostro update lettura
|
||||
updateStats();
|
||||
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
titolo = string.Format("READ BLOCK MEM WORD: {0} --> {1} byte", txtMemArea.Text, numByte);
|
||||
contenuto = "";
|
||||
ushort shortVal = 0;
|
||||
string byteValA = "";
|
||||
string byteValB = "";
|
||||
for (int i = 0; i < memByteRead.Length / 2; i++)
|
||||
{
|
||||
byteValA = Convert.ToString(memByteRead[i * 2], 2).PadLeft(8, '0');
|
||||
byteValB = Convert.ToString(memByteRead[i * 2 + 1], 2).PadLeft(8, '0');
|
||||
shortVal = S7.Net.Types.Word.FromByteArray(memByteRead.Skip(2 * i).Take(2).ToArray());
|
||||
contenuto += string.Format("W{0:000}: {1} | {2}-{3}{4}", i, shortVal, byteValA, byteValB, Environment.NewLine);
|
||||
}
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione lettura DWORD!
|
||||
/// </summary>
|
||||
private void eseguiLetturaDWord()
|
||||
{
|
||||
PerfStats = new TimingData();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtMemArea.Text);
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
int numTest = 1;
|
||||
int.TryParse(txtNumRep.Text, out numTest);
|
||||
for (int i = 0; i < numTest; i++)
|
||||
{
|
||||
sw.Restart();
|
||||
// eseguo test
|
||||
memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
sw.Stop();
|
||||
// salvo risultati
|
||||
PerfStats.addValue((double)sw.ElapsedMilliseconds);
|
||||
}
|
||||
|
||||
// mostro update lettura
|
||||
updateStats();
|
||||
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
titolo = string.Format("READ BLOCK MEM WORD: {0} --> {1} byte", txtMemArea.Text, numByte);
|
||||
contenuto = "";
|
||||
uint intVal = 0;
|
||||
string byteValA = "";
|
||||
string byteValB = "";
|
||||
string byteValC = "";
|
||||
string byteValD = "";
|
||||
for (int i = 0; i < memByteRead.Length / 4; i++)
|
||||
{
|
||||
byteValA = Convert.ToString(memByteRead[i * 4], 2).PadLeft(8, '0');
|
||||
byteValB = Convert.ToString(memByteRead[i * 4 + 1], 2).PadLeft(8, '0');
|
||||
byteValC = Convert.ToString(memByteRead[i * 4 + 2], 2).PadLeft(8, '0');
|
||||
byteValD = Convert.ToString(memByteRead[i * 4 + 3], 2).PadLeft(8, '0');
|
||||
intVal = S7.Net.Types.DWord.FromByteArray(memByteRead.Skip(4 * i).Take(4).ToArray());
|
||||
contenuto += string.Format("W{0:000}: {1} | {2}-{3}-{4}-{5}{6}", i, intVal, byteValA, byteValB, byteValC, byteValD, Environment.NewLine);
|
||||
}
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Esecuzione lettura come struct
|
||||
/// </summary>
|
||||
private void eseguiLetturaStruct()
|
||||
{
|
||||
sw.Restart();
|
||||
if (testCncConn())
|
||||
{
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
titolo = string.Format("READ STRUCT: {0} --> {1} byte", txtMemArea.Text, numByte);
|
||||
|
||||
//leggo a ciclo una singola struct...
|
||||
|
||||
int numPar = 50;
|
||||
ThermoParam objPar = new ThermoParam();
|
||||
List<ThermoParam> ElencoParametri = new List<ThermoParam>();
|
||||
for (int i = 0; i < numPar; i++)
|
||||
{
|
||||
objPar = (ThermoParam)currPLC.ReadClass<ThermoParam>(600, i * 20);
|
||||
ElencoParametri.Add(objPar);
|
||||
}
|
||||
sw.Stop();
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
|
||||
foreach (var item in ElencoParametri)
|
||||
{
|
||||
contenuto += $"Id: {item.Id}{Environment.NewLine}";
|
||||
contenuto += $"SetpointHMI: {item.SetpointHMI}{Environment.NewLine}";
|
||||
contenuto += $"SetpointPLC: {item.SetpointPLC}{Environment.NewLine}";
|
||||
contenuto += $"ValMin: {item.ValMin}{Environment.NewLine}";
|
||||
contenuto += $"ValMax: {item.ValMax}{Environment.NewLine}";
|
||||
contenuto += $"UnitMeasure: {item.UnitMeasure}{Environment.NewLine}";
|
||||
contenuto += $"---------{Environment.NewLine}";
|
||||
}
|
||||
|
||||
|
||||
#if false
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtMemArea.Text);
|
||||
Byte[] memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
contenuto = "";
|
||||
ushort shortVal = 0;
|
||||
string byteValA = "";
|
||||
string byteValB = "";
|
||||
for (int i = 0; i < memByteRead.Length / 2; i++)
|
||||
{
|
||||
byteValA = Convert.ToString(memByteRead[i * 2], 2).PadLeft(8, '0');
|
||||
byteValB = Convert.ToString(memByteRead[i * 2 + 1], 2).PadLeft(8, '0');
|
||||
shortVal = S7.Net.Types.Word.FromByteArray(memByteRead.Skip(2 * i).Take(2).ToArray());
|
||||
contenuto += string.Format("W{0:000}: {1} | {2}-{3}{4}", i, shortVal, byteValA, byteValB, Environment.NewLine);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
}
|
||||
protected void animateProgBar()
|
||||
{
|
||||
uiTimer.Interval = 20;
|
||||
}
|
||||
|
||||
protected void advProgBar()
|
||||
{
|
||||
toolStripProgressBar1.ProgressBar.Value++;
|
||||
if (toolStripProgressBar1.ProgressBar.Value >= toolStripProgressBar1.ProgressBar.Maximum)
|
||||
{
|
||||
toolStripProgressBar1.ProgressBar.Value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione lettura Real!
|
||||
/// </summary>
|
||||
private void eseguiLetturaReal()
|
||||
{
|
||||
sw.Restart();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtMemArea.Text);
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
Byte[] memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
titolo = string.Format("READ BLOCK MEM WORD: {0} --> {1} byte", txtMemArea.Text, numByte);
|
||||
contenuto = "";
|
||||
double realVal = 0;
|
||||
string byteValA = "";
|
||||
string byteValB = "";
|
||||
string byteValC = "";
|
||||
string byteValD = "";
|
||||
for (int i = 0; i < memByteRead.Length / 4; i++)
|
||||
{
|
||||
byteValA = Convert.ToString(memByteRead[i * 4], 2).PadLeft(8, '0');
|
||||
byteValB = Convert.ToString(memByteRead[i * 4 + 1], 2).PadLeft(8, '0');
|
||||
byteValC = Convert.ToString(memByteRead[i * 4 + 2], 2).PadLeft(8, '0');
|
||||
byteValD = Convert.ToString(memByteRead[i * 4 + 3], 2).PadLeft(8, '0');
|
||||
realVal = S7.Net.Types.Double.FromByteArray(memByteRead.Skip(4 * i).Take(4).ToArray());
|
||||
contenuto += string.Format("W{0:000}: {1} | {2}-{3}-{4}-{5}{6}", i, realVal, byteValA, byteValB, byteValC, byteValD, Environment.NewLine);
|
||||
}
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
sw.Stop();
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Esecuzione lettura tipo STRING!
|
||||
/// </summary>
|
||||
private void eseguiLetturaString()
|
||||
{
|
||||
sw.Restart();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtMemArea.Text);
|
||||
int numByte = 1;
|
||||
int.TryParse(txtMemSize.Text, out numByte);
|
||||
Byte[] memByteRead = currPLC.ReadBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, numByte);
|
||||
sw.Stop();
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
titolo = string.Format("READ BLOCK MEM STRING: {0} --> {1} byte", txtMemArea.Text, numByte);
|
||||
contenuto = "";
|
||||
string byteVal = "";
|
||||
// i primi 2 byte sono LUNGHEZZA MAX e lungh effettiva quindi setto il NUM BYTE....
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
byteVal = Convert.ToString(memByteRead[i], 2).PadLeft(8, '0');
|
||||
contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, memByteRead[i], Environment.NewLine);
|
||||
}
|
||||
// prendo 2° valore (num max valori)
|
||||
numByte = memByteRead[1];
|
||||
// poi prendo la stringa...
|
||||
string outVal = "";
|
||||
for (int i = 2; i < numByte + 2; i++)
|
||||
{
|
||||
outVal += Char.ConvertFromUtf32(memByteRead[i]);
|
||||
}
|
||||
contenuto += string.Format("{0}{1}", outVal, Environment.NewLine);
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Test connessione CNC
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private bool testCncConn()
|
||||
{
|
||||
bool answ = false;
|
||||
IPStatus pingStatus = testPing();
|
||||
// se passa il ping faccio il resto...
|
||||
if (pingStatus != IPStatus.Success)
|
||||
{
|
||||
titolo = "Errore ping";
|
||||
contenuto = string.Format("Reply Status per {0}: {1}", parametri.ipAdrr, pingStatus);
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currPLC.IsConnected) currPLC.Open();
|
||||
bool excludeAvailable = true;
|
||||
if (excludeAvailable)
|
||||
{
|
||||
if (!currPLC.IsConnected)
|
||||
{
|
||||
titolo = "Errore connessione";
|
||||
//contenuto = string.Format("{0} | {1}", currPLC.LastErrorCode, currPLC.LastErrorString);
|
||||
//currPLC.ClearLastError();
|
||||
contenuto = "!currPLC.IsConnected";
|
||||
showOut(titolo, contenuto);
|
||||
tslConn.Text = "NO Connection";
|
||||
}
|
||||
else
|
||||
{
|
||||
tslConn.Text = "Connection OK";
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currPLC.IsAvailable)
|
||||
{
|
||||
titolo = "Errore Disponibilità";
|
||||
//contenuto = string.Format("{0} | {1}", currPLC.LastErrorCode, currPLC.LastErrorString);
|
||||
//currPLC.ClearLastError();
|
||||
contenuto = "!currPLC.IsAvailable";
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!currPLC.IsConnected)
|
||||
{
|
||||
titolo = "Errore connessione";
|
||||
//contenuto = string.Format("{0} | {1}", currPLC.LastErrorCode, currPLC.LastErrorString);
|
||||
//currPLC.ClearLastError();
|
||||
contenuto = "!currPLC.IsConnected";
|
||||
showOut(titolo, contenuto);
|
||||
tslConn.Text = "NO Connection";
|
||||
}
|
||||
else
|
||||
{
|
||||
tslConn.Text = "Connection OK";
|
||||
answ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// test ping all'indirizzo impostato nei parametri
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IPStatus testPing()
|
||||
{
|
||||
IPStatus answ = IPStatus.Unknown; ;
|
||||
IPAddress address;
|
||||
PingReply reply;
|
||||
Ping pingSender = new Ping();
|
||||
address = IPAddress.Loopback;
|
||||
IPAddress.TryParse(parametri.ipAdrr, out address);
|
||||
reply = pingSender.Send(address, 100);
|
||||
answ = reply.Status;
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// formatta un numero in forma binaria 0/1 a 32 bit (4 byte)
|
||||
/// </summary>
|
||||
/// <param name="valore"></param>
|
||||
/// <returns></returns>
|
||||
public static string binaryForm(int valore)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = string.Format(new BinaryFormat(), "{0:B}", valore);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// aggiorna display in base a selezione tipo output...
|
||||
/// </summary>
|
||||
/// <param name="title"></param>
|
||||
/// <param name="content"></param>
|
||||
protected void showOut(string title, string content)
|
||||
{
|
||||
// verifico combo e formatto...
|
||||
contenuto = "";
|
||||
string byteVal = "";
|
||||
ushort shortVal = 0;
|
||||
uint intVal = 0;
|
||||
string byteValA = "";
|
||||
string byteValB = "";
|
||||
string byteValC = "";
|
||||
string byteValD = "";
|
||||
// verifico come mostrare dati (byte, word, struct ...)
|
||||
switch (cmbOutType.SelectedItem)
|
||||
{
|
||||
case "word":
|
||||
for (int i = 0; i < memByteRead.Length / 2; i++)
|
||||
{
|
||||
byteValA = Convert.ToString(memByteRead[i * 2], 2).PadLeft(8, '0');
|
||||
byteValB = Convert.ToString(memByteRead[i * 2 + 1], 2).PadLeft(8, '0');
|
||||
shortVal = S7.Net.Types.Word.FromByteArray(memByteRead.Skip(2 * i).Take(2).ToArray());
|
||||
contenuto += string.Format("W{0:000}: {1} | {2}-{3}{4}", i, shortVal, byteValA, byteValB, Environment.NewLine);
|
||||
}
|
||||
break;
|
||||
case "dword":
|
||||
for (int i = 0; i < memByteRead.Length / 4; i++)
|
||||
{
|
||||
byteValA = Convert.ToString(memByteRead[i * 4], 2).PadLeft(8, '0');
|
||||
byteValB = Convert.ToString(memByteRead[i * 4 + 1], 2).PadLeft(8, '0');
|
||||
byteValC = Convert.ToString(memByteRead[i * 4 + 2], 2).PadLeft(8, '0');
|
||||
byteValD = Convert.ToString(memByteRead[i * 4 + 3], 2).PadLeft(8, '0');
|
||||
intVal = S7.Net.Types.DWord.FromByteArray(memByteRead.Skip(4 * i).Take(4).ToArray());
|
||||
contenuto += string.Format("W{0:000}: {1} | {2}-{3}-{4}-{5}{6}", i, intVal, byteValA, byteValB, byteValC, byteValD, Environment.NewLine);
|
||||
}
|
||||
break;
|
||||
case "struct":
|
||||
ThermoParam objPar = new ThermoParam();
|
||||
List<ThermoParam> ElencoParametri = new List<ThermoParam>();
|
||||
IFormatter formatter = new BinaryFormatter();
|
||||
// procedo 20 byte alla volta...
|
||||
for (int i = 0; i < memByteRead.Length / 20; i++)
|
||||
{
|
||||
objPar = SerDeserExtensions.Deserializer<ThermoParam>(memByteRead.Skip(20 * i).Take(20).ToArray());
|
||||
ElencoParametri.Add(objPar);
|
||||
}
|
||||
foreach (var item in ElencoParametri)
|
||||
{
|
||||
contenuto += $"Id: {item.Id}{Environment.NewLine}";
|
||||
contenuto += $"SetpointHMI: {item.SetpointHMI}{Environment.NewLine}";
|
||||
contenuto += $"SetpointPLC: {item.SetpointPLC}{Environment.NewLine}";
|
||||
contenuto += $"ValMin: {item.ValMin}{Environment.NewLine}";
|
||||
contenuto += $"ValMax: {item.ValMax}{Environment.NewLine}";
|
||||
contenuto += $"UnitMeasure: {item.UnitMeasure}{Environment.NewLine}";
|
||||
contenuto += $"---------{Environment.NewLine}";
|
||||
}
|
||||
break;
|
||||
case "byte":
|
||||
default:
|
||||
for (int i = 0; i < memByteRead.Length; i++)
|
||||
{
|
||||
byteVal = Convert.ToString(memByteRead[i], 2).PadLeft(8, '0');
|
||||
contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, memByteRead[i], Environment.NewLine);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string outText = "";
|
||||
// a video
|
||||
outText += string.Format("{0}--------------------------------------------------------------------------------------{0}", Environment.NewLine);
|
||||
outText += string.Format("- {0}{1}", titolo, Environment.NewLine);
|
||||
outText += string.Format("--------------------------------------------------------------------------------------{0}", Environment.NewLine);
|
||||
outText += string.Format("{0}{1}", contenuto, Environment.NewLine);
|
||||
outText += string.Format("--------------------------------------------------------------------------------------{0}{0}", Environment.NewLine);
|
||||
|
||||
// aggiorno visualizzazione
|
||||
txtOut.Text = outText;
|
||||
// loggo!
|
||||
lg.Info(outText);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esecuzione SCRITTURA Byte!
|
||||
/// </summary>
|
||||
private void eseguiScritturaByte()
|
||||
{
|
||||
sw.Restart();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtWriteAddr1.Text);
|
||||
byte num2write = 0;
|
||||
string val2write = txtWriteVal2.Text;
|
||||
byte.TryParse(txtWriteVal1.Text, out num2write);
|
||||
byte[] DB_Byte = new byte[1];
|
||||
DB_Byte[0] = num2write;
|
||||
currPLC.WriteBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, DB_Byte);
|
||||
titolo = string.Format("WRITE BLOCK MEM: {0}", txtWriteAddr1.Text);
|
||||
contenuto = "";
|
||||
contenuto += string.Format("DT: {0} | DbNum: {1} | indiceMem: {2} | num2write: {3}{4}{4}", DataType.DataBlock, memoria.DbNum, memoria.indiceMem, num2write, Environment.NewLine);
|
||||
string byteVal = "";
|
||||
for (int i = 0; i < DB_Byte.Length; i++)
|
||||
{
|
||||
byteVal = Convert.ToString(DB_Byte[i], 2).PadLeft(8, '0');
|
||||
contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, DB_Byte[i], Environment.NewLine);
|
||||
}
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
sw.Stop();
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Esecuzione SCRITTURA WORD!
|
||||
/// </summary>
|
||||
private void eseguiScritturaWord()
|
||||
{
|
||||
sw.Restart();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtWriteAddr1.Text);
|
||||
UInt16 num2write = 0;
|
||||
string val2write = txtWriteVal2.Text;
|
||||
UInt16.TryParse(txtWriteVal1.Text, out num2write);
|
||||
byte[] DB_Byte = new byte[2];
|
||||
S7.Net.Types.Word.ToByteArray(num2write).CopyTo(DB_Byte, 0);
|
||||
currPLC.WriteBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, DB_Byte);
|
||||
titolo = string.Format("WRITE BLOCK MEM: {0}", txtWriteAddr1.Text);
|
||||
contenuto = "";
|
||||
contenuto += string.Format("DT: {0} | DbNum: {1} | indiceMem: {2} | num2write: {3}{4}{4}", DataType.DataBlock, memoria.DbNum, memoria.indiceMem, num2write, Environment.NewLine);
|
||||
string byteVal = "";
|
||||
for (int i = 0; i < DB_Byte.Length; i++)
|
||||
{
|
||||
byteVal = Convert.ToString(DB_Byte[i], 2).PadLeft(8, '0');
|
||||
contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, DB_Byte[i], Environment.NewLine);
|
||||
}
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
sw.Stop();
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Esecuzione SCRITTURA DWORD!
|
||||
/// </summary>
|
||||
private void eseguiScritturaDWord()
|
||||
{
|
||||
sw.Restart();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtWriteAddr1.Text);
|
||||
uint num2write = 0;
|
||||
string val2write = txtWriteVal2.Text;
|
||||
uint.TryParse(txtWriteVal1.Text, out num2write);
|
||||
byte[] DB_Byte = new byte[4];
|
||||
S7.Net.Types.DWord.ToByteArray(num2write).CopyTo(DB_Byte, 0);
|
||||
currPLC.WriteBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, DB_Byte);
|
||||
titolo = string.Format("WRITE BLOCK MEM: {0}", txtWriteAddr1.Text);
|
||||
contenuto = "";
|
||||
contenuto += string.Format("DT: {0} | DbNum: {1} | indiceMem: {2} | num2write: {3}{4}{4}", DataType.DataBlock, memoria.DbNum, memoria.indiceMem, num2write, Environment.NewLine);
|
||||
string byteVal = "";
|
||||
for (int i = 0; i < DB_Byte.Length; i++)
|
||||
{
|
||||
byteVal = Convert.ToString(DB_Byte[i], 2).PadLeft(8, '0');
|
||||
contenuto += string.Format("B{0:000}: {1} | {2}{3}", i, byteVal, DB_Byte[i], Environment.NewLine);
|
||||
}
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
sw.Stop();
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
}
|
||||
/// <summary>
|
||||
/// Esecuzione SCRITTURA String!
|
||||
/// </summary>
|
||||
private void eseguiScritturaString()
|
||||
{
|
||||
sw.Restart();
|
||||
if (testCncConn())
|
||||
{
|
||||
// decodifico memoria...
|
||||
memAddress memoria = new memAddress(txtWriteAddr2.Text);
|
||||
int num2write = 0;
|
||||
// verifico di no sforare con lunghezza
|
||||
string val2write = txtWriteVal2.Text;
|
||||
// se è maggiore di maxStrChar TRIMMA:::
|
||||
if (val2write.Length > maxStrChar)
|
||||
{
|
||||
val2write = val2write.Substring(0, 20);
|
||||
}
|
||||
// scambio spazi con underscore... e MAIUSCOLO!!!
|
||||
val2write = val2write.Replace(' ', '_').ToUpper();
|
||||
num2write = val2write.Length;
|
||||
byte[] DB_Byte = new byte[maxStrChar + 2];
|
||||
// primi 2 byte sono 20 (fix) e lung effettiva...
|
||||
DB_Byte[0] = 20;
|
||||
DB_Byte[1] = (byte)num2write;
|
||||
// converto 1-1 i char in byte...
|
||||
for (int i = 0; i < num2write; i++)
|
||||
{
|
||||
DB_Byte[2 + i] = (byte)(val2write[i]);
|
||||
}
|
||||
currPLC.WriteBytes(DataType.DataBlock, memoria.DbNum, memoria.indiceMem, DB_Byte);
|
||||
titolo = string.Format("WRITE BLOCK MEM: {0}", txtWriteAddr1.Text);
|
||||
contenuto = "";
|
||||
contenuto += string.Format("DT: {0} | DbNum: {1} | indiceMem: {2} | stringa: {3}{4}{4}", DataType.DataBlock, memoria.DbNum, memoria.indiceMem, num2write, Environment.NewLine);
|
||||
showOut(titolo, contenuto);
|
||||
}
|
||||
sw.Stop();
|
||||
tslRTime.Text = string.Format("{0}", sw.Elapsed);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Scrivo memoria tipo STRING
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnStrWrite_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiScritturaString();
|
||||
}
|
||||
|
||||
private void txtIP_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
needRefresh = true;
|
||||
}
|
||||
|
||||
private void txtRack_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
needRefresh = true;
|
||||
}
|
||||
|
||||
private void cbCpuType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
needRefresh = true;
|
||||
}
|
||||
|
||||
private void txtSlot_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
needRefresh = true;
|
||||
}
|
||||
|
||||
private void txtMemArea_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
needRefresh = true;
|
||||
}
|
||||
|
||||
private void txtMemSize_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
needRefresh = true;
|
||||
}
|
||||
|
||||
private void btnReadByte_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiLetturaByte();
|
||||
}
|
||||
|
||||
private void btnReadWord_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiLetturaWord();
|
||||
}
|
||||
|
||||
private void btnReadString_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiLetturaString();
|
||||
}
|
||||
|
||||
private void btnReadDWord_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiLetturaDWord();
|
||||
}
|
||||
/// <summary>
|
||||
/// Lettura real
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnReadReal_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiLetturaReal();
|
||||
}
|
||||
|
||||
private void btnNumWriteB_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiScritturaByte();
|
||||
}
|
||||
|
||||
private void btnNumWriteDW_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiScritturaDWord();
|
||||
}
|
||||
|
||||
private void btnNumWriteW_Click(object sender, EventArgs e)
|
||||
{
|
||||
setParamPlc();
|
||||
eseguiScritturaWord();
|
||||
}
|
||||
|
||||
private void btnReadStruct_Click(object sender, EventArgs e)
|
||||
{
|
||||
// effettua lettura intera struct...
|
||||
setParamPlc();
|
||||
eseguiLetturaStruct();
|
||||
}
|
||||
|
||||
private void cmbOutType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
showOut("", "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
[Serializable]
|
||||
public class ThermoParam
|
||||
{
|
||||
public ushort Id;
|
||||
public UInt32 SetpointHMI;
|
||||
public UInt32 SetpointPLC;
|
||||
public UInt32 ValMax;
|
||||
public UInt32 ValMin;
|
||||
public ushort UnitMeasure;
|
||||
}
|
||||
|
||||
|
||||
//public T Deserialize<T>(byte[] param)
|
||||
//{
|
||||
// using (MemoryStream ms = new MemoryStream(param))
|
||||
// {
|
||||
// IFormatter br = new BinaryFormatter();
|
||||
// return (T)br.Deserialize(ms);
|
||||
// }
|
||||
//}
|
||||
|
||||
public static class SerDeserExtensions
|
||||
{
|
||||
public static byte[] Serializer(this object _object)
|
||||
{
|
||||
byte[] bytes;
|
||||
using (var _MemoryStream = new MemoryStream())
|
||||
{
|
||||
IFormatter _BinaryFormatter = new BinaryFormatter();
|
||||
_BinaryFormatter.Serialize(_MemoryStream, _object);
|
||||
bytes = _MemoryStream.ToArray();
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static T Deserializer<T>(this byte[] _byteArray)
|
||||
{
|
||||
T ReturnValue;
|
||||
using (var _MemoryStream = new MemoryStream(_byteArray))
|
||||
{
|
||||
IFormatter _BinaryFormatter = new BinaryFormatter();
|
||||
ReturnValue = (T)_BinaryFormatter.Deserialize(_MemoryStream);
|
||||
}
|
||||
return ReturnValue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
public class TimingData
|
||||
{
|
||||
/// <summary>
|
||||
/// Array dei valori rilevati in secondi
|
||||
/// </summary>
|
||||
protected List<double> valori { get; set; }
|
||||
/// <summary>
|
||||
/// Statistiche attuali
|
||||
/// </summary>
|
||||
public stats currStat;
|
||||
/// <summary>
|
||||
/// Tipo dei dati salvato
|
||||
/// </summary>
|
||||
public string Tipo { get; set; }
|
||||
public TimingData()
|
||||
{
|
||||
valori = new List<double>();
|
||||
currStat = new stats();
|
||||
}
|
||||
/// <summary>
|
||||
/// aggiunge dati e restituisce statistiche aggiornate...
|
||||
/// </summary>
|
||||
/// <param name="valore"></param>
|
||||
/// <returns></returns>
|
||||
public void addValue(double valore)
|
||||
{
|
||||
valori.Add(valore);
|
||||
currStat.min = valori.Min();
|
||||
currStat.max = valori.Max();
|
||||
currStat.avg = valori.Average();
|
||||
currStat.num = valori.Count;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Struttura risultati
|
||||
/// </summary>
|
||||
public struct stats
|
||||
{
|
||||
public double min;
|
||||
public double max;
|
||||
public double avg;
|
||||
public int num;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using S7.Net;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
public class connParam
|
||||
{
|
||||
public string ipAdrr = "";
|
||||
|
||||
public CpuType tipoCpu = CpuType.S7300;
|
||||
public short slot = 0;
|
||||
public short rack = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
public class memAddress
|
||||
{
|
||||
/// <summary>
|
||||
/// Indice DB
|
||||
/// </summary>
|
||||
public int DbNum = 0;
|
||||
/// <summary>
|
||||
/// Tipo Memoria (DBD, DBW...)
|
||||
/// </summary>
|
||||
public string tipoMem = "";
|
||||
/// <summary>
|
||||
/// Indice partenza memoria (es DBD0 --> 0)
|
||||
/// </summary>
|
||||
public int indiceMem = 0;
|
||||
/// <summary>
|
||||
/// Inizializza da un formato stringa
|
||||
/// </summary>
|
||||
/// <param name="strFormat"></param>
|
||||
public memAddress(string strFormat)
|
||||
{
|
||||
string[] memComp = strFormat.Split('.');
|
||||
int.TryParse(memComp[0].Replace("DB", ""), out DbNum);
|
||||
tipoMem = memComp[1].Substring(2, 1);
|
||||
int.TryParse(memComp[1].Replace("DB", "").Replace(tipoMem, ""), out indiceMem);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NLog" version="4.7.0" targetFramework="net462" />
|
||||
<package id="NLog.Config" version="4.7.0" targetFramework="net462" />
|
||||
<package id="NLog.Schema" version="4.7.0" targetFramework="net462" />
|
||||
<package id="S7netplus" version="0.4.0" targetFramework="net462" />
|
||||
</packages>
|
||||
@@ -0,0 +1,36 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "charSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
# Segnali BIT per gestione MAPO-IOB-WIN "base"
|
||||
0.0|IOB_POWER_ON |BIT
|
||||
0.1|IOB_RUN |BIT
|
||||
0.2|IOB_COUNT |BIT
|
||||
0.3|IOB_ALARM |BIT
|
||||
0.4|IOB_MANUAL |BIT
|
||||
# segnali BIT x ACK
|
||||
0.5|ACK_STR |BIT
|
||||
0.6|ACK_ST_COM |BIT
|
||||
0.7|ACK_END_COM |BIT
|
||||
#bit x definizione ultimo pezzo (OK/SCARTO/RILAVORAZIONE)
|
||||
1.0|LAST_PZ_OK |BIT
|
||||
1.1|LAST_PZ_KO |BIT
|
||||
1.2|LAST_PZ_RIL |BIT
|
||||
# Vettori allarmi (banchi da 32)
|
||||
002|ALARMS_001 |4BYTE
|
||||
006|ALARMS_033 |4BYTE
|
||||
010|ALARMS_065 |4BYTE
|
||||
014|ALARMS_097 |4BYTE
|
||||
# Altro valori byte numerici (0..255)
|
||||
018|AUTO_POWER_OFF |BYTE
|
||||
019|OVR_SPEED |BYTE
|
||||
020|OVR_FEED |BYTE
|
||||
021|CURR_MODE |BYTE
|
||||
# valori word come UINT 16bit/Word
|
||||
022|COUNT_TOT |WORD
|
||||
024|RPM_PEZZO |WORD
|
||||
026|RPM_MOLA |WORD
|
||||
028|NUM_PZ_STOP |WORD
|
||||
030|MIN_TEO_STOP |WORD
|
||||
032|LOAD_PEZZO |WORD
|
||||
034|LOAD_MOLA |WORD
|
||||
036|TC_LAST_PZ |REAL
|
||||
040|MIS_H1_LAST_PZ |REAL
|
||||
044|MIS_H2_LAST_PZ |REAL
|
||||
@@ -0,0 +1,27 @@
|
||||
# Commenti con cancelletto, struttura un variabile per riga, tipo chiave|valore (occhio che il separatore è configurato da .cofig come "charSep"); spazi e tabulazioni dovrei trimmarli in acquisizione (qui inseriti per comodità di lettura)
|
||||
# Segnali BIT per gestione richeista lettura valori
|
||||
0.0|SIG_STR |BIT
|
||||
0.1|SIG_ST_COM |BIT
|
||||
0.2|SIG_END_COM |BIT
|
||||
# valori word come UINT 16bit/Word
|
||||
002|NUM_PZ_LOTTO |WORD
|
||||
# dati COMMESSA
|
||||
006|L_MAX_COMM |BYTE
|
||||
007|L_ACT_COMM |BYTE
|
||||
008|COD_COMMESSA |20CHAR
|
||||
# dati ARTICOLO
|
||||
006|L_MAX_ART |BYTE
|
||||
007|L_ACT_ART |BYTE
|
||||
008|COD_ARTICOLO |20CHAR
|
||||
# dati PROGRAMMA
|
||||
006|L_MAX_PROG |BYTE
|
||||
007|L_ACT_PROG |BYTE
|
||||
008|COD_PROGRAMMA |20CHAR
|
||||
# dati MACCHINA
|
||||
006|L_MAX_MACC |BYTE
|
||||
007|L_ACT_MACC |BYTE
|
||||
008|COD_MACCHINA |20CHAR
|
||||
# dati DIRECTORY
|
||||
006|L_MAX_DIR |BYTE
|
||||
007|L_ACT_DIR |BYTE
|
||||
008|COD_DIRECTORY |20CHAR
|
||||
@@ -0,0 +1,266 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Configuration;
|
||||
using NLog;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Siemens_S7_Test
|
||||
{
|
||||
public class utils
|
||||
{
|
||||
/// <summary>
|
||||
/// wrapper di log
|
||||
/// </summary>
|
||||
public static Logger lg;
|
||||
/// <summary>
|
||||
/// folder archiviazione dati configurazione (DATA\CONF)
|
||||
/// </summary>
|
||||
public static string confDir
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(@"{0}\{1}", Application.StartupPath, CRS("dataConfPath"));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// legge conf in formato char
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static char CRC(string key)
|
||||
{
|
||||
char answ = '-';
|
||||
try
|
||||
{
|
||||
answ = ConfigurationManager.AppSettings[key].ToCharArray()[0];
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// legge conf in formato stringa
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string CRS(string key)
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = ConfigurationManager.AppSettings[key].ToString();
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// legge conf in formato INT
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static Int32 CRI(string key)
|
||||
{
|
||||
int answ = 0;
|
||||
try
|
||||
{
|
||||
answ = Convert.ToInt32(CRS(key));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// legge conf in formato BOOLean
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static bool CRB(string key)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
answ = Convert.ToBoolean(CRS(key));
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Decodifica file allarme
|
||||
/// </summary>
|
||||
/// <param name="linea"></param>
|
||||
/// <param name="separator"></param>
|
||||
/// <param name="memPre">tipo memoria (R/D/...)</param>
|
||||
/// <param name="baseAddr">indirizzo di partenza memoria</param>
|
||||
/// <param name="memSize">dimensione singolo slot in byte</param>
|
||||
/// <returns></returns>
|
||||
protected static otherData decodeOtherData(string linea, char separator, string memPre, int baseAddr, int memSize)
|
||||
{
|
||||
string[] valori = linea.Split(separator);
|
||||
int shift = 0;
|
||||
try
|
||||
{
|
||||
shift = Convert.ToInt32(valori[0]) - 1;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
string memAddr = string.Format("{0}{1}", memPre, baseAddr + shift * memSize);
|
||||
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
|
||||
}
|
||||
/// <summary>
|
||||
/// Decodifica file MAP (caso ESA/IOT)
|
||||
/// </summary>
|
||||
/// <param name="linea"></param>
|
||||
/// <param name="separator"></param>
|
||||
/// <param name="ByteNum">indirizzo Byte: indirizzo di partenza memoria</param>
|
||||
/// <param name="memSize">dimensione singolo slot in byte</param>
|
||||
/// <param name="BitNum">indirizzo bit: numero riga x calcolo indice bit</param>
|
||||
/// <returns></returns>
|
||||
protected static otherData decodeBitData(string linea, char separator, int ByteNum, int memSize, int BitNum)
|
||||
{
|
||||
string[] valori = linea.Split(separator);
|
||||
int shift = 0;
|
||||
try
|
||||
{
|
||||
shift = Convert.ToInt32(valori[0]) - 1;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
int resto = 0;
|
||||
Math.DivRem(BitNum, 8, out resto);
|
||||
string memAddr = string.Format("{0}.{1}", ByteNum + shift * memSize, resto);
|
||||
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
|
||||
}
|
||||
/// <summary>
|
||||
/// Decodifica file MAP (caso FANUC/OSAI/...)
|
||||
/// </summary>
|
||||
/// <param name="linea"></param>
|
||||
/// <param name="separator"></param>
|
||||
/// <param name="memPre">tipo memoria (R/D/...)</param>
|
||||
/// <param name="baseAddr">indirizzo Byte: indirizzo di partenza memoria</param>
|
||||
/// <param name="memSize">dimensione singolo slot in byte</param>
|
||||
/// <param name="numRiga">indirizzo bit: numero riga x calcolo indice bit</param>
|
||||
/// <returns></returns>
|
||||
protected static otherData decodeBitData(string linea, char separator, string memPre, int baseAddr, int memSize, int numRiga)
|
||||
{
|
||||
string[] valori = linea.Split(separator);
|
||||
int shift = 0;
|
||||
try
|
||||
{
|
||||
shift = (Convert.ToInt32(valori[0]) - 1) / (8 * memSize);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
int resto = 0;
|
||||
Math.DivRem(numRiga, 8 * memSize, out resto);
|
||||
string memAddr = string.Format("{0}{1}.{2}", memPre, baseAddr + shift, resto);
|
||||
return new otherData(valori[0], memAddr, valori[1].Trim(), valori[2].Trim());
|
||||
}
|
||||
/// <summary>
|
||||
/// Legge il file di conf di una MAP di informazioni da gestire con lettura set memoria
|
||||
/// </summary>
|
||||
/// <param name="vettoreConf">nome vettore memoria</param>
|
||||
/// <param name="nomeFile">file origine</param>
|
||||
/// <param name="memSize">dimensione (in byte) della memoria</param>
|
||||
/// <param name="numVett">dimensione (in byte) della memoria</param>
|
||||
public static void loadConfFile(ref otherData[] vettoreConf, string nomeFile, int memSize, ref int numVett)
|
||||
{
|
||||
otherData lastData = new otherData();
|
||||
int totRighe = 0;
|
||||
string linea;
|
||||
totRighe = File.ReadLines(nomeFile).Count();
|
||||
// creo un vettore della dimensione corretta... conta anche commenti tanto poi riduco...
|
||||
vettoreConf = new otherData[File.ReadLines(nomeFile).Count()];
|
||||
// carica da file...
|
||||
StreamReader file = new StreamReader(nomeFile);
|
||||
// leggo 1 linea alla volta...
|
||||
int numRiga = 0;
|
||||
int bitNum = 0;
|
||||
int byteNum = 0;
|
||||
while ((linea = file.ReadLine()) != null)
|
||||
{
|
||||
// SE non è un commento...
|
||||
if (linea.Substring(0, 1) != "#")
|
||||
{
|
||||
// se finisce per BIT allora processo bit-a-bit...
|
||||
if (linea.EndsWith("BOOL"))
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] memIdx = linea.Split(utils.CRC("charSep"))[0].Split('.');
|
||||
// calcolo bit e byte number...
|
||||
int.TryParse(memIdx[0], out byteNum);
|
||||
if (memIdx.Length > 1)
|
||||
{
|
||||
int.TryParse(memIdx[1], out bitNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
bitNum = 0;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
byteNum = 0;
|
||||
bitNum = 0;
|
||||
}
|
||||
lastData = decodeBitData(linea, utils.CRC("charSep"), byteNum, 1, bitNum);
|
||||
vettoreConf[numRiga] = lastData;
|
||||
}
|
||||
else
|
||||
{
|
||||
lastData = decodeOtherData(linea, utils.CRC("charSep"), "", 1, memSize);
|
||||
vettoreConf[numRiga] = lastData;
|
||||
}
|
||||
numRiga++;
|
||||
}
|
||||
}
|
||||
// salvo lunghezza file...
|
||||
try
|
||||
{
|
||||
numVett = Convert.ToInt32(lastData.memAddr) + 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
numVett = numRiga + 1;
|
||||
}
|
||||
// chiudo file
|
||||
file.Close();
|
||||
// ora trimmo vettore al solo numero VERO dei valori caricati...
|
||||
Array.Resize<otherData>(ref vettoreConf, numRiga);
|
||||
|
||||
if (utils.CRB("verbose")) lg.Info(string.Format("Fine caricamento vettore di {0} variabili per file {1}", numRiga, nomeFile));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dato generico (per decodifica)
|
||||
/// </summary>
|
||||
public class otherData
|
||||
{
|
||||
public string codNum;
|
||||
public string memAddr;
|
||||
public string varName;
|
||||
public string dataType;
|
||||
public otherData()
|
||||
{
|
||||
codNum = "";
|
||||
memAddr = "";
|
||||
varName = "";
|
||||
dataType = "";
|
||||
}
|
||||
public otherData(string _codNum, string _memAddr, string _varName, string _dataType)
|
||||
{
|
||||
codNum = _codNum;
|
||||
memAddr = _memAddr;
|
||||
varName = _varName;
|
||||
dataType = _dataType;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user