2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter...

70
Stochastic Adaptive Control (02421) www.imm.dtu.dk/courses/02421 Niels Kjølstad Poulsen Build. 303B, room 048 Section for Dynamical Systems Dept. of Applied Mathematics and Computer Science The Technical University of Denmark Email: [email protected] phone: +45 4525 3356 mobile: +45 2890 3797 2019-04-29 20:09 Adaptive systems (L22-24) L23 1 / 70

Transcript of 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter...

Page 1: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Stochastic Adaptive Control (02421)www.imm.dtu.dk/courses/02421

Niels Kjølstad Poulsen

Build. 303B, room 048Section for Dynamical Systems

Dept. of Applied Mathematics and Computer ScienceThe Technical University of Denmark

Email: [email protected]: +45 4525 3356mobile: +45 2890 3797

2019-04-29 20:09

Adaptive systems (L22-24)

L23

1 / 70

Page 2: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Adaptive Systems

Wikipedia: Adaptive behavior is a type of behavior that is used to adjust to another type ofbehavior or situation.

Here: device, algorithm or method with the ability ajust itself (or its behavior) to the actual system.

Prediction, Filtering and smoothing

Detection, isolation and fault estimation

Control

2 / 70

Page 3: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Adaptive Control

w y

e

u

System and disturbances Model of

Objectives Constraints

SystemController

Design

Model

y

e

u

ID

Uncertainty

Knowledge

Objective

System

3 / 70

Page 4: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Adaptive Control

Self Tuning Controller (STC)

w

Controller System

Design

e

u

y

ID

4 / 70

Page 5: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Adaptive Control - the line of arguments

PID: Process information around wc. Robust. Not necessarily optimal (rarely optimal wrt.disturbances).

Stochastic Control: requires a precise model (also of the disturbances).

w y

e

u

System and disturbances Model of

Objectives Constraints

SystemController

Design

5 / 70

Page 6: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

System Identification

System Identification: Parameter estimation. Validation.

Model

y

e

u

ID

Uncertainty

Knowledge

Objective

System

6 / 70

Page 7: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Adaptive Control

Adaptive Control: Parameter changes (time variations, nonlinear system).

w

Controller System

Design

e

u

y

ID

7 / 70

Page 8: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Other approach: Robust Control

w y

e

u

System and disturbances Model of

Objectives Constraints

SystemController

Design

-3 -2 -1 0 1 2 3 4 50

2

4

6

8

10

12

14

16

18

20

Optimal

Suboptimal

→ hhn et al.

8 / 70

Page 9: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Gain Scheduling (GS), Linear Parameter Variation (LPV)

Controller System

Schedule

Measured point of operation

w u

e

y

Examples: Tank system. Wind turbine. Ship. Aircraft.

To be considered as an open loop adaptive controller or a methods for dealing with nonlinearsystems.

9 / 70

Page 10: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Model Reference Adaptive Control

SystemController

Adaption

Model

w

u y

error

ym

10 / 70

Page 11: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

The Basic Self Tuner

w

Controller System

Design

e

u

y

ID

11 / 70

Page 12: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Classification of adaptive controllers

Explicit STC

ImplicitCautious

CE based STC

Suboptimal dual controllers

Optimal dual controllers

MRAC

STC

Gain Schedule

Dual

Gradient optimization

Stability optimization

12 / 70

Page 13: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Recap: Polynomials and vectors

Let us consider the result of a polynomium operating on a signal

S(q−1)yt = s0yt + s1yt−1 + ... + snyt−n

= γTϑ

where

γT =[

yt yt−1 ... yt−n

]

ϑT =[

s0 s1 ... sn]

13 / 70

Page 14: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit version of Basic self Tuner

14 / 70

Page 15: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

The Basic Self Tuner (Explicit version)

System:

A(q−1)yt = q−kB(q−1)ut + C(q−1)et

ID:

yt = ϕ⊤

t θ + et

θt = arg Min

t∑

i=0

ε2i pem or plr

Control: MV.

ut = arg Min E

{

y2t+k

}

15 / 70

Page 16: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

ID: The Basic Self Tuner - (Explicit version)

