Slides Mm3

43
1 Analog and Digital Control 1 Lecture 3 Kirsten Mølgaard Nielsen Based on lecture notes by Jesper Sandberg Thomsen

description

A

Transcript of Slides Mm3

Page 1: Slides Mm3

1

Analog and Digital Control

1Lecture 3

Kirsten Mølgaard Nielsen

Based on lecture notes by Jesper Sandberg Thomsen

Page 2: Slides Mm3

2

OutlineDiscrete equivalents

Overview (emulation – finding a discrete equivalent to the continuous system)

Numerical integration Zero-Pole matching (mapping) Hold equivalents

Design by emulation Evaluation of design

Nyquist stability criterion Continuous case Discrete case

Page 3: Slides Mm3

3

Discrete Equivalents - Overviewcontroller

D(s)plantG(s)

r(t) u(t) y(t)e(t)+

-

Translation to discrete controller (emulation)Numerical Integration• Forward rectangular rule• Backward rectangular rule• Trapeziod rule (Tustin’s method, bilinear transformation)• Bilinear with prewarpingZero-Pole MatchingHold Equivalents• Zero order hold (ZOH)• Triangle hold (FOH)

Translation todiscrete plantZero order hold (ZOH)

EmulationPurpose: Find a discrete transfer function which approximately has the same characteristics over the frequency range of interest.

Digital implementation: Control part constant between samples. Plant is not constant between samples.

Page 4: Slides Mm3

4

Numerical Integration

Fundamental concept Represent H(s) as a differential equation. Derive an approximate difference equation.

We will use the following example Notice, by partial expansion of a transfer function this

example covers all real poles.

aeauuas

asH

sE

