Merge branch 'develop'

This commit is contained in:
2020-01-15 12:14:35 +01:00
4 changed files with 391 additions and 15 deletions
+12
View File
@@ -33,6 +33,10 @@ bit4 = 0
bit5 = 0
bit6 = 0
bit7 = 0
bit8 = 0
bit9 = 0
bit10 = 0
bit11 = 0
[invert]
bit0 = 0
@@ -43,6 +47,10 @@ bit4 = 0
bit5 = 0
bit6 = 0
bit7 = 0
bit8 = 0
bit9 = 0
bit10 = 0
bit11 = 0
[filter]
MAX_COUNTER_FILTER = 8
@@ -54,3 +62,7 @@ bit4 = 0
bit5 = 0
bit6 = 0
bit7 = 0
bit8 = 0
bit9 = 0
bit10 = 0
bit11 = 0
+83 -15
View File
@@ -1,12 +1,14 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# readParallela v. 2.2
# readParallela v. 2.4
# - single instance timer
# - invio multiplo x send eventi accodati
# - gestione segnali BLINKING
# - gestione INVERSIONE segnali cv 10-VII-2018
# - gestione FILTRAGGIO segnali brevi cv 23-VII-2018
# - (2.3) gestione 12 bit cv 14-I-2020
# - (2.4) fix ingressi e conf apertura parallela + gestione vari bit filtraggio x nuovi ingressi + update conf con 12 parametri bit SEL 15-I-2020
#---------------------------------------------------------------
# levare locking
@@ -41,7 +43,7 @@ MAXRETRY = 3
# numero campioni filtraggio segnale ballerino
MAX_COUNTER_BLINK = 10
PROGRAM_NAME ="ReadPar IOB-pi v.2.2"
PROGRAM_NAME ="ReadPar IOB-pi v.2.4"
# DA FILE CONF
idxMacchina = "1001"
@@ -72,6 +74,10 @@ in_4 = 16
in_5 = 18
in_6 = 22
in_7 = 7
in_8 = 29
in_9 = 31
in_10 = 36
in_11 = 32
# contatore: serve x match tra accoda ed invia x possibile controllo a posteriori... ogni volta che accodo incremento di 1, va da 0 a 9999
cont = '0'
@@ -88,18 +94,18 @@ timer_busy = False
#
# array per ingressi filtrati
i_counters = array ( 'i',[0,0,0,0,0,0,0,0])
B_blinking = array ( 'B',[0,0,0,0,0,0,0,0])
B_previous = array ( 'B',[0,0,0,0,0,0,0,0])
B_input = array ( 'B',[0,0,0,0,0,0,0,0])
B_output = array ( 'B',[0,0,0,0,0,0,0,0])
i_counters = array ( 'i',[0,0,0,0,0,0,0,0,0,0,0,0])
B_blinking = array ( 'B',[0,0,0,0,0,0,0,0,0,0,0,0])
B_previous = array ( 'B',[0,0,0,0,0,0,0,0,0,0,0,0])
B_input = array ( 'B',[0,0,0,0,0,0,0,0,0,0,0,0])
B_output = array ( 'B',[0,0,0,0,0,0,0,0,0,0,0,0])
B_inverting = array ( 'B',[0,0,0,0,0,0,0,0])
B_inverting = array ( 'B',[0,0,0,0,0,0,0,0,0,0,0,0])
B_filter = array ( 'B',[0,0,0,0,0,0,0,0])
B_filter_prev = array ( 'B',[0,0,0,0,0,0,0,0])
B_temp = array ( 'B',[0,0,0,0,0,0,0,0])
i_filter_counters = array ( 'i',[0,0,0,0,0,0,0,0])
B_filter = array ( 'B',[0,0,0,0,0,0,0,0,0,0,0,0])
B_filter_prev = array ( 'B',[0,0,0,0,0,0,0,0,0,0,0,0])
B_temp = array ( 'B',[0,0,0,0,0,0,0,0,0,0,0,0])
i_filter_counters = array ( 'i',[0,0,0,0,0,0,0,0,0,0,0,0])
#--------------------------------------------------------------
# Gestione coda (condivisa) x registrazione eventi ed invio URL
@@ -124,6 +130,12 @@ def readParallelaFiltrata():
global in_6
global in_7
global in_8
global in_9
global in_10
global in_11
global GPIO
current = ''
@@ -170,9 +182,35 @@ def readParallelaFiltrata():
B_input[7] = 0
else:
B_input[7] = 1
if GPIO.input(in_8):
B_input[8] = 0
else:
B_input[8] = 1
if GPIO.input(in_9):
B_input[9] = 0
else:
B_input[9] = 1
if GPIO.input(in_10):
B_input[10] = 0
else:
B_input[10] = 1
if GPIO.input(in_11):
B_input[11] = 0
else:
B_input[11] = 1
#ciclo per ogni segnale
for i in xrange(8) :
for i in xrange(12) :
# print (i)
# v2.1 gestione inversione bit ingresso
@@ -285,7 +323,17 @@ def readParallelaFiltrata():
new_value = new_value + 64
if ( B_output[7] == 1 ) :
new_value = new_value + 128
if ( B_output[8] == 1 ) :
new_value = new_value + 256
if ( B_output[9] == 1 ) :
new_value = new_value + 512
if ( B_output[10] == 1 ) :
new_value = new_value + 1024
if ( B_output[11] == 1 ) :
new_value = new_value + 2048
current = hex( new_value ).replace ( "0x" , "" ).upper()
except:
@@ -455,6 +503,10 @@ def avviaParallela():
global in_5
global in_6
global in_7
global in_8
global in_9
global in_10
global in_11
global GPIO
@@ -475,6 +527,10 @@ def avviaParallela():
GPIO.setup(in_5, GPIO.IN) # input 5
GPIO.setup(in_6, GPIO.IN) # input 6
GPIO.setup(in_7, GPIO.IN) # input 7
GPIO.setup(in_8, GPIO.IN) # input 8
GPIO.setup(in_9, GPIO.IN) # input 9
GPIO.setup(in_10, GPIO.IN) # input 10
GPIO.setup(in_11, GPIO.IN) # input 11
except:
print( "\n\n" + PROGRAM_NAME + " - Error 3 on RPi.GPIO ! \n\n")
@@ -517,6 +573,10 @@ try:
B_blinking[5] = config.getint ( 'blink' , 'bit5' )
B_blinking[6] = config.getint ( 'blink' , 'bit6' )
B_blinking[7] = config.getint ( 'blink' , 'bit7' )
B_blinking[8] = config.getint ( 'blink' , 'bit8' )
B_blinking[9] = config.getint ( 'blink' , 'bit9' )
B_blinking[10] = config.getint ( 'blink' , 'bit10' )
B_blinking[11] = config.getint ( 'blink' , 'bit11' )
MAX_COUNTER_BLINK = config.getint ( 'blink' , 'MAX_COUNTER_BLINK' )
@@ -530,6 +590,10 @@ try:
B_inverting[5] = config.getint ( 'invert' , 'bit5' )
B_inverting[6] = config.getint ( 'invert' , 'bit6' )
B_inverting[7] = config.getint ( 'invert' , 'bit7' )
B_inverting[8] = config.getint ( 'invert' , 'bit8' )
B_inverting[9] = config.getint ( 'invert' , 'bit9' )
B_inverting[10] = config.getint ( 'invert' , 'bit10' )
B_inverting[11] = config.getint ( 'invert' , 'bit11' )
# cv 2.2 se bit = 1 allora filtro segnali brevi ...
@@ -541,6 +605,10 @@ try:
B_filter[5] = config.getint ( 'filter' , 'bit5' )
B_filter[6] = config.getint ( 'filter' , 'bit6' )
B_filter[7] = config.getint ( 'filter' , 'bit7' )
B_filter[8] = config.getint ( 'filter' , 'bit8' )
B_filter[9] = config.getint ( 'filter' , 'bit9' )
B_filter[10] = config.getint ( 'filter' , 'bit10' )
B_filter[11] = config.getint ( 'filter' , 'bit11' )
MAX_COUNTER_FILTER = config.getint ( 'filter' , 'MAX_COUNTER_FILTER' )
@@ -0,0 +1,193 @@
IdxFamigliaIngresso;IdxMicroStato;ValoreIngresso;IdxTipoEvento;next_IdxMicroStato
56;0;0;14;1
56;0;1;15;2
56;0;2;14;1
56;0;3;16;3
56;0;4;14;1
56;0;5;15;2
56;0;6;14;1
56;0;7;16;3
56;0;8;14;1
56;0;9;18;5
56;0;10;14;1
56;0;11;18;5
56;0;12;14;1
56;0;13;18;5
56;0;14;14;1
56;0;15;18;5
56;0;16;14;1
56;0;17;24;6
56;0;18;14;1
56;0;19;24;6
56;0;20;14;1
56;0;21;24;6
56;0;22;14;1
56;0;23;24;6
56;0;24;14;1
56;0;25;18;5
56;0;26;14;1
56;0;27;18;5
56;0;28;14;1
56;0;29;18;5
56;0;30;14;1
56;0;31;18;5
56;1;1;15;2
56;1;3;16;3
56;1;5;15;2
56;1;7;16;3
56;1;9;18;5
56;1;11;18;5
56;1;13;18;5
56;1;15;18;5
56;1;17;24;6
56;1;19;24;6
56;1;21;24;6
56;1;23;24;6
56;1;25;18;5
56;1;27;18;5
56;1;29;18;5
56;1;31;18;5
56;2;0;14;1
56;2;2;14;1
56;2;3;16;3
56;2;4;14;1
56;2;6;14;1
56;2;7;16;3
56;2;8;14;1
56;2;9;18;5
56;2;10;14;1
56;2;11;18;5
56;2;12;14;1
56;2;13;18;5
56;2;14;14;1
56;2;15;18;5
56;2;16;14;1
56;2;17;24;6
56;2;18;14;1
56;2;19;24;6
56;2;20;14;1
56;2;21;24;6
56;2;22;14;1
56;2;23;24;6
56;2;24;14;1
56;2;25;18;5
56;2;26;14;1
56;2;27;18;5
56;2;28;14;1
56;2;29;18;5
56;2;30;14;1
56;2;31;18;5
56;3;0;14;1
56;3;1;15;2
56;3;2;14;1
56;3;4;14;1
56;3;5;15;2
56;3;6;14;1
56;3;8;14;1
56;3;9;18;5
56;3;10;14;1
56;3;11;18;5
56;3;12;14;1
56;3;13;18;5
56;3;14;14;1
56;3;15;18;5
56;3;16;14;1
56;3;17;24;6
56;3;18;14;1
56;3;19;24;6
56;3;20;14;1
56;3;21;24;6
56;3;22;14;1
56;3;23;24;6
56;3;24;14;1
56;3;25;18;5
56;3;26;14;1
56;3;27;18;5
56;3;28;14;1
56;3;29;18;5
56;3;30;14;1
56;3;31;18;5
56;4;0;14;1
56;4;1;15;2
56;4;2;14;1
56;4;3;16;3
56;4;4;14;1
56;4;5;15;2
56;4;6;14;1
56;4;7;16;3
56;4;8;14;1
56;4;9;18;5
56;4;10;14;1
56;4;11;18;5
56;4;12;14;1
56;4;13;18;5
56;4;14;14;1
56;4;15;18;5
56;4;16;14;1
56;4;17;24;6
56;4;18;14;1
56;4;19;24;6
56;4;20;14;1
56;4;21;24;6
56;4;22;14;1
56;4;23;24;6
56;4;24;14;1
56;4;25;18;5
56;4;26;14;1
56;4;27;18;5
56;4;28;14;1
56;4;29;18;5
56;4;30;14;1
56;4;31;18;5
56;5;0;14;1
56;5;1;15;2
56;5;2;14;1
56;5;3;16;3
56;5;4;14;1
56;5;5;15;2
56;5;6;14;1
56;5;7;16;3
56;5;8;14;1
56;5;10;14;1
56;5;12;14;1
56;5;14;14;1
56;5;16;14;1
56;5;17;24;6
56;5;18;14;1
56;5;19;24;6
56;5;20;14;1
56;5;21;24;6
56;5;22;14;1
56;5;23;24;6
56;5;24;14;1
56;5;26;14;1
56;5;28;14;1
56;5;30;14;1
56;6;0;14;1
56;6;1;15;2
56;6;2;14;1
56;6;3;16;3
56;6;4;14;1
56;6;5;15;2
56;6;6;14;1
56;6;7;16;3
56;6;8;14;1
56;6;9;18;5
56;6;10;14;1
56;6;11;18;5
56;6;12;14;1
56;6;13;18;5
56;6;14;14;1
56;6;15;18;5
56;6;16;14;1
56;6;18;14;1
56;6;20;14;1
56;6;22;14;1
56;6;24;14;1
56;6;25;18;5
56;6;26;14;1
56;6;27;18;5
56;6;28;14;1
56;6;29;18;5
56;6;30;14;1
56;6;31;18;5
1 IdxFamigliaIngresso IdxMicroStato ValoreIngresso IdxTipoEvento next_IdxMicroStato
2 56 0 0 14 1
3 56 0 1 15 2
4 56 0 2 14 1
5 56 0 3 16 3
6 56 0 4 14 1
7 56 0 5 15 2
8 56 0 6 14 1
9 56 0 7 16 3
10 56 0 8 14 1
11 56 0 9 18 5
12 56 0 10 14 1
13 56 0 11 18 5
14 56 0 12 14 1
15 56 0 13 18 5
16 56 0 14 14 1
17 56 0 15 18 5
18 56 0 16 14 1
19 56 0 17 24 6
20 56 0 18 14 1
21 56 0 19 24 6
22 56 0 20 14 1
23 56 0 21 24 6
24 56 0 22 14 1
25 56 0 23 24 6
26 56 0 24 14 1
27 56 0 25 18 5
28 56 0 26 14 1
29 56 0 27 18 5
30 56 0 28 14 1
31 56 0 29 18 5
32 56 0 30 14 1
33 56 0 31 18 5
34 56 1 1 15 2
35 56 1 3 16 3
36 56 1 5 15 2
37 56 1 7 16 3
38 56 1 9 18 5
39 56 1 11 18 5
40 56 1 13 18 5
41 56 1 15 18 5
42 56 1 17 24 6
43 56 1 19 24 6
44 56 1 21 24 6
45 56 1 23 24 6
46 56 1 25 18 5
47 56 1 27 18 5
48 56 1 29 18 5
49 56 1 31 18 5
50 56 2 0 14 1
51 56 2 2 14 1
52 56 2 3 16 3
53 56 2 4 14 1
54 56 2 6 14 1
55 56 2 7 16 3
56 56 2 8 14 1
57 56 2 9 18 5
58 56 2 10 14 1
59 56 2 11 18 5
60 56 2 12 14 1
61 56 2 13 18 5
62 56 2 14 14 1
63 56 2 15 18 5
64 56 2 16 14 1
65 56 2 17 24 6
66 56 2 18 14 1
67 56 2 19 24 6
68 56 2 20 14 1
69 56 2 21 24 6
70 56 2 22 14 1
71 56 2 23 24 6
72 56 2 24 14 1
73 56 2 25 18 5
74 56 2 26 14 1
75 56 2 27 18 5
76 56 2 28 14 1
77 56 2 29 18 5
78 56 2 30 14 1
79 56 2 31 18 5
80 56 3 0 14 1
81 56 3 1 15 2
82 56 3 2 14 1
83 56 3 4 14 1
84 56 3 5 15 2
85 56 3 6 14 1
86 56 3 8 14 1
87 56 3 9 18 5
88 56 3 10 14 1
89 56 3 11 18 5
90 56 3 12 14 1
91 56 3 13 18 5
92 56 3 14 14 1
93 56 3 15 18 5
94 56 3 16 14 1
95 56 3 17 24 6
96 56 3 18 14 1
97 56 3 19 24 6
98 56 3 20 14 1
99 56 3 21 24 6
100 56 3 22 14 1
101 56 3 23 24 6
102 56 3 24 14 1
103 56 3 25 18 5
104 56 3 26 14 1
105 56 3 27 18 5
106 56 3 28 14 1
107 56 3 29 18 5
108 56 3 30 14 1
109 56 3 31 18 5
110 56 4 0 14 1
111 56 4 1 15 2
112 56 4 2 14 1
113 56 4 3 16 3
114 56 4 4 14 1
115 56 4 5 15 2
116 56 4 6 14 1
117 56 4 7 16 3
118 56 4 8 14 1
119 56 4 9 18 5
120 56 4 10 14 1
121 56 4 11 18 5
122 56 4 12 14 1
123 56 4 13 18 5
124 56 4 14 14 1
125 56 4 15 18 5
126 56 4 16 14 1
127 56 4 17 24 6
128 56 4 18 14 1
129 56 4 19 24 6
130 56 4 20 14 1
131 56 4 21 24 6
132 56 4 22 14 1
133 56 4 23 24 6
134 56 4 24 14 1
135 56 4 25 18 5
136 56 4 26 14 1
137 56 4 27 18 5
138 56 4 28 14 1
139 56 4 29 18 5
140 56 4 30 14 1
141 56 4 31 18 5
142 56 5 0 14 1
143 56 5 1 15 2
144 56 5 2 14 1
145 56 5 3 16 3
146 56 5 4 14 1
147 56 5 5 15 2
148 56 5 6 14 1
149 56 5 7 16 3
150 56 5 8 14 1
151 56 5 10 14 1
152 56 5 12 14 1
153 56 5 14 14 1
154 56 5 16 14 1
155 56 5 17 24 6
156 56 5 18 14 1
157 56 5 19 24 6
158 56 5 20 14 1
159 56 5 21 24 6
160 56 5 22 14 1
161 56 5 23 24 6
162 56 5 24 14 1
163 56 5 26 14 1
164 56 5 28 14 1
165 56 5 30 14 1
166 56 6 0 14 1
167 56 6 1 15 2
168 56 6 2 14 1
169 56 6 3 16 3
170 56 6 4 14 1
171 56 6 5 15 2
172 56 6 6 14 1
173 56 6 7 16 3
174 56 6 8 14 1
175 56 6 9 18 5
176 56 6 10 14 1
177 56 6 11 18 5
178 56 6 12 14 1
179 56 6 13 18 5
180 56 6 14 14 1
181 56 6 15 18 5
182 56 6 16 14 1
183 56 6 18 14 1
184 56 6 20 14 1
185 56 6 22 14 1
186 56 6 24 14 1
187 56 6 25 18 5
188 56 6 26 14 1
189 56 6 27 18 5
190 56 6 28 14 1
191 56 6 29 18 5
192 56 6 30 14 1
193 56 6 31 18 5
@@ -0,0 +1,103 @@
#
# Interclays macchina FeOx EDF con OMRON
#
# partenza da IdxFam 55
#
#
$DEFINITIONS
$NAME : INTERCLAYS_FE_OX
$IDX : 56
$N_STATES : 7
$N_BITS : 5
#definizione bit : obbligatorio iniziare da 0
$BIT : 0 : POWERON
$BIT : 1 : RUN
$BIT : 2 : END_CYCLE
$BIT : 3 : ALARM
$BIT : 4 : MANUAL
#$BIT : 5 : SILOS
#$BIT : 6 : AUTOBOTTE
#definizione stati : obbligatorio iniziare da 0
$STATE : 0 : ST_INIT
$STATE : 1 : ST_POWER_OFF
$STATE : 2 : ST_MACHINE_READY
$STATE : 3 : ST_RUN
$STATE : 4 : ST_END_CYCLE
$STATE : 5 : ST_ALARM
$STATE : 6 : ST_MANUAL
#definizione eventi : obbligatorio iniziare da 0
$EVENT : 00 : EV_00
$EVENT : 01 : EV_01
$EVENT : 02 : EV_02
$EVENT : 03 : EV_03
$EVENT : 04 : EV_04
$EVENT : 05 : EV_05
$EVENT : 06 : EV_06
$EVENT : 07 : EV_07
$EVENT : 08 : EV_08
$EVENT : 09 : EV_09
$EVENT : 10 : EV_10
$EVENT : 11 : EV_11
$EVENT : 12 : EV_12
$EVENT : 13 : HW_init
$EVENT : 14 : HW_POWER_OFF
$EVENT : 15 : HW_POWERON
$EVENT : 16 : HW_MACHINING
$EVENT : 17 : HW_end_machining
$EVENT : 18 : HW_ERROR
$EVENT : 19 : Barcode_cambio operatore
$EVENT : 20 : Contapezzi
$EVENT : 21 : HW_start_pallet
$EVENT : 22 : HW_END_PALLET
$EVENT : 23 : HW_rottura_nastro_abrasivo
$EVENT : 24 : HW_MANUALE
$EVENT : 25 : HW_nastro_scarico_pieno
$EVENT : 26 : Barcode_Manca_Riforn_MPD
$EVENT : 27 : Timer_timeout_tempo_ciclo
$EVENT : 28 : Timer_timeout_TURNO_by_tempo_ciclo
$EVENT : 29 : HW_magazzino_grezzi vuoto
$EVENT : 30 : HW_emergenza
$EVENT : 31 : Barcode_Modifica_Programmi
$EVENT : 32 : Barcode_Sostituzione_Utensile
$EVENT : 33 : HW_Allarme Macchina
$EVENT : 34 : HW_END_PALLET_1
$EVENT : 35 : HW_END_PALLET_2
$EVENT : 36 : HW_deposito_robot
$EVENT : 37 : Barcode_Riempimento_Vasca
$EVENT : 38 : Barcode_Riscaldamento
$EVENT : 39 : Barcode_Anomalia_Macchina
$EVENT : 40 : HW_WarmUp_CoolDown
$EVENT : 41 : HW_MACHININGSLOW
$EVENT : 42 : HW_WarnLivelloVasca
$EVENT : 43 : HW_WarnLivelloCell
$EVENT : 44 : HW_Warna_Vuoto
$EVENT : 45 : HW_WarnRiserva
$EVENT : 46 : HW_Carico
$EVENT : 47 : HW_MISMATCH
#$EVENT : 999 : Commento
$RULES
# state : input : next state : event
ALL_STATES : NOT POWERON : ST_POWER_OFF : HW_POWER_OFF
#ALL_STATES : END_CYCLE : ST_END_CYCLE : HW_END_PALLET
ALL_STATES : ALARM : ST_ALARM : HW_ERROR
ALL_STATES : MANUAL : ST_MANUAL : HW_MANUALE
#ALL_STATES : AUTOBOTTE : ST_RUN : HW_MACHINING
#ALL_STATES : SILOS : ST_RUN : HW_MACHINING
ALL_STATES : RUN : ST_RUN : HW_MACHINING
ALL_STATES : POWERON : ST_MACHINE_READY : HW_POWERON
#--------------------------------------------------------------------------
$DO