A(q−1)yt = q−kB(q−1)ut + C(q−1)et

ID:

θ⊤ = (... ai, ... bi, ... ci ...)

ϕ⊤

t = (... − yt−i, ... ut−i, ... et−i ...)

θt = θt−1 +Ptψt

1 + ψ⊤t Ptψt

εt εt = yt − ϕ⊤

t θt

Pt = Pt −Ptψψ

⊤t Pt

1 + ψ⊤t Ptψt

Pt = funk (Pt−1, εt, ϕt, ψt) Forgetting

ψt =1

Ct−1

ϕt

16 / 70

Page 17: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Control: The Basic Self Tuner - Explicit version

J = E

{

y2t+k

}

Minimum variance control

C = AG+ q−kS

yt+k =1

C

[

BGut + Syt]

+Get+k

Rut = −Syt R = BG

Controller:

Rut + Syt = 0

γt = ( ut, ut−1, ... yt, yt−1, ... )⊤

ϑ = ( r0, , r1, ... s0, s1, ... )⊤

ut = arg Sol(

γTt ϑ = 0)

17 / 70

Page 18: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Example

System:

yt − 0.9 yt−1 = 1 ut−2 + et NB: an ARX system

Model:

yt + a yt−1 = b ut−2 + εt

Estimation:

εt = yt + at−1yt−1 − bt−1ut−2

ϕTt =

[

−yt−1 ut−2

]

θT =[

a b]

θt = θt−1 +Ptϕt

1 + ϕ⊤t Ptϕt

εt

Pt = Pt −Ptϕtϕ

⊤t Pt

1 + ϕ⊤t Ptϕt

Pt = funk (Pt−1, εt, ϕt, ψt)

Je =t

i=1

ε2i ≃ tσ2 εt = et for correct parameters

18 / 70

Page 19: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Example (hard coded design)

Design:

1 = (1 + atq−1)(1 + gq−1) + q−2s

G = 1− atq−1 S = a2t

Controller:

bt(1− atq−1)ut = −a2t yt

or

ut = atut−1 −a2t

btyt

Jc =t

i=0

y2i ≃ E

{

y2t

}

t ≃ 1.81σ2 t

In closed loop (for correct parameters)

yt = (1 + 0.9q−1)et

19 / 70

Page 20: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Example

0 20 40 60 80 100-2

-1.5

-1

-0.5

0

0.5

1

1.5

2System parameters

20 / 70

Page 21: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Example

0 20 40 60 80 100-1.5

-1.4

-1.3

-1.2

-1.1

-1

-0.9

-0.8

-0.7

-0.6

-0.5Control parameters

21 / 70

Page 22: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Example

0 20 40 60 80 100

50

100

150

200

Accumulated control and est. losses

Acc

. Los

s

22 / 70

Page 23: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Example

20 40 60 80 1000

50

100

150

200Loss

Acc

. Los

s

20 40 60 80 100

50

100

150

200

250

Loss

Acc

. Los

s

20 40 60 80 100

50

100

150

200

250

Loss

Acc

. Los

s

20 40 60 80 1000

200

400

600

800

1000Loss

Acc

. Los

s

23 / 70

Page 24: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Control: The Basic Self Tuner - Explicit version

J = E

{

y2t+k

}

A(q−1)yt = B(q−1)ut−k + C(q−1)et

C = AG+ q−kS

yt+k =1

C

[

BGut + Syt]

+Get+k

Rut = −Syt R = BG

Controller:

Rut + Syt = 0

γt = ( ut, ut−1, ... yt, yt−1, ... )⊤

ϑ = ( r0, , r1, ... s0, s1, ... )⊤

ut = arg Sol(

γTt ϑ = 0)

24 / 70

Page 25: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

The Basic Self Tuner - Explicit simple version Prelude to implicit version

J = E

{

y2t+1

}

A(q−1)yt = B(q−1)ut−1 + et

k = 1 C(q−1) = 1

1 = A+ q−1S G(q−1) = 1 S(q−1) = q(1 − A) = A

yt+1 =[

But + Syt]

+ et+1

Rut = −Syt R = B

Controller:

Rut + Syt = 0

γt = ( ut, ut−1, ... yt, yt−1, ... )⊤

