30 views

Uploaded by Armando Malone

a full course of control engineering systems

- Analog and Digital Control System Design - Chen
- 5.Ruth
- Vibration and tip deflection control of a Single-link flexible manipulator [ Pdf ].pdf
- matlab
- Sensors and Actuators example questions
- Control Manual # 10-Fall 2015
- rr420201-digital-control-systems
- Disain via RL
- Analog and Digital Control System Design
- TAMU, MEEN 364, 2014, Exam
- Sylllabus
- LAB4 Report
- midterm 28.04.2014
- Control System Manual
- Introduction to Simulink
- Tugas 4 (Inverse Response Chapter 17)
- CS Course File
- Control Systems
- 16
- AN6_XCS_Freq_resp_plot.doc

You are on page 1of 442

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)

closed-loop dynamics.

Open-loop control also possible (called feedforward) more

prone to modeling errors since inputs not changed as a result of

measured error.

and the control law.

The sensors and actuators need not always be physical devices

(e.g., economic systems).

A good selection of the sensor and actuator can greatly simplify

the control design process.

Course concentrates on the design of control law given the rest of

the system (although we will need to model the system).

September 9, 2010

Fall 2010 16.30/31 13

(spacecraft, aircraft, rockets) and aerospace processes (propulsion)

need to be controlled just to function

Example: aircraft doing aggressive maneuvers dicult to y by

hand - dynamics are unstable and nonlinear (aerodynamic and

geometric)

lenge vehicle are nonlinear, unstable, constrained by limitations.

Car will not track desired path without feedback control.

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

Qualitative dont use too much fuel

Quantitative settling time of step response <3 sec

Typically requires that you understand the process (expected com

mands and disturbances) and the overall goals (bandwidths).

Often requires that you have a strong understanding of the phys

ical dynamics of the system so that you do not ght them in

inappropriate (i.e., inecient) ways.

What aspects of the system are to be sensed and controlled?

Consider sensor noise and linearity as key discriminators.

Cost, reliability, size, . . .

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)

Analysis, simulation, experimentation, . . .

September 9, 2010

Fall 2010 16.30/31 15

and a set of stability/performance requirements:

Given a controller, you can analyze the stability & expected per

formance

You have a reasonably good idea how to design a controller using

classical techniques (Bode and/or root locus)

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

is designer intensive (lots of simple but detailed calculations), and

typically very iterative

So our focus in this class is on state space methods for several reasons:

More systematic design tools exist - can be easily codied and

implemented numerically easy integrate optimization

Easily handle larger-scale systems (many modes) and many sensors

and actuators (MIMO).

September 9, 2010

Fall 2010 16.30/31 16

State-Space Approach

What are state-space models?

Why should we use them?

How are they related to the transfer functions used in classical

control design?

How do we develop a state-space model?

How do we design a controller using a state-space model?

Bottom line:

using n rst-order dierential equations:

mq + cq + kq = F

q 0 1 q 0

= + u

q k/m c/m q 1/m

x = Ax + Bu

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

models. We will explore this process in detail.

Full-state feedback ctitious since requires more information

than typically (ever?) available

Observer/estimator design process of estimating the system

state from the measurements that are available.

Dynamic output feedback combines these two parts with prov

able guarantees on stability (and performance).

Fortunately there are very simple numerical tools available to

perform each of these steps

control design design process more systematic.

algebra.

Will not focus on the theorems/proofs in class details will be

handed out as necessary, but these are in the textbooks.

Will focus on using the linear algebra to understand the behavior

of the system dynamics so that we can modify them using control.

Linear algebra in action

Even so, this will require more algebra that most math courses

that you have taken . . . .

September 9, 2010

Fall 2010 16.30/31 18

Signicant dierence from previous years is that we will spend more

time on the analysis of the system stability assuming various types of

basic nonlinearities

All systems are nonlinear to some extent

How well will the controller based on linear model assumptions

work on the full nonlinear system?

design a controller, and then analyze the performance on the original

nonlinear system.

Also interested in understanding how the addition of certain types

of nonlinearities (saturation, rate limits, stiction) might inuence

stability/performance.

models

Basic issues such as gain and timing errors

Parameter errors

Unmodeled dynamics

September 9, 2010

Fall 2010 16.30/31 19

Implementation Issues

analysis and design

I did at Stanford for many years and have a good set of notes on

the subject if you are interested

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

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #2

Basic control approaches

Fall 2010 16.30/31 22

x sp = Aspxsp + Bspe

where e is the elevator input, and

w Zw /m U0

xsp = , Asp = 1 1

q Iyy (Mw + Mw Zw /m) Iyy (Mq + Mw U0)

Ze /m

Bsp = 1

Iyy (Me + Mw Ze /m)

Add that = q, so s = q

(s) 1 q(s) 1

= = 0 1 (sI Asp)1Bsp

e(s) s e(s) s

(s) 1.1569s + 0.3435

= 2 Ge (s)

e(s) s(s + 0.7410s + 0.9272)

so that the dominant roots have a frequency of approximately 1

rad/sec and damping of about 0.4

PoleZero Map

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

1

1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 10 0.1

Real Axis

Fall 2010 16.30/31 23

show that pilots do not like the ying qualities of an aircraft with this

combination of frequency and damping

What is preferred?

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

back to the elevator command e.

Unfortunately the actuator is slow, so there is an apparent lag in

the response that we must model

ec 4 ea

Ge (s)

s+4

c

k

command created by our controller

4

= Ge (s)ea; ea = H(s)ec; H(s) =

s+4

The control is just basic proportional feedback

ec = k ( c)

= Ge (s)H(s)k ( c)

or that

(s) Ge (s)H(s)k

=

c(s) 1 + Ge (s)H(s)k

Need to be able to predict where the poles are going as a function

of k Root Locus

Fall 2010 16.30/31 25

r e u y

Gc(s) Gp(s)

npz

Np (s zpi)

Gp = Kp = Kp ni pp

Dp i (s ppi )

and the controller transfer function is

ncz

Nc (s zci)

Gc(s) = Kc = Kc nicp

Dc i (s pci )

Assume that npp > npz and ncp > ncz

2

Signals are:

u control commands

y output/measurements

r reference input

e response error

path without changing the pole locations.

Will discuss performance and add disturbances later, but for now just

focus on the pole locations

Fall 2010 16.30/31 26

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?

easy to show that

y Gc Gp

= Gcl (s)

r 1 + Gc Gp

where

Kc Kp N c N p

Gcl (s) =

DcDp + KcKpNcNp

is the closed loop transfer function

Denominator called characteristic equation c(s) and the roots

of c(s) = 0 are called the closed-loop poles (CLP).

The CLP are clearly functions of Kc for a given Kp, Np, Dp, Nc, Dc

a locus of roots [Evans, 1948]

Fall 2010 16.30/31 27

tools such as rlocus(num,den) to obtain full result, but we can get

some important insights by developing a short set of plotting rules.

Full rules in FPE, page 279 (4th edition).

Basic questions:

1. What points are on the root locus?

2. Where does the root locus start?

3. Where does the root locus end?

4. When/where is the locus on the real line?

5. Given that s0 is found to be on the locus, what gain is need for

that to become the closed-loop pole location?

6. What are the departure and arrival angles?

7. Where are the multiple points on the locus?

Dc are known, let

Nc Np

Ld = and K = KcKp

Dc Dp

c(s) = 1 + KLd(s) = 0

So values of s for which Ld(s) = 1/K, with K real are on the RL.

For K positive, s0 is on the root locus if

Ld(s0) = 180 l 360, l = 0, 1, . . .

If K negative, s0 is on the root locus if [0 locus]

Ld(s0) = 0 l 360, l = 0, 1, . . .

These are known as the phase conditions.

Fall 2010 16.30/31 28

Nc N p

c = 1 + K =0

DcDp

DcDp + KNcNp = 0

So if K 0, then locus starts at solutions of DcDp = 0 which are

the poles of the plant and compensator.

Already shown that for s0 to be on the locus, must have

1

Ld(s0) =

K

NcNp

Ld = =0

DcDp

1. Poles are located at values of s for which NcNp = 0, which are

the zeros of the plant and the compensator

As |s| , |Ld(s)| 0, but we must ensure that the phase

condition is still satised.

Fall 2010 16.30/31 29

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

Fall 2010 16.30/31 211

Locus points on the real line are to the left of an odd number

of real axis poles and zeros [K positive].

Follows from the phase condition and the fact that the phase

contribution of the complex poles/zeros cancels out

is needed for that to become the closed-loop pole location?

Need

1 Dp(s0)Dc(s0)

K =

|Ld(s0)| Np(s0)Nc(s0)

e.g., assume that Ld(s0) = 180, then need Kc and Kp to be

same sign so that K > 0

Fall 2010 16.30/31 212

Im

Re

Fig. 3: Basic

Im

Re

Im

Re

ics to modify root locus and then chose gain to place CLP at desired

location on the locus.

Fall 2010 16.30/31 213

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

lim e(t) = 0

t

Can determine this using the closed-loop transfer function and the

nal value theorem

lim e(t) = lim se(s)

t s0

y(s) Gc(s)Gp(s) y(s)

= = Gc(s)Gp(s)

r(s) 1 + Gc(s)Gp(s) e(s)

e(s) 1

=

r(s) 1 + Gc(s)Gp(s)

so in the case of a step input, we have

r(s) 1/s

e(s) = =

1 + Gc(s)Gp(s) 1 + Gc(s)Gp(s)

1/s 1

lim se(s) = lim s = e()

s0 s0 1 + Gc (s)Gp (s) 1 + Gc(0)Gp(0)

1

ess =

1 + Gc(0)Gp(0)

To make the error small, we need to make one (or both) of Gc(0),

Gp(0) very large

Fall 2010 16.30/31 215

1

sn (s+)m with n 1, then

s0

ramp, parabola) with systems that have a dierent number of free

integrators (type), but the summary is this:

1

type 0

1 + Kp

1

type 1 0

Kv

1

type 2 0 0

Ka

where

Kp = lim Gc(s)Gp(s) P

osition Error Constant

s0

s0

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

Same case we have been looking at.

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

(a > 0, b > 0) to a step,

r(t) = 1(t) r(s) = 1/s

where

e 1 r(s)

= = S(s) e(s) =

r 1 + Gc G p (1 + GcGp)

where S(s) is the Sensitivity Transfer Function for the

closed-loop system

so that with proportional control,

s 1 1

lim ess = lim = K

t s0 s 1 + Kg Gp (s) 1 + ab

g

so can make ess small, but only with a very large Kg

the expense of the transient response

Typically gets worse because the system is less well damped

Fall 2010 16.30/31 218

(s + a)(s + b)

improve the steady state response.

Im

Re

towards the imaginary axis more oscillatory response.

K2 K1 s + K 2

Gc = K1 + =

s s

which introduces a pole at the origin and zero at s = K2/K1

PI solves many of the problems with just integral control

Im

Re

Does not help with the steady state

Provides feedback on the rate of change of e(t) so that the

control can anticipate future errors.

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.

proportional-derivative feedback PD

Gc(s) = K1 + K2s

which moves the zero from the origin.

ation of a measured signal is typically a bad idea

Typically use band-limited dierentiation instead, by rolling-o the

PD control with a high-frequency pole (or two).

Fall 2010 16.30/31 220

Controller Synthesis

Will proportional feedback do the job?

What types of dynamics need to be added? Use main building block

(s + z)

GB (s) = Kc

(s + p)

If pick z > p, with p small, then

Im

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

loop poles to be at 1 2j

Will proportional control be sucient? no

So use compensator with 1 pole.

(s + z)

Gc = K

(s + p)

So there are 3 CLP.

To determine how to pick the p, z, and k, we must use the phase

and magnitude conditions of the RL

To proceed, evaluate the phase of the loop

s+z

Ld(s) =

(s + p)s2

at s0 = 1 + 2j. Since we want s0 to be on the new locus, we know

that Ld(s0) = 180 360l

Im

(-1,2j)

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

the negative real line, and then assume that p = z, where typically

5 10 is a good ratio.

2(117) + = 180

2 2

arctan arctan = 53

z1 10z 1

but recall that

tan(A) tan(B)

tan(A B) =

1 + tan(A) tan(B)

so

( z2 1 ) ( 10z21 )

= 1.33

1 + ( z2 1 )( 10z21 )

which give z = 2.2253, p = 22.2531, kc = 45.5062

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.

d(s) = (s2 + 2s + 5)(s + ) = 0

c(s) = 1 + GpGc = 0

s2(s + p) + K(s + z) = 0

s3 + s2p + Ks + Kz = 0

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.

c(s) = s2 + 10zs2 + Ks + Kz = 0

= s3 + s2( + 2) + s(2 + 5) + 5 = 0

gives

s2 + 2=10z

s 2 + 5=K

s0 5=zK

solve for , z, K

25 5z

; = K=

5 2z 5 2z

z = 2.23, = 20.25, K = 45.5

3 Errata: changed the rule of the pole zero ratio.

Fall 2010 16.30/31 224

1 %

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

and analyzing controllers

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #3

Analysis

Synthesis

Performance

Stability in the Frequency Domain

Nyquist Stability Theorem

Fall 2010 16.30/31 32

FR: Introduction

Advantages:

Good indicator of transient response;

Explicitly shows location of all closed-loop poles;

Trade-os in the design are fairly clear.

Disadvantages:

Requires a transfer function model (poles and zeros);

Dicult to infer all performance metrics;

Hard to determine response to steady-state (sinusoids)

Hard to infer stability margins

techniques:

Can infer performance and stability from the same plot

Can use measured data rather than a transfer function model

Design process can be independent of the system order

Time delays are handled correctly

Graphical techniques (analysis and synthesis) are quite simple.

Fall 2010 16.30/31 33

[0, ) the frequency response function (FRF)

G(j) = |G(j)|G(j)

The FRF can be used to nd the steady-state response of a

system to a sinusoidal input since, if

e(t) y(t)

G(s)

steady-state output is

y(t) = 0.3 sin(2t 80)

The FRF clearly shows the magnitude (and phase) of the re

sponse of a system to sinusoidal input

1. Polar (Nyquist) plot Re vs. Im of G(j) in complex plane.

Hard to visualize, not useful for synthesis, but gives denitive

tests for stability and is the basis of the robustness analysis.

2. Nichols Plot |G(j)| vs. G(j), which is very handy for sys

tems with lightly damped poles.

Simplest tool for visualization and synthesis

Typically plot 20log |G| which is given the symbol dB

Fall 2010 16.30/31 34

(s + 1)(s + 2)

log |G(s)| =

(s + 3)(s + 4)

and each of these factors can be calculated separately and then added

to get the total FRF.

(s + 1)(s + 2)

= (s + 1) + (s + 2)

(s + 3)(s + 4)

(s + 3) (s + 4)

approximations exist and can be used to obtain a good prediction of

the system response.

Fall 2010 16.30/31 35

Bode Example

s+1

G(s) =

s/10 + 1

|j + 1|

|G(j)| =

|j/10 + 1|

Approximation

0 i

log[1 + (/i)2]1/2

log[/i] i

are very easy to work with.

Fall 2010 16.30/31 36

Arrange representation of transfer function so that DC gain of

each element is unity (except for parts that have poles or zeros at

the origin) absorb the gain into the overall plant gain.

Draw all component sketches

Start at low frequency (DC) with the component that has the

lowest frequency pole or zero (i.e. s=0)

Use this component to draw the sketch up to the frequency of the

next pole/zero.

Change the slope of the sketch at this point to account for the

new dynamics: -1 for pole, +1 for zero, -2 for double poles, . . .

Scale by overall DC gain

Fall 2010 16.30/31 37

plot for complete system in a similar fashion

Know that (1 + j/i) = tan1(/i)

Can use straightline approximations

0 /i 0.1

(1 + j/i) 90 /i 10

45 /i = 1

Fall 2010 16.30/31 38

Then add them up starting from zero frequency and changing the

slope as

Fall 2010 16.30/31 39

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

1 + 0j

Fall 2010 16.30/31 310

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

Fall 2010 16.30/31 311

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

Fall 2010 16.30/31 312

plot of L(j) in the complex plane passes through the critical point

s = 1

-1

GcG(j)

statements are only valid if we assume that:

Increasing gain leads to instability

|L(j)| = 1 at only 1 frequency

which are reasonable assumptions, but not always valid.

plicated, and it can be hard to do in a Bode diagram need more

precise test.

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)

Fall 2010 16.30/31 313

Nyquist Stability

phase by a vector (tail at s0) as the tip traverses the contour c c

encircles s0

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.

path C2

Fall 2010 16.30/31 314

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?

P = # poles of L(s) = G(s)Gc(s) in the RHP

Z = # closed-loop poles in the RHP

N = # clockwise encirclements of the Nyquist Diagram about the

critical point -1.

Can show that Z = N + P

So for the closed-loop system to be stable (i.e., no closed-loop

poles in the RHP), need

Z0 N = P

Note that since P 0, then would expect CCW encirclements

Fall 2010 16.30/31 315

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

diagram, then always revert to the Nyquist plot.

Fall 2010 16.30/31 316

FR: Summary

Will see that control design is relatively straight forward as well

Can be a bit complicated to determine stability, but this is a relatively

minor problem and it is easily handled using Nyquist plots

Usually only necessary to do one of Bode/Root Locus analysis, but

they do provide dierent perspectives, so I tend to look at both in

sisotool.

Corresponds to a test on the number of encirclements of the critical

point

For most systems that can be interpreted as needing the GM > 0

and P M > 0

Typically design to GM 6dB and P M 30 60

Introduced S(s) as a basic measure of system robustness.

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

consider both the magnitude and phase plots of the loop, but that is

not the case.

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

(locally):

s0 slope of 0, so no crossover possible

