exercises for lectures 24 discrete controlexample: discrete observer michael Šebek ari-24-2014 10...

43
Exercises for lectures 24 – Discrete control Michael Šebek Automatic Control 2016 9-5-17

Upload: others

Post on 27-Mar-2021

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Exercises for lectures24 – Discrete control

Michael ŠebekAutomatic Control 2016

9-5-17

Page 2: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example

Michael Šebek 2ARI-24-2012

• Consider a double integrator sampled with sampling period h

• And find the state feedback assigning required characteristicpolynomial:

Coordinate transformation solution

• Sampled double integrator with characteristic polynomial

• And its controllability canonical form

• Is and therefore

2

1 0( )clp z z p z p

21 2( 1) ( ) ( )

0 1

h hx k x k u k

h

2 2det 1 2 1z z z z I F

2 1 1( 1) ( ) ( )

1 0 0x k x k u k

2 22 3 2h h

h h

C1 2

0 1

C2

1 1

2

1 0.5

1 0.5

h hT

h h

CC

Page 3: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example

Michael Šebek 3ARI-24-2012

• Given and desired characteristic polynomial comparison

• The state FB is based on canonical coordinates

• Finally, with inverse transform we get:

2

1 0( )clp z z p z p 2 2det 1 2 1z z z z I F

1 1 1 1

2 0 0 0

2

1

k p a p

k p a p

1 02 1p p K

2

1 1 0 1 01 0 22

1 0.5 1 32 1

21 0.5

h h p p p pp p

h hh h

K KT

Page 4: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example – different solution

Michael Šebek 4ARI-24-2012

• For Ackermann formula we prepare

• and

• So we get the same result

1 0 12

1 0

1 0

1 2( )

0 1cl

p p h p hp p p

p p

F F F I

12 2 2

1

2

2 3 2 1 1.5

1 0.5

h h h h

h h h h

C

2

1 0 11

21 0

1 0 1 0

2

1 21 1.5( )0 1 0 1

0 11 0.5

1 3

2

cl

p p h p hh hp

p ph h

p p p p

h h

K FC

Page 5: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: Deadbeat

Michael Šebek 5ARI-24-2012

State deadbeat for double integrator

• For system

• And the required characteristic polynomial

• We have already calculated

• So simply substitute

• And we get

1 00, 0p p

21 2( 1) ( ) ( )

0 1

h hk k u k

h

x x

1 0 1 0

2

1 3

2

p p p p

h h

K

2

1 0( )clp z z p z p

2

1 3

2h h

K

Page 6: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: Deadbeat

Michael Šebek 6ARI-24-2012

• We will verify the result

• And calculate the signals:

- all inputs are growing withdecreasing h- It takes only steps

2

new 2

new

1 1 2 42 1 3

0 1 1 1 22

1 2 4

1 1 2

h hh

hh hh

z hz

h z

F F GK

I F 2

newdet zI F z

10

20

10 10 20

20 10 20

10 20

10 20

(0)

2 41 2 4(1) (0)

21 1 2

2 41 2 4 0(2) (1)

21 1 2 0

new

new

xx

x

x x hxhx F x

x x h xh

x hxhx F x

x h xh

10 10 20

2 2

20

10 20 10 20

2 2

10 20

2

31 3(0) (0)

2 2

2 41 3(1) (1)

22 2

01 3(2) (2) 0

02

x x xu Kx

xh h h h

x hx x xu Kx

x h xh h h h

u Kxh h

Page 7: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example Deadbeat

Michael Šebek 7ARI-24-2012

• The same result is obtained by z-transformation

1

1 10

new

20

10 10 10

20 20 20

10 10 20 10 10 20

20 10 20

1 2 4( ) (0)

1 1 2

1 2 4 1 0 1 2 41 1

1 1 2 0 1 1 1 2

2 4 2 41

2

xz hx z z zI F x z

xh z

x x xz h h

x x xh z hz z

x x hx x x hx

x x h xz

1

1

20 10 20

10 10 20 1 2

20 10 20

10 10 20 1 2

2

20 10 20

10 20 10 20

2 2

2

2 4 0

2 0

2 4 01 3( ) ( )

2 02

3

2 2

z

x x h x z