ϑ = ( r0, , r1, ... s0, s1, ... )⊤

ut = arg Sol(

γTt ϑ = 0)

25 / 70

Page 26: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit version of Basic self Tuner

26 / 70

Page 27: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

The Basic Self Tuner II (Implicit version)

A(q−1)yt = B(q−1)ut−1 + et C = 1 k = 1

MV: J = E

{

y2t+1

}

C = AG+ q−kS

yt+k =1

C

[

BGut + Syt]

+Get+k

Rut = −Syt R = BG

1 = A ∗ 1 + q−1S G = 1 S = q(1− A) = −a1 − a2q−1 − ... − anq

1−n

yt+1 = [But + Syt] +et+1 But = −Syt Notice the simple design

yt+1 = [Syt + Rut] +et+1 = ϕ⊤

t+1θ + et+1

ϕ⊤

t+1 =[

yt yt−1 ... ut ...]

θT =[

s0 s1 ... r0 ...]

θ : yt = ϕ⊤

t θt−1 + εt; Je =1

t

t∑

i=0

ε2i

ut : ϕ⊤

t+1θt = 0 Jc = E

{

y2t+1

}

27 / 70

Page 28: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

The Basic Self Tuner III

A(q−1)yt = q−kB(q−1)ut + et

C = 1 k ≥ 1

MV: J = E

{

y2t+k

}

BGut = −Syt

1 = AG+ q−kS

yt+k = [Syt +BGut] +Get+k

yt+k = [Syt +Rut] +Get+k

= ϕ⊤

t+kθ +Get+k

θ : yt = ϕ⊤

t θt−1 + εt; Je =1

t

t∑

i=0

ε2i

ut : ϕ⊤

t+kθt = 0 Jc = E

{

y2t+k

}

28 / 70

Page 29: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

The Basic Self Tuner IV

A(q−1)yt = q−kB(q−1)ut + C(q−1)et

MV: J = E

{

y2t+k

}

BGut = −Syt

C = AG+ q−kS

yt+k =1

C[Syt +BGut] +Get+k

RLS: yt+k = [Syt +Rut] +Get+k Notice the missing C

= ϕ⊤

t+kθ +Get+k

θ : yt = ϕ⊤

t θt−1 + εt; Je =1

N

t∑

i=0

ε2i

ut : ϕ⊤

t+kθt = 0 Jc = E

{

y2t+k

}

29 / 70

Page 30: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicite STC

Advantage:

Design simple,

RLS (even if C 6= 1),

Je ≃ Jc

Disadvantage:

More parameters (k >> 1),

Not all strategies can be transformed into an implicitte strategy.

30 / 70

Page 31: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Convergence analysis

Is θ0 a possible convergence point.

S : yt =1

Cϕ⊤

t θ0 +Get

M : yt = ϕ⊤

t θ + εt

E

{

ϕtεt

}

= 0

εt = yt − ϕ⊤

t θ =1

Cϕ⊤

t θ0 +Get − ϕ⊤

t θ

= Get +1− C

Cϕ⊤

t θ0 for θ = θ0

31 / 70

Page 32: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicite STC.

Synergy

Control: Jc = E

{

y2t+k

}

= E

{

ε2t+k

}

Estimation: Je =1

N

ε2i

Fixation

Controller:

ut = −S

Ryt

Model:

yt+k = [Rut + Syt] +Get+k

1

2<r0

b0

32 / 70

Page 33: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Stochastic Adaptive Control (02421)www.imm.dtu.dk/courses/02421

Niels Kjølstad Poulsen

Build. 303B, room 048Section for Dynamical Systems

Dept. of Applied Mathematics and Computer ScienceThe Technical University of Denmark

Email: [email protected]: +45 4525 3356mobile: +45 2890 3797

2019-04-29 20:09

Adaptive Control II (L23)

33 / 70

Page 34: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Classification of adaptive controllers

Explicit STC

ImplicitCautious

CE based STC

Suboptimal dual controllers

Optimal dual controllers

MRAC

STC

Gain Schedule

Dual

Gradient optimization

Stability optimization

34 / 70

Page 35: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Certainty Equivalence principle