s1 slope of -1, so about 90 PM

s2 slope of -2, so PM very small

Fall 2010 16.30/31 43

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.

Fall 2010 16.30/31 44

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

2 sin(P M/2) , near

2 1 2

r = n 1 2 2

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

Fall 2010 16.30/31 45

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')%

a 2nd order dominant response:

1 + 1.1 + 1.4 2

10-90% rise time tr = n

Settling time (5%) ts = 3

n

Time to peak amplitude tp =

n 1 2

Peak overshoot M = entp

p

Fall 2010 16.30/31 46

s+z

Gc(s) = Kc

s+p

Question: how choose Gc(s) to modify the LTF L(s) = Gc(s)Gp(s)

to get the desired bandwidth, phase margin, and error constants?

Lead Controller (|z| < |p|)

Zero at a lower frequency than the pole

Gain increases with frequency (slope +1)

Phase positive (i.e. this adds phase lead)

dB

0

20 log |p/z|

20

0

0

Phase

-90o

0o

z p

Fall 2010 16.30/31 47

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/

of phase ( small) and the tendency to generate large gains at high

frequency

So try to keep 1/ 10, which means |p| 10|z| and

max 60

(s + z1) (s + z2)

Gc(s) = kc

(s + p1) (s + p2)

One approach is to force the desired crossover frequency so that

|L(jc)| = 1

sponse.

Fall 2010 16.30/31 48

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

o uncompensated compensated

-180

at a particular desired c

1. Find the max required

Note that required = P M (180 + G(jc))

2. Put max at the crossover frequency, so that

c2 = |p| |z|

3. Select Kc so that crossover is at c

Fall 2010 16.30/31 49

Design Example

1

Design a compensator for the system G(s) = s(s+1)

Note that at 10rad/sec, the slope of |G| is -2, corresponding to a

plant phase of approximately 180

So need to add a lead compensator adds a slope of +1 (locally),

changing the LTF slope to -1, and thus increasing the phase margin

|.| -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

Fall 2010 16.30/31 410

Code: Lead Example

1 %

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

Fall 2010 16.30/31 411

Lag Mechanics

Gain decreases at high frequency typically scale lag up so that

HF gain is 1, and thus the low frequency gain is higher.

Add negative phase (i.e., adds lag)

dB

0 p z

0

-20

0

20 log |p/z|

Phase m

o

0

o

-90

Image by MIT OpenCourseWare.

s/p+1

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

LTF to reduce the tracking error.

Two ways to get desired low frequency gain:

Using just a gain increase, which increases c and decrease P M

Add Lag dynamics that increase increase the gain at low frequency

and leave the gain near and above c unchanged

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

Fall 2010 16.30/31 413

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

Fall 2010 16.30/31 414

Code: Lag Example

1 %

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

Fall 2010 16.30/31 415

Summary

the steps involved.

Typically nd that this process is highly iterative because the nal

performance doesnt match the specications (second order assump

tions)

Practice is the only way to absorb these approaches.

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

system as a rst order dierential equation in an N -vector, which is

called the state.

Convert the N th order dierential equation that governs the dy

namics into N rst-order dierential equations

mp + cp + kp = F

Let x1 = p, then x2 = p = x 1, and

x 2 = p = (F cp kp)/m

= (F cx2 kx1)/m

p 0 1 p 0

= + u

p k/m c/m p 1/m

Let u = F and introduce the state

x1 p

x= = x = Ax + Bu

x2 p

If the measured output of the system is the position, then we have

that

p x1

y=p= 1 0 = 1 0 = Cx

p x2

Fall 2010 16.30/31 53

x (t) = A(t)x(t) + B(t)u(t)

y(t) = C(t)x(t) + D(t)u(t)

where:

t R denotes time

x(t) Rn is the state (vector)

u(t) Rm is the input or control

y(t) Rp is the output

B(t) Rnm is the input matrix

C(t) Rpn is the output or sensor matrix

D(t) Rpm is the feedthrough matrix

Also note that this is a multi-input / multi-output (MIMO) system.

Linear Time-Invariant (LTI) state dynamics

x (t) = Ax(t) + Bu(t)

y(t) = Cx(t) + Du(t)

so that now A, B, C, D are constant and do not depend on t.

Fall 2010 16.30/31 54

Basic Denitions

with respect to its inputs and output

u(t) G(s) y(t)

i superposition holds:

G(1u1 + 2u2) = 1Gu1 + 2Gu2

So if y1 is the response of G to u1 (y1 = Gu1), and y2 is the

response of G to u2 (y2 = Gu2), then the response to 1u1 + 2u2

is 1y1 + 2y2

input and output is independent of time. So if the response to u(t)

is y(t), then the response to u(t t0) is y(t t0)

x (t) = 3x(t) + u(t)

y(t) = x(t)

is LTI, but

x (t) = 3t x(t) + u(t)

y(t) = x(t)

is not.

A matrix of second system is a function of absolute time, so re

sponse to u(t) will dier from response to u(t 1).

Fall 2010 16.30/31 55

Future output depends only on current state and future input

Future output depends on past input only through current state

State summarizes eect of past inputs on future output like the

memory of the system

charge of the battery. If you know that state, then you do not need

to know how that level of charge was achieved (assuming a perfect

battery) to predict the future performance of the ashlight.

But to consider all nonlinear eects, you might also need to know

how many cycles the battery has gone through

Key point is that you might expect a given linear model to ac

curately model the charge depletion behavior for a given number

of cycles, but that model would typically change with the number

cycles

Fall 2010 16.30/31 56

the dynamics

This was the case done before.

Only issue is which set of states to use there are many choices.

Much more on this later

models, and almost all systems are nonlinear in real-life.

Can develop linear models from nonlinear system dynamics

Fall 2010 16.30/31 57

Equilibrium Points

x = f (x, u)

where x is once gain the state vector, u is the vector of inputs, and

f (, ) is a nonlinear vector function that describes the dynamics

First step is to dene the point about which the linearization will be

performed.

Typically about equilibrium points a point for which if the

system starts there it will remain there for all future time.

x = f (x, u) = 0

Result is an algebraic set of equations that must be solved for both

xe and ue

Note that x e = 0 and u e = 0 by denition

Typically think of these nominal conditions xe, ue as set points

or operating points for the nonlinear system.

in state space form as

x 1 x2

=

x 2 rx2 gl sin x1

Setting f (x, u) = 0 yields x2 = 0 and x2 = rlg sin x1, which

implies that x1 = = {0, }

Fall 2010 16.30/31 58

Linearization

state solution xe (possibly requires a nominal input ue)

Then write the actual state as x(t) = xe + x(t)

about the nominal to be small

Can then develop the linearized equations by using the Taylor series

expansion of f (, ) about xe and ue.

x i = fi(x, u)

can be expanded as

d

(xei + xi) = fi(xe + x, ue + u)

dt

fi

fi

fi(xe, ue) +

x +

u

x

0 u 0

where

fi fi fi

=

x x1

xn

values of xe and ue.

and u must be small enough that we can ignore the higher order

terms in the Taylor expansion of f (x, u).

Fall 2010 16.30/31 59

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

Fall 2010 16.30/31 510

y(t) = ye + y, then

g1

g1

.

0

.

0

.

y

=

. x +

.

. u

gp

gp

x

0

u 0

= C(t)x + D(t)u

notation) we write the state equations as:

x (t) = A(t)x(t) + B(t)u(t)

y(t) = C(t)x(t) + D(t)u(t)

which is of the same form as the previous linear models

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.

Fall 2010 16.30/31 511

condition xs(t0).

Solution is stable if other solutions xb(t0) that start near xs(t0)

stay close to xs(t) t stable in sense of Lyapunov (SSL).

If other solutions are SSL, but the xb(t) do not converge to xs(t)

solution is neutrally stable.

If other solutions are SSL and xb(t) x(t) as t solution

is asymptotically stable.

A solution xs(t) is unstable if it is not stable.

point at xe = 0

This equilibrium point is stable if and only if all of the eigenvalues

of A satisfy Ri(A) 0 and every eigenvalue with Ri(A) = 0

has a Jordan block of order one.1

Thus the stability test for a linear system is the familiar one of

determining if Ri(A) 0

inal nonlinear from the analysis of the linearized system model

1 more on Jordan blocks on 6??, but this basically means that these eigenvalues are not repeated.

Fall 2010 16.30/31 512

for the nonlinear autonomous system

x (t) = f (x(t))

where f is continuously dierentiable in a neighborhood of xe. As

sume

f

A =

x

xe

Then:

The origin is an asymptotically stable equilibrium point for the

nonlinear system if Ri(A) < 0 i

The origin is unstable if Ri(A) > 0 for any i

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.

Fall 2010 16.30/31 513

Linearization Example

(rate k) we have the dynamics

mx = kx

but with a leaf spring as is used on car suspensions, we have a

nonlinear spring the more it deects, the stier it gets. Good model

now is

mx = k1x k2x3

which is a cubic spring.

the end)

Fall 2010 16.30/31 514

y = k1y k2y 3

gives us the nonlinear model (x1 = y and x2 = y)

d y y

= x = f (x)

dt y k1y k2y 3

Find the equilibrium points and then make a state space model

y

f (x) = =0

k1y k2y 3

which gives

y e = 0 and k1ye + k2(ye)3 = 0

Second condition corresponds to ye = 0 or ye = k1/k2,

which is only real if k1 and k2 are opposite signs.

f1 f1

x1 x2 0 1

A= f2 f2 =

k1 3k2(y)2 0 0

x1 x2 0

0 1

=

k1 3k2(ye)2 0

and the linearized model is x = Ax

September 21, 2010

Fall 2010 16.30/31 515

0 1

A0 =

k1 0

which are the standard dynamics of a system with just a linear spring

of stiness k1

Stable motion about y = 0 if k1 > 0

point at y = 0, y = 2, and since k1 + k2(ye)2 = 0 then

0 1

A1 =

2 0

which are the dynamics of a stable oscillator about the equilibrium

point

Fig. 3: Nonlinear response (k1 = 1, k2 = 0.5). The gure on the right shows the

oscillation about the equilibrium point.

Fall 2010 16.30/31 516

Code: Nonlinear System Sim

1 function test=nlplant(ft);

2 global k1 k2

3 x0 = [1 2]/10;

4

5 k1=1;k2=0;

6 [T,x]=ode23('plant', [0 20], x0); % linear

7

8 k2=2;

9 [T1,x1]=ode23('plant', [0 20], x0); %nonlinear

10

11 figure(1);clf;

12 subplot(211)

13 plot(T,x(:,1),T1,x1(:,1),'');

14 legend('Linear','Nonlinear')

15 ylabel('X','FontSize',ft)

16 xlabel('Time','FontSize',ft)

17 subplot(212)

18 plot(T,x(:,2),T1,x1(:,2),'');

19 legend('Linear','Nonlinear')

20 ylabel('V','FontSize',ft)

21 xlabel('Time','FontSize',ft)

22 text(4,0.3,['k 2=',num2str(k2)],'FontSize',ft)

23 return

24

25 % use the following to cll the function above

26 close all

27 set(0, 'DefaultAxesFontSize', 12, 'DefaultAxesFontWeight','demi')

28 set(0, 'DefaultTextFontSize', 12, 'DefaultTextFontWeight','demi')

29 set(0,'DefaultAxesFontName','arial')

30 set(0,'DefaultAxesFontSize',12)

31 set(0,'DefaultTextFontName','arial')

32 set(gcf,'DefaultLineLineWidth',2);

33 set(gcf,'DefaultlineMarkerSize',10)

34 global k1 k2

35 nlplant(14)

36 print f1 dpng r300 nlplant.png

37 k1=1;k2=0.5;

38 % call plant.m

39 x0 = [sqrt(k1/k2) .25];

40 [T,x]=ode23('plant', [0:.001:32], x0);

41 figure(1);subplot(211);plot(T,x(:,1));ylabel('y');xlabel('Time');grid

42 subplot(212);plot(T,x(:,2));ylabel('dy/dt');xlabel('Time');grid

43 figure(2);plot(x(:,1),x(:,2));grid

44 hold on;plot(x0(1),0,'rx','MarkerSize',20);hold off;

45 xlabel('y');ylabel('dy/dt')

46 axis([1.2 1.7 .25 .25]);axis('square')

47

48 print f1 dpng r300 nlplant2.png

49 print f2 dpng r300 nlplant3.png

2 % plant.m

3 global k1 k2

4 xdot(1) = x(2);

5 xdot(2) = k1*x(1)k2*(x(1))3;

6 xdot = xdot';

Fall 2010 16.30/31 5A1

I

F = mvcI and T = H

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

but value of Ixz depends on specic body frame selected.

Instantaneous mapping of angular momentum

= Hxi + Hyj + Hzk

H

into the body frame given by

Hx Ixx 0 Ixz P

HB = Hy = 0 Iyy 0 Q

Hz Ixz 0 Izz R

Fall 2010 16.30/31 5A2

1

F = vcB + BI vc

m

X U 0 R Q U

1

Y = V + R 0 P V

m

Z W Q P 0 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

Izz R + Ixz P +P Q(Iyy Ixx) QRIxz

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.

Fall 2010 16.30/31 5A3

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

=0

P Uo

BI o o

B = Q (vc)B = 0

R 0

which are associated with the ight condition. In fact, these dene

the type of equilibrium motion that we linearize about. Note:

W0 = 0 since we are using the stability axes, and

V0 = 0 because we are assuming symmetric ight

Fall 2010 16.30/31 5A4

Nominal Perturbed Perturbed

Velocity Velocity Acceleration

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, = =

Fall 2010 16.30/31 5A5

U = U0 + u, V0 = W0 = 0, P0 = Q0 = R0 = 0.

1

[X0 + X] = U + QW RV u + qw rv u

m

1

[Y0 + Y ] = V + RU P W

m

v + r(U0 + u) pw v + rU0

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

Fall 2010 16.30/31 5A6

vehicle dynamics, we must investigate terms X . . . N .

We must also address the left-hand side (F , T )

Net forces and moments must be zero in equilibrium condition.

Aerodynamic and Gravity forces are a function of equilibrium con

dition AND the perturbations about this equilibrium.

rst order expansion in the key ight parameters

X X X X X g

X = U + W + W + + . . . + + X c

U W W

g

X X X X X

= u+ w+ w + + ... + + X c

U W W

X

U called stability derivative evaluated at eq. condition.

Clearly approximation since ignores lags in aerodynamics forces (as

sumes that forces only function of instantaneous values)

Fall 2010 16.30/31 5A7

Stability Derivatives

to analyze the aircraft ight mechanics well supported by numerous

ight test comparisons.

The forces and torques acting on the aircraft are very complex nonlin

ear functions of the ight equilibrium condition and the perturbations

from equilibrium.

Linearized expansion can involve many terms u, u,

u,

. . . , w, w,

w,

...

Symm. variables: U , W , Q & forces/torques: X, Z, and M

zero for any value of U , W , Q

Derivatives of asymmetric forces/torques with respect to the sym

metric motion variables are zero.

1. Derivatives of symmetric forces/torques with respect to the asym

metric motion variables are small and can be neglected.

motion variables, but keep Z/ w and Mw M/ w (aero

dynamic lag involved in forming new pressure distribution on the

wing in response to the perturbed angle of attack)

Fall 2010 16.30/31 5A8

()/() 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

Fall 2010 16.30/31 5A9

equations 1, 3, 5 decouple from 2, 4, 6

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

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

Outline

2 Causality

3 Time Invariance

4 State-space models

5 Linear Systems

Continuous- and discrete-time signals

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

Signals are vectors

Multiplication by a scalar

Let R. The signal y can be obtained as:

and 0[k] = 0 for all k Z, and 1y = y .

Let u and v be two signals of the same kind (i.e., both in continuous

or discrete time).

The signal u + v is dened as:

(MIT) Topic 5 addendum: Signals, Systems Fall 2010 4 / 27

Systems

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

A classication

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

Static/Memoryless systems

A system is said to be memoryless (or static) if, for any t0 R (resp.

k0 Z), the output at time t0 (resp. at time k0 ) depends only on the

input at time t0 (resp. at step k0 ).

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.

Causality

A system G is said to be causal if, for any t0 R (resp., k0 Z) the

output at time t0 (resp. at step k0 ) depends only on the input up to, and

including, time t0 (resp. up to, and including, step k0 ).

A system is said to be strictly causal if the dependency is only on the input

preceding t0 (resp., k0 ).

that will be applied in the future, but only on past and present inputs.

(Strictly causal systems only depend on past inputs).

Note that a static system is causal, but not strictly causal.

Some remarks on causality

However, there are some cases in which non-causal systems can actually

be interesting to study:

For example, in a nap-of-the-Earth ying mission, the path to the

next waypoint, and the altitude prole, may be known in advance.

Commands may belong to a pre-dened class.

For example, an autopilot that is programmed to execute an acrobatic

maneuver (e.g., a loop).

O-line processing.

For example, a system that is used as a lter to smooth a certain

signal, or possibly to rip a song from a CD to an MP3 le.

Outline

2 Causality

3 Time Invariance

4 State-space models

5 Linear Systems

Time delays

A time-delay system, or more simply a time delay, is a system ST such that

y [k] = ST (u[k]) = u[k T ] in discrete time;

u u

ST

T

t t

Time invariance

A system is time invariant if it commutes with time delays. In other words,

the output to a time-delayed input is the same as the time-delayed output

to the original input.

u(t) y (t) y (t T )

TI System Time delay

u(t) u(t T ) y (t T )

Time delay TI System

where you put the origin on the time axis (but it depends on the direction

in which time ows).

(MIT) Topic 5 addendum: Signals, Systems Fall 2010 13 / 27

Outline

2 Causality

3 Time Invariance

4 State-space models

