control of discrete systems - isae-supaero of discrete systems ensica ... discrete state system...

45
1 Control of Discrete Systems ENSICA Yves Briere ISAE General Introduction

Upload: vocong

Post on 26-Apr-2018

232 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

1

Control of Discrete Systems

ENSICA

Yves BriereISAE

General Introduction

Page 2: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

2

Prerequisites :Automatique ENSICA 1A et 2ATraitement numérique du signal ENSICA 1A(Control and signal processing, basics)

Tools : Matlab / Simulink

References : • « Commande des systèmes », I. D. Landau, Edition

Lavoisier 2002.

Planning22 slots of 1h15

Overview

Overview

Discrete signals and systems

Sampling continuous systems

Identification of discrete systems

Closed loop systems

Control methods

Control by computer

Page 3: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

3

I. Introduction

6

II. Discrete signals and systems

Signal processing / Control

� Signal processing gives tools to describe and filter signals� Control theory use these tools to deal with closed loop systems

� More generally, control theory deal with :� discrete state system analysis and control (Petri nets, etc...)� Complex systems, UML, etc...

Page 4: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

4

7

II. Discrete signals and systems

What we deal with in this course

F1(z)

E(z) S(z) U(z)

P(z)

R(z) F2(z)

F3(z)

S(z)

T(z)

F4(z)

Or, simply :

F(z) e(z) s(z) u(z)

p(z)

Computer DAC System ADC

The same problem as seen by the control system engineer :

8

II. Discrete signals and systems

II. Discrete signals and systems

Page 5: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

5

9

II. Discrete signals and systems

Reminder : the z-transform

Discrete signal : list of real numbers (samples)

Z-transform : function of the complex z variable

( ) ( )( ) ( )∑∞

=

−⋅==0k

kzksksZzs

( ) { },...s,s,sks 210=

Existence of s(z) : generally no problem (convergence radius : s(z) exist for a given radius |z| > R )

10

II. Discrete signals and systems

Reminder : properties of the z-transform

1

( ) ( )( ) ( )∑∞

=

−⋅==0k

kzksksZzs

2

( ) ( )( ) ( )( ) ( )( )ksZβksZαksβksαZ 2121 ⋅+⋅=⋅+⋅

3

( )( ) ( )dz

zdszkskZ ⋅−=⋅

4

( )( )

=⋅c

zskscZ k

5

( )( ) ( ) ( )zsz1ks1ksZ 1 ⋅+−==− −

6

( )( ) ( ) ( )0kszzsz1ksZ =⋅−⋅=+

7

( ) ( )( )zslim0ks z ∞→==

8

( ) ( )

⋅−=∞→ → zsz

1zlimks 1z

Delay theorem

Final value theorem

Linearity

Page 6: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

6

11

II. Discrete signals and systems

Reminder : basic signals

s(k) S(z) δ(k) : unit impulse 1

u(k) : unit step 1z

z

k.u(k) ( )21z

z

( )kuck ⋅ cz

z

( ) ( )kuksin ⋅⋅ω

( )( ) 1sinz2z

sinz2 +ω⋅⋅−

ω⋅

12

II. Discrete signals and systems

Reminder : from « z » to « k »

First approach : use the z-transform equations (we don’t give here the

inverse z-transform equation, it is too ugly...)

Second approach : use tricks

� recurrence inversion� Polynoms division� Singular value decomposition

Third approach : computer (Matlab)

Page 7: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

7

13

II. Discrete signals and systems

Reminder : discrete transfer function

We deal with Linear Time Invariant (LTI) systems

The sequence of output and input samples are consequently simply relatedby:

Discrete LTI system

e(k) s(k)

( ) ( ) ( ) ( )( ) ( ) ( ) ( )mkeb...2keb1kebkeb

nksa...2ksa1ksaks

m210

n21

−⋅++−⋅+−⋅+⋅=−⋅++−⋅+−⋅+

The delay theorem gives:

( )( ) ( )

nn

22

11

mm

22

110

za...zaza1

zb...zbzbbzF

ze

zs−−−

−−−

⋅++⋅+⋅+⋅++⋅+⋅+

==

Normalized : a0 = 1

14

II. Discrete signals and systems

Reminder : discrete transfer function

Remarks

� We prefer to use z-1 rather than z. (z-1 is a « shift » operator)

� We often use the q-1 notation instead of z-1 : this way we don’t bother withradius convergence and other fundamental mathematic stuff.

