Post on 04-Apr-2018
7/29/2019 aircraft control Lecture 10
1/41
16.333Lecture# 10StateSpaceControl
Basicstatespacecontrolapproaches
7/29/2019 aircraft control Lecture 10
2/41
Fall2004 16.33391StateSpaceBasics
Statespacemodelsareoftheformx(t) = Ax(t)+Bu(t)y(t) = Cx(t)+Du(t)
withassociatedtransferfunctionG(s)=C(sIA)1B+D
Note:mustformsymbolicinverseofmatrix(sIA),whichishard. Time response:Homogeneouspartx =Ax, x(0)known
TakeLaplacetransformX(s)=(sIA)1x(0) x(t)=L1 (sIA)1 x(0)
I A A2Butcanshow(sIA)1 = +
s2 + s3 +...s1soL1 (sIA)1 =I+At+2!(At)2+...=eAt
Givesx(t)=eAtx(0)whereeAt isMatrixExponential1
3CalculateinMATLABRusingexpm.mandnotexp.m
Time response: ForcedSolutionMatrixcasex =Ax+Buwherexisann-vectoranduisam-vector.Camshowt
x(t) = eAtx(0)+ eA(t)Bu()d0
ty(t) = CeAtx(0)+ CeA(t)Bu()d+Du(t)
0CeAtx(0)istheinitialresponseCeA(t)B istheimpulseresponseofthesystem.
1MATLABR isatrademarkoftheMathworksInc.
7/29/2019 aircraft control Lecture 10
3/41
Fall2004 16.33392Dynamic Interpretation
SinceA=TT1,then TeAt | | 1t . . . w..1 e =TetT1 =v1 . vn
| | nt Te wn wherewehavewritten
T w.1
.T1 = .T wn
whichisacolumnofrows. Multiplythisexpressionoutandwegetthat
nAt it Te = e viwi
i=1
AssumeAdiagonalizable,thenx =Ax,x(0)given,hassolutionx(t) = eAtx(0)=TetT1x(0)
n
= eitvi{wiTx(0)}i=1
n
it
= e viii=1
Statesolutionisalinearcombinationofthesystemmodesvieieit Determinesthenatureofthetimeresponse
viDetermines
extent
to
which
each
state
contributes
to
that
mode
i Determinesextenttowhichtheinitialconditionexcitesthemode
7/29/2019 aircraft control Lecture 10
4/41
Fall2004 16.33393 Notethatthevi givetherelativesizingoftheresponseofeachpartofthestatevectortotheresponse.
1v1(t)= et mode100.5
v2(t)= e3t mode20.5 Clearlyeit givesthetimemodulation
i realgrowing/decayingexponentialresponsei complexgrowing/decayingexponentialdampedsinusoidal
Bottom line: The locationsoftheeigenvaluesdeterminethepolelocationsforthesystem,thus:Theydeterminethestabilityand/orperformance&transientbe-haviorofthesystem.
It istheir locationsthatwewillwanttomodifywiththecontrollers.
7/29/2019 aircraft control Lecture 10
5/41
Fall2004 16.33394Full-stateFeedbackController
Assumethatthesingle-inputsystemdynamicsaregivenbyx = Ax+ Buy = Cx
sothatD= 0.Themulti-actuator case is quite a bitmore complicated aswewouldhavemanyextradegreesoffreedom.
RecallthatthesystempolesaregivenbytheeigenvaluesofA.Want to use the input u(t) tomodify the eigenvalues of A tochangethesystemdynamics.
r u yOO // A,B,C //
x
K
Assumeafull-statefeedbackoftheform:u= rKx
wherer issomereference inputandthegainK isR1nIfr= 0,wecallthiscontrolleraregulator
7/29/2019 aircraft control Lecture 10
6/41
Fall2004 16.33395 Findtheclosed-loopdynamics:
x = Ax+ B(rKx)= (ABK)x+ Br= Aclx+ Br
y = Cx
Objective:PickK sothatAcl hasthedesiredproperties,e.g.,Aunstable,wantAcl stablePut2polesat2 2j
NotethattherearenparametersinKandneigenvaluesinA,soitlookspromising,butwhatcanweachieve?
Example#1:Consider:1 1
x =1 2
1x+ u
0Then
det(sIA) = (s1)(s2) 1 = s2 s+ 1 = 03sothesystemisunstable.
Defineu= k1 k2 x= Kx,then 1 1 1 1 k1 1 k2
Acl = ABK= k1 k2 =1 2 0 1 2
Sothenwehavethatdet(sIAcl) = s2+ (k13)s+ (1 2k1+ k2) = 0
7/29/2019 aircraft control Lecture 10
7/41
Fall2004 16.33396Thus,bychoosingk1 andk2,wecanputi(Acl) anywhereinthecomplexplane(assumingcomplexconjugatepairsofpoles).
Toputthepolesats= 5, 6,comparethedesiredcharacteristicequation
(s+ 5)(s+ 6) = s2+ 11s+ 30 = 0withtheclosed-loopone
2s + (k13)x+ (1 2k1+ k2) = 0toconcludethat
k13 = 11 k1 = 141 2k1+ k2 = 30 k2 = 57
sothatK= 14 57 ,whichiscalledPolePlacement. Ofcourse, it isnotalwaysthiseasy,asthe issueofcontrollabilitymustbeaddressed.
Example#2:Considerthissystem:1 1
x =0 2
1x+ u
0withthesamecontrolapproach
1 1 1 1 k1 1 k2Acl = ABK= k1 k2 =0 2 0 0 2sothatdet(sIAcl) = (s1 + k1)(s2) = 0The feedbackcontrol canmodify thepoleat s = 1, but it cannotmovethepoleats= 2.
This system cannot be stabilizedwith full-state feedbackcontrol.
Whatisthereasonforthisproblem?
7/29/2019 aircraft control Lecture 10
8/41
Fall2004 16.33397Itisassociatedwithlossofcontrollabilityofthee2tmode.
Basictestforcontrollability: rankMc =n B AB 1 1= 1
0 10Mc = 0 2SothatrankMc 1=
7/29/2019 aircraft control Lecture 10
9/41
Fall2004 16.33398AckermannsFormula
Thepreviousoutlinedadesignprocedureand showedhow todo itbyhandforsecond-ordersystems.Extendstohigherorder(controllable)systems,buttedious.
AckermannsFormulagivesusamethodofdoingthisentiredesignprocessisoneeasystep.
K= 0 . . . 0 1 M1d(A)cMc = B AB . . . An1Bd(s) is the characteristic equation for the closed-loop poles,whichwethenevaluatefors= A.
Itisexplicitthatthesystemmustbecontrollablebecauseweareinvertingthecontrollabilitymatrix.
RevisitExample#1: d(s) = s2+ 11s + 30 1 1 1 1 1 1
= B AB = =Mc 0 1 2 0 0 1So 1 11 2 1 1 1 1K = 0 1 + 11 + 30I
0 1 1 2 1 2 43 14
= 0 1 = 14 5714 57
AutomatedinMatlab: place.m&acker.m(seepolyvalm.mtoo)
7/29/2019 aircraft control Lecture 10
10/41
Fall2004 16.33399 Origins? Forsimplicity,considerathird-ordersystem(case#2),butthisextendstoanyorder. a1 a2 a3 1
A= 1 0 0 B=0 C= b1 b2 b30 1 0 0
This form is useful because the characteristic equation for the2systemisobviousdet(sIA)=s3+a1s +a2s+a3 =0
Canshowthat a1 a2 a3 1
Acl =ABK = 1 0 00 k1 k2 k30 1 0 0
a1k1 a2k2 a3k3=
1 0 0
0 1 0sothatthecharacteristicequationforthesystemisstillobvious:
2cl(s)=det(sIAcl)=s3+(a1+k1)s +(a2+k2)s+(a3+k3)=0 Wethencomparethiswiththedesiredcharacteristicequationdevel-opedfromthedesiredclosed-looppolelocations:
2d(s)=s3+(1)s +(2)s+(3)=0togetthat
a1+k1 =1 k1 =.1a1
.. .. .an+kn =n kn =nan
Pole
placement
is
avery
powerful
tool
and
we
will
be
using
it
for
mostofourstatespacework.
7/29/2019 aircraft control Lecture 10
11/41
Fall2004 16.333910AircraftStateSpaceControl
Cannowdesignafullstatefeedbackcontrollerforthedynamics:xsp =Aspxsp+Bspe
withdesiredpolesbeingatn =3and=0.6s=1.82.4id(s)=s2+3.6s+9
Ksp=place(Asp,Bsp,[roots([1 2*0.6*3 3^2])])w Designcontrolleru= 0.0264 2.3463q
Withfullmodel,couldarrangeitsophugoidpolesremaininthesameplace,justmovetheonesassociatedwiththeshortperiodmode
s=1.82.4i, 0.00330.0672iev=eig(A);% damp short period, but leave the phugoid where it isPlist=[roots([1 2*.6*3 3^2]) ev([3 4],1)];K1=place(A,B(:,1),Plist)
uwu= 0.0026 0.0265 2.3428 0.0363 q
7/29/2019 aircraft control Lecture 10
12/41
Fall2004 16.333911 Canalsoaddthelagdynamicstoshortperiodmodelwithincluded
xsp = Aspxsp+ a
a
=
4
c
Bsp e; e s+4 ex = 4x +4ec, a =xexsp = Asp Bsp xsp 0+ ce x 0 4 x 4
Adds=3todesiredpolelistPlist=[roots([1 2*.6*3 3^2]),-.25,-3];At2=[Asp2 Bsp2(:,1);zeros(1,3) -4];Bt2=[zeros(3,1);4];Kt=place(At2,Bt2,Plist);step(ss(At2-Bt2*Kt2,Bt2,[0 0 1 0],0),35)
wq
x
u= 0.0011 3.4617 4.9124 0.5273
0 5 10 15 20 25 30 350.25
0.2
0.15
0.1
0.05
0
Step Response
Time (sec)
r
ads
Noproblemworkingwithlargersystemswithstatespacetools Maincontrolissueisfindinggoodlocationsforclosed-looppoles
7/29/2019 aircraft control Lecture 10
13/41
Fall2004 16.333912Estimators/Observers
Problem: So farwehaveassumedthatwehave fullaccessto thestatex(t)whenwedesignedourcontrollers.Mostoftenallofthisinformationisnotavailable.
Usually can only feedback information that is developed from thesensorsmeasurements.Couldtryoutputfeedback
u=Kx u=KySameastheproportionalfeedbackwelookedatatthebeginningoftherootlocuswork.
Thistypeofcontrolisverydifficulttodesigningeneral.
Alternative approach: Develop a replicaof thedynamic systemthatprovidesanestimateofthesystemstatesbasedonthemea-suredoutputofthesystem.
Newplan:1.Developestimateofx(t)thatwillbecalledx(t).2.Thenswitchfromu=Kx(t)tou=Kx(t).
Twokeyquestions:Howdowefindx(t)?Willthisnewplanwork?
7/29/2019 aircraft control Lecture 10
14/41
Fall2004 16.333913EstimationSchemes
Assumethatthesystemmodelisoftheform:x = Ax+Bu, x(0)unknowny = Cx
where1.A,B,andC areknown.2.u(t)isknown3.
Measurable
outputs
are
y(t)
from
C
=
I
Goal:Developadynamicsystemwhosestatex(t)=x(t)
foralltimet0.Twoprimaryapproaches:Open-loop.Closed-loop.
7/29/2019 aircraft control Lecture 10
15/41
Fall2004 16.333914Open-loopEstimator
Given thatweknow theplantmatricesandthe inputs,wecanjustperformasimulationthatrunsinparallelwiththesystem
x(t)=Ax +Bu(t)
Thenx(t)x(t)tprovidedthatx(0)=x(0)
MajorProblem:Wedonotknowx(0)SystemA,B,C
x(t)y(t)
//
u(t)//
//ObserverA,B,C
x(t)y(t)
//
Analysisofthiscase. Startwith:x(t) = Ax+Bu(t)x(t) = Ax +Bu(t)
Definetheestimationerror: x(t)=x(t)x(t).Nowwantx(t)=0t.Butisthisrealistic?
7/29/2019 aircraft control Lecture 10
16/41
Fall2004 16.333915 Subtracttoget:
d(x x) = A(x x) x(t) = Axdt
whichhasthesolutionx(t) = eAtx(0)
Givestheestimationerrorintermsoftheinitialerror.
Doesthisguaranteethatx = 0 t?Oreventhatx 0 ast ? (whichisamorerealisticgoal).Responseisfineifx(0) = 0.Butwhatifx(0) = 0?
IfAstable,thenx 0 ast ,butthedynamicsoftheestima-tion errorarecompletelydeterminedby theopen-loopdynamicsofthesystem(eigenvaluesofA).Couldbeveryslow.Noobviouswaytomodifytheestimationerrordynamics.
Open-loopestimationdoesnotseemtobeaverygood idea.
7/29/2019 aircraft control Lecture 10
17/41
Fall2004 16.333916Closed-loopEstimator
Obviouswaytofixtheproblem istousetheadditional informationavailable:Howwelldoestheestimatedoutputmatchthemeasuredoutput?
Compare: y=Cx with y =CxThenformy =yy Cx
SystemA,B,Cx(t)y(t)
//
+
u(t)
//
//
L
ObserverA,B,Cx(t) y(t)//
OO
Approach: Feedbacky toimproveourestimateofthestate.Basicformoftheestimatoris:
x(t) = Ax(t)+Bu(t)+ Ly(t)y(t) = Cx(t)
whereLisauserselectablegainmatrix. Analysis:
x =x x = [Ax+Bu] [Ax +Bu+L(yy)]= A(xx)L(CxCx)= Ax LCx =(ALC)x
7/29/2019 aircraft control Lecture 10
18/41
Fall2004 16.333917 Sotheclosed-loopestimationerrordynamicsarenow
x =(A LC)x withsolution x(t)=e(ALC)t x(0)
Bottom line: Can select the gain L to attempt to improve theconvergenceoftheestimationerror(and/orspeeditup).Butnowmustworryaboutobservabilityofthesystemmodel.
Notethesimilarity:
RegulatorProblem: pickK forA BK3ChooseK R1n (SISO)suchthattheclosed-looppoles
det(sI A+BK)=c(s)areinthedesiredlocations.
EstimatorProblem: pickLforA LC3ChooseL Rn1 (SISO)suchthattheclosed-looppoles
det(sI A+LC)=o(s)areinthedesiredlocations.
Theseproblemsareobviouslyvery similar in fact theyarecalleddualproblems.
7/29/2019 aircraft control Lecture 10
19/41
Fall2004 16.333918EstimationGainSelection
Forregulation,wereconcernedwithcontrollabilityof(A,B)For a controllable systemwe canplace the eigenvaluesofABK arbitrarily.
For
estimation,
were
concerned
with
observability
of
pair
(A,
C).
Foranobservable systemwe canplace the eigenvaluesofALC arbitrarily.
Testusingtheobservabilitymatrix: rankMorank
CCACA2...
CAn1
=n
The procedure for selecting L is very similar to that used for theregulatordesignprocess.
7/29/2019 aircraft control Lecture 10
20/41
Fall2004 16.333919 Oneapproach:
Notethatthepolesof(ALC) and(ALC)T areidentical.Alsowehavethat(ALC)T = AT CTLTSodesigningLT forthistransposedsystem looks likeastandardregulatorproblem(ABK)where
A ATB CTK LT
SowecanuseKe = acker(AT,CT,P) , LKTe
NotethattheestimatorequivalentofAckermannsformulaisthat
L= e(s)M
1o
0...01
7/29/2019 aircraft control Lecture 10
21/41
Fall2004 16.333920SimpleEstimatorExample
Simplesystem 1 1.5 1 .5A = , B= , x(0) = 0
1 2 0 1C = 1 0 , D= 0
Assumethattheinitialconditionsarenotwellknown.Systemstable,butmax(A) = 0.18Testobservability:
Crank
CA1 0
= rank1 1.5
Useopenandclosed-loopestimators. Sincetheinitialconditionsare0
notwellknown,usex(0) = 0 Open-loopestimator:
x = Ax + Buy = Cx
Closed-loopestimator:x = Ax + Bu+ Ly = Ax + Bu+ L(yy)
= (ALC)x+ Bu+ Lyy = Cx
Which isadynamicsystemwithpolesgivenbyi(ALC) andwhichtakesthemeasuredplantoutputsasaninputandgeneratesanestimateofx.
7/29/2019 aircraft control Lecture 10
22/41
Fall2004 16.333921 Typicallysimulatebothsystemstogetherforsimplicity
Open-loopcase:x = Ax+Buy = Cxx = Ax +Buy = Cx
0.51x A 0 x
B x(0)= + u , =x(0) x 0 A x By
C 0 x
=y 0 C x
Closed-loopcase:x = Ax+Bux = (ALC)x+Bu+LCx
x A 0 x B= u
B
x LC ALC x +
Exampleusesastrongu(t)toshakethingsup
00
7/29/2019 aircraft control Lecture 10
23/41
Fall2004 16.333922
0 0.5 1 1.5 2 2.5 3 3.5 41
0.5
0
0.5
1Open loop estimator
states
time
x1x2
0 0.5 1 1.5 2 2.5 3 3.5 41
0.5
0
0.5
1
estimationerror
time
Figure1:Open-loopestimator. Estimationerrorconvergestozero,butveryslowly.
0 0.5 1 1.5 2 2.5 3 3.5 41
0.5
0
0.5
1
Closedloop estimator
states
time
x1x2
0 0.5 1 1.5 2 2.5 3 3.5 41
0.5
0
0.5
1
estimationerror
time
Figure2: Closed-loopestimator. Convergence looksmuchbetter.
7/29/2019 aircraft control Lecture 10
24/41
Fall2004 16.333923AircraftEstimationExample
TakeShortperiodmodelandassume thatwecanmeasure q. Canweestimatethemotionassociatedwiththeshortperiodmode?
xsp = Aspxsp+Bspuy = 0 1 xsp
Takexsp(0)=[0.5;0.05]T Systemstable,socoulduseanopenloopestimator Forclosed-loopestimator,putdesiredpolesat3,4 Forthevariousdynamicsmodelsasbefore
Csp=[0 1]; % sense qKe=place(Asp,Csp,[-3 -4]);Le=Ke;
0 2 4 6 8 1020
15
10
5
0
5
10
x1
Openloop estimator
time0 2 4 6 8 10
0.1
0.05
0
0.05
0.1
x1
time
0 2 4 6 8 108
6
4
2
0
2
4
x1
error
time0 2 4 6 8 10
0.05
0.04
0.03
0.02
0.01
0
0.01
0.02
x2
error
time
0 2 4 6 8 1020
15
10
5
0
5
10
15
x1
Closedloop estimator
time0 2 4 6 8 10
0.1
0.05
0
0.05
0.1
x1
time
0 2 4 6 8 1020
15
10
5
0
x1
error
time0 2 4 6 8 10
0.05
0.04
0.03
0.02
0.01
0
0.01
x2
error
time
Figure3: Closed-loopestimator. Convergence looksmuchbetter. Asexpected,theOLestimatordoesnotdowell,buttheclosed-looponeconvergesnicely
7/29/2019 aircraft control Lecture 10
25/41
Fall2004 16.333924WheretoputtheEstimatorPoles?
LocationheuristicsforpolesstillapplyuseBessel,ITAE,...Maindifference: probablywanttomaketheestimatorfasterthanyou intend tomake the regulator should enhance thecontrol,whichisbasedonx(t).
ROT:Factorof23inthetimeconstantn associatedwiththeregulatorpoles.
Note: When designing a regulator, were concerned with band-width of the control getting too high often results in controlcommandsthatsaturatetheactuatorsand/orchangerapidly.Differentconcernsfortheestimator:Loopclosedinsidecomputer,sosaturationnotaproblem.However,themeasurementsyareoftennoisy,andweneedtobecarefulhowweusethemtodevelopourstateestimates.
Highbandwidthestimatorstendtoaccentuatetheeffectofsens-ingnoiseintheestimate.Stateestimatestendtotrackthemeasurements,whicharefluc-tuatingrandomlyduetothenoise.
LowbandwidthestimatorshavelowergainsandtendtorelymoreheavilyontheplantmodelEssentiallyanopen-loopestimatortendstoignorethemeasure-mentsandjustusestheplantmodel.
7/29/2019 aircraft control Lecture 10
26/41
Fall2004 16.333925 Canalsodevelopanoptimalestimatorforthistypeofsystem.
Which isapparentlywhatKalmandidoneevening in1958whiletakingthetrainfromPrincetontoBaltimore...
Balances effect of the various types of random noise in thesystemontheestimator:
x = Ax+Bu+Bwwy = Cx+v
where:3w: processnoisemodelsuncertaintyinthesystemmodel.3v: sensornoisemodelsuncertaintyinthemeasurements.
FinalThoughts Note that the feedback gain L in the estimator only stabilizes theestimationerror.Ifthesystem isunstable,thenthestateestimateswillalsogoto
,withzeroerrorfromtheactualstates. Estimationisanimportantconceptofitsown.
NotalwaysjustpartofthecontrolsystemCriticalissueforguidanceandnavigationsystem
Morecompletediscussionrequiresthatwestudystochasticprocessesandoptimizationtheory.
Estimationisallaboutwhichdoyoutrustmore: yourmea-surementsoryourmodel.
7/29/2019 aircraft control Lecture 10
27/41
Fall2004 16.333926CombinedRegulatorandEstimator
Asadvertised,wecanchangethepreviouscontrolu=Kxtothenewcontrolu=Kx (sameK).Wenowhavex = Ax+Buy = Cxx = Ax +Bu+L(yy)y = Cx
withclosed-loopdynamics x A BK xx
=LC ABKLC x xcl =Aclxcl
Notobviousthatthissystemwillevenbestable: i(Acl)
7/29/2019 aircraft control Lecture 10
28/41
Fall2004 16.333927 Absolutelykeypoints:
1.i(Acl)i(Acl)why?2.Acl isblockuppertriangular,socanfindpolesbyinspection:
det(sIAcl)=det(sI(ABK))det(sI(ALC))
Theclosed-looppolesofthesystemconsistoftheunionofthe regulatorandestimatorpoles
Sowecandesigntheestimatorandregulatorseparatelywithconfi-dencethatcombinationofthetwowillworkVERYwell.
Compensatorisacombinationoftheestimatorandregulator.x = Ax +Bu+L(yy)
= (ABKLC)x+Lyu
=
Kx
xc = Acxc+Bcyu = Ccxc
Keeptrackofthisminussign.Weneedoneinthefeedbackpath,butwecanmoveitaroundtosuitourneeds.
7/29/2019 aircraft control Lecture 10
29/41
Fall2004 16.333928 LetGc(s) bethecompensatortransferfunctionwhere
u=
Cc(sI
Ac)
1
Bc = Gc(s)y= K(sI(ABKLC))1L
sobymydefinition,u= Gcy Gc(y)
Reason formaking the definition is that when we implement thecontroller,weoftendonotjustfeedbacky(t),butinsteadhavetoincludeareferencecommandr(t)Useservoapproachandfeedbacke(t) = r(t) y(t) instead
r//
e// Gc(s) u // G(s) y//
OO
Sonowu= Gce= Gc(ry).Andifr= 0,thenwestillhaveu= Gc(y)
Importantpoints:Closed-loopsystemwillbestable,butthecompensatordynamicsneednotbe.
OftenverysimpleandusefultoprovideclassicalinterpretationsofthecompensatordynamicsGc(s).
7/29/2019 aircraft control Lecture 10
30/41
Fall2004 16.333929 Mechanicsofclosingtheloop
G(s) :x = Ax+ Buy = Cx
Gc(s) :xc = Acxc+ Bceu = Ccxc
ande= ry,u= Gce,y= Gu.
LoopdynamicsL= GGc y= L(s)ex = Ax+ Bu= Ax+ BCcxc
xc = Acxc+ Bce
x A BCc x 0= + exc 0 Ac xc Bc x
y = C 0xc
Nowformtheclosed-loopdynamicsbyinsertinge= ry x A BCc x 0 x=xc 0 Ac xc + Bc r C 0 xc
A BCc x 0= + r
BcC Ac xc Bc
xy = C 0xc
7/29/2019 aircraft control Lecture 10
31/41
Fall2004 16.333930Performance Issue
OftenfindwithstatespacecontrollersthattheDCgainoftheclosedloopsystemisnot1. Soy=r insteadystate.
RelativelysimplefixistomodifytheoriginalcontrollerwithscalarNu=rKxu=NrKx
Closed-loopsystemonpage5becomesx =Ax+B(NrKx)=Aclx+BNr Gcl(s)=C(sIAcl)1BNy =CxAnalyzesteadystatestepresponseyss =Gcl(0)rstep
Gcl(0)=C(Acl)1BNAndpickN sothatGcl(0)=1N = 1(C(Acl)1B)
AbitmorecomplicatedwithacombinedestimatorandregulatorOnesimpleway(notthebest)ofachievingasimilargoalistoadd
N torandforceGcl(0)=1Nowtheclosed-loopdynamicsonpage29become:x x=Acl +BclNrxc 1N =
(Ccl(Acl)1Bcl)xc xy =Ccl xc
Notethatthisfixesthesteadystatetrackingerrorproblems,but inmyexperiencecancreatestrangetransients(oftenNMP).
7/29/2019 aircraft control Lecture 10
32/41
Fall2004 16.333931Example: CompensatorDesign
1 x =Ax+BuG(s)=s2+s+1 y=Cx
where 0 1 0
A= B= C= 1 01 1 1
Regulator: Want regulator poles to have a time constant of c =1/(n)=0.25sec(ABKr)=44jwhichcanbefoundusingplaceorackerK_r=acker(a,b,[-4+4*j;-4-4*j]);togiveKr = [ 31 7 ]
Estimator:wanttheestimatorpolestobefaster,sousee
=
1/(n)
=
0.1
sec.
Use
real
poles,
(A
LeC)
=
10
L_e=acker(a,c,[-10 -10]);
19whichgivesLe = 80
FormcompensatorGc(s)ac=a-b*K_r-L_e*c;bc=L_e;cc=K_r;dc=0;
Ac = 19 1 19 Bc = Cc = 31 7112 808(s+2.5553) u
Gc(s)=1149 =s2+27s+264 e
Lowfrequencyzero,withhigherfrequencypoles(likealead)
7/29/2019 aircraft control Lecture 10
33/41
Fall2004 16.333932
101
100
101
102
100
101
102
Freq (rad/sec)
Mag
Plant GCompensator Gc
101
100
101
102
200
150
100
50
0
50
Freq (rad/sec)
Phase
(deg)
Plant GCompensator Gc
Figure4:Thecompensatordoesindeedlooklikeahighfrequencylead(amplificationfrom216rad/sec). Plantprettysimple looking.
7/29/2019 aircraft control Lecture 10
34/41
Fall2004 16.333933
101
100
101
102
100
101
102
Freq (rad/sec)
Mag
Loop L
101
100
101
102
250
200
150
100
50
0
Freq (rad/sec)
Phase
(deg)
Figure5:ThelooptransferfunctionL= GcGshowsaslopechangearoundc = 5rad/secduetotheeffectofthecompensator. Significantgainandphasemargins.
7/29/2019 aircraft control Lecture 10
35/41
Fall2004 16.333934
150
100
50
0
50
Magnitude(dB)
102
101
100
101
102
103
270
225
180
135
90
45
0
Phase
(deg)
Bode DiagramGm = 14.3 dB (at 14.9 rad/sec) , Pm = 45.8 deg (at 4.84 rad/sec)
Frequency (rad/sec)
Figure6: Quitesignificantgainandphasemargins.
7/29/2019 aircraft control Lecture 10
36/41
Fall2004 16.333935
40 35 30 25 20 15 10 5 0 5 1025
20
15
10
5
0
5
10
15
20
25
Root Locus
Real Axis
ImaginaryAxis
Figure7: Freezethecompensatorpolesandzerosanddrawaroot locusversusanadditionalplantgain,G(s) G(s) =
(s2+
s+1).Notelocationoftheclosed-looppoles!!
7/29/2019 aircraft control Lecture 10
37/41
Fall2004 16.333936
101
100
101
102
102
101
100
101
102
Freq (rad/sec)
Mag
Factor of N=1.0899 applied to Closed loop
Plant Gclosedloop G
cl
Figure8: Closed-looptransfersystembandwidthhas increasedsubstantially.
7/29/2019 aircraft control Lecture 10
38/41
Fall2004 16.333937
EstimatorDesign(est1.m)1 clear all2 close all3 figure(1);clf4 set(gcf,DefaultLineLineWidth,2)5 set(gcf,DefaultlineMarkerSize,10)6 figure(2);clf7 set(gcf,DefaultLineLineWidth,2)8 set(gcf,DefaultlineMarkerSize,10)910 load b747 % get A B Asp Bsp11 Csp=[0 1]; % sense q1213 Ke=place(Asp,Csp,[-3 -4]);Le=Ke;1415 xo=[-.5;-.05]; % start somewhere1617 t=[0:.01:10];N=floor(.15*length(t));18 % hit on the system with an input19 %u=0;u=[ones(15,1);-ones(15,1);ones(15,1)/2;-ones(15,1)/2;zeros(41,1)]/5;20 u=0;u=[ones(N,1);-ones(N,1);ones(N,1)/2;-ones(N,1)/2]/20;21 u(length(t))=0;2223 [y,x]=lsim(Asp,Bsp,Csp,0,u,t,xo);24 plot(t,y)2526 % closed-loop estimator27 % hook both up so that we can simulate them at the same time28 % bigger state = state of the system then state of the estimator29 A_cl=[Asp zeros(size(Asp));Le*Csp Asp-Le*Csp];30 B_cl=[Bsp;Bsp];31 C_cl=[Csp zeros(size(Csp));zeros(size(Csp)) Csp];32 D_cl=zeros(2,1);3334 % note that we start the estimators at zero, since that is35 % our current best guess of what is going on (i.e. we have no clue :-) )36 %37 [y_cl,x_cl]=lsim(A_cl,B_cl,C_cl,D_cl,u,t,[xo;0;0]);38 figure(1)39 subplot(221)40 plot(t,x_cl(:,[1]),t,x_cl(:,[3]),--)41 ylabel(x1);title(Closed-loop estimator);xlabel(time);grid42 subplot(222)43 plot(t,x_cl(:,[2]),t,x_cl(:,[4]),--)44 ylabel(x1);xlabel(time);grid45 subplot(223)46
plot(t,x_cl(:,[1])-x_cl(:,[3]))
47 ylabel(x1 error);xlabel(time);grid48 subplot(224)49 plot(t,x_cl(:,[2])-x_cl(:,[4]))50 ylabel(x2 error);xlabel(time);grid51 print -depsc spest_cl.eps52 jpdf(spest_cl)5354 % open-loop estimator55 % hook both up so that we can simulate them at the same time56 % bigger state = state of the system then state of the estimator57 A_ol=[Asp zeros(size(Asp));zeros(size(Asp)) Asp];58 B_ol=[Bsp;Bsp];59 C_ol=[Csp zeros(size(Csp));zeros(size(Csp)) Csp];60 D_ol=zeros(2,1);6162 [y_ol,x_ol]=lsim(A_ol,B_ol,C_ol,D_ol,u,t,[xo;0;0]);63 figure(2)64 subplot(221)65 plot(t,x_ol(:,[1]),t,x_ol(:,[3]),--)66 ylabel(x1);title(Open-loop estimator);xlabel(time);grid
7/29/2019 aircraft control Lecture 10
39/41
Fall2004 16.33393867 subplot(222)68 plot(t,x_ol(:,[2]),t,x_ol(:,[4]),--)69 ylabel(x1);xlabel(time);grid70 subplot(223)71
plot(t,x_ol(:,[1])-x_ol(:,[3]))
72 ylabel(x1 error);xlabel(time);grid73 subplot(224)74 plot(t,x_ol(:,[2])-x_ol(:,[4]))75 ylabel(x2 error);xlabel(time);grid76 print -depsc spest_ol.eps77 jpdf(spest_ol)78
7/29/2019 aircraft control Lecture 10
40/41
Fall2004 16.333939
Regular/EstimatorDesign(regest.m)1 % Combined estimator/regulator design for a simple system2 % G= 1/(s^2+s+1)3 %4 % Jonathan How5 % Fall 20046 %7 close all;clear all8 for ii=1:59 figure(ii);clf;set(gcf,DefaultLineLineWidth,2);set(gcf,DefaultlineMarkerSize,10)10 end1112 a=[0 1;-1 -1];b=[0 1];c=[1 0];d=0;13 k=acker(a,b,[-4+4*j;-4-4*j]);14 l=acker(a,c,[-10 -10]);15 %16 % For state space for G_c(s)17 %18 ac=a-b*k-l*c;bc=l;cc=k;dc=0;1920 G=ss(a,b,c,d);21 Gc=ss(ac,bc,cc,dc);2223 f=logspace(-1,2,400);24 g=freqresp(G,f*j);g=squeeze(g);25 gc=freqresp(Gc,f*j);gc=squeeze(gc);2627 figure(1);clf28 subplot(211)29 loglog(f,abs(g),f,abs(gc),--);axis([.1 1e2 .2 1e2])30 xlabel(Freq (rad/sec));ylabel(Mag)31 legend(Plant G,Compensator Gc);grid32 subplot(212)33 semilogx(f,180/pi*angle(g),f,180/pi*angle(gc),--);34 axis([.1 1e2 -200 50])35 xlabel(Freq (rad/sec));ylabel(Phase (deg));grid36 legend(Plant G,Compensator Gc)3738 L=g.*gc;3940 figure(2);clf41 subplot(211)42 loglog(f,abs(L),[.1 1e2],[1 1]);axis([.1 1e2 .2 1e2])43 xlabel(Freq (rad/sec));ylabel(Mag)44 legend(Loop L);45 grid46
subplot(212)
47 semilogx(f,180/pi*phase(L.),[.1 1e2],-180*[1 1]);48 axis([.1 1e2 -290 0])49 xlabel(Freq (rad/sec));ylabel(Phase (deg));grid50 %51 % loop dynamics L = G Gc52 %53 al=[a b*cc;zeros(2) ac];54 bl=[zeros(2,1);bc];55 cl=[c zeros(1,2)];56 dl=0;57 figure(3)58 rlocus(al,bl,cl,dl)59 %60 % closed-loop dynamics61 % unity gain wrapped around loop L62 %63 acl=al-bl*cl;bcl=bl;ccl=cl;dcl=d;6465 N=inv(ccl*inv(-acl)*bcl)66
7/29/2019 aircraft control Lecture 10
41/41
Fall2004 16.33394067 hold on;plot(eig(acl),d);hold off68 grid69 %70 % closed-loop freq response71
%
72 Gcl=ss(acl,bcl*N,ccl,dcl);73 gcl=freqresp(Gcl,f*j);gcl=squeeze(gcl);7475 figure(4);clf76 loglog(f,abs(g),f,abs(gcl),--);77 axis([.1 1e2 .01 1e2])78 xlabel(Freq (rad/sec));ylabel(Mag)79 legend(Plant G,closed-loop G_{cl});grid80 title([Factor of N=,num2str(N), applied to Closed loop])8182 figure(5);clf83 margin(al,bl,cl,dl)8485 figure(1);orient tall;print -depsc reg_est1.eps86 jpdf(reg_est1)87 figure(2);orient tall;print -depsc reg_est2.eps88 jpdf(reg_est2)89 figure(3);print -depsc reg_est3.eps90 jpdf(reg_est3)91 figure(4);print -depsc reg_est4.eps92 jpdf(reg_est4)93 figure(5);print -depsc reg_est5.eps94 jpdf(reg_est5)