5 Linear Systems

State of a system

We know that, if a system is causal, in order to compute its output at a

given time t0 , we need to know only the input signal over (, t0 ].

(Similarly for DT systems.)

This is a lot of information. Can we summarize it with something more

manageable?

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.

We dene the dimension of a causal system as the minimal number of

variables sucient to describe the systems state (i.e., the dimension of

the smallest state vector).

can be described with a nite number of variables.

Some remarks on innite-dimensional systems

some examples are very useful:

(CT) Time-delay systems: Consider the very simple time delay ST ,

dened as a continuous-time system such that its input and outputs

are related by

y (t) = u(t T ).

In order to predict the output at times after t, the knowledge of the

input for times in (t T , t] is necessary.

PDE-driven systems: Many systems in aerospace, arising, e.g., in

structural control and ow control applications, can only be described

exactly using a continuum of state variables (stress, displacement,

pressure, temperature, etc.). These are innite-dimensional systems.

In order to deal with innite-dimensional systems, approximate discrete

models are often used to reduce the dimension of the state.

Outline

2 Causality

3 Time Invariance

4 State-space models

5 Linear Systems

Linear Systems

A system is said a Linear System if, for any two inputs u1 and u2 , and any

two real numbers , , the following are satised:

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);

y [k] = C [k]x[k] + D[k]u[k];

time, and have the correct dimensions to make the equations meaningful.

LTI State-space model

If the system is Linear Time-Invariant (LTI), the equations simplify to:

d

x(t) = Ax(t) + Bu(t);

dt

y (t) = Cx(t) + Du(t);

y [k] = Cx[k] + Du[k];

dimension of the state vector.

Example of DT system: accumulator

k1

y [k] = u[i].

i=

k2

y [k] = u[i] + u[k 1] = y [k 1] + u[k 1].

i=

In other words, we can set x[k] = y [k] as a state, and get the following state-space model:

y [k] = x[k].

x[2] = x[1] + u[1] = 1 + 1 = 2, y [2] = x[2] = 2;

...

x[k] = x[k 1] + u[k 1] = k 1 + 1 = k, y [k] = x[k] = k;

LTI State-space models in Matlab

>> A= [1, 0.1; 0, 1]; B= [1; 2]; C = [3, 4]; D=0;

>> P = ss(A,B,C,D)

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.

LTI State-space models in Matlab

>> A= [1, 0.1; 0, 1]; B= [1; 2]; C = [3, 4]; D=0; Ts = 0.2;

>> P = ss(A,B,C,D,Ts)

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

Discrete-time model.

Finite-dimensional Linear Systems 1/2

if the linear combination of two inputs generates an output that is the

linear combination of the outputs generated by the two individual

inputs.

The denition of a state allows us to summarize the past inputs into

the state, i.e.,

x(t0 ),

u(t), t +

u(t), t t0 ,

notion.

Finite-dimensional Linear Systems 2/2

A system is said a Linear System if, for any u1 , u2 , t0 , x0,1 , x0,2 , and any

two real numbers , , the following are satised:

x(t0 ) = x0,1 ,

y1 ,

u(t) = u1 (t), t t0 ,

x(t0 ) = x0,2 ,

y2 ,

u(t) = u2 (t), t t0 ,

x(t0 ) = x0,1 + x0,2 ,

y1 + y2 .

u(t) = u1 (t) + u2 (t), t t0 ,

Forced response and initial-conditions response

Assume we want to study the output of a system starting at time t0 , knowing the

initial state x(t0 ) = x0 , and the present and future input u(t), t t0 . Let us study

the following two cases instead:

Initial-conditions response:

xIC (t0 ) = x0 ,

yIC ;

uIC (t) = 0, t t0 ,

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.

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

for a system G(s).

There are many, many ways to do this.

1. Simple numerator (strictly proper)

y 1

= G(s) = 3

u s + a 1 s2 + a 2 s + a 3

y b1s2 + b2s + b3 N (s)

= G(s) = 3 =

u s + a1s2 + a2s + a3 D(s)

y b0s3 + b1s2 + b2s + b3

= G(s) = 3

u s + a 1 s2 + a 2 s + a 3

Fall 2010 16.30/31 63

to nth follows easily)

y 1

= G(s) = 3

u s + a 1 s2 + a 2 s + a 3

can be rewritten as the dierential equation

...

y + a1y + a2y + a3y = u

choose the output y and its derivatives as the state vector

y

x = y

y

then the state equations are

...

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.

Fall 2010 16.30/31 64

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)

...

v + a1v + a2v + a3v = u

use the state vector

v

x = v

v

to get

x = A2x + B2u

where

a1 a2 a3 1

A2 = 1 0 0 and B2 = 0

0 1 0 0

y = b1v + b2v + b3v

v

= b1 b2 b3 v

v

= C2x + [0]u

Fall 2010 16.30/31 65

y b0s3 + b1s2 + b2s + b3

= G(s) = 3

u s + a 1 s2 + a 2 s + a 3

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 )

so that, given the bi, we can easily nd the i

D = b0

1 = b1 Da1

...

Can make state-space model for G1(s) as in case 2

from the model for G1(s)

because we are free to pick the x as we want

Fall 2010 16.30/31 66

Modal Form

It is a diagonal representation of the state-space model.

Assume for now that the transfer function has distinct real poles pi

(easily extends to case with complex poles, see 7??)

N (s) N (s)

G(s) = =

D(s) (s p1)(s p2) (s pn)

r1 r2 rn

= + + +

s p1 s p2 s pn

Now dene collection of rst order systems, each with state xi

X1 r1

= x 1 = p1x1 + r1u

U (s) s p1

X2 r2

= x 2 = p2x2 + r2u

U (s) s p2

...

Xn rn

= x n = pnxn + rnu

U (s) s pn

Which can be written as

x (t) = Ax(t) + Bu(t)

y(t) = Cx(t) + Du(t)

with

T

p1 r1 1

A= ... B = .

.. C = ...

pn rn 1

Good representation to use for numerical robustness reasons.

Avoids some of the large coecients in the other 4 canonical forms.

Fall 2010 16.30/31 67

x (t) = Ax(t) + Bu(t)

y(t) = Cx(t) + Du(t)

what is the corresponding transfer function?

L{x (t) = Ax(t) + Bu(t)}

sX(s) x(0) = AX(s) + BU (s)

Y (s) = CX(s) + DU (s)

which gives

(sI A)X(s) = BU (s) + x(0)

X(s) = (sI A)1BU (s) + (sI A)1x(0)

and

Y (s) = C(sI A) B + D U (s) + C(sI A)1x(0)

1

Function of the system.

It is part of the response, but not part of the transfer function.

Fall 2010 16.30/31 68

SS to TF

x (t) = Ax(t) + Bu(t)

y(t) = Cx(t) + Du(t)

to the transfer function G(s) = C(sI A)1B + D need to form

inverse of matrix (sI A)

A symbolic inverse not very easy.

1

a1 a2 1 a4 a2

=

a3 a4 a1a4 a2a3 a3 a1

For larger problems, we can also use Cramers Rule

sI A B

det

C D

G(s) = C(sI A)1B + D =

det(sI A)

Reason for this will become more apparent later (see 8??) when

we talk about how to compute the zeros of a state-space model

(which are the roots of the numerator)

(s) = det(sI A) = 0

It is the roots of (s) = 0 that determine the poles of the system.

Will show that these determine the time response of the system.

1 see here

Fall 2010 16.30/31 69

a1 a2 a3

1

T

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.

Fall 2010 16.30/31 610

State-Space Transformations

freedom in choosing the state vector.

Selection of the state is quite arbitrary, and not that important.

In fact, given one model, we can transform it to another model that

is equivalent in terms of its input-output properties.

To see this, dene Model 1 of G(s) as

x (t) = Ax(t) + Bu(t)

y(t) = Cx(t) + Du(t)

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

z = Az + B u

+ Du

y = 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

G1(s) = C(sI A)1B + D

G2(s) = C (sI A)1B + D

G1(s) = C(sI A)1B + D

= C(T T 1)(sI A)1(T T 1)B + D

= (CT ) T 1(sI A)1T (T 1B) + D

1

= (C ) T 1(sI A)T (B ) + D

= C (sI A)1B + D

= G2(s)

model through a similarity transformation.

b1 s2 + b 2 s + b 3

G(s) = 3

s + a 1 s2 + a 2 s + a 3

we have 6 parameters to choose

But in the related state-space model, we have A 3 3, B 3 1,

C 1 3 for a total of 15 parameters.

Is there a contradiction here because we have more degrees of freedom

in the state-space model?

No. In choosing a representation of the model, we are eectively

choosing a T , which is also 3 3, and thus has the remaining 9

degrees of freedom in the state-space model.

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

Note that e(A+B)t = eAteBt i AB = BA

Fall 2010 16.30/31 72

0 1

A =

2 3

1

1 s 1

(sI A) =

2 s+3

s+3 1 1

=