� Impulse response : e(z) = 1 The transfer function is also the impulse response(function = signal)

� Causality : the output depends on past, not future� the impulse response is null for k < 0� Confusion between « causal system » and « causal signal »

Page 8: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

8

15

II. Discrete signals and systems

Reminder : discrete transfer function

Properties

� Impulse response : the inverse z-transform of the transfer function

� Step response

( )1n

n2

21

1

mm

22

110

z1

1

za...zaza1

zb...zbzbbzs

−−−−

−−−

−×

⋅++⋅+⋅+⋅++⋅+⋅+

=

� Static gain (Final value theorem applied to the last equation)

∑=

=

=

=

+=

ni

1ii

mi

0ii

0

a1

b

F

16

II. Discrete signals and systems

Reminder : discrete transfer function

Properties : stability

� Any transfer function can be expressed as:

( ) ( ) ( ) ( )( ) ( ) ( )1

n1

21

1

1m

12

110

zc1zc1zc1

ze1ze1ze1ezF

−−−

−−−

⋅+⋅+⋅⋅+⋅+⋅+⋅⋅+⋅

=L

L

Coefficients ci are either real or complex conjugates

For a stable system each ci coefficient must verify |ci| <1, in other wordseach poles must belong to the unit circle.

F(z) can be decomposed in a sum of first order and second order systems� It is good to know how first and second order behaves

Properties : singular value decomposition

Page 9: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

9

17

II. Discrete signals and systems

Reminder : first order systems

Properties : first order system

0 5 10 15 20 250

1

2

3zpk([],[0.6],1,1)

-3 -2 -1 0 1 2 3-1

0

1Pole-Zero Map

Real AxisIm

agin

ary

Axi

s

0 5 10 15 20 250

5

10zpk([],[0.9],1,1)

-3 -2 -1 0 1 2 3-1

0

1Pole-Zero Map

Real Axis

Imag

inar

y A

xis

0 5 10 15 20 250

10

20zpk([],[1],1,1)

-3 -2 -1 0 1 2 3-1

0

1Pole-Zero Map

Real Axis

Imag

inar

y A

xis

0 5 10 15 20 250

100

200zpk([],[1.2],1,1)

-2 0 2 4-1

0

1Pole-Zero Map

Real Axis

Imag

inar

y A

xis

18

II. Discrete signals and systems

Reminder : second order systems

Properties : second order systems

-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

0.1π/T

0.2π/T

0.3π/T

0.4π/T0.5π/T

0.6π/T

0.7π/T

0.8π/T

0.9π/T

π/T

0.1π/T

0.2π/T

0.3π/T

0.4π/T0.5π/T

0.6π/T

0.7π/T

0.8π/T

0.9π/T

π/T

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Pole-Zero Map

Real Axis

Imag

inar

y A

xis

Page 10: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

10

19

II. Discrete signals and systems

0 5 10 15 20 250

2

4zpk([],[0.6+0.5i 0.6-0.5i],1,1)

-3 -2 -1 0 1 2 3-1

0

1Pole-Zero Map

Real Axis

Imag

inar

y A

xis

0 5 10 15 20 250

0.5

1zpk([],[-0.1+0.2i -0.1-0.2i],1,1)

-3 -2 -1 0 1 2 3-1

0

1Pole-Zero Map

Real Axis

Imag

inar

y A

xis

0 5 10 15 20 250

1

2zpk([],[0.2+0.9i 0.2-0.9i],1,1)

-3 -2 -1 0 1 2 3-1

0

1Pole-Zero Map

Real Axis

Imag

inar

y A

xis

0 5 10 15 20 25-5

0

5zpk([],[0.6+0.9i 0.6-0.9i],1,1)

-3 -2 -1 0 1 2 3-1

0

1Pole-Zero Map

Real Axis

Imag

inar

y A

xis

Reminder : second order systems

Properties : second order systems

20

II. Discrete signals and systems

Reminder : frequency response

Reminder : continuous systems

( ) ( )[ ]

∞∈=⋅⋅π⋅⋅+⋅⋅π⋅= ⋅⋅π⋅⋅

0f

