Upload
sabato-mazzoni
View
223
Download
2
Embed Size (px)
Citation preview
Università Degli Studi di Napoli “ Università Degli Studi di Napoli “ Federico II”Federico II”
Tesi di LaureaTesi di LaureaInIn
Ingegneria e Tecnologia dei Sistemi di ControlloIngegneria e Tecnologia dei Sistemi di Controllo
CONTROLLO “PC-BASED” CONTROLLO “PC-BASED” DI UNA CELLA DI UNA CELLA ROBOTIZZATAROBOTIZZATA
Relatore:Relatore:Ch.mo Prof.Ch.mo Prof. Pasquale Pasquale ChiacchioChiacchio
Candidato:Candidato: Pasquale Di LorenzoPasquale Di Lorenzo Mat. 41/2253Mat. 41/2253
Giugno 2004Giugno 2004
PC-Based ControlPC-Based Control
Working PlacePC Platform for
Real-Time-Tasks
Platform forUser Interface
DevelopingEnvironment
Personal ComputerPersonal Computer++
Real-Time Operative SystemReal-Time Operative System
PC-Based ControlPC-Based Control
La Cella RobotizzataLa Cella Robotizzata
R o bo t S m a rt 3 S6 a s s i
R o bo t S m a rt 3 S7 a s s i
P in za 0 Pin za 1
Na s tro Tra s po rta to re
C 3 G -9 0 0 0
C 3 G -9 0 0 0S m a rt la b I /O
I S A B it3
P C -C o ntr o lL i nux-R TAI
• Robot Smart 3S/C3G-9000
• Pinze Pneumatiche
• Nastro Trasportatore
• PC-Linux-RTAI
• Schede di Comunicazione
Apparecchiature : Apparecchiature :
Comunicazione RobotComunicazione Robot
REPLICSREPLICS
• gestire e/o simulare contemporaneamente ed indipendentemente i robot industriali COMAU Smart-3S e le unità di controllo aperte C3G-9000;
• monitorare, salvare su disco e graficare in tempo reale le posizioni, le correnti e le forze;
• eseguire moduli e file di script RPL per la comunicazione con i Robot;
• avere una vista 3D dei robot in tempo reale;
• trasmettere dati attraverso le porte seriali e parallele;
• controllare il tutto da una postazione remota;
Comunicazione Comunicazione Nastro/PinzeNastro/Pinze
Smartlab I/OSmartlab I/O
16 relay output channels
16 input channels
Response time for relay: 1 ms minimum
Port address selectable
Features :
Linux-RTAILinux-RTAI
RTHALRTHAL
SOPLICS – ArchitetturaSOPLICS – Architettura(SOftware Plc under LInux Control System)
Pa n n e llo di C o m a n do ( St a r t - St o p R e sum e - Susp e n d)
Q u a droS in o t t ico
M o n ito r
S U P E R V IS IO N EG e s t i o ne
M o dul o U te nte
R TF H andl e r
P LC -M a na g e r
M o dul oU te nte
M E M O R IA C O N D IV IS A
th re ad 0
th re ad 1
R o bo t Sm ar t 3 S( R ep lic s )
Sm ar t l ab I/O( n as tr o e p in ze)
M A IL B O X
M A IL B O X
M A IL B O X
M A IL B O X
FIFO 0 FIFO 1 FIFO 2
P a rte N O N R E A L -T I M E
P a rte R E A L -T I M ED e v ice D riv e r
Pa n n e llo di C o m a n do ( St a r t - St o p R e sum e - Susp e n d)
Q u a droS in o t t ico
M o n ito r
S U P E R V IS IO N EG e s t i o ne
M o dul o U te nte
R TF H andl e r
P LC -M a na g e r
M o dul oU te nte
M E M O R IA C O N D IV IS A
th re ad 0
th re ad 1
R o bo t Sm ar t 3 S( R ep lic s )
Sm ar t l ab I/O( n as tr o e p in ze)
M A IL B O X
M A IL B O X
M A IL B O X
M A IL B O X
FIFO 0 FIFO 1 FIFO 2
P a rte N O N R E A L -T I M E
P a rte R E A L -T I M ED e v ice D riv e r
Modulo PrincipaleModulo Principale
TASK-R e al -Ti m eP untato r i a funzi o ni e var i abi l i c o ndi vi s e
M ai l B o x - F IF O....
P a r t e D i c h i a r a t i v a
p lc_ m an ag er
l e g g e g l i i n g r e s s i
r i c h i a m a l a f u n z i o n e d i c o n t r o l l oc h e c k e v e n t i a s i n c r o n i
a g g i o r n a l e u s c i t e
e ve nt_ handl e r
r e ad_ i nput_ r plr e ad_ i nput_ s m l
w r i te _ o utput_ s m lw r i te _ o utput_ r pl
F u n z i o n i d i s u p p o r t o
init_ m o dule
Al l o c a l a m e m o r i a ne c e s s ar i ai ni zi al i zza i l t i m e r
c le a nup_ m o dule
D e al l o c a l a m e m o r i a e r i m uo vei tas k
i ni t_ dr i ve re ve nt_ handl e rr e s um e _ s ys te mr tf_ i n_ handl e r
r e ad_ i nput_ s m lw r i te _ o utput_ s m lr e ad_ i nput_ r plw r i te _ o utput_ r pl
addr _ m bxs pl c _ pr i nts us pe nd_ s ys te me r r o r e _ handl e r
TASK-R e al -Ti m eP untato r i a funzi o ni e var i abi l i c o ndi vi s e
M ai l B o x - F IF O....
P a r t e D i c h i a r a t i v a
p lc_ m an ag er
l e g g e g l i i n g r e s s i
r i c h i a m a l a f u n z i o n e d i c o n t r o l l oc h e c k e v e n t i a s i n c r o n i
a g g i o r n a l e u s c i t e
e ve nt_ handl e r
r e ad_ i nput_ r plr e ad_ i nput_ s m l
w r i te _ o utput_ s m lw r i te _ o utput_ r pl
F u n z i o n i d i s u p p o r t o
init_ m o dule
Al l o c a l a m e m o r i a ne c e s s ar i ai ni zi al i zza i l t i m e r
c le a nup_ m o dule
D e al l o c a l a m e m o r i a e r i m uo vei tas k
i ni t_ dr i ve re ve nt_ handl e rr e s um e _ s ys te mr tf_ i n_ handl e r
r e ad_ i nput_ s m lw r i te _ o utput_ s m lr e ad_ i nput_ r plw r i te _ o utput_ r pl
addr _ m bxs pl c _ pr i nts us pe nd_ s ys te me r r o r e _ handl e r
Modulo RobotModulo Robot
init_ m o dule
Al l o c a l a m e m o r i a ne c e s s ar i a ec o l l e g a i puntato r i al l e funzi o ni
c le a nup_ m o dule
D e al l o c a l a m e m o r i a
P untato r i a funzi o ni e var i abi l i c o ndi vi s eM B X
....
P a r t e D i c h i a r a t i v a
t h r e a d 0 - ro bo t6 a s s i
a t te s a s u lla m a ilbo x
e s e c u z ion e de l l 'az ion ec or r i s pon de n te al c om an do
c om an doe s e g u i to c on
s u c c e s s o
m es s ag g ior ic ev u to
ER R O R E!ar r e s to de l s i s te m a
NO
S I
a t te s a s u lla m a ilbo x
e s e c u z ion e de l l 'az ion ec or r i s pon de n te al c om an do
c om an doe s e g u i to c on
s u c c e s s o
m es s ag g ior ic ev u to
ER R O R E!ar r e s to de l s i s te m a
NO
S I
t h r e a d 1 - ro bo t7 a s s i
init_ m o dule
Al l o c a l a m e m o r i a ne c e s s ar i a ec o l l e g a i puntato r i al l e funzi o ni
c le a nup_ m o dule
D e al l o c a l a m e m o r i a
P untato r i a funzi o ni e var i abi l i c o ndi vi s eM B X
....
P a r t e D i c h i a r a t i v a
t h r e a d 0 - ro bo t6 a s s i
a t te s a s u lla m a ilbo x
e s e c u z ion e de l l 'az ion ec or r i s pon de n te al c om an do
c om an doe s e g u i to c on
s u c c e s s o
m es s ag g ior ic ev u to
ER R O R E!ar r e s to de l s i s te m a
NO
S I
a t te s a s u lla m a ilbo x
e s e c u z ion e de l l 'az ion ec or r i s pon de n te al c om an do
c om an doe s e g u i to c on
s u c c e s s o
m es s ag g ior ic ev u to
ER R O R E!ar r e s to de l s i s te m a
NO
S I
t h r e a d 1 - ro bo t7 a s s i
Modulo SmartlabModulo Smartlab
init_ m o dule
A llo c a la m e m o ria n e c e s s aria ec o lle g a i p u n tato ri alle fu n zio n i
c le a nup_ m o dule
D e al l o c a l a m e m o r i a
P u n tato ri a fu n zio n i e v ariab ili c o n d iv is eM B X
.. . .
P a r t e D i c h i a r a t i v a
m b x _ h a n d l e r
a t te s a s u lla m a ilbo x
v e n g o n o s c r i tte o le tte lepor te di I/O
O pe r az ion e diI/O e s e g u i tac on s u c c e s s o
m es s ag g ior ic ev u to
ER R O R E!ar r e s to de l s i s te m a
NO
S I
init_ m o dule
A llo c a la m e m o ria n e c e s s aria ec o lle g a i p u n tato ri alle fu n zio n i
c le a nup_ m o dule
D e al l o c a l a m e m o r i a
P u n tato ri a fu n zio n i e v ariab ili c o n d iv is eM B X
.. . .
P a r t e D i c h i a r a t i v a
m b x _ h a n d l e r
a t te s a s u lla m a ilbo x
v e n g o n o s c r i tte o le tte lepor te di I/O
O pe r az ion e diI/O e s e g u i tac on s u c c e s s o
m es s ag g ior ic ev u to
ER R O R E!ar r e s to de l s i s te m a
NO
S I
Modulo UtenteModulo Utente
#define TIMER _O N#define R O BO T_O N#define EVENT1_O N#define EVENT2_O N#define EVENT3_O N#inc lude <s plc _c trlm od.h>
int scan_loop(){...}
static void event1_fun(int e ){ .... }
static void event2_fun(int e ){ .... }
static void event3_fun(int e ){ .... }
#define TIMER _O N#define R O BO T_O N#define EVENT1_O N#define EVENT2_O N#define EVENT3_O N#inc lude <s plc _c trlm od.h>
int scan_loop(){...}
static void event1_fun(int e ){ .... }
static void event2_fun(int e ){ .... }
static void event3_fun(int e ){ .... }
Macro e FunzioniMacro e Funzioni
Input Smartlab:Input Smartlab:
if (FD3) { …azione …} if (SMA_1) { …azione …} ………
Output SmartlabOutput Smartlab : :
AVA=1; OPEN_PINCER_0=1; …….
Output RobotOutput Robot : :
DRIVE_ON(0); set_pos(rob_pos,0); MOVE_TO(0); …..
Input Robot:Input Robot:
if(IS_DRIVE_ON(1)) { …azione … } if(IS_POS_OK(i)) { …azione … } ……
Supervisione : Supervisione :
NEUTRO ‘N’ ; VERDE ‘V’ GRIGIO ‘G’ ; BIANCO ‘B’ NO_PEZ ‘X’ ; IN_MOV ; P1 ; P2 ; SUL_NASTRO START ; STOP ..….
Funzioni Temporali:Funzioni Temporali:
reset_timer(1): load_timer(1,5*SECs); If (!timer(1)) { … azione …}
Fasi e Transizioni :Fasi e Transizioni :
X(1)=1; if (X(1)) { … azione … } CLEAR_TR; TR(1)=1;
Interfaccia Grafica 1/2Interfaccia Grafica 1/2
ConfigurazioneConfigurazione
Interfaccia Grafica 2/2Interfaccia Grafica 2/2
Quadro Quadro SinotticoSinottico
Esempio Modulo UtenteEsempio Modulo Utente
1
0
T r0 S TA R T
re s e tta il c onta tore v iti;s e tta il c o lore ne utro pe r il pe zzo;
T r1
2 m otore na s tro in a va nti
T r2
3
T r3
4fe rm a il na s tro ;
s e tta c o lore pe zzo;
T r4
FD 1
K M A
FD 4
FD 4
#define EVENT1_ON#include <splc_ctrlmod.h>static int c=0; // contatore numero vitistatic int fronte_di_salita(unsigned int in) { static int just1=0; if(in) { if(!(just1)) { just1=1; return 1; }
else return 0; } else { just1=0; return 0;
}}
int scan_loop(){ static int init=0; if(init) goto start; X(0)=1; init=1; // ----- AZIONI ------ //start: if(X(1)) { c=0; COL_PEZ=NEUTRO;} if(X(2)) { AVA=1; } if(X(4)) { AVA=0; switch(c) { case 1: COL_PEZ=VERDE; break; case 2: COL_PEZ=GRIGIO; break;
case 3: COL_PEZ=BIANCO; break; default : COL_PEZ=NEUTRO; break; } } CLEAR_TR// - VALUTAZIONE DELLE // TRANSIZIONI SUPERABILI--- //if(X(0) && START) TR(0)=1;if(X(1) && FD1) TR(1)=1;if(X(2) && KMA) TR(2)=1;if(X(3) && FD4) TR(3)=1;if(X(4) && !FD4) TR(4)=1;//---- AGGIORNAMENTO // DELLA CONDIZIONE -------//if(TR(0)) { X(0)=0; X(1)=1; }if(TR(1)) { X(1)=0; X(2)=1; }if(TR(2)) { X(2)=0; X(3)=1; }if(TR(3)) { X(3)=0; X(4)=1; }if(TR(4)) { X(4)=0; X(1)=1; }
EVENT1=fronte_di_salita(S1);return 0;
}static void event1_fun(int e){ c++;}
Algoritmi di Controllo della Cella 1/4Algoritmi di Controllo della Cella 1/4
Specifiche funzionali del CompitoSpecifiche funzionali del Compito
• Realizzazione di un ciclo di Pallettizzazione/DepallettizzazioneRealizzazione di un ciclo di Pallettizzazione/Depallettizzazione
• Gestione AllarmiGestione Allarmi1. Allarmi di time-out2. Allarmi relativi a consensi elettrici3. Allarmi conseguenti a malfunzionamenti del programma4. Allarmi conseguenti a stati di emergenza
Decomposizione in SFCDecomposizione in SFC
Algoritmi di Controllo della Cella 2/4Algoritmi di Controllo della Cella 2/4
nome descrizione liv. gerarchico
GR1 Generale 1
GR2 Nastro 2
GR3 Robot6A 2
GR4 Robot7A 2
M3.1 Pallet-Robot6A 2 - macrofase
M3.2 Depallet-Robot6A 2 - macrofase
M4.1 Pallet-Robot7A 2 - macrofase
M4.2 Depallet-Robot7A 2 - macrofase
GRA1 Malfunzionamento fotocellule 1
GRA2 Allarme Pinza 0 1
GRA3 Allarme Pinza 1 1
GRA4 Allarme Sovraccarico Termico e EMERG 1
GRA5 Allarme Compressore 1
GRA6 Allarme Riconoscimento Pezzo 1
GRA7 Allarme Robot_6A 1
GRA8 Allarme Robot_7A 1
Algoritmi di Controllo della Cella 3/4Algoritmi di Controllo della Cella 3/4
Esempio SFC : GR1 GeneraleEsempio SFC : GR1 Generale
1
0
T r0 S TA R T an d S TO P
C o n t r o llo N a st r o ;
T r1 N a s t ro O K
2
T r2 P re s s io n e O K e p in ze a p e rte
3 Ac c en s io n e M o to r i R o b o t;
T r3 M o to ri A c c e s i
4 F a se d i P a llettizza zio n e
T r4 F in e P a le t t izza zio n e
5 F a se d i D ep a llettizza zio n e
T r5 F in e D e p a le t t izza zio n e
P R E SS_ O K a n dt im e r ( 0 ) /X ( 2 ) /1 se c
P R E SS_ O K a n dt im e r ( 0 ) /X ( 2 ) /1 se c
R ila ssa p in z a 0 ;R ila ssa p in z a 1 ;
C o n t r o lloP r e ssio n e ;
A p r i P in z a 0 ;A p r i P in z a 1 ;
1
0
T r0 S TA R T an d S TO P
if ( K T & ! Q M & ! E M E R G & ! F D 1 & ! F D 2 & ! F D 3 & ! F D 4 & ! S1 ) n a st r o _ o k = 1 ;
T r1 n a s t ro _ o k
2if ( P R E SS_ O K ) { lo a d_ t im e r ( 0 ,1 * SE C s) ; if ( ! t im e r ( 0 ) ) { O P E N _ P I N C E R _ 0 = 1 ; O P E N _ P I N C E R _ 1 = 1 ; } e lse { R E L A X _ P I N C E R _ 0 ; R E L A X _ P I N C E R _ 1 ; }}
T r2 P R E SS_ O K & SM A _ 0 & SM C _ 0 & SM A _ 1 & SM C _ 1
3 r e se t _ t im e r ( 0 ) ;D R I VE _ O N ( 0 ) ; D R I VE _ O N ( 1 ) ;
T r3 IS _ D RIVE_ O N (0) & IS _ D RIVE_ O N (1)
4
T r4 X (44) & X (84)
5
T r5 X (58) & X (98)
SY S_ ST A T U S= P A L L E T ;
SY S_ ST A T U S= D E P A L L E T ;
SFC FunzionaleSFC Funzionale SFC OperativoSFC Operativo
Algoritmi di Controllo della Cella 4/4Algoritmi di Controllo della Cella 4/4
Esempio SFC Allarme : GRA1 Malfunzionamento FotocelluleEsempio SFC Allarme : GRA1 Malfunzionamento Fotocellule
1 2 0
T r1 2 0
1 2 1
il m o to r e d e l n as tr o è ac c es o
I l m o to r e s i ès p en to T r1 2 2T r1 2 1 I l m o to r e è an c o r a ac c es o ed è s c ad u to il t im er
1 2 2
1 2 3
1 2 4
P o n e il s is t e ma in s t a to d i a lla rme ;S e g n a la il ma lfu n zio n a me n to d e lle F o to c e llu le ;Re s e t t a il t ime r;
T r1 2 3 1
Rila s s a le p in ze ;S p e g n i il mo to re d e l n a s t ro ;D is a b ilit it a tu t t e le fa s i;B lo c c a i ro b o t s e in mo v ime n to ;S p e g n i i mo to ri d e i ro b o t ;
T r1 2 4
I n iz ia liz z a il t im e r ;
C a r ic a il t im e r a 3 0 se c o n di
M o to re d e l n a s t ro s p e n to e M o to ri d e i ro b o t S p e n t i
1 2 0
T r1 2 0
1 2 1
KM A o r KM I
KM A & KM I T r1 2 2T r1 2 1 ( KM A o r KM I ) & t1 0 /X 1 2 1 /2 0 s
1 2 2
1 2 3
1 2 4
SY S_ ST A T U S= P L C _ A L L A R M ; if ( K M A ) A L L A R M _ T Y P E = T I M E _ O U T _ A VA ; e lse A L L A R M _ T Y P E = T I M E _ O U T _ I N D ; r e se t _ t im e r ( 1 0 ) ;
T r1 2 3 1
R E L A X _ P I N C E R _ 0 ; R E L A X _ P I N C E R _ 1 ;A VA = 0 ; I N D = 0 ; ST A R T = 0 ; ST O P = 1 ; in t i; f o r ( i= 0 ;i< 1 1 0 ;i+ + ) X ( i) = 0 ; M O VE T O _ E X I T ( 0 ) = 1 ; M O VE T O _ E X I T ( 1 ) = 1 ; D R I VE _ O F F ( 0 ) ; D R I VE _ O F F ( 1 ) ;
T r1 2 4
r e se t _ t im e r ( 1 0 ) ;
K M A & K M I ) & I S_ D R I VE _ O N ( 0 ) & I S_ D R I VE _ O N ( 1 )
lo a d_ t im e r ( 1 0 ,3 0 * SE C s) ;
SFC FunzionaleSFC FunzionaleSFC OperativoSFC Operativo
Conclusioni e Sviluppi Futuri Conclusioni e Sviluppi Futuri
Obiettivi Raggiunti:Obiettivi Raggiunti:
SOPLICS : Ambiente SOPLICS : Ambiente PC-BasedPC-Based per il controllo e supervisione della cella robotizzataper il controllo e supervisione della cella robotizzata
Sviluppi Futuri:Sviluppi Futuri:
Aggiunta di moduli device-driver per il controllo di nuove apparecchiatureAggiunta di moduli device-driver per il controllo di nuove apparecchiature
Controllo Remoto Lan/WanControllo Remoto Lan/Wan
Modulo di controllo indipendente e programmabile dall’utenteModulo di controllo indipendente e programmabile dall’utente