State space control

xt+1 = Axt + But + vt

yt = Cxt + et

Complete state information

ut = −Lxt

Incomplete state information

ut = −Lxt

CE valid

Adaptive control

A(q−1)y = q−kB(q−1)ut + C(q−1)et

MV for known system

C = AG+ q−kS

BGut = −Syt

Adaptive MV

C = AG+ q−kS

BGut = −Syt

CE convinient

35 / 70

Page 36: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit Adaptive Control

36 / 70

Page 37: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit STC (CE based)

w

Controller System

Design

e

u

y

ID

Minimalvariance, MV0

PZ, GSP

GMV (MVi)

GPC (or MPC)

LQG (SS or Xreg)

Deadbeat, PID ao.

Kalmanfilter/observer

Polplacement controller

LQG

Robust

37 / 70

Page 38: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit MV0 control

System (assumed known):

A(q−1)yt = q−kB(q−1)ut + C(q−1)et+d

Cost:

J = E

{

(yt+k−wt)2}

Controller:

BGut = Cwt − Syt−Gd

Design:

C = AG+ q−kS

G(0) = 1 ord(G) = k − 1 ord(S) = max(na − 1, nc − k)

wt

−Gd

ut

C

et d

yt

A−1

−S

1

BGC q−kB

38 / 70

Page 39: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Main loop

measinit; % Initilialise the measurement system

for it=1:nstp,

w=wt(it);

[y,t]=meas; % Measure output

u=...

act(u); % Actuate control

end

39 / 70

Page 40: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Cannonical realization

Rut = Qwt − Syt − δ

xrt+1 = Arxrt +Br

[

wt

yt

]

ut = CrxRt +Dr

[

wt

yt

]

+ u0

40 / 70

Page 41: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Cannonical realization

%------------------------------------------------------------------------

[A,B,k,C,s2]=sysinit(dets); % Determine linear model (ie. get system)

%------------------------------------------------------------------------

[Q,R,S,G]=dsnmv0(A,B,k,C);

%------------------------------------------------------------------------

[Ar,Br,Cr,Dr]=qrs2ss(Q,R,S);

nr=length(Ar); Xr=zeros(nr,1);

%------------------------------------------------------------------------

measinit; % Initilialise the measurement system

for it=1:nstp,

w=wt(it); wf=wft(it);

[y,t]=meas;

u=Cr*Xr+Dr*[wf;y]+u0;

act(u); % Actuate control

Xr=Ar*Xr+Br*[wf;y];

end

41 / 70

Page 42: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Direct realization

Rut = Qwt − Syt − δ Rut −Qwt + Syt + δ = 0

ϕT

t=

[

ut, ut−1, ... −wt, −wt−1, ... yt, yt−1, ... 1]

ϕ = ϕr

θT =[

r0, r1, ... q0, q1, ... s0, s1, ... δ]

ut = −ϕTtθ

r0θ = θ(2 : end);

ϕT

t−1=

[

ut−1, ut−2, ... −wt−1, −wt−2, ... yt−1, yt−2, ... 1]

42 / 70

Page 43: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Direct realization

%------------------------------------------------------------------------

[A,B,k,C,d,s2]=sysinit(dets); % Determine linear model (ie. get system)

%------------------------------------------------------------------------

[Q,R,S,G]=dsnmv0(A,B,k,C);

%------------------------------------------------------------------------

nr=length([R Q S])+1; fir=zeros(nr,1); thr=[R Q S G(1)*d]’;

pil=1+[0 length(R) length([R Q])];

%------------------------------------------------------------------------

measinit; % Initilialise the measurement system

for it=1:nstp,

w=wt(it);

[y,t]=meas; % Measure output

% Ru=Qw-Sy-Gd

fir(2:end)=fir(1:end-1);

fir(pil)=[0 -w y];

u=-fir’*thr/thr(1);

fir(1)=u;

act(u); % Actuate control

end

43 / 70

Page 44: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

ID (Explicit version)

A(q−1)yt = q−kB(q−1)ut + C(q−1)et + d

ID:

θ⊤ = (... ai, ... bi, ... ci ... d)

ϕ⊤