etf2sinjtf2cos)t(e tf2j

Analogy : discrete system

( ) ( )[ ]

∈=⋅⋅π⋅⋅+⋅⋅π⋅= ⋅⋅π⋅⋅

10f

ekf2sinjkf2cos)k(e kf2j

The output signal looks like

( ) ( )( )

[ ]

∈⋅= Φ+⋅⋅π⋅⋅

10f

efA)k(s fkf2j

With F of phase Φ (degrees) and module A (decibels):

( ) ( )[ ]

∈== ⋅π⋅⋅

10f

ezFfF f2j

Page 11: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

11

21

II. Discrete signals and systems

Reminder : frequency response

Definition : frequency response

( ) ( )[ ]

∈== ⋅π⋅⋅

10f

ezFfF f2jf : normalized frequency (between 0 and 1)F(f) : frequency response

Property : Bode diagram

-10

-5

0

5

10

15

20

Mag

nitu

de (

dB)

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5-360

-270

-180

-90

0

Pha

se (

deg)

bode diagram of 1/(z2 - 0.4z + 0.85))

Frequency (Hz)

Bode diagram of a second order

system. Note the linear scale for frequency.

22

II. Discrete signals and systems

Reminder : Nyquist-Shannon sampling theorem

1

0

Plan complexe continu

Plan complexe discret

1

1

1

2

0

Page 12: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

12

End of C1 C2

III. Samplingcontinuous

systems

Page 13: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

13

25

III. Sampled continuous systems

Discrete systems

A real system is generally continuous (and described by differentialequations)

Computer DAC System ADC

An interface provides sampled measurements at a given frequency:� Digital to Analog Converter (DAC)

� smart sensor

A computer provides at a given frequency the input of the system

An interface transforms the computer output into a continuous input for the system

� Analog to Digital Converter (ADC)

� smart actuator

26

III. Sampled continuous systems

Hypothesis

� Sampling is regular� Sampling is synchronous� The computer computes the control according to the curr »ent measurement and a finite set of pas measurements.

Computer DAC System ADC

Page 14: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

14

27

III. Sampled continuous systems

Sampling a continuous transfer function

Hypothesis :

� The continuous transfer function is known� The ADC is a ZOH ☺

We must now deal with F+ZOH in a whole

ZOH F(p)

28

III. Sampled continuous systems

Zero Holder Hold : the sampled input is blocked during one sampling

delay.

The impulse response of a zoh is consequently:

t

Te 0

1

The Laplace transform of the above signal is:

( )eT s1 e

ZOH ss s

− ⋅

= −

Sampling a continuous transfer function

Page 15: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

15

29

III. Sampled continuous systems

The impulse response of ZOH+F is :

( ) ( ) ( ) ( )sFs

1esF

s

1sF

s

e

s

1ss e

eTj

Tj

⋅−⋅=⋅

−= ⋅−

⋅−

Two terms for the impulse response :

( ) ( ) ( ) ( ) ( )

⋅−=

⋅−

⋅= −− sFs

1Zz1sF

s

1ZzsF

s

1Zks 11

Usually the z-transfer function of ZOH+F is given by tables:

Sampling a continuous transfer function

30

III. Sampled continuous systems

Tables

F(s) FBOZ(z) 1 1

s

1

1

1e

z1

zT−

−⋅

sT1

1

⋅+

−=−=

⋅+⋅

−−

TT

1T

T

1

11

11

ee

eae1b

za1

zb

e

sL

TL

sT1e

<

⋅+

⋅−

( ) ( )

−=−=

−=⋅+

⋅+⋅

−−

−−

−−

1eebe1b

eaza1

zbzb

TLTT2

TTL1

TT11

1

22

11

ee

e

Matlab

% Defini t ion of a cont inuous system :

sysc=tf(1, [1 1]) ;

% z_transfer funct ion af ter sampl ing a t Te

Te=0.1;

sysd=c2d(sysc,Te, 'zoh ' ) ;

% Notat ion with z^-1

sysd.var iab le='z

Matlab

Sampling a continuous transfer function

Page 16: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

16

31

III. Sampled continuous systems

Sampling time delay equivalence

A sampling time of Te can be approximated as a delay of Te/2 : instability in closed loo^p.

-1.5 -1 -0.5 0 0.5 1 1.5 2-2

-1.5

-1

-0.5

0

0.5

1

1.5

2Nyquist Diagram

Real Axis

Imag

inar

y A

xis

>> F=2*s/(1+s+s^2)/s/(1+s)>> G=F;>> G.ioDelay=0.5>> nyquist(F,G)

FG

32

III. Sampled continuous systems

Choice of sampling time

The sampling time is chosen according to the closed loop expectedperformance

Example : third order system>> F=1.5/(1+s+s^2)/(1+s)

Sampling frequency : 5 to 25 fois the expected closed loop bandwidth.