2 s (s + 2)(s + 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

Fall 2010 16.30/31 73

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

x = Ax + Bu

where x is an n-vector and u is a m-vector

t

x(t) = eAtx(0) + eA(t )Bu( )d

0

and if y = Cx + Du, then

t

At

y(t) = Ce x(0) + CeA(t )Bu( )d + Du(t)

0

CeA(t)B is the impulse response of the system.

Fall 2010 16.30/31 74

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

we can show that

1

eAt = I + At + (At)2 + . . .

2!

1

= I + T T 1t + (T T 1t)2 + . . .

2!

t 1

= T e T

and ?

Eigenvalues and Eigenvectors

Fall 2010 16.30/31 75

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

n eigenvectors are linearly independent

Avi = ivi i = 1, . . . , n

1 .

..

A v1 vn = v1 vn

n

AT = T T 1AT =

Fall 2010 16.30/31 76

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 .

tn1

1 t t2 /2!

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

Fall 2010 16.30/31 77

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

1

v1 =

2

4 1

v12

(s2IA)v2 = =0 4v12v22 = 0, v22 = 4v12

8 2 v22

1

v2 =

4

Conrm that Avi = ivi

Fall 2010 16.30/31 78

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

x(t) = eAtx(0) = T etT 1x(0)

n

= eitvi{wiT x(0)}

i=1

n

= eitvii

i=1

vi Determines how each state contributes to that mode

i Determines extent to which initial condition excites the mode

Fall 2010 16.30/31 79

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

locations for the system, thus:

They determine the stability and/or performance & transient be

havior of the system.

control work

Fall 2010 16.30/31 710

little more complicated.

Consider a 2x2 case with A having eigenvalues a bi and associated

eigenvectors e1, e2, with e2 = e1. Then

a + bi 0 1

A = e1 e2 e1 e2

0 a bi

a + bi 0 1

T DT 1

= e1 e1 e1 e1

0 a bi

1 i 1 1

M = 0.5 M 1 =

1 i i i

Then it follows that

A = T DT 1 = (T M )(M 1DM )(M 1T 1)

= (T M )(M 1DM )(T M )1

which has the nice structure:

a b 1

A = Re(e1) Im(e1) Re(e1) Im(e1)

b a

where all the matrices are real.

Fall 2010 16.30/31 711

cos(bt) sin(bt) 1

eAt = Re(e1) Im(e1) eat

Re(e1) Im(e1)

sin(bt) cos(bt)

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.

cos(bt) sin(bt)

x(t) = eAtx(0) = Re(e1) Im(e1) eat

sin(bt) cos(bt)

1

Re(e1) Im(e1) [Re(e1)]

at cos(bt) sin(bt) 1

= Re(e1) Im(e1) e

sin(bt) cos(bt) 0

cos(bt)

= eat Re(e1) Im(e1)

sin(bt)

which would ensure that only this mode is excited in the response

Fall 2010 16.30/31 712

1, and ki = 1

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

Fall 2010 16.30/31 713

xi(0) = 1Re(vi) + 2Im(vi) j R

Simulation using 1 = 1, 2 = 0

Visualization important for correct physical interpretation

Mode 1 1 = 0.77i

m1 m3 m2

Middle mass has higher amplitude motions z3, motions all in phase

Fall 2010 16.30/31 714

Mode 2 2 = 1.85i

m1 m3 m2

two end masses

Again middle mass has higher amplitude motions z3

Fall 2010 16.30/31 715

Mode 3 3 = 2.00i

m1 m3 m2

two masses in opposition

tem are associated with higher frequency eigenvalues

Fall 2010 16.30/31 716

Fall 2010 16.30/31 717

Code: Simulation of Spring Mass System Modes

1 % Simulate modal response for a spring mass system

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')

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

Need to develop a similar way of dening/computing them using

a state space model.

non-zero input u(t) = u0es0t, but exactly zero output y(t) 0 t

Note that there is a specic initial condition associated with this

response x0, so the state response is of the form x(t) = x0es0t

u(t) = u0es0t x(t) = x0es0t y(t) 0

x0

x0s0es0t = Ax0es0t + Bu0es0t

s0I A B =0

u0

Also have that y = Cx + Du = 0 which gives:

x0

Cx0es0t + Du0es0t = 0

C D =0

u0

s0I A B x0

=0

C D u0

Is a generalized eigenvalue problem that can be solved in

MATLAB using eig.m or tzero.m 1

1 MATLAB is a trademark of the Mathworks Inc.

Fall 2010 16.30/31 82

of

s0I A B

det =0

C D

Compare with equation on page 6??

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

2

x0 = and u = 2e2t

1

Fall 2010 16.30/31 83

quency domain, so that

Y1(s) = G(s)U (s)

where u = 2e2t, so that U (s) = 2

s+2

s+2 2 2

Y1(s) = =

s2 + 7s + 12 s + 2 s2 + 7s + 12

Say that s = 2 is a blocking zero or a transmission zero.

component at the input frequency s = 2.

That input has been blocked.

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

0 y(t) = 0, as expected.

Fall 2010 16.30/31 84

Simpler Test

If z is a zero with (right) direction [ T , uT ]T , then

zI A B

=0

C D u

If z not an eigenvalue of A, then = (zI A)1Bu, which gives

C(zI A)1B + D u = G(z)

u=0

Which implies that G(s) loses rank at s = z

If G(s) is square, can nd the zero frequencies by solving:

det G(s) = 0

If any of the resulting roots are also eigenvalues of A, need to

re-check the generalized eigenvalue matrix condition.

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

Fall 2010 16.30/31 85

Note that the transfer function matrix (TFM) notion is a MIMO

generalization of the SISO transfer function

It is a matrix of transfer functions

g11(s) g1m(s)

G(s) =

...

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.

of gij (s) in the form Aij , Bij , Cij , Dij , and then assemble (if TFM is

p m)

A11 B11

. . .

. . .

A1m

B1m

A =

B =

A21

B21

..

..

Apm Bpm

C11 C1m

C21 . . . C2m

C

=

D = [Dij ]

...

Cp1 Cpm

Fall 2010 16.30/31 86

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

matrix.

minors and 1 order-2 minor to consider.

2 Lowest order polynomial that can be divided cleanly by all denominators of the minors of G(s).

3 See here for details

Fall 2010 16.30/31 87

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.

Fall 2010 16.30/31 88

the partial fraction expansion

Set Ri = CiBi, and nd appropriate Bi and Ci

Form Ai by placing the poles on the diagonal as many times as

needed (determined by rank of Ri)

Form state space model:

A1 B1

x = ... x + ... u

ANm BNm

y = C1 CNm x

Fall 2010 16.30/31 89

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

est polynomial that leaves all terms with no denominator:

1

{(s 2)(s + 1)(s + 2), (s 2)(s + 1)(s + 2),

(s 2)(s + 1)(s + 2)2

2 2

(s + 1)(s + 2 ), (s 2) (s + 2), 2 7s

So we expect a fourth order system with poles at s = 2, s = 2

(two), and s = 1

(s + 1)(s 2) (s + 1)(s 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.

Fall 2010 16.30/31 810

0

A1 = [1] B1 = 0 3 C1 =

1

2 0 1 1

A2 = B2 = C2 = I2

0 2 0 4

0

A3 = [2] B3 = 1 0 C3 =

1

1 %

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

Fall 2010 16.30/31 811

Zero Example 2

1 1

s + 1 (s + 1)2

TFM G(s) =

1 1

(s + 1)3 (s + 1)4

1 1 1 1

, , , , 0

s+1 (s + 1)2 (s + 1)3 (s + 1)4

To nd LCD (least common multiple of denominators), pull out small

est polynomial that leaves all terms with no denominator:

1

3 2

(s + 1) , (s + 1) , (s + 1), 1

(s + 1)4

minimal state space model to have 4 poles at s = 1.

Gilbert approach as given cannot be applied directly since d(s) =

1

(s+1)4

has repeated roots

See Matlab code for model development

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

not minimal since the order is 10, not the 4 we expected.

Fall 2010 16.30/31 812

realization.

0.40 0.16 1.00 0.01 0.23 0.02

0.32 1.49 0.06

A= 1.07

0.50 1.06 1.17 0.39 B = 0.97 0.36

0.05 0.31

0.07 0.16 0.02 0.94 0.01 0.75

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

expected.

Code: Zeros (zero example1.m)

1 G1=ss(tf({1 1;1 1},{[1 1] conv([1 1],[1 1]);conv([1 1],conv([1 1],[1 1])) ...

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') %

Fall 2010 16.30/31 813

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)

The McMillan degree is 3 we expect the minimal state space

model to have 3 poles.

For Gilbert approach, we rewrite

2s + 3 3s + 5

(s + 2) 0 R1 R2

G(s) = = +

(s + 1)(s + 2) s+1 s+2

where

2s+3

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.

Fall 2010 16.30/31 814

1 2 1 0

R1 = = C1B1

1 0 0 1

1

R2 = 1 1 = C2B2

0

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

1.00 0.00 0.00 0.56 1.12

A = 0.00 2.00 0.00 B = 0.35 0.35

0.00 0.00 1.00 0.50 0.00

1.79 2.83 0.00 0.00 0.00

C = D=

0.00 0.00 2.00 0.00 0.00

Code: Zeros (zero example2.m)

2 G1=canon(G1,'modal')

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') %

Fall 2010 16.30/31 815

matrix condition is that it can be used to nd MIMO zeros of a

system with multiple inputs/outputs.

s I A B

det 0 =0

C D

Just looking at individual transfer functions is not useful.

Need to look at system as a whole use the singular values of

G(s)

Will see later the conditions to determine if the order of a state space

model is minimal.

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

need to identify.

Will see that these are very closely associated with the concepts

of pole/zero cancelation in transfer functions.

6

G(s) =

s+2

for which we develop the state-space model

Model # 1 x = 2x + 2u

y = 3x

= [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.

(s) = C(sI A)1B + D

G

1

2 0 2

= 3 0 sI

0 1 1

2

s+2 6

= 3 0 1

= !!

s+2

s+1

Fall 2010 16.30/31 93

comparing one state-space model to another (page 6??) was whether

they reproduced the same same transfer function

Now we have two very dierent models that result in the same

transfer function

Note that I showed the second model as having 1 extra state, but

I could easily have done it with 99 extra states!!

A clue is that the dynamics associated with the second state of

the model x2 were eliminated when we formed the product

2

s+2

G(s) = 3 0 1

s+1

because the A is decoupled and there is a zero in the C matrix

Which is exactly the same as saying that there is a pole-zero

(s)

cancelation in the transfer function G

6 6(s + 1) (s)

= G

s + 2 (s + 2)(s + 1)

(s)

Note that model #2 is one possible state-space model of G

(has 2 poles)

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.

Fall 2010 16.30/31 94

Model # 1 x = 2x + 2u

y = 3x

= [ 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

canceled out of the transfer function.

But in this case it occurred because there is a 0 in the B matrix

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).

Fall 2010 16.30/31 95

2 0

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.

trollable, unobservable, or both do not show up in the transfer

function.

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

Fall 2010 16.30/31 96

Observability

can be uniquely deduced from the knowledge of the input u(t) and

output y(t) for all t between 0 and any nite T > 0.

If x(0) can be deduced, then we can reconstruct x(t) exactly

because we know u(t) we can nd x(t) t.

Thus we need only consider the zero-input (homogeneous) solution

to study observability.

y(t) = CeAtx(0)

before of being able to see all the states in the output of the de-

coupled examples

ROT: For those decoupled examples, if part of the state cannot

be seen in y(t), then it would be impossible to deduce that part

of x(0) from the outputs y(t).

Fall 2010 16.30/31 97

zero-input solution y(t), with x(0) = x, is zero for all t 0

Equivalent to saying that x is an unobservable state if

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

the state x2 from the previous analysis

Fall 2010 16.30/31 98

servable states.

We normally just say that the pair (A,C) is observable.

the outputs from the initial conditions x1(0) and x2(0) = x1(0) + x

Then

y1(t) = CeAtx1(0) and y2(t) = CeAtx2(0)

but

y2(t) = CeAt(x1(0) + x) = CeAtx1(0) + CeAtx

= CeAtx1(0) = y1(t)

would be impossible for us to deduce the actual initial condition

of the system x1(t) or x2(t) given y1(t)

CeAtx(0) = 0 t is feasible, but very hard in general.

Better tests are available.

Fall 2010 16.30/31 99

C

CA

2

CA x

= 0

...

CAn1

CeAtx = 0 t0

But all the derivatives of CeAt exist and for this condition to hold, all

derivatives must be zero at t = 0. Then

Ce x t=0 = 0

Cx = 0

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

Cayley-Hamilton theorem.

Fall 2010 16.30/31 910

that

C

CA

2

rank Mo

rank

CA = n

...

CAn1

The requirement for an unobservable state is that for x =

0

Mox = 0

Which is equivalent to saying that x is orthogonal to each row of

Mo .

But if the rows of Mo are considered to be vectors and these span

the full n-dimensional space, then it is not possible to nd an

n-vector x that is orthogonal to each of these.

To determine if the n rows of Mo span the full n-dimensional

space, we need to test their linear independence, which is equiv

alent to the rank test1

1

2. rank M number of linearly independent rows of M

3. rank M min{m, p}

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

every nite T > 0, there exists an input function u(t), 0 < t T ,

such that the system state goes from x(0) = 0 to x(T ) = x.

in nite time from the origin, then we can get from any initial

condition to that state in nite time as well. 1

before of being able to inuence all the states in the system in the

decoupled examples (page 9??).

be inuenced by u(t), then it would be impossible to move that

part of the state from 0 to x

t

xf (t) = eA(t )Bu( )d

0

Change of variables 2 = t , d = d2 gives a form that is a

little easier to work with:

t

xf (t) = eA2 Bu(t 2)d2

0

Assume system has m inputs.

Fall 2010 16.30/31 102

theorem gives

n1

At

e = Aii(t)

i=0

for some computable scalars i(t), so that

n1

t n1

i

xf (t) = (A B) i(2)u(t 2)d2 = (AiB) i(t)

i=0 0 i=0

combination of the nm vectors AiB (with m inputs).

All linear combinations of these nm vectors is the range space of

the matrix formed from the AiB column vectors:

2 n1

Mc = B AB A B A B

system

If a state xc(t) is not in the range space of Mc, it is not a linear

combination of these columns it is impossible for xf (t) to ever

equal xc(t) called uncontrollable state.

lable states.

Necessary and sucient condition for controllability is that

2 n1

rank Mc rank B AB A B A B = n

Fall 2010 16.30/31 103

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.

a system. Whether the model has them or not depends on the repre

sentation that you choose.

But they indicate that something else more fundamental is wrong. . .

Fall 2010 16.30/31 104

Modal Tests

ty/controllability for system with a decoupled A matrix.

There is, of course, a very special decoupled form for the state-space

model: the Modal Form (6??)

x = Ax + Bu

y = Cx + Du

and the A is diagonalizable (A = T T 1) using the transformation

| |

T = v1 vn

| |

based on the eigenvalues of A. Note that we wrote:

w1T

T 1 = ...

wnT

which is a column of rows.

z = T 1x = T 1(Ax + Bu)

= (T 1AT )z + T 1Bu

= z + T 1Bu

y = Cx + Du

= CT z + Du

Fall 2010 16.30/31 105

dynamics matrix .

But by denition,

w1T

T 1B = ... B

wnT

and

CT = C v1 vn

wiT B 0

then that element of the state vector zi would be uncontrollable by

the input u.

Also, if

Cvj 0

then that element of the state vector zj would be unobservable with

this sensor.

able if it can be shown that

wiT B =

0 i

and

Cvj = 0 j

Fall 2010 16.30/31 106

Cancelation

Examples show the close connection between pole-zero cancelation

and loss of observability and controllability. Can be strengthened.

vi

able i the system has a zero at i with direction .

0

(iI A)vi = 0 It is a mode

Cvi = 0 That mode is unobservable

Combine to get:

(iI A)

vi = 0

C

Or

(iI A) B vi

=0

C D 0

which implies that

the system has a zero at that frequency as well,

vi

with direction .

0

of controllability, but now

using zeros with left direction wiT 0 .

Fall 2010 16.30/31 107

observability or controllability we say that there is a pole/zero cance

lation.

tion mode is unobservable

tion mode is uncontrollable

and

the directionality of the system mode (eigenvector) and zero

vi T

or wi 0 .

0

Fall 2010 16.30/31 108

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

the degree of controllability and observability for that mode.

Loss of observability or controllability residue is zero that

pole does not show up in the transfer function.

If modes have equal observability Cvi Cvj , but one

wiT B wjT B

Great way to approach model reduction if needed.

Fall 2010 16.30/31 109

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

dynamics that you are not aware of and cannot inuence, but you

know that they are at least stable.

That is enough information on the system model for now will assume

minimal models from here on and start looking at the control issues.

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #11

State-Space Systems

Where do we change the pole locations to?

How well does this approach work?

Fall 2010 16.30/31 111

x (t) = Ax(t) + Bu(t)

y(t) = Cx(t)

so that D = 0.

The multi-actuator case is quite a bit more complicated as we

would have many extra degrees of freedom.

Want to use the input u(t) to modify the eigenvalues of A to

change the system dynamics.

r u(t) y(t)

A, B, C

x(t)

u(t) = r Kx(t)

where r is some reference input and the gain K is R1n

If r = 0, we call this controller a regulator

x (t) = Ax(t) + B(r Kx(t))

= (A BK)x(t) + Br

= Acl x(t) + Br

y(t) = Cx(t)

Fall 2010 16.30/31 112

A unstable, want Acl stable

Put 2 poles at 2 2i

Note that there are n parameters in K and n eigenvalues in A, so it

looks promising, but what can we achieve?

1 1 1

x (t) = x(t) + u

1 2 0

system is unstable.

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

complex plane (assuming complex conjugate pairs of poles).

Fall 2010 16.30/31 113

equation

(s + 5)(s + 6) = s2 + 11s + 30 = 0

with the closed-loop one

s2 + (k1 3)s + (1 2k1 + k2) = 0

to conclude that

k1 3 = 11 k1 = 14

1 2k1 + k2 = 30 k2 = 57

so that K = 14 57 , which is called Pole Placement.

be an issue.

1 1 1

x (t) = x(t) + u

0 2 0

with the same control approach

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.

Problem caused by a lack of controllability of the e2t mode.

Fall 2010 16.30/31 114

1 1 1 1

Mc = B AB =

0 0 2 0

So that rank Mc = 1 < 2.

1 1

A= , decompose as AV = V = V 1AV

0 2

where

1 0 1 1 1 1

= V = V 1 =

0 2 0 1 0 1

Convert

z=V 1 x(t)

x (t) = Ax(t) + Bu z = z + V 1Bu

T

where z = z1 z2 . But:

1 1

1 1

V 1B = =

0 1 0 0

so that the dynamics in modal form are:

1 0 1

z = z+ u

0 2 0

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.

Fall 2010 16.30/31 115

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.

process is one easy step.

1

K = 0 . . . 0 1 Mc d(A)

n1

Mc = B AB . . . A B as before

d(s) is the characteristic equation for the closed-loop poles, which

we then evaluate for s = A.

Note: is explicit that the system must be controllable because

we are inverting the controllability matrix.

1 1 1 1 1 1

Mc = B AB = =

0 1 2 0 0 1

So

1 2

1 1 1 1 1 1

K = 0 1 + 11 + 30I

0 1 1 2 1 2

43 14

= 0 1 = 14 57

14 57

Fall 2010 16.30/31 116

this extends to any order.

a1 a2 a3 1

A= 1 0 0 B = 0 C = b1 b2 b3

0 1 0 0

See key benet of using control canonical state-space model

This form is useful because the characteristic equation for the

system is obvious det(sI A) = s3 + a1s2 + a2s + a3 = 0

a1 a2 a3 1

Acl = A BK = 1 0 0 0

k1 k2 k3

0 1 0 0

a1 k1 a2 k2 a3 k3

= 1 0 0

0 1 0

so that the characteristic equation for the system is still obvious:

cl (s) = det(sI Acl )

= s3 + (a1 + k1)s2 + (a2 + k2)s + (a3 + k3) = 0

Fall 2010 16.30/31 117

closed-loop pole locations:

d(s) = s3 + (1)s2 + (2)s + (3) = 0

to get that

a1 + k1 = 1 k1 = 1 a1

..

. ...

an + kn = n kn = n an

Take an arbitrary A, B and transform it to the control canonical

form (x(t) z(t) = T 1x(t))

Not obvious, but Mc can be used to form this T

using the formulas at top of page for the

Solve for the gains K

state z(t)

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.

Fall 2010 16.30/31 118

Reference Inputs

some nice properties (i.e. stabilize A)

a reference command?

Performance issue rather than just stability.

Started with

x (t) = Ax(t) + Bu y = Cx(t)

u = r Kx(t)

y(t) r(t) as t

nal value theorem:

lim y(t) = lim sY (s)

t s0

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

1 1 1

x(t) = x(t) + u

1 2 0

y = 1 0 x(t)

Already designed K = 14 57 so the closed-loop system is

x (t) = (A BK)x(t) + Br

y = Cx(t)

which gives the transfer function

Y (s)

= C (sI (A BK))1 B

R(s)

1

s + 13 56 1

= 1 0

1 s 2 0

s2

= 2

s + 11s + 30

Y (s) 2

= = 1 !!

R(s) s=0 30

So our step response is quite poor!

Fall 2010 16.30/31 1110

u = N r Kx(t)

N extra gain used to scale the closed-loop transfer function

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

1

1

1

N = Gcl (0) = C(A BK) B

Note that this development assumed that r was constant, but it could

also be used if r is a slowly time-varying command.

Fall 2010 16.30/31 1111

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.

1 % full state feedback for topic 13

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

Fall 2010 16.30/31 1112

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!

Fall 2010 16.30/31 1113

0.94

G(s) = 2

s 0.0297

Target pole locations 0.25 0.25i

Fig. 4: Response to step input with and without the N correction. Gives the desired

steady-state behavior, with little diculty!

Fall 2010 16.30/31 1114

8 14 20

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!

Fall 2010 16.30/31 1115

(s 1)

G(s) =

(s + 1)(s 3)

Target pole locations 1 i

Fig. 8: Response to step input with and without the N correction. Gives the desired

steady-state behavior, with little diculty!

Fall 2010 16.30/31 1116

FSFB Summary

Matlab using acker and/or place

in the control we can change the eigenvectors as desired, as well

as the poles.

And to correct the fact that we cannot usually measure the state

develop an estimator.

Fall 2010 16.30/31 1117

1 % Examples of pole placement with FSFB

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

Fall 2010 16.30/31 1118

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])

Fall 2010 16.30/31 1119

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

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #12

State-Space Systems

put the poles?

Heuristics

Linear Quadratic Regulator

How well does this approach work?

some nice properties (i.e. stabilize A)

i(A) i(A BK)

poles roots of:

s2 + 2ns + n2 = 0

Then place rest of the poles so they are much faster than the

dominant 2nd order behavior.

Example: could keep the same damped frequency wd and then

move the real part to be 23 times faster than the real part of

dominant poles n

Just be careful moving the poles too far to the left because it

takes a lot of control eort

1 + 1.1 + 1.4 2

10-90% rise time tr = n

n

Time to peak amplitude tp =

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.

Fall 2010 16.30/31 123

system optimizes the cost function

T T

JLQR = x(t) Qx(t) + u(t) Ru(t) dt

0

where:

xT Qx is the State Cost with weight Q

uT Ru is called the Control Cost with weight R

Basic form of Linear Quadratic Regulator problem.

u(t) = Klqrx(t)

and Klqr found by solving Algebraic Riccati Equation (ARE)

0 = AT P + P A + Q P BR1B T P

Klqr = R1B T P

Some details to follow, but discussed at length in 16.323

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

Fall 2010 16.30/31 124

81420

Fig. 1: Example #1: G(s) = (s+8)(s+14)(s+20) with control penalty and 10

Fall 2010 16.30/31 125

0.94

Fig. 2: Example #2: G(s) = s2 0.0297 with control penalty and 10

Fall 2010 16.30/31 126

81420

Fig. 3: Example #3: G(s) = (s8)(s14)(s20) with control penalty and 10

Fall 2010 16.30/31 127

(s1)

Fig. 4: Example #4: G(s) = (s+1)(s3) with control penalty and 10

Fall 2010 16.30/31 128

(s2)(s4)

Fig. 5: Example #5: G(s) = (s1)(s3)(s2 +0.8s+4)s2 with control penalty and 10

Fall 2010 16.30/31 129

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

control input for that component of the state/actuator signal.

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

Fall 2010 16.30/31 1210

Regulator Summary

with no regard to the amount of control eort required.

Designer must iterate on the selected bandwidth (n) to ensure

that the control eort is reasonable.

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

Fall 2010 16.30/31 1211

1 % LQR examples for 16.31

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);

Fall 2010 16.30/31 1212

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

101 %!rm srl22.pdf;

102 export fig srl22 pdf

103

104 if 1

105 figure(fig);clf;fig=fig+1;

106 f=logspace(1,2,400);

107 gcl1=freqresp(sys1,f);

108 gcl2=freqresp(sys2,f);

109 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);%grid

110 axis([.1 100 .01 2])

111 xlabel('Freq (rad/sec)');ylabel('G {cl}')

112 title('Closedloop Freq Response')

113 legend(['\rho = ',num2str(R)],['\rho = ',num2str(10*R)],'Location','SouthWest')

114 %!rm srl23.pdf;

115 export fig srl23 pdf

116 end

117

118 end % if 0

119 %%%%%%%%%%%%%%

120

121 if 1

122 clear all

123 fig=7;

124

125 G=tf(.94,[1 0 0.0297]);

126 [a,b,c,d]=ssdata(G);

127 R=.1

128 k=lqr(a,b,c'*c,R);

129 k2=lqr(a,b,c'*c,10*R);

130

131 % find the feedforward gains

132 Nbar=inv(c*inv(ab*k)*b);

133 Nbar2=inv(c*inv(ab*k2)*b);

134

135 sys1=ss(ab*k,b*Nbar,c,d);

136 sys2=ss(ab*k2,b*Nbar2,c,d);

137

138 t=[0:.01:30];

139 [y,t,x]=step(sys1,t);

140 [y2,t2,x2]=step(sys2,t);

141

142 figure(fig);clf;fig=fig+1;

143 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 30 0 1.2])

144 grid;

148 hold on

Fall 2010 16.30/31 1213

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 %%%%%%%%%%%%

Fall 2010 16.30/31 1214

230 fig=13;

231

232 G=tf(conv([1 2],[1 4]),conv(conv([1 1],[1 3]),[1 2*.2*2 22 0 0]));

233 [a,b,c,d]=ssdata(G);

234 R=.1

235 k=lqr(a,b,c'*c,R);

236 k2=lqr(a,b,c'*c,10*R);

237

238 % find the feedforward gains

239 Nbar=inv(c*inv(ab*k)*b);

240 Nbar2=inv(c*inv(ab*k2)*b);

241

242 sys1=ss(ab*k,b*Nbar,c,d);

243 sys2=ss(ab*k2,b*Nbar2,c,d);

244

245 t=[0:.01:10];

246 [y,t,x]=step(sys1,t);

247 [y2,t2,x2]=step(sys2,t);

248

249 figure(fig);clf;fig=fig+1;

250 plot(t,y,'',t2,y2,'LineWidth',2);axis([0 10 1 1.2])

251 grid;

252 legend(['\rho = ',num2str(R)],['\rho = ',num2str(10*R)],'Location','SouthEast')

253 xlabel('time (sec)');ylabel('Y output');

254 title('Unstable, NMP system Step Response')

255 hold on

256 plot(t2([1 end]),[.1 .1]*y2(end),'r');

257 plot(t2([1 end]),[.1 .1]*9*y2(end),'r');

258 hold off

259

260 text(1,.6,['k= [ ',num2str(round(k*1000)/1000),' ]'])

261 text(1,.8,['Nbar= ',num2str(Nbar)])

262 %!rm srl52.pdf;

263 export fig srl52 pdf

264

265 if 1

266 figure(fig);clf;fig=fig+1;

267 f=logspace(2,2,400);

268 gcl1=freqresp(sys1,f);

269 gcl2=freqresp(sys2,f);

270 loglog(f,abs(squeeze(gcl1)),f,abs(squeeze(gcl2)),'LineWidth',2);%grid

271 axis([.1 100 .01 2])

272 xlabel('Freq (rad/sec)')

273 ylabel('G {cl}')

274 title('Closedloop Freq Response')

275 legend(['\rho = ',num2str(R)],['\rho = ',num2str(10*R)],'Location','SouthWest')

276 %!rm srl53.pdf;

277 export fig srl53 pdf

278 end

Fall 2010 16.30/31 1215

Example: B747

Variables of interest now include lateral velocity (side slip, ), yaw

and yaw rate r, roll and roll rate p.

Actuators are aileron a and rudder r (Figure 10.30 from FPE)

x, y, z = Position coordinates = Roll angle

u, v, w = Velocity coordinates = Pitch angle

p = Roll rate = Yaw angle

q = Pitch rate = Slide-slip angle

r = Yaw rate = Angle of attack

Velocity vector

x, u

y, v

, q

r

, p

er

dd

Ru

, r

Aileron a Elevators e

z, w

Image by MIT OpenCourseWare.

ight condition to get equations of motion for lateral dynamics

r

r

x = Ax + Bu , x = , u = = r

p

a

0.0558 0.9968 0.0802 0.0415

A = (1)

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

October 17, 2010

Fall 2010 16.30/31 1216

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.

Fast real 0.5627 Roll Damping

Oscillatory 0.0329 0.9467i Dutch Roll

Spiral Roll Dutch Roll

= v/U0 0.0067 -0.0197 0.3085 0

p = p/(2U0/b) -0.0009 -0.0712 0.1131 120

r = r/(2U0/b) 0.0052 0.0040 0.0348 -84

1.0000 1.0000 0.9438 28

Not as enlightening as the longitudinal case the lateral

dynamics tightly couple all of the states in a complex motion

Note that the Dutch roll is too lightly damped, and we would typically

like to increase that damping using closed-loop control

Fall 2010 16.30/31 1217

Washout Filter

namics is that there are various ight modes that require a steady

0). For example, steady turning ight.

yaw rate (rss =

So the control that we implement must not be concerned if the

steady state value r is non-zero

of the r signal.

High pass cuts out the low frequency content in the signal

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)

Fall 2010 16.30/31 1218

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

To proceed, must augment the lter and actuator dynamics to the

state model

Algebra of this will be discussed later, but Matlab has easy ways of

doing this augmentation because we can multiply systems together

(note code using a I/O order dierent than picture above)

1 sys = ss(A,B,C,D);

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

Try gain feedback - see root locus

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

Real Axis

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

Fall 2010 16.30/31 1220

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

eect of zero still apparent

Suggests 0.1, which gives about 40% damping in that mode

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)

Fall 2010 16.30/31 1221

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

But note that the original gain feedback design wasnt that much

worse is the additional complexity of the full state feedback justied?

October 17, 2010

Fall 2010 16.30/31 1222

1 % B747 lateral dynamics

2 % Jonathan How, Fall 2010

3 % working from Matlab Demo called jetdemo

4 clear all;%close all

5 %

6 A=[.0558 .9968 .0802 .0415;

7 .598 .115 .0318 0;

8 3.05 .388 .4650 0;

9 0 0.0805 1 0];

10 B=[ .00729 0;

11 0.475 0.00775;

12 0.153 0.143;

13 0 0];

14 C=[0 1 0 0; 0 0 0 1];D=[0 0; 0 0];

15 sys = ss(A,B,C,D);

16 set(sys, 'inputname', {'rudder' 'aileron'},...

17 'outputname', {'yaw rate' 'bank angle'});

18 set(sys, 'statename', {'beta' 'yaw rate' 'roll rate' 'phi'});

19 [Yol,Tol]=initial(ss(A,B,[1 0 0 0],zeros(1,2)),[1 0 0 0]',[0:.1:30]);

20 [V,E]=eig(A)

21 %

25 %

28 %

29 Gp=WashFilt*sys*H;

33 [Ap,Bp,Cp,Dp]=ssdata(Gp);

34 [Klqr,S,Elqr]=lqr(Ap,Bp(:,1),Cp(1,:)'*Cp(1,:),0.1);rifd(Elqr)

35 %

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

Fall 2010 16.30/31 1223

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

101

102 figure(4);clf

103 rlocus(Gp(1,1)*Gc);axis([5.5 .5 3 3])

104 hold on

105 [p,z]=pzmap(Gp(1,1));

106 plot(p+sqrt(1)*eps,'rx','MarkerFace','r')

107 plot(z+sqrt(1)*eps,'ro','MarkerFace','r')

108 [p,z]=pzmap(Gc(1,1));

109 plot(p+sqrt(1)*eps,'mx','MarkerFace','m')

110 plot(z+sqrt(1)*eps,'mo','MarkerFace','m')

111 p=eig(acl);

112 plot(p+sqrt(1)*eps,'bd')

113 hold off

114 export fig b747 lqr4 pdf

115

116 % initial comp at zero

117 [Ycl,Tcl]=initial(Gcl,[xp0;xp0*0],Tol); %'

118

119 figure(3);clf

120 plot(Tol,Yol,T,Y(:,1),Tgain,Ygain,Tcl,Ycl(:,1));axis([0 30 1 1]);

121 setlines(2)

122 legend('OL','LQR','Gain','DOFB')

123 ylabel('\beta');xlabel('Time')

124 grid on

125 export fig b747 lqr3a pdf

126

127 figure(6);clf

128 plot(T,Y(:,1).2,Tcl,Ycl(:,1).2,T,Y(:,2).2,Tcl,Ycl(:,2).2);

129 axis([0 10 0 1]);

130 hold off

131 setlines(2)

132 legend('LQR x2','DOFB x2','LQR u2','DOFB u2')

133 ylabel('x2 and u2');xlabel('Time')

134 grid on

135 export fig b747 lqr3b pdf

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

Fall 2010 16.30/31 132

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

robustly achieved in response to constant reference commands.

Done by augmenting integrators to the system output and then

including a penalty on the integrated output in LQ cost.

reference r(t), add extra states xI (t), where

x I (t) = e(t) = r(t) y(t)

Then penalize both x(t) and xI (t) in the cost

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)

T T

J= x Rxxx + u Ruuu dt

0

is full-state feedback (found using LQR approach in Topic 12)

x

u(t) = [ K KI ] = Kx(t)

xI

Fall 2010 16.30/31 133

typically implement the controller using the architecture:

r 1 xI

KI

s

u y

K G(s)

when the model of the system dynamics is wrong.

the same used in the simulations

diers from the one used in the simulations

integrator approaches still do OK robustness to modeling errors.

Fall 2010 16.30/31 134

1 % LQ servo

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

Fall 2010 16.30/31 135

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

Estimation Theory (with noise) Kalman

Estimators/Observers

state x(t) when we designed our controllers.

sensors measurements.

Could try output feedback

y

u = Kx u = K

Same as the proportional feedback we looked at at the beginning

of the root locus work.

This type of control is very dicult to design in general.

that provides an estimate of the system states based on the mea

sured output of the system.

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).

How do we nd x

(t)?

Will this new plan work?

Fall 2010 16.30/31 143

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 =

(t) = x(t)

x

for all time t 0. Two primary approaches:

Open-loop.

Closed-loop.

Fall 2010 16.30/31 144

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

x (t) = Ax(t) + Bu(t)

(t) = Ax

x (t) + Bu(t)

(t) = 0 t. (But is this realistic?)

Now want x

Fall 2010 16.30/31 145

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.

(t) = 0 t?

(t) 0 as t ? (which is a more realistic goal).

Or even that x

Response is ne if x (0) = 0?

(0) = 0. But what if x

estimation error are completely determined by the open-loop dynamics

of the system (eigenvalues of A).

Could be very slow.

No obvious way to modify the estimation error dynamics.

Fall 2010 16.30/31 146

Closed-loop Estimator

available:

How well does the estimated output match the measured output?

(t) = Cx

Compare: y(t) = Cx(t) with y (t)

Then form y

(t) = y(t) y

(t) Cx

(t)

Actual System y

x: A, B, C

+

u

L

y

Estimator

y

: A, B, C

x

Basic form of the estimator is:

(t) = Ax

x (t) + Bu(t) + Ly

(t)

(t) = Cx

y (t)

where L is the user selectable gain matrix.

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)

Fall 2010 16.30/31 147

(t) = (A LC)x

x (t)

with solution

(t) = e(ALC)t x

x (0)

convergence of the estimation error (and/or speed it up).

But now must worry about observability of the system model.

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).

