control example using matlab

37
Control Example using Matlab Cruise Control

Upload: rizkie-denny-pratama

Post on 16-Aug-2015

50 views

Category:

Documents


1 download

DESCRIPTION

Matlab

TRANSCRIPT

Control Example using MatlabCruise Control Modeling a Cruise Control System The inertia of the wheels is neglectedAerodynamic Drag is neglectedis proportional to the square of the cars speed Physical setup and system equations The problem is reduced to the simple mass and damper system It is assumed that friction is opposing the motion of the caris proportional to the car's speed Modeling a Cruise Control System Using ewton's law! the dynamic equation for this system is"u b m# #= + where u is the force from the engine$ There are se%eral different ways to describe a system of linear differential equations$ To calculate the Transfer &unction! we shall use the 'tare 'pace representation then transform it to T& using ss(tf State-space equationsThe state-space representation is gi%en by the equations" where is an n by ) %ector representing the state *commonly position and %elocity %ariables in mechanical systems+! u is a scalar representing the input *commonly a force or torque in mechanical systems+! and y is a scalar representing the output$ Du , y-u Adtd###+ =+ =# State Equation for our CC modelThe state %ectoris . #!/ and y is ###The equationum)mb# #+ = is u b m# #= + or[ ] [ ] u 0#) 0 yum)0#mb0) 0####+=+= Design requirements&or this e#ample! let's assume thatm 1 )0002gb 1 30sec4mu 1 300 Design requirements5hen the engine gi%es a 300 ewton force! the car will reach a ma#imum %elocity of )0 m4s *(( mph+$ An automobile should be able to accelerate up to that speed in less than 3 seconds$ 'ince this is only a cruise control system! a )06 o%ershoot on the %elocity will not do much damage$ A (6 steady7state error is also acceptable for the same reason$ 8ise time 9 3 sec:%ershoot 9 )06'teady state error 9 (6 Matlab representation and open-loop responsem = 1000; b = 50; u = 500; A = [0 1; 0 -b/m] B = [0; 1/m] C = [0 1] D = 0 step(A,u*B,C,D) this step response does not meet the design criteria placed on the problem$ The system is o%erdamped! so the o%ershoot response is fine! but the rise time is too slow$ P controllerThe first thing to do in this problem is to transform the state7space equations into transfer function form$ m = 1000; b = 50; u = 500; A = [0 1; 0 -b/m] B = [0; 1/m] C = [0 1] D = 0 [num,den]=ss2tf(A,B,C,D) e#t! close the loop and add some proportional control to see if the response can be impro%ed$ k = 100; [numc,denc] = c!!p(k*num,den,-1); "C!sed-!!p t#$nsfe# funct%!nt = 0&0'1&20; step(10*numc,denc,t) "f!# 10m/sec t(e s%)n$ used b* step$+%s([0 20 0 10]) Get the ransfer !unction,-!#m = 1000; b = 50; u = 500; A = [0 1; 0 -b/m] B = [0; 1/m] C = [0 1] D = 0 [num,den]=ss2tf(A,B,C,D);atlab should return the following to the command window" num = 00.00100 den = 1.0000 0.0500 0This is the way ;atlab presents the T& 0'001s . 0 ------------------ s/2 . 0'05s . 0 Step function,0(e step funct%!n %s !ne !f m!st usefu funct%!ns %n 1$t$b f!# c!nt#! des%)n' ,2%3en $ s*stem t($t c$n be desc#%bed b* e%t(e# $ t#$nsfe# funct%!n !# $ set !f st$te-sp$ce e4u$t%!ns, t(e #esp!nse t! $ step %nput c$n %mmed%$te* be p!tted' ,A step %nput c$n be desc#%bed $s $ c($n)e %n t(e %nput f#!m 5e#! t! $ 6n%te 3$ue $t t%me t = 0' ,B* def$ut, t(e step c!mm$nd pe#f!#ms $ un%t step (%'e' t(e %nput )!es f#!m 5e#! t! !ne $t t%me t = 0)' ,0(e b$s%c c!mm$nd t! use t(e step funct%!n %s !ne !f t(e f!!7%n) 8 (depend%n) %f *!u ($3e $ set !f st$te-sp$ce e4u$t%!ns !# $ t#$nsfe# funct%!n f!#m)& step(A,B,C,D) step(num,den) P controller The steady state error is more than )06! and the rise time is still too slow$ Ad