Closed loop bandwitdh at -3dB of F/(1+F) : 0.3 Hz

Sampling time : 5 Hz

Page 17: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

17

33

III. Sampled continuous systems

10-1

-270

-225

-180

-135

-90

-45

0

Pha

se (

deg)

Bode Diagram

Frequency (Hz)

-20

-15

-10

-5

0

5

10

System: FFrequency (Hz): 0.196

Magnitude (dB): -3

System: untitled1Frequency (Hz): 0.269Magnitude (dB): -7.36

Mag

nitu

de (

dB)

System: untitled1Frequency (Hz): 0.0215Magnitude (dB): -4.36

F F/(1+F)

Choice of sampling frequency

34

III. Sampled continuous systems

Root Locus

Real Axis

Imag

inar

y A

xis

-3 -2.5 -2 -1.5 -1 -0.5 0 0.5-2.5

-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

2.50.120.240.380.50.640.76

0.88

0.97

0.120.240.380.50.640.76

0.88

0.97

0.511.522.5

System: FGain: 1.64

Pole: -0.0488 + 1.35iDamping: 0.0362

Overshoot (%): 89.2Frequency (rad/sec): 1.35

System: FGain: 1.69Pole: -1.92Damping: 1

Overshoot (%): 0Frequency (rad/sec): 1.92

Choice of sampling frequency

Page 18: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

18

35

III. Sampled continuous systems

2 4 6 8 10 12 14

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

Choice of sampling frequency

36

III. Sampled continuous systems

Sampling effect : discretization

Sampling is always associated to a discretization of the signal !Example :

- Signal sampled at 0.2s and discretized at a resolution of 0.1.- The numerical derivative of the signal

0 5 10 150

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 5 1 0 1 5

- 0 . 1

- 0 . 0 5

0

0 . 0 5

0 . 1

0 . 1 5

Page 19: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

19

37

III. Sampled continuous systems

First approach : discretise a continuous controller

The sampling effect (ZOH) is neglected.

Example : continuous PD : ( ) ( )( )

( ) ( ) ( )

p D

p D

e sPID s k k s

s

d te t k t k

dt

= = + ⋅ε

ε= ⋅ε + ⋅

Continuous derivative is replaced by a discrete derivative :

( ) ( ) ( ) ( )e

Dp T

1kkkkkke

−ε−ε⋅+ε⋅=

Transfer function :

( ) ( ) ( ) ( ) ( )zT

z1kk

T

zzzkzkze

e

1

Dpe

1

Dp ε⋅

−⋅+=ε−ε⋅+ε⋅=−−

S to z equivalence :e

1

T

z1s

−−=

38

III. Sampled continuous systems

More generally the problem is to approximate a differential equation : cf

numerical methods of integration

Method s to z equivalence

Euler's forward method

e1

1

Tz

z1s

⋅−= −

Euler's backward method

e

1

T

z1s

−−=

Tustin method 1

1

e z1

z1

T

2s −

+−⋅=

First approach : discretise a continuous controller

Page 20: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

20

39

III. Sampled continuous systems

Warning : methods are not equivalent !

-1.5 -1 -0.5 0 0.5 1-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

Blue : zoh

Green : tustin

(No problem if samplingtime is small)

First approach : discretise a continuous controller

40

III. Sampled continuous systems

Equivalence of contrinuous poles after « s to z » conversion

(a) (b)

1

1

(c) (d)

s z

z z (a) : continuous

(b) : Euler forward(c) : Euler backward(d) : Tustin

First approach : discretise a continuous controller

Page 21: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

21

41

III. Sampled continuous systems

End C3 C4

IV. Identification of discrete systems

Page 22: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

22

43

IV. Identification of discrete systems

Introduction

Before the design process of a controller one must have a discrete model of the

plant

� First approach : continuous model and/or identification then discretization (cflast chapter)

� Second approach : tests on the real system, measurements (sampled), identification algorithm

For a full course on this topic see 3d year course “airplane identification”

44

IV. Identification of discrete systems

Naive approach

(But easy, fast and easy to explain)

� Standard test (step, impulse)

� Try to fit as well as possible a model (first order, second order with delay, etc...)

... « fit as well as possible » ...� criteria ?...� optimisation ?…

Page 23: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

23

45

IV. Identification of discrete systems

Example : real step test (o) and simulated first order step (x)

0 1 2 3 4 5 6 7 80

0.2

0.4

0.6

0.8

1

1.2

1.4

