diff --git a/IOB-PI/std_vers/IOB.cfg b/IOB-PI/std_vers/IOB.cfg index ad9ef57..26771f4 100644 --- a/IOB-PI/std_vers/IOB.cfg +++ b/IOB-PI/std_vers/IOB.cfg @@ -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 diff --git a/IOB-PI/std_vers/readParallela.py b/IOB-PI/std_vers/readParallela.py index f49e4f7..897a6c6 100644 --- a/IOB-PI/std_vers/readParallela.py +++ b/IOB-PI/std_vers/readParallela.py @@ -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' ) diff --git a/StateMachine/Interclays/56_Interclays_FeOx.csv b/StateMachine/Interclays/56_Interclays_FeOx.csv new file mode 100644 index 0000000..a08bfd1 --- /dev/null +++ b/StateMachine/Interclays/56_Interclays_FeOx.csv @@ -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 diff --git a/StateMachine/Interclays/56_Interclays_FeOx.rul b/StateMachine/Interclays/56_Interclays_FeOx.rul new file mode 100644 index 0000000..aed4b2e --- /dev/null +++ b/StateMachine/Interclays/56_Interclays_FeOx.rul @@ -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