You are on page 1of 31

METR4202 – Advanced Control & Robotics

Lecture 5

The z-Domain
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 1

Discrete Transfer Functions


Discrete Stability (Bilinear Transformation)
Discrete Control Design (Tustin Transformation)

Control Course Overview

G. Hovland 2004-2006

Continuous and Discrete Systems


Continuous Control System:

yref u y
Controller System
-
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 2

Discrete Control System:

D/A A/D
yref
Controller System
-
Digital to Analog (D/A) Converter

D/A Simple and effectively instantaneous


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 3

A/D Successive Approximation

Analog Input Signal

D/A Converter

Comparator
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 4

Circuit
Higher/
Lower

Binary search from MSB to LSB


Analog to Digital (A/D) Converter
Analog Signal Zero-order Sample and Hold
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 5

In general,
Quantisation
M / 2n voltage
Errors
levels.

A/D is not instantaneous

Digital vs Analog Analysis

If A/D could be made instantaneous, there would be no


need to differentiate between digital and analog control
systems.
In practice, A/D requires time (eg. comparator circuit).
We will need to model the sample-and-hold process.
Note that a system that is stable with an analog
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 6

controller, can become unstable with the same controller


but implemented as a digital controller with a slow
sampling rate.
Two Views of Sampling
Constant sampling times
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 7

a. switch opening
and closing;
b. product of time
waveform and
sampling waveform

The waveform view b) will be used Whenever you see * in the


in the following analysis following, it refers to the sampled
function!

Sample Pulse Function u(t) - u(t-Tw)


1 u(t)
Laplace of a step is
s 1

0 t
Tw
Laplace of a delayed step is
e − Tw s 1
u(t-Tw)
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 8

s
0 t
Tw
Laplace of a pulse is
1 − e − Tw s u(t) - u(t-Tw)
1
s
0 t
Tw
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 9 The Sampled Function f*Tw

T: pulse train period

k =∞
f *TW (t ) = f (t ) s(t ) = f (t ) k = −∞
u(t − kT ) − u (t − kT − Tw )

k: integer

The Sampled Function f*Tw

Assumption: Tw is small in comparison to T

f(t) is constant in sampling interval


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 10

f (t ) = f ( kT )
f ( kT )[u(t − kT ) − u(t − kT − Tw )]
k =∞
f *TW (t ) = k = −∞

f(kT) moved inside the summation


The Laplace Transform f*Tw F*Tw(s)

f ( kT )[u(t − kT ) − u(t − kT − Tw )]
k =∞
f *TW (t ) = k = −∞

k =∞ e −kTs e −kTs −Tw s


F *
Tw ( s) = f ( kT ) −
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 11

k = −∞
s s
k =∞ 1 − e −Tw s −kTs
= k = −∞
f ( kT ) e
s

Taylor Series Expansion of F*Tw(s)

k =∞ 1 − e −Tw s −kTs
F *
Tw ( s) = k = −∞
f ( kT ) e
s
(Tw s ) 2
1 − 1 − Tw s + −
k =∞ 2!
= k = −∞
f ( kT ) e −kTs
s
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 12

Assuming Tw small
k =∞
≈ k = −∞
f ( kT )Twe −kTs
Inverse Laplace Dirac delta function

k =∞
f *Tw (t ) = Tw k = −∞
f ( kT )∂ (t − kT )
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 13 Sampler Model: Uniform Rectangular Pulse Train

Sample waveform dependency


Ideal Sampler: (in this example rectangular
this will be used for pulse train)
further analysis

Ideal Sample and Hold


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 14

Individual step responses with length T

1 − e −Ts Delay T because step response


Gh ( s ) = ends at T
s
Summary so Far

Ideal Sampler
k =∞
f (t ) =
*
k = −∞
f ( kT )∂ (t − kT )

Zero-order Sample-and-Hold (z.o.h.)


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 15

1 − e −Ts
Gh ( s ) =
s

We are now ready to introduce the z-transform

The z-Transform (Nise Chapter 13.3)

Ideal Sampler
k =∞
f (t ) =
*
k =−∞
f (kT )∂(t − kT )
s-domain (Continuous control systems)
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 16

∞ −kTs
F ( s) =
*
k =0
f ( kT ) e

z-domain (discrete control systems)


z −1 = e −Ts
∞ −k
F ( z) = k =0
f ( kT ) z
Time delay!
Simple Example z-Transform

f(kT) = u(kT) - 2u([k-1]T) - 3u([k-2]T)

F(z) = 1 - 2z-1 - 3z-2


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 17

Each further delay increases exponent of z

Example 13.1
Find the z-transform of a sampled unit ramp
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 18