x x hxz z

x x h x

x x hxu z Kx z z z

x x h xh h

x x x x

h h h

1 20z zh

Page 8: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Simulation – discrete system

Michael Šebek 8ARI-24-2012

• model AW_Deadbeat.mdl 1 21, (0) 1, (0) 1h x x

( )u k

1( )x k2 ( )x k

Page 9: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Simulation – continuous systm

Michael Šebek 9ARI-24-2012

• model AW_Deadbeat.mdl

1 2(0) 1, (0) 1, 0.5,1,2x x h

1( )x k

2 ( )x k

( )u k

0.5h 1h 2h

Page 10: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: Discrete observer

Michael Šebek 10ARI-24-2014

• Lets take double integrator with sampling period h again

• And find observability matrix such that the dynamics of state estimation has a characteristic polynomial

Naive solution (for 2nd order OK)

• The observer dynamics (state estimation) has a matrix

• With characteristic polynomial

• By comparing the coefficients with the desired char. Polynomial weget equations , with solution

2

poz 1 0( )p z z p z p

21 2

( 1) ( ) ( ), ( ) 1 0 ( )0 1

h hk k u k y k k

h

x x x

1 1

poz

2 2

111 0

10 1

l l hh

l l

F F LH

2

1 1 2( ) 2 1p z z l z l l h

1 1

1 2 0

21

l pl l h p

1 1

2 1 0

21

l pl p p h

Page 11: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example:Discrete observer different solution

Michael Šebek 11ARI-24-2012

• To solve the Ackermann formula we prepare

a

• Then we will get the same result

• And verify the solution

1 0 12

poz 1 0

1 0

1 2( )

0 1

p p h p hp p p

p p

F F F I

11 0 1 0

1 1 1h h h

O ,O

1 0 11

poz

1 0

1

1 2

1 20 1 0 0( )

0 11 1 1 1

2

1

p p h p hp

p p h h

p

p p h

L F O

1

poz

1 0

2

1 0 poz

1,

1 1

det( ) ( )poz

p h

p p h

z z p z p p z

F

I F

Page 12: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: Deadbeat observer

Michael Šebek 12ARI-24-2012

• Lets take double integrator with sampling period h again

• We derive observer with the state injection matrix L in previous example

• It estimates the state of the systém with the dynamics given by the char. polynomial:

• This general observer goes to deadbeat by setting

• So the injection matrix is

2

poz 1 0( )p z z p z p

21 2

( 1) ( ) ( ), ( ) 1 0 ( )0 1

h hk k u k y k k

h

x x x

1

1 2

2

1

p

p p h

L

1 0 0p p

2

1 h

L

Page 13: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Simulation – discrete system

Michael Šebek 13ARI-24-2012

AW_Observer_Deadbeat.mdl

1 2

1 2

(0) 1, (0) 1

ˆ (0) (0) 0

x x

x x

1( )x k

1̂( )x k

2 ( )x k

2ˆ ( )x k

Page 14: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

AW_Observer_Deadbeat.mdl

Simulation – continues system

Michael Šebek 14ARI-24-2012

1 2

1 2

(0) 1, (0) 1

ˆ (0) (0) 0

0.5

x x

x x

h

1( )x k

1̂( )x k

2 ( )x k

2ˆ ( )x k

Page 15: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: output feedback - deadbeat type

Michael Šebek 15ARI-24-2012

• In model AW_Observer_SSZV_Deadbeat.mdlwe join

– Sampled double integrator

– deadbeat system

– deadbeat observer

• Sumulation is done for values:

1 2

1 2

(0) 1, (0) 1

ˆ (0) (0) 0

x x

x x

Page 16: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: output feedback - deadbeat type

Michael Šebek 16ARI-24-2012

• discrete systemand controller

• The control takes 4 steps, of which 2 steps

take the state estimate and 2 steps the control

• System order is 2, controller order is also 2

1( ) ( )x k y k

1̂( )x k

2 ( )x k

2ˆ ( )x k

( )u k

Page 17: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: output feedback - deadbeat type

Michael Šebek 17ARI-24-2012

continues system(double integrator) and discretecontroller

• Controll takes 4 steps

• State estimation takes 2 steps, then