Naive approach

46

IV. Identification of discrete systems

A little bit of method ?

� trial and error fitting of the outputs �� find a criteria ☺ , example : mean square error...

( ) ( )( )∑=

−=N

1t

2mesuréreel tyty

N

1J

>> t=0:0.1:8;

>> p=tf('p');

>> sysreal=tf(1/(1+2*p)/(1+0.6*p)*(1+0.5*p)) +0.02*randn(length(t),1);

>> yreal=step(sysreal,t)+0.02*randn(length(t),1);

>> ysimul=step(1/(1+2*p),t);

>> plot(t,yreal,'bo',t,ysimul,'rx')

>> eps=yreel-ysimul;

>> J=1/length(eps)*eps'*eps;

After some iterations one obtain J minimal with tau=1.81 s

Better model with a delay, twoparameters to tune

Naive approach

Page 24: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

24

47

IV. Identification of discrete systems

Drawbacks :� Test signals with high amplitude (is the system still linear ?)

� Reduced precision� Perurbation noise not taken into account� Perturbation noise reduces the performance of the identification

� long, not very rigorous...

Advantage :� easy to understand...

Naive approach

48

IV. Identification of discrete systems

Second method (the good one) : « estimation »

� Perform a « rich test » (random input signal, rich in frequency)

� Fit the model that best predict the output.

Page 25: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

25

49

IV. Identification of discrete systems

Basic principle of parametric identification

Physical systemADC DAC

Numerical model

Parameters AdaptationAlgorithm

u(t) y(t)

ŷ(t)

ε(t)

Parameters of the model

perturbations

50

IV. Identification of discrete systems

Example of an Identification Process

Linear model (ARX) :

euByA +⋅=⋅

( ) ( ) ( ) ( )( ) ( ) ( ) ( )te1ntub...1tubtub

1ntya...1tyatya1ty

bn21

an21

b

a

++−⋅++−⋅+⋅

=+−⋅++−⋅+⋅++

Model used as a predictor :

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

a

b

predict 1 2 n a

1 2 n b

y t 1 a y t a y t 1 ... a y t n 1

...............................b u t b u t 1 ... b u t n 1

+ = − ⋅ + ⋅ − + + ⋅ − + +

⋅ + ⋅ − + + ⋅ − +

� Try to minimize the difference between prediction and actual measurement.

White noise

Page 26: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

26

51

IV. Identification of discrete systems

errorpredictionmeasurements

JTotal

eps8yp8y8u8eps7yp7y7u7eps6yp6y6u6eps5yp5y5u5eps4yp4y4u4eps3yp3y3u3

y2u2y1u1

Example : orders na = 3 et nb = 2

( )2ub1ub...............................

3ya2a1ya5yp

21

321

⋅+⋅+⋅+⋅+⋅−=

5y5yp5eps −=

( )∑=

=N

1t

2teps

N

1J

Unknown : coefficients {a1, a2, a3, b1, b2}

Example of an Identification Process

52

IV. Identification of discrete systems

Recursive Least Square Algorithm

� Possible since model is linear� Possible since quadratic criteria� Interesting because of the recursive version

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

a

b

predict 1 2 n a

1 2 n b

y t 1 a y t a y t 1 ... a y t n 1

...............................b u t b u t 1 ... b u t n 1

+ = − ⋅ + ⋅ − + + ⋅ − + +

⋅ + ⋅ − + + ⋅ − +

Prediction equation can be re-written :

( ) ( )Tpredicty t t= θ ⋅φ

( ) [ ],...b,b,...a,atθ 2121T =

( ) ( ) ( ) ( ) ( )[ ],...1tu,tu,...1ty,tytφ T −−−−=

Example of an Identification Process

Where :

Page 27: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

27

53

IV. Identification of discrete systems

Estimate θ taking into account the full set of measurements� Obtained θ is optimal

Least Square Algorithm

( ) ( ) ( )( )∑=

−φ⋅=θt

1i

1iiytFˆ

With :

( ) ( ) ( )( )∑=

− −⋅−=t

1i

T1 1iφ1iφtF

54

IV. Identification of discrete systems

Estimate θ recursively for t = 0...N�θ obtained after recursion is optimal

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

( ) ( ) ( ) ( )

T

1 1 T

t t 1 F t t y t t 1 t

with :

F t F t 1 t t− −

θ = θ − + ⋅ϕ ⋅ − θ − ⋅ϕ

= − + ϕ ⋅ϕ

