You are on page 1of 27

METR4200 – Advanced Control

Lecture 10

Digital Control Design

Chapter 13 Nise
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

(Except 13.8, 13.9, 13.11)

G. Hovland 2004

Digital Control Analysis and Design

 In this lecture
 Ideal Sampler and Second-Order Zero-and-Hold
 z-Transform
 Stability of discrete control systems
 Steady-state errors of discrete control systems
 Bilinear Transformation

 Why?
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

 Digital controllers can behave very differently from their analog


counterparts
 An analog control system can become unstable when digitised
 The step-response can change dramatically when digitised
 We need tools for analysing the effects of sampling
From Analog to Digital Control

Analog Controller
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Digital Controller

For example: Matlab/Simulink with xPC

Computer in the Loop

Figure 13.2
a. Placement of
the digital
computer within
the loop;
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

b. detailed block
diagram showing
placement of A/D
and D/A converters
Digital to Analog (D/A) Converter

D/A Simple and effectively instantaneous


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Analog to Digital (A/D) Converter


Analog Signal Zero-order Sample and Hold
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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
controller, can become unstable with the same controller
but implemented as a digital controller with a slow
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

sampling rate.

Two Views of Sampling


Constant sampling times

a. switch opening
and closing;
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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)
u(t)
1

0 t
Tw

u(t-Tw)
1

0 t
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Tw

u(t) - u(t-Tw)
1

0 t
Tw

The Sampled Function f*Tw

T: pulse train period


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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

f(kT) moved inside the summation

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

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


k =∞

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


F *
Tw ( s ) = ∑k = −∞ f ( kT )  − 
 s s 
k =∞ 1 − e −Tw s  −kTs
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

= ∑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 − Tws + − L
f ( kT )     e −kTs
k =∞ 2 !
= ∑k = −∞
 s 
 
 Assuming Tw small 
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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

k =∞
f *Tw (t ) = Tw ∑k = −∞ f ( kT )∂ (t − kT )

Sampler Model: Uniform Rectangular Pulse Train


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Sample waveform dependency


Ideal Sampler: (in this example rectangular
this will be used for pulse train)
further analysis
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004 Ideal Sample and Hold

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

1 − e −Ts
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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)


F ( s) = ∑k =0 f (kT ) e−kTs
*
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

 z-domain (discrete control systems) z −1 = e −Ts



F ( z) = ∑k =0 f (kT ) z −k
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


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Each further delay increases exponent of z


Example 13.1
 Find the z-transform of a sampled unit ramp

Open Form
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Example 13.1 - cont'd


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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?


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004 Partial Table of s- and z-Transforms

These 3 are the main ones you will use in practice

z-Transform Theorems
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Use these 2 to double-check F(z)


Initial and Final Values of Ramp kT
Initial Value:

f (0) = lim z→∞ F ( z )


f(kT) = kT
Tz
= lim z→∞ =0
( z − 1) 2

Final Value:
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

z −1
f (∞) = lim z →1 (1 − z −1 ) F ( z ) = lim z→1 F ( z)
z
z − 1 Tz T
= lim z →1 = lim z →1 =∞
z ( z − 1) 2
z −1

Inverse z-Transform

z
F ( z) =
z − e −aT
f (kT ) = e − akT
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

1
F ( s) =
s+a
z-Domain Transfer Functions
∞ ∞
C ( z ) = ∑m =0 g ( mT ) z − m ∑n =0 r ( nT ) z − n

= G ( z ) R( z )

z-domain transfer
functions can be
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

multiplied as in
s-domain

Assumption: sampled
output (See Nise
Chapter 13.4) R(z) C(z)
G(z)

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
G(s) → G(z)
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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

s z −1
1 z

METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

s +1 z − e −T

More z-Domain Transfer Functions

Take note of the sampling locations!


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004
z-Domain Feedback Control
S1: D/A Converter

Exactly the same


as in s-domain when
assuming sampling
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

at S2, S3 and S4.

Closed-loop
transfer function

G / (1 + GH)

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)


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004
Example 13.6

Find the closed-loop


digital transfer function
and determine if the
system is stable for
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

K = 20
K = 100

with a sample time

T = 0.1 seconds

Example 13.6 - cont'd


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004
Example 13.6 - cont'd
Multiplication of 1-e-Ts = 1 - z-1 and result on previous slide
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

z-domain roots determine stability


K=20: Roots at 0.12 ± j0.78
K=100: Roots at -0.58 and -4.9

Example 13.7

Determine the range of sampling interval, T, that will make


the system stable, and the range that will make it unstable.
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004 Example 13.7 - cont'd

Determine stability from pole

Stable: 0 < T < 0.2


11e0 = 11
Unstable: T > 0.2
11e −0.2 = 9

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.
 Bilinear transformations
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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

z <1 when α < 0