Open Form
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 19 Example 13.1 - cont'd

Note F(z) is closed-form while F*(s) is not. This is one reason why
the new z-transform is introduced. The Laplace F(s) is closed-form,
but the sampled F*(s) is not!

What is the Laplace transform F(s) of a ramp?

Partial Table of s- and z-Transforms


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 20

These 3 are the main ones you will use in practice


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 21 z-Transform Theorems

Example 13.4
Given a z.o.h. in cascade with G1(s) = (s+2) / (s+1) or

1 − e −Ts s + 2
G( s) =
s s +1
Find the sampled-data transfer function, G(z), if the sampling
time T=0.5 seconds
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 22

G(s) → G(z)

Zero-order-hold
1 − e − Ts G1(s)
G2 ( s ) =
s

By default, assuming sampled inputs and outputs


Example 13.4 - cont'd

Again, partial
fractions!

1 z
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 23


s z −1
1 z

s +1 z − e −T

z-Domain Stability
z −1 = e −Ts
z = eTs = eT (α + jω ) = eαT e jωT = eαT ∠ωT
α = 0 : eαT = 1 Region B (marginally stable)

α > 0 : eαT > 1 Region C (unstable)

α < 0 : eαT < 1 Region A (stable)


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 24
z-domain stability directly from s-domain

There is no equivalent Routh-Hurwitz stability criterion


for discrete control systems
A simple transformation allows us to check discrete
stability by transforming to s-domain and applying the
Routh-Hurwitz criterion as normal.
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 25

Bilinear transformations

z +1 s +1
s= z=
z −1 s −1

Bilinear Transformations
s = α + jω
(α + 1) + jω
z=
(α − 1) + jω
(α + 1) 2 + ω 2
z =
(α − 1) 2 + ω 2
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 26

z <1 when α < 0


Hence, the bilinear transformation
z >1 when α > 0 preserves the behaviour above!
z =1 when α = 0
Note: the transformation should not
be used for other purposes than
determining discrete stability!!
Example 13.8: Discrete Stability
Closed-Loop Discrete denominator: z 3 − z 2 − 0.2 z + 0.1
Use the Routh-Hurwitz criterion to determine stability

s +1
z= → s 3 − 19 s 2 − 45s − 17
s −1

How many
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 27

poles outside
the unit circle
in z-domain
does the system
have?

s-domain design, z-domain implementation

We want to re-use all the techniques we have developed


for continuous systems.
Ideally, we want to design everything in s-domain and
then convert to z-domain as the last step before
implementation on the real-time controller.
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 28

The Tustin approximation will allow us to do this


T
2 z −1 1+
s
s= z= 2
T z +1 1− s
T
2
This transformation yields a digital transfer function
whose output response at the sampling instants is
approximately the same as the analog transfer function.
s-domain to z-domain: Tustin Approximation

2 z −1 1977( s + 6)
s= Gc ( s ) ≈
T z +1 ( s + 29.1)

Sample time, choose T=0.01

200( z − 1)
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 29

1977( + 6)
Gc ( z ) = z + 1
200( z − 1)
+ 29.1
z +1
1977( 200 z − 200 + 6 z + 6)
=
200 z − 200 + 29.1z + 29.1
1977( 206 z − 194)
=
229.1z − 170.9
1778 z − 1674
=
z − 0.746

Example 13.12 - Verification

The effects of three


different sampling
times
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 30
Matlab / Simulink Discrete Control Functions

c2d: Converts continuous to discrete transfer


functions, example Gd = c2d(G,dt,'tustin')
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 31

Discrete Control Summary

z-transform provides closed-form transfer function for


sampled systems, (Laplace transform does usually not)
Stability analysis in z-domain required for sampled
systems
Bilinear transformation allows Routh-Hurwitz stability
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 32

test for z-domain roots


Tustin approximation allows us to design controllers as
usual in s-domain and convert the final result to z-
domain just prior to implementation
Main Themes of METR4202/7202

Frequency Phase and


Gain Margins Simple PD
Domain
Control Design
Analysis Overshoot, settling time (Bode Plots, 11.1-11.2)
(Nise Chapter 10.1-7) phase margin, bandwidth

Tustin
Discrete
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 33

Bilinear
Transformations Time Domain
Analysis
(Nise Chapter 13)
Desired
Polynomials

Signal-Flow charts
State-Space Pole placement State-Space
Control Design Observer Design
Similarity (Nise Chapter 12)
(Nise Chapter 12)
Transformations

Advantages / Disadvantages

Frequency Domain: (+) Easy to obtain models


