SIGNALS AND SYSTEMS LABORATORY 8: Sae Variable Feedback Conrol Syses INTRODUCTION Sae variable descripions for dynaical syses describe he evoluion of he sae vecor, as a funcion of he sae and he inpu. There ay be an oupu equaion as well, bu we shall no be concerned wih i in his discussion. For coninuous ie syses he sae equaion is a differenial equaion of he for f, u. In his equaion, he sae and he conrol inpu u are vecors. Therefore he funcion f, u is also vecor valued. If one akes he inpu a funcion of he sae, u g hen he syse is a sae variable feedback syse. The funcion g is called a conrol law. We shall sudy wo eaples of sae variable conrol syses in his lab. I is generally he case ha he differenial equaions are non-linear. Therefore hey are very difficul o sudy, alhough hey are no paricularly difficul o siulae nuerically using soehing like MATLAB. One analyical design ool which can be used in he viciniy of a vecor is a linearizaion of he syse. This is an approiaion which is valid only for sall disances fro. Provided ha f,, or is a res poin, hen he linearized syse is 3 z Az + Bu, where z is he deviaion of he sae vecor fro he noinal poin. The arices A and B are copued fro he funcion f, u as follows: 5 A i, j fi j, u and 6 B i, j fi u j., u The righ hand side of equaion 3 conains he linear ers in a Taylor series approiaion of he righ hand side of equaion. Using he linearizaion, one can apply several well-known design ehods for linear syses o obain a conrol sraegy. Once ipleened however, he syse will perfor well only in he region for which he linear approiaion is good. We will ge a ase of his in he second proble o be sudied in his lab. Page of 8
TIME OPTIMAL CONTROL OF A LINEAR SYSTEM BUSHAW S PROBLEM u Figure One A echanical syse aced upon by a force u. Consider a rigid body of ass aced upon by a single force. If he syse is consrained o ove in one diension only hen Newon s law of oion is F a. For sipliciy, se he ass o, and call he force u. Then he differenial equaion describing he oion is u. This syse is he uliae in sipliciy, bu i can ake for an ineresing conrol proble. In sae variable for, i has diension wo. If we define he sae vecor o be 7, hen he siple equaion u becoes 8 + u, which is in he for A + Bu. One can ake a feedback syse ou of his by aking he conrol inpu u o be a funcion of he sae vecor. We shall ake his proble ore pracical by consraining he inpu: Conrol inpu consrain: u, for each. This consrain is realisic in any siuaions. For our proble, i liis he acceleraion o a os. A ypical proble involving a bounded inpu is he ie opial conrol proble. The goal is o drive he syse fro any iniial sae o a specified arge in iniu ie. The soluion o his proble is usually bang-bang, which is a colorful way of saying ha he conrol u is alos always or -. In oher words he inpu is always on he boundary of he consrained se of allowable inpus. A feedback conrol law has he for 9 u g,. If we respec he consrain, his funcion canno be linear. Thus he feedback syse will be nonlinear, and will be described by he differenial equaion g, +. Page of 8
Figure Two conains phase plane porrais of he nonlinear syse described by equaion, wih differen conrol laws. These are u aiu acceleraion u aiu deceleraion, if v, linear wih sauraion u γ whereγ v v, if v, if v u sign + bang-bang conrol. u is always eiher full on or full off u u - Linear, wih clipping bang-bang conrol Figure Two Trajecories of he syse u wih four choices for u. Page 3 of 8
Eaine he -file doublin., or double inegraor, found on he web page, and ake noe of how he differenial equaions are nuerically inegraed, using MATLAB: becoes + d + d or +d*. u becoes + d + u d or +d*u. funcion doublina,b,g % doublina,b,g % run he double inegraor. % a and b are vecors of diension % g is a sring describing he conrol funcion % ug, L;T;dT/L;d*[:L-];epsilon.; zeros,l;vzeros,l; :,a;a;a; k; while k<lsuabs[;]-b>epsilon; uevalg; +d*;+d*u; :,k[;]; vku; kk+; end % We have no shown several lines which draw graphs.5 -.5 u -sign*+*abs.5.5 -.5.5 u.5 - -.5.5 phase plane.5 -.5.5 -.5.5 elapsed ie.938.5.5 Figure Three A siulaion of he syse, using he bang-bang conrol law. The equaions are, u, which is apparen fro he graph. Page of 8
This ool nuerically inegraes he differenial equaions and produces he graphs shown in Figure Three. The conrol law is passed as a sring, and herefore you can run he syse for any law ha you can wrie an epression for. The paraeers a and b are colun vecors of diension, wih a he iniial sae and b a arge sae. The siulaion will erinae if he rajecory ges close o b, or if he ie ges o, whichever happens firs. Here is an eaple:»g -sign*+*abs ;»doublin[-;],[;],g.938 The final ie is prined. In his eaple i is jus shor of seconds. See Figure Three. Assignen:. Copue he soluions o he differenial equaion 7 for arbirary iniial condiions, when u. In oher words find forulas for and when a and a.. Design a conrol law u g, which akes he syse o he poin, in iniu 3 ie. The conrol us no violae he consrain ha u, and should work for any choice of iniial condiions. Use he ool doublin. o es your conrol law g. For eaple,»doublinrandn,,[-3;],g eercises he syse wih a rando iniial sae. For your repor, include wo randoized sars, and he specific case»doublin[;],[-3;],g Also repor your conrol law g, and he design philosophy you used o ge i. THE CART AND THE PENDULUM The broo balancing or invered pendulu syse shown in Figure Four has been a popular eaple for any years. The proble is o keep he ball in he air. Noe ha he applied force is raher indirec. We can only ove he car horizonally and hereby influence he pendulu indirecly. This proble is very close o he one ha gave he early builders of rockes headaches. A rocke us be guided fro he base by swiveling he rocke nozzles. If you have seen ovies of early rocke launches, you will have seen rockes ha had o be desroyed because hey wen off course. In his lab we will siulae he dynaics of his syse using he MATLAB differenial equaion solver ode3. We will siulae he oion wih zero applied force, and hen aep o sabilize he syse, abou is unsable zero sae posiion, by linearizing and hen using a linear conrol law. You will sudy his sabilizaion proble, and ge soe daa on is liiaions. The syse is governed by a pair of coupled, second order nonlinear differenial equaions. In order o use he equaion solver we shall pu he in sae variable for. Ne, we will linearize he sae variable equaions abou he unsable res poin where he car and pendulu are a res wih he pendulu sraigh up:. For he resuling linear sae variable equaion, we can ge a sabilizing linear feedback conrol law. Page 5 of 8
Page 6 of 8 rigid pendulu of lengh L and ass ball of ass u pendulu angle, easured counerclockwise fro verical car posiion car of ass Conrol Force Figure Four The Car and he Pendulu wih apologies o Edgar Allen Poe Here are all he equaions: Equaions of oion of he car and pendulu sin sin cos sin cos g u + + + Definiion of Sae vecor for he car and pendulu 3 Non-linear Sae Variable Equaions for he car and pendulu 3 + sin sin cos cos 3 3 3 g u
Linearized Sae Variable Equaions abou he zero sae A + Bu, where Linear feedback conrol law A g + g, and B. 5 u G, where G [g g g 3 g ]. Linearized Feedback syse 6 A + BG. The MATLAB differenial equaion solver ode3 ay be used o copue soluions o he nonlinear equaions. Use he help faciliy o see how ode3 are used. To ake he graph shown in Figure Five, use he following coands: [,y]ode3 car,,,[;pi/6;;]; subplo,,,plo,y:,;ile subplo,,,plo,y:,;ile \hea.5 6 hea -.5-5 5 Figure Five Car posiion and pendulu angle as a funcion of ie, when he conrol force is zero, for iniial condiions, bu π / 6. This is he siuaion depiced in Figure Four. Page 7 of 8
The sring car idenifies he -file car. locaed on he webpage, which conains he equaions. funcion docar, % docar, % Nonlinear equaions of oion for he Car and % pendulu syse, for use by he MATLAB ode solver ode3 g;m;u; %conrol force for free oion % u[.6-53.6 5. -9.]*; % a linear feedback law ccos;ssin; do[3:;inv[m+ -c;-c ]*[u-^*s;g-3**s]]; Visualize he oion of he car and pendulu as he curves in Figure Five depic i. The pendulu falls o he lef and coes up again o an angle opposie he saring angle. I coes o res oenarily and hen reverses iself. Meanwhile he car is rocking back and forh in a periodic oion. The horizonal coponen of oenu is zero for his se of iniial condiions, and wih no force applied. Therefore he car does no have any aggregae horizonal oion. Noice ha here is a choice of conrol inpus in he -file car.. You can acivae he linear feedback law by reoving he coen characer. Wih a lile era effor, one can even produce a priiive ovie of he oion of he car. The -file covie., found on he webpage under -files for Lab 8, assebles several fraes based on he soluion o he differenial equaion, o ake a ovie. Assignen:»[,y]ode3 car,[ 3],[;pi/8;;]; % solve he diff. eqn.»figure,plo,y:,[ ] % This plos and hea»figure % resize he window. Make i sall!»covie_deo % his uses he array y copued by ode3»oviem,3 % M is he ovie produced by covie 3. Using he definiions in equaions 5 and 6, copue he arices A and B of he linearizaion of he syse abou he zero sae. Your resuls should agree wih equaion.. In MATLAB coand ode, creae he arices A and B of he linearized equaion, using he values and g. Then consruc he by ari G[.6,-53.6,5., -9.]. Using he MATLAB eig funcion o coue eigenvalues, copue he eigenvalues of he open-loop syse, eiga, and he eigenvalues of he closed-loop syse, eiga+b*g. Wha do you conclude abou he behavior of he wo syses in he viciniy of he zero sae? 5. Now siulae he car and pendulu syse using ode3 in a anner siilar o he eaple above, ecep ha he -file car. should be edied o acivaed he linear feedback conrol law. Use he sae iniial condiions as in he eaple, bu wih a greaer ie lii. Plo he resuling and hea. Then ry o ake a ovie. Now vary he iniial condiions [ hea ]. Making several runs, wih a shor ie duraion, ry o characerize he region abou he poin, in he,, plane for which he linear conrol syse can balance he broo. Choose several pairs and hen ake arks on he plane of he for + if he pendulu is balanced and - if i isn. Page 8 of 8