Fall 2010 16.30/31 148

Regulator/Estimator Comparison

Regulator Problem:

Concerned with controllability of (A, B)

of A BK arbitrarily.

Choose K R1n (SISO) such that the closed-loop poles

det(sI A + BK) = c(s)

are in the desired locations.

Estimator Problem:

For estimation, were concerned with observability of pair (A, C).

A LC arbitrarily.

Choose L Rn1 (SISO) such that the closed-loop poles

det(sI A + LC) = o(s)

are in the desired locations.

These problems are obviously very similar in fact they are called

dual problems.

Fall 2010 16.30/31 149

The procedure for selecting L is very similar to that used for the

regulator design process.

x 1 a1 1 0 x1 b1

x 2 = a2 0 1 x2 + b2 u

x 3 a3 0 0 x3 b3

x1

y = 1 0 0 x2

x3

Now very simple to form

a1 1 0 l1

A LC = a2 0 1 l2

1 0 0

a3 0 0 l3

a1 l1 1 0

= a2 l2 0 1

a3 l3 0 0

The closed-loop poles of the estimator are at the roots of

det(sI A + LC) = s3 + (a1 + l1)s2 + (a2 + l2)s + (a3 + l3) = 0

Use Pole Placement algorithm with this characteristic equation.

0

..

.

L = e(A)M1 o

0

1

Fall 2010 16.30/31 1410

Also we have that (A LC)T = AT C T LT

So designing LT for this transposed system looks like a standard

regulator problem (A BK) where

A AT

B CT

K LT

So we can use

Ke = acker(AT , C T , P ) , L KeT

can use

R

Ke = lqr(AT , C T , Q, ) , L KT

e

to design a good set of optimal estimator gains

Roles of Q and R

explained in 16.322

Fall 2010 16.30/31 1411

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

Since the initial conditions are not well known, use

0

(0) =

x

0

Open-loop estimator:

(t) = Ax

x (t) + Bu(t)

(t) = Cx

y (t)

Fall 2010 16.30/31 1412

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

Fall 2010 16.30/31 1413

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

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

Fall 2010 16.30/31 1414

Location heuristics for poles still apply

Main dierence: probably want to make the estimator faster than

you intend to make the regulator should enhance the control,

(t).

which is based on x

Crude ROT: Factor of 2 in the time constant n associated

with the regulator poles.

of the control getting too high often results in control commands

that saturate the actuators and/or change rapidly.

Loop closed inside computer, so saturation not a problem.

However, measurements y are often noisy, and must be careful

how we use them to develop state estimates.

ing noise in the estimate.

State estimates tend to track the data in the measurements,

which could be uctuating randomly due to the noise.

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.

Fall 2010 16.30/31 1415

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.

Not always just part of the control system

Critical issue for guidance and navigation system

More complete discussion requires that we study stochastic pro

cesses and optimization theory.

More in 16.322 take in Spring or see 2004 OCW notes

ments or your model.

Fall 2010 16.30/31 1416

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

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

Fall 2010 16.30/31 152

designed assuming

u(t) = Kx(t)

but implemented as

u(t) = Kx

(t)

(t) = (A LC)x

x (t) + Bu(t) + Ly(t)

(t) = Cx

y (t)

x (t) = Ax(t) + Bu(t)

(t)

x = (A LC)x (t) + Bu(t) + Ly(t)

y(t) = Cx(t)

(t)

y = Cx (t)

u(t) = Kx (t)

BK

x (t) A x(t)

= x cl (t) = Acl xcl (t)

(t)

x LC A BK LC (t)

x

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

then converting the closed-loop system dynamics using the

similarity transformation T

x(t) I 0 x(t)

cl (t)

x = = T xcl (t)

(t)

x I I x (t)

Note that T = T 1

cl (t)

Acl T Acl T 1 Acl

Since similarity transformations preserve the eigenvalues we are

guaranteed that

i(Acl ) i(Acl )

I 0 A BK I 0

Acl =

I I LC A BK LC I I

A BK I 0

=

A LC A + LC I I

A BK BK

=

0 A LC

poles of the system are given by

cl) det(sI (A BK)) det(sI (A LC)) = 0

det(sI A

November 5, 2010

Fall 2010 16.30/31 154

the union of the regulator poles and estimator poles.

bine them at the end.

Called the Separation Principle.

Keep in mind that the pole locations you are picking for these two

sub-problems will also be the closed-loop pole locations.

uncertainty about the stability and/or performance of the closed-loop

system.

The closed-loop poles will be exactly where you put them!!

And we have not even said what compensator does this amazing

accomplishment!!!

November 5, 2010

Fall 2010 16.30/31 155

The Compensator

the regulator and estimator using u(t) = Kx

(t)

(t) = (A LC)x

x (t) + Bu(t) + Ly(t)

(t) = (A BK LC)x

x (t) + Ly(t)

u(t) = Kx (t)

(t)

u(t) = Ccxc(t)

Ac A BK LC , Bc L , Cc K

Note that the compensator maps sensor measurements to actuator

commands, as expected.

LHP, but compensator dynamics do not need to be stable.

i(A BK LC) =??

November 5, 2010

Fall 2010 16.30/31 156

the compensator transfer function as

Gc(s) = Cc(sI Ac)1Bc

so that

u(t) = Gc(s)y(t)

as lead/lag) for the compensator Gc(s).

feedback on e(t) = r(t) y(t) rather than just y(t)

r e u y

Gc(s) Gp(s)

Still have u(t) = Gc(s)y(t) if r(t) = 0.

So now write state space model of the compensator as

x c(t) = Acxc(t) + Bce(t)

u(t) = Ccxc(t)

for the classical control, but it turns out not to be the best approach

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) = Ax(t) +BCc xc(t)

x c(t) = +Ac xc(t) +Bce(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)

x (t) A BCc x(t) 0 x(t)

= + r(t) C 0

x c(t) 0 Ac xc(t) Bc xc(t)

A BCc x(t) 0

= + r(t)

BcC Ac xc(t) Bc

x(t)

y(t) = C 0

xc(t)

Acl is not exactly the same as on page 15-2 because we have re

arranged where the negative sign enters into the problem. Same

result though.

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

x cl (t) = Acl xcl (t) + Bcl N r(t)

y(t) = Ccl xcl (t)

1

N = Ccl (Acl )1Bcl

November 5, 2010

Fall 2010 16.30/31 159

0 1 0

A= , B= , C= 1 0 , D=0

1 1 1

i(A BK) = 4 4j K = 31 7

Regulator pole time constant c = 1/n 1/4 = 0.25 sec

Use real poles, so e(s) = (s + 10)2

1

C 0

L = e(A)

CA 1

2 1

0 1 0 1 100 0 1 0 0

= + 20 +

1 1 1 1 0 100 0 1 1

99 19 0 19

= =

19 80 1 80

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;

U

Gc(s) = Cc(sI Ac)1Bc

E

s + 2.553

= 1149

s2 + 27s + 264

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

0

5 0.975

0.91

10

15

20 15 10 5 0 5

Real Axis

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.

Looks like a lead compensator.

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

0

50 0.985

0.94

100

150 0.86

200

250 200 150 100 50 0 50 100 150

Real Axis

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.

Note sure what this looks like.

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';

Lest = 31.500 5.2985 7.854 122.6895 121.7798 54.858

Much larger that LQR gains because the poles are moving further

November 5, 2010

Fall 2010 16.30/31 1528

1 na=size(Ap,1);

2 % Form compensator and closedloop

3 % see 155

4 ac=ApBp(:,1)*KlqrKest*Cp(1,:);bc=Kest;cc=Klqr;dc=0;