Algorithm can be applied in real time� parameters supervision

� diagnostis

� Algorithm can be improved with a forget factor : λ=0.95...0.99( ) ( ) ( ) ( ) ( ) ( ) ( )( )

( ) ( ) ( ) ( )

T

1 1 T

t t 1 F t t y t t 1 t

with :

F t F t 1 t t− −

θ = θ − + ⋅ϕ ⋅ − θ − ⋅ϕ

= λ ⋅ − + ϕ ⋅ϕ

Recursive Least Square (rls) Algorithm

Page 28: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

28

55

IV. Identification of discrete systems

Les algorithmes d’identification sont en général des variantes des moindres carrés récursifs

En tous cas ils ont tous, pour les algorithmes récursifs, la forme suivante :

Identification algorithms (general)

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

( ) ( ) ( ) ( )T11

T

tt1tFtF

avec

t1ttyttF1tt

ϕ⋅ϕ+−⋅λ=

ϕ⋅−θ−⋅ϕ⋅+−θ=θ

−−

56

IV. Identification of discrete systems

1. Choice of a frequency sampling� Not too big� Not too small

� Adapted to the fastet expected dynamic (usually closed loop dynamic)

Identification method

Page 29: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

29

57

IV. Identification of discrete systems

2. Excitation signal� Le signal doit être riche en fréquence� Signal can (and must) be of small amplitude (a few %)

Example 1 : Pseudo Random Binary Signal

0 5 10 15 20-1.5

-1

-0.5

0

0.5

1

1.5

Matlab / System Identification Toolboxe

>> u=idinput(500,’prbs’ )

Example 2 : excitation 3-2-1-1 (airplane identification) 3∆t

2∆t

∆t

∆t

Identification method

58

IV. Identification of discrete systems

3. Test and measurements� Choice of a setpoint

� Test� Remove mean of measurements� Remove absurd values

4. Model choice

� Example : ARX, degree of A and B

5. Apply algorithm� Example : rls

6. Validate

� Validation criteria ?

Iterate

Identification method

Page 30: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

30

59

IV. Identification of discrete systems

1. The model must predict the output

Validation criteria

2. The model behavior must be the same than the original for perturbations

( ) ( ) ( ) ( )( ) ( ) ( ) ( )te1ntub...1tubtub

1ntya...1tyatya1ty

bn21

an21

b

a

++−⋅++−⋅+⋅

=+−⋅++−⋅+⋅++The model :

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

( ) ( ) ( )( )1ty...............

1ntub...1tubtub...............

1ntya...1tyatyate

1ty1tyte

bn21

an21est

estest

b

a

+−

+−⋅++−⋅+⋅−

+−⋅++−⋅+⋅=+−+=

With the estimated model (ai, bi) one can estimate the error !

� Check that eest(t) is a white noise !

60

IV. Identification of discrete systems

Use dedicated software

Example : Matlab / System Identification Toolboxe...

Page 31: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

31

61

IV. Identification of discrete systems

1. Import datas 2. Choose model and algorithm

3. Validate : prédiction

3. Validate, residuals

62

IV. Identification of discrete systems

� Accelerate the identification processMatlab licence = 3000 € + toolboxes licence...

� « homemade » toolboxes are used for dedicated applications

Use dedicated software

Page 32: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

32

63

IV. Identification of discrete systems

Non parametric identification

From input/output datas, estimate the transfer function :

� Input / output cross correlation� FFT, Hamming window and tutti quanti

� Gain and phase, Bode diagram

From input / output datas, estimate the impulse response� Apply RLS algorithm with nB big and nA = 0

� Allow for instance to quickly estimate the pure delay

V. Closed loopsystems

Page 33: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

33

65

V. Closed loop systems

Reminder

F1(z)

E(z) S(z) U(z)

P(z)

R(z) F2(z)

F3(z)

S(z)

T(z)

F4(z)

F(z) e(z) s(z) u(z)

p(z)

Equivalent !

Open loop transfer function : F = S.F1.F2.F3.T

66

V. Closed loop systems

Closed loop transfer function

Open loop transfer function : F = S.F1.F2.F3.T

Closed loop transfer function :

G = F(1+F)G = B/(A+B)

Page 34: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

34

67

V. Closed loop systems

Static gain

As seen before :

∑∑

∑=

=

=

=

=

=

++=

ni

1ii

mi

0ii

mi

0ii

0

ab1

b

G

Condition to have a unitary closed loop static gain (no static error) :

1

ab1