the states are equal in sampling moments.

• And then 2 steps controll

• System order is 2, controller order is also 2

1( ) ( )x k y k

1̂( )x k

2 ( )x k

2ˆ ( )x k

( )u k

Page 18: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Optional: Luenberger's reduced observer

Michael Šebek 18ARI-24-2012

• The previous observer with an eq.It contains unnecessary delay, since its state in time k dependsonly on measurements up to time k-1

• It doesn´t use the kowledge about output in the time k

• Because the output can be directly measured. It is sufficient to estimate1 state less.

• Thus, the observer with the equation is better

• For estimation error applies

• And selecting a matrix L can set any eigenvalues

• Next and if L meetsthen output is estimated without error and we can

eliminate one equation! This reduced observer does not include a bundle model.

( ) ( 1) ( 1)k k k x F LHF x Fx

ˆ( )x k

ˆ( ) ( ) ( ) ( 1)y k k x k k Hx H I LH x

I LH 0

ˆ ˆ ˆ( 1) ( ) ( ) ( ( ) ( ))k k u k y k y k x Fx G L

ˆ ˆ( ) ( 1) ( 1) ( ) ( 1) ( 1)

ˆ ( 1) ( 1) ( )

k k u k y k k u k

k u k y k

x Fx G L H Fx G

I KH Fx G L

Page 19: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example

Michael Šebek 19ARI-24-2012

• Lets take double integrator with sampling period h

• The observer equation is

• choice is and from first equation

• The reduced observer has equation

• choice set any eigenvalue

• For example gives a deadbeat estimator

21 2

( 1) ( ) ( ), ( ) 1 0 ( )0 1

h hk k u k y k k

h

x x x

21 1 11

2 2 22

1 (1 ) (1 ) 2ˆ ˆ( ) ( 1) ( 1) ( )

1 (1 2)

l h l ll hk k u k y k

l hl lh hl

x x

1̂( ) ( )x k y k

2 2 2 2 2ˆ ˆ( ) (1 ) ( 1) ( ) ( 1) 1 2 ( 1)x k hl x k l y k y k h hl u k

2 1l h

2l

I LC 01 0l

Page 20: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: reduced deadbeat

Michael Šebek 20ARI-24-2012

• For We have a reduced deadbeat observer

• Which is the first-order system that can be realized with one time delayas:

• The first state of the system is equal to the output therefore we don´testimate this state (only measure)

• Simulation of AW_Observer_Reduced.mdl verify, that the second state is estimated exactly after one step.

1 1̂( ) ( ) ( )x k y k x k

2ˆ ( ) 1 ( ) 1 ( 1) 2 ( 1)x k h y k h y k h u k

1 20, 1l l h

1

2ˆ ( ) 1 ( ) 2 ( ) 1 ( )x z h y z z h u z h y z

1( )x k

2 ( )x k

2ˆ ( )x k

Page 21: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: reduced observer + state FB

Michael Šebek 21ARI-24-2012

• Finally, by connecting the reduced observer with the state FB, we get a 1st order output deadbeat controllerAW_Observer_Reduced_and_SSFB.mdl

• Everything is done

in 3 steps

1( ) ( )y k x k

2 ( )x k

2ˆ ( )x k ( )u k

Page 22: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: reduced observer + state FB

Michael Šebek 22ARI-24-2012

• And the same for continuous systémAW_Observer_Reduced_and_SSFB.mdl

• Everything is done

in 3 steps

1( ) ( )y k x k

( )u k

2 ( )x k

2ˆ ( )x k

Page 23: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Polynomial pole placement: example in z

Michael Šebek 23ARI-24-2012

Polynomial solution in z

• It is the same as a continuous solution in s

• For given system

and given poles, expressed by CL char. polynomial

• We solve and we get

• Example

• Let´s look at the example of satellite orientation (double integrator)

• Finally, we will assign a general characteristic polynomial of order 3 (why?)

controllerb

a

systemyq

p

u

( ) ( )b z a z

( )c z

( ) ( ) ( ) ( ) ( )a z p z b z q z c z ( ) ( )q z p z

21 2( 1) ( ) ( )

0 1

( ) 1 0 ( )

h hk k u k

h

y k k

x x

x