sU

)(

)(

)(

ExampleTransfer function Differential equation

Page 5: Slides Mm3

5

Numerical Integration

kTTkTaeauTkTu

daeaudaeaukTu

continousdaeautu

aeauu

as

asH

sE

sU

TkT kT

TkT

t

,over of area)(

)(

)()()()(

Equation alDifferenti

)()(

)(

FunctionTransfer

0

0

Page 6: Slides Mm3

6

Numerical Integration

Now, three simple ways to approximate the area.

Forward rectangle approx. by looking forward

from kT-T Backward rectangle

approx. by looking backward from kT

Trapezoid approx. by average

kT-T kT

kT-T kT

kT-T kT

Page 7: Slides Mm3

7

Numerical Integration

Forward rectangular rule (Euler’s rule)(Approximation kT-T)

aTz

a

aTz

aT

zaT

aTz

zE

zUzH

zEaTzzUzaTzU

TkTaTeTkTuaT

TkTaeTkTauTTkTukTu

F

11)1(1)(

)()(

)()()1()(

unctionTransfer F

)()()1(

)()()()(

EquationDifference

1

11

11

11

1

111

Page 8: Slides Mm3

8

Numerical IntegrationBackward rectangular rule (app kT)

aTzz

a

zaT

aTz

aT

aT

zaTzE

zUzH

zEaT

aTzU

zaTzU

kTeaT

aTTkTu

aTkTu

kTaTeTkTukTaTukTu

kTaekTauTTkTukTu

B

11)1()1()1(

11

1

)(

)()(

)(1

)()1(

1)(

unctionTransfer F

)(1

)(1

1)(

)()()()(

)()()()(

EquationDifference

2

22

22

222

222

Page 9: Slides Mm3

9

Numerical IntegrationTrapezoid rule (Tustin’s Method, bilinear trans.)(app ½(old value + new value))

azz

T

a

aTzaT

zaT

zE

zUzH

kTeTkTeaT

aTTkTu

aT

aT

kTaekTauTkTaeTkTauT

TkTukTu

T

)1()1(22)2(

)1(

)(

)()(

unctionTransfer F

)()()2/(1

2/)(

)2/(1

)2/(1

)()()()(2

)()(

EquationDifference

3

3

3333

Page 10: Slides Mm3

10

Numerical Integration

Comparison with H(s)

azz

T

azH

as

a

aTzz

azH

as

a

aTz

azH

as

a

sH

T

B

F

)1()1(2

)(rule Trapezoid

1)(rule Backward

1)(rule Forward

functionTransfer Method)(

Page 11: Slides Mm3

11

Numerical IntegrationTransform s ↔ z

sT

sTz

z

z

Ts

Tsz

Tz

zs

TszT

zs

)2/(1

)2/(1or

)1(

)1(2rule Trapezoid

1

1or

1rule Backward

1or1

rule Forward

ionApproximatMethod

Comparison with respect to stability In the s-plane, s = j is the boundary between stability

and instability.

Page 12: Slides Mm3

12

Numerical Integration - stability

jssT

sTz

jsTs

z

jsTsz

for )2/(1

)2/(1Trapezoid

for 1

1Backward

for 1Forward

(Forward)Region ofs-LHP

(Backward)Region ofs-LHP

(Trapezoid)Region ofs-LHP

Page 13: Slides Mm3

13

Numerical IntegrationSome conclusions

Higher distortion with the forward and backward rule. The forward rectangular rule could cause a stable

continuous filter to be mapped into an unstable digital filter.

The trapezoid rule maps the stable region in the s-plane exactly into the stable region of the z-plane. Though, the j-axis is compressed into the unit circle with length 2.

The trapezoid rule appears superior. But, let us make some further investigations..... let us calculate the power |H(j|2 at, for example, = a – the change in frequency response.

Page 14: Slides Mm3

14

Numerical Integration

2

1)(

)(

1)/(

1)(

)(

2

2222

22

jaH

a

aa

ajH

aj

ajH

What about HT(z) ? at which frequency is |HT(z)|2 = 0.5 ?

Page 15: Slides Mm3

15

Numerical Integration

12/,)2

(2

Notice,

)2

arctan(2

or)2/tan(2

2

1

1)2/tan(21

1)(

en Power wh.with

1)2/tan(21

1

)2/tan(2

)(

1

11

22

1

22

1

11

aTaaT

T

aT

TT

Ta

TTa

zH

ezez

TjTa

aTjT

azH

T

TjTj

T

HT(z) as before but re-formulated (page 194)

I.e. high sampling frequency

Page 16: Slides Mm3

16

Numerical IntegrationTrapezoid with pre-warping

maintain the power at some specified frequency

1. Choose a critical frequency

2. Replace by a´ such that new a = a’,

3. and insert in H(s). a’ = (2/T) tan( T/2)

4. Find the discrete filter H(z) based on the modified continuous transfer function H(s).

11

)2/tan(1

)()(

11

1

zz

Ts

sHzH

)1()(1 jHzH

Page 17: Slides Mm3

17

Numerical Integration

1/

at Prewarping

2

1

1.0

with122

1

)(

filterorder 3th Example,

23

b

T

sss

sH

Plots for T = 0.1s ≈ 60 b

Page 18: Slides Mm3

18

Numerical Integration

Plots for T = 1s ≈ 6 wb

Notice,prewarp

Page 19: Slides Mm3

19

Numerical Integration

Plots for T = 2s ≈ 3 b

Notice,prewarp

Page 20: Slides Mm3

20

Zero-Pole MatchingExact map between poles (z = esT) exists.

Basic idea, simply use same map for zeros.

Rules1. All poles are mapped by z = esT.

For example, s = -a maps to z = e-aT

2. All finite zeros are mapped by z = esT. For example, s = -b maps to z = e-bT

3. Basically, zeros at j= infinity maps to z = ej= -1 (representing the highest frequency)

4. Identical gain at some critical freq. (typically, s=0) H(s) at s=0 = H(z) at z=1

Page 21: Slides Mm3

21

Zero-Pole Matching

z

zKzH

eK

as

a

ez

zK

zsH

ezas

as

aH(s)

aT

szaT

s

aT

1)(

2

11

14) (rule Gain

10)(3) (rule Zero

1) (rule Pole

01

Example (1)Compute the discrete equivalent by zero-pole matching

Page 22: Slides Mm3

22

Zero-Pole Matching

s-plane z-plane

z

zKzH

as

aH(s)

1)(

match-zp

Page 23: Slides Mm3

23

Zero-Pole Matching

)1()()1()(1

11)(

)(

)(1

1

kKekKekukuz

zK

z

zKzH

zE

zU

Including delay in computerNotice, u(k) depends on e(k). This comes from rule 3

Solution, first zero for s=infinity is mapped to z=infinity

(as in Matlab). This gives

)1()1()(1

1

)(

)(1

1

kKekukuz

zK

zK

zE

zU

Page 24: Slides Mm3

24

Hold EquivalentsPurpose, design a discrete filter H(z), such that

input e(k) is samples of e(t) H(z) has an output u(k) u(k) approximates the output of the continuous filter

H(s) whose input is the continuous signal e(t).

Zero order hold (ZOH) (step invariant), approach below

HoldSampler H(s)e(t) e(k) u(k)

Samplereh(t) u(t)

Page 25: Slides Mm3

25

Hold EquivalentsHold operation

gaina is)(

)()()(

11

)(

)(1)(1)(

ke

kesQsE

es

sQ

Ttttq

h

Ts

Q(s)

HoldSampler H(s)e(t) e(k) u(k)

Samplereh(t) u(t)

Page 26: Slides Mm3

26

Hold Equivalents

ZOH transformation Notice, we can find H(z) by Take inverse Laplace to find a continuous signal. Sample this continuous signal to find a discrete signal.

kkette )()()(

)(11

)()()()()(

)()()()()()()(

11 kes

sHLksQsHLtu

ksQsHkesQsHsU

Ts

HoldSampler H(s)e(t) e(k) u(k)

Samplereh(t) u(t)

Page 27: Slides Mm3

27

Hold Equivalents

)()(

)(1)(1)(11

)()( 11 ks

sHLTttke

ssHLtu Ts

s

sHLZ

s

sHZ

s

sHZzzHzUkuZ

tuku tkT

)()(where

)()1()()()(

)()(

1

1

Continuous output signal

Discrete output signal and transfer function H(z)

Page 28: Slides Mm3

28

Hold EquivalentsTriangle hold equivalent

Extrapolate the samples to connect sample to sample in a straight line.

Impulse response for triangle hold

THold System

2

2

Ts

ee TsTs )(sH

)(ke )(tu

2

)()1()(

Result

s

sHZ

Tz

zzH

T

0.1

Page 29: Slides Mm3

29

Hold Equivalents

Same third order filteras before

+ Zero-pole o ZOHx Triangle

T = 1(next T=2)

Page 30: Slides Mm3

30

Hold Equivalents

Same filteras before

+ Zero-pole o ZOHx Triangle

T = 2

Page 31: Slides Mm3

31

Hold EquivalentsConcluding remarks

Methods, we have looked at Numerical integration methods Zero-pole matching (mapping) Hold equivalents

All methods works fine for high sample frequency Matlab

Page 32: Slides Mm3

32

Evaluation of Design

Discrete controller by emulation Can be calculated using one of several techniques.

Evaluation discrete equivalent (design) We need to analyze in the z-domain. Process expressed in z-domain (ZOH) Notice, other eval. might be necessary (simulation)

Page 33: Slides Mm3

33

Evaluation of DesignExample, using Matlab

sysD_c = tf([10 1],[1 1]);T = 0.2; % around 30*wn. Also use, T = 1sysD_d = c2d(sysD_c,T,’matched’); % zero-pole matchedsysG_c = tf([1],[10 1 0]);sysG_d = c2d(sysG_c,T,’zoh’); % zero order holdsysCL_c = feedback(sysD_c*sysG_c,1);sysCL_d = feedback(sysD_d*sysG_d,1);step(sysCL_c); hold on;step(sysCL_d);

)110(

1)(

(antenna) sys. Cont.

sssG

1

)110()(

controller Cont.

s

ssD

Page 34: Slides Mm3

34

Evaluation of Design

T = 0.2(s ≈ 30 n)

Page 35: Slides Mm3

35

Evaluation of Design

T = 1(s ≈ 6 n)

The sample delay gives phase lag.Thus, less PM which gives higher overshoot

Page 36: Slides Mm3

36

Nyquist Stability Criterion

Check closed loop stability with controller KD(s) and plant G(s)

)(

)()()(,

)()(1

)()(

)(

)(

sa

sbsGsD

sGsDK

sGsDK

sR

sY

Characteristic equation (CE)

0)(

)()(0)()(1

sa

sKbsasGsDK

Notice, number of poles in CE equals number of open-loop poles in D(s)G(S). (known)Notice, zeros in CE are closed-loop poles! (unknown)

Page 37: Slides Mm3

37

Nyquist Stability CriterionApproach, check characteristic equation

Let us follow a contour encircling the RHP. Basic idea: Evaluate CE = 1+KD(s)G(s) at the

contour, and draw image. (We can just as well evaluate KD(s)G(s) and look at -1 )

)()( sGsDK

Notice, poles or zeros gives encirclements

Page 38: Slides Mm3

38

Nyquist Stability Criterion

Criterion (continuous case)

Z = P + N

Z = number of unstable closed-loop poles. Thus, for stability we want Z=0. (unknown)

P = number of unstable open-loop poles of KDG (known).

N = total number of encirclements of the point -1 by evaluation of KDG (taken in same direction as s. Thus, N might be negative).

Page 39: Slides Mm3

39

Nyquist Stability CriterionInterpretations and explanations

If the s-plane contour encircles a zero of 1+KDG in a certain direction, the image contour will encircle the origin in the same direction. (related to Z)

If the s-plane contour encircles a pole of 1+KDG in a certain direction, the image contour will encircle the origin in the opposite direction. (related to P)

The net number of same-direction encirclements, N, equals the difference N = Z- P.

Actually, we should investigate 1+KDG and encirclements around the origin, but easier to investigate KDG and encirclements around -1.

Page 40: Slides Mm3

40

Nyquist Stability Criterion

Discrete case Same approach,

almost... Unstable region is

outside the unit circle.

Easier to evaluate using the stable region.

Page 41: Slides Mm3

41

Nyquist Stability Criterion

Discrete case CE: 0 = 1+KD(z)G(z) Total number of poles = n Number of stable zeros of 1+KD(z)G(z) is n-Z Number of stable poles of 1+KD(z)G(z) is n-P

Criterion (discrete case) Z = (n-Z) – (n-P) or Z = P – N

Page 42: Slides Mm3

42

Nyquist Stability Criterion

Discrete case Determin the number P of unstable poles of KDG Plot KD(z)G(z) for the unit circle. This is the counter-

clockwise path around the unit circle. Set N equal to the number of Counter-clockwise

encirclements of the point -1 on the plot Compute Z=P-N. The system is stable if and only if Z=0

Page 43: Slides Mm3

43

Nyquist Stability CriterionExample (7.9)Evaluate the stability of the unity feedback discrete system with the plant G(s) with sampling time T=2 and ZOH. Use controller KD(z) = K.

)1(

1)(

sssG

Solution (matlab)sysC = tf([1],[1 1 0]);sysD = c2d(sysC,2);nyquist(sysD);

K=1

The system is openloop stable and there are no encirkelments of -1 => the system is closed loop stable for K=1