b

Gni

1ii

mi

0ii

mi

0ii

0 =++

=

∑∑

∑=

=

=

=

=

= ( ) ( )( )

( )( )z'A

zB

z1

1

ze

zszF

1⋅

−==

−�

Integrator

68

V. Closed loop systems

Perturbation rejection

� Same condition on A(1) to perfectly reject the perturbations (integrator in the loop)

Perturbation-output transfer function

( ) ( )( )

( )( ) ( )11

1

ypzBzA

zA

zp

zszS

−−

+==

Generally the rejection perturbation condition is weaker : � |Syp(ej2πf)| < Smax for a subinterval of [0 0.5]

Page 35: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

35

69

V. Closed loop systems

Stability : poles

System is stable is the poles belong to the unit circle� Compute closed loop transfer function

� Jury criteria (equivalent to Routh)

� Compute poles� Draw the root locus

F(z)

e(z) s(z) u(z)

p(z)

– K

70

V. Closed loop systems

Example : root locus

F(z)

e(z) s(z) u(z)

p(z)

– K

Root Locus

-0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

0.1π/T

0.2π/T

0.3π/T0.4π/T0.5π/T0.6π/T

0.7π/T

0.8π/T

0.9π/T

π/T

0.1π/T

0.2π/T

0.3π/T

0.4π/T0.5π/T

0.6π/T

0.7π/T

0.8π/T

0.9π/T

π/T

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

System: sysGain: 0.0169Pole: 0.564 + 0.281iDamping: 0.706Overshoot (%): 4.35Frequency (rad/sec): 0.654System: sys

Gain: 0.0162Pole: 0.196Damping: 1

Overshoot (%): 0Frequency (rad/sec): 1.63

Page 36: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

36

71

V. Closed loop systems

Stability : frequency criteria

Nyquist criteria : as in the continuous case

-1 -0.5 0 0.5 1 1.5

-1.5

-1

-0.5

0

0.5

1

1.5

Nyquist Diagram

Real Axis

Imag

inar

y A

xis

f=0

f=0.

5

(-1,

0)

72

V. Closed loop systems

Nyquist criteria

Margins :

- Module margin �∆M- Gain module�∆G- Phase module�∆P

(-1,0)

∆P ∆M

1/∆G

Page 37: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

37

73

V. Closed loop systems

end C5 C6

VI. Control of sampled systems

Page 38: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

38

75

VI. Control of closed loop systems

Hypothesis

Requisites :

� Synchronous sampling� Regular sampling� Sampling time adapted to the desired closed loop performance

76

VI. Control of closed loop systems

Introduction

If K is linear, the RST form is canonical :

F(z)

e(t) s(t) u(t)

p(t)

– 1/S

R

Tr(t))

R, S et T are polynoms

Controller computes e(t) given r(t) and s(t) :

F(z) e(t) s(t)

p(t)

K(z) r(t))

Page 39: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

39

77

VI. Control of closed loop systems

Discretization of a continuous controller

1. Process is modelled as a linear transfer function (Laplace)

� No need to know a sampled model of the system2. Design of a continuous controller3. Discretization of the continuous controller

� Many discretization methods� Problem if Te too big (stability)� Problem if Te too small (numerical round up)

78

VI. Control of closed loop systems

Design of a discrete controller

1. System is known as a discrete transfer function (z-transform)

� Discxretizaiton of a continuous model + ZOH� Direct identification

2. Design of a discrete controller

1. PID 12. PID 23. Pole placement

4. Independant tracking and regulation goals

Page 40: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

40

79

VI. Control of closed loop systems

PID 1

Continuous PID : ( )

⋅+

⋅+

⋅+⋅=

sN

T1

sT

sT

11KsK

d

d

iPID

Discretization (Euler) : ( )

−⋅+

−⋅+

−⋅+⋅= −

e

1d

e

1

d

e

1

i

PID

T

q1

N

T1

T

q1T

T

q1T

11KqK

80

VI. Control of closed loop systems

PID 1

After re-arranging :

( ) ( ) ( )

⋅+=

⋅+⋅=

⋅+⋅

+⋅+

⋅+⋅+

+⋅−=

⋅+⋅

++⋅=

⋅+⋅−⋅+⋅+

⋅=−−

−−

ed

d'1

ed

d2

ed

d

ed

d

i

e

ed

d1

ed

d

i

e0

1'1

1

22

110

PID

TNT

Ts

TNT

TKr

TNT

TN

TNT

T