2

2

( ) 1

( ) 2 ( 1)

b z h z

a z z

3 2

2 1 0( )c z z c z c z c

2 2( ) ( 1) , ( ) 2 1a z z b z h z

Page 24: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Pole placement: example solved in z

Michael Šebek 24ARI-24-2012

• So we will solve the polynomial equation

• After a while of counting

• So the required position of the CL poles is provided by the controller with transfer function:

2 2 3 2

2 1 0( 1) ( ) 2 1 ( )z p z h z q z z c z c z c

2 1 0

2 2

2 1 0 2 1 0

( ) 3 4

( ) 3 5 (2 ) 3 3 (2 )

p z z c c c

q z z c c c h c c c h

2 1 0 2 1 0

2

2 1 0

3 5 3 3( ) 2

( ) 4 3

c c c z c c cq z

p z h z c c c

Page 25: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Pole placement: example solved in z

Michael Šebek 25ARI-24-2012

• For je

• By choosing continuous poles

• Discrete poles are

• And from this

• We get

1,2

3

1.8 0.5

5

s j

s

1,2 30.8342 0.0417, 0.6065z j z

3 2( ) 2.275 1.7096 0.4232c z z z z

( ) 15.3928 14.2429

( ) 0.3519

q z z

p z z

>> h=0.1;a=(z-1)^2;b=1/2*h^2*(1+z);

>> c=(z-exp((-1.8-j*0.5)*h))*...

(z-exp((-1.8+j*0.5)*h))*...

(z-exp((-5)*h));

>> [p,q]=axbyc(a,b,c)

>> gain=value(b*q/c,1);

>> gainSSZV=value(b*p/c,1);

p = -0.3519 + 1.0000z,

q = -14.2429 + 15.3928z

>> a,b,c

a = 1-2z+z^2, b=0.0050+0.0050z

c = -0.4232+1.7096z-2.2750z^2+z^3

0.1h

2

0.0050 1( )

( ) 2 1

zb z

a z z z

>> as=s^2;bs=1;

>> cs=(s-(-1.8-j*0.5))*...

(s-(-1.8+j*0.5))*(s+5);

>> [ps,qs]=axbyc(as,bs,cs);

>> as,bs,cs,ps,qs

>> gains=value(bs*qs/cs,0);

as = s^2

bs = 1

cs = 17 + 21s + 8.6s^2 + s^3

ps = 8.6 + s

qs = 17 + 21s

Co

ntin

uo

us

design

Page 26: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example - simulation

Michael Šebek 26ARI-24-2012

• Model SatelliteDiscretePol.mdl + all polynomials in Matlabu

( )u k

( )y k

( )u k

( )u k_ ( )diskretni regulatory k

_ ( )spojity regulatory k

Discretesystem

Continuoussystem

Page 27: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Pole placement: example solved in z-1

Michael Šebek 27ARI-24-2012

• Solution is similar

• and

• We get equation

• With the solution

1 3 2 3

1 2 3

( ) 2.275 1.7096 0.4232

1 2.275 1.7096 0.4232

c z z z z z

z z z

1

1

( ) 15.3928 14.2429

( ) 1 0.3519

q z z

p z z

1 2

1 2 2

1

1 2

0.0050 1( )

( ) 2 1

0.0050 1

1 2

zb z z

a z z z z

z

z z

1 2 1 1 1 1 2 3(1 2 ) ( ) 0.0050 1 ( ) 1 2.275 1.7096 0.4232z z p z z q z z z z

>> h=0.1;a=(z-1)^2;

>> b=1/2*h^2*(1+z);

>>c=(z-exp((-1.8-j*0.5)*h))*...

(z-exp((-1.8+j*0.5)*h))*...

(z-exp((-5)*h));

>> azi=a*z^-2;bzi=b*z^-2;

>> czi=c*z^-3;

>>[pzi,qzi]=axbyc(azi,bzi,czi);

>> pzi,qzi

pzi = 1 - 0.35z^-1

qzi = 15 - 14z^-1

Page 28: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Deadbeat as a special pole placement

Michael Šebek 28ARI-24-2012

• Deadbeat is special case for pole placement for discrete systems

• We choose , where m ≥ 2× system order – 1

