0% found this document useful (0 votes)
49 views45 pages

Slides Control of Discrete Systems

Uploaded by

Abdo Hesham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views45 pages

Slides Control of Discrete Systems

Uploaded by

Abdo Hesham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Control of Discrete Systems

ENSICA

Yves Briere
ISAE

General Introduction

1
Overview

Prerequisites :
Automatique ENSICA 1A et 2A
Traitement 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.

Planning
22 slots of 1h15

Overview

Discrete signals and systems

Sampling continuous systems

Identification of discrete systems

Closed loop systems

Control methods

Control by computer

2
I. Introduction

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

3
II. Discrete signals and systems

What we deal with in this course

Computer DAC System ADC

The same problem as seen by the control system engineer :


P(z)

F4(z)
E(z)
U(z) S(z)
R(z) S(z) F1(z) F2(z)


T(z) F3(z)

Or, simply :
p(z)
u(z) e(z) s(z)
F(z)

7

II. Discrete signals and systems

II. Discrete signals and


systems

4
II. Discrete signals and systems

Reminder : the z-transform


Discrete signal : list of real numbers (samples)

s(k ) = {s 0 , s1 , s 2 ,...}
Z-transform : function of the complex z variable

s(z ) = Z(s(k )) = ∑ s(k ) ⋅ z −k
k =0

Existence of s(z) : generally no problem (convergence radius : s(z) exist for a


given radius |z| > R )

II. Discrete signals and systems

Reminder : properties of the z-transform


1 s(z ) = Z(s(k )) = ∑ s(k ) ⋅ z −k
k =0

2 Z(α ⋅ s1 (k ) + β ⋅ s 2 (k )) = α ⋅ Z(s1 (k )) + β ⋅ Z(s 2 (k )) Linearity


ds(z )
3 Z(k ⋅ s(k )) = − z ⋅
dz

4 ( )
Z c ⋅ s(k ) = s 
k z
c
5 Z(s(k − 1)) = s(k = −1) + z −1 ⋅ s(z ) Delay theorem
6 Z(s(k + 1)) = z ⋅ s(z ) − z ⋅ s(k = 0 )
7 s(k = 0 ) = lim z→∞ (s(z ))
 z −1  Final value theorem
8 s(k → ∞ ) = lim z→1  ⋅ s(z )
 z 

10

5
II. Discrete signals and systems

Reminder : basic signals

s(k) S(z)
δ(k) : unit impulse 1
z
u(k) : unit step
z −1
z
k.u(k)
(z − 1)2
z
c k ⋅ u (k )
z−c
z ⋅ sin (ω)
sin (ω ⋅ k ) ⋅ u (k )
z − 2 ⋅ z ⋅ sin (ω) + 1
2

11

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)

12

6
II. Discrete signals and systems

Reminder : discrete transfer function

We deal with Linear Time Invariant (LTI) systems

e(k) Discrete s(k)


LTI system

The sequence of output and input samples are consequently simply related
by:
s(k ) + a 1 ⋅ s(k − 1) + a 2 ⋅ s(k − 2 ) + ... + a n ⋅ s(k − n ) =
b 0 ⋅ e(k ) + b1 ⋅ e(k − 1) + b 2 ⋅ e(k − 2) + ... + b m ⋅ e(k − m )
The delay theorem gives:

s(z ) b + b1 ⋅ z −1 + b 2 ⋅ z −2 + ... + b m ⋅ z − m
= F(z ) = 0
e(z ) 1 + a 1 ⋅ z −1 + a 2 ⋅ z −2 + ... + a n ⋅ z − n
Normalized : a0 = 1 13

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 with
radius 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 »

14

7
II. Discrete signals and systems

Reminder : discrete transfer function


Properties

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

 Step response
b 0 + b 1 ⋅ z −1 + b 2 ⋅ z −2 + ... + b m ⋅ z − m
s(z ) =
1
×
1 + a 1 ⋅ z −1 + a 2 ⋅ z − 2 + ... + a n ⋅ z − n 1 − z −1

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


i=m
∑ bi
i =0
F0 = i=n
1+ ∑ai
i =1

15

II. Discrete signals and systems

Reminder : discrete transfer function


