!"#$%&'#%()*"+",'-&)%&+)#.&/*.()0'/$)%)123).4)%&)
'&5"*/"+)6"&+7(78))
9('%&%):#7*'.)!;&+"<)
):*"%).4)=>,/"8,)9&-'&""*'&-)%&+):7/.8%/'.&) ?&'5"*,'+%+)+")@5'"+.)
A'B.&C)=6%'&) "('%&%D%#7*'.E-8%'(D#.8)
Abstract—The interest in studying the different techniques of control and its real-time responses, has made of the system of inverted pendulum a classic control problem. This system is highly nonlinear, with multiple inputs and a single output and belongs to a special class of mechanical systems called underactuated, in which there are fewer control inputs than degrees of freedom. In order to relate the PLC programming with the control of this kind of systems, classical control algorithms and fuzzy algorithms have been implemented in the PLC Siemens S7-200. The PID control has been developed using the tool that the PLC provides for this controller while the fuzzy control with each of its stages (fuzzification, inference engine and defuzzification) has been configured from a user interface and the mathematical algorithm has been implemented in the PLC.
Keywords- Pendulum; S7-200; PID; inference; fuzzification; defuzzification; automation.
Resumen—El interés por estudiar las diferentes técnicas de
control y sus respuestas en tiempo real, ha hecho del sistema de péndulo invertido un problema clásico de control. Este sistema es altamente no lineal, con múltiples entradas y una sola salida y pertenece a una clase especial de sistemas mecánicos llamados subactuados, en los cuales hay menos actuadores que grados de libertad.
Con el objetivo de relacionar la programación de autómatas con el control de este tipo de sistemas, se ha implementado tanto algoritmos de control clásico como algoritmos difusos en un PLC Siemens S7-200. El control PID se ha realizado utilizando las herramientas que el PLC posee para la configuración de este tipo de controlador, mientras que el control difuso con cada una de sus etapas constitutivas (fusificación, motor de inferencias y defusificación), ha sido configurado desde una interfaz de usuario y el algoritmo matemático desarrollado en el PLC.
Palabras Claves- Péndulo; S7-200; PID; inferencia; fusificación; defusificación; automatización.
FD G:3HAI@?JK):JK)LM9@I9LF3:2)G:=F=
L$")'&5"*/"+)6"&+7(78)6(%&/)',)%)&.&('&"%*),>,/"8)%&+)'/)',) 0'+"(>)7,"+)4.*)/",/'&-)+'44"*"&/)#.&/*.()%(-.*'/$8,D))
L$"*")',)%)0'+")5%*'"/>).4)%66('#%/'.&,).4)/$',),>,/"8),7#$) %,) #*%&") ,/%N'('<%/'.&C) 5"$'#(") +"5"(.68"&/) 0'/$) 6"&+7(78) ,>,/"8 O="-0%>” %&+ 8.+"('&- 4.* ,"',8ic #.&/*.l .4 N7'(+'&- ,/*7#/7*",D) F&) /$") %"*.,6%#") 4'"(+C) '/) ',) 7,"+) 4.*) /$") %#/'5") #.&/*.() .4) %) *.#P"/) '&) .*+"*) /.) P""6) '/) 76*'-$/) %/) /$") /'8") .4)
/%P".44C) /$") 8.+"('&-) .4) N'6"+) *.N./,C) ,%/"(('/") 6.,'/'.&'&-C) N%(%&#"),/%N'('<%/'.&).4),$'6,)%&+)%'*#*%4/,D)
Q'-7*")RD) F&5"*/"+)6"&+7(78),>,/"8)%66('#%/'.&,)
A. Mathematical model
G"4.*")7,'&-)+'44"*"&/)#.&/*.()%(-.*'/$8,C)/$")8%/$"8%/'#%( 8.+"() ',) 7,"+) '&) .*+"*) /.) %&%(><") /$") ,>,/"8) .6"*%/'.&) %&+) ,"("#/)%&)%66*.6*'%/")#.&/*.(("*D)
Q'-7*")SD) Q*"")N.+>)+'%-*%8).4)/$"),>,/"8)
!"#$%&'(& !"#$%&)*&+","-%!%,.&)*&!/%&-%0/"1'.-&
&
&
*23456&7(& -89:6;892<8=&;>?6=&>@&9:6&ABA96;&
B. Classic controllers
'CA2?6& 9:6& <=8AA2<& <>C95>=& 8=3>529:;AD& 9:656& 856& ?2@@656C9& 9BE6A& >@& <>C95>==65A& A4<:& 8AD& E5>E>592>C8=& F+GD& E5>E>592>C8=H 2C96358=& F+'GD& E5>E>592>C8=H?652I892I6& F+JG& 8C?& E5>E>592>C8=H 2C96358=H?652I892I6& F+'JG& 9:89& E65;29& 9>& <>C95>=& 9:2A& ABA96;& <>CA2?652C3&A>;6&E858;6965A&@>5&94C2C3(&"&E>AA2K2=29B&2A&4A2C3& :6452A92<A&54=6A&8A&A:>LC&9:6&@23456&7(&
!"#$%&''(& &/%M,'.!'0&,M$%.&*),&.%!!'1N&+","-%!%,.&
&
C. Fuzzy controller
!:2A& 2A& 8C>9:65& E>AA2K2=29B& >@& <>C95>=& @>5& 9:2A& ;6<:8C2A;& K6<84A6& :8A& A23C2@2<8C9& 8?I8C9836A& @>5& ?BC8;2<& ABA96;A& 9:89& <8C& K6& <:858<9652O6?& K69965& 2C& L>5?A& 9:8C& KB& ;89:6;892<8=& 8EE5>P2;892>CA(&"=A>&9:2A&<>C95>==65&2A&<>CA2?656?&I65B&5>K4A9D& 8EE5>E52896& @>5& ;4=92E=6& 2CE49A& 8C?& >49E49A& 8C?& :8A& <:68E& 2;E=6;6C9892>C(&
&
!:6&@23456&Q&A:>LA&9:6&A9836A&>@&9:6&@4OOB&8=3>529:;(&
&
*23456&Q(& *4OOB&8=3>529:;&
''( &J%.'N1&)*&%$%0!,)1'0&"1J&0)1!,)$&.R.!%-&
A. Electronic design
!:6& 2CI6596?& E6C?4=4;& ABA96;& <>CA2A9A& >@& 8& ;6<:8C2<8=D& 6=6<95>C2<&8C?&<>C95>=&A4KABA96;A&9:89&L>5S&9>369:65&9>&8<:26I6& 9:6&A98K2=2O892>C&>@&9:6&E6C?4=4;(&
& *23456&T(& .BA96;&A<:6;6&
'CA2?6&9:6&6=6<95>C2<&ABA96;D&8&E52C96?&<25<429&K>85?&F+0#G& L8A& ?6A23C6?& 2C& >5?65& 9>& 8?U4A9& 9:6& I>=9836& A23C8=& >@& 9:6& E>96C92>;6965&8C?&56?4<6&9:6&@56V46C<B&>@&9:6&6C<>?65&A23C8=(& *459:65;>56D& 9:6& A65I>& <>C95>=& A23C8=& 2A& 8;E=2@26?& 2C& I>=9836& 8C?& <4556C9& 2C& >5?65& 9>& 8?8E9& 9:2A& A23C8=& 9>& 9:6& 2CE49A& >@& 9:6& E5>358;;8K=6&=>32<&<>C95>==65&F+$0G(&
& *23456&W(& J28358;&>@&;82C&6=6<95>C2<&K>85?&
B. Control System Design
!"#$ %&'()&*$ +,+(#-$ .+$ /#0#*&1#/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3A2!;0/3/3B;2#!
! C79:02!DD#!E2@/.1737/.7.9!/=!3A2!;0/3/3B;2!
FB! 5.54BG7.9! 3A2! 17851H5.35928! /=! 3A2! @:002.3! 8B8326<! 5! .2I!;0/3/3B;2!3A53!/==208!9025320!=5@7473728!3/!?2!:821!58!5!3283! ;453=/06!A58!?22.!12879.21!#!J73A7.!/=!!3A2!12879.!@/.1737/.8<! 73!A58!?22.!@/.8712021K!
$5>76:6! 42.93A! /=! LM! @6! 3/! 3A2! 6/H262.3! ;53A! /=! 3A2!@5007592#!
*7673537/.8!/.!3A2!0/3537/.!8712!/=!3A2!;2.1:4:6#! ,;221!D#L!!6N8#!
*/I! @/83<! ;/035?42<! 479A3I279A3<! 258B! 3/! 657.357.! 5.1! 02;570#!
!
C79:02!DO#!+2879.!/=!5!.2I!;0/3/3B;2!
!
"P# E%,Q*R,!
RA2! [email protected]! A58! ?22.! 328321! I73A! 3A2! 3I/! 3B;28! /=! @/.30/44208! 5.1! 3A2! 028:438! /?357.21! 502! 8A/I.! 7.! 3A2! =79:028! ?24/I#!
!
C79:02!DS#!T/8737/.!@/.30/4!028;/.82!I73A!T"!@/.30/4420!
!
C79:02!DU#!T2.1:4:6!@/.30/4!028;/.82!I73A!T+!@/.30/4420!
!
C79:02!DL#!C:GGB!@/.30/4420!028;/.82!I73A!/.2!7.;:3!
! C79:02!DV#!C:GGB!@/.30/4420!028;/.82!I73A!3I/!7.;:38!
!" #$%#&'()$%(
#*+,,-.+*/ .01230*/ 452607,/ 6+85/ 935+2/ :;1.2-01+*-2</ -1 7-::53512/2<=5,/0:/,<,254,>/?;2/6+85/.532+-1/*-4-2+2-01, -1/@)@$/,<,254,/A4;*2-=*5/-1=;2/+17/4;*2-=*5/0;2=;2B +17/ 26-,/ 6+,/ ?551/ =30857/ C651/ 23<-19/ 20/ ?+*+1.5/ 265 =517;*;4/C-26/D)E/.01230**53"
F3-.2-01/ =30?*54,/ -1/ 45.6+1-,4/ -1253:535/ C-26/ 265
=517;*;4/ ,2+?-*-G+2-01/ ?5.+;,5/ 6-9653/ 80*2+95/ 20 0853.045/265/-1532-+/0:/265/.+33-+95/-,/35H;-357" F03/ 265/ :;GG</ .01230**53>/ .+*-?3+2-01/ -,/ +/ =30.5,,/ 26+2
2+I5,/+/853</*019/2-45/?5.+;,5/-2/-,/?+,57/01/23-+*/+17 53303/25,2>/,0/-2/-,/102/=0,,-?*5/20/51,;35/0=2-4+*/35,;*2, -4457-+25*<"/ @0350853>/ 265/ :;GG</ .01230*/ +*903-264 75=517,/,23019*</01/265/+?-*-2</0:/265/D&#/20/=53:034 :*0+2-19/ =0-12/ 0=53+2-01,"/ J6-,/ 7-35.2*</ +::5.2,/ 265 +40;12/ 0:/ 45403</ 155757/ +17/ 265/ ,=557/ -1/ 03753/ 20 =30.5,,/260,5/0=53+2-01,"
E;3-19/ 25,2-19/ 0:/ 265/ :;GG</ +*903-264>/ 015/ .0;*7 35+*-G5/ 26+2/ 265/ 35,=01,5/ -4=3085,/ -:/ 2C0/ -1=;2 8+3-+?*5,/ +35/ ;,57/ +17/ C-26/ +/ 7-,23-?;2-01/ 0:/ 265 454?53,6-=/:;1.2-01,/4035/.01.5123+257/-1/265/.51253
0:/265/3+195"/J65/4035/K0-157/265/:;1.2-01,/+35/01/265/ 15+3/ G530/ 8+*;5,>/ -2/ 6+,/ +/ 6-9653/ 35,0*;2-01/ 03/ :-153/ :;GG-:-.+2-01/+2/260,5/3+195,"/
LMFMLM%#M(/
NOP Q" M+,01> R" %0?*5> +17 )" %" (157701> SJ65/ L5+.2-01/ T655* D517;*;4U>/@039+1/V/#*+<=00*/D;?*-,653,>/WXXY"/
NWP @"/ Z1201-0>/ #"/ @[3H;5G>/ L"/ (-*8+/ </ #"/ @53*0, S(-,254+,/ 7-1[4-.0,/ ,;?+.2;+70,\/ D]17;*0,/ -18532-70,”, )1,2-2;20/ D0*-2].1-.0/ %+.-01+*>/ #)EMJM#>/@]^-.0"/
N_P (-5451s, S@+1;+*/75*/,-,254+/75/+;204+2-G+.-`1/(YaWXXU>/WXXb"/ NcP (-5451s, SMK54=*0,/(YaWXX"/M,.+*+70 75 8+*035s +1+*`9-.0,U>/MK54=*0/
%d/_b"/
NeP Z" D]35G $2530> SE5,+330**0/ 75/ *+/ =*+12+/ 5^=53-4512+*/ D]17;*0/ )18532-70U> '1-853,-7+7 75/$8-570>/(5=2-54?35/Offb"/
NgP h;+19/ #6;1aM>/ &)/ E019ah+-> (U i019> S(-4;*+2-01/ +17/ L0?;,215,,/ (2;7-5,/ 01/ +1 )1853257 D517;*;4U>/ D30.557-19,/ 0:/ 265/ _X26/ #6-15,5/ #01230*/#01:5351.5>/j;*</WWaWc>/WXOO>/i+12+->/#6-1+"
NYP @" D-157+> Z" !-8+,> S#01230*/ 75/ ;1/ 4075*0/ +5307-1[4-.0/ +=*-.+170/ ,-,254+,/7-:;,0,U> M,.;5*+/D0*-2].1-.+/%+.-01+*>/k;-20>/M.;+703>/WXXb"