t = (... − yt−i, ... ut−i, ... et−i ... 1)

θt = θt−1 +Ptψt

1 + ψ⊤t Ptψt

εt εt = yt − ϕ⊤

t θt

Pt = Pt −Ptψψ

⊤t Pt

1 + ψ⊤t Ptψt

Pt = funk (Pt−1, εt, ϕt, ψt) Forgetting

ψt =1

Ct−1

ϕt

44 / 70

Page 45: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit MV0 controller

%------------------------------------------------------------------------

[A,B,k,C,d,s2]=sysinit(dets); % Determine linear model (ie. get system)

%------------------------------------------------------------------------

na=length(A)-1; mb=length(B); nc=length(C)-1;

th=[A(2:end) B C(2:end) d]’; th0=th;

th=th*0;

pil=[na mb];

pil=[0 cumsum(pil)]+1;

fi=zeros(size(th));

p0=10000;

P=eye(size(th,1))*p0;

%------------------------------------------------------------------------

[Q,R,S,G]=dsnmv0(A,B,k,C); % just for the structure

%------------------------------------------------------------------------

nr=length([R Q S]); fir=zeros(nr,1); fir=[fir; 1]; thr=[R Q S G(1)*d]’;

pilr=1+[0 length(R) length([R Q])];

%------------------------------------------------------------------------

45 / 70

Page 46: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit MV0 controller

Main loop

measinit; % Initilialise the measurement system

for it=1:nstp,

w=wt(it);

[y,t]=meas; % Measure output

% ID block

res=y-fi’*th;

K=P*fi/(1+fi’*P*fi);

P=P-K*fi’*P;

th=th+K*res;

% Design block

A=[1 th(1:na)’]; B=th(pil(2):pil(3)-1)’;

C=[1 th(pil(3):end)’]; d=th(end);

[Q,R,S,G]=dsnmv0(A,B,k,C);

thr=[R Q S G(1)*d]’;

46 / 70

Page 47: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit MV0 controller

% Ru=Qw-Sy Controller

fir(2:end)=fir(1:end-1);

fir(pilr)=[0 -w y];

u=-fir’*thr/thr(1);

fir(1)=u;

fi(2:end)=fi(1:end-1);

fi(pil(1:2))=[-y u]’;

act(u); % Actuate control

end

47 / 70

Page 48: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

PZ-control

System:

Ayt = q−kBut + Cet + d

Cost:

J = E

{

(Amyt+k −Bmwt)2}

Controller:

BGut = BmCwt − Syt −Gd

Design:

AmC = AG+ q−kS

G(0) = 1 ord(G) = k − 1 ord(S) = max(na − 1, nc + nam − k)

48 / 70

Page 49: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit PZ controller

%------------------------------------------------------------------------

[A,B,k,C,d,s2]=sysinit(dets); % Determine linear model (ie. get system)

%------------------------------------------------------------------------

na=length(A)-1; mb=length(B); nc=length(C)-1;

th=[A(2:end) B C(2:end)d]’; th0=th;

th=th*0;

pil=[na mb];

pil=[0 cumsum(pil)]+1;

fi=zeros(size(th));

p0=10000;

P=eye(size(th,1))*p0;

%------------------------------------------------------------------------

Am=[1 -0.6];

Bm=sum(Am);

[Q,R,S,G]=dsnpz(A,B,k,C,Am,Bm); % just for the structure

%------------------------------------------------------------------------

nr=length([R Q S]); fir=zeros(nr,1); fir=[fir; 1]; thr=[R Q S G(1)*d]’;

pilr=1+[0 length(R) length([R Q])];

%------------------------------------------------------------------------

49 / 70

Page 50: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit PZ-control

Main loop

measinit; % Initilialise the measurement system

for it=1:nstp,

w=wt(it);

[y,t]=meas; % Measure output

% ID block

res=y-fi’*th;

K=P*fi/(1+fi’*P*fi);

P=P-K*fi’*P;

th=th+K*res;

% Design block

A=[1 th(1:na)’]; B=th(pil(2):pil(3)-1)’;

C=[1 th(pil(3):end)’]; d=th(end);

[Q,R,S,G]=dsnpz(A,B,k,C,Am,Bm);

