Total Notes
Total Notes
Motivation
Fall 2010 16.30/31 12
16.30/31: Introduction
d
r e u y
Gc(s) Gp(s)
Goal: Design a controller Gc(s) so that the system has some desired
characteristics. Typical objectives:
Stabilize the system (Stabilization)
Regulate the system about some design point (Regulation)
Follow a given class of command signals (Tracking)
Reduce response to disturbances. (Disturbance Rejection)
September 9, 2010
Fall 2010 16.30/31 13
But there are also many stable systems that simply require better
performance in some sense (e.g., faster, less oscillatory), and we
can use control to modify/improve this behavior.
September 9, 2010
Fall 2010 16.30/31 14
Obtain model
Analytic (FEM) or from measured data (system ID)
Evaluation model reduce size/complexity Design model
Accuracy? Error model?
Design controller
Select technique (SISO, MIMO), (classical, state-space)
Choose parameters (ROT, optimization)
September 9, 2010
Fall 2010 16.30/31 15
Will not focus too much on the classical design in this course, but
personally think it is important to know the design process for
classical controllers, and you should be able to provide a classical
interpretation of any advanced control technique as a sanity check
Try to answer why did it do that?
Not always possible, but always a good goal.
Texts provide full design process we will only review it
September 9, 2010
Fall 2010 16.30/31 16
State-Space Approach
Bottom line:
2. Why:
State variable form convenient way to work with complex dy
namics. Matrix format easy to use on computers.
Transfer functions only deal with input/output behavior, but
state-space form provides easy access to the internal fea
tures/response of the system.
Allows us to explore new analysis and synthesis tools.
Great for multiple-input multiple-output systems (MIMO), which
are very hard to work with using transfer functions.
September 9, 2010
Fall 2010 16.30/31 17
September 9, 2010
Fall 2010 16.30/31 18
September 9, 2010
Fall 2010 16.30/31 19
Implementation Issues
But with the increase in processor speeds and the ability to develop
code right from simulink (e.g., RTW), there is not much point dis
cussing all of the intricacies of digital design
But sometimes you have to use a small computer and/or you dont
get all the cycles
So we will discuss the process enough to capture the main issues and
the overall implementation approach
Bottom line is that as long as you sample fast enough the eects
are not catastrophic - it just adds a little bit more delay to the
feedback loop.
Easily predicted and relatively easy to account for.
Provides feedback on how fast you need to go go faster costs
more money and can create numerical implementation issues
Much of the implementation done for the labs will be using code
automatically developed straight from simulink
You are probably familiar with Matlab, but should practice with
Simulink as well, as that will be used for the HW and the labs.
September 9, 2010
Fall 2010 16.30/31 110
Feedback
Muddy cards and oce hours.
Help me to know whether my assumptions about your backgrounds
is correct and whether there are any questions about the material.
September 9, 2010
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #2
1
1
0.68 0.54 0.42 0.3 0.2 0.09
0.8
0.8
0.84 0.6
0.6
0.4
0.4
0.95
0.2
0.2
Imaginary Axis
0.2
0.2
0.95
0.4
0.4
0.6
0.84 0.6
0.8
0.8
5
POOR
ACCEPTABLE
4
3 SATISFACTORY
2
UNACCEPTABLE
1
0
0.1 0.2 0.4 0.6 0.8 1 2 4
Damping ratio s
Image by MIT OpenCourseWare.
This criterion was developed in 1950s, and more recent data is pro
vided in MILSPEC8785C
Based on this plot, a good target: frequency 3 rad/sec and
damping of about 0.6
Problem is that the short period dynamics are no where near these
numbers, so we must modify them.
Could do it by redesigning the aircraft, but it is a bit late for
that. . .
Fall 2010 16.30/31 24
ec 4 ea
Ge (s)
s+4
c
k
or that
(s) Ge (s)H(s)k
=
c(s) 1 + Ge (s)H(s)k
r e u y
Gc(s) Gp(s)
Signals are:
u control commands
y output/measurements
r reference input
e response error
Basic questions:
Analysis: Given Nc and Dc, where do the closed loop poles go
as a function of Kc?
Synthesis: Given Kp, Np and Dp, how should we chose Kc, Nc, Dc
to put the closed loop poles in the desired locations?
DcDp + KNcNp = 0
So if K 0, then locus starts at solutions of DcDp = 0 which are
the poles of the plant and compensator.
NcNp
Ld = =0
DcDp
More details as K :
Assume there are n zeros and p poles of Ld(s)
Then for large |s|,
1
Ld(s)
(s )pn
So the root locus degenerates to:
1
1+ =0
(s )pn
So n poles head to the zeros of Ld(s)
Remaining p n poles head to |s| = along asymptotes
dened by the radial lines
180 + 360 (l 1)
l = l = 1, 2, . . .
pn
so that the number of asymptotes is governed by the number of
poles compared to the number of zeros (relative degree).
If zi are the zeros if Ld and pj are the poles, then the centroid
of the asymptotes is given by:
p
n
pj zi
=
pn
Fall 2010 16.30/31 210
Example: L(s) = s4
Im
Re
s+1
Example G(s) =
s2(s + 4)
Im
Re
s1
Example G(s) =
s2(s 4)
Im
Re
Im
Re
Fig. 3: Basic
Im
Re
Im
Re
Im
Re
Im
Re
Im
Re
Im
Re
Performance Issues
Interested in knowing how well our closed loop system can track var
ious inputs
Steps, ramps, parabolas
Both transient and steady state
Can determine this using the closed-loop transfer function and the
nal value theorem
lim e(t) = lim se(s)
t s0
which are a good simple way to keep track of how well your system
is doing in terms of steady state tracking performance.
Fall 2010 16.30/31 216
Dynamic Compensation
For a given plant, can draw a root locus versus K. But if desired
pole locations are not on that locus, then need to modify it using
dynamic compensation.
Basic root locus plots give us an indication of the eect of adding
compensator dynamics. But need to know what to add to place
the poles where we want them.
New questions:
What type of compensation is required?
How do we determine where to put the additional dynamics?
There are three classic types of controllers u = Gc(s)e
2. Integral feedback:
t
Ki
u(t) = Ki e( )d Gc(s) =
0 s
Used to reduce/eliminate steady-state error
If e( ) is approximately constant, then u(t) will grow to be very
large and thus hopefully correct the error.
Fall 2010 16.30/31 217
Im
Re
Re
1
Example # 2: G(s) = , (a > 0, b > 0)
(s a)(s b)
with Gc(s) = Kds
Im
Re
Derivative feedback is very useful for pulling the root locus into
the LHP - increases damping and more stable response.
Controller Synthesis
Re
(s + z)
GB (s) Kc
s
which is essentially a PI compensator, called a lag.
If pick p z, then at low frequency, the impact of p/(s + p) is
small, so
Im
Re
GB (s) Kc(s + z)
Various algorithms exist to design the components of the lead and lag
compensators
Fall 2010 16.30/31 221
0 Re
p z
As shown in the gure, there are four terms in Ld(s0) the two
poles at the origin contribute 117 each
Given the assumed location of the compensator pole/zero, can
work out their contribution as well
Fall 2010 16.30/31 222
2
Geometry for the real zero: tan = z1 and for the real pole: tan =
2
p1
2 clear all
3 target = 1+2*j;
5 syms z M; ratio=10;
6
phi z=(imag(target)/(z+real(target)));
7 phi p=(imag(target)/(ratio*z+real(target)));
8 M=(phi zphi p)/(1+phi z * phi p);
9 test=solve(Mtan(pi/180*(2*phi origin180)));
10 Z=eval(test(1));
11 P=ratio*Z;
12 K=1/abs((target+Z)/(target2*(target+P)));
13 [Z P K]
Fall 2010 16.30/31 223
Pole Placement
Another option for simple systems is called pole placement.
Clearly need to pull the poles at the origin into the LHP, so need a
lead compensator Rule of thumb:3 take p = (5 10)z.
2 % Fall 2009
3 %
4 close all
5 figure(1);clf
6 set(gcf,'DefaultLineLineWidth',2)
7 set(gcf,'DefaultlineMarkerSize',10)
8 set(gcf,'DefaultlineMarkerFace','b')
12
13 %Example: G(s)=1/22
15 z=roots([20 49 10]);z=max(z),k=25/(52*z),alpha=5*z/(52*z),
16 num=1;den=[1 0 0];
18 rlocus(conv(num,knum),conv(den,kden));
19 hold;plot(alpha+eps*j,'d');plot([1+2*j,12*j],'d');hold off
20 r=rlocus(conv(num,knum),conv(den,kden),1)'
21 axis([25 5 15 15])
Observations
In a root locus design it is easy to see the pole locations, and thus
we can relatively easily identify the dominant time response
Caveat is that near pole/zero cancelation complicates the process
of determining which set of poles will dominate
Some of the performance specications are given in the frequency
response, and it is dicult to determine those (and the corresponding
system error gains) in the RL plot
Easy for low-order systems, very dicult / time consuming for higher
order ones
As we will see, extremely dicult to identify the robustness margins
using a RL plot
A good approach for a fast/rough initial design
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #3
FR: Introduction
2. Nichols Plot |G(j)| vs. G(j), which is very handy for sys
tems with lightly damped poles.
log |G(s)| =
(s + 3)(s + 4)
Bode Example
Approximation
0 i
log[1 + (/i)2]1/2
log[/i] i
Then add them up starting from zero frequency and changing the
slope as
Want tests on the loop transfer function L(s) = Gc(s)G(s) that can
be performed to establish stability of the closed-loop system
Gc(s)G(s)
Gcl (s) =
1 + Gc(s)G(s)
Easy to determine using a root locus.
How do this in the frequency domain? i.e., what is the simple
equivalent of the statement does root locus go into RHP?
Intuition: All points on the root locus have the properties that
L(s) = 180 and |L(s)| = 1
So at the point of neutral stability (i.e., imaginary axis crossing),
we know that these conditions must hold for s = j
So for neutral stability in the Bode plot (assume stable plant),
must have that L(j) = 180 and |L(j)| = 1
So for most systems we would expect to see |L(j)| < 1 at the
frequencies for which L(j ) = 180
Gain Margin: factor by which the gain is less than 1 at the frequen
cies for which L(j ) = 180
GM = 20 log |L(j )|
Phase Margin: angle by which the system phase diers from 180
when the loop gain is 1.
Let c be the frequency at which |L(jc)| = 1, and = L(jc)
(typically less than zero), then
P M = 180 +
Gain
margin
1/GM
1
-1
Positive
phase
margin
L(j)
Fig. 5: Gain and Phase Margin for stable system in a polar plot
Im
Positive gain Im
margin
Negative phase
margin
1/GM
1 1
Re Re
-1
Positive phase
margin
1/GM
Negative gain
L(j) L(j) margin
Negative gain
Positive gain + margin
+ margin c
|L| db 0 |L| db 0
Log Log
_ _
c
-90o -90o
L -180o L -180o
Log Log
-270o Positive phase -270o
margin Negative phase
margin
-1
GcG(j)
A more precise version must not only consider whether L(s) passes
through 1, but how many times it encircles it.
In the process, we must take into account the stability of L(s)
Nyquist Stability
Im
c
Re
s0
We are interested in the plot of L(s) for a very specic set of values
of s, called the Nyquist Path.
Im
R
R
Re
C2
Case shown assumes that L(s) has no imaginary axis poles, which
is where much of the complexity of plotting occurs.
Also note that if lims L(s) = 0, then much of the plot of L(s)
for values of s on the Nyquist Path is at the origin.
Steps:
Construct Nyquist Path for particular L(s)
Draw Nyquist Diagram
Count # of encirclements of the critical point -1
Why do we care about the # of encirclements?
Turns out that (see appendix) that if L(s) has any poles in the
RHP, then the Nyquist diagram/plot must encircle the critical
point -1 for the closed-loop system to be stable.
It is our job to ensure that we have enough encirclements how many
do we need?
The whole issue with the Nyquist test boils down to developing a
robust way to make accurate plots and count N .
Good approach to nd the # of crossing from a point s0 is:
Draw a line from s0
Count # of times that line and the Nyquist plot cross
N = #CWcrossings #CCWcrossings
Im
G(s)
-1
Re
FR: Summary
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #4
Performance Issues
Synthesis
Lead/Lag examples
Fall 2010 16.30/31 42
Theorem: For any stable, minimum phase system with transfer func
tion G(s), G(j) is uniquely related to the slope of |G(j)|.
Relationship is that, on a log-log plot, if slope of the magnitude
plot is constant over a decade in frequency, with slope n, then
G(j) 90n
Performance Issues
Step error response
1
ess =
1 + Gc(0)Gp(0)
and we can determine Gc(0)Gp(0) from the low frequency Bode plot
for a type 0 system.
For a type 1 system, the DC gain is innite, but dene
Kv = lim sGc(s)Gp(s) ess = 1/Kv
s0
So can easily determine this from the low frequency slope of the
Bode plot.
Performance Issues II
Classic question: how much phase margin do we need? Time response
of a second order system gives:
1. Closed-loop pole damping ratio P M/100, P M < 70
3. Closed-loop bandwidth
BW = n 1 2 + 2 4 2 + 4 4
2
and c = n 1 + 4 4 2 2
10 20
Decibels
Amplitude Mr resonant peak
c
ratio 0
1 , rad/s
|y|/|r|
0.7 -3
0.1 -20
Band width
BW
1 figure(1)%
2 z=[0:.01:1]'; zs=[0:.01:1/sqrt(2)eps]';
3 wbw=sqrt(12*z.2+sqrt(24*z.2+4*z.4));%
4 wc=sqrt(sqrt(1+4*z.4)2*z.2);%
5 wr=sqrt(12*zs.2);%
6 set(gcf,'DefaultLineLineWidth',2) %
7 plot(z,wbw,z,wc,zs,wr)%
9 xlabel('\zeta');ylabel('\omega')%
n 1 2
Peak overshoot M = entp
p
dB
0
20 log |p/z|
20
0
0
Phase
-90o
0o
z p
Lead Mechanics
Maximum phase added
1
sin max =
1 +
1 sin max
=
1 + sin max
Frequency of the maximum phase addition is max = |z| |p|
Usually try to place this near c
High frequency gain increase is by 1/
Lead Mechanics II
Adding a lead to the LTF changes both the magnitude and phase, so
it is dicult to predict the new crossover point (which is where we
should be adding the extra phase).
dB
0
z p
Phase
0o
-90o
Design Example
1
Design a compensator for the system G(s) = s(s+1)
|.| -1 |G|
1 z p
0.1 1 10
-2
|GGc|
New
|.| = 1 Line
so c = 10
Design steps:
G(j ) 180
c
zp = 1sin m
1+sin m , m = 40
P M = 40
z
p = 0.22
3 %
4 close all
5 set(0,'DefaultLineLineWidth',2)
6 set(0,'DefaultlineMarkerSize',10)
7 set(0,'DefaultlineMarkerFace','b')
10 %
11 % g=1/s/(s+1)
12 figure(1);clf;
13 wc=10;
14 PM=40*pi/180;
15
16 G=tf(1,conv([1 0],[1 1]));
17 phi G=phase(evalfr(G,j*wc))*180/pi;
18 %
19 phi m=PM(180+phi G);
20 %
21 zdp=(1sin(phi m))/(1+sin(phi m));
22 z=sqrt(wc2*zdp);
23 p=z/zdp;
24 %
25 Gc=tf([1 z],[1 p]);
26 k c=1/abs(evalfr(G*Gc,j*wc));
27 Gc=Gc* k c;
28 w=logspace(2,2,300);
29 f G=freqresp(G,w);f Gc=freqresp(Gc,w);f L=freqresp(G*Gc,w);
30 f G=squeeze(f G);f Gc=squeeze(f Gc);f L=squeeze(f L);
31 loglog(w,abs(f G),w,abs(f Gc),w,abs(f L))
32 xlabel('Freq');ylabel('Magnitude');grid on
33 legend('Plant G','Comp G c','LTF L','Location','SouthWest')
34 print dpng r300 lead examp2.png
Lag Mechanics
dB
0 p z
0
-20
0
20 log |p/z|
Phase m
o
0
o
-90
Image by MIT OpenCourseWare.
Typically use a lag to add 20 log to the low frequency gain with
(hopefully) a small impact to the PM (at crossover)
Pick the desired gain reduction at high frequency 20 log(1/),
where = |z|/|p|
Pick |Glag |s=0 = kc to give the desired low frequency gain increase
for the LTF (shift the magnitude plot up)
Heuristic: want to limit frequency of the zero (and pole) so that
there is a minimal impact of the phase lag at c z = c/10
September 19, 2010
Fall 2010 16.30/31 412
Lag Compensation
dB
|KcGp|
|GcGp|
0
p z wc
20 log |p/z|
Original c
Phase
Gp(j)
o
-90
Gc(j)Gp(j)
Phase margin,
o uncompensated
-180
Phase margin,
compensated
Lag Example
Lag example with G(s) = 3/((s + 1)2(s/2 + 1)) and on right Gc(s) = 1,
left Gc(s) = (s + 0.1)/(s + 0.01), which should reduce steady state step
error from 0.25 to 0.032
3 %
4 close all
5 set(0,'DefaultLineLineWidth',2)
6 set(0,'DefaultlineMarkerSize',10)
7 set(0,'DefaultlineMarkerFace','b')
10
11 G=tf([3],conv(conv([1/1 1],[1/2 1]),[1 1]));%
12 wc=1;zl=wc/10; pl=zl/10;
13 close all;
14
15 Gc=zl/pl*tf([1/(zl) 1],[1/(pl) 1]);%
16
17 figure(1);clf; %
18 set(gcf,'DefaultLineLineWidth',2)
19 L=Gc*G;Gcl=(L)/(1+L);%
22 xlabel('Time (sec)');ylabel('y') %
23 ess=1/(1+evalfr(L,0*j))
25
26 w=logspace(2,2,300)';
27 figure(2);clf;%
28 set(gcf,'DefaultLineLineWidth',2)
29 [mag,ph]=bode(L,w);grid on; %
30 subplot(211);loglog(w,squeeze(mag));grid on;%
32 xlabel('Freq');ylabel('Mag')%
33 subplot(212);semilogx(w,squeeze(ph));%
34 xlabel('Freq');ylabel('Phase');grid on%
36
37 figure(3);rlocus(L);rr=rlocus(L,1);hold on; %
38 plot(rr+j*eps,'rs','MarkerSize',12,'MarkerFace','r');hold off %
39 print dpng r300 lag examp13.png
40
41 Gc=1;
42 Gc2=2;
43
44 figure(4); set(gcf,'DefaultLineLineWidth',2) %
45 L=Gc*G;Gcl=(L)/(1+L);L2=Gc2*G;Gcl2=(L2)/(1+L2);%
46 [y,t]=step(Gcl,20);%
47 [y2,t]=step(Gcl2,t);%
48 hold on; %
52 xlabel('Time (sec)');ylabel('y') %
53 ess=1/(1+evalfr(L,0*j)) %
54 hold off
56
57 w=logspace(2,2,300)';
58 figure(5);clf;set(gcf,'DefaultLineLineWidth',2)
59 [mag,ph]=bode(L,w);
60 [mag2,ph2]=bode(L2,w);
61 subplot(211);loglog(w,squeeze(mag),'b',w,squeeze(mag2),'m.');grid on;%
63 xlabel('Freq');ylabel('Mag')%
64 subplot(212);semilogx(w,squeeze(ph),'b',w,squeeze(ph2),'m.');%
65 xlabel('Freq');ylabel('Phase');grid on%
67
68 figure(6);rlocus(L);rr=rlocus(L,Gc);rr2=rlocus(L,Gc2);hold on; %
69 plot(rr+j*eps,'rs','MarkerSize',12,'MarkerFace','r');
70 plot(rr2+j*eps,'md','MarkerSize',12,'MarkerFace','m');hold off %
71 print dpng r300 lag examp16.png
Summary
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #5
State-Space Systems
What are state-space models?
Why should we use them?
How are they related to the transfer functions used in
classical control design and how do we develop a state-
space model?
What are the basic properties of a state-space model, and
how do we analyze these?
Fall 2010 16.30/31 52
SS Introduction
Basic Denitions
Equilibrium Points
Linearization
Can then develop the linearized equations by using the Taylor series
expansion of f (, ) about xe and ue.
fi(xe, ue) +
x +
u
x
0 u 0
where
fi fi fi
=
x x1
xn
d
Since dt xe i = fi(xe, ue), we thus have that
d fi
fi
(xi)
x +
u
dt
x
0 u 0
Combining for all n state equations, gives (note that we also set
=) that
f1
f1
0
f2
f2
d
x
0
u
0
x
=
x +
u
dt
...
...
fn
fn
x
0
u
0
= A(t)x + B(t)u
where
f1 f1 f1
f1 f1 f1
x1 x2 xn u1 u2 um
f2 f2 f2 f2 f2 f2
x1 x2
xn
and
B(t)
u1 u2
um
A(t)
...
...
fn fn fn fn fn fn
x1 x2 xn u1 u2 um
0 0
g1
g1
.
0
.
0
.
y
=
. x +
.
. u
gp
gp
x
0
u 0
= C(t)x + D(t)u
If the system is operating around just one set point then the partial
fractions in the expressions for AD are all constant LTI lin
earized model.
1 more on Jordan blocks on 6??, but this basically means that these eigenvalues are not repeated.
Note that this doesnt say anything about the stability of the nonlinear
system if the linear system is neutrally stable.
A very powerful result that is the basis of all linear control theory.
Linearization Example
Find the equilibrium points and then make a state space model
Fig. 3: Nonlinear response (k1 = 1, k2 = 0.5). The gure on the right shows the
oscillation about the equilibrium point.
4 xdot(1) = x(2);
5 xdot(2) = k1*x(1)k2*(x(1))3;
6 xdot = xdot';
1 B
F = vc + BI vc Transport Thm.
m
B + BI
T = H H
q Y
u v
X
p
Basic assumptions are:
w
BI
Instantaneous mapping of vc and
into the body frame:
BI
= Pi + Qj + Rk
vc = Ui + V j + W k
P U
BI B = Q (vc)B = V
R W
U + QW RV
= V + RU P W
W + P V QU
B +
T = H BI
H
IxxP + Ixz R
L 0 R Q Ixx 0 Ixz P
M = Iyy Q + R 0 P 0 Iyy 0 Q
N Izz R + Ixz P Q P 0 Ixz 0 Izz R
Equations are very nonlinear and complicated, and we have not even
said where F and T come from need to linearize to develop analytic
results
Assume that the aircraft is ying in an equilibrium condition and
we will linearize the equations about this nominal ight condition.
Linearization
Can linearize about various steady state conditions of ight.
For steady state ight conditions must have
F = Faero + Fgravity + Fthrust = 0 and T = 0
So for equilibrium condition, forces balance on the aircraft
L = W and T = D
Velocities U0 , U = U0 + u U = u
W0 = 0, W =w W = w
V0 = 0, V =v V = v
Angular P0 = 0, P =p P = p
Rates Q0 = 0, Q=q Q = q
R0 = 0, R=r R = r
Angles 0 , = 0 + =
0 = 0, = =
0 = 0, = =
1 + P V QU w + pv q(U0 + u)
[Z0 + Z] = W
m
w qU0
X u 1
1
Y = v + rU0 2
m
Z w qU0 3
Attitude motion:
IxxP + Ixz R +QR(Izz Iyy ) + P QIxz
L
M = Iyy Q +P R(Ixx Izz ) + (R2 P 2)Ixz
N Izz R + Ixz P +P Q(Iyy Ixx) QRIxz
L Ixxp + Ixz r 4
M = Iyy q 5
N Izz r + Ixz p 6
Stability Derivatives
()/() X Y Z L M N
u 0 0 0
v 0 0 0
w 0 0 0
p 0 0 0
q 0 0 0 0
r 0 0 0
Note that we must also nd the perturbation gravity and thrust forces
and moments
X g
Z g
= mg cos 0
= mg sin 0
Aerodynamic summary:
X X
1A X = U 0 u + W 0 w X u, x w/U0
2A Y v/U0, p, r
3A Z u, x w/U0, x w/U
0, q
4A L v/U0, p, r
5A M u, x w/U0, x w/U
0, q
6A N v/U0, p, r
X mu
Z = m(w qU0)
M Iyy q
X X X g c
U 0 u + W 0 w +
+ X 0
Z u + Z w + Z w + Z q + Z g + Z c
U 0
W 0 W Q 0 0
0
M
M M
U 0 u + W 0 w + W w + MQ q + M c
0 0
Y m(v + rU0)
L = Ixxp + Ixz r
N Izz r + Ixz p
Y
Y Y c
V 0 v
+ P 0 p + R 0 r + +Y
L L L c
V 0 v + P 0 p + R 0 r + L
N
N N c
V 0 v + P 0 p + R 0 r + N
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
16.30
Estimation and Control of Aerospace Systems
Topic 5 addendum: Signals and Systems
Fall 2010
2 Causality
3 Time Invariance
4 State-space models
5 Linear Systems
Continuous-time signal
A (scalar) continuous-time signal is a function that associates to each time
t R a real number y (t), i.e., y : t y (t). Note: We will use the
standard (round) parentheses to indicate continuous-time signals.
Discrete-time signal
A (scalar) discrete-time signal is a function that associates to each integer
k Z a real number y [k], i.e., y : k y [k]. Note: We will use the square
parentheses to indicate discrete-time signals.
y (t) y [k]
t k
Multiplication by a scalar
Let R. The signal y can be obtained as:
Denition (system)
A system is an operator that transforms an input signal u into a unique
output signal y .
u(t) y (t)
t t
u(t) y (t)
System
u[k] y [k]
u[k] y (t)
k t
Continuous-Time System: CT CT
This is the kind of systems you studied in 16.06.
Discrete-Time System: DT DT
We will study this kind of systems in this class.
Sampler: CT DT
This class includes sensors, and A/D (Analog Digital) converters.
Let us call a sampler with sampling time T a system such that
y [k] = u(kT ).
Hold: DT CT
This class includes actuators, and D/A (Digital Analog) converters.
A Zero-Order Hold (ZOH) with holding time T is such that
t
y (t) = u .
T
(MIT) Topic 5 addendum: Signals, Systems Fall 2010 6 / 27
Outline
2 Causality
3 Time Invariance
4 State-space models
5 Linear Systems
This is the most basic kind of system. Essentially the output can be
written as a simple function of the input, e.g.,
Examples:
A proportional compensator;
A spring;
An electrical circuit with resistors only.
However, there are some cases in which non-causal systems can actually
be interesting to study:
2 Causality
3 Time Invariance
4 State-space models
5 Linear Systems
u u
ST
T
t t
u(t) y (t) y (t T )
TI System Time delay
u(t) u(t T ) y (t T )
Time delay TI System
2 Causality
3 Time Invariance
4 State-space models
5 Linear Systems
Denition (state)
The state x(t1 ) of a causal system at time t1 (resp. at step k1 ) is the
information needed, together with the input u between times t1 and t2
(resp. between steps k1 and k2 ), to uniquely predict the output at time t2
(resp. at step k2 ), for all t2 t1 (resp. for all steps k2 k1 ).
In other words, the state of the system at a given time summarizes the
whole history of the past inputs , for the purpose of predicting the
output at future times.
Usually, the state of a system is a vector in some n-dimensional space Rn .
(MIT) Topic 5 addendum: Signals, Systems Fall 2010 15 / 27
Dimension of a system
The choice of a state for a system is not unique (in fact, there are innite
choices, or realizations).
However, there are come choices of state which are preferable to others; in
particular, we can look at minimal realizations.
2 Causality
3 Time Invariance
4 State-space models
5 Linear Systems
u 1 y1 ,
u2 y 2 ,
u1 + u2 y1 + y2 .
Superposition of eects
This property is very important: it tells us that if we can decompose a
complicated input into a sum of simple signals, we can obtain the output
as the sum of the individual outputs corresponding to the simple inputs.
Examples (in CT, same holds in DT):
Taylor series: u(t) = ci t i .
i=0
Fourier series: u(t) = i=0 (ai cos(i t) + bi sin(i t)).
(MIT) Topic 5 addendum: Signals, Systems Fall 2010 19 / 27
State-space model
Finite-dimensional linear systems can always be modeled using a set of dierential (or
dierence) equations as follows:
d
x(t) = A(t)x(t) + B(t)u(t);
dt
y (t) = C (t)x(t) + D(t)u(t);
d
x(t) = Ax(t) + Bu(t);
dt
y (t) = Cx(t) + Du(t);
In other words, we can set x[k] = y [k] as a state, and get the following state-space model:
a =
x1 x2
x1 1 0.1
x2 0 1
b =
u1
x1 1
x2 2
c =
x1 x2
y1 3 4
d =
u1
y1 0
Continuous-time model.
a =
x1 x2
x1 1 0.1
x2 0 1
b =
u1
x1 1
x2 2
c =
x1 x2
y1 3 4
d =
u1
y1 0
Forced response:
xF (t0 ) = 0,
yF .
uF (t) = u(t), t t0 ,
Clearly, x0 = xIC + xF , and u = uIC + uF , hence
y = yIC + yF ,
that is, we can always compute the output of a linear system by adding the output
corresponding to zero input and the original initial conditions, and the output
corresponding to a zero initial condition, and the original input.
In other words, we can study separately the eects of non-zero inputs and of
non-zero initial conditions. The complete case can be recovered from these two.
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .
Topic #6
State-Space Systems
What are state-space models?
Why should we use them?
How are they related to the transfer functions
used in classical control design and how do we
develop a state-space model?
What are the basic properties of a state-space model, and
how do we analyze these?
Fall 2010 16.30/31 62
...
y
a1 a2 a3 y 1
x = y = 1 0 0 y + 0 u
y 0 1 0 y 0
y
y = 0 0 1 y + [0]u
y
This is typically called the controller form for reasons that will become
obvious later on.
There are four classic (called canonical) forms observer, con
troller, controllability, and observability. They are all useful in
their own way.
Consider case 2
y b1 s2 + b 2 s + b 3 N (s)
= G(s) = 3 =
u s + a1s2 + a2s + a3 D(s)
Let
y y v
=
u v u
where y/v = N (s) and v/u = 1/D(s)
1s2 + 2s + 3
= 3 +D
s + a1 s 2 + a 2 s + a 3
= G1(s) + D
where
D( s3 +a1s2 +a2s +a3 )
+( +1s2 +2s +3 )
Modal Form
SS to TF
1 see here
A =
1 0 0
,
B =
0
,
C
=
b1 b2 b3
0 1 0 0
then
s + a1 a2 a3 1
1
1 s 0 0
G(s) = det
det(sI A)
0 1 s 0
b1 b2 b3 0
b3 + b 2 s + b 1 s2
=
det(sI A)
and det(sI A) = s3 + a1s2 + a2s + a3
Which is obviously the same as before.
State-Space Transformations
Now introduce the new state vector z related to the rst state x
through the transformation x = T z
T is an invertible (similarity) transform matrix
z = T 1x = T 1(Ax + Bu)
= T 1(AT z + Bu)
= (T 1AT )z + T 1Bu = Az + B u
and
+ Du
y = Cx + Du = CT z + Du = Cz
Are these going to give the same transfer function? They must if
these really are equivalent models.
September 21, 2010
Fall 2010 16.30/31 611
= C (sI A)1B + D
= G2(s)
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #7
State-Space Systems
What are the basic properties of a state-space
model, and how do we analyze these?
Time Domain Interpretations
System Modes
Fall 2010 16.30/31 71
Time Response
Can develop a lot of insight into the system response and how it is
modeled by computing the time response x(t)
Homogeneous part
Forced solution
Homogeneous Part
x = Ax, x(0) known
Take Laplace transform
X(s) = (sI A)1x(0)
so that
1 1
x(t) = L (sI A) x(0)
But can show
1 I A A2
(sI A) = + 2 + 3 + ...
s s s
1
so L1 (sI A)1 = I + At + (At)2 + . . .
2!
At
= e
x(t) = eAtx(0)
eAt is a special matrix that we will use many times in this course
Transition matrix or Matrix Exponential
1
2 1 1 1
s+1 s+2 s+1 s+2
= 2 2 1 2
+ +
s+1 s+2 s+1 s+2
t 2t t 2t
2e e e e
eAt =
2et + 2e2t et + 2e2t
We will say more about eAt when we have said more about A (eigen
values and eigenvectors)
Computation of eAt = L1{(sI A)1} straightforward for a 2-state
system
More complex for a larger system, see this paper
Forced Solution
Consider a scalar case:
x = ax + bu, x(0) given
t
x(t) = eatx(0) + ea(t )bu( )d
0
where did this come from?
1. x ax = bu
2. eat [x ax] = d at
dt (e x(t)) = eatbu(t)
t d a
t
3. 0 d e x( )d = eatx(t) x(0) = 0 ea bu( )d
Have seen the key role of eAt in the solution for x(t)
Determines the system time response
But would like to get more insight!
Consider what happens if the matrix A is diagonalizable, i.e. there
exists a T such that
1
T 1AT = which is diagonal = ...
n
Then
eAt = T etT 1
where
e1t
e t = ...
e n t
Recall that the eigenvalues of A are the same as the roots of the
characteristic equation (page 67)
is an eigenvalue of A if
det(I A) = 0
which is true i there exists a nonzero v (eigenvector) for which
(I A)v = 0 Av = v
Jordan Form
One word of caution: Not all matrices are diagonalizable
0 1
A= det(sI A) = s2
0 0
only one eigenvalue s = 0 (repeated twice). The eigenvectors solve
0 1 r1
= 0
0 0 r2
r1
eigenvectors are of the form , r1 = 0 would only be one.
0
2
Need Jordan Form to handle the case with repeated roots
Jordan form of matrix A Rnn is block diagonal:
A1 0 0 j 1 0 0
0 A2 0
0 j 1 0
A =
.. . . .
...
with
Aj =
.
...
.
.. 1
0 0 Ak 0 0 0 j
Observation: any matrix can be transformed into Jordan form with
the eigenvalues of A determining the blocks Aj .
A1 t
(n1)!
e 0
0
tn2
0 A2 t
e 0
0 1
t
(n2)!
eAt with
e
Aj t j t
=
=
0 0 1
e
.
. .
.
.. ..
0 0
e
Ak t . t
0 0 1
EV Mechanics
1 1
Consider A =
8 5
s+1 1
(sI A) =
8 s5
det(sI A) = (s + 1)(s 5) + 8 = s2 4s + 3 = 0
so the eigenvalues are s1 = 1 and s2 = 3
Eigenvectors (sI A)v = 0
1
s+1 v11
(s1I A)v1 = =0
8 s5 v21
s=1
2 1
v11
8 4
v21
0), so set v11 = 1
4 1
v12
(s2IA)v2 = =0 4v12v22 = 0, v22 = 4v12
8 2 v22
1
v2 =
4
Conrm that Avi = ivi
Dynamic Interpretation
Since A = T T 1, then
t
w1T
| | e1
eAt = T etT 1 = v1 vn ... ...
| | ent wnT
where we have written
w1T
T 1 = ...
wnT
which is a column of rows.
Multiply this expression out and we get that
n
eAt = eitviwiT
i=1
Note that the vi give the relative sizing of the response of each part
of the state vector to the response.
1 t
v1(t) = e mode 1
0
0.5 3t
v2(t) = e mode 2
0.5
Clearly eit gives the time modulation
i real growing/decaying exponential response
i complex growing/decaying exponential damped sinusoidal
Note that
1 1 0
Re(e1) Im(e1) Re(e1) Im(e1) =
0 1
So for an initial condition to excite just this mode, can pick x(0) =
[Re(e1)], or x(0) = [Im(e1)] or a linear combination.
which would ensure that only this mode is excited in the response
k5
k1 k2 k3 k4
Wall
Wall
m1 m3 m2
x = z1 z2 z3 z1 z2 z3
0 I
A = M = diag(mi)
M 1K 0
k1 + k2 + k5 k5 k2
K = k5 k3 + k4 + k5 k3
k2 k3 k2 + k3
Eigenvalues and eigenvectors of the undamped system
1 = 0.77i 2 = 1.85i 3 = 2.00i
v1 v2 v3
1.00 1.00 1.00
1.00 1.00 1.00
1.41 1.41 0.00
0.77i 1.85i 2.00i
0.77i 1.85i 2.00i
1.08i 2.61i 0.00
m1 m3 m2
Mode 2 2 = 1.85i
m1 m3 m2
Mode 3 3 = 2.00i
m1 m3 m2
3 % Fall 2009
5 m=eye(3); % mass
8 [v,d]=eig(a);
9 t=[0:.01:20]; l1=1:25:length(t);
10 G=ss(a,zeros(6,1),zeros(1,6),0);
11
12 % use the following to cll the function above
13 close all
16 set(0,'DefaultAxesFontName','arial');
17 set(0,'DefaultTextFontName','arial');set(0,'DefaultlineMarkerSize',10)
18
19 figure(1);clf
20 x0=alp1*real(v(:,1))+(1alp1)*imag(v(:,1))
21 [y,t,x]=lsim(G,0*t,t,x0);
22 plot(t,x(:,1),'','LineWidth',2);hold on
23 plot(t(l1),x(l1,2),'rx','LineWidth',2)
24 plot(t,x(:,3),'m','LineWidth',2);hold off
25 xlabel('time');ylabel('displacement')
27 legend('z1','z2','z3')
29
30 figure(2);clf
31 x0=alp1*real(v(:,5))+(1alp1)*imag(v(:,5))
32 [y,t,x]=lsim(G,0*t,t,x0);
33 plot(t,x(:,1),'','LineWidth',2);hold on
34 plot(t(l1),x(l1,2),'rx','LineWidth',2)
35 plot(t,x(:,3),'m','LineWidth',2);hold off
36 xlabel('time');ylabel('displacement')
38 legend('z1','z2','z3')
40
41 figure(3);clf
42 x0=alp1*real(v(:,3))+(1alp1)*imag(v(:,3))
43 [y,t,x]=lsim(G,0*t,t,x0);
44 plot(t,x(:,1),'','LineWidth',2);hold on
45 plot(t,x(:,2),'r.','LineWidth',2)
46 plot(t,x(:,3),'m','LineWidth',2);hold off
47 xlabel('time');ylabel('displacement')
49 legend('z1','z2','z3')
51
52 figure(4);clf
53 x0=[1 0 1 0 0 0]';
54 [y,t,x]=lsim(G,0*t,t,x0);
55 plot(t,x(:,1),'','LineWidth',2)
56 hold on
57 plot(t,x(:,2),'r.','LineWidth',2)
58 plot(t,x(:,3),'m','LineWidth',2)
59 hold off
60 xlabel('time');ylabel('displacement')
62 legend('z1','z2','z3')
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #8
State-Space Systems
System Zeros
Transfer Function Matrices for MIMO systems
x0
Key Point: Zeros have both direction and frequency s0
u0
Just as we would associate a direction (eigenvector) with each pole
(frequency i)
s+2
Example: G(s) = s2+7s+12
7 12
1
A = B= C= 1 2 D=0
1 0 0
s0 + 7 12 1
s I A B
det 0 = det 1 s0 0
C D
1 2 0
= (s0 + 7)(0) + 1(2) + 1(s0) = s0 + 2 = 0
so there is clearly a zero at s0 = 2, as we expected. For the
directions, solve:
s0 + 7 12 1 x01 5 12 1 x01
1 s0 0 x02 = 1 2 0 x02 = 0?
1 2 0 s =2 u0 1 2 0 u0
0
Note that the output response left in Y1(s) is of a very special form
it corresponds to the (negative of the) response you would see from
T
the system with u(t) = 0 and x0 = 2 1
Y2(s) = C(sI A)1x0
s + 7 12 1 2
= 1 2
1 s 1
s 12 2 1
= 1 2
1 s+7 1 s2 + 7s + 12
2
= 2
s + 7s + 12
Simpler Test
Need to be very careful when we nd MIMO zeros that have the same
frequency as the poles of the system, because it is not obvious that
a pole/zero cancelation will occur (for MIMO systems).
The zeros have a directionality associated with them, and that
must agree as well, or else you do not get cancelation
More on this topic later when we talk about controllability and
observability
...
gp1(s) gpm(s)
gij (s) relates input of actuator j to output of sensor i.
It is relatively easy to go from a state-space model to a TFM, but
not obvious how to go back the other way.
A11 B11
. . .
. . .
A1m
B1m
A =
B =
A21
B21
..
..
Apm Bpm
C11 C1m
C21 . . . C2m
C
=
D = [Dij ]
...
Cp1 Cpm
One issue is how many poles are needed - this realization might be
inecient (larger than necessary).
Related to McMillan degree, which for a proper system is the
degree of the characteristic polynomial obtained as the least com
mon denominator of all minors of G(s).2
Subtle point: consider a m m matrix A, then the standard
minors formed by deleting 1 row and column and taking the de
terminant of the resulting matrix are called the m 1th order
minors of A.
To consider all minors of A, must consider all possible orders, i.e.
by selecting j m subsets of the rows and columns and taking
the resulting determinant.
Given an n m matrix A with entries aij , a minor of A is the
determinant of a smaller matrix formed from its entries by selecting
only some of the rows and columns.
Let K = { k1 k2 . . . kp } and L = { l1 l2 . . . lp } be subsets
of {1, 2, . . . , n} and {1, 2, . . . , m}, respectively.
Indices are chosen so k1 < k2 < kp and l1 < l2 < lp.
3
pth order minor dened by K and L is the determinant
a ak1l2 . . . ak1lp
k1l1
a ak2l2 . . . ak2lp
[A]K,L =
k..2l1 ...
.
akpl1 akpl2 . . . akplp
Gilberts Realization
One approach: rewrite the TFM as
H(s)
G(s) =
d(s)
where d(s) is the least common multiple of the denominators of the
entries of G(s).
Note dierence from the discussion about the McMillan degree.
d(s) looks like a characteristic equation for this system, but it is
not it does not accurately reect number of poles needed.
For proper systems for which d(s) has distinct roots, can use Gilberts
realization.
Apply a partial fraction expansion to each of the elements of TFM
G(s) and collect residues for each distinct pole4.
Nm
Ri
G(s) = where Ri = lim (s pi)G(s)
i
s pi spi
4 Generalizations of this Gilberts realization approach exist if the gij have repeated roots.
Zero Example 1
1 1
s+2 s + 2
TFM G(s) =
s2
1
s 2 (s + 1)(s + 2)
To compute the McMillan degree for this system, form all minors (4
order-1 and 1 order-2):
1 1 1 s2 2 7s
, , , ,
s + 2 s + 2 s 2 (s + 1)(s + 2) (s 2)(s + 1)(s + 2)2
1
G(s) =
(s + 1)(s + 2)(s 2)
(s + 1)(s + 2) (s 2)2
1 0 0 1 0 0 1 1 1
= + +
s + 1 0 3 s2 1 0 (s + 2) 0 4
Note that the rank of the last 22 matrix is 2
So the system order is 4 - we need to have two poles s = 2.
3 %
7 R1=tf([1 1],1)*G;R1=minreal(R1);R1=evalfr(R1,1)
8 R2=tf([1 2],1)*G;R2=minreal(R2);R2=evalfr(R2,2)
9 R3=tf([1 2],1)*G;R3=minreal(R3);R3=evalfr(R3,2)
10
11 % form SS model for 3 poles using the residue matrices
12 A1=[1];B1=R1(2,:);C1=[0 1]';
13 A2=[2 0;0 2];B2=R2;C2=eye(2);
14 A3=[2];B3=R3(2,:);C3=[0 1]';
15
16 % combine submodels
17 A=zeros(4);A(1:1,1:1)=A1;A(2:3,2:3)=A2;A(4,4)=A3;
18 B=[B1;B2;B3];
19 C=[C1 C2 C3];
20
21 syms s
22 Gn=simple(C*inv(s*eye(4)A)*B);
23
24 % alternative is to make a SS model of each g {ij}
25 A11=2;B11=1;C11=1;
26 A12=2;B12=1;C12=1;
27 A21=2;B21=1;C21=1;
28 A22=[3 2;1 0];B22=[2 0]';C22=[0.5 1];
29
30 % and then combine
31 AA=zeros(5);AA(1,1)=A11;AA(2,2)=A12;AA(3,3)=A21;AA(4:5,4:5)=A22;
32 BB=[B11 B11*0;B12*0 B12;B21 B21*0;B22*0 B22];
33 CC=[C11 C12 zeros(1,3);zeros(1,2) C21 C22];
34 GGn=simple(CC*inv(s*eye(5)AA)*BB);
35
36 Gn,GGn
Zero Example 2
1 1
s + 1 (s + 1)2
TFM G(s) =
1 1
(s + 1)3 (s + 1)4
(s + 1) , (s + 1) , (s + 1), 1
(s + 1)4
1.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00
0.00 3.00 1.50 0.50 0.00 0.00 0.00 0.00 0.00 0.00
0.50 0.00
0.00 2.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00
0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00
0.00 0.00 0.00 0.00 2.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00
A= B=
0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00
0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 4.00 1.50 1.00 0.50
0.00 0.50
0.00 0.00 0.00 0.00 0.00 0.00 4.00 0.00 0.00 0.00
0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.50 0.00 0.00 0.00
1.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 0.00
C = D=
0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00
0.18 1.01 0.35 0.63 0.00 0.00
C= D=
1.11 0.29 0.43 0.28 0.00 0.00
3 [a,b,c,d]=ssdata(G1);
4 latex(a,'%.2f','nomath') %
5 latex(b,'%.2f','nomath') %
6 latex(c,'%.2f','nomath') %
7 latex(d,'%.2f','nomath') %
8 G2=minreal(G1);[a2,b2,c2,d2]=ssdata(G2);
9 latex(a2,'%.2f','nomath') %
10 latex(b2,'%.2f','nomath') %
11 latex(c2,'%.2f','nomath') %
12 latex(d2,'%.2f','nomath') %
Zero Example 3
2s + 3 3s + 5
s2 + 3s + 2 s2 + 3s + 2
TFM G(s) =
0
(s + 1)
McMillan Degree: nd all minors of G(s)
2s + 3 3s + 5 1 (3s + 5)
, , ,
s2 + 3s + 2 s2 + 3s + 2 (s + 1) (s + 1)(s2 + 3s + 2)
To nd LCD, pull out smallest polynomial that leaves all terms with
no denominator:
1
(s2 + 3s + 2),
(2s + 3)(s + 1), (3s + 5)(s + 1), (3s + 5)
(s2 + 3s + 2)(s + 1)
3s+5
s+2 s+2
1 2
s1
s1
1 0
1 0
2s+3 3s+5
s+1 s+1
1 1
R2 = lim (s + 2)G(s) = lim =
s2 s2 s+2
s+1 0 0 0
which also indicates that we will have a third order system with 2
poles at s = 1 and 1 at s = 2.
giving
1 0 0 1 0
A = 0 1 0 B=0 1
0 0 2 1 1
1 2 1
C =
1 0 0
Will see later the conditions to determine if the order of a state space
model is minimal.
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #9
State-Space Systems
State-space model features
Observability
Controllability
Minimal Realizations
Fall 2010 16.30/31 92
= [x x2]
T
But now consider the new state space model x
2 0
Model # 2
=
x +
x u
0 1 1
y = 3 0 x
which is clearly dierent than the rst model, and larger.
For this system we say that the dynamics associated with the second
state are unobservable using this sensor (denes C matrix).
There could be a lot motion associated with x2, but we would
be unaware of it using this sensor.
= [ x x2]
T
with x
2
0
2
Model # 3
=
x +
x u
0 1 0
y = 3 2 x
which is also clearly dierent than model #1, and has a dierent
form from the second model.
1
2 0 2
G(s) = 3 2 sI
0 1 0
3 2
2 6
= s+2 s+1 = !!
0 s+2
So in this case we can see the state x2 in the output C = 3 2 ,
but we cannot inuence that state with the input since
2
B=
0
So we say that the dynamics associated with the second state are
uncontrollable using this actuator (denes the B matrix).
x +
x u
0 1 0
y = 3 0 x
So now we have
1
2
=
0 2
G(s) 3 0 sI
0 1 0
3 0
2 6
= s+2 s+1 = !!
0 s+2
Get same result for the transfer function, but now the dynamics as
sociated with x2 are both unobservable and uncontrollable.
Would like to develop models that only have dynamics that are both
controllable and observable
called a minimal realization
A state space model that has the lowest possible order for the
given transfer function.
But rst need to develop tests to determine if the models are observ
able and/or controllable
Observability
CeAtx = 0 t 0
For the problem we were just looking at, consider Model #2 with
x = [ 0 1 ]T = 0, then
2 0
2
=
x +
x u
0 1 1
y = 3 0 x
so
2t
e 0 0
CeAtx = 3 0
0 et 1
2t 0
= 3e 0 =0t
1
CA
2
CA x
= 0
...
CAn1
At
d At
= 0
CAeAtx
t=0
= CAx
= 0
Ce x
dt
t=0
d2
At 2 At
2
Ce x = 0
CA e x t=0
= CA x = 0
dt2
t=0
...
dk
At k At
k
Ce x = 0
CA e x t=0
= CA x = 0
dtk
t=0
CA
2
rank Mo
rank
CA = n
...
CAn1
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #10
State-Space Systems
State-space model features
Controllability
Fall 2010 16.30/31 101
Controllability
Further Examples
With Model # 2:
2
0
2
x +
x u
0 1 1
y = 3 0 x
C 3 0
M0 = =
CA 6 0
2 4
Mc = B AB =
1 1
rank M0 = 1 and rank Mc = 2
So this model of the system is controllable, but not observable.
With Model # 3:
2
0
2
x +
x u
0 1 0
y = 3 2 x
C 3 2
M0 = =
CA 6 2
2 4
Mc = B AB =
0 0
rank M0 = 2 and rank Mc = 1
So this model of the system is observable, but not controllable.
Modal Tests
There is, of course, a very special decoupled form for the state-space
model: the Modal Form (6??)
T 1 = ...
wnT
which is a column of rows.
y = Cx + Du
= CT z + Du
But by denition,
w1T
T 1B = ... B
wnT
and
CT = C v1 vn
Also, if
Cvj 0
then that element of the state vector zj would be unobservable with
this sensor.
Cancelation
Examples show the close connection between pole-zero cancelation
and loss of observability and controllability. Can be strengthened.
Connection to Residue
Recall that in modal form, the state-space model (assumes diagonal
izable) is given by the matrices
T
p1 w1 B
. .. B = ... C = Cv1 Cvn
A=
pn wnT B
for which case it can easily be shown that
G(s) = C(sI A)1B
1
w1T B
sp1
=
Cv1 Cvn ... ...
1
spn w nT B
n
(Cvi)(wT B)
i
=
i=1
s pi
wiT B wjT B
Weaker Conditions
Often it is too much to assume that we will have full observability
and controllability. Often have to make do with the following. System
called:
Detectable if all unstable modes are observable
Stabilizable if all unstable modes are controllable
That is enough information on the system model for now will assume
minimal models from here on and start looking at the control issues.
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #11
State-Space Systems
r u(t) y(t)
A, B, C
x(t)
Dene u = k1 k2 x(t) = Kx(t), then
1 1 1
Acl = A BK = k1 k2
1 2 0
1 k1 1 k2
=
1 2
which gives
det(sI Acl ) = s2 + (k1 3)s + (1 2k1 + k2) = 0
1 1 1 1 k1 1 k2
Acl = A BK = k1 k2 =
0 2 0 0 2
so that
det(sI Acl ) = (s 1 + k1)(s 2) = 0
So the feedback control can modify the pole at s = 1, but it cannot
move the pole at s = 2.
With this zero in the modal B-matrix, can easily see that the mode
associated with the z2 state is uncontrollable.
Must assume that the pair (A, B) are controllable.
Ackermanns Formula
The previous outlined a design procedure and showed how to do it by
hand for second-order systems.
Extends to higher order (controllable) systems, but tedious.
u(t) = K z(t)
Then switch back to gains needed for the state x(t), so that
1 u = Kz(t)
K = KT = Kx(t)
Pole placement is a very powerful tool and we will be using it for most
of this course.
Reference Inputs
Started with
x (t) = Ax(t) + Bu y = Cx(t)
u = r Kx(t)
Y (s)
sY (s) sR(s) as s 0 = 1
R(s)
s=0
So, for good performance, the transfer function from R(s) to Y (s)
should be approximately 1 at DC.
October 17, 2010
Fall 2010 16.30/31 119
Now we have
x (t) = (A BK)x(t) + BN r
y = Cx(t)
so that
Y (s)
= C (sI (A BK))1 BN = Gcl (s)N
R(s)
Y (s) 15(s 2)
= 2
R(s) s + 11s + 30
Note that this development assumed that r was constant, but it could
also be used if r is a slowly time-varying command.
So the steady state step error is now zero, but is this OK?
See plots big improvement in the response, but transient a bit
weird.
3 %
4
a=[1 1;1 2];b=[1 0]';c=[1 0];d=0;
5 k=[14 57];
6 Nbar=15;
7 sys1=ss(ab*k,b,c,d);
8 sys2=ss(ab*k,b*Nbar,c,d);
9 t=[0:.025:4];
10 [y,t,x]=step(sys1,t);
11 [y2,t2,x2]=step(sys2,t);
12
13 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 4 1 1.2]);grid;
14 legend('u=rKx','u=Nbar rKx','Location','SouthEast')
15 xlabel('time (sec)');ylabel('Y output');title('Step Response')
16 print dpng r300 step1.png
Simple example:
8 14 20
G(s) =
(s + 8)(s + 14)(s + 20)
Target pole locations 12 12i, 20
Fig. 2: Response to step input with and without the N correction. Gives the desired
steady-state behavior, with little diculty!
Fig. 4: Response to step input with and without the N correction. Gives the desired
steady-state behavior, with little diculty!
G(s) =
(s 8)(s 14)(s 20)
Target pole locations 12 12i, 20
Fig. 6: Response to step input with and without the N correction. Gives the desired
steady-state behavior, with little diculty!
Fig. 8: Response to step input with and without the N correction. Gives the desired
steady-state behavior, with little diculty!
FSFB Summary
And to correct the fact that we cannot usually measure the state
develop an estimator.
3 %
4 % Jonathan How
5 % Sept, 2010
6 %
8 set(0,'DefaultLineLineWidth',2)
9 set(0,'DefaultlineMarkerSize',10);set(0,'DefaultlineMarkerFace','b')
11
12 % system
15 k=place(a,b,[12+12*j;1212*j;20]);
16
17 % find the feedforward gains
18 Nbar=inv(c*inv(ab*k)*b);
19
20 sys1=ss(ab*k,b,c,d);
21 sys2=ss(ab*k,b*Nbar,c,d);
22
23 t=[0:.01:1];
24 [y,t,x]=step(sys1,t);
25 [y2,t2,x2]=step(sys2,t);
26
27 figure(1);clf
28 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 1 0 1.2]);grid;
30 title('Step Response')
31 hold on
34 hold off
35
36 text(.4,.6,['k= [ ',num2str(round(k*1000)/1000),' ]'],'FontSize',14)
37 text(.4,.8,['Nbar= ',num2str(round(Nbar*1000)/1000)],'FontSize',14)
39
40 figure(1);clf
41 f=logspace(1,2,400);
42 gcl1=freqresp(sys1,f);
43 gcl2=freqresp(sys2,f);
44 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);grid
45 xlabel('Freq (rad/sec)')
46 ylabel('G {cl}')
48 legend('u=rKx','u=Nbar rKx')
50
51 %%%%%%%%%
52 % example 2
53 %
54 clear all
55
56 [a,b,c,d]=tf2ss(8*14*20,conv([1 8],conv([1 14],[1 20])))
57 k=place(a,b,[12+12*j;1212*j;20])
59 Nbar=inv(c*inv(ab*k)*b);
60
61 sys1=ss(ab*k,b,c,d);
62 sys2=ss(ab*k,b*Nbar,c,d);
63
64 t=[0:.01:1];
65 [y,t,x]=step(sys1,t);
66 [y2,t2,x2]=step(sys2,t);
67
68 figure(2);clf
69 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 1 0 1.2])
70 grid;
71 legend('u=rKx','u=Nbar rKx')
73 hold on
76 hold off
77
79 text(.4,.8,['Nbar= ',num2str(round(Nbar*1000)/1000)],'FontSize',14)
81
82 figure(2);clf
83 f=logspace(1,2,400);
84 gcl1=freqresp(sys1,f);
85 gcl2=freqresp(sys2,f);
86 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);grid
87 xlabel('Freq (rad/sec)')
88 ylabel('G {cl}')
90 legend('u=rKx','u=Nbar rKx')
92
93 %%%%%%%%%%%%%%
94 % example 3
95 clear all
96
97 [a,b,c,d]=tf2ss(.94,[1 0 0.0297])
98 k=place(a,b,[1+j;1j]/4)
100 Nbar=inv(c*inv(ab*k)*b);
101
102 sys1=ss(ab*k,b,c,d);
103 sys2=ss(ab*k,b*Nbar,c,d);
104
105 t=[0:.1:30];
106 [y,t,x]=step(sys1,t);
107 [y2,t2,x2]=step(sys2,t);
108
109 figure(3);clf
110 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 30 0 2])
111 grid;
112 legend('u=rKx','u=Nbar rKx')
113 xlabel('time (sec)');ylabel('Y output');title('Step Response')
114 hold on
115 plot(t2([1 end]),[.1 .1]*y2(end),'r');
116 plot(t2([1 end]),[.1 .1]*9*y2(end),'r');
117 hold off
118
119 text(15,.6,['k= [ ',num2str(round(k*1000)/1000),' ]'],'FontSize',14)
120 text(15,.8,['Nbar= ',num2str(round(Nbar*1000)/1000)],'FontSize',14)
121 export fig triple3 pdf
122
123 figure(3);clf
124 f=logspace(3,1,400);
125 gcl1=freqresp(sys1,f);
126 gcl2=freqresp(sys2,f);
127 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);grid
128 xlabel('Freq (rad/sec)')
129 ylabel('G {cl}')
130 title('Closedloop Freq Response')
131 legend('u=rKx','u=Nbar rKx')
132 export fig triple31 pdf
133
134 %%%%%%%%%%%%
135 % example 4
136 clear all
137
138 [a,b,c,d]=tf2ss([1 1],conv([1 1],[1 3]))
139 k=place(a,b,[[1+j;1j]])
140 % find the feedforward gains
141 Nbar=inv(c*inv(ab*k)*b);
142
143 sys1=ss(ab*k,b,c,d);
144 sys2=ss(ab*k,b*Nbar,c,d);
145
146 t=[0:.1:10];
147 [y,t,x]=step(sys1,t);
148 [y2,t2,x2]=step(sys2,t);
149
150 figure(3);clf
151 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 10 1 1.2])
152 grid;
153 legend('u=rKx','u=Nbar rKx')
154 xlabel('time (sec)');ylabel('Y output')
155 title('Unstable, NMP system Step Response')
156 hold on
157 plot(t2([1 end]),[.1 .1]*y2(end),'r');
158 plot(t2([1 end]),[.1 .1]*9*y2(end),'r');
159 hold off
160
161 text(5,.6,['k= [ ',num2str(round(k*1000)/1000),' ]'],'FontSize',14)
162 text(5,.8,['Nbar= ',num2str(round(Nbar*1000)/1000)],'FontSize',14)
163 export fig triple4 pdf
164
165 figure(4);clf
166 f=logspace(2,2,400);
167 gcl1=freqresp(sys1,f);
168 gcl2=freqresp(sys2,f);
169 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);grid
170 xlabel('Freq (rad/sec)')
171 ylabel('G {cl}')
172 title('Closedloop Freq Response')
173 legend('u=rKx','u=Nbar rKx')
174 export fig triple41 pdf
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #12
State-Space Systems
1 + 1.1 + 1.4 2
10-90% rise time tr = n
n 1 2
Key dierence in this case: since all poles are being placed, the
assumption of dominant 2nd order behavior is pretty much guaranteed
to be valid.
Note: state cost written using output xT Qx, but could dene a
system output of interest z = Cz x that is not based on a physical
sensor measurement and use cost ftn:
T
T T
JLQR = x (t)Cz QCz x(t) + u(t) u(t) dt
0
z)
Then eectively have state penalty Q = (CzT QC
Selection of z used to isolate system states of particular interest
that you would like to be regulated to zero.
R = I eectively sets the controller bandwidth
81420
Fig. 1: Example #1: G(s) = (s+8)(s+14)(s+20) with control penalty and 10
0.94
Fig. 2: Example #2: G(s) = s2 0.0297 with control penalty and 10
81420
Fig. 3: Example #3: G(s) = (s8)(s14)(s20) with control penalty and 10
(s1)
Fig. 4: Example #4: G(s) = (s+1)(s3) with control penalty and 10
(s2)(s4)
Fig. 5: Example #5: G(s) = (s1)(s3)(s2 +0.8s+4)s2 with control penalty and 10
Good ROT (typically called Brysons Rules) when selecting the weight
ing matrices Q and R is to normalize the signals:
12
(x1)2
max
2
2
Q =
(x2)2max
...
n2
(xn)2max
12
(u1)2
max
22
R =
(u2)2max
...
2
m
(um)2
max
2
2
i
i =
1 and
i
i =
1 are used to add an additional relative
is used as the last relative weighting between the control and state
penalties gives a relatively concrete way to discuss the relative size
of Q and R and their ratio Q/R
Regulator Summary
LQR selects closed-loop poles that balance between state errors and
control eort.
Easy design iteration using R
Sometimes dicult to relate the desired transient response to the
LQR cost function.
Key thing is that the designer is focused on system performance
issues rather than the mechanics of the design process
2 % Fall 2010
4 %
6 set(0,'DefaultLineLineWidth',2);
7 set(0,'DefaultlineMarkerSize',8);set(0,'DefaultlineMarkerFace','b')
9 set(0,'DefaultAxesFontName','arial');set(0,'DefaultTextFontName','arial')
10 set(0,'DefaultFigureColor','w','DefaultAxesColor','w',...
11 'DefaultAxesXColor','k','DefaultAxesYColor','k',...
12 'DefaultAxesZColor','k','DefaultTextColor','k')
13
14 if 1
15 clear all;fig=1;
16 % system
18 [a,b,c,d]=ssdata(G);
19 R=1e3;
22
23 % find the feedforward gains
24 Nbar=inv(c*inv(ab*k)*b);
25 Nbar2=inv(c*inv(ab*k2)*b);
26
27 sys1=ss(ab*k,b*Nbar,c,d);
28 sys2=ss(ab*k2,b*Nbar2,c,d);
29
30 t=[0:.005:1];
31 [y,t,x]=step(sys1,t);
32 [y2,t2,x2]=step(sys2,t);
33
34 figure(fig);clf;fig=fig+1;
35 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 1 0 1.2])
36 grid;
39 title('Step Response')
40 hold on
43 hold off
44
45 text(.4,.6,['k= [ ',num2str(round(k*1000)/1000),' ]'])
46 text(.4,.8,['Nbar= ',num2str(Nbar)])
47 %!rm srl12.pdf
49
50 if 1
51 figure(fig);clf;
52 f=logspace(1,2,400);
53 gcl1=freqresp(sys1,f);
54 gcl2=freqresp(sys2,f);
55 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);%grid
60 %!rm srl13.pdf
61 export fig srl13 pdf
62 end
63
64 end % if 0
65
66 %%%%%%%%%
67 if 1
68 clear all
69 fig=4;
70
71 G=tf(8*14*20,conv([1 8],conv([1 14],[1 20])));
72 [a,b,c,d]=ssdata(G);
73 R=.1
74 k=lqr(a,b,c'*c,R);
75 k2=lqr(a,b,c'*c,10*R);
76
78 Nbar=inv(c*inv(ab*k)*b);
79 Nbar2=inv(c*inv(ab*k2)*b);
80
81 sys1=ss(ab*k,b*Nbar,c,d);
82 sys2=ss(ab*k2,b*Nbar2,c,d);
83
84 t=[0:.005:1];
85 [y,t,x]=step(sys1,t);
86 [y2,t2,x2]=step(sys2,t);
87
88 figure(fig);clf;fig=fig+1;
89 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 1 0 1.2])
90 grid;
93 title('Step Response')
94 hold on
97 hold off
98
144 grid;
148 hold on
152
153 text(15,.6,['k= [ ',num2str(round(k*1000)/1000),' ]'])
154 text(15,.8,['Nbar= ',num2str(Nbar)])
155 %!rm srl32.pdf;
156 export fig srl32 pdf
157
158 if 1
159 figure(fig);clf;fig=fig+1;
160 f=logspace(3,3,400);
161 gcl1=freqresp(sys1,f);
162 gcl2=freqresp(sys2,f);
163 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);%grid
164 axis([.1 100 .01 2])
165 xlabel('Freq (rad/sec)');ylabel('G {cl}')
166 title('Closedloop Freq Response')
167 legend(['\rho = ',num2str(R)],['\rho = ',num2str(10*R)],'Location','SouthWest')
168 %!rm srl33.pdf;
169 export fig srl33 pdf
170 end
171
172 end % if 0
173
174 %%%%%%%%%%%%
175 if 1
176 clear all
177 fig=10;
178
179 G=tf([1 1],conv([1 1],[1 3]));
180 [a,b,c,d]=ssdata(G);
181 R=.1
182 k=lqr(a,b,c'*c,R);
183 k2=lqr(a,b,c'*c,10*R);
184
185 % find the feedforward gains
186 Nbar=inv(c*inv(ab*k)*b);
187 Nbar2=inv(c*inv(ab*k2)*b);
188
189 sys1=ss(ab*k,b*Nbar,c,d);
190 sys2=ss(ab*k2,b*Nbar2,c,d);
191
192 t=[0:.01:10];
193 [y,t,x]=step(sys1,t);
194 [y2,t2,x2]=step(sys2,t);
195
196 figure(fig);clf;fig=fig+1;
197 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 10 1 1.2])
198 grid;
199 legend(['\rho = ',num2str(R)],['\rho = ',num2str(10*R)],'Location','SouthEast')
200 xlabel('time (sec)');ylabel('Y output');
201 title('Unstable, NMP system Step Response')
202 hold on
203 plot(t2([1 end]),[.1 .1]*y2(end),'r');
204 plot(t2([1 end]),[.1 .1]*9*y2(end),'r');
205 hold off
206
207 text(5,.6,['k= [ ',num2str(round(k*1000)/1000),' ]'])
208 text(5,.8,['Nbar= ',num2str(Nbar)])
209 %!rm srl42.pdf;
210 export fig srl42 pdf
211
212 if 1
213 figure(fig);clf;fig=fig+1;
214 f=logspace(2,2,400);
215 gcl1=freqresp(sys1,f);
216 gcl2=freqresp(sys2,f);
217 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);%grid
218 axis([.1 100 .01 2])
219 xlabel('Freq (rad/sec)');ylabel('G {cl}')
220 title('Closedloop Freq Response')
221 legend(['\rho = ',num2str(R)],['\rho = ',num2str(10*R)],'Location','SouthWest')
222 %!rm srl43.pdf;
223 export fig srl43 pdf
224 end
225
226 end % if 0
227
228 %%%%%%%%%%%%
Example: B747
Velocity vector
x, u
y, v
, q
r
, p
er
dd
Ru
, r
Aileron a Elevators e
z, w
Image by MIT OpenCourseWare.
r
r
x = Ax + Bu , x = , u = = r
p
a
0.0558 0.9968 0.0802 0.0415
3.05 0.388 0.4650 0
0 0.0805 1 0
0.00729 0
0.475 0.00775
B =
(2)
0.153 0.143
0 0
Open-Loop Dynamics
Code gives the numerical values for all of the stability derivatives.
Solve for the eigenvalues of the matrix A to nd the lateral
modes.
0.0329 0.9467i, 0.5627, 0.0073
Stable, but there is one very slow pole.
There are 3 modes, but they are a lot more complicated than the
longitudinal case.
Note that the Dutch roll is too lightly damped, and we would typically
like to increase that damping using closed-loop control
Washout Filter
For now we will penalize that ltered state in the LQR cost function
When we get to output feedback, it is only the ltered r that is
available to the controller
Washout filter with =4.2
0
10
|H (s)|
w
1
10
2
10
2 1 0 1
10 10 10 10
Freq (rad/sec)
Add the rudder dynamics Hr (s) = 10/(s + 10), i.e. eectively a lag
New control picture (shows a nominal yaw damper we will replace
that with a state feedback controller)
Yaw
Hw (s)
Gyro
e
rc er r r 1
K Hr (s) s
Aircraft
a p 1
s
8 %
9 % Washout filter
10 tau=3;
11 washn=[1 0];washd=[1 1/tau]; % washout filter on yaw rate
12 WashFilt=tf({washn 0;0 1},{washd 1;1 1});
13 %
14 Gp=WashFilt*sys*H;
Inputs are now er and a, and outputs are e and from this MIMO
system, pull out the SISO system from er e
Sixth order because of the augmented states
Easiest control is of course to try gain feedback from e to er will
compare that with LQR
October 17, 2010
Fall 2010 16.30/31 1219
Root Locus
0.2 0.1
1 0.4 0.3
0.8
0.6
0.4
Imaginary Axis
0.2
1 0.9 0.8 0.7
0
0.2
0.4
0.6
0.8
1 0.4 0.3
0.2 0.1
Presence of zero on imaginary axis traps the Dutch roll pole so that
it cannot be moved far into the LHP
Net result is that we are limited to about 30% damping in that pole
Using an LQR state cost based on e2, can design an LQR controller
for various R = .
But where do the poles go as a ftn of ?
Follow a pattern dened by a symmetric root locus (SRL)
form pole/zero map from input er to output e, put these on
the s-plane, introduce mirror image of these dynamics about the
imaginary axis, plot root locus using standard root-locus tools.
Symmetric root locus
0.20.1 1
1 0.40.3 0.9
0.8
0.7
0.5
Imaginary Axis
0.5
0.7
0.8
1 0.40.3 0.9
0.20.1 1
1 0.5 0 0.5 1
Real Axis
1 Gp=WashFilt*sys*H;
2 set(Gp, 'statename', {'xwo' 'beta' 'yaw rate' 'roll' 'phi' 'xa'});
3 set(Gp, 'inputname', {'rudder inputs' 'aileron'},...
4 'outputname', {'filtered yaw rate' 'bank angle'});
5 [Ap,Bp,Cp,Dp]=ssdata(Gp);
6 [Klqr,S,Elqr]=lqr(Ap,Bp(:,1),Cp(1,:)'*Cp(1,:),0.1)
9.8852
1.1477
(Ap Bp(:, 1)Klqr ) =
0.2750 0.6200i
0.4696
0.0050
1
OL
0.8 LQR
Gain
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1
0 5 10 15 20 25 30
Time
25 %
28 %
29 Gp=WashFilt*sys*H;
37 figure(1);clf
38 rlocus(Ap,Bp(:,1),Cp(1,:),0);
40 Kgain=2;
41 Egain=eig(ApBp(:,1)*Kgain*Cp(1,:));rifd(Egain)
44
45 Cpbeta=[0 1 0 0 0 0]; % performance output variable
46 Ggain=ss(ApBp(:,1)*Kgain*Cp(1,:),Bp,Cpbeta,0);
47 xp0=[0 1 0 0 0 0]';
48 [Ygain,Tgain]=initial(Ggain,xp0,Tol); %'
49
50 figure(2);clf
51 srl(ss(Ap,Bp(:,1),Cp(1,:),0));
52 sgrid([.1 .2 .3 .4],[.7 .8 .9 1])
53 axis([1.25 1.25 1.25 1.25]);grid on
54 hold on;plot(Elqr+eps*sqrt(1),'bd');hold off
55 export fig b747 lqr2 pdf
56
57 % close the LQR loop
58 Acl=ApBp(:,1)*Klqr;
59 Bcl=Bp(:,1);
61 Ccl=[Cpbeta;Klqr];
62 Dcl=[0;0];
63 Glqr=ss(Acl,Bcl,Ccl,Dcl);
64 [Y,T]=initial(Glqr,xp0,Tol); %'
65
66 figure(3);clf
67 plot(Tol,Yol,T,Y(:,1),Tgain,Ygain);axis([0 30 1 1]);
68 setlines(2)
69 legend('OL','LQR','Gain')
70 ylabel('\beta');xlabel('Time')
71 grid on
73
74 % estimator poles made faster by jfactor
75 jfactor=2.05;
76 Eest=jfactor*Elqr;
77 Kest=place(Ap',Cp(1,:)',Eest);Kest=Kest';
78
79 na=size(Ap,1);
81 % see 155
82 ac=ApBp(:,1)*KlqrKest*Cp(1,:);bc=Kest;cc=Klqr;dc=0;
83 Gc=ss(ac,bc,cc,dc);
84 % see 157
86 bcl=[zeros(na,1);bc];
88 ccl=[Cpbeta,zeros(1,na);zeros(1,na) cc];
89 dcl=[0;0];
90 Gcl=ss(acl,bcl,ccl,dcl);
91
92 figure(5);clf
93 [p,z]=pzmap(Gc(1,1));
94 plot(z+sqrt(1)*eps,'mo','MarkerFace','m')
95 hold on
96 plot(p+sqrt(1)*eps,'bs','MarkerFace','b')
97 hold off
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #13
State-Space Systems
Full-state Feedback Control Performance/Robustness
LQ Servo Introduction
Can use scaling N can achieve zero steady state error, but the ap
proach is sensitive to accurate knowledge of all plant parameters
If state of the original system is x(t), then the dynamics are modied
to be
x (t) A 0 x(t) Bu 0
= + u(t) + r(t)
x I (t) Cy 0 x I (t) 0 I
T
and dene x(t) = xT (t) xI T (t)
r 1 xI
KI
s
u y
K G(s)
2 % Fall 2010
7 [a,b,c,d]=ssdata(G);
10 nom=2;
11 if nom
12 cpert=c; % nominal case
13 else
14 cpert=1.5*c; % offnominal case
15 end
16 ns=size(a,1);
17 z=zeros(ns,1);
18 Rxx=c'*c;
19 Ruu=1;
20
21 klqr=lqr(a,b,Rxx,Ruu); % basic LQR gains
22 Nbar=inv(c*inv(ab*klqr)*b); % design with c
23 syslqr=ss(ab*klqr,b*Nbar,cpert,0); % simulate with cpert
24
25 Rxx1=[Rxx z;z' 30];
26 Rxx2=[Rxx z;z' 1];
27
28 abar=[a z;c 0];bbar=[b;0]; % design with c
29 kbar1=lqr(abar,bbar,Rxx1,Ruu);
30 kbar2=lqr(abar,bbar,Rxx2,Ruu);
31 abarpert=[a z;cpert 0]; % simulate with cpert
32 sys1=ss(abarpertbbar*kbar1,[z;1],[cpert 0],0);
33 sys2=ss(abarpertbbar*kbar2,[z;1],[cpert 0],0);
34
35 figure(1);
36 t=[0:.1:10]';
37 [ylqr,tlqr]=step(ss(syslqr),t);
38 [y1,t1]=step(ss(sys1),t);
39 [y2,t2]=step(ss(sys2),t);
40 plot(t,ylqr,t,y1,t,y2,'LineWidth',2)
41 xlabel('Time')
42 legend('LQR with N','Int Penalty 30','Int Penalty 1','Location','SouthEast')
43
44 if nom
45 export fig lqrservo1 pdf
46 else
47 export fig lqrservo2 pdf
48 end
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #14
State-Space Systems
Open-loop Estimators
Closed-loop Estimators
Estimators/Observers
New plan:
(t).
1. Develop estimate of x(t) that will be called x
2. Then switch from u(t) = Kx(t) to u(t) = Kx (t).
Estimation Schemes
Assume that the system model is of the form:
x (t) = Ax(t) + Bu(t) , x(0) unknown
y(t) = Cx(t)
where
1. A, B, and C are known.
2. u(t) is known
I
3. Measurable outputs are y(t) from C =
x
for all time t 0. Two primary approaches:
Open-loop.
Closed-loop.
Open-loop Estimator
Given that we know the plant matrices and the inputs, we can just
perform a simulation that runs in parallel with the system
(t) = Ax
x (t) + Bu(t)
Then x
(t) x(t) t provided that x
(0) = x(0)
Actual System y
x: A, B, C
u
Estimator
y
: A, B, C
x
Subtract to get:
d
(x(t) x
(t)) = A(x(t) x (t) = Ax
(t)) x (t)
dt
which has the solution
(t) = eAtx
x (0)
Gives the estimation error in terms of the initial error.
Response is ne if x (0) = 0?
(0) = 0. But what if x
Closed-loop Estimator
Actual System y
x: A, B, C
+
u
L
y
Estimator
y
: A, B, C
x
Analysis:
(t) =
x x (t) x (t)
= [Ax(t) + Bu(t)] [Ax (t) + Bu(t) + L(y(t) y
(t))]
= A(x(t) x (t)) L(Cx(t) Cx (t))
= Ax (t) LCx (t)
= (A LC)x (t)
Closed-loop estimator:
(t) =
x Ax (t) + Bu(t) + Ly (t)
= Ax (t) + Bu(t) + L(y(t) y (t))
= (A LC)x (t) + Bu(t) + Ly(t)
(t) =
y Cx (t)
Which is a dynamic system with poles given by i(A LC) and
which takes the measured plant outputs as an input and generates
an estimate of x(t).
Regulator/Estimator Comparison
Regulator Problem:
Concerned with controllability of (A, B)
Estimator Problem:
For estimation, were concerned with observability of pair (A, C).
These problems are obviously very similar in fact they are called
dual problems.
Roles of Q and R
explained in 16.322
Estimators Example
Simple system
1 1.5
1 0.5
A = , B= , x(0) =
1 2 0 1
C = 1 0 , D=0
Assume that the initial conditions are not well known.
System stable, but max(A) = 0.18
Test observability:
C 1 0
rank = rank
CA 1 1.5
Open-loop estimator:
(t) = Ax
x (t) + Bu(t)
(t) = Cx
y (t)
Open-loop case:
x (t) = Ax(t) + Bu(t)
y(t) = Cx(t)
(t)
x = (t) + Bu(t)
Ax
(t)
y = (t)
Cx
x (t)
A 0 x(t) B
=
+ u(t)
(t)
x 0 A (t)
x B
0.5
x(0)
1
=
(0)
x 0
y(t)
C 0 x(t)
=
(t)
y 0 C (t)
x
Closed-loop case:
x (t) = Ax(t) + Bu(t)
(t) = (A LC)x
x (t) + Bu(t) + LCx(t)
x (t)
A 0 x(t) B
=
+ u(t)
(t)
x LC A LC (t)
x B
0.5
states
0
x1
0.5 x2
1
0 0.5 1 1.5 2 2.5 3 3.5 4
time
1
estimation error
0.5
0.5
1
0 0.5 1 1.5 2 2.5 3 3.5 4
time
Closedloop estimator
1
0.5
states
0
x1
0.5 x2
1
0 0.5 1 1.5 2 2.5 3 3.5 4
time
1
estimation error
0.5
0.5
1
0 0.5 1 1.5 2 2.5 3 3.5 4
time
Low bandwidth estimators have lower gains and tend to rely more
heavily on the plant model
Essentially an open-loop estimator tends to ignore the measure
ments and just uses the plant model.
Final Thoughts
Note that the feedback gain L in the estimator only stabilizes the
estimation error.
If the system is unstable, then the state estimates will also go to
, with zero error from the actual states.
Code: Estimator
1 % Examples of estimator performance
2 %
3 % Jonathan How
4 % Oct 2010
5 %
6 % plant dynamics
7 %
9 set(0,'DefaultLineLineWidth',2);
10 set(0,'DefaultlineMarkerSize',10);set(0,'DefaultlineMarkerFace','b')
12
13 set(0,'DefaultFigureColor','w',...
14 'DefaultAxesColor','w',...
15 'DefaultAxesXColor','k',...
16 'DefaultAxesYColor','k',...
17 'DefaultAxesZColor','k',...
18 'DefaultTextColor','k')
19
20 a=[1 1.5;1 2];b=[1 0]';c=[1 0];d=0;
21 %
23 l=place(a',c',[3 4]);l=l'
24 %
26 xo=[.5;1];
28 xe=[0 0]';
29 %
30 t=[0:.1:10];
31 %
32 % inputs
33 u=0;u=[ones(15,1);ones(15,1);ones(15,1)/2;ones(15,1)/2;zeros(41,1)];
34 %
35 % openloop extimator
37 B ol=[b;b];
39 D ol=zeros(2,1);
40 %
41 % closedloop extimator
43 B cl=[b;b];
45 D cl=zeros(2,1);
46
47 [y cl,x cl]=lsim(A cl,B cl,C cl,D cl,u,t,[xo;xe]);
48 [y ol,x ol]=lsim(A ol,B ol,C ol,D ol,u,t,[xo;xe]);
49
50 figure(1);clf;subplot(211)
51 set(gca)
53 title('Closedloop estimator');ylabel('states');xlabel('time')
56 setlines(2);axis([0 4 1 1]);grid on
57 ylabel('estimation error');xlabel('time')
58
59 figure(2);clf;subplot(211)
60 set(gca)
65 setlines(2);axis([0 4 1 1]);grid on
66 ylabel('estimation error');xlabel('time')
67
68 figure(1);export fig est11 pdf
69 figure(2);export fig est12 pdf
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #15
State-Space Systems
Closed-loop control using estimators and regulators.
Back to reality
(t)
x = (A LC)x (t) + Bu(t) + Ly(t)
y(t) = Cx(t)
(t)
y = Cx (t)
u(t) = Kx (t)
This does not look too good at this point not even obvious that
the closed-system is stable.
i(Acl ) =??
November 5, 2010
Fall 2010 16.30/31 153
Note that T = T 1
November 5, 2010
Fall 2010 16.30/31 154
November 5, 2010
Fall 2010 16.30/31 155
The Compensator
November 5, 2010
Fall 2010 16.30/31 156
r e u y
Gc(s) Gp(s)
November 5, 2010
Fall 2010 16.30/31 157
Mechanics
Basics:
e(t) = r(t) y(t), u(t) = Gce(t), y(t) = Gu(t)
x (t) A BCc
x(t) 0
L(s) : = + e(t)
x c(t) 0 Ac xc(t) Bc
x(t)
y(t) = C 0
xc(t)
November 5, 2010
Fall 2010 16.30/31 158
Assume that the closed-loop system has been written for the system
on 15-6, then it is still possible that the DC gain of the response from
r to y is not unity
Scalar input/output assumed for now
November 5, 2010
Fall 2010 16.30/31 159
November 5, 2010
Fall 2010 16.30/31 1510
Compensator:
A BK LC
Ac =
0 1 0 19
= 31 7 1 0
1 1 1 80
19 1
=
112 8
19
Bc = L =
80
Cc = K = 31 7
2 k=acker(a,b,[4+4*j;44*j]);
3 l=acker(a',c',[10 10]')';
4 %
6 %
7 ac=ab*kl*c;bc=l;cc=k;dc=0;
Note that the compensator has a low frequency real zero and two
higher frequency poles.
November 5, 2010
Fall 2010 16.30/31 1511
Fig. 2: Loop transfer function L(s) shows the slope change near c = 5
rad/sec. Note that we have a large PM and GM.
November 5, 2010
Fall 2010 16.30/31 1512
Fig. 3: Freeze compensator poles and zeros; look at root locus of closed-
loop poles versus an additional loop gain (nominally = 1.)
November 5, 2010
Fall 2010 16.30/31 1513
Code: Dynamic Output Feedback Example
1 % Combined estimator/regulator design for a simple system
2 % G= 1/(s2+s+1)
3 % Jonathan How
4 % Fall 2010
5 %
7 set(0,'DefaultLineLineWidth',2)
8 set(0,'DefaultFigureColor','None')
9 set(0,'DefaultlineMarkerSize',8);set(0,'DefaultlineMarkerFace','b')
11 %
13 k=acker(a,b,[4+4*j;44*j]);
14 l=acker(a',c',[10 11]')';
15 %
17 %
18 ac=ab*kl*c;bc=l;cc=k;dc=0;
19
20 G=ss(a,b,c,d);
21 Gc=ss(ac,bc,cc,dc);
22
23 f=logspace(1,2,400);
24 g=freqresp(G,f*j);g=squeeze(g);
25 gc=freqresp(Gc,f*j);gc=squeeze(gc);
26
27 figure(1);clf;orient tall
28 subplot(211)
30 xlabel('Freq (rad/sec)');ylabel('Mag')
32 grid
33 subplot(212)
34 semilogx(f,180/pi*angle(g),f,180/pi*angle(gc),'');
37
38 L=g.*gc;
39
40 figure(2);clf;orient tall
41 subplot(211)
43 xlabel('Freq (rad/sec)');ylabel('Mag')
44 legend('Loop L');
45 grid
46 subplot(212)
50 %
51 % loop dynamics L = G Gc
52 %
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 % closedloop dynamics
62 %
63 acl=albl*cl;bcl=bl;ccl=cl;dcl=d;
64 %
66 N=inv(ccl*inv(acl)*bcl)
67
68 hold on;plot(eig(acl),'d','MarkerFaceColor','b');hold off
69 grid on
70 axis([25 5 15 15])
71 %
73 %
74 Gcl=ss(acl,bcl*N,ccl,dcl*N);
75 gcl=freqresp(Gcl,f*j);gcl=squeeze(gcl);
76
November 5, 2010
Fall 2010 16.30/31 1514
77 figure(4);clf
78 loglog(f,abs(g),f,abs(gcl),'');
80 xlabel('Freq (rad/sec)');ylabel('Mag')
83
84 figure(5);clf
85 margin(al,bl,cl,dl)
86
92
93 figure(6);clf
95 bcl=[b;b];
96 N=inv(ccl*inv(acl)*bcl)
97 Gnew=ss(acl,bcl*N,ccl,dcl*N);
98 [yorig,t]=step(Gcl,2.5);
99 [ynew]=step(Gnew,t);
100 plot(t,yorig,t,ynew);setlines(2);
101 legend('Original','New');grid on
102 ylabel('Y');xlabel('Time (s)')
103 figure(6);export fig reg est6 pdf;
November 5, 2010
Fall 2010 16.30/31 1515
81420
Mag Fig. 5: Example #1: G(s) = (s+8)(s+14)(s+20)
0
10
G
Gc
1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
50
0
Phase (deg)
50
100
G
150 Gc
200 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
Loop L
0
10
Mag
2
10 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
0
50
Phase (deg)
100
150
200
250
1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1516
81420
Fig. 6: Example #1: G(s) = (s+8)(s+14)(s+20)
Bode Diagram
Gm = 11 dB (at 40.4 rad/sec) , Pm = 69.7 deg (at 15.1 rad/sec)
50
0
Magnitude (dB)
50
100
150
0
90
Phase (deg)
180
270
360
1 0 1 2 3
10 10 10 10 10
Frequency (rad/sec)
2
10
Plant G
Gcl unscaled
Gcl scaled
1
10
Mag
0
10
1
10
2
10 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1517
81420
Fig. 7: Example #1: G(s) = (s+8)(s+14)(s+20)
Root Locus
150 140
0.7 0.56 0.42 0.28 0.14
120
100
100 0.82
80
0.91 60
50 40
Imaginary Axis
0.975
20
20
0.975
50 40
0.91 60
80
100 0.82
100
120
0.7 0.56 0.42 0.28 0.14
150 140
150 100 50 0 50 100
Real Axis
Root Locus
25
0.86 0.76 0.64 0.5 0.34 0.16
20
0.94
15
10
0.985
Imaginary Axis
5
50 40 30 20 10
0
5
0.985
10
15
0.94
20
0.86 0.76 0.64 0.5 0.34 0.16
25
50 45 40 35 30 25 20 15 10 5 0
Real Axis
closed-loop poles, -- Plant poles, Plant zeros, Compensator poles, Compensator zeros
Two compensator zeros at -21.546.63j draw the two lower frequency plant poles further into the LHP.
Compensator poles are at much higher frequency.
Looks like a lead compensator.
November 5, 2010
Fall 2010 16.30/31 1518
0.94
Mag Fig. 8: Example #2: G(s) = s2 0.0297
0
10
G
Gc
1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
50
0
Phase (deg)
50
100
G
150 Gc
200 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
Loop L
0
10
Mag
2
10 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
0
50
Phase (deg)
100
150
200
250
1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1519
0.94
Fig. 9: Example #2: G(s) = s2 0.0297
Bode Diagram
Gm = 11.8 dB (at 7.41 rad/sec) , Pm = 36.6 deg (at 2.76 rad/sec)
50
0
Magnitude (dB)
50
100
150
135
Phase (deg)
180
225
270
2 1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)
2
10
Plant G
Gcl unscaled
Gcl scaled
1
10
Mag
0
10
1
10
2
10 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1520
0.94
Fig. 10: Example #2: G(s) = s2 0.0297
Root Locus
15
0.82 0.7 0.56 0.42 0.28 0.14
10
0.91
5 0.975
Imaginary Axis
5 0.975
0.91
10
Root Locus
2
2
0.64 0.5 0.34 0.161.75
0.76 1.5
1.5
1.25
0.86 1
1
0.75
0.94
0.5
Imaginary Axis
0.5
0.985 0.25
0.985 0.25
0.5
0.5
0.94
0.75
1
0.86 1
1.25
1.5
0.76 1.5
0.64 0.5 0.34 0.161.75
2
2 1.5 1 0.5 20 0.5 1 1.5 2
Real Axis
closed-loop poles, -- Plant poles, Plant zeros, Compensator poles, Compensator zeros
Compensator zero at -1.21 draws the two lower frequency plant poles further into the LHP.
November 5, 2010
Fall 2010 16.30/31 1521
81420
Mag Fig. 11: Example #3: G(s) = (s8)(s14)(s20)
0
10
G
Gc
1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
50
0
Phase (deg)
50
100
G
150 Gc
200 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
Loop L
0
10
Mag
2
10 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
0
50
Phase (deg)
100
150
200
250
1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1522
81420
Fig. 12: Example #3: G(s) = (s8)(s14)(s20)
Bode Diagram
Gm = 0.9 dB (at 24.2 rad/sec) , Pm = 6.67 deg (at 35.8 rad/sec)
50
0
Magnitude (dB)
50
100
150
200
135
180
Phase (deg)
225
270
315
360
1 0 1 2 3 4
10 10 10 10 10 10
Frequency (rad/sec)
2
10
Plant G
Gcl unscaled
Gcl scaled
1
10
Mag
0
10
1
10
2
10 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1523
81420
Fig. 13: Example #3: G(s) = (s8)(s14)(s20)
Root Locus
200
0.76 0.64 0.5 0.34 0.16
150 0.86
100
0.94
Imaginary Axis
50 0.985
50 0.985
0.94
100
150 0.86
Root Locus
25
25
0.64 0.5 0.34 0.16
0.76 20
20
15
15 0.86
10
10
0.94
Imaginary Axis
5
5 0.985
5 0.985
5
0.94
10
10
15 0.86
15
20 0.76
20
0.64 0.5 0.34 0.16
25
25 20 15 10 5 250 5 10 15 20 25
Real Axis
closed-loop poles, -- Plant poles, Plant zeros, Compensator poles, Compensator zeros
Compensator zeros at 3.728.03j draw the two higher frequency plant poles further into the LHP. Lowest
frequency one heads into the LHP on its own.
Compensator poles are at much higher frequency.
November 5, 2010
Fall 2010 16.30/31 1524
(s1)
Mag Fig. 14: Example #4: G(s) = (s+1)(s3)
0
10
G
Gc
1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
50
0
Phase (deg)
50
100
G
150 Gc
200 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
Loop L
0
10
Mag
2
10 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
0
50
Phase (deg)
100
150
200
250
1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1525
(s1)
Fig. 15: Example #4: G(s) = (s+1)(s3)
Bode Diagram
Gm = 3.4 dB (at 4.57 rad/sec) , Pm = 22.4 deg (at 1.41 rad/sec)
20
0
Magnitude (dB)
20
40
60
80
120
Phase (deg)
150
180
210
2 1 0 1 2 3
10 10 10 10 10 10
Frequency (rad/sec)
2
10
Plant G
Gcl unscaled
Gcl scaled
1
10
Mag
0
10
1
10
2
10 1 0 1 2 3
10 10 10 10 10
Freq (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1526
(s1)
Fig. 16: Example #4: G(s) = (s+1)(s3)
Root Locus
50
50
0.64 0.5 0.38 0.24 0.12
40
40 0.76
30
30
0.88
20
20
Imaginary Axis
0.97 10
10
10
0.97 10
20
20
0.88
30
30
40 0.76
40
0.64 0.5 0.38 0.24 0.12
50
50 40 30 20 10 500 10 20
Real Axis
Root Locus
10
10
0.64 0.5 0.34 0.16
0.76 8
8
6
6 0.86
4
4
0.94
Imaginary Axis
2
2 0.985
2 0.985
2
0.94
4
4
6 0.86
6
8 0.76
8
0.64 0.5 0.34 0.16
10
10 8 6 4 2 100 2 4 6 8 10
Real Axis
closed-loop poles, -- Plant poles, Plant zeros, Compensator poles, Compensator zeros
Compensator zero at -1 cancels the plant pole. Note the very unstable compensator pole at s = 9!!
Needed to get the RHP plant pole to branch o the real line and head into the LHP.
November 5, 2010
Fall 2010 16.30/31 1527
B747 DOFB
The previous B747 controller assumed full state feedback - would like
to extend that now to consider output feedback using the output of
the washout ltered yaw rate e
To place the estimator poles, take the approach of just increasing the
frequency of the LQR closed-loop poles by a factor of 2:
d(Aest) = 2 (Alqr )
1 Gp=WashFilt*sys*H;
2 set(Gp, 'statename', {'xwo' 'beta' 'yaw rate' 'roll' 'phi' 'xa'});
3 set(Gp, 'inputname', {'rudder inputs' 'aileron'},...
4 'outputname', {'filtered yaw rate' 'bank angle'});
5 [Ap,Bp,Cp,Dp]=ssdata(Gp);
6 [Klqr,S,Elqr]=lqr(Ap,Bp(:,1),Cp(1,:)'*Cp(1,:),0.1)
7
8 Eest=real(Elqr)*2+2*imag(Elqr)*sqrt(1);
9 Kest=place(Ap',Cp(1,:)',Eest);Kest=Kest';
November 5, 2010
Fall 2010 16.30/31 1528
3
5 4 3 2 1 0
Root Locus
1
Imaginary Axis
3
5 4 3 2 1 0
Real Axis
November 5, 2010
Fall 2010 16.30/31 1529
1
OL
0.8 LQR
Gain
0.6 DOFB
0.4
0.2
0.2
0.4
0.6
0.8
1
0 5 10 15 20 25 30
Time
Time response looks good perhaps even better than LQR, but
note that is not inconsistent as this DOFB might be using more
control eort, and LQR balances that eort with the state cost
1
LQR x2
0.9 2
DOFB x
0.8 LQR u2
DOFB u2
0.7
0.6
x2 and u2
0.5
0.4
0.3
0.2
0.1
0
0 2 4 6 8 10
Time
November 5, 2010
Fall 2010 16.30/31 1530
25 %
28 %
29 Gp=WashFilt*sys*H;
37 figure(1);clf
38 rlocus(Ap,Bp(:,1),Cp(1,:),0);
40 Kgain=2;
41 Egain=eig(ApBp(:,1)*Kgain*Cp(1,:));rifd(Egain)
44
45 Cpbeta=[0 1 0 0 0 0]; % performance output variable
46 Ggain=ss(ApBp(:,1)*Kgain*Cp(1,:),Bp,Cpbeta,0);
47 xp0=[0 1 0 0 0 0]';
48 [Ygain,Tgain]=initial(Ggain,xp0,Tol); %'
49
50 figure(2);clf
51 srl(ss(Ap,Bp(:,1),Cp(1,:),0));
52 sgrid([.1 .2 .3 .4],[.7 .8 .9 1])
53 axis([1.25 1.25 1.25 1.25]);grid on
54 hold on;plot(Elqr+eps*sqrt(1),'bd');hold off
55 export fig b747 lqr2 pdf
56
57 % close the LQR loop
58 Acl=ApBp(:,1)*Klqr;
59 Bcl=Bp(:,1);
61 Ccl=[Cpbeta;Klqr];
62 Dcl=[0;0];
63 Glqr=ss(Acl,Bcl,Ccl,Dcl);
64 [Y,T]=initial(Glqr,xp0,Tol); %'
65
66 figure(3);clf
67 plot(Tol,Yol,T,Y(:,1),Tgain,Ygain);axis([0 30 1 1]);
68 setlines(2)
69 legend('OL','LQR','Gain')
70 ylabel('\beta');xlabel('Time')
71 grid on
73
74 % estimator poles made faster by jfactor
November 5, 2010
Fall 2010 16.30/31 1531
75 jfactor=2.05;
76 Eest=jfactor*Elqr;
77 Kest=place(Ap',Cp(1,:)',Eest);Kest=Kest';
78
79 na=size(Ap,1);
81 % see 155
82 ac=ApBp(:,1)*KlqrKest*Cp(1,:);bc=Kest;cc=Klqr;dc=0;
83 Gc=ss(ac,bc,cc,dc);
84 % see 157
86 bcl=[zeros(na,1);bc];
88 ccl=[Cpbeta,zeros(1,na);zeros(1,na) cc];
89 dcl=[0;0];
90 Gcl=ss(acl,bcl,ccl,dcl);
91
92 figure(5);clf
93 [p,z]=pzmap(Gc(1,1));
94 plot(z+sqrt(1)*eps,'mo','MarkerFace','m')
95 hold on
96 plot(p+sqrt(1)*eps,'bs','MarkerFace','b')
97 hold off
November 5, 2010
Fall 2010 16.30/31 1532
Mag
0
0 10
10
Plant G
Compensator Gc
2
1 0 1 2
10 1 0 1 2
10 10 10 10 10 10 10 10
Freq (rad/sec) Freq (rad/sec)
0
200
Phase (deg)
Phase (deg)
100
100
0 200
100 300
200 1 0 1 2 1 0 1 2
10 10 10 10 10 10 10 10
Freq (rad/sec) Freq (rad/sec)
Root Locus
3
3
0.5 0.38 0.28 0.17 0.08
2.5
0.64
2
2
1.5
0.8
1
1
0.94
0.5
Imaginary Axis
0.5
0.94
1
1
0.8
1.5
2
2
0.64
2.5
November 5, 2010
Fall 2010 16.30/31 1533
Mag
0
0 10
10
Plant G
Compensator Gc
2
1 0 1 2
10 1 0 1 2
10 10 10 10 10 10 10 10
Freq (rad/sec) Freq (rad/sec)
0
200
Phase (deg)
Phase (deg)
100
100
0 200
100 300
200 1 0 1 2 1 0 1 2
10 10 10 10 10 10 10 10
Freq (rad/sec) Freq (rad/sec)
Root Locus
3
3
0.5 0.38 0.28 0.17 0.08
2.5
0.64
2
2
1.5
0.8
1
1
0.94
0.5
Imaginary Axis
0.5
0.94
1
1
0.8
1.5
2
2
0.64
2.5
0.5 0.38 0.28 0.17 0.08
3
2 1.5 1 0.5 30 0.5 1
Real Axis
November 5, 2010
Fall 2010 16.30/31 1534
Look at the resulting DOFB controller - are the plant poles; are
the compensator zeros; are the compensator poles
Root Locus
3
0.78 0.64 0.5 0.34 0.18
2.5
0.87
2
Imaginary Axis
1.5 0.94
1
0.985
0.5
0.5
0.985
1
4 3.5 3 2.5 2 1.5 1 0.5 0
Real Axis
So the DOFB controller puts zeros right near the plant poles similar
to the notch lter ensures that the departure angle of the poles is
to the left, not the right, so all the poles are stabilized.
Appears to achieve much higher levels of damping in that pole
than the classical/notch lter design did.
November 5, 2010
Fall 2010 16.30/31 1535
2 2
10 10
Loop L
Mag
Mag
0
0 10
10
Plant G
Compensator Gc
2
1 0 1 2
10 1 0 1 2
10 10 10 10 10 10 10 10
Freq (rad/sec) Freq (rad/sec)
0
200
Phase (deg)
Phase (deg)
100
100
0 200
100 300
200 1 0 1 2 1 0 1 2
10 10 10 10 10 10 10 10
Freq (rad/sec) Freq (rad/sec)
Bode Diagram
Factor of N=1 applied to Closed loop Gm = 1.87 dB (at 1.89 rad/sec) , Pm = 11.6 deg (at 1.49 rad/sec)
2
10
Plant G 100
closedloop Gcl
Magnitude (dB) 0
1
10
100
200
Mag
0
10
300
0
90
Phase (deg)
1
10 180
270
360
2
10 1 0 1 2
450
2 1 0 1 2 3
10 10 10 10 10 10 10 10 10 10
Freq (rad/sec) Frequency (rad/sec)
November 5, 2010
Fall 2010 16.30/31 1536
DOFB Summary
Note that the designer now focuses on selecting the appropriate reg
ulator and estimator pole locations.
Once those and the implementation architecture (i.e., how refer
ence input is applied, as on 155) are set, the closed-loop response
is specied.
Can almost consider the compensator to be a by-product.
November 5, 2010
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #16
Reference Input - II
r e u y
Gc(s) Gp(s)
November 2, 2010
Fall 2010 16.30/31 163
November 2, 2010
Fall 2010 16.30/31 164
Third: Given this extra freedom, what is best way to use it?
One good objective is to select G and N so that the state esti
mation error is independent of r(t).
With this choice, changes in r(t) do not tend to cause such large
(t)
transients in x
For this analysis, take x
(t) = x(t) xc(t) since xc(t) x
(t)
x
= Ax(t) + Bu(t) (Acxc(t) + Bcy(t) + Gr(t))
So
G BN
November 2, 2010
Fall 2010 16.30/31 165
sI A BCc 0
original det BcC sI Ac Bc = 0
C 0 0
sI A BCc BN
new det BcC sI Ac BN = 0
C 0 0
November 2, 2010
Fall 2010 16.30/31 166
14
Hard to see how this helps, but consider the scalar new case :
C(BCcBN + (sI Ac)BN ) = 0
CBN (BCc (sI [A BCc BcC])) = 0
CBN (sI [A BcC]) = 0
So zero of the y/r path is the root of sI [A BcC] = 0, which
is the pole of the estimator.
So by setting G = BN as in the new case, the estimator dynamics
are canceled out of the response of the system to a reference
command.
Cancelation does not occur with original implementation.
SISO, multi-dimensional state case handled in the appendix.
(s) e(s)
November 2, 2010
Fall 2010 16.30/31 167
November 2, 2010
Fall 2010 16.30/31 168
1
1 1 1
F H F F HG
Now use fact that =
0 G 0 G1
To get that
(sI (A BK))1 (sI (A BK))1 BK(sI (A LC))1
1
(sI Acl ) = T T
0 (sI (A LC))1
November 2, 2010
Fall 2010 16.30/31 169
(sI Acl )
C 0
BN
So new case has e(s) in numerator, which cancels the zero dynamics
out of the closed-loop response, but the original case does not.
November 2, 2010
Fall 2010 16.30/31 1610
FF Example 1
8 14 20
G(s) =
(s + 8)(s + 14)(s + 20)
Method #1: original implementation.
Method #2: original, with the reference input scaled to ensure
that the DC gain of y/r|DC = 1.
Method #3: new implementation with both G = BN and N se
lected.
Step Response
1.4
meth1
meth2
1.2 meth3
1
Y response
0.8
0.6
0.4
0.2
0
0 0.2 0.4 0.6 0.8 1
Time (sec)
November 2, 2010
Fall 2010 16.30/31 1611
FF Example 2
0.94
G(s) =
s2 0.0297
Method #1: original implementation.
Method #2: original, with the reference input scaled to ensure
that the DC gain of y/r|DC = 1.
Method #3: new implementation with both G = BN and N se
lected.
Step Response
1.5
meth1
meth2
meth3
1
Y response
0.5
0
0 1 2 3 4 5
Time (sec)
November 2, 2010
Fall 2010 16.30/31 1612
FF Example 3
8 14 20
G(s) =
(s 8)(s 14)(s 20)
Method #1: original implementation.
Method #2: original, with the reference input scaled to ensure
that the DC gain of y/r|DC = 1.
Method #3: new implementation with both G = BN and N se
lected.
Step Response
4
meth1
meth2
3 meth3
2
Y response
3
0 0.2 0.4 0.6 0.8 1
Time (sec)
November 2, 2010
Fall 2010 16.30/31 1613
FF Example 4
1 + 1.1 + 1.4 2
10-90% rise time tr = n = 0.44s
0.8
Y
0.6
0.4
0.2
0
0 0.5 1 1.5 2 2.5
Time (s)
November 2, 2010
Fall 2010 16.30/31 1614
Code: Dynamic Output Feedback FF Examples
1 % Code for Topic 16 in 2010
2 % Examples of dynamic output feedback
3 % Jonathan How
4 %
5 close all;
6 % clear all;for model=1:5;dofb examp2;end
7 fig=0;
8 % system
9 switch model
10 case 1
12 tt=[20 0 10 10]*2.5;
13 t=[0:.0025:1];
14 case 2
16 tt=[10 10 10 10]*2.5;
17 t=[0:.0025:1];
18 case 3
19 G=tf(.94,[1 0 0.0297]);name='nexamp3';
20 tt=[10 10 10 10]/5;
21 t=[0:.01:5];
22 case 4
24 tt=[10 10 10 10];
25 t=[0:.01:10];
26 case 5
27 G=tf(conv([1 2],[1 4]),conv(conv([1 1],[1 3]),[1 2*.2*2 22 0 0]));
28 name='examp5';
29 case 6
31 tt=[20 0 10 10]*2.5;
32 t=[0:.0001:1];
33 otherwise
34 return
35 end
36
37 %%%
38 [a,b,c,d]=ssdata(G);na=length(a);
39 %
40 if model == 6
41 R=.00001;
42 else
43 R=.01;
44 end
45 % choose the regulator poles using LQR 122
46 [k,P,reg poles]=lqr(a,b,c'*c,R);
47 %hold on
48 %plot(reg poles+j*eps,'md','MarkerSize',12,'MarkerFaceColor','m')
49 %hold off
50
51 % design the estimator by doubling the real part of the regulator poles
52 PP=2*real(reg poles)+imag(reg poles)*j;
53 % see 1413
54 ke=place(a',c',PP);l=ke';
56 ac=ab*kl*c;bc=l;cc=k;dc=0;
57 % see 156
59 % standard case
60 bcl1=[zeros(na,1);bc];
61 %scale up the ref path so that at least the Gcl(s) has unity DC gain
63 scale=ccl*inv(acl)*bcl2;
64 bcl2=bcl2/scale;
65 %
67 scale=ccl*inv(acl)*bcl3;
68 bcl3=bcl3/scale;
69 %
73 Gc=ss(ac,bc,cc,dc);
74
75 fig=fig+1;figure(fig);clf;
76 f=logspace(2,3,400);j=sqrt(1);
November 2, 2010
Fall 2010 16.30/31 1615
77 g=freqresp(G,f*j);g=squeeze(g);
78 gc=freqresp(Gc,f*j);gc=squeeze(gc);
79 gcl1=freqresp(Gcl1,f*j);gcl1=squeeze(gcl1);
80 gcl2=freqresp(Gcl2,f*j);gcl2=squeeze(gcl2);
81 gcl3=freqresp(Gcl3,f*j);gcl3=squeeze(gcl3);
82
83 figure(fig);fig=fig+1;clf
84 orient tall
85 subplot(211)
87 xlabel('Freq (rad/sec)');ylabel('Mag')
88 legend('G','G c','Location','Southeast');grid
89 subplot(212)
90 semilogx(f,180/pi*unwrap(angle(g)),f,180/pi*unwrap(angle(gc)),'','LineWidth',2);
93 legend('G','G c','Location','SouthWest')
94
95 L=g.*gc;
96
97 figure(fig);fig=fig+1;clf
98 orient tall
99 subplot(211)
November 2, 2010
Fall 2010 16.30/31 1616
154 plot(unwrap(angle(L))*180/pi,abs(L),'LineWidth',1.5)
155 hold on
156 plot(unwrap(angle(L))*180/pi,.95*abs(L),'r.','LineWidth',1.5)
157 plot(unwrap(angle(L))*180/pi,1.05*abs(L),'m:','LineWidth',1.5)
158 plot(unwrap(angle(ZZ))*180/pi,abs(ZZ),'g')
159 plot(180,1,'rx');hold off
160 hold on;
161 semilogy(unwrap(angle(ZZ))*180/pi360,abs(ZZ),'g')
162 hold off
163 legend('1','0.95','1.05')
164 axis([195 165 .5 1.5])
165 if max(real(eig(a))) > 0
166 title('Nichols: Unstable Openloop System')
167 else
168 title('Nichols: Stable Openloop System')
169 end
170 ylabel('Mag');xlabel('Phase (deg)')
171
172 figure(fig);fig=fig+1;clf
173 loglog(f,abs(1./(1+L)),f,abs(L),'','LineWidth',1.5);grid
174 title('Sensitivity Plot')
175 legend(' | S | ',' | L | ')
176 xlabel('Freq (rad/sec)');ylabel('Mag')
177 axis([.1 1e3 1e2 100])
178
179 figure(fig);fig=fig+1;clf
180 [y1,t]=step(Gcl1,t);
181 [y2,t]=step(Gcl2,t);
182 [y3,t]=step(Gcl3,t);
183 plot(t,y1,t,y2,t,y3,t,ones(size(t)),'','LineWidth',1.5)
184 setlines(1.5)
185 legend('meth1','meth2','meth3')
186 title('Step Response')
187 xlabel('Time (sec)');ylabel('Y response')
188
189 for ii=[1:gcf 15]
190 eval(['figure(',num2str(ii),'); export fig ',name,' ',num2str(ii),' pdf a1'])
191 if ii==4;
192 figure(ii);axis(tt)
193 eval(['export fig ',name,' ',num2str(ii),'a pdf'])
194 end
195 end
196
197 eval(['save ',name,' R G Gc Gcl1 Gcl2 Gcl3 k l P PP'])
198
199 return
November 2, 2010
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #17
LQ Servo Revisited
T
and dene x = x xI
Once have used LQR to design control gains K and KI , we have the
freedom to choose how we implement it the control system.
Provided that we dont change the feedback path and thus modify
the closed loop pole locations
r e 1 xI
KI
s
u y
K G(s)
x
r e 1 xI
KI
s
u y
R K G(s)
Design Approach
Assume that the state can be partitioned into parts we care about for
tracking (T x) that we assume are directly available from y and parts
we dont (x = T x)
Can think of T and T as selector matrices with a diagonal of
1s and 0s - but not always this form
But must have T + T = I.
So the control is
u = K(x
+ Re) KI xI
= K(x
+ R[r y]) KI xI
= K(x
RCx +Rr) KI xI
key
u = K(x + Rr) KI xI
Closed-loop dynamics
Two control laws being compared are:
u1 = K(x) KI xI (1)
u2 = K(x + Rr) KI xI (2)
with dynamics
x = Ax + Bu, y = Cx (3)
augmented with an integrator x I = r y
Closed-loop:
x A BK BKI x 0
= + r (4)
x I C 0 xI I
and
x A BK BKI x BKR
= + r (5)
x I C 0 xI I
(s+2)
Example G(s) = (s1)(ss+2)
1.4
1.2
0.8
y
0.6
0.4
0.2
LQ Servo without R
With R
0
0 1 2 3 4 5
Time
0
10
|Gcl|
LQ Servo without R
With R
2
10 2 1 0 1 2
10 10 10 10 10
w
0
cl
phase G
100
200
300 2 1 0 1 2
10 10 10 10 10
w
Fig. 2: LQ servo implementation comparison
2 % Fall 2010
5
6 G=tf([1 2],conv([1 1],[1 1 2]));
7 [a,b,c,d]=ssdata(G);
10 ns=size(a,1);
11 z=zeros(ns,1);
12 Rxx=c'*c;
13 Ruu=.001;
15 R=c'/1.75;
16
17 abar=[a z;c 0];
18 bbar=[b;0];
20 kbar1=lqr(abar,bbar,Rxx1,Ruu);
21 K1=kbar1(1,1:ns);Ki1=kbar1(ns+1);
22 % for R calc
23 kbar2=lqr(abar,bbar,Rxx1,1*Ruu);
24 K2=kbar2(1,1:ns);Ki2=kbar2(ns+1);
25
26 acl1=abarbbar*kbar1;
27 acl2=abarbbar*kbar2;
28 % implementation as on 175
29 bcl1=[zeros(ns,1);1];
30 bcl2=[b*K2*R;1];
31 ccl=[c 0];
32 dcl=0;
33
34 Gcl1=ss(acl1,bcl1,ccl,dcl);
35 Gcl2=ss(acl2,bcl2,ccl,dcl);
36
37 figure(1);
38 t=[0:.01:5]';
39 [y1,t1]=step(Gcl1,t);
40 [y2,t2]=step(Gcl2,t);
41 ')
plot(t,y1,t,y2,'
42 xlabel('Time')
43 ylabel('y')
46
47 w=logspace(2,2,300);
48 figure(2)
49 [mag1,ph1]=bode(Gcl1,w);mag1=squeeze(mag1);ph1=squeeze(ph1);
50 [mag2,ph2]=bode(Gcl2,w);mag2=squeeze(mag2);ph2=squeeze(ph2);
51 subplot(211);
52 loglog(w,mag1,w,mag2,'');grid on
55 subplot(212);
56 semilogx(w,ph1,w,ph2,'');grid on
DOFB Servo
Now back up a bit add address how to add an integrator into the
DOFB compensator to obtain robust tracking performance. For the
DOFB problem,
= Ax
x + Bu + L(y y
)
= (A LC)x + Bu + Ly (6)
x I = r y
x
u = K KI
xI
Augment integrator state used in LQR design, since it must be
part of the compensator (does not need to be estimated)
T T T
= x
x xI
Which gives the DOFB servo compensator as:
A LC BK BK I L 0
=
x +
x y+ r
0 0 I I
u = Kx (7)
Use LQR and its dual to nd K and L using the dynamics aug
mented with an integrator.
Implement as in Eq. 7 to get the following results
Note root locus as a function of scalar loop gain multiplier ,
where nominally = 1
Int Penalty 10
5
vs
4 CLP
OLP
3 OLZ
GcZ
2 GcP
Imaginary Axis
5
4 3 2 1 0 1 2
Real Axis
Fig. 3: DOFB servo root locus
Int Penalty 1
5
vs
4 CLP
OLP
3 OLZ
GcZ
2 GcP
Imaginary Axis
5
4 3 2 1 0 1 2
Real Axis
1.4
1.2
1
Response
0.8
0.6
0.4
Fig. 5: Step response of the DOFB servo interplay now between the various
weightings - all give zero SS error, but transient response quite dierent.
DOFB Servo II
As before, assume that we can partition the state into parts we care
about for tracking T x and parts we dont T x
Require that T + T = I
1.4
1.2
1
Response
0.8
0.6
0.4
Fig. 6: DOFB servo step response with and without R formulations compared to
N formulation (see Figure 5).
(s+2)
Example for same system as 17-5: G(s) = (s1)(ss+2)
Adding extra reference input like this increases the bandwidth of the
controller and speeds up the response.
But perhaps too much - so further tuning required.
sat(u) y
sat() Gp(s)
K = (A LC)
x x + Bsat(u) + Ly
x
4 %
6 [N,D]=tfdata(G,'v');roots(N);
7 [a,b,c,d]=ssdata(G);ns=size(a,1);
8 Ruu=.001;
9 Rxx=c'*c;
10 [klqr,P,E]=lqr(a,b,Rxx,Ruu);
11 z=zeros(ns,1);
14
15 abar=[a z;c 0];bbar=[b;0];
16 kbar1=lqr(abar,bbar,Rxx1,Ruu);
17 kbar2=lqr(abar,bbar,Rxx2,Ruu);
18
19 % use dual of LQR to design estimator
20 [l,QQ,EE]=lqr(a',c',b*b',.01);l=l';
21
22 % form compensators
25 by=[l;1];br=[l*0;1];
26 cc1=[kbar1];cc2=[kbar2];
27
28 % form closedloop dynamics
33
34 % using the Nbar form of closed loop
36 bcl3=[b;b];
37 ccl3=[c c*0];
38 Nbar=inv(ccl3*inv(acl3)*bcl3);
39 bcl3=bcl3*Nbar;
40
41 figure(1);t=[0:.01:5]';
42 [y2,t2]=step(ss(acl2,bcl,ccl,0),t);
43 [y1,t1]=step(ss(acl1,bcl,ccl,0),t);
44 [y3,t3]=step(ss(acl3,bcl3,ccl3,0),t);
45 plot(t1,y1,t2,y2,'r',t3,y3,'m:','LineWidth',2)
46 xlabel('time');ylabel('Response')
49
50 Gc uy=tf(ss(ac1,by,cc1,0));
51 [nn,dd]=tfdata(Gc uy,'v');
52 figure(2);
53 rlocus(G* Gc uy) % is a positive feedback loop now
54 hold on;plot(eig(acl1)+j*eps,'bd','MarkerFaceColor','b');hold off
55 hold on;plot(eig(a)+j*eps,'mv','MarkerFaceColor','m');hold off
56 hold on;plot(roots(N)+j*eps,'ro');hold off
57 hold on;plot(roots(nn)+j*eps,'ro','MarkerFaceColor','r');hold off
58 hold on;plot(roots(dd)+j*eps,'gs','MarkerFaceColor','g','MarkerSize',5);hold off
59 legend('vs \alpha','CLP','OLP','OLZ','GcZ','GcP','Location','NorthEast')
60 title('Int Penalty 10')
61 axis([4 2 5 5])
62 export fig lqservo2 pdf
63
64 Gc uy=tf(ss(ac2,by,cc2,0));
65 [nn,dd]=tfdata(Gc uy,'v');
66 figure(3);
67 rlocus(G* Gc uy) % is a positive feedback loop now
68 hold on;plot(eig(acl2)+j*eps,'bd','MarkerFaceColor','b');hold off
69 hold on;plot(eig(a)+j*eps,'mv','MarkerFaceColor','m');hold off
70 hold on;plot(roots(N)+j*eps,'ro');hold off
71 hold on;plot(roots(nn)+j*eps,'ro','MarkerFaceColor','r');hold off
72 hold on;plot(roots(dd)+j*eps,'gs','MarkerFaceColor','g','MarkerSize',5);hold off
73 legend('vs \alpha','CLP','OLP','OLZ','GcZ','GcP','Location','NorthEast')
74 title('Int Penalty 1')
75 axis([4 2 5 5])
76 export fig lqservo3 pdf
77
78 % Use R=/= formulation
79 R=c'/1.75;
80 figure(4);t=[0:.01:5]';
81 [y4,t4]=step(ss(acl1,[b*kbar1(1:ns)*R;b*kbar1(1:ns)*R;1],ccl,0),t);
82 %[y4,t4]=step(ss(acl2,[b*kbar2(1:ns)*R;b*kbar2(1:ns)*R;1],ccl,0),t);
83 plot(t1,y1,t4,y4,t3,y3,'m:','LineWidth',2)
84 %plot(t2,y2,t4,y4,t3,y3,'m:','LineWidth',2)
85 xlabel('time');ylabel('Response')
86 legend('Int Penalty 10 no R','Int Penalty 10 with R','Nbar Form','Location','SouthEast')
87 export fig lqservo4 pdf
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #18
Deterministic LQR
Optimal control and the Riccati equation
Weight Selection
Fall 2010 16.30/31 182
Have seen the solutions to the LQR problem, which results in linear
full-state feedback control.
Would like to get some more insight on where this came from.
z = Cz x
Cost:
tf
1 T 1
November 5, 2010
Fall 2010 16.30/31 183
Constrained Optimization
1.5
0.5
0
y
0.5
1.5
2
2 1.5 1 0.5 0 0.5 1 1.5 2
x
November 5, 2010
Fall 2010 16.30/31 184
L L L
= = =0
x y
which gives
L
= 2x + = 0
x
L
= 2y + = 0
y
L
= x + y + 2 = 0
Key point here is that due to the constraint, the selection of x and y
during the minimization are not independent
Lagrange multiplier captures this dependency.
November 5, 2010
Fall 2010 16.30/31 185
LQR Optimization
3. H = 0 Ruuu + Bu
T 1 T
p = 0, so u = Ruu Bu p
u
2
Can check for a minimum by looking at H2 0 (need to check
u
that Ruu 0)
November 5, 2010
Fall 2010 16.30/31 186
2. It is relatively easy to nd P .
November 5, 2010
Fall 2010 16.30/31 187
Turns out that the news is even better than that, because LQR ex
hibits very good stability margins
r x
Bu (sI A)1 K
November 5, 2010
Fall 2010 16.30/31 188
Can develop a relationship between the open-loop cost C(s) and the
closed-loop return dierence I +L(s) called the Kalman Frequency
Domain Equality
1
[I + L(s)]T [I + L(s)] = 1 + C T (s)C(s)
Written for MIMO case, but look at the SISO case to develop further
insights (s = j)
[I + L(j)] [I + L(j)] = (I + Lr () jLi())(I + Lr () + jLi())
|1 + L(j)|2
and
C T (j)C(j) = Cr2 + Ci2 = |C(j)|2 0
November 5, 2010
Fall 2010 16.30/31 189
3 |LN(j)|
2 |1+LN(j)|
1
Imag Part
0
(1,0)
1
4
7 6 5 4 3 2 1 0 1
Real Part
Great, but why is this so signicant? Recall the SISO form of the
Nyquist Stability Theorem:
If the loop transfer function L(s) has P poles in the RHP s-plane (and
lims L(s) is a constant), then for closed-loop stability, the locus
of L(j) for : (, ) must encircle the critical point (1, 0) P
times in the counterclockwise direction (Ogata528)
November 5, 2010
Fall 2010 16.30/31 1810
stable OL
1.5
0.5 LA(j)
Imag Part
2
0
0.5 1 LN(j)
1.5
Real Part
Fig. 2: Perturbation to the LTF causing a change in the number of encirclements
November 5, 2010
Fall 2010 16.30/31 1811
Claim is that since the LTF L(j) is guaranteed to be far from the
critical point for all frequencies, then LQR is VERY robust.
Can study this by introducing a modication to the system, where
nominally = 1, but we would like to consider:
The gain R
j
The phase e
K(sI A)1Bu
|L|
1
|1+L|
Imag Part
0 =0
3
2 1 0 1 2 3 4
Real Part
Fig. 3: Example of LTF for an open-loop Fig. 4: Example loop transfer functions
stable system for open-loop unstable system.
November 5, 2010
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #19
Stengel Chapter 6
Question: how well do the large gain and phase margins
discussed for LQR map over to DOFB using LQR and LQE
(called LQG)?
Fall 2010 16.30/31 192
November 5, 2010
Fall 2010 16.30/31 193
The good news is that the state-space techniques will give you a
controller very easily.
You should use the time saved to verify that the one you
designed is a good controller.
Need to develop tools that will give us some insight on how well a
controller can tolerate modeling errors.
November 5, 2010
Fall 2010 16.30/31 194
m, l
L
F
November 5, 2010
Fall 2010 16.30/31 195
Dene
q
q= , x=
x q
Then with y = x
x = Ax + Buu
y = Cy x
5
10
Mag
0
10
G
Gc
5
10 2 1 0 1 2
10 10 10 10 10
Freq (rad/sec)
200
Phase (deg)
150
G
100 Gc
50
0 2 1 0 1 2
10 10 10 10 10
Freq (rad/sec)
Fig. 1: Plant and Controller
November 5, 2010
Fall 2010 16.30/31 196
2
10
Mag Loop L
0
10
2
10 2 1 0 1 2
10 10 10 10 10
Freq (rad/sec)
0
Phase (deg)
100
200
300 2 1 0 1 2
10 10 10 10 10
Freq (rad/sec)
Bode Diagram
Gm = 0.0712 dB (at 5.28 rad/sec) , Pm = 0.355 deg (at 3.58 rad/sec)
30
20
Magnitude (dB)
10
10
20
30
180
90
Phase (deg)
90
180
2 1 0 1 2
10 10 10 10 10
Frequency (rad/sec)
Fig. 2: Loop and Margins
November 5, 2010
Fall 2010 16.30/31 197
Root Locus
10
10
0.64 0.5 0.34 0.16
0.76 8
8
6
6 0.86
4
4
0.94
Imaginary Axis
2
2 0.985
2 0.985
2
0.94
4
4
6 0.86
6
8 0.76
8
0.64 0.5 0.34 0.16
10
10 8 6 4 2 100 2 4 6 8 10
Real Axis
Root Locus
2
2 0.64 0.5 0.34 0.16
1.75
0.76
1.5
1.5
1.25
0.86
1
1
0.75
0.94
0.5
Imaginary Axis
0.5
0.985 0.25
0.985 0.25
0.5
0.5
0.94
0.75
1
1
0.86
1.25
1.5
1.5
0.76
1.75
2 0.64 0.5 0.34 0.16
2
2 1.5 1 0.5 0 0.5 1 1.5 2
Real Axis
Fig. 3: Root Locus with frozen compensator dynamics. Shows sensitivity to overall
gain symbols are a gain of [0.995:.0001:1.005].
November 5, 2010
Fall 2010 16.30/31 198
Looking at both the Loop TF plots and the root locus, it is clear this
system is stable with a gain of 1, but
Unstable for a gain of 1 and/or a slight change in the system
phase (possibly due to some unmodeled delays)
Very limited chance that this would work on the real system.
Of course, this is an extreme example and not all systems are like this,
but you must analyze to determine what robustness margins your
controller really has.
November 5, 2010
Fall 2010 16.30/31 199
Premise is that the system is stable for the nominal system has the
right number of encirclements.
Goal of the robustness test is to see if the possible perturbations
to our system model (due to modeling errors) can change the
number of encirclements
In this case, say that the perturbations can destabilize the system.
November 5, 2010
Fall 2010 16.30/31 1910
1.02
1.01
Mag
Mag
0
10 1
0.99
0.98
0.97
0.96
1
10 0.95
260 240 220 200 180 160 140 120 100 180.5 180 179.5 179 178.5
Phase (deg) Phase (deg)
Fig. 4: Nichols Plot (|L((j))| vs. arg L((j))) for the cart example which clearly
shows sensitivity to overall gain and/or phase lag.
Sensitivity Plot
3
10
|S|
|L|
2
10
1
10
Mag
0
10
1
10
2
10 2 1 0 1 2
10 10 10 10 10
Freq (rad/sec)
Diculty in this example is that the open-loop system is unstable, so L(j) must
point.
November 5, 2010
Fall 2010 16.30/31 1911
Summary
LQG gives you a great way to design a controller for the nominal
system.
Other tools have been developed that allow you to directly shape the
sensitivity plot |S(j)|
Called H and
November 5, 2010
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #20
Digital Control
d
r e u y
Gc(s) Gp(s)
Can implement this using analog circuits, but as you have seen, there
are many advantages to implementing these using a computer much
more exible
yk A2D
Digital Computer
November 5, 2010
Fall 2010 16.30/31 202
Ts
y(t) y(k)
November 5, 2010
Fall 2010 16.30/31 203
u(k)
u(t) ?
Basic approach is to just hold the latest value of u(k) for the entire
periods Ts
Called a zero-order hold (ZOH)
Ts
u(k) = y(k)
y(t) ZOH u(t)
November 5, 2010
Fall 2010 16.30/31 204
So sampled and held e(t) looks like input e(t), but delay is obvious.
November 5, 2010
Fall 2010 16.30/31 205
Time
November 5, 2010
Fall 2010 16.30/31 206
Control Law
Basic compensator
s + z U (s)
Gc(s) = Kc =
s + p E(s)
xc(k + 1) xc(k)
= Acxc + Bce
Ts
xc(k + 1) = (I + TsAc)xc(k) + TsBce(k)
u(k) = Ccxc(k) + Dce(k)
November 5, 2010
Fall 2010 16.30/31 207
initialize uold
k = k + 1
wait
end while
Note that this outputs the control as soon after the data read as
possible to reduce the delay
result is that the write time might be unknown
Could write uk+1 at end of wait delay is longer, but xed
November 5, 2010
Fall 2010 16.30/31 208
Summary
Using a digital computer introduces some extra delay
Sample and hold Ts/2 delay
Holding u(k) to end of loop Ts delay
So the delay is Ts/23Ts/2
With s 15BW , delay eects are small, and the cts and discrete
controllers are similar
November 5, 2010
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #21
NL Example
f (x, x)
G(s)
0
x
2
=1
3 =2
=0.2
4
3 2 1 0 1 2 3 4
x
Thus the output of the nonlinearity (input of the linear part) contains
the third harmonic of the input
Key point: since the system G(s) is low pass, expect that this
third harmonic will be suciently attenuated by the linear sys
tem that we can approximate
2 A3
q(t) = x x cos(t)
4
A2 d
= [A sin(t)]
4 dt
What are the implications of adding this nonlinearity into the feedback
loop?
Can approximately answer that question by looking at the stability
of G(s) in feedback with N .
x = A sin(t) = G(j)q = G(j)N (A, )(x)
which is equivalent to:
(1 + G(j)N (A, ))x = 0
that we can rewrite as:
A2(j)
1 + =0
4 (j)2 (j) + 1
So we have
4T
N=
A
so the equivalent gain decreases as the input amplitude goes up.
Makes sense since the output is limited, so eective gain of the
nonlinearity must decrease as the amplitude of the input goes up
Saturation Nonlinearity
Set = t, so that d = dt
4 /2
d
a1 = y(t) sin
0
T
4 /2
4
= A sin sin d + T sin d
0 T
4A T
/2
4T
= A sin2 d + sin d
0 T
2
2A T 2T T
= arcsin + 1
A A
Many of the DF are real, but for NL with delay, hysteresis, can get
very complex forms for N that involve phase lags.
N has both real and imaginary parts
f (e)
T
e
Converts input sine wave to square wave, and also introduces phase
shift, as change from 1 to +1 occurs after input signal has
changed sign.
If = arcsin(
A ), then
2T 4T
b1 = cos d + cos d =
0 A
2
2T 4T
a1 = sin d + sin d = 1
0 A
Thus we have
2
4T
N (A) = 1 j
A A A
Where the complex term arises from the phase shift from a sin
input to a cos output.
DF Analysis Example
K
Plant: G(s) = s(T1 s+1)(T2 s+1)with relay nonlinearity:
T if e 0
f (e) =
T if e < 0
Graphical test:
With a Relay, K=1.5, A=2.2918
4
G
1
3
N
1
Imag
4
8 7 6 5 4 3 2 1 0
Real
Fig. 1: DF graphical test note that the DF is on the negative real line, parameterized
by A, whereas the transfer function of G is parameterized by
RL
x' = Ax+Bu
y = Cx+Du
State -Space
XY Graph 1
Fig. 3: System initially forced a little (green) and a lot (blue), and then both re
sponses converge to the same limit cycle
Can show that the expected amplitude of the limit cycle is:
4T KT1T2
A=
(T1 + T2)
For the graphical test, note that 1/N is real, and very similar to
the result for a relay
Relay
1 Saturation
10
N
0
10
1
10
0 1 2 3 4 5
A
Fig. 4: Comparison of N for relay and saturation
1
Imag
4
8 7 6 5 4 3 2 1 0
Real
so we have
2 2
1 4T 4T
= 1 + j
N A A A A
2 2
A A
= 1 +j = 1 j
4T A A 4T A 4T
0.4
0.2
Imag
0.2
0.4
0.6
0.8
1
5 4 3 2 1 0
Real
Fig. 5: Test for limit cycle for a relay with hysteresis, K = 1.5, = T /3
0.5
0
x
0.5
1.5
4 2 0 2 4 6
x
Fig. 6: Simulation comparison of all 3 types of nonlinearities with K = 1.5. Simu
lation results agree well with the predictions.
2 2
1 1
Imag
Imag
0 0
1 1
2 2
3 3
4 4
8 7 6 5 4 3 2 1 0 8 7 6 5 4 3 2 1 0
Real Real
With a Relay with Hysteresis, K=1 A=2.0808 Sim response with different NLs, K=1
1 1
G Relay
0.8 1
0.8 Saturation
N
Hyst
0.6 0.6
0.4 0.4
0.2 0.2
Imag
0 0
x
0.2 0.2
0.4 0.4
0.6 0.6
0.8 0.8
1 1
5 4 3 2 1 0 4 2 0 2 4 6
Real x
Fig. 7: Repeat all simulations with K = 1
2 2
1 1
Imag
Imag
0 0
1 1
2 2
3 3
4 4
8 7 6 5 4 3 2 1 0 8 7 6 5 4 3 2 1 0
Real Real
With a Relay with Hysteresis, K=0.7 A=1.6013 Sim response with different NLs, K=0.7
1 0.8
G Relay
0.8 1
Saturation
N 0.6
Hyst
0.6
0.4
0.4
0.2 0.2
Imag
0 0
x
0.2
0.2
0.4
0.4
0.6
0.8 0.6
1 0.8
5 4 3 2 1 0 2 1 0 1 2 3 4 5
Real x
Fig. 8: Repeat all simulations with K = 0.7
Stability analysis is similar to that used for linear systems, where the
concern is about encirclements of critical point s = 1.
Dierence here: use the 1/N (A) point as critical point.
Example
Im
Unstable L.C.
U S U
A
Re
Stable L.C.
2 % Jonathan How
3 % Oct 2009
4 %
5 set(0,'DefaultLineLineWidth',1.5)
6 set(0,'DefaultAxesFontName','arial');set(0,'DefaultTextFontName','arial')
7 set(0,'DefaultlineMarkerSize',8);set(0,'DefaultlineMarkerFace','r')
9 set(0,'DefaultFigureColor','w', 'DefaultAxesColor','w',...
10 'DefaultAxesXColor','k', 'DefaultAxesYColor','k',...
11 'DefaultAxesZColor','k','DefaultTextColor','k')
12 %
13 %clear all
14 global T GG2 GG3 Delta
15
16 if 0
17 T 1=3;T 2=2;K=1.5;T=1;
18 elseif 0
19 T 1=3;T 2=2;K=1;T=1;
20 else
21 T 1=3;T 2=2;K=0.7;T=1;
22 end
23
24 SS=(K* T 1 * T 2)/(T 1+T 2);
25 G=tf(K,conv([T 1 1 0],[T 2 1]));
26 omega=logspace(3,3,400);GG=freqresp(G,omega);GG=squeeze(GG);
27 omega2=1/sqrt(T 1 * T 2);GG2=freqresp(G,omega2);GG2=squeeze(GG2);
28
29 A1=logspace(2,log10(10),50);
30 N1=4*T./(pi*A1);
31 figure(1);clf
32 plot(real(GG),imag(GG));
33 axis([10 1 10 10]);
34 axis([8 .1 4 4]);
35 grid on;hold on;
36 plot(real(1./N1),imag(1./N1),'r');
37 plot(real(GG2),imag(GG2),'ro');
38 hold off;
39 xlabel('Real');ylabel('Imag');
1
40 h=legend({'G',' '},'Location','NorthEast','interpreter','latex');
N
41 title(['With a Relay, K=',num2str(K),', A=',num2str(real(GG2)*4*T/pi)])
42
43 A2=logspace(log10(T),log10(10),50);
44 N2=(2/pi)*(asin(T./A2)+(T./A2).*sqrt(1(T./A2).2));
45 figure(5);clf
46 plot(A2,1./N2,[0 5]',[real(GG2) real(GG2)],'k');grid on
47 axis([1 1.75 2 0.9]);
48 if real(GG2) < 1
49 Asat=fsolve('Nsat',[1]);
50 else
51 Asat=inf;
52 end
53
54 figure(2);clf
55 plot(real(GG),imag(GG));axis([8 .1 4 4]);
57 plot(real(1./N2),imag(1./N2),'r');
58 if real(GG2) < 1
59 plot(real(GG2),imag(GG2),'ro');
60 end
61 hold off;
62 xlabel('Real');ylabel('Imag');
1
63 h=legend({'G',' '},'Location','NorthEast','interpreter','latex');
N
64 title(['With a Saturation , K=',num2str(K),' A=',num2str(Asat)])
65
66 Delta=T/3;
67 A3=logspace(log10(Delta),1,200);
68 N3=(4*T./(A3*pi)).*(sqrt(1(Delta./A3).2)sqrt(1)*Delta./A3);
69 figure(3);clf
70 plot(real(GG),imag(GG));
71 axis([5 .1 1 1]);
73 plot(real(1./N3),imag(1./N3),'r');
75 GG3=GG(ii);Ahyst=fsolve('Nhyst',[2])
76 plot(real(GG3),imag(GG3),'ro');
77 hold off;
78 xlabel('Real');ylabel('Imag');
1
79 h=legend({'G',' '},'Location','NorthEast','interpreter','latex');
N
80 title(['With a Relay with Hysteresis, K=',num2str(K),' A=',num2str(Ahyst)])
81
82 figure(4);clf
84 semilogy(A1,N1,A2,N2,'k');grid on
85 xlabel('A','Interpreter','latex');ylabel('N ','Interpreter','latex');
86 legend('Relay','Saturation','Location','NorthEast');
88
89 sim('RL1');sim('RL2');sim('RL3');
90
91 figure(6)
92 plot(RL(:,1),RL(:,2))
93 hold on
94 plot(RL2(:,1),RL2(:,2),'g')
95 plot(RL3(:,1),RL3(:,2),'r:')
96 hold off
97 legend('Relay','Saturation','Hyst','Location','NorthEast');
98 grid on
99 xlabel('x','Interpreter','latex');
102
103 if K==1.5
114 else
119 end
1 function y=Nsat(A);
2 global T GG2
3
4 N2=(2/pi)*(asin(T/A)+(T/A)*sqrt(1(T/A)2));
5 y=1/N2real(GG2);
6
7 end
1 function y=Nhyst(A);
2 global T GG3 Delta
3
4 neginvN3=(A*pi/(4*T))*sqrt(1(Delta/A)2)sqrt(1)*(Delta*pi)/(4*T)
5 y=real(neginvN3)real(GG3)
6
7 end
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #22
Stability
Let x = 0 D be an equilibrium point of the system
x = f (x),
xe
x(0)
Unstable
Already talked about how to linearize the dynamics about the equilib
rium point and use the conclusion from the linear analysis to develop
a local conclusion
Often called Lyapunovs rst method
Furthermore,
1. If V (x(t)) = 0 only when x(t) = x0, then the equilibrium is
asymptotically stable.
2. If V (x(t)) < V (x(t)), for some > 0, then the equilibrium
is exponentially stable.
1A compact set is a set that is closed and bounded, e.g., the set {(x, y) : 0 x 1, x2 y x2 .
Example 1: Pendulum
Consider a pendulum:
g
= sin() c,
l
Setting x1 = , x2 = :
x 1 = x2
g
x 2 = sin(x1) cx2
l
Analysis:
V (0) = 0
V (x1, x2) 0
In particular, note that the solution P of the Riccati equation has the
interpretation of a Lyapunov function, i.e., for this closed-loop system
we can use
V (x) = xT P x
Check:
V (x) = xT P x + x T P x
= xT P (A + BK)x + xT (A + BK)T P x
= xT (P A + P BK + AT P + K T B T P )x
= xT (AT P + P A P BR1B T P P BR1B T P )x
= xT (Q + P BR1B T P )x 0
dt 1+x
which has equilibrium points at x = 1 and x = 2.
dt 2 + z
which has an eq point at z = 0.
Example 5: Saturation
r e u 1
x2 1
x1
f (e) Ts s
Clearly:
V = 0 if e = x2 = 0 and V > 0 for x22 + e2 = 0
What about the derivative?
V = T x2x 2 + f (e)e
1 f (e)
= T x2 x2 + + f (e) [x2]
T T
= x22
Invariance Principle
Note that positively invariant sets include equilibrium points and limit
cycles.
Invariance Example 1
Thus previously could only show that V (x) 0, and the system
is stable ISL
Revisit Example 5:
V decreasing if x2 = 0, and the only invariant point is x2 = e = 0,
so the origin is asymptotically stable
Invariance Example 2
Limit cycle:
x 1
=
x2 x71
[x
41
+ 2x
22
10]
x 2
=
x
31 3x52
[x
41
+ 2x22 10]
Note that x
41
+ 2x
22
10 is invariant since
d
4
[x
1
+ 2x
22
10] = (4x
10
6 4 2
1
+ 12x
2
)(x
1
+ 2x
2
10)
dt
which is zero if x
41
+ 2x
22
= 10.
so
V
< 0 except if x
41
+ 2x
22
= 10 (the LC) or x
10
6
1
+ 3x
2
= 0 (at
origin).
Conclusion: since the origin and LC are the invariant set for this
system - thus all trajectories starting in a neighborhood of the LC
converge to this invariant set
Actually turns out the origin in unstable.
Summary
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
16.30/31 Feedback Control Systems
Overview of Nonlinear Control Synthesis
Emilio Frazzoli
December 3, 2010
Geometric control
Feedback linearization
Dynamics inversion
Dierential atness
Adaptive control
Neural network augmentation
Lyapunov-based methods/Contraction theory
Control Lyapunov Functions
Backstepping
Computational/logic approaches
Hybrid systems
i = 1, . . . n.
For each of these equilibria, linearize the system and design a local control
law ui (x) = ui K (x xi ) for the linearization.
It is positive denite
V (0) = 0.
A dynamical system
dx
= f (x, u),
dt
z = h(x, u).
p
d = g + fI /m,
forces.
E. Frazzoli (MIT) Nonlinear Control December 3, 2010 7 / 14
A dierentially-at model of aircraft dynamics 3/4
pd = R V 3 ,
V 2
Also,
pd,1 2 an + a t
d
pd,2 = R 3 at 1 an
dt 3
pd,3 2 at + a n
Finally, we have
a t 2 an 1 0 0 3 pd,1
d
1 = 3 at /an + 0 1/an 0 R T 3 pd,2
dt
a n 2 at 0 0 1 pd,3
an = I V12 p d p dT (
pd g ) = 0: if the normal acceleration is zero, the roll
attitude is not well dened.
1
L= V 2 SCL + aL0 ,
2m
the drag is similarly computed.
The engine thrust T is a function of the throttle setting T and other variables.
at = T (T ) cos D(),
an = T (T ) sin L().
What if the initial condition is not on the reference trajectory? What if there
are disturbances that make the aircraft deviate from the trajectory? We need
feedback.
Let p : t p(t) be the actual position of the vehicle, and consider a system
in which p (3) = u, e.g.,
p 0 I 0 p 0
d
p = 0 0 I p + 0 u
dt
p 0 0 0 p I
If we
set
(3)
u = pd K [e, e , e]T ,
where k is a stabilizing control gain for the error dynamics, and
compute at , an , 1 from (p, p , p
, u) (vs. pd and its derivatives)
then,
lim e(t) = lim (p(t) pd (t)) = 0,
t + t +
as desired.
Convergence assured almost globally, the control law breaks down if at any
point x = 0, or an = 0.
A modication of this control law can ensure path tracking (vs. trajectory
tracking), requiring less thrust control eort. See Hauser & Hindman '97.
Some limitations:
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #23
Fg F
mg
Fg = mg sin(),
Engine model
200 200
n=5
180 180
Torque T [Nm]
Torque T [Nm]
160 160
140 140
100 100
0 200 400 600 0 20 40 60
Angular velocity [rad/s] Velocity v [m/s]
2
Engine torque (at full throttle): T = Tm 1
m 1 ,
where = nr v = nv, n is gear ratio, and r wheel radius.
The engine driving force can hence be written as
Feng = nT (nv)u, 0 u 1.
Jacobian Linearization
Any (feasible) speed corresponds to an equilibrium point.
Choose a reference speed vref > 0, and solve for dv/dt = 0 with
respect to u, assuming a horizontal road ( = 0).
0 = nT (nv)
u CdAv2 mgCr
2
i.e.,
1
2
2 Cd Av + mgCr
u = .
nT (nv)
Linearized system ( = v v, = u u):
d 1
T (nv)
1
= n
u C
Av
+ nT (nv)
v
v
d
dt
m
m
Adyn Bdyn
Nonlinear Simulation
Check with BOTH linear AND nonlinear simulation
f(u)
Signal 1 -K- sin -K-
Fg
engine Car1
Gain 2 Trigonometric Gain 4
Signal Builder f(u)
Function
ubar To Workspace
vbar Clock
Faero
1
1
1
-C -K-
Ffrict F s v
-K-
vbar
Gain 3
1.5s+1.5 Bdyn
Scope
s s-Adyn
control 1 Transfer Fcn
ubar
Review
(Jacobian) linearization:
Find the desired equilibrium condition (state and control).
Linearize the non-linear model around the equilibrium.
Control design:
Design a linear compensator for the linear model.
If the linear system is closed-loop stable, so will be the nonlinear
systemin a neighborhood of the equilibrium.
Check in a (nonlinear) simulation the robustness of your design
with respect to typical deviations.
What is wrong?
Idea: once the input saturates, stop integrating the error (cant do
much about it anyway!)
Anti-windup Logic
Anti-windup Scheme
Signal 1 f(u)
-K- sin -K-
Fg
engine Car2
Gain 2 Trigonometric Gain 4
Signal Builder f(u)
Function To Workspace
vbar ubar Clock
Faero
Constant
1
1.5 -K-
-C- F s v
1 Ffrict
Gain Integrator
0 Transfer Fcn 2 Constant 1
Add
1.5 Product
Constant 3 Saturation
s
Transfer Fcn 3
-K-
Gain 1
-K-
vbar
ubar
Anti-windup Summary
3 set(0,'DefaultAxesFontName','arial')
4 set(0,'DefaultAxesFontSize',12)
5 set(0,'DefaultTextFontName','arial')
6
7 clear all
8 %close all
10 theta=0;
11 gear=5;
21 m=1500; % mass
22 v=25;
23
24 % Compute the torque produced by the engine, Tm
27 F = alpha(gear) * torque;
28
29 % Compute the external forces on the vehicle
34
35 ubar=(Fa+Fr)/(F)
36 vbar=v;
37
38 dTdv=Tm*(2*beta*(alpha(gear)*vbar/wm1)*(alpha(gear)/wm))
39 Adyn=(alpha(gear)*dTdv*ubarrho*Cd*A*vbar)/m;
40 Bdyn=F/m;
41
42 Hillangle=4; % nonsaturating angle
43 sim('cruise control')
44 figure(4);
45 subplot(211);
46 plot(Car1(:,5),Car1(:,[2]),'LineWidth',2);xlabel('Time');ylabel('Speed')
48 subplot(212);
49 plot(Car1(:,5),Car1(:,[4]),'LineWidth',2);xlabel('Time');ylabel('Throttle')
50
51 figure(1);
52 subplot(211);
53 plot(Car1(:,5),Car1(:,[1 2]),'LineWidth',2);xlabel('Time');ylabel('Speed')
54 legend('NL','Lin','Location','SouthEast');
56 subplot(212);
57 plot(Car1(:,5),Car1(:,[3 4]),'LineWidth',2);xlabel('Time');ylabel('Throttle')
58
59 Antiwindup gain=0; % us esame code with and without AWup
60 Hillangle=4.85;
62 figure(2);
63 subplot(211);
64 plot(Car2(:,5),Car2(:,[1 2]),'LineWidth',2);xlabel('Time');ylabel('Speed')
65 legend('NL','Lin','Location','SouthEast');
67 subplot(212);
68 plot(Car2(:,5),Car2(:,[3 4]),'LineWidth',2);xlabel('Time');ylabel('Throttle')
69
70 Car2 no AW=Car2;
71
72 Antiwindup gain=5;
73 sim('cruise control awup')
74 figure(3);
75 subplot(211);
76 plot(Car2(:,5),Car2(:,[1 2]),'LineWidth',2);xlabel('Time');ylabel('Speed')
77 legend('NL','Lin','Location','SouthEast');
78 title(['Hill response, angle=',num2str(Hillangle),' With Antiwindup gain=',num2str(Antiwindup gain)])
79 subplot(212);
80 plot(Car2(:,5),Car2(:,[3 4]),'LineWidth',2);xlabel('Time');ylabel('Throttle')
81
82 figure(5);
83 subplot(211);
84 plot(Car2 no AW(:,5),Car2 no AW(:,[6 7]),Car2 no AW(:,5),10* Car2 no AW(:,[8]),'LineWidth',2);xlabel('Time');yla
85 legend('sat(u)','u','10* e {vel}','Location','NorthEast');
86 axis([4 20 0.5 5])
87 title(['Hill response no AW'])
88 subplot(212);
89 plot(Car2(:,5),Car2(:,[6 7]),Car2(:,5),10*Car2(:,[8]),'LineWidth',2);xlabel('Time');ylabel('Windup error')
90 legend('sat(u)','u','10* e {vel}','Location','NorthEast');
91 title(['Hill response with AW'])
92 axis([4 20 0.5 5])
93
94 print dpng r300 f1 AW1.png
95 print dpng r300 f2 AW2.png
96 print dpng r300 f3 AW3.png
97 print dpng r300 f4 AW4.png
98 print dpng r300 f5 AW5.png
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Topic #24
Basic setup:
di do
r e u y
Gc(s) G(s)
n
y = T (r n) + Sdo + SGdi
with
L = GGc, S = (I + L)1 T = L(I + L)1
Since
T (s) + S(s) = I s
cannot make both IS(j)I and IT (j)I small at the same frequen
cies fundamental design constraint
(A) High loop gain Good command following & dist rejection
(B) Low loop gain Attenuation of sensor noise.
Direct approach is to develop an upper bound for |S| and then test
if |S| is below this bound.
1
|S(j)| < ?
|Ws(j)|
s/M + B
Ws =
s + B A
Bounded Gain
1 MIMO result very similar, but need a dierent norm on the TFM of G(s)
" #
1 T
A 2
BB
H=
C T C AT
Eigenvalues of this matrix are symmetric about the real and imag
inary axis (related to the SRL)
AT X + XA + C T C + 2 XBB T X = 0
and A + 12 BB T X is stable.
Typical Application
Direct approach provides an upper bound for |S|, so must test if |S|
is below this bound.
1
|S(j)| < ?
|Ws(j)|
Pick simple forms for weighting functions (rst or second order), and
then cascade them as necessary. Basic one:
s/M + B
Ws(s) =
s + B A
Issues
Note that it is actually not easy to nd Gmax directly using the state
space techniques
It is easy to check if Gmax <
So we just keep changing to nd the smallest value for which
we can show that Gmax < (called min)
r u y y2
G(s) GT (s)
+
AT C T
A B
G(s) := and G(s) GT (s) :=
C 0 BT 0
Note that
u/r = S(s) = [1 GG]1
T
x 1 A BB x1 B
T= T + r
x 2 C C A x2 0
x1
u = 0 BT +r
x2
poles of S(s) are contained in the eigenvalues of the matrix H.
Can use state-space tools to test if a generic system has a gain less
that 1, and can easily re-do this analysis to include bound .
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.