5 Gc=ss(ac,bc,cc,dc);

6 % see 157

7 acl=[Ap Bp(:,1)*cc;bc*Cp(1,:) ac];bcl=[zeros(na,1);bc];ccl=[Cpbeta,zeros(1,na)];dcl=0;

8 Gcl=ss(acl,bcl,ccl,dcl);

because the augmented plant is (4+1+1) Gc pole-zero map and

closed-loop poles shown

3

Gc zeros

2 Gc poles

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

1 % B747 lateral dynamics

2 % Jonathan How, Fall 2010

3 % working from Matlab Demo called jetdemo

4 clear all;%close all

5 %

6 A=[.0558 .9968 .0802 .0415;

7 .598 .115 .0318 0;

8 3.05 .388 .4650 0;

9 0 0.0805 1 0];

10 B=[ .00729 0;

11 0.475 0.00775;

12 0.153 0.143;

13 0 0];

14 C=[0 1 0 0; 0 0 0 1];D=[0 0; 0 0];

15 sys = ss(A,B,C,D);

16 set(sys, 'inputname', {'rudder' 'aileron'},...

17 'outputname', {'yaw rate' 'bank angle'});

18 set(sys, 'statename', {'beta' 'yaw rate' 'roll rate' 'phi'});

19 [Yol,Tol]=initial(ss(A,B,[1 0 0 0],zeros(1,2)),[1 0 0 0]',[0:.1:30]);

20 [V,E]=eig(A)

21 %

25 %

28 %

29 Gp=WashFilt*sys*H;

33 [Ap,Bp,Cp,Dp]=ssdata(Gp);

34 [Klqr,S,Elqr]=lqr(Ap,Bp(:,1),Cp(1,:)'*Cp(1,:),0.1);rifd(Elqr)

35 %

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

101

102 figure(4);clf

103 rlocus(Gp(1,1)*Gc);axis([5.5 .5 3 3])

104 hold on

105 [p,z]=pzmap(Gp(1,1));

106 plot(p+sqrt(1)*eps,'rx','MarkerFace','r')

107 plot(z+sqrt(1)*eps,'ro','MarkerFace','r')

108 [p,z]=pzmap(Gc(1,1));

109 plot(p+sqrt(1)*eps,'mx','MarkerFace','m')

110 plot(z+sqrt(1)*eps,'mo','MarkerFace','m')

111 p=eig(acl);

112 plot(p+sqrt(1)*eps,'bd')

113 hold off

114 export fig b747 lqr4 pdf

115

116 % initial comp at zero

117 [Ycl,Tcl]=initial(Gcl,[xp0;xp0*0],Tol); %'

118

119 figure(3);clf

120 plot(Tol,Yol,T,Y(:,1),Tgain,Ygain,Tcl,Ycl(:,1));axis([0 30 1 1]);

121 setlines(2)

122 legend('OL','LQR','Gain','DOFB')

123 ylabel('\beta');xlabel('Time')

124 grid on

125 export fig b747 lqr3a pdf

126

127 figure(6);clf

128 plot(T,Y(:,1).2,Tcl,Ycl(:,1).2,T,Y(:,2).2,Tcl,Ycl(:,2).2);

129 axis([0 10 0 1]);

130 hold off

131 setlines(2)

132 legend('LQR x2','DOFB x2','LQR u2','DOFB u2')

133 ylabel('x2 and u2');xlabel('Time')

134 grid on

135 export fig b747 lqr3b pdf

November 5, 2010

Fall 2010 16.30/31 1532

using torque inputs on the larger spacecraft (J1 = 1)

Sensor is star tracker on payload (angle), and actuator is torque

applied to spacecraft

10bs + 10k

Plant: Gp(s) = , k = 0.1 and b = 0.005

s2(s2 + 11bs + 11k)

3s + 1

Klead(s) = 1.5

s+5

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)

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

3

2 1.5 1 0.5 30 0.5 1

Real Axis

November 5, 2010

Fall 2010 16.30/31 1533

ible modes are driven unstable by the lead controller

The problem with the lightly damped poles is that the loop phase

changes very rapidly get wrong departure angle for the root locus.

Can improve the design using notch ltering

The notch has a lightly damped zero pair at a frequency just below the

resonant frequency of the system, resulting in a rapid phase change,

but in the opposite direction.

Result is that the departure angle now to the left, not the right.

Fixes instability problem - but damping of the resonant pole is

quite limited need to nd a better location for the notch zeros.

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)

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

in the weights

1 kk=0.1;bb=0.05*sqrt(kk/10);J1=1;J2=0.1;

2 a=[0 1 0 0;kk/J2 bb/J2 kk/J2 bb/J2;0 0 0 1;kk/J1 bb/J1 kk/J1 bb/J1];na=size(a,1);

3 b=[0 0 0 1/J1]';c=[1 0 0 0];d=0;

4 k=lqr(a,b,c'*c,.1);

5 l=lqr(a',c',b*b',.01);l=l'

6 %

7 % For state space for G c(s)

8 %

9 ac=ab*kl*c;bc=l;cc=k;dc=0;

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

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

a dynamic output feedback controller

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

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #16

Fall 2010 16.30/31 162

Reference Input - II

changing to feedback on

e(t) = r(t) y(t)

r e u y

Gc(s) Gp(s)

Intuitively appealing because same approach used for classical

control, but it turns out not to be the best.

u(t) = Ccxc(t) + N r(t)

N performs the same role that we used it for previously.

Introduce G as an extra degree of freedom in the problem.

Following presents some observations on the impact of G

November 2, 2010

Fall 2010 16.30/31 163

the system, regardless of the selection of G and N , since

x (t) = Ax(t) + Bu(t) , y(t) = Cx(t)

x c(t) = Acxc(t) + Bcy(t) + Gr(t)

u(t) = Ccxc(t) + N r(t)

BCc

x (t) A x(t) BN

= + r(t)

x c(t) BcC Ac xc(t) G

x(t)

y(t) = C 0

xc(t)

So the closed-loop poles are the eigenvalues of

A BCc

BcC Ac

(same as 157 except in a dierent place, gives same closed-

loop eigenvalues) regardless of the choice of G and N

G and N impact the forward path, not the feedback path

original implementation, on 156 since the controller reduces

to:

x c(t) = Acxc(t) + Bc(y(t) r(t)) = Acxc(t) + Bc(e(t))

u(t) = Ccxc(t)

With Gc(s) = Cc(sI Ac)1Bc, then this compensator can be

written as u(t) = Gc(s)e(t) as before (since the negative signs

cancel).

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

x

= (A BcC)x(t) + BN r(t) ({A BcC}xc(t) + Gr(t))

= (A BcC)x (t) + BN r(t) Gr(t)

= (A BcC)x (t) + (BN G)r(t)

(t) by setting

G BN

November 2, 2010

Fall 2010 16.30/31 165

x c(t) = (A BK LC)xc(t) + Ly(t) + BN r(t)

u(t) = Kxc(t) + N r(t)

can be rewritten as:

x c(t) = (A LC)xc(t) + Ly(t) + Bu(t)

u(t) = Kxc(t) + N r(t)

So the control is computed using the reference before it is applied,

and that control is applied to both system and estimator.

of the system, then what does it change?

Recall that zeros of SISO y/r transfer function solve:

sI A BCc BN

general det BcC sI Ac G = 0

C 0 0

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.

DOFB control, the closed-loop transfer function will be of the form:

Y (s) (s)b(s)

T (s) = = Kg

R(s) e(s)c(s)

Designer determines c(s) and e(s)

Plant zeroes b(s) remain, unless canceled out

Many choices for (s) the one called new sets it to

(s) e(s)

November 2, 2010

Fall 2010 16.30/31 167

As before, this can be done by selecting N so that the DC gain of

the closed-loop y/r transfer function is 1.

1

y

A BCc B

C 0 N =I

r DC BcC Ac B

u(t) = Ccxc(t) + N r(t)

Selection of N ensures good steady-state performance

new implementation gives better transient performance.

November 2, 2010

Fall 2010 16.30/31 168

sI Acl Bcl

det = det(sI Acl ) det(0 Ccl (sI Acl )1Bcl )

Ccl 0

= e(s)c(s) det(Ccl (sI Acl )1Bcl )

= e(s)c(s) Ccl (sI Acl )1Bcl

steps.

I 0

First note if T = so that T = T 1, then

I I

(sI Acl )1 = T T 1(sI Acl )1T T 1

= T (sI T Acl T )1T

where

A BK BK

T Acl T Acl =

0 A LC

1

sI (A BK) BK

(sI Acl )1 = T T

0 sI (A LC)

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

1 BN

(sI Acl )

C 0

BN

BN

= C 0 T T

0 (sI (A LC))1 BN

(sI (A BK))1 (sI (A BK))1 BK(sI (A LC))1

BN

= C 0

0 (sI (A LC))1 0

= C(sI (A BK))1 BN = Cadj[sI (A BK)]BN c (s)1

sI Acl Bcl

det = e (s)c (s) det(Ccl (sI Acl )1 Bcl )

Ccl 0

= e (s)c (s) Cadj[sI (A BK)]BN c (s)1

= e (s) Cadj[sI (A BK)]BN

1 0

(sI Acl )

C 0

L

(sI (A BK))1 (sI (A BK))1 BK(sI (A LC))1

0

= C 0 T 1 T

0 (sI (A LC)) L

1

(sI (A BK)) (sI (A BK))1 BK(sI (A LC))1

0

= C 0

0 (sI (A LC))1 L

= C(sI (A BK))1 BK(sI (A LC))1 L

sI Acl Bcl

det = e (s)c (s) det(Ccl (sI Acl )1 Bcl )

Ccl 0

= e (s)c (s) Cadj[sI (A BK)] BK adj[sI (A LC)]Le (s)1 c (s)1

= Cadj[sI (A BK)] BK adj[sI (A LC)]L

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

target poles at 4 4j and estimator target poles at 10.

So dominant poles have n 5.5 and = 0.707

From these closed-loop dynamics, would expect to see

1 + 1.1 + 1.4 2

10-90% rise time tr = n = 0.44s

n

Time to peak amplitude tp = = 0.79s

n 1 2

Now compare step responses of new and original implementations

1.4

Original

New

1.2

0.8

Y

0.6

0.4

0.2

0

0 0.5 1 1.5 2 2.5

Time (s)

criteria quite well - and certainly much better than the original

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)

101 xlabel('Freq (rad/sec)');ylabel('Mag')

102 legend('Loop L');

103 grid

104 subplot(212)

105 semilogx(f,180/pi*phase(L.'),[.1 1e3],180*[1 1],'LineWidth',2);

106 axis([.1 1e3 290 0])

107 xlabel('Freq (rad/sec)');ylabel('Phase (deg)');grid

108 %

109 % loop dynamics L = G Gc

110 % see 156

111 al=[a b*cc;zeros(na) ac];bl=[zeros(na,1);bc];cl=[c zeros(1,na)];dl=0;

112

113 figure(fig);fig=fig+1;clf

114 margin(al,bl,cl,dl);

115 figure(fig);fig=fig+1;clf

116 rlocus(al,bl,cl,dl)

117 hold on;

118 plot(eig(acl)+eps*j,'bd','MarkerFaceColor','b')

119 plot(eig(a)+eps*j,'mv','MarkerFaceColor','m')

120 plot(eig(ac)+eps*j,'rs','MarkerSize',9,'MarkerFaceColor','r')

121 plot(tzero(ac,bc,cc,dc)+eps*j,'ro','MarkerFaceColor','r')

122 hold off;grid on

123 %

124 % closedloop freq response

125 %

126 figure(15);clf

127 loglog(f,abs(g),f,abs(gcl1),f,abs(gcl2),'','LineWidth',2);

128 axis([.1 1e3 .01 1e2])

129 xlabel('Freq (rad/sec)');ylabel('Mag')

130 legend('Plant G','Gcl unscaled','Gcl scaled');grid

131

132 figure(fig);fig=fig+1;clf

133 loglog(f,abs(g),f,abs(gcl1),f,abs(gcl2),f,abs(gcl3),'','LineWidth',2);

134 axis([.1 1e3 .01 1e2])

135 xlabel('Freq (rad/sec)');ylabel('Mag')

136 legend('Plant G','Gcl1','Gcl2','Gcl3');grid

137

138 ZZ=1+.1*exp(j*[0:.01:1]*2*pi);

139 figure(fig);fig=fig+1;clf

140 semilogy(unwrap(angle(L))*180/pi,abs(L))

141 hold on;

142 semilogy(unwrap(angle(ZZ))*180/pi360,abs(ZZ),'g')

143 hold off

144 axis([270 100 .1 10])

145 hold on;plot(180,1,'rx');hold off

146 if max(real(eig(a))) > 0

147 title('Nichols: Unstable Openloop System')

148 else

149 title('Nichols: Stable Openloop System')

150 end

151 ylabel('Mag');xlabel('Phase (deg)')

152

153 figure(fig);fig=fig+1;clf

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

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #17

DOFB Servo

Handling saturations in DOFB

Fall 2010 16.30/31 171

LQ Servo Revisited

steady state error that is a bit more robust to modeling errors than

the N formulation.

An issue with this architecture is that the response to the reference

is only driven by the integrated error there is no direct path

from the reference input to the system

transient might be slow.

added extra states xI , where

x I = e

Then penalize both x and xI in the cost

Caveat: note we are free to dene e = r y or e = y r, but

the implementation must be consistent

are modied to be

x A 0 x Bu 0

= + u+ r

x I Cy 0 xI 0 I

T

T

T

and dene x = x xI

T T

J= x Rxxx + u Ruuu dt

0

is of the form:

x

u = [ K KI ] = Kx

xI

Fall 2010 16.30/31 172

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)

of the e through R.

This actually adds another feedback loop, so we need to clarify

how this is done.

Fall 2010 16.30/31 173

Design Approach

u = K (x

+ Re) KI xI

Note that the tracking error is in the output of the integrator and

the state feedback components.

So this approach has the potential to correct the slow response

problems identied in the original implementation.

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.

state vector x = [x, v, . . .]T , and y = x = Cx

Scalar position reference r, and e = r y, x I = e

In this example it is clear that we have

x 1 x

0= 0 v

.

.

. ... ...

1 0

T = 0 and T = 1

. . . ...

Fall 2010 16.30/31 174

So the control is

u = K(x

+ Re) KI xI

= K(x

+ R[r y]) KI xI

= K(x

RCx +Rr) KI xI

key

x

RCx = T x (T )x = x

Then the control signal becomes:

u = K(x + Rr) KI xI

in the feedback the elements of x are not fedback more that

once

Appears to be useful to choose R = C T , with < 1

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

Fall 2010 16.30/31 175

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

Fall 2010 16.30/31 176

1 % LQR servo

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

Fall 2010 16.30/31 177

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)

A BK 0

x x

= LC A LC BK BKI + 0 r

x

x

C 0 0 I

x

y = C 0

x

Fall 2010 16.30/31 178

System

(s + 2)

G(s) =

(s 1)(s s + 2)

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

that the compensator zeros are close to the plant poles.

October 17, 2010

Fall 2010 16.30/31 179

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

Int Penalty 1

Nbar Form

0

0 1 2 3 4 5

time

Fig. 5: Step response of the DOFB servo interplay now between the various

weightings - all give zero SS error, but transient response quite dierent.

Fall 2010 16.30/31 1710

DOFB Servo II

transient response.

Consider same modication as on 17-2 and add a more direct

feedback of parts of e other than through integrator state.

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

= (A LC)x

x + Bu + Ly

x I = e = r y

Note: can also dene an error based on the state estimate

e = r y

= r Cx

on 17-4):

u = K(T x

+ Re) KI xI

= K(T x

+ R(r Cx )) KI xI

= K((T RC)x + Rr) KI xI

Again set RC = T , so T RC = I and

u = K(x

+ Rr) KI xI

= Kx

KRr (8)

Fall 2010 16.30/31 1711

1.4

1.2

1

Response

0.8

0.6

0.4

Int Penalty 10 with R

Nbar Form

0

0 1 2 3 4 5

time

Fig. 6: DOFB servo step response with and without R formulations compared to

N formulation (see Figure 5).

A BK BKR

x x

= LC A LC BK BK I + BKR r

x

x

C 0 0 I

x

y = C 0

x