Hence, the bilinear transformation
z >1 when α > 0
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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
poles outside
the unit circle
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

in z-domain
does the system
have?
Discrete Control Steady-State Errors

In order to
analyse steady-
state errors, we
assume that
samplers are
placed in the
loop as illustrated.

Given these
assumptions, the
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

error equals

E(z) =

R(z) / [1 + G(z)]

Discrete Steady-State Errors: Step Input


Final Value:
R( z )
e(∞ ) = lim z→1 (1 − z −1 ) E ( z ) = lim z→1 (1 − z −1 )
1 + G( z )
Unit Step:
1
R( s) =
s
z 1
R( z ) = =
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

z − 1 1 − z −1
R( z ) 1 1
e( ∞) = lim z →1 (1 − z −1 ) = lim z→1 =
1 + G( z ) 1 + G ( z ) 1 + lim z→1 G ( z )
If we define the error constant: K P = lim z →1 G ( z )
1
Then: e( ∞ ) =
1 + KP
Discrete Steady-State Errors: Ramp / Parabola
1
Ramp: R( s) =
s2
Tz T
R( z) = = −1
( z − 1) (1 − z )( z − 1)
2

R( z) T
e(∞) = limz→1(1 − z −1 ) = limz→1
1 + G( z) ( z − 1)(1 + G( z))
T 1
= limz→1 =
( z − 1)G( z) Kv
Parabola:

T 2 z( z + 1) T 2 ( z + 1)
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

R( z) = =
2( z − 1)3 2(1 − z −1 )( z − 1)2
R( z)
−1 T 2 ( z + 1)
e(∞) = limz→1 (1 − z ) = limz→1
1 + G( z) 2( z − 1)2 (1 + G( z))
T2 1
= limz→1 =
( z − 1)2 G( z) Ka

Comparison to s-Domain (Lecture 4)


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Same steady-state formulas in continuous and


discrete domains!! In s-domain the parameters
Kp, Kv and Ka are given by G(s), in z-domain
by G(z)
Example 13.9 - Steady-State Error

G(s) → G(z)

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

For a step, ramp and parabolic input, find the


METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

steady-state errors for the digital feedback


system above, if
10
G1 ( s ) =
s( s + 1)

Example 13.9 - Solution


10(1 − e −Ts ) 1 1 1 
G( s) = 2 = 10(1 − e −Ts )  2 − +
s ( s + 1) s s s + 1
Partial
Fractions

Note: If both the


continuous and
the discrete
versions of the
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

same control
system are
stable, then
the steady-state
errors will be the
same.
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.
 The Tustin approximation will allow us to do this
T
2 z −1 1+ s
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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.

Example 13.12 - Digital Lead Compensator

1
G p ( s) =
s ( s + 6)( s + 10)

Design a digital lead compensator,


Gc(z), so that the system will
operate with 20% overshoot
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

and a settling time of Ts=1.1


seconds for a step-response.
Example 13.12 - Lead Controller Design
 Bode Approximation: At jw=1, -20*log10(abs(j+6)*abs(j+10))=-35 dB

0dB
0.1 1 10 100
-65dB
-40dB

-80dB

Check-
-120dB points
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

-90o
0.1 1 10 100

-180o

-270o

Lead Compensator - Desired Poles

− ln(%OS / 100)
ζ = = 0.456
π + ln (%OS / 100)
2 2

We add 8o margin
  to get total phase
−1  2ζ  margin of 56o
Φ M = tan  
= 48o

 − 2ζ + 1 + 4ζ
2 4 

4
wn = ≈ 8.0
Tsζ
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

7dB
Lead-Compensator Formulas: β=0.2

1
s + 1− β  1 1
Gc ( s ) =
K T ,β <1 ϕ MAX = sin −1  
 wMAX = Gc ( jwMAX ) =
β s+ 1 1 + β  T β β
βT
Lead Compensator

 We choose K=52dB = 395 to make the uncompensated


gain equal to 0dB when phase is -180o
 K will otherwise be determined from the steady-state
error requirement if specified.
 New phase-margin frequency where system phase is -
180o - 56o. This occurs at ≈ 13 rad/s

1
wMAX =
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

T ≈ 0.17
T β
Continuous
lead-compensator
1977( s + 6)
Gc ( s ) ≈ design including
( s + 29.1) additional gain K

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)
1977( + 6)
Gc ( z ) = z + 1
200( z − 1)
+ 29.1
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

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
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

Matlab / Simulink Discrete Control Functions

 c2d: Converts continuous to discrete transfer


functions, example Gd = c2d(G,dt,'tustin')
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004
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
test for z-domain roots
 Tustin approximation allows us to design controllers as
METR4200 – ADVANCED CONTROL SEMESTER 2, 2004

usual in s-domain and convert the final result to z-


domain just prior to implementation

You might also like