thr=[R Q S G(1)*d]’;

50 / 70

Page 51: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit PZ-control

% Ru=Qw-Sy Controller

fir(2:end)=fir(1:end-1);

fir(pilr)=[0 -w y];

u=-fir’*thr/thr(1);

fir(1)=u;

fi(2:end)=fi(1:end-1);

fi(pil(1:2))=[-y u]’;

act(u); % Actuate control

end

51 / 70

Page 52: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit PZ-control

0 10 20 30 40 50 60 70 80 90-1

-0.5

0

0.5

1

Y, W

t in sec

yt

wt

0 10 20 30 40 50 60 70 80 90-1

-0.5

0

0.5

1

U

t in sec

ut

52 / 70

Page 53: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit PZ-control

0 10 20 30 40 50 60 70 80 90-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

θ

t in sec

θ

53 / 70

Page 54: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit PZ-control

0 10 20 30 40 50 60 70 80 90-0.4

-0.2

0

0.2

0.4

Y, W

t in sec

yt

wt

0 10 20 30 40 50 60 70 80 90-0.4

-0.2

0

0.2

0.4

U

t in sec

ut

54 / 70

Page 55: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit PZ-control

0 10 20 30 40 50 60 70 80 90 1000

0.2

0.4

0.6

0.8

1

1.2

1.4

J e

t in sec

Accumulated losses

0 10 20 30 40 50 60 70 80 90 1000

0.5

1

1.5

2

J u

t in sec

55 / 70

Page 56: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Explicit PZ-control

0 10 20 30 40 50 60 70 80 90-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

θ

t in sec

θ

56 / 70

Page 57: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit Adaptive Control

57 / 70

Page 58: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit STC

w

Controller System

Design

e

u

y

ID

Implicit Adaptive Control (STC)

The model is rephrased in terms of the control parameters, which are estimated. The adaptationmechanism (estimation procedure) is working on the control parameters directly.

58 / 70

Page 59: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit MV0

J = E

{

(yt+k − wt)2}

A(q−1)yt = q−kB(q−1)ut + C(q−1)et + d

C = AG+ q−kS R = BG δ = G(1)d

ξt+k = yt+k −wt

=1

C[Syt + Rut − Cwt + δ] +Get+k

=1

Cϕ⊤

t+kθ + et+k

Model: ξt = yt −wt−k

= ϕ⊤

t θt−1 + εt No C

Control: ut = argSol(

ϕ⊤

t+k θt = 0.)

59 / 70

Page 60: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit MV0

RLS-algorithmComputer burden (design)Active (estimation) and passive (control) have similar cost function.Has to know k.The min phase problem.

60 / 70

Page 61: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit MV0

J = E

{

(yt+k − wt)2}

1 Measure yt.

2 Create ξt = yt − wt−k.

3 Create ϕt = (yt−k , ... , ut−k, ... ,−wt−k, 1)T and ϕt+k.

4 Update the estimates:

ǫt = ξt − ϕtθt−1 (1)

P−1t = P−1

t−1+ ϕtϕ

Tt (2)

θt = θt−1 + Ptϕtǫt (3)

5 Determine ut such that:

ϕTt+kθt = 0 (4)

6 Actuate the control.

61 / 70

Page 62: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit PZ-regulator

J = E

{

(Am(q−1)yt+k − Bm(q−1)wt)2}

AmC = AG+ q−kS R = BG Q = BmC δ = Gd

ξt+k = Amyt+k − Bmwt

=1

C[Syt + Rut −Qwt + δ] +Get+k

=1

Cϕ⊤

t+kθ + et+k

Model: ξt = Amyt − Bmwt−k

= ϕ⊤

t θt−1 + εt

Control: ut = argSol(

ϕ⊤

t+k θt = 0.)

62 / 70

Page 63: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit PZ-regulator

J = E

{

(Am(q−1)yt+k − Bm(q−1)wt)2}

1 Measure yt.

2 Create ξt = Am(q−1)yt −Bm(q−1)wt−k.

3 Create ϕt = (yt−k , ... , ut−k, ... ,−wt−k, 1)T og ϕT

t+k.