(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.

Fall 2010 16.30/31 1712

compensator both see u = Kx .

If actuator saturates, then possible that the system sees

if u>

sat(u) = u if <u<

if u <

ied so that it also sees sat(u) rather than u.

= (A LC)x

x + Bsat(u) + Ly

u = Kx

sat(u) y

sat() Gp(s)

K = (A LC)

x x + Bsat(u) + Ly

x

Fall 2010 16.30/31 1713

1 % DOFB servo

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')

Fall 2010 16.30/31 1714

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

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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.

Plant:

x = Ax + Buu, x(t0) = x0

z = Cz x

Cost:

tf

1 T 1

JLQR =

2 0 2

Where Rzz > 0 and Ruu > 0

Dene Rxx = CzT RzzCz 0

This is not necessarily specied to be a feedback controller.

straints being the dynamics of the system.

November 5, 2010

Fall 2010 16.30/31 183

Constrained Optimization

add them to the cost using a Lagrange multiplier

Results in an unconstrained optimization.

c(x, y) = x + y + 2 = 0

2

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 f (x, y) + c(x, y) = x2 + y 2 + (x + y + 2)

Where is the Lagrange multiplier

Note that if the constraint is satised, then L f

point of f (x, y) (f /x = f /y = 0)

With constraints we nd the stationary points of L

L L L

= = =0

x y

which gives

L

= 2x + = 0

x

L

= 2y + = 0

y

L

= x + y + 2 = 0

x = y = 1

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

fact that the cost involves an integration over time

See 16.323 OCW notes for details

constraints in the problem (the system dynamics) to the cost (inte

grand, then integrate by parts) to form the Hamiltonian:

1 T

x Rxxx + uT Ruuu + pT (Ax + Buu)

H =

2

p Rn1 is called the Adjoint variable or Costate

It is the Lagrange multiplier in the problem.

T

1. x = H = Ax + Buu with x(t0) = x0

p

T

2. p = H = Rxxx AT p with p(tf ) = Ptf x(tf )

x

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

1 T

x = Ax + Buu = Ax BuRuu Bu p

which can be combined with equation for the adjoint variable

p = Rxxx AT p = CzT RzzCz x AT p

1 T

x A BuRuu Bu x

=

p CzT RzzCz AT p

which is called the Hamiltonian Matrix.

Matrix describes closed loop dynamics for both x and p.

Dynamics of x and p are coupled, but x known initially and p

known at terminal time, since p(tf ) = Ptf x(tf )

Two point boundary value problem typically hard to solve.

it is relatively easy to show that:

1. p = P x

2. It is relatively easy to nd P .

1 T

0 = AT P + P A + Cz T RzzCz P BuRuu Bu P

Which, is the matrix algebraic Riccati Equation.

1 T 1 T

uopt = Ruu Bu p = Ruu Bu P x = Kx

linear feedback on the full system state

November 5, 2010

Fall 2010 16.30/31 187

errors and the control eort.

Easy design iteration using Ruu

Sometimes dicult to relate the desired transient response to the

LQR cost function.

Particularly nice thing about the LQR approach is that the designer

is focused on system performance issues

Turns out that the news is even better than that, because LQR ex

hibits very good stability margins

1 T

J = z z + uT u dt

2 0

x = Ax + Buu, z = Cz x, Rxx = CzT Cz

z

Cz

r x

Bu (sI A)1 K

Loop transfer function L(s) = K(sI A)1Bu

Cost transfer function C(s) = Cz (sI A)1Bu

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

1

|1 + L(j)|2 = 1 + |C(j)|2 1

November 5, 2010

Fall 2010 16.30/31 189

unit circle centered at (1, 0).

4

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

But what if the model is wrong and it turns out that the actual loop

transfer function LA(s) is given by:

LA(s) = LN (s)[1 + (s)], |(j)| 1,

will change the decision about closed-loop stability

can do this directly by determining if it is possible to change the

number of encirclements of the critical point

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

If open-loop system is stable, then any (0, ) yields a stable

closed-loop system. For an unstable system, any (1/2, )

yields a stable closed-loop system

gain margins are (1/2, )

Phase margins of at least 60

Both of these robustness margins are very large on the scale of what

is normally possible for classical control systems.

stable OL

3

|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

Fall 2010

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

in this course) and an optimal regulator to design the controller, the

compensator is called

Linear Quadratic Gaussian (LQG)

Special case of the controllers that can be designed using the sep

aration principle.

system is guaranteed.

The designer is freed from having to perform any detailed mechanics

- the entire process is fast and automated.

Designer can focus on the performance related issues, being con

dent that the LQG design will produce a controller that stabilizes

the system.

Selecting values of Rzz , Ruu and relative sizes of Rww & Rvv

state space tools are very sensitive to errors in the knowledge of the

model.

i.e., the compensator might work very well if the plant gain = 1,

but be unstable if = 0.9 or = 1.1.

LQG is also prone to plantpole/compensatorzero cancelation,

which tends to be sensitive to modeling errors.

tions on Automatic Control, Vol. 23, No. 4, pp. 756-757, 1978.

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.

good, but one important criterion is whether there is a reasonable

chance that it would work on the real system as well as it

does in Matlab. Robustness.

The controller must be able to tolerate some modeling error, be

cause our models in Matlab are typically inaccurate.

Linearized model

Ignores some higher frequency dynamics

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

Cart with an inverted pendulum on top.

m, l

L

F

Can develop the nonlinear equations for large angle motions

Linearize for small

(M + m)x + bx mL = F

2 2 2

(I + ml )s mgL mLs (s) 0

2 2 =

mLs (M + m)s + bs x(s) F

which gives

(s) mLs2

=

F [(I + ml2)s2 mgL][(M + m)s2 + bs] (mLs2)2

x(s) (I + ml2)s2 mgL

=

F [(I + ml2)s2 mgL][(M + m)s2 + bs] (mLs2)2

x 1.818s2 + 44.55

= 4

F s + 0.1818s3 31.18s2 4.45s

which has poles at s = 5.6, s = 0, and s = 0.14 and plant zeros

at 5.

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

choice of the weighting matrices.

This is somewhat expected. (why?)

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

bility margins.

sure of stability, or not.

critical point as a measure of closeness to changing the number of

encirclements.

Closeness translates to high sensitivity which corresponds to LN (j)

being very close to the critical point.

Ideally you would want the sensitivity to be low. Same as saying

that you want L(j) to be far from the critical point.

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

10 1.05

1

1.04 0.99

1.01

1.03

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

hard for L(j) to get too far away from the critical

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.

actual system is slightly dierent.

Basic analysis tool is the Sensitivity Plot

improve any lack of robustness

Apart from the obvious lower the controller bandwidth approach.

And sometimes you need the bandwidth just to stabilize the system.

See my Ph.D. thesis in 1992.

Other tools have been developed that allow you to directly shape the

sensitivity plot |S(j)|

Called H and

but it is not always an issue.

November 5, 2010

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #20

Eective Delay

Emulation

Fall 2010 16.30/31 201

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

A2D Gc(s) D2A Gp(s)

yk A2D

Digital Computer

November 5, 2010

Fall 2010 16.30/31 202

Digital/discrete control runs on a clock

Only uses the input signals at discrete instants in time

So continuous e(t) is sampled at xed periods in time e(kTs)

Where Ts is the sampling period and k is an integer

Requires A/D and D/A operations

1. Convert a physical signal (voltage) to a binary number, which is

an approximation since we will only have a 12-16 bits to cover a

10V range.

2. Sample a continuous signal e(t) every Ts seconds so that

y(t) y(k)

Ts

y(t) y(k)

November 5, 2010

Fall 2010 16.30/31 203

1. Binary to analog

2. Convert discrete signal (at kTs) to a continuous one.

u(k)

u(t) ?

k=1 1 2 3 4 5 6 7 hold u(k) for period Ts

Basic approach is to just hold the latest value of u(k) for the entire

periods Ts

Called a zero-order hold (ZOH)

might have on the loop transfer function

Approximate the A/D as sample

Approximate D/A as ZOH

Set control law to 1, so u(k) = e(k)

Ts

u(k) = y(k)

y(t) ZOH u(t)

November 5, 2010

Fall 2010 16.30/31 204

Can actually analyze the transfer function U (s)/E(e) analytically

Can also gain some insight by looking at basic signals

Smoothed u(k) by connecting mid-points u(t)

So sampled and held e(t) looks like input e(t), but delay is obvious.

hold is Ts/2 on average

Can be a problem if Ts is too large

November 5, 2010

Fall 2010 16.30/31 205

Key point is that Ts is how long we have to compute the control

command given the measurements received

Time

A/D and D/A operations depend on the complexity of the algorithm

and the quality of the equipment

But quality cost

2

Typically would set sampling frequency 2 = Ts 15BW

November 5, 2010

Fall 2010 16.30/31 206

Control Law

Basic compensator

s + z U (s)

Gc(s) = Kc =

s + p E(s)

u + pu = Kc(e + ze)

- need to approximate the dierentials

1 uk+1 uk

u |t=kTs [u((k + 1)Ts) u(kTs)]

Ts Ts

This uses the forward approximation, but others exist

uk+1 uk ek+1 ek

+ puk = Kc( + zek )

Ts Ts

or

uk+1 = (1 pTs)uk + Kcek+1 Kc(1 zTs)ek

which is a recursive dierence equation, that can easily be imple

mented on a computer.

x c = Acxc + Bce

u = Ccxc + Dce

xc (k+1)xc (k)

and x c Ts so that

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

rk+1, form ek+1

uk+1 = (1 pTs)uk + Kcek+1 Kc(1 zTs)ek

Then let uold = (1 pTs)uk Kc(1 zTs)ek , so that

uk+1 = Kcek+1 + uold

Also dene constants 1 = (1 pTs) and 2 = Kc(1 zTs)

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

extra

cTs 180 c2 180 c

= = 180

2 2s s

to the PM to account for the delay.

With s 15BW , delay eects are small, and the cts and discrete

controllers are similar

Lots of dierent conversion approaches depending on what proper

ties of the continuous controller you want to preserve.

November 5, 2010

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #21

Describing Function Analysis

Fall 2010 16.30/31 212

NL Example

x + (x2 1)x + x = 0

which can be written as linear system

G(s) =

s2 s + 1

f (x, x)

G(s)

on the value of

4

0

x

2

=1

3 =2

=0.2

4

3 2 1 0 1 2 3 4

x

Sustained oscillation for a nonlinear system, of the type above

Fall 2010 16.30/31 213

x(t) = A sin(t) so that x (t) = A cos(t)

Note that A and are not known, and may not actually exist.

q(t) = x2x = A2 sin2(t)A cos(t)

A3

= (cos(t) cos(3t))

4

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

this nonlinearity by dening that:

A2j

q = N (A, )(x) N (A, ) =

4

which approximates the eect of the nonlinearity as a frequency re

sponse function.

N (A, ) G(s)

Fall 2010 16.30/31 214

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

case (i.e. a limit cycle) of amplitude 2 and frequency 1.

This is consistent with the response seen in the plots - independent

of we get sustained oscillations in which the x(t) value settles

down to an amplitude of 2.

Note that does impact the response and changes the shape/fea

tures in the response.

Fall 2010 16.30/31 215

proach.

A sin t.

Would expect that the output y = f (x) is a complex waveform,

which we represent using a Fourier series of the form:

y(t) = b0 + (an sin nt + bn cos nt)

n=1

harmonics of the ingoing signal.

In general we would expect these harmonics to pass through the

system G(s) and show up in the input to the nonlinearity

Would then have a much more complicated input for x(t), leading

to a more complex output y(t) non-feasible analysis path

The fundamental yf = a1 sin t+b1 cos t is signicantly larger

in amplitude than the harmonics

The linear system G(s) acts as a low-pass that attenuates the

harmonics more strongly than the fundamental.

Fall 2010 16.30/31 216

function of the nonlinearity becomes

yf

N=

x

2/ 2/

a1 = y(t) sin t dt b1 = y(t) cos t dt

0 0

Note that will often nd that N is a function of the amplitude A

and the frequency .

Then (setting = 1 for simplicity, since the solution isnt a function

of )

1 2 2

4T

a1 = y(t) sin t dt = T sin t dt =

0 0

Nonlinearity is odd (i.e., y(t) = y(t)), so bi = 0 i

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

Fall 2010 16.30/31 217

Saturation Nonlinearity

T if e > T

u = f (e) = e if T e T

T if e < T

caps the output to a value T .

Saturation is an odd function

Assume e(t) = A sin t and A > T , and nd T so that

T

e(tT ) = A sin T = T T = arcsin

A

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

2

2 T T T

N (A) = arcsin + 1

A A A

Fall 2010 16.30/31 218

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.

Fall 2010 16.30/31 2113

both N and G is given by the condition that there be a nonzero

solution to the equation

1

GN + 1 = 0 G =

N

Nyquist plot of G(s) and the DF (1/N )

If N is real, then 1/N is along the negative real line

from G(j) at the intersection point gives the frequency of the

oscillation

A from the expression for N for the particular value associated

with the intersection point.

Fall 2010 16.30/31 2114

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

1 A

=

N 4T

which is on negative real line moving to left as A increases.

KT1T2

s=

(T1 + T2)

with corresponding = 1/ T1T2

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

Fall 2010 16.30/31 2115

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)

Can we prove that this limit cycle is stable or unstable?

Fall 2010 16.30/31 2116

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

4

G

1

3

N

1

Imag

4

8 7 6 5 4 3 2 1 0

Real

Fall 2010 16.30/31 2117

N = F +jH

F 2 +H 2

and in this

case

2 2 2 2 2

2

4T 1 + 4T 4T

F 2+H 2 = =

A A A A A

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

4T , and then use

(G(jc)) to nd A.

With a Relay with Hysteresis, K=1.5 A=2.921

1

G

0.8 1

N

0.6

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

Fall 2010 16.30/31 2118

1.5

Relay

Saturation

1 Hyst

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.

Fall 2010 16.30/31 2119

Note greater separation in the amplitudes

With a Relay, K=1, A=1.5279 With a Saturation , K=1 A=1.3812

4 4

G G

1 1

3 3

N N

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

Fall 2010 16.30/31 2120

Now note that the saturation nonlinearity does not lead to a limit

cycle

With a Relay, K=0.7, A=1.0695 With a Saturation , K=0.7 A=Inf

4 4

G G

1 1

3 3

N N

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

Fall 2010 16.30/31 2121

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.

amplitude A if a limit cycle is initiated.

the left of the 1/N (A) point in the s-plane

With that change, G(s) would not encircle the critical pt, the

response would be stable and the amplitude of the signal (A)

would to decrease

Since the perturbation increase A, and response decreases it, the

limit cycle is stable.

1/N (A) point in the s-plane

G(s) would now encircle the critical point, the response would be

unstable and the signal amplitude (A) would increase

Since perturbation decreases A, and response increases it, limit

cycle is stable.

with increasing A pointing to the left of G(s)

Fall 2010 16.30/31 2122

Example

Im

Unstable L.C.

U S U

A

Re

Stable L.C.

Fall 2010 16.30/31 2123

1 % Examples of describing ftns

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');

Fall 2010 16.30/31 2124

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

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #22

Lyapunov Stability Analysis

Fall 2010 16.30/31 222

tems.

Formalizes idea that all systems will tend to a minimum-energy

state.

Lyapunovs stability theory is the single most powerful method

in stability analysis of nonlinear systems.

A point x0 is an equilibrium point if f (x0) = 0

Can always assume x0 = 0

Stable in the sense of Lyapunov if (arbitrarily) small devia

tions from the equilibrium result in trajectories that stay (arbitrar

ily) close to the equilibrium for all time.

Asymptotically stable if small deviations from the equilibrium

are eventually forgotten, and the system returns asymptotically

to the equilibrium point.

Exponentially stable if it is asymptotically stable, and the con

vergence to the equilibrium point is fast.

Fall 2010 16.30/31 223

Stability

Let x = 0 D be an equilibrium point of the system

x = f (x),

f (z)| L|y z| for all y, z I(x).

Smoothness condition for functions which is stronger than regular

continuity intuitively, a Lipschitz continuous function is limited

in how fast it can change. (see here)

A sucient condition for a function to be Lipschitz is that the

Jacobian f /x is uniformly bounded for all x.

The equilibrium point is

Stable in the sense of Lyapunov (ISL) if, for each 0,

there is = () > 0 such that

x(0) < lim x(t) = 0

t+

Exponentially stable if there exist , , > 0 s.t.

xe

x(0)

Unstable

Fall 2010 16.30/31 224

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

Powerful method based on concept of Lyapunov function

Lyapunovs second method

LF is a scalar function of the state that is always non-negative,

is zero only at the equilibrium point, and is such that its value is

non-increasing along systems trajectories.

bratory system is stable if the total energy is continually decreasing.

Fall 2010 16.30/31 225

librium point (i.e., {x0} D Rn), and a let there be a function

V : D R.

punov) if the V satises the following conditions (and if it does, it is

called a Lyapunov function):

1. V (x) 0, for all x D.

d V (x) dx(t)

V (x(t)) V (x(t)) =

dt x dt

V (x)

= f (x) 0

x

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.

that as x +, then V (x) +.

Such a function V is said radially unbounded

1A compact set is a set that is closed and bounded, e.g., the set {(x, y) : 0 x 1, x2 y x2 .

Fall 2010 16.30/31 226

positive denite (V (x) > 0 for all x = 0 and V (0) = 0.)

V (x) being positive semi-denite means V (x) 0 for all x, but

V (x) can be zero at points other than x = 0.)

i) V (x) = x21 + x22 PD, PSD, ND, NSD, ID

2x2

v) V (x) = x21 + 1+x22 PD, PSD, ND, NSD, ID

2

Fall 2010 16.30/31 227

Example 1: Pendulum

the mechanical energy in the system

Consider a pendulum:

g

= sin() c,

l

Setting x1 = , x2 = :

x 1 = x2

g

x 2 = sin(x1) cx2

l

1

V = ml2x22 + mgl(1 cos(x1))

2

Analysis:

V (0) = 0

V (x1, x2) 0

= cml2x22 0

Lyapunov.

But note that V is only NSD

Fall 2010 16.30/31 228

V (x) = M x2 = xT M T M x = xT P x

V (x) = x T P x + xT P x

= xT AT P x + xT P Ax

= xT (AT P + P A)x

function

V (x) = xT (AT P + P A)x = xT Qx, (Q > 0)

AT P + P A = Q

Not surprisingly, this is called a Lyapunov equation

Note that it happens to be the linear part of a Riccati equation

It always has a solution if all the eigenvalues of A are in the left

half plane (i.e., A is Hurwitz, and denes a stable linear system)

Fall 2010 16.30/31 229

x = Ax + Bu

AT P + P A P BR1B T P + Q = 0

and set u = Kx with K = R1B T P , the closed-loop system is

stable.

x = (A + BK)x

Can conrm this fact using the Lyapunov Thm.

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

Fall 2010 16.30/31 2210

dx 2

= x

dt 1+x

which has equilibrium points at x = 1 and x = 2.

dz 2

= z 1

dt 2 + z

which has an eq point at z = 0.