Properties : stability

 Any transfer function can be expressed as:

F(z ) =
( )(
e 0 ⋅ 1 + e1 ⋅ z −1 ⋅ 1 + e 2 ⋅ z −1 L 1 + e m ⋅ z −1 ) ( )
(1 + c 1 ⋅z −1
)⋅ (1 + c 2 ⋅z −1
)L (1 + c n ⋅z −1
)
Coefficients ci are either real or complex conjugates

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

Properties : singular value decomposition

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
16

8
II. Discrete signals and systems

Reminder : first order systems


Properties : first order system
zpk([],[0.6],1,1)
3 Pole-Zero Map
1

Imaginary Axis
2
0
1

0 -1
0 5 10 15 20 25 -3 -2 -1 0 1 2 3

zpk([],[0.9],1,1) Real Axis


10 Pole-Zero Map
1
Imaginary Axis

5 0

0 -1
0 5 10 15 20 25 -3 -2 -1 0 1 2 3

zpk([],[1],1,1) Real Axis


20 Pole-Zero Map
1
Imaginary Axis

10 0

0 -1
0 5 10 15 20 25 -3 -2 -1 0 1 2 3

zpk([],[1.2],1,1) Real Axis


200 Pole-Zero Map
1
Imaginary Axis

100 0

0 -1
0 5 10 15 20 25 -2 0 2 4
Real Axis 17

II. Discrete signals and systems

Reminder : second order systems


Properties : second order systems
Pole-Zero Map
1
0.5π/T
0.6π/T 0.4π/T

0.8 0.7π/T 0.1 0.3π/T


0.2
0.3
0.6
0.8π/T 0.4 0.2π/T
0.5
0.4 0.6
0.7
0.9π/T 0.8 0.1π/T
0.2
0.9
Imaginary Axis

π/T
0
π/T

-0.2
0.9π/T 0.1π/T

-0.4

0.8π/T 0.2π/T
-0.6

-0.8 0.7π/T 0.3π/T

0.6π/T 0.4π/T
0.5π/T
-1
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Real Axis
18

9
II. Discrete signals and systems

Reminder : second order systems


Properties : second order systems
zpk([],[0.6+0.5i 0.6-0.5i],1,1)
4 Pole-Zero Map
1

Imaginary Axis
2
0

0 -1
0 5 10 15 20 25 -3 -2 -1 0 1 2 3

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


1 Pole-Zero Map
Imaginary Axis 1

0.5 0

0 -1
0 5 10 15 20 25 -3 -2 -1 0 1 2 3
zpk([],[0.2+0.9i 0.2-0.9i],1,1) Real Axis
2 Pole-Zero Map
1
Imaginary Axis

1 0

0 -1
0 5 10 15 20 25 -3 -2 -1 0 1 2 3
zpk([],[0.6+0.9i 0.6-0.9i],1,1) Real Axis
5 Pole-Zero Map
1
Imaginary Axis

0 0

-5 -1
0 5 10 15 20 25 -3 -2 -1 0 1 2 3
19
Real Axis

II. Discrete signals and systems

Reminder : frequency response


Reminder : continuous systems
e( t ) = cos(2 ⋅ π ⋅ f ⋅ t ) + j ⋅ sin(2 ⋅ π ⋅ f ⋅ t ) = e j⋅2⋅π⋅f ⋅t

f ∈ [0 ∞ ]
Analogy : discrete system
e(k ) = cos(2 ⋅ π ⋅ f ⋅ k ) + j ⋅ sin (2 ⋅ π ⋅ f ⋅ k ) = e j⋅2⋅π⋅f ⋅k

f ∈ [0 1]
The output signal looks like
s(k ) = A(f ) ⋅ e j⋅(2⋅π⋅f ⋅k + Φ (f ))

f ∈ [0 1]
With F of phase Φ (degrees) and module A (decibels):
(
F(f ) = F z = e j⋅2⋅π⋅f

)
f ∈ [0 1]
20

10
II. Discrete signals and systems

Reminder : frequency response


Definition : frequency response

(
F(f ) = F z = e j⋅2⋅π⋅f

) f : normalized frequency (between 0 and 1)
f ∈ [0 1] F(f) : frequency response

Property : Bode diagram


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