T

T

TNT

T1Kr

TNT

TN

T

T1Kr

qs1q1

qrqrrKqK

B/A s(t)

1/S

R

R r(t)

Page 41: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

41

81

VI. Control of closed loop systems

PID 1

Closed loop transfer function is : :

CLB R B R

HA S B R P

⋅ ⋅= =⋅ + ⋅

S as an integral teerm (the I of PID) :

( ) RB'Sz1ARBSAP 1 ⋅+⋅−⋅=⋅+⋅= −

Desired dynamics is given by the roots of P :

A,B,P � R S’

Small degrees : by hand

Large degrees : Bezout algorithm

82

VI. Control of closed loop systems

PID 1

Main drawback : new zeros given by R at the denominator...Solution : PID2

Page 42: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

42

83

VI. Control of closed loop systems

PID 2

B/A s(t)

1/S

R

R r(t)

Starting from the already known PID1 :

R is replaced by R(1) :

( )CLB

H R 1P

= ⋅

Static gain is one, desired dynamic remains the same� Same performances in rejection perturbation� Better performance (smaller overshoot) in tracking

84

VI. Control of closed loop systems

Pole placement

Can be seen as a more general PID 2 where degrees of R and S are not constrained.

( )( )

( )( ) ( )

A

A

B

B

d 1

OL 1

n1 11 n

n1 1 1 * 11 n

q B qH

A q

A q 1 a q ... a q

B q b q ... b q q B q

− −

−− −

−− − − −

⋅=

= + ⋅ + + ⋅

= ⋅ + + ⋅ = ⋅

Tracking performance

( ) ( )( )

( ) ( ) ( ) ( ) ( ) P

P

d 1 1

CL 1

n1 1 1 d 1 1 11 n

q B q T qH

P q

P q A q S q q B q R q 1 p q ... p q

− − −

−− − − − − − −

⋅ ⋅=

= ⋅ + ⋅ ⋅ = + ⋅ + + ⋅

Regulation performance :( ) ( )

( )1

11

ypqP

qSqAS −

−− ⋅=

Page 43: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

43

85

VI. Control of closed loop systems

Pole placement

P poles gives the closed loop dynamic :� PD Dominant poles (second order, natural frequency, damping)�PF auxiliary poles, faster

A,B,P � P : compute R and S

Static gain :� S = (1-q-1).S’

Rejection of harmonic perturbation

� S = HS.S’ where |HS | is small at a given frequency

Remove sensibility to an given frequency :� R = HR.R’ where | HR | is small at a given frequency

86

VI. Control of closed loop systems

Pole placement

Perturbation rejection : choice of R and S

PF.PD = (1-q-1).HS.S’.A + HR.R’.B

A.(1-q-1).HS B.HR PF.PD � R’ and S’

Static gain :� S = (1-q-1).S’

Rejection of harmonic perturbation� S = HS.S’ where |HS | is small at a given frequency

Remove sensibility to an given frequency :� R = HR.R’ where | HR | is small at a given frequency

Page 44: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

44

87

VI. Control of closed loop systems

Pole placement

Tracking : choice of T

T is replaced by the normalized factor :

B/A y(t)

1/S

R

T'

y*(t)

B*/A*

r(t)

1. T’ is chosen such as the transfer y*�y is as « transparent » as possible

2. B*/A* chosen such as r�y* as the desired dynamic

88

VI. Control of closed loop systems

Pole placement

Tracking : choice of T’

( ) ( ) ( )( )1

1d11

yy qP

qBqq'TqS * −

−−−− ⋅=

( ) ( )( )1B

qPq'T

11

−− =

With :

One obtain :

( ) ( )( )1B

qBqqS

1d1

yy*

−−− ⋅=

Page 45: Control of Discrete Systems - ISAE-SUPAERO of Discrete Systems ENSICA ... discrete state system analysis and control ... radius convergence and other fundamental mathematic stuff

45

89

VI. Control of closed loop systems

Placement de pôle

Tracking : choice of A* and B* :

� chosen according to tracking specifications

90

VI. Control of closed loop systems

Independant tracking and perturbation rejection specifications

P chosen to cancel poles of B*

� B must be stable

Tracking : choice of T’

( ) ( ) ( )( ) ( )1*1

1*1d11

yy qBqP

qBqqq'TqS * −−

−−−−−

⋅⋅⋅=

( ) ( )11 qPq'T −− =

With :

One obtain :

( ) ( )1d1yy qqS *

+−− =