• The deadbeat controller can be found by solving the equation

• From solutions we choose the minimum degree in q

• In the resulting system, each initial state (of the system and the controller) will disappear in the finite number of steps, at latest in step m

Example

• The deadbeat controller for satellite orientation (double integrator) is obtained by solving the equation

• The resulting controller has a TF

(which we can easily get from previous example)

( ) mc z z

( ) ( ) ( ) ( ) ma z p z b z q z z

2 2 3( 1) ( ) 2 1 ( )z p z h z q z z

2

( ) 2 5 3

( ) 4 3

q z z

p z h z

Page 29: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Deadbeat controller: example solved in z

Michael Šebek 29ARI-24-2012

• For is

• We choose

• So the equation is

• And the solution

• Model SatelliteDiscretePol.mdl + all

polynomials prepared in Matlab

3( )c z z

( ) 2.5 1.5

( ) 0.75

q z z

p z z

>> as=s^2;bs=1;h=1;a=(z-1)^2;

b=1/2*h^2*(1+z); c=z^3;

>> [p,q]=axbyc(a,b,c);

>> gain =value(b*q/c,1);

>> gainSSZV=value(b*p/c,1);

>> [ps,qs]=axbyc(as,bs,(s+100)^3);

>> a,b,p,q

a = 1 - 2z + z^2

b = 0.5 + 0.5z

p = 0.75 + z

q = -1.5 + 2.5z

1h

2

0.5 1( )

( ) 2 1

zb z

a z z z

2 3( 2 1) ( ) 0.5 1 ( )z z p z z q z z

Page 30: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example - simulation

Michael Šebek 30ARI-24-2012

• Model SatelliteDiscretePol.mdl + all polynomials prepared in Matlab

( )u k

( )y k

( )u k

_ ( )diskretni regulatory k

diskrétní soustava

spojitá soustava

Page 31: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Let‘s compare 2 different structures

Michael Šebek 31ARI-24-2012

• Classical controll and control with SSZV+observer

• Both structures have the same CL characteristic polynomial

and therefore the same response to non-zero pp.

• But they have different TF (with different zeros)

• and therefore different responses to external signals

3( )c z z

3

( ) ( )

( ) ( ) ( ) ( )

1.25 0.6 1

b z q z

a z p z b z q z

z z

z

3

( ) ( )

( ) ( ) ( ) ( )

0.5 0.75 1

1 1

(1) (1) 0.75

b z p zk

a z p z b z q z

z zk

z

kb p

Page 32: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Simulation: 2 different structures

Michael Šebek 32ARI-24-2012

Model SatelliteDiscretePol.mdl + all polynomials prepared in Matlab

Discrete system output Řízení odchylkou

SS ZV + poz

>> gainSSZV=value(b*p/c,1)

gainSSZV =

1.7500

Continuous system output

Řízení odchylkou

SS ZV + poz

Řízení odchylkou

SS ZV + poz

input

Page 33: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Deadbeat controller: example solved in z-1

Michael Šebek 33ARI-24-2012

• Recall the equation from previous example

• And deadbeat controller

Now we will do the same in

• Convert system to

• Solve equation

• And we get

( ) 2.5 1.5

( ) 0.75

q z z

p z z

>> h=1;a=(z-1)^2;...

b=1/2*h^2*(1+z);

>> azi=a*z^-2;bzi=b*z^-2;

>>

[pzi,qzi]=axbyc(azi,bzi,1);

>> azi,bzi,czi,pzi,qzi

azi = z^-2 - 2z^-1 + 1

bzi = 0.5z^-2 + 0.5z^-1

>> azi,bzi,pzi,qzi

azi = z^-2 - 2z^-1 + 1

bzi = 0.5z^-2 + 0.5z^-1

pzi = 1 + 0.75z^-1

qzi = 2.5 - 1.5z^-1

2 3( 2 1) ( ) 0.5 1 ( )z z p z z q z z

1 21

1 1 2

0.5( )

( ) 1 2

z zb z

a z z z

1 2 1 1 2 1(1 2 ) ( ) 0.5( ) ( ) 1z z p z z z q z

1 1

1 1

( ) 2.5 1.5

( ) 1 0.75

q z z

p z z