experimentally through frequency responses. (-) Models
do not reveal the physical structure, only input-output
relationships.
Continuous Time Domain: (+) Models based on natural
laws (physics, chemistry, etc). Some states are more
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 34

important than others and controllers can be designed


accordingly. (-) More difficult to estimate model
parameters.
Discrete Time Domain: (+) Allows analysis of sample-
and-hold effects. (-) Requires controller design in z-
plane. (+) Tustin approximation allows us to re-use tools
from Frequency Domain.
Overview: Frequency Domain Analysis

Checklist

Polar Plots

Asymptotic Bode Plots: 1st and 2nd order zeros and poles *

The Nyquist Stability Criterion *


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 35

Sketching Nyquist Diagrams: Polar Plots positive, negative jw *

Gain and Phase Margins from Nyquist Plots *

Stability, Gain and Phase Margins from Bode Plots

* means that examples given in the following slides

Common Asymptotes

Figure 10.9
Normalised and
scaled
Bode plots for
a. G(s) = s;
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 36

b. G(s) = 1/s;
c. G(s) = (s + a);
d. G(s) = 1/(s + a)
The Final Statement of the Nyquist Criterion

The number of closed-loop


poles, Z, in the right half-plane
equals the number of open-
loop poles, P, that are in the
right half-plane minus the
number of counter-clockwise
revolutions, N, around -1 of
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 37

the mapping GH
Z=P–N
Only if Z=0, the system is
stable
Remember this !

Zeros of 1 + G(s) H(s) ⇔ Poles of G(s) / [1 + G(s) H(s) ]

Examples
Frequency Response
Polar Plots
Z=P-N

Figure 10.25
Mapping examples:
a. contour does
not enclose
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 38

closed-loop poles;
b. contour does
enclose
closed-loop poles

Class Question:
Are the closed-loop systems a,b stable or unstable?
Sketching the Nyquist Diagram (10.4)

Figure 10.26
a. Turbine and
generator;
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 39

b. block diagram
of speed control
system for
Example 10.4

Vector Evaluation of the Nyquist Diagram

a. vectors on contour
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 40

at low frequency;
b. vectors on contour
around infinity;
c. Nyquist diagram

Class Question:
Is the closed-loop system stable?
Example 10.7
K Double-check
G( s) = 2
( s + 2 s + 2)( s + 2) this calculation

4(1 − w2 ) − jw(6 − w2 ) yourself!


G ( jw) =
16(1 − w2 )2 + w2 (6 − w2 ) 2
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 41

Class Questions (use only positive jw axis):

a) Find the range of gain for stability and instability


b) For marginal stability find the radian frequency of oscillation

Example 10.7 - Solution


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 42

K
G( s) =
( s 2 + 2 s + 2)( s + 2)
4(1 − w2 ) − jw(6 − w2 )
G ( jw) =
16(1 − w2 ) 2 + w2 (6 − w2 ) 2
Gain and Phase Margin via Nyquist (10.6)

Figure 10.35
Nyquist diagram
showing gain
and phase
margins
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 43

Phase and Gain Margin in Bode Plots

Gain
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 44

Margin

Phase
Margin
Overview: State-Space Analysis and Design

State-Space Models: ABCD Form *

Controllability by Inspection: Parallel Form *

The Controllability Matrix *

Similarity Transformations *
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 45

The Transformation Matrix P via the Controllability Matrices *

Observability by Inspection: Parallel Form *

The Observability Matrix

The Transformation Matrix P via the Observability Matrices

Summary State Space Forms

Figure 5.31
State-space forms for

C (s) s+3
=
R( s ) ( s + 4)( s + 6)

y = c(t )
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 46

Controllability /Observability
by inspection
Phase-Variable Form
x1 0 1 0 0 x1 0
x2 0 0 1 0 x2 0
= + u
xn −1 0 0 0 1 xn −1 0
xn − a0 − a1 − an −1 xn 1
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 47

A Matrix
B Vector

0 1 0 0 Major
advantage of
0 0 1 0
the phase-
A − BK = variable and
0 0 0 1 controller
canonical
− ( a0 + k1 ) − ( a1 + k2 ) − ( an −1 + kn ) forms

Phase-Variable Form

Poles of uncontrolled system:

s n + an −1s n −1 + + a1s + a0 = 0

n system parameters to adjust


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 48

Poles of controlled system:

s n + ( an −1 + kn ) s n −1 + + ( a1 + k2 ) s + (a0 + k1 ) = 0
P from controllability matrix CM

For the original system


CMZ = [ B AB A2 B An −1B ]

For the transformed system

CMX = [ P −1B P −1 APP −1B ( P −1 AP ) 2 P −1B ( P −1 AP ) n −1 B ]


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 49