4 Update the estimates:

ǫt = ξt − ϕtθt−1 (5)

P−1t = P−1

t−1+ ϕtϕ

Tt (6)

θt = θt−1 + Ptϕtǫt (7)

5 Determine ut such that: ϕTt+k

θt = 0 .

63 / 70

Page 64: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit PZ-regulator

%------------------------------------------------------------------------

[A,B,k,C,d,s2]=sysinit(dets); % Determine linear model (ie. get system)

%------------------------------------------------------------------------

Am=[1 -0.6];

Bm=sum(Am);

[Ax,Bx,Cx,Dx]=armax2ss(1,Bm,k,Am);

nx=length(Ax); Xm=zeros(nx,1);

%------------------------------------------------------------------------

[Q,R,S,G]=dsnpz(A,B,k,C,Am,Bm);

nr=length([R Q S d]); fi=zeros(nr,1);

th=[R Q S G(1)*d]’; th0=th; % th=th*0;

pil=1+[0 length(R) length([R Q])];

p0=10000;

P=eye(nr)*p0;

th(pil(2))=Q(1); % First coefficient in Q=C*Bm is known

P(pil(2),pil(2))=0;

%th(pil(1))=R(1); % Fixed b0

%P(pil(1),pil(1))=0;

%------------------------------------------------------------------------

64 / 70

Page 65: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit PZ-regulator

measinit; % Initilialise the measurement system

for it=1:nstp,

w=wt(it);

[y,t]=meas; % Measure output

xi=Cx*Xm+Dx*[-w;y];

% ID block

res=xi-fi’*th;

K=P*fi/(1+fi’*P*fi);

P=P-K*fi’*P;

th=th+K*res; % th’

fi(2:end)=fi(1:end-1);

fi(pil)=[0 -w y]’;

u=-fi’*th/th(1);

fi(pil(1))=u;

act(u); % Actuate control

Xm=Ax*Xm+Bx*[-w;y];

end

65 / 70

Page 66: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit PZ-regulator

Deterministic:

0 10 20 30 40 50 60 70 80 90-1

-0.5

0

0.5

1

Y, W

t in sec

yt

wt

0 10 20 30 40 50 60 70 80 90-1

-0.5

0

0.5

1

U

t in sec

ut

66 / 70

Page 67: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit PZ-regulator

0 10 20 30 40 50 60 70 80 90-2

-1.5

-1

-0.5

0

0.5

1

1.5

2

θ

t in sec

θ

67 / 70

Page 68: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit GMV-regulator

J = E

{

(

By

Ay

yt+k −Bw

Aw

wt

)2

+ ρ

(

Bu

Au

ut

)2 }

AmC = ByAG+ q−kS

R = AuBG+ αBuC δ = Gd

ξt+k = yt+k − wt + αut

=1

C[Syt + Rut −Qwt + δ] +Get+k

=1

Cϕ⊤

t+kθ + et+k

y =1

Ay

y w = w =Bw

Aw

w u =1

Au

u

68 / 70

Page 69: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit GMV-regulator

Model: ξt = yt − wt−k + αut−k

= ϕ⊤

t θt−1 + εt

Control: ut = argSol(

ϕ⊤

t+k θt = 0.)

69 / 70

Page 70: 2019-04-29 20:09 Adaptive systems (L22-24) · 2019-04-30 · Gain Scheduling (GS), Linear Parameter Variation (LPV) Controller System Schedule Measured point of operation w u e y

Implicit GMV-regulator

J = E

{

(

By

Ay

yt+k −Bw

Aw

wt

)2

+ ρ

(

Bu

Au

ut

)2}

1 Measure yt.

2 Create ξt = yt − wt−k + αut−k

[

α = ρ

b0

]

.

3 Create ϕt = (yt−k , ..., ut−k, ...,−wt−k, ...,1)T og ϕt+k.

4 Update the estimates:

ǫt = ξt − ϕtθt−1 (8)

P−1t = P−1

t−1+ ϕtϕ

Tt (9)

θt = θt−1 + Ptϕtǫt (10)

5 Determine ut such that: ϕTt+k

θt = 0.

6 Determine ut = Auut.

70 / 70