Then can show

2z

V = zz = z2 z

2+z

and 2 < z, which can be rewritten as 2 + z > 0, then have

V (2 + z) = 2z (z 2 + z)(2 + z)

= z 3 3z 2

= z 2(z + 3) < 0 z Br (r < 2)

point xe = 1 is locally asymptotically stable.

Fall 2010 16.30/31 2211

Example 5: Saturation

r e u 1

x2 1

x1

f (e) Ts s

e = x2

1 f (e)

x 2 = x2 +

T T

where it is known that:

u = f (e) and f () lies in the rst and third quadrants

e

f (e) = 0 means e = 0, and 0 f (e)de > 0

Assume that T > 0 so open loop stable

e

T

V = x22 + f ()d

2 0

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

Fall 2010 16.30/31 2212

Invariance Principle

punov function that is strictly decreasing away from the equilibrium.

Unfortunately, in many cases (e.g., in aerospace, robotics, etc.),

there may be situations in which V = 0 for states other than at

the equilibrium. (i.e. V is NSD not ND)

Need further analysis tool for these types of systems, since stable

ISL is typically insucient

x = f (x)

Let D be a (compact) positively invariant set, i.e., a set such

that if x(t0) , then x(t) for all t t0.

Let V : D R, such that V (x) 0 for all x .

Then, x(t) will eventually approach the largest positively invariant set

in which V = 0.

Note that positively invariant sets include equilibrium points and limit

cycles.

Fall 2010 16.30/31 2213

Invariance Example 1

Lyapunov function

Showed that V (x) = cml2x2 2

2

Thus previously could only show that V (x) 0, and the system

is stable ISL

on the x2 = = 0 axis

However, the only part of the x2 = 0 axis that is invariant is the

origin!

LaSalles invariance principle allows us to conclude that the pen

dulum system response must tend to this invariant set

Hence the system is in fact asymptotically stable.

Revisit Example 5:

V decreasing if x2 = 0, and the only invariant point is x2 = e = 0,

so the origin is asymptotically stable

Fall 2010 16.30/31 2214

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.

= x

31

, which

phase plane

V = (x

41

+ 2x

22

10)2

In a region about the LC, can show that

V = 8(x

10

6 4 2

1

+ 3x

2

)(x

1

+ 2x

2

10)

2

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.

Fall 2010 16.30/31 2215

Summary

system.

If we can nd a Lyapunov function, then we know the equilibrium

is stable.

However, if a candidate Lyapunov function does not satisfy the

conditions in the theorem, this does not prove that the equi

librium is unstable.

tions; however,

Often energy can be used as a Lyapunov function.

Quadratic Lyapunov functions are commonly used; these can be

derived from linearization of the system near equilibrium points.

used to construct polynomial Lyapunov functions.

negative semi-denite.

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

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

An overview of nonlinear control design methods

Extend applicability of linear design methods:

Gain scheduling

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

Gain scheduling

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.

Control Lyapunov functions

It is positive denite

V (0) = 0.

V V

V = f (x) + g (x)u 0.

x x

Dierential Flatness

A dynamical system

dx

= f (x, u),

dt

z = h(x, u).

state and input trajectories as a function of the at outputs and a nite

number of its derivatives, i.e., if one can nd a map such that

linearizability. (But more intuitive.)

A dierentially-at model of aircraft dynamics 1/4

and the reference acceleration pd .

0) we can

Based on these, and assuming coordinated ight (and hence p d =

get a set of reference wind axes:

The xw axis is aligned with the velocity vector pd , i.e., xw := p d /p d .

The acceleration can be written as

p

d = g + fI /m,

gravity vector.

The main sources of forces for an airplane are the engine thrust and lift. Both

are approximately contained within the symmetry plane of the aircraft. Hence,

the zw axis is chosen such that the (xw , zw ) plane contains fI .

The yw axis is chosen to complete a right-handed orthonormal triad.

A dierentially-at model of aircraft dynamics 2/4

The tangential acceleration1 at along the wind velocity vector (xw axis).

The normal acceleration an (along the zw axis).

The roll rate 1 around the wind velocity vector (xw axis).

frame, aw is the acceleration in the wind frame dened in the previous slide,

and R is a rotation matrix, computed as a function of p d , pd .

Dierentiating,

(3) w + Ra w = R( aw ) + Ra w .

pd = Ra

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

A dierentially-at model of aircraft dynamics 4/4

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

dened.

an = I V12 p d p dT (

pd g ) = 0: if the normal acceleration is zero, the roll

attitude is not well dened.

Incorporating aerodynamics and propulsive models

output pd (position trajectory) and inputs: (a t , 1 , a n ).

How can we control at , an (or their derivatives)?

The wing lift is

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().

Adding feedback

uniquely (modulo a 180 roll rotation) the corresponding state and control

input trajectories.

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

Tracking control law

e 0 I 0 e 0

d (3)

e = 0 0 I e + 0 u pd .

dt

e 0 0 0 e 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.

Some remarks

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:

cannot account for, e.g., a split-S maneuver.

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #23

Anti-windup

trol of Aerospace Systems, Lecture 21: Lyapunov Stability

Theory by Prof. Frazzoli

Fall 2010 16.30/31 232

Fg F

mg

dv

m = Feng + Faero + Ffrict + Fg .

dt

where

1

Faero = CdAv |v|,

2

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.

Astr

om and Murray: Feedback Systems, 2008

Fall 2010 16.30/31 233

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

Let us use the following numerical values (all units in SI):

Tm = 190, = 0.4, m = 420, 5 = 10, Cr = 0.01,

m = 1500, g = 9.81, = 1.2, CdA = 0.79.

For v = 25 (90 km/h, or 55 mph), we get u = 0.2497.

The linearization yields:

Adyn = 0.0134, Bdyn = 1.1837

1.1837

G(s) =

s + 0.0134

Fall 2010 16.30/31 234

Assume we want to maintain the commanded speed (cruise con

trol): we need to add an integrator.

A PI controller will work, e.g.,

s+1

C(s) = 1.5

s

25 sec

Fall 2010 16.30/31 235

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

0

del V s Add

Product

Constant 3 control Saturation

-K-

vbar

Gain 3

1.5s+1.5 Bdyn

Scope

s s-Adyn

control 1 Transfer Fcn

ubar

Fall 2010 16.30/31 236

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.

Fall 2010 16.30/31 237

What if the slope is a little steeper (say 4.85 degrees)?

What is wrong?

Once the input saturates, the integral of the error keeps increasing.

When the error decreases, the large integral value prevents the

controller from resuming normal operations quickly (the integral

error must decrease rst!) so the response is delayed

Idea: once the input saturates, stop integrating the error (cant do

much about it anyway!)

Fall 2010 16.30/31 238

Anti-windup Logic

KI if the input does not saturate;

KI =

0 if the input saturates

Another option is the following:

Compare the actual input and the commanded input.

If they are the same, the saturation is not in eect.

Otherwise, reduce the integral error by a constant times the dif

ference.

uint = Ki (e + Kaw (sat(u) u)) dt

ence is fedback to the integrator to so that eact = sat(u) u tends

to zero

Implies that the controller output is kept close to saturation limit.

The controller output will then change as soon as the error changes

sign, thus avoiding the integral windup.

If there is no saturation, the anti-windup scheme has no eect.

Fall 2010 16.30/31 239

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

Scope

s s-Adyn

control 1 Transfer Fcn

ubar

the error buildup in the integral term

Fall 2010 16.30/31 2310

Anti-windup Summary

when the (original) feedback loop is eectively opened by the satura

tion.

Prevent divergence of the integral error when the control cannot keep

up with the reference.

Maintain the integral errors small.

Fall 2010 16.30/31 2311

1 set(0, 'DefaultAxesFontSize', 12, 'DefaultAxesFontWeight','demi')

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);

Fall 2010 16.30/31 2312

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

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Topic #24

Bounded Gain Theorem

Robust Stability

Fall 2010 16.30/31 241

Basic setup:

di do

r e u y

Gc(s) G(s)

n

e = r (y + n)

= r (do + G(di + Gce) + n)

= S(r do n) SGdi

y = T (r n) + Sdo + SGdi

with

L = GGc, S = (I + L)1 T = L(I + L)1

e small

IS(j)I small 0 1

IT (j)I small 2

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

Fall 2010 16.30/31 242

Indirect that works on L itself classical control does this

Direct that works on S and T

If |L(j)| 1 S = (1 + L)1 L1 |S| 1, |T | 1

If |L(j)| 1 S = (1 + L)1 1 and T L |T | 1

So we can convert the performance requirements on S, T into spec

ications on L

(A) High loop gain Good command following & dist rejection

(B) Low loop gain Attenuation of sensor noise.

180 to maintain stability

Fall 2010 16.30/31 243

perfect tracking, we need e 0

want S 0 since e = Sr + . . .

ment is that it be small.

Direct approach is to develop an upper bound for |S| and then test

if |S| is below this bound.

1

|S(j)| < ?

|Ws(j)|

order), and then cascade them as necessary. Basic one:

s/M + B

Ws(s) =

s + B A

M > 1, and |1/Ws | 1 at B

Fall 2010 16.30/31 244

150

G(s) =

(10s + 1)(0.05s + 1)2

and a high frequency peak less than M = 5.

s/M + B

Ws =

s + B A

determining whether

|Ws(j)S(j)| < 1,

Avoids a graphical/plotting test, which might be OK for analysis

(a bit cumbersome), but very hard to use for synthesis

Fall 2010 16.30/31 245

Bounded Gain

|S(j)| < ,

Critically important test for robustness

x (t) = Ax(t) + Bu(t)

y(t) = Cx(t) + Du(t)

is bounded in the sense that

Gmax = sup |G(j)| = sup |C(jI A)1B + D| <

1. |D| <

A + B( 2 I DT D)1 DT C B( 2 I DT D)1 B T

H=

C T (I + D( 2 I DT D)1 DT )C AT C T D( 2 I DT D)1 B T

has no eigenvalues on the imaginary axis.

1 MIMO result very similar, but need a dierent norm on the TFM of G(s)

Fall 2010 16.30/31 246

" #

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.

But there are some key dierences from the LQR/LQE AREs

Fall 2010 16.30/31 247

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

1. Forming a state space model of the combined system Ws(s)S(s)

2. Use the bounded gain theorem with = 1

3. Typically use a bisection section of to nd |Ws(j)S(j)|max

150

G(s) = Gc = 1

(10s + 1)(0.05s + 1)2

Require B 5, a slope of 1, low frequency value less than

A = 0.01 and a high frequency peak less than M = 5.

In this case = 1.02, so we just fail the test - consistent with

graphical test.

Fall 2010 16.30/31 248

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)

1. Select u, l so that l Gmax u

Yes Stop (Gmax 12 (u + l ))

No go to step 3.

set u = and go to step 2.

Fall 2010 16.30/31 249

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

x 1 = Ax1 + B(r + y2) = Ax1 + BB T x2 + Br

x 2 = AT x2 C T y = AT x2 C T Cx

u = r + B T x2

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.

Fall 2010 16.30/31 2410

S = [I GG]1 has no poles there

I G*G I > 0 as (since D = 0).

Together, these imply that

|G(j)| < 1

which is true i

Gmax = max |G(j)| < 1

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 .

MIT OpenCourseWare

http://ocw.mit.edu

Fall 2010

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

- Analog and Digital Control System Design - ChenUploaded byEdisson Rangel Barajas
- 5.RuthUploaded byHassan Syed
- Vibration and tip deflection control of a Single-link flexible manipulator [ Pdf ].pdfUploaded byijicsjournal
- matlabUploaded byXagnik Basu Mallik
- Sensors and Actuators example questionsUploaded byTushar Mahajan
- Control Manual # 10-Fall 2015Uploaded byZain Ali
- rr420201-digital-control-systemsUploaded bySrinivasa Rao G
- Disain via RLUploaded byYusron Muttaqin
- Analog and Digital Control System DesignUploaded byUtsav Gautam
- TAMU, MEEN 364, 2014, ExamUploaded byAndrea Spencer
- SylllabusUploaded byThennarasu Ramachandran
- LAB4 ReportUploaded bySrinivas Gude
- midterm 28.04.2014Uploaded byDiana Rus
- Control System ManualUploaded byArivumani Velmurugan
- Introduction to SimulinkUploaded byCristhianCoyo
- Tugas 4 (Inverse Response Chapter 17)Uploaded byPKM KLAMPIS NGASEM
- CS Course FileUploaded byramanaidu1
- Control SystemsUploaded bydocsdownforfree
- 16Uploaded byJisoo Um
- AN6_XCS_Freq_resp_plot.docUploaded byMOHAMED IBRAHIM
- Solution Hw5Uploaded byz.hui196810
- Control_systems. TWO MARKSUploaded bydivya vaidhyanathan
- Mit Improved Filter Design in Internal Model ControlUploaded byDiego Quimbert
- Lecture 2Uploaded bycprabhakaran
- A Nonlinear Tracking Controller for a Haptic Interface Steer-By-wire SystemUploaded byFranciscoJoseManas
- Chapter 14Uploaded bySajjad Aslam
- two tankUploaded byOluwaseun Godson
- Appendix hUploaded byAbdullah1345
- Hybrid Schemes for Adaptive Control StrategiesUploaded bysjhsjh
- ch01Uploaded byTerius Kim

- Digital Control Syllabus 2013_2Uploaded byArmando Malone
- SP Robotics Course OutlineUploaded byOdi Alowiwi
- readme.txtUploaded byArmando Malone
- Robotics ABET Course Outline 150930Uploaded byArmando Malone
- RT2_160112Uploaded byArmando Malone
- En Cours 2017 Lfsab1104Uploaded byArmando Malone
- Digital Control Syllabus 2013_2.pdfUploaded byArmando Malone
- jha_proUploaded byArmando Malone
- 2Uploaded byArmando Malone
- 2005 - Advanced Robotic Manipulation_OussamaKhatibUploaded bynachoflores214793
- ReadmeUploaded byArmando Malone
- Chap 1Uploaded byKiran Kumar N
- IEEE Artcile Presentation StructureUploaded byArmando Malone
- README.TXTUploaded byArmando Malone
- m243bgrn (1)Uploaded byArmando Malone
- [Doi 10.1109%2Fpesgm.2014.6938870] Vargas, Miguel Angel; Garcia, Norberto -- [IEEE 2014 IEEE Power & Energy Society General Meeting - National Harbor, MD, USA (2014.7.27-2014.7.31)] 2014 IEEE PES GeneUploaded byArmando Malone
- Exam_RT1_2008_2Uploaded byArmando Malone
- OPFUploaded byArmando Malone
- [doi 10.1109%2Ficit.2008.4608553] Wang Yi-Bo, ; Wu Chun-Sheng, ; Liao Hua, ; Xu Hong-Hua, -- [IEEE 2008 IEEE International Conference on Industrial Technology - (ICIT) - Chengdu, China (2008.04.21-200.pdfUploaded byArmando Malone
- 09 Chapter 4Uploaded byArmando Malone
- Exam_RT1_2006_1Uploaded byArmando Malone
- 1681-7619-2-PB.pdfUploaded byArmando Malone
- Exam_RT1_2006_2Uploaded byArmando Malone
- SimulationofSmartGridPowerDispatch.pdfUploaded byArmando Malone
- 10.1016@j.epsr.2005.05.008.pdfUploaded byArmando Malone
- lec23Uploaded byArmando Malone
- Exam_RT1_2011_2_enUploaded byArmando Malone
- Academic Writing FSE 2018-19Uploaded byArmando Malone
- Exam_RT1_2011_1_enUploaded byArmando Malone
- ExerciseSet9_2017Uploaded byArmando Malone

- Modeling and Control of a Rotary Inverted PendulumUploaded bysalman
- (eBook - Electronics) - Principles of PLL - Tutorial (Kroupa 2000)Uploaded by양종렬
- Root Locus TechniqueUploaded byTammanurRavi
- Nr-220206 Control SystemsUploaded bySrinivasa Rao G
- Control System Lab ManualUploaded byVenkata Subramanian
- Matlab ManualUploaded byParul Thapar
- Root Location in the S-planeUploaded byWidya Astuti
- Chapter 10 PID ControlsUploaded byRiski SepTiadi Rasya
- Lec Notes 7 Root Locus DesignUploaded byFerhat Tekoğlu
- Control System Question BankUploaded byKarthik Nagarajan
- matlab8Uploaded byRobert Roig
- control systemsUploaded byAnonymous FRJktAGZm
- Exam Info Fee 09Uploaded byJie Rong
- Oral Question BankCS1Uploaded byOmkar Shete
- Control System TheoryUploaded byNishant Saxena
- EML_5311_Project_28_April_Ramin_ShamshiriUploaded byRaminShamshiri
- Ec6405 2m Rejinpaul IIUploaded byAnonymous xaeuoo4
- ee653_midsem_2017Uploaded byJivnesh Sandhan
- HW TemplateUploaded byDamien Raid Salah
- Identifying Break Points in Root Locus Using Bolzano TheoremUploaded byIJSTR Research Publication
- 1Uploaded bySteven Yang
- Digital Control TutorialUploaded byNatalia Bonilla
- Activity 05Uploaded byYvesExequielPascua
- B. R. Barmish - New Tools for Robustness of Linear SystemsUploaded byAndreza Cardoso
- Aircraft Longudinal Motion ControlBy Fuzzy LogicUploaded byManoj Choudhary
- 3rd Yr & 4th Yr Syllabus-EIEUploaded byJEEVANMECHATRONICS
- Chapter 8 Manual OgataUploaded byKalim Ullah
- Control System Design _ VisSimUploaded bypredic1
- Test 4Uploaded byRavinder Ranga
- Electrical Syllabus for CCC - BtechUploaded byPavan Kumar