= P −1[ B AB A2 B An −1B] PP-1


terms
disappear
Hence, P = CMZ * CMX-1

In Matlab: P = ctrb(Az,Bz) * inv(ctrb(Ax,Bx))

P-matrix that gives phase-variable form


If we have the original system

z = Az z + Bz u
and the phase-variable form
x1 0 1 0 0 x1 0
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 50

x2 0 0 1 0 x2 0
= + u = Ax x + Bx u
xn −1 0 0 0 1 xn −1 0
xn − a0 − a1 − an −1 xn 1

P = ctrb(Az,Bz) * inv(ctrb(Ax,Bx)) will transform any


controllable system z to the phase-variable form x!!!!
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 51 Controller Design via State-Space (Ch. 12.1-4)

State-space formulation of the uncontrolled system:


x = Ax + Bu y = Cx
State-space formulation of the controlled system:

x = Ax + Bu = Ax + B( r − Kx ) = ( A − BK ) x + Br y = Cx

Example 12.1: State-Space Controller Design


Given the plant design the phase-variable
feedback gains to yield
20( s + 5)
G( s) = 9.5% overshoot and a
s( s + 1)( s + 4) settling time Ts of 0.74 sec.
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 52

4
= 0.60 wn = = 9.0
Tsζ

Desired poles: Should not


interfere with
( s 2 + 2ζwn s + wn )( s + p )
2 design requirements!
Example 12.1: Desired Poles
Bode plots

20( s + 5)
G1 ( s ) = and
( s + 5.1)( s 2 + 2ζwn + wn )
2

20
G2 ( s ) =
( s 2 + 2ζwn + wn )
2
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 53

In general:
Use extra poles to cancel
out zeros. If no cancellations
required, place poles far away
from 2nd order pole.

Example 12.1: Signal-Flow Diagram

20( s + 5)
G( s) =
s( s + 1)( s + 4)

How?

0 1 0
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 54

A= 0 0 1
0 −4 −5
C = [100 20 0]
Example 12.1: Controller Gains

0 1 0
A − BK = 0 0 1
− k1 − ( 4 + k2 ) − (5 + k3 )
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 55

Characteristic equation:

s 3 + (5 + k3 ) s 2 + ( 4 + k2 ) s + k1 = 0
Must match design requirements:
( s 2 + 2ζwn s + wn )( s + p ) = s 3 + 15.9 s 2 + 136.08s + 413.1
2

Controller gains by inspection:


k1 = 413.1, k2 = 132.08, k3 = 10.9

Controller design by transformation: Ex 12.4


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 56

Convert the signal-flow diagram above to the form


x = Ax + Bu
y = Cx
Ex 12.4: Check Controllability

0 0 1
CM = [ B AB A2 B ] = 0 1 − 3
1 −1 1
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 57

Is this system state controllable? Check by inspection

Ex 12.4: Transform to Phase-Variables

1 1
= 3
( s + 1)( s + 2)( s + 5) s + 8s 2 + 17 s + 10

x1 0 1 0 x1 0 Phase-variable
x2 = 0 0 1 x2 + 0 u form
− 10 − 17 − 8 x3
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 58

x3 1
0 0 1
CM = [ B AB A2 B ] = 0 1 −8
1 −8 47
1 0 0
−1
P = CMZ * CMX = 5 1 0
10 7 1
Ex 12.4: Desired Response
20.8% overshoot and settling time Ts=4.0
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 59

4
= 0.447 wn = = 2.24
Tsζ

Desired poles: We use the extra pole


to cancel the zero
( s 2 + 2ζwn s + wn )( s + p )
2

= ( s 2 + 2 s + 5)( s + 4) = s 3 + 6s 2 + 13s + 20

State-Feedback Controller

0 1 0
A − BK = 0 0 1
− (10 + k1 ) − (17 + k2 ) − (8 + k3 )

Desired:
( s 2 + 2ζwn s + wn )( s + p )
2
METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 60

= ( s 2 + 2 s + 5)( s + 4) = s 3 + 6s 2 + 13s + 20

By inspection: k1=10, k2=-4, k3=-2


State-Feedback Controller: Original

Korig = K * P-1 = [ -20 10 -2]


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 61

Verify design with


Y (s) desired poles
T (s) = = C( sI − A) −1 B + D
U (s)

Mid-Semester Class Test

Wednesday September 6 at 10:00am - 11:50am


Two Venues: Lecture Theatre (50-2)
GP-South Room 421 (20-25 seats)

Questions and Answers Session, September 5, 12-1pm


METR4202/7202 – Advanced Control & Robotics, Semester 2, 2006: Page: 62

GP South: Room 421