15

10
Magnitude (dB)

-5
Bode diagram of a second order
-10
0
system. Note the linear scale for
-90
frequency.
Phase (deg)

-180

-270

-360
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
21
Frequency (Hz)

II. Discrete signals and systems

Reminder : Nyquist-Shannon sampling theorem

Plan complexe Plan complexe


continu discret

0
22

11
End of C1 C2

III. Sampling
continuous
systems

12
III. Sampled continuous systems
Discrete systems

Computer DAC System ADC

A real system is generally continuous (and described by differential


equations)
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
25

III. Sampled continuous systems


Hypothesis

Computer DAC System ADC

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

26

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

27

III. Sampled continuous systems


Sampling a continuous transfer function

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

The impulse response of a zoh is consequently:

1
t
0 Te

The Laplace transform of the above signal is:


1 e − Te ⋅s
ZOH ( s ) = −
s s

28

14
III. Sampled continuous systems
Sampling a continuous transfer function

The impulse response of ZOH+F is :


 1 e − j⋅Te 
s(s ) =  −  ⋅ F(s ) = ⋅ F(s ) − e − j⋅Te ⋅ F(s )
1 1

s s  s s

Two terms for the impulse response :

1  1  1 
s(k ) = Z ⋅ F(s ) − z −1 ⋅ Z F(s ) = 1 − z −1 ⋅ Z F(s ) ( )
s  s  s 

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

29

III. Sampled continuous systems


Sampling a continuous transfer function

Tables Matlab

F(s) FBOZ(z)
1 1
Matlab
1 Te ⋅ z −1
−1 % Definition of a continuous s ystem :
s 1− z
sysc=tf(1,[1 1]) ;
 b 1 ⋅ z −1
1  −1
% z_transfer function after sampling at Te
1 + a 1 ⋅ z
1+ T ⋅s  T Te
Te=0.1;
− e −
b 1 = 1 − e a1 = − e
T T sysd=c2d(s ysc,Te,'zoh');
− L⋅s −1 −2 % Notation with z^-1
e  b1 ⋅ z + b 2 ⋅ z
1+ T ⋅s  −1
a 1 = −e −Te T
sysd.var iable='z
 1 + a1 ⋅ z
L < Te

b1 = 1 − e
(L−Te ) T
b 2 = e −Te T
(e LT
)
−1

30

15
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.
Nyquist Diagram
2

1.5

0.5
Imaginary Axis

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

-1.5

-2
-1.5 -1 -0.5 0 0.5 1 1.5 2
Real Axis

31

III. Sampled continuous systems


Choice of sampling time
The sampling time is chosen according to the closed loop expected
performance

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

Example : third order system


>> F=1.5/(1+s+s^2)/(1+s)

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

Sampling time : 5 Hz

32

16
III. Sampled continuous systems
Choice of sampling frequency
Bode Diagram

10
F F/(1+F)
5
Magnitude (dB)

0 System: untitled1
Frequency (Hz): 0.269
-5 Magnitude (dB): -7.36
System: F
System: untitled1 Frequency (Hz): 0.196
-10 Frequency (Hz): 0.0215 Magnitude (dB): -3
Magnitude (dB): -4.36

-15

-20

-45

-90
Phase (deg)

-135

-180

-225

-270
-1
10
33
Frequency (Hz)

III. Sampled continuous systems


Choice of sampling frequency
Root Locus
2.5
0.76 0.64 0.5 0.38 0.24 0.12 F
System:
Gain: 1.64
2 Pole: -0.0488 + 1.35i
Damping: 0.0362
Overshoot (%): 89.2
0.88 Frequency (rad/sec): 1.35
1.5

0.97

0.5
Imaginary Axis

2.5 2 1.5 1 0.5


0
System: F
Gain: 1.69
-0.5 Pole: -1.92
0.97 Damping: 1
Overshoot (%): 0
-1 Frequency (rad/sec): 1.92

-1.5
0.88

-2

0.76 0.64 0.5 0.38 0.24 0.12


-2.5
-3 -2.5 -2 -1.5 -1 -0.5 0 0.5
Real Axis
34

17
III. Sampled continuous systems
Choice of sampling frequency

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

2 4 6 8 10 12 14

35

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
1

0.9

0.8
0 .1 5

0.7

0 .1

0.6

0 .0 5
0.5

0.4 0

0.3
-0 .0 5

0.2

-0 .1
0.1

0 0 5 1 0 1 5
0 5 10 15

36

18
III. Sampled continuous systems
First approach : discretise a continuous controller

The sampling effect (ZOH) is neglected.


e (s )
Example : continuous PD : PID ( s ) = = kp + kD ⋅ s
ε (s )
dε ( t )
e ( t ) = kp ⋅ ε ( t ) + kD ⋅
dt
Continuous derivative is replaced by a discrete derivative :
ε(k ) − ε(k − 1)
e(k ) = k p ⋅ ε(k ) + k D ⋅
Te

Transfer function :

ε(z ) − z −1 ε(z )  1 − z −1 
e(z ) = k p ⋅ ε(z ) + k D ⋅ =  k p + k D ⋅  ⋅ ε(z )
Te  Te 
1 − z −1
S to z equivalence : s=
Te 37

III. Sampled continuous systems


First approach : discretise a continuous controller

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


numerical methods of integration

Method s to z equivalence

Euler's forward 1 − z −1
s=
method z −1 ⋅ T e

Euler's backward 1 − z −1
s=
method Te

2 1 − z −1
Tustin method s= ⋅
T e 1 + z −1

38

19
III. Sampled continuous systems
First approach : discretise a continuous controller

Warning : methods are not equivalent !


1

0.8
Blue : zoh
0.6 Green : tustin
0.4

0.2

-0.2

-0.4

-0.6
(No problem if sampling
time is small)
-0.8

-1
-1.5 -1 -0.5 0 0.5 1 39

III. Sampled continuous systems


First approach : discretise a continuous controller

Equivalence of contrinuous poles after « s to z » conversion

s z

(a) (b)

z z
(a) : continuous
1
(b) : Euler forward
(c) : Euler backward
(d) : Tustin

(c) (d)
40

20
III. Sampled continuous systems

End C3 C4

41

IV. Identification of
discrete systems

21
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 (cf


last 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”

43

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 ?…

44

22
IV. Identification of discrete systems
Naive approach
Example : real step test (o) and simulated first order step (x)
1.4

1.2

0.8

0.6

0.4

0.2

0 45
0 1 2 3 4 5 6 7 8

IV. Identification of discrete systems


Naive approach

A little bit of method ?


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

1 N
J= ∑ (y reel (t ) − y mesuré (t ))2
N t =1
>> t=0:0.1:8;
>> p=tf('p'); After some iterations one obtain J
>> sysreal=tf(1/(1+2*p)/(1+0.6*p)*(1+0.5*p))
minimal with tau=1.81 s
+0.02*randn(length(t),1);
>> yreal=step(sysreal,t)+0.02*randn(length(t),1);
>> ysimul=step(1/(1+2*p),t);
Better model with a delay, two
parameters to tune
>> plot(t,yreal,'bo',t,ysimul,'rx')

>> eps=yreel-ysimul;
>> J=1/length(eps)*eps'*eps;
46

23
IV. Identification of discrete systems
Naive approach

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

47

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.

48

24
IV. Identification of discrete systems

Basic principle of parametric identification

perturbations

u(t) y(t)
ADC Physical system DAC

ŷ(t)
Numerical model
ε(t)

Parameters of the model Parameters Adaptation


Algorithm

49

IV. Identification of discrete systems


Example of an Identification Process
Linear model (ARX) :

A⋅ y = B⋅u + e
White noise

y(t + 1) + a1 ⋅ y(t ) + a 2 ⋅ y(t − 1) + ... + a n a ⋅ y(t − n a + 1) =


b1 ⋅ u (t ) + b 2 ⋅ u (t − 1) + ... + b n b ⋅ u (t − n b + 1) + e(t )

Model used as a predictor :

( )
y predict ( t + 1) = − a1 ⋅ y ( t ) + a 2 ⋅ y ( t − 1) + ... + a n a ⋅ y ( t − n a + 1) +
...............................b1 ⋅ u ( t ) + b 2 ⋅ u ( t − 1) + ... + b n b ⋅ u ( t − n b + 1)

 Try to minimize the difference between prediction and actual measurement.

50

25
IV. Identification of discrete systems
Example of an Identification Process

Example : orders na = 3 et nb = 2

measurements prediction error


u1 y1
u2 y2 yp5 = −(a1 ⋅ y1 + a 2 ⋅ 2 + a 3 ⋅ y3) +
u3 y3 yp3 eps3 ...............................b1 ⋅ u1 + b 2 ⋅ u 2
u4 y4 yp4 eps4 eps5 = yp5 − y5
u5 y5 yp5 eps5
1 N
∑ (eps t )2
u6 y6 yp6 eps6
J=
u7 y7 yp7 eps7 N t =1
u8 y8 yp8 eps8
Unknown : coefficients
Total J {a1, a2, a3, b1, b2}

51

IV. Identification of discrete systems


Example of an Identification Process

Recursive Least Square Algorithm


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

(
y predict ( t + 1) = − a1 ⋅ y ( t ) + a 2 ⋅ y ( t − 1) + ... + a n a ⋅ y ( t − n a + 1) + )
...............................b1 ⋅ u ( t ) + b 2 ⋅ u ( t − 1) + ... + b n b ⋅ u ( t − n b + 1)

Prediction equation can be re-written :


y predict = θT ( t ) ⋅ φ ( t )

Where : θ(t )T = [a 1 , a 2 ,...b1 , b 2 ,...]

φ(t )T = [− y(t ),− y(t − 1),...u (t ), u (t − 1),...]

52

26
IV. Identification of discrete systems
Least Square Algorithm

Estimate θ taking into account the full set of measurements


 Obtained θ is optimal

t
θˆ = F(t )∑ (y(i ) ⋅ φ(i − 1))
i =1

With :

∑ (φ(i − 1)⋅ φ(i − 1) )


t
F(t )−1 = T

i =1

53

IV. Identification of discrete systems


Recursive Least Square (rls) Algorithm

Estimate θ recursively for t = 0...N


θ obtained after recursion is optimal

(
θ ( t ) = θ ( t − 1) + F ( t ) ⋅ ϕ ( t ) ⋅ y ( t ) − θT ( t − 1) ⋅ ϕ ( t ) )
with :
−1 −1
F ( t ) = F ( t − 1) + ϕ ( t ) ⋅ ϕ ( 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 ) = θ ( t − 1) + F ( t ) ⋅ ϕ ( t ) ⋅ y ( t ) − θT ( t − 1) ⋅ ϕ ( t ) )
with :
−1 −1
F ( t ) = λ ⋅ F ( t − 1) + ϕ ( t ) ⋅ ϕ ( t )
T
54

27
IV. Identification of discrete systems
Identification algorithms (general)

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 :

( )
θ(t ) = θ(t − 1) + F(t ) ⋅ ϕ(t ) ⋅ y(t ) − θ T (t − 1) ⋅ ϕ(t )
avec
F(t ) = λ ⋅ F(t − 1) + ϕ(t ) ⋅ ϕ(t )
−1 −1 T

55

IV. Identification of discrete systems


Identification method

1. Choice of a frequency sampling


 Not too big
 Not too small
 Adapted to the fastet expected dynamic (usually closed loop dynamic)

56

28
IV. Identification of discrete systems
Identification method

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


1.5

0.5
Matlab / System Identification Toolboxe
0

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


-1

-1.5
0 5 10 15 20

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


3∆t ∆t

∆t
2∆t
57

IV. Identification of discrete systems


Identification method
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
58

29
IV. Identification of discrete systems
Validation criteria

1. The model must predict the output

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

The model :
y(t + 1) + a1 ⋅ y(t ) + a 2 ⋅ y(t − 1) + ... + a n a ⋅ y(t − n a + 1) =
b1 ⋅ u (t ) + b 2 ⋅ u (t − 1) + ... + b n b ⋅ u (t − n b + 1) + e(t )
With the estimated model (ai, bi) one can estimate the error !
e est (t ) = y est (t + 1) − y(t + 1)
e est (t ) = a1 ⋅ y(t ) + a 2 ⋅ y(t − 1) + ... + a n a ⋅ y(t − n a + 1)
............... − b1 ⋅ u (t ) + b 2 ⋅ u (t − 1) + ... + b n b ⋅ u (t − n b + 1)
............... − y(t + 1)
 Check that eest(t) is a white noise !
59

IV. Identification of discrete systems


Use dedicated software

Example : Matlab / System Identification Toolboxe...

60

30
IV. Identification of discrete systems

3. Validate :
prédiction

1. Import datas 2. Choose model


and algorithm
3. Validate,
residuals

61

IV. Identification of discrete systems


Use dedicated software

 Accelerate the identification process


Matlab licence = 3000 € + toolboxes licence...
 « homemade » toolboxes are used for dedicated applications

62

31
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

63

V. Closed loop
systems

32
V. Closed loop systems
Reminder
P(z)

F4(z)
E(z)
U(z) S(z)
R(z) S(z) F1(z) F2(z)


T(z) F3(z)

Equivalent !
p(z)
u(z) e(z) s(z)
F(z)

Open loop transfer function :


F = S.F1.F2.F3.T
65

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)

66

33
V. Closed loop systems
Static gain

As seen before :
i=m
∑ bi
i=0
G0 = i=m i=n
1 + ∑ bi + ∑ a i
i =0 i =1

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

i=m
∑ bi s(z ) B(z )
F(z ) =
1
G0 = i =0
=1  = ⋅
i=m i=n e(z ) 1 − z −1 A' (z )
1 + ∑ bi + ∑ a i
i =0 i =1

Integrator
67

V. Closed loop systems


Perturbation rejection

Perturbation-output transfer function

S yp (z ) =
s(z )
=
A z −1 ( )
( ) ( )
p(z ) A z + B z −1
−1

 Same condition on A(1) to perfectly reject the perturbations


(integrator in the loop)

Generally the rejection perturbation condition is weaker :


 |Syp(ej2πf)| < Smax for a subinterval of [0 0.5]

68

34
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

p(z)
e(z)
u(z) s(z)
K F(z)

69

V. Closed loop systems


Example : root locus
Root Locus

0.6π/T 0.5π/T 0.4π/T


0.8 0.7π/T 0.3π/T

0.6
0.2π/T

0.8π/T
0.4

0.1π/T
0.2
p(z)
0.9π/T System: sys
e(z) Gain: 0.0169
π/T
u(z) s(z)
Pole: 0.564 + 0.281i
0 K F(z) Damping: 0.706
π/T Overshoot (%): 4.35
– System: sys
Gain: 0.0162
Frequency (rad/sec): 0.654
0.9π/T 0.9
-0.2 Pole: 0.196
Damping: 1 0.8
0.1π/T
Overshoot (%): 0 0.7
-0.4 Frequency (rad/sec): 1.63 0.6
0.8π/T
0.5
0.4 0.2π/T
-0.6 0.3
0.2
-0.8 0.7π/T 0.1 0.3π/T

0.6π/T 0.4π/T
0.5π/T
-1
-0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
70

35
V. Closed loop systems
Stability : frequency criteria
Nyquist criteria : as in the continuous case
Nyquist Diagram
1.5
Imaginary Axis

f=0
f=0.5
1

0.5
(-1,0)

-0.5

-1

-1.5
-1 -0.5 0 0.5 1 1.5

Real Axis

71

V. Closed loop systems


Nyquist criteria
Margins :

1/∆G

(-1,0)
- Module margin ∆M
- Gain module ∆G
∆M ∆P
- Phase module ∆P

72

36
V. Closed loop systems

end C5 C6

73

VI. Control of
sampled systems

37
VI. Control of closed loop systems
Hypothesis

Requisites :

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

75

VI. Control of closed loop systems


Introduction
Controller computes e(t) given r(t) and s(t) :
p(t)
e(t) s(t)
r(t)) K(z) F(z)

If K is linear, the RST form is canonical :


p(t)
u(t) e(t)
s(t)
r(t)) T 1/S F(z)
––
R

R, S et T are polynoms

76

38
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 system
2. Design of a continuous controller
3. Discretization of the continuous controller
 Many discretization methods
 Problem if Te too big (stability)
 Problem if Te too small (numerical round up)

77

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 1
2. PID 2
3. Pole placement
4. Independant tracking and regulation goals

78

39
VI. Control of closed loop systems
PID 1
 
 T ⋅ s 
K PID (s ) = K ⋅ 1 +
1 
Continuous PID : + d
 Ti ⋅ s Td 
 1 + ⋅ s 
 N 
 1 − q −1 
 Td ⋅ 
 Te 
K PID (q ) = K ⋅ 1 +
1
Discretization (Euler) : −1
+ −1 
 1 − q T 1 − q 
 Ti ⋅ 1+ d ⋅
 Te N Te 

79

VI. Control of closed loop systems


PID 1
r0 + r1 ⋅ q −1 + r2 ⋅ q −2
K PID (q ) = K ⋅
(1 − q )⋅ (1 + s
−1 '
1 ⋅ q −1 )
  Te N ⋅ Td 
r0 = K ⋅ 1 + + 
After re-arranging :   Ti Td + N ⋅ Te 
 N ⋅ Td
r1 = − K ⋅ 1 + Td T
+ e ⋅
Td
+


 + ⋅ + ⋅
  T d N Te T i Td N Te Td + N ⋅ Te 

  Td 
r(t) s(t) r2 = K ⋅  T + N ⋅ T 
R 1/S B/A   d e 
–  ' Td
R
s1 =
 Td + N ⋅ Te

80

40
VI. Control of closed loop systems
PID 1

Closed loop transfer function is : :


B⋅R B⋅R
H CL = =
A ⋅S + B⋅ R P

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

( )
P = A ⋅ S + B ⋅ R = A ⋅ 1 − z −1 ⋅ S'+ B ⋅ R

Desired dynamics is given by the roots of P :

A,B,P  R S’

Small degrees : by hand


Large degrees : Bezout algorithm

81

VI. Control of closed loop systems


PID 1

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


Solution : PID2

82

41
VI. Control of closed loop systems
PID 2

Starting from the already known PID1 :


r(t) s(t)
R 1/S B/A

R

R is replaced by R(1) :
B
H CL = R (1) ⋅
P

Static gain is one, desired dynamic remains the same


 Same performances in rejection perturbation
 Better performance (smaller overshoot) in tracking

83

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.
H OL =
( )
q − d ⋅ B q −1
A (q )
−1

 ( )
A q −1 = 1 + a1 ⋅ q −1 + ... + a n ⋅ q − n A
A

( )
−1 −1 −n
B q = b1 ⋅ q + ... + bn B ⋅ q B = q ⋅ B q
−1 * −1
( )
Tracking performance

H CL =
( ) ( )
q − d ⋅ B q −1 ⋅ T q −1
P (q ) −1

P (q ) = A (q ) ⋅ S(q ) + q
−1 −1 −1 −d
( ) ( )
⋅ B q −1 ⋅ R q −1 = 1 + p1 ⋅ q −1 + ... + pn P ⋅ q − n P

A (q )⋅ S(q )
−1 −1
=
P (q )
Regulation performance : S yp −1

84

42
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
85

VI. Control of closed loop systems


Pole placement

Perturbation rejection : choice of 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

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

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

86

43
VI. Control of closed loop systems
Pole placement

Tracking : choice of T

T is replaced by the normalized factor :


r(t) y*(t) y(t)
* *
B /A T' 1/S B/A

R

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


possible
2. B*/A* chosen such as ry* as the desired dynamic

87

VI. Control of closed loop systems


Pole placement

Tracking : choice of T’

( ) ( )q P⋅(qB(q) )
−d −1
S yy* q −1 = T' q −1 −1

With :

( ) PB(q(1) )
−1
T' q −1 =

One obtain :

( )
S yy* q −1 = q −d ⋅
( )
B q −1
B(1)

88

44
VI. Control of closed loop systems
Placement de pôle

Tracking : choice of A* and B* :

 chosen according to tracking specifications

89

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’
( ) ( ) qP(q⋅ q )⋅ B⋅ B(q(q ) )
−d −1 * −1
Syy* q −1 = T' q −1 −1 * −1

With :

( ) ( )
T' q −1 = P q −1

One obtain :
( )
Syy* q −1 = q − (d +1)

90

45

You might also like