1z

Page 34: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: strong and weak versions

Michael Šebek 34ARI-24-2012

• Continuous

system TF

• Sampled with period

• Because the system has zeroes, we factorize it

• From

• We calculate the weak version

• And from strong version

>> ad=gd.den;bd=gd.num;

>> rts = roots(bd);

>> rts_minus = rts(abs(rts)<=1);

>> rts_plus = rts(abs(rts)>1);

>> b_minus = root2pol({rts_minus},'d');

>> b_minus.h=h; b_plus = bd/b_minus;

>> rts',b_minus,b_plus

ans = 0 -1.3459 1.1052

b_minus = d

b_plus = 0.0038-0.00062d-0.0026d^2

1ax b q p xb

2

1

( 10)

( )

( )

b s

a ss

s

s

0.1h

>> a=s^2*(s+10);b=s+1;

>> h=0.1;

>> gz=sdf(c2d(ss(b/a),h));

>> gd=reverse(gz);gd.v=d;gd

0.0051d + 0.00065d^2 - 0.0048d^3

gd = --------------------------------

1 - 3d + 3d^2 - 0.99d^3 2 3

2 3

0.0051 0.0006( 5 0.0048

1 3 3 0.99

)

( )

b d

a

d d d

d d dd

4 238 6.2 2610 ,d db db

2

2

4 2.4 1.7 0.37

38 6.

( )10

2 26( )

weak

weak

q d dd

d dp d

1ax bq

32

2

19 29 8

1 75 56

( )10

( )

strong

strong

q d d

d

d

dp d

Pro úsporu místa tu

používáme d = z-1

Attention : zerosin d = z-1

>>[x,q_weak] = axbyc(ad,b_minus,1,'minx');

>> p_weak = b_plus*x,q_weak

q_weak = 2.4 - 1.7d + 0.37d^2

p_weak = 0.0038 - 0.00062d - 0.0026d^2

>> [p_strong,q_strong] = axbyc(ad,bd,1)

p_strong = 1 + 75d + 56d^2

q_strong = -1.9e+004+2.9e+004d - 8e+003d^2

Page 35: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: simulation

Michael Šebek 35ARI-24-2012

• Model DB_strong_weak.mdl (Everything is prepared from the past )

( )weaku k

( )strongu k

( )strongy t

( )strongy k

( )weaky t

( )weaky k

Page 36: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example 2DOF controller

Michael Šebek 36ARI-24-2012

• For system

• We choose

• And solve the equation

• We get

• therefore

2

2

( ) 1

( ) 2 ( 1)

b z h z

a z z

2

1 0 0( ) , ( )c oc z z c z c c z z d

2

2 20 1 0 01 0

( 1) 12

hz z p q z q z dz c z cz

0 0 1 0 0 0 1

2

0 0 1 0 0 0 1

2

0 0 1 0 0 0

( ) 3 4

( ) 3 3 2

5 3 3 2

p z c d c d c d c z

q z c d c d c d c h

z c d c d c d c h

2

0 1 01t c c h

2

1 0 0( ) 1r z c c d z h

>> h=1;

>> cc=z^2;co=z;

>> a=(z-1)^2;b=h^2/2*(z+1);

>> [p,q]=axbyc(a,b,cc*co);

>> t=value(cc/b,1);

>> r=t*co; p,q,t,r

p = 0.75 + z

q = -1.5 + 2.5z

t = 1

r = z

>> syms z h c0 c1 d0

>> cc=z^2+c1*z+c0;co=z+d0;

a=(z-1)^2;b=h^2/2*(z+1);

>> [p,q]=saxbyc(a,b,cc*co,z)

p =

1/4*c0*d0+3/4-1/4*c1*d0-

1/4*c0+1/4*d0+1/4*c1+z

q =

1/2*(3*c0*d0-3+c1*d0+c0-d0-

c1)/h^2+1/2*(5+3*d0+3*c1-

c0*d0+c1*d0+c0)/h^2*z

>> t=subs(cc/b,z,1)

t = (1+c1+c0)/h^2

>> r=t*co

r = (1+c1+c0)/h^2*(z+d0)

Page 37: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Simulation: 2DOF

Michael Šebek 37ARI-24-2012

• Model DOF2.mdl

1 ( )DOFy t

1 ( )DOFy k

2 ( )DOFy t

2 ( )DOFy k

2 ( )DOFu k

1 ( )DOFu k

Page 38: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: Deadbeat ramp tracking

Michael Šebek 38ARI-24-2012

• System

• Deadbeat

• Ramp generator

• Equations (are the same, because)

• controller

1( ) 1m z

>> h=0.5; m=1;f=(1-zi)^2;

>> a=(1-zi)^2;b=h^2/2*(zi+1)*zi;

>> [p,q]=axbyc(a,b,m);

>> [t,r]=axbyc(f,b,m);

>> p,q,t,r

p = 1 + 0.75z^-1

q = 10 - 6z^-1

t = 1 + 0.75z^-1

r = 10 - 6z^-1

1 21

211

0.13( )

( ) 1

z zb z

a z z

2

( ) 1

( )

b s

a s s

0.5h

1 1 1 2( ) ( ) (1 )f z f z z

1 2 1 1 2 1

1 2 1 1 2 1

(1 ) ( ) 0.13 ( ) 1

(1 ) ( ) 0.13 ( ) 1

z p z z z q z

z t z z z r z

1

1

1

1

1

11

1 0.75

10 6

1 0.

( )

( )

( ) 88

( )

p z

q z r z

z

z

z

t z

1 1 1

1 1 1

1 1 1 110 6 10 6 10 6

1 0.75 1 0.75 1 0.( ) ( ) ( )

5(

7)r

z z z

z z zu z y z y z e z

a f

Page 39: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: Deadbeat ramp tracking

Michael Šebek 39ARI-24-2012

• Model DBtracking.mdl

( )ry t

( )y k

( )ry t

( )y t

( ) ( )u t u k

( )e t

Page 40: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: Deadbeat ramp tracking

Michael Šebek 40ARI-24-2012

• Model DBtracking.mdl

( )ry t

( )y k

( )ry t

( )y t

( ) ( )u t u k

( )e t

Page 41: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: sin and stairs tracking

Michael Šebek 41ARI-24-2012

• Model DBtracking.mdl

( )ry t( )y t

( ) ( )u t u k

( )y t

( )ry t

( ) ( )u t u k

Not tuned to sinus

Page 42: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: Deadbeat parabola tracking

Michael Šebek 42ARI-24-2012

• system

• Deadbeat

• Parabola generator

• equations

• Controller 2DOF

• It tracks parabola in a finite steps, however the input is nonzero

because doesnot divide

• The resulting system better track general signals

1( ) 1m z

>> h=0.5; m=1;f=(1-zi)^3;

>> a=(1-zi)^2;b=h^2/2*(zi+1)*zi;

>> [p,q]=axbyc(a,b,m);

>> [t,r]=axbyc(f,b,m);

>> p,q,t,r

p = 1 + 0.75z^-1

q = 10 - 6z^-1

t = 1 + 0.88z^-1

r = 17 - 20z^-1 + 7z^-2

1 21

211

0.13( )

( ) 1

z zb z

a z z

2

( ) 1

( )

b s

a s s

0.5h

1 1 1 3( ) ( ) (1 )f z f z z

1 2 1 1 2 1

1 3 1 1 2 1

(1 ) ( ) 0.13 ( ) 1

(1 ) ( ) 0.13 ( ) 1

z p z z z q z

z t z z z r z

1

1

1

1 2

1

1

1

1

1 0.75

10 6

1 0.88

17 20

( )

( )

7

( )

( )

z

z

z

z

p z

q z

t z

zr z

1 1 2

1 1

1 1 110 6 17 20 7

1 0.75 1 0.75( ) ( ) ( )r

zu z y z y z

z z

z z

f a

Page 43: Exercises for lectures 24 Discrete controlExample: Discrete observer Michael Šebek ARI-24-2014 10 • Lets take double integrator with sampling period h again • And find observability

Automatické řízení - Kybernetika a robotika

Example: ramp and sin tracking

Michael Šebek 43ARI-24-2012

• Model DBtracking.mdl

( ) ( )u t u k

( )y t

( )ry t

( ) ( )u t u k

( )y t

( )ry t