lqr feedforward

20
Model-Based Controller Design Optimal linear quadratic (LQ) control Given the LTI plant model, with directly measurable state : () = () + () () = () + () ; โˆˆ ,โˆˆ ,โˆˆ Find the control to minimize the performance index (cost): = 1 2 + 1 2 + 0 where = >0, = โ‰ฅ0, = โ‰ฅ0 are weight matrices โ€ข The optimal LQR control is found by minimizing the Hamiltonian function: = 1 2 + + () () + () where () is the Lagrangian multiplier So, let =0 = () = () + =0 + = () + = = โˆ’ โˆ’1 = + = + โ€ข For LTI systems = () Optimal LQ control: () = โˆ’()() where () = โˆ’1 () and () is the solution of the differential Riccati equation (DRE): = () + () + โˆ’ () โˆ’1 () , = Plant - u r=0 x K

Upload: sri248

Post on 01-Jan-2016

160 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: lqr feedforward

Model-Based Controller Design

Optimal linear quadratic (LQ) control Given the LTI plant model, with directly measurable state ๐‘ฅ:

๐‘ฅ (๐‘ก) = ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

; ๐‘ฅ โˆˆ ๐‘…๐‘›, ๐‘ข โˆˆ ๐‘…๐‘š , ๐‘ฆ โˆˆ ๐‘…๐‘™

Find the control ๐‘ข to minimize the performance index (cost): ๐ฝ =

1

2๐‘ฅ๐‘‡ ๐‘ก๐‘“ ๐‘€๐‘ฅ ๐‘ก๐‘“ +

1

2 ๐‘ฅ๐‘‡ ๐‘ก ๐‘„๐‘ฅ ๐‘ก + ๐‘ข๐‘‡ ๐‘ก ๐‘…๐‘ข ๐‘ก ๐‘‘๐‘ก๐‘ก๐‘“๐‘ก0

where ๐‘… = ๐‘…๐‘‡ > 0, ๐‘„ = ๐‘„๐‘‡ โ‰ฅ 0, ๐‘€ = ๐‘€๐‘‡ โ‰ฅ 0 are weight matrices

โ€ข The optimal LQR control is found by minimizing the Hamiltonian function: ๐ป =

1

2๐‘ฅ๐‘‡ ๐‘ก ๐‘„๐‘ฅ ๐‘ก + ๐‘ข๐‘‡ ๐‘ก ๐‘…๐‘ข ๐‘ก + ๐œ†๐‘‡(๐‘ก) ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)

where ๐œ†(๐‘ก) is the Lagrangian multiplier

So, let

๐œ•๐ป

๐œ•๐‘ข= 0

๐œ•๐ป

๐œ•๐‘ฅ= ๐œ† (๐‘ก)

๐œ•๐ป

๐œ•๐œ†= ๐‘ฅ (๐‘ก)

๐‘…๐‘ข ๐‘ก + ๐ต๐‘‡๐œ† ๐‘ก = 0

๐‘„๐‘ฅ ๐‘ก + ๐ด๐‘‡๐œ† ๐‘ก = ๐œ† (๐‘ก)

๐ด๐‘ฅ ๐‘ก + ๐ต๐‘ข ๐‘ก = ๐‘ฅ ๐‘ก

๐‘ข ๐‘ก = โˆ’๐‘…โˆ’1๐ต๐‘‡๐œ† ๐‘ก

๐œ† ๐‘ก = ๐ด๐‘‡๐œ† ๐‘ก + ๐‘„๐‘ฅ ๐‘ก

๐‘ฅ ๐‘ก = ๐ด๐‘ฅ ๐‘ก + ๐ต๐‘ข ๐‘ก

โ€ข For LTI systems ๐œ† ๐‘ก = ๐‘ƒ ๐‘ก ๐‘ฅ(๐‘ก)

Optimal LQ control: ๐‘ข(๐‘ก) = โˆ’๐พ(๐‘ก)๐‘ฅ(๐‘ก) where ๐พ(๐‘ก) = ๐‘…โˆ’1๐ต๐‘‡๐‘ƒ(๐‘ก) and ๐‘ƒ(๐‘ก) is the solution of the differential Riccati equation (DRE):

๐‘ƒ ๐‘ก = ๐ด๐‘‡๐‘ƒ(๐‘ก) + ๐‘ƒ(๐‘ก)๐ด + ๐‘„ โˆ’ ๐‘ƒ(๐‘ก)๐ต๐‘…โˆ’1๐ต๐‘‡๐‘ƒ(๐‘ก) , ๐‘ƒ ๐‘ก๐‘“ = ๐‘€

Plant -

u r=0 x

K

Page 2: lqr feedforward

Linear quadratic regulator (LQR)

Given the plant model:

๐‘ฅ (๐‘ก) = ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

; ๐‘ฅ โˆˆ ๐‘…๐‘›, ๐‘ข โˆˆ ๐‘…๐‘š, ๐‘ฆ โˆˆ ๐‘…๐‘™

Minimize the performance index (cost), for ๐‘ก๐‘“ = โˆž (steady-state case):

๐ฝ =1

2 ๐‘ฅ๐‘‡ ๐‘ก ๐‘„๐‘ฅ ๐‘ก + ๐‘ข๐‘‡ ๐‘ก ๐‘…๐‘ข ๐‘ก ๐‘‘๐‘กโˆž

๐‘ก0

where ๐‘… = ๐‘…๐‘‡ > 0, ๐‘„ = ๐‘„๐‘‡ โ‰ฅ 0 are weight matrices

โ€ข For ๐‘ก๐‘“ = โˆž, ๐‘ƒ ๐‘ก = ๐‘ƒ (constant)

LQR control: ๐‘ข(๐‘ก) = โˆ’๐พ๐‘ฅ(๐‘ก) where ๐พ = ๐‘…โˆ’1๐ต๐‘‡๐‘ƒ and ๐‘ƒ is the solution of the algebraic Riccati equation (ARE): ๐ด๐‘‡๐‘ƒ ๐‘ก + ๐‘ƒ ๐‘ก ๐ด + ๐‘„ โˆ’ ๐‘ƒ ๐‘ก ๐ต๐‘…โˆ’1๐ต๐‘‡๐‘ƒ ๐‘ก = 0

Closed-loop system equation (๐‘Ÿ = 0):

๐‘ฅ ๐‘ก = ๐ด โˆ’ ๐ต๐พ ๐‘ฅ ๐‘ก + ๐ต๐‘Ÿ๐‘ฆ ๐‘ก = ๐ถ๐‘ฅ ๐‘ก + ๐ท๐‘Ÿ

Or, equivalently, the quadruple ๐ด โˆ’ ๐ต๐พ ,๐ต, ๐ถ, ๐ท

Optimal Linear Quadratic (LQ) Control

Plant -

u r=0 x

K

Page 3: lqr feedforward

Linear quadratic regulator (LQR)

Given the plant model:

๐‘ฅ (๐‘ก) = ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

; ๐‘ฅ โˆˆ ๐‘…๐‘›, ๐‘ข โˆˆ ๐‘…๐‘š, ๐‘ฆ โˆˆ ๐‘…๐‘™

Let ๐‘ข ๐‘ก = โˆ’๐พ๐‘ฅ ๐‘ก + ๐‘๐‘Ÿ LQR state feedback control gain: ๐พ = ๐‘…โˆ’1๐ต๐‘‡๐‘ƒ

and ๐‘ƒ is the solution of the algebraic Riccati equation (ARE): ๐ด๐‘‡๐‘ƒ ๐‘ก + ๐‘ƒ ๐‘ก ๐ด + ๐‘„ โˆ’ ๐‘ƒ ๐‘ก ๐ต๐‘…โˆ’1๐ต๐‘‡๐‘ƒ ๐‘ก = 0

Choose N so that the closed-loop DC-gain is equal to one. Closed-loop system equation:

๐‘ฅ ๐‘ก = ๐ด โˆ’ ๐ต๐พ ๐‘ฅ ๐‘ก + ๐ต๐‘๐‘Ÿ๐‘ฆ ๐‘ก = ๐ถ๐‘ฅ ๐‘ก + ๐ท๐‘๐‘Ÿ

Or, equivalently, ๐บ ๐‘  = ๐ถ ๐‘ ๐ผ โˆ’ ๐ด โˆ’ ๐ต๐พโˆ’1๐ต + ๐ท ๐‘

Or, the quadruple ๐ด โˆ’ ๐ต๐พ , ๐ต๐‘, ๐ถ, ๐ท๐‘

dc-Gain: ๐บ 0 = โˆ’ ๐ถ ๐ด โˆ’ ๐ต๐พ โˆ’1๐ต + ๐ท ๐‘ = 1

Feedforward control gain: ๐‘ = โˆ’ ๐ถ ๐ด โˆ’ ๐ต๐พ โˆ’1๐ต + ๐ท โˆ’1

Optimal Linear Quadratic (LQ) Control

Plant -

u r x

K

N +

Page 4: lqr feedforward

Linear quadratic regulator (LQR) Matlab functions: are(), lqr(), care(), dcgain(),

โ€ข For example: P= are(A,B*inv(R)*Bโ€˜,Q);

[K,P]=lqr(A,B,Q,R);

[P,L,K]=care(A,B,Q,R,S,E);

Example: Let ๐‘ฅ (๐‘ก) = ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

, with ๐ด =

โˆ’0.2 0.50 โˆ’0.5

0 0 01.6 0 0

0 00 00 0

โˆ’14.3 85.8 00 โˆ’33.3 1000 0 โˆ’10

,

๐ต =

000030

, ๐ถ = 1 0 0 0 0 , ๐ท = 0 .

โ€ข Find the LQR control ๐‘ข(๐‘ก) = โˆ’๐พ๐‘ฅ(๐‘ก) and plot the closed-loop step response for ๐‘… = 1, ๐‘„ = ๐‘‘๐‘–๐‘Ž๐‘” ๐œŒ, 0,0,0,0 , and ๐œŒ = 1,5,10,50,100.

โ€ข Also, for =100, plot the closed-loop states

Plant -

u r=0 x

K

Page 5: lqr feedforward

Linear quadratic regulator (LQR) Matlab code:

A=[-0.2,0.5,0,0,0; 0,-0.5,1.6,0,0;

0,0,-14.3,85.8,0; 0,0,0,-33.3,100;

0,0,0,0,-10]; B=[0;0;0;0;30];

C=[1,0,0,0,0]; D=0; rho=1;

R=1; Q=diag([rho,0,0,0,0]);

for rho=[1,5,10,50,100],

Q(1,1)=rho; [K,P] =lqr(A,B,Q,R),

step(ss(A-B*K,B,C,D)); hold on;

end, hold off;

โ€ข Or, instead of lqr(), use: P=are(A,B*inv(R)*B',Q),

K=inv(R)*B'*P,

โ€ข Closed-loop states Q(1,1)=100; [K,P] =lqr(A,B,Q,R); Ac=A-B*K;

[y,t,x]=step(ss(Ac,B,C,D)); plot(t,x(:,2:5)); grid;

Optimal solution: P = 0.3563 0.0326 0.0026 0.0056 0.0309 0.0326 0.0044 0.0004 0.0009 0.0056 0.0026 0.0004 0.0000 0.0001 0.0005 0.0056 0.0009 0.0001 0.0002 0.0012 0.0309 0.0056 0.0005 0.0012 0.0088 K = 0.9260 0.1678 0.0157 0.0371 0.2653

๐’– ๐’• = โˆ’๐‘ฒ๐’™ ๐’• + ๐’“

Plant -

u r x

K

0 0.5 1 1.50

0.2

0.4

0.6

0.8

1

1.2

1.4Step Response

Time (sec)

Am

plitu

de

=1

=5

Closed-loop Step Response

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-6

-4

-2

0

2

4

6

States x2, โ€ฆ, x5

Page 6: lqr feedforward

Discrete-time LQ control

Given the plant model:

๐‘ฅ(๐‘˜ + 1) = ๐ด๐‘ฅ(๐‘˜) + ๐ต๐‘ข(๐‘˜)๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

; ๐‘ฅ โˆˆ ๐‘…๐‘›, ๐‘ข โˆˆ ๐‘…๐‘š, ๐‘ฆ โˆˆ ๐‘…๐‘™

Minimize the performance index (cost): ๐ฝ =

1

2 ๐‘ฅ๐‘‡ ๐‘˜ ๐‘„๐‘ฅ ๐‘˜ + ๐‘ข๐‘‡ ๐‘˜ ๐‘…๐‘ข ๐‘˜๐‘๐‘˜=0

where ๐‘… = ๐‘…๐‘‡ > 0, ๐‘„ = ๐‘„๐‘‡ โ‰ฅ 0 are weight matrices

Discrete LQ control: ๐‘ข(๐‘˜) = โˆ’๐พ๐‘ฅ(๐‘˜) where ๐พ = ๐‘…โˆ’1๐ต๐‘‡๐‘ƒ(๐‘˜) and ๐‘ƒ(๐‘˜) is the solution of the dynamic/difference Riccati equation (DRE): ๐‘ƒ ๐‘˜ = ๐ด๐‘‡ ๐‘ƒ ๐‘˜ + 1 โˆ’ ๐‘ƒ ๐‘˜ + 1 ๐ต๐‘…โˆ’1๐ต๐‘‡๐‘ƒ ๐‘˜ + 1 ๐ด + ๐‘„ , ๐‘ƒ ๐‘ = ๐‘„

For steady-state case (๐‘ = โˆž) โ€ข P is a constant matrix

Discrete LQR ๐‘ข(๐‘˜) = โˆ’๐พ๐‘ฅ(๐‘˜)

where ๐พ = ๐‘… + ๐ต๐‘‡๐‘ƒ๐ต โˆ’1๐ต๐‘‡๐‘ƒ๐ด and ๐‘ƒ = ๐ด๐‘‡ ๐‘ƒ โˆ’ ๐‘ƒ๐ต๐‘…โˆ’1๐ต๐‘‡๐‘ƒ ๐ด + ๐‘„

LQR for Discrete-Time Systems

Matlab functions: dlqr(), dare(),

Page 7: lqr feedforward

Selection of Weighting Matrices Single-input, single-output (SISO) case: โ€ข LQR control (a possible choice for weight matrices)

โ€ข ๐‘… = 1, ๐‘„ = ๐‘‘๐‘–๐‘Ž๐‘”(๐‘ฅ1๐‘š๐‘Ž๐‘ฅ , โ€ฆ , ๐‘ฅ๐‘›๐‘š๐‘Ž๐‘ฅ), where ๐‘ฅ๐‘–๐‘š๐‘Ž๐‘ฅ is the maximum expected value of state ๐‘ฅ๐‘–(๐‘ก)

โ€ข Cheap control (control effort is inexpensive)

โ€ข ๐‘… = 1, ๐‘„ = ๐œŒ๐‘„0, where ๐‘„0 = ๐‘„0๐‘‡ โ‰ฅ 0 and ๐œŒ > 0 is a large number

โ€ข Expensive control (control effort is expensive)

โ€ข ๐‘… = 1, ๐‘„ = ๐œŒ๐‘„0, where ๐‘„0 = ๐‘„0๐‘‡ โ‰ฅ 0 and ๐œŒ > 0 is a small number

โ€ข Terminal control (terminal state must tend to zero)

โ€ข ๐‘„ = 0, ๐‘€ = ๐œŒ๐‘€0, where ๐‘€0 = ๐‘€0๐‘‡ โ‰ฅ 0 and ๐œŒ tends to infinity

โ€ข Here, the DRE changes to:

โˆ’๐‘ƒ ๐‘ก = ๐ด๐‘‡๐‘ƒ(๐‘ก) + ๐‘ƒ(๐‘ก)๐ด โˆ’ ๐‘ƒ(๐‘ก)๐ต๐‘…โˆ’1๐ต๐‘‡๐‘ƒ(๐‘ก) , ๐‘ƒ ๐‘ก๐‘“ = ๐œŒ๐‘€0

Equivalently, let ฮ  ๐‘ก = ๐‘ƒโˆ’1(๐‘ก)

ฮ  (๐‘ก) = ฮ (๐‘ก)๐ด๐‘‡ + ๐ดฮ (๐‘ก) โˆ’ ๐ต๐‘…โˆ’1๐ต๐‘‡ , ฮ  ๐‘ก๐‘“ = 0

Page 8: lqr feedforward

Plant model: ๐‘ฅ (๐‘ก) = ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

Degree of stability ๐›ผ โ€ข All closed-loop poles are to the left of โˆ’๐›ผ โ€ข Define a new performance index (cost)

๐ฝ =1

2 ๐‘’2๐›ผ๐‘ก ๐‘ฅ๐‘‡ ๐‘ก ๐‘„๐‘ฅ ๐‘ก + ๐‘ข๐‘‡ ๐‘ก ๐‘…๐‘ข ๐‘ก ๐‘‘๐‘กโˆž

๐‘ก0

where ๐‘… = ๐‘…๐‘‡ > 0, ๐‘„ = ๐‘„๐‘‡ โ‰ฅ 0 are weight matrices

โ€ข Define a new state variable and control ๐œ‰(๐‘ก) = ๐‘’๐›ผ๐‘ก๐‘ฅ(๐‘ก)

๐‘ฃ(๐‘ก) = ๐‘’๐›ผ๐‘ก๐‘ข(๐‘ก)

New state equation and performance index (cost) ๐œ‰ (๐‘ก) = ๐ด + ๐›ผ๐ผ ๐œ‰(๐‘ก) + ๐ต๐‘ฃ(๐‘ก)

๐ฝ =1

2 ๐œ‰๐‘‡ ๐‘ก ๐‘„๐œ‰ ๐‘ก + ๐‘ฃ๐‘‡ ๐‘ก ๐‘…๐‘ฃ ๐‘ก ๐‘‘๐‘กโˆž

๐‘ก0

LQR with degree of stability ๐‘ข(๐‘ก) = โˆ’๐พ๐‘ฅ(๐‘ก)

where ๐พ = ๐‘…โˆ’1๐ต๐‘‡๐‘ƒ and the modified ARE is: (๐ด + ๐›ผ๐ผ)๐‘‡๐‘ƒ + ๐‘ƒ ๐ด + ๐›ผ๐ผ + ๐‘„ โˆ’ ๐‘ƒ๐ต๐‘…โˆ’1๐ตโ€ฒ๐‘ƒ = 0

LQR with Degree of Stability

Matlab code: P=are((A_a*eye(size(A)))โ€™,B*inv(R)*Bโ€™,Q); k=inv(R)*Bโ€™*P; u=-k*x;

or use lqr() with A replaced with (A+I)

Page 9: lqr feedforward

Observer Design

LQR assumptions: 1. Plant model is perfectly known: ๐‘ฅ (๐‘ก) = ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)

๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

2. All states are directly measurable โ€ข If assumption 1 is not true (the model has uncertainties), use robust control โ€ข If assumption 2 is not true (only the output is measurable), use an observer

โ€ข System must be observable

Observer (state estimator) design: โ€ข Create a copy of the plant model with corrective term

๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข + ๐พ๐‘œ(๐‘ฆ โˆ’ ๐‘ฆ )๐‘ฆ = ๐ถ๐‘ฅ + ๐ท๐‘ข

โ€ข Choose the observer gain ๐พ๐‘œ so that all eigenvalues of ๐ด โˆ’ ๐พ๐‘œ๐ถ are in LHP

๐‘ฅ (๐‘ก) = ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

u y

๐‘ฅ ๐‘ก = ๐ด โˆ’ ๐พ๐‘œ๐ถ ๐‘ฅ ๐‘ก + ๐ต โˆ’ ๐พ๐‘œ๐ท ๐‘ข ๐‘ก + ๐พ๐‘œ๐‘ฆ ๐‘ฅ

Plant

Observer

Page 10: lqr feedforward

For plant model, (assuming that the state vector ๐‘ฅ is not measured):

๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข๐‘ฆ = ๐ถ๐‘ฅ + ๐ท๐‘ข

An observer-based controller has the form:

๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข + ๐พ๐‘œ(๐‘ฆ โˆ’ ๐ถ๐‘ฅ โˆ’ ๐ท๐‘ข)๐‘ข = โˆ’๐พ๐‘ฅ + ๐‘๐‘Ÿ

โ€ข The observer can be written as: ๐‘ฅ = ๐ด โˆ’ ๐พ๐‘œ๐ถ ๐‘ฅ + ๐ต โˆ’ ๐พ๐‘œ๐ท ๐‘ข + ๐พ๐‘œ๐‘ฆ

โ€ข Or, by superposition:

๐‘ฅ ๐‘ข = ๐ด โˆ’ ๐พ๐‘œ๐ถ ๐‘ฅ ๐‘ข + ๐ต โˆ’ ๐พ๐‘œ๐ท ๐‘ข

๐‘ฅ ๐‘ฆ = ๐ด โˆ’ ๐พ๐‘œ๐ถ ๐‘ฅ ๐‘ฆ + ๐พ๐‘œ๐‘ฆ

๐‘ฅ = ๐‘ฅ ๐‘ข + ๐‘ฅ ๐‘ฆ

Observer-based controller, (๐‘ฅ = ๐‘ฅ ๐‘ข + ๐‘ฅ ๐‘ฆ):

๐‘ฅ ๐‘ข = ๐ด โˆ’ ๐พ๐‘œ๐ถ ๐‘ฅ ๐‘ข + ๐ต โˆ’ ๐พ๐‘œ๐ท ๐‘ข๐‘ข๐‘ข = ๐พ๐‘ฅ ๐‘ข

โ‡’ ๐บ๐‘ข(๐‘ )

๐‘ฅ ๐‘ฆ = ๐ด โˆ’ ๐พ๐‘œ๐ถ ๐‘ฅ ๐‘ฆ + ๐พ๐‘œ๐‘ฆ

๐‘ข๐‘ฆ = ๐พ๐‘ฅ ๐‘ฆ โ‡’ ๐บ๐‘ฆ ๐‘ 

๐‘ข = ๐‘๐‘Ÿ โˆ’ ๐‘ข๐‘ข โˆ’ ๐‘ข๐‘ฆ

Observer-Based Controller Design

Plant u y

Observer ๐‘ฅ

N

K

r

-

G(s) u y

N r

-

Gy(s)

Guc(s)

G(s) u y

N r

-

Gy(s)

Gu(s) - uu

uy

๐บ๐‘ข๐‘(๐‘ ) = ๐ผ + ๐บ๐‘ข(๐‘ )โˆ’1

Page 11: lqr feedforward

Matlab function: reg(), Syntax: [Ac,Bc,Cc,Dc]=reg(A,B,C,D,K,Ko);

Or: Gc=-reg(G,K,Ko)

Example: Let ๐‘ฅ (๐‘ก) = ๐ด๐‘ฅ(๐‘ก) + ๐ต๐‘ข(๐‘ก)๐‘ฆ(๐‘ก) = ๐ถ๐‘ฅ(๐‘ก) + ๐ท๐‘ข(๐‘ก)

, with ๐ด =

โˆ’0.2 0.50 โˆ’0.5

0 0 01.6 0 0

0 00 00 0

โˆ’14.3 85.8 00 โˆ’33.3 1000 0 โˆ’10

, ๐ต =

000030

,

๐ถ = 1 0 0 0 0 , ๐ท = 0 .

Find the observer-based LQR control ๐‘ข ๐‘ก = โˆ’๐พ๐‘ฅ ๐‘ก + ๐‘Ÿ for ๐‘… = 1, ๐‘„ = ๐‘‘๐‘–๐‘Ž๐‘” 1,0,0,0,0 , using an observer gain ๐พ๐‘œ = โˆ’8.3 979.24 โˆ’19367.61 4293.85 0 ๐‘‡, and then plot the closed-loop step response.

Matlab code: A=[-0.2,0.5,0,0,0; 0,-0.5,1.6,0,0; 0,0,-14.3,85.8,0; 0,0,0,-33.3,100; 0,0,0,0,-10]; B=[0;0;0;0;30]; C=[1,0,0,0,0]; D=0; R=1; Q=diag([1,0,0,0,0]); G=ss(A,B,C,D); [K,P] =lqr(A,B,Q,R); Ko=[-8.3,979.24,-19367.61,4293.85,0]'; Gc=-reg(G,K,Ko); zpk(Gc), Gcl1=ss(A-B*K,B,C,D); Gcl2=feedback(Gc*G,1,-1); step(Gcl1,Gcl2);

Observer-Based Controller Design

G(s) Gc(s) -

e u r y

0 0.5 1 1.5 2 2.50

0.2

0.4

0.6

0.8

1

1.2

1.4

1.6From: In(1) To: u1

Step Response

Time (sec)

Am

plitu

de

Full-state feedback LQR

Observer-based LQR

๐บ๐‘(๐‘ ) =11.4839 (s+33.34) (s+14.3) (s+10) (s+1.792)

(s+20.92) (s^2 + 30.19s + 328.1) (s^2 + 6.845s + 120)

Page 12: lqr feedforward

Pole Placement Design Technique

Given the system ๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข๐‘ฆ = ๐ถ๐‘ฅ + ๐ท๐‘ข

with a state feedback control ๐‘ข = โˆ’๐พ๐‘ฅ + ๐‘๐‘Ÿ

โ€ข If ๐ด, ๐ต is controllable and ๐‘ฅ is directly measurable, the closed-loop poles (eigenvalues of ๐ด โˆ’ ๐ต๐พ ) can be arbitrarily assigned โ€“ Imaginary poles, however, must come in conjugate pairs

โ€ข The systemโ€™s open-loop characteristic equation is:

๐‘Ž ๐‘  = ๐‘‘๐‘’๐‘ก ๐‘ ๐ผ โˆ’ ๐ด = ๐‘ ๐‘› + ๐‘Ž1๐‘ ๐‘›โˆ’1 +โ‹ฏ+ ๐‘Ž๐‘›โˆ’1๐‘  + ๐‘Ž๐‘›

โ€ข The systemโ€™s closed-loop characteristic equation is:

๐›ฟ ๐‘  = ๐‘‘๐‘’๐‘ก ๐‘ ๐ผ โˆ’ ๐ด + ๐ต๐พ = ๐‘ ๐‘› + ๐‘‘1 ๐พ ๐‘ ๐‘›โˆ’1 +โ‹ฏ+ ๐‘‘๐‘›โˆ’1 ๐พ ๐‘  + ๐‘‘๐‘›(๐พ)

โ€ข Let the desired closed-loop poles be: ๐œ‡๐‘–, ๐‘– = 1, โ€ฆ , ๐‘›

โ€“ The desired closed-loop characteristic equation can be written as :

๐›ผ ๐‘  = ๐‘  โˆ’ ๐œ‡๐‘– = ๐‘ ๐‘› + ๐›ผ1๐‘ ๐‘›โˆ’1 +โ‹ฏ+ ๐›ผ๐‘›โˆ’1๐‘  + ๐›ผ๐‘›

๐‘›๐‘–=1

Feedback gain ๐พ = ๐‘˜1 โ‹ฏ ๐‘˜๐‘› can be found, by equating ๐›ฟ ๐‘  and ๐›ผ ๐‘  , as

๐›ฟ ๐‘  = ๐›ผ ๐‘ 

๐‘‘1 ๐พ = ๐›ผ1โ‹ฎ

๐‘‘๐‘›โˆ’1 ๐พ = ๐›ผ๐‘›โˆ’1๐‘‘๐‘› ๐พ = ๐›ผ๐‘›

๐พ = ๐‘˜1 โ‹ฏ ๐‘˜๐‘› = ?

Page 13: lqr feedforward

Pole Placement Control Algorithms โ€ข Bass-Gura algorithm ๐พ = ๐‘Ž โˆ’ ๐›ผ ๐‘‡๐ฟโˆ’1๐’žโˆ’1

where ๐‘Ž โˆ’ ๐›ผ ๐‘‡ = ๐‘Ž1 โˆ’ ๐›ผ1 โ‹ฏ ๐‘Ž๐‘› โˆ’ ๐›ผ๐‘› , ๐’ž = ๐ต ๐ด๐ต โ‹ฏ ๐ด๐‘›โˆ’1๐ต , and ๐ฟ =

๐‘Ž๐‘›โˆ’1 ๐‘Ž๐‘›โˆ’2๐‘Ž๐‘›โˆ’2 ๐‘Ž๐‘›โˆ’3

โ‹ฏ ๐‘Ž1 1โ‹ฏ 1

โ‹ฎ โ‹ฎ๐‘Ž1 11

โ‹ฑ

is the non-singular Hankel matrix

โ€ข Ackermannโ€™s algorithm โ€“ Can be applied only to SISO systems

๐พ = 0 โ‹ฏ 0 1 ๐’žโˆ’1๐›ผ where ๐›ผ๐‘‡ = ๐›ผ1 โ‹ฏ ๐›ผ๐‘› , ๐’ž = ๐ต ๐ด๐ต โ‹ฏ ๐ด๐‘›โˆ’1๐ต

โ€ข Numerically robust pole-placement algorithm (place) โ€“ Can be applied to MIMO systems โ€“ Desired poles must all be distinct

Matlab functions: bass_pp(), acker(), place(), K=bass_pp(A,B,pdes) K=acker(A,B,pdes) K=place(A,B,pdes) where pdes = desired closed-loop poles

Matlab function for Bass-Gura algorithm function K=bass_pp(A,B,p) n=length(B); a1=poly(p); alpha=[a1(n:-1:2),1]; C=ctrb(A,B); a=poly(A); aa=[a(n:-1:2),1]; L=hankel(aa); K=(a1(n+1:-1:2)-a(n+1:-1:2))*inv(L)*inv(C);

Page 14: lqr feedforward

Pole Placement Control Design

Example: Consider the multivariable system model ๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข๐‘ฆ = ๐ถ๐‘ฅ + ๐ท๐‘ข

with

๐ด =

0 2 01 0 00 1 0

0 โˆ’2 0 0 0 โˆ’1 0 0 0

0 0 0 2 0 0 0 0 โˆ’1

3 0 01 0 00 1 0

, ๐ต =

1 20 00 10 โˆ’10 10 0

, ๐ถ = 1 0 0 0 0 0 , ๐ท = 0

โ€ข Design a state feedback control ๐‘ข = โˆ’๐พ๐‘ฅ + ๐‘๐‘Ÿ so the closed-loop poles are at: ๐œ‡๐‘– = โˆ’1, โˆ’2, โˆ’3, โˆ’4, โˆ’1j. Also draw the closed-loop step response.

Matlab code: A=[0,2,0,0,-2,0; 1,0,0,0,0,-1; 0,1,0,0,0,0; 0,0,0,3,0,0; 2,0,0,1,0,0; 0,0,-1,0,1,0];

B=[1,2; 0,0; 0,1; 0,-1; 0,1; 0,0]; C=[1,0,0,0,0,0]; D=0;

pdes=[-1,-2,-3,-4,-1+i,-1-i];

K=place(A,B,pdes), N=inv(diag(dcgain(ss((A-B*K),B,C,D)))),

eig(A-B*K), sys_cl=ss((A-B*K),B*N,C,D); dcgain(sys_cl);

step(sys_cl);

Control gains:

๐พ =8.0037 โˆ’26.0056 โˆ’26.11220.1759 โˆ’3.0018 โˆ’3.1317

16.3759 23.2324 28.7704โˆ’7.7366 2.0396 2.6613

๐‘ =โˆ’10.9884 0

0 13.6388 0 2 4 6

-1

-0.5

0

0.5

1

1.5

2

2.5

3

3.5From: In(1)

0 2 4 6

From: In(2)

Step Response

Time (sec)

Am

plitu

de Response to u1 Response to u2

Page 15: lqr feedforward

โ€ข Observer design using pole placement technique

โ€“ Dual of control design problem

โ€ข Matlab functions: place(), acker(),

Example: Given the plant ๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข๐‘ฆ = ๐ถ๐‘ฅ + ๐ท๐‘ข

with ๐ด =

0 10 0

0 0โˆ’1 0

0 00 0

0 111 0

, ๐ต =

010โˆ’1

,

๐ถ = 1 2 3 4 , ๐ท = 0

โ€ข Design an observer with poles at: ๐‘ 1,2,3,4 = โˆ’1,โˆ’2,โˆ’1 ยฑ ๐‘–

Matlab code:

A=[0,1,0,0; 0,0,-1,0; 0,0,0,1; 0,0,11,0];

B=[0; 1; 0; -1]; C=[1,2,3,4]; D=0;

pdes=[-1, -2, -1+i, -1-i];

Ko=place(A',C',pdes)', eig(A-Ko*C),

Pole Placement Control Design Technique

Observer gain:

๐พ๐‘œ =

โˆ’0.2203โˆ’0.47500.42381.2247

Page 16: lqr feedforward

Observer-based controller design using pole placement

Plant: ๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข๐‘ฆ = ๐ถ๐‘ฅ + ๐ท๐‘ข

Controller: ๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข + ๐พ๐‘œ(๐‘ฆ โˆ’ ๐ถ๐‘ฅ โˆ’ ๐ท๐‘ข)๐‘ข = โˆ’๐พ๐‘ฅ + ๐‘๐‘Ÿ

Equivalently:

โ€ข ๐บ๐‘ ๐‘  =๐‘ˆ๐‘ฆ(๐‘ )

๐‘Œ(๐‘ )=

๐ด โˆ’ ๐ต๐พ โˆ’ ๐พ๐‘œ๐ถ + ๐พ๐‘œ๐ท๐พ ๐พ๐‘œ๐พ 0

โ€ข ๐บ๐‘Ÿ๐‘ ๐‘  =๐‘ˆ๐‘Ÿ(๐‘ )

๐‘…(๐‘ )=

๐ด โˆ’ ๐ต๐พ โˆ’ ๐พ๐‘œ๐ถ + ๐พ๐‘œ๐ท๐พ ๐ต โˆ’ ๐พ๐‘œ๐ท ๐‘โˆ’๐พ ๐‘

Closed-loop system:

๐‘ฅ ๐‘ฅ

=๐ด โˆ’๐ต๐พ๐พ๐‘œ๐ถ ๐ด โˆ’ ๐ต๐พ โˆ’ ๐พ๐‘œ๐ถ

๐‘ฅ๐‘ฅ +

๐ต๐ต

๐‘๐‘Ÿ

๐‘ฆ = ๐ถ โˆ’๐ท๐พ๐‘ฅ๐‘ฅ + ๐ท ๐‘๐‘Ÿ

๐บ๐‘๐‘™ ๐‘  = ๐ถ โˆ’๐ท๐พ ๐‘ ๐ผ โˆ’๐ด โˆ’๐ต๐พ๐พ๐‘œ๐ถ ๐ด โˆ’ ๐ต๐พ โˆ’ ๐พ๐‘œ๐ถ

โˆ’1๐ต๐ต

+ ๐ท ๐‘

DC-gain = ๐บ๐‘๐‘™(0) = 1 ๐‘ = โˆ’ ๐ถ โˆ’๐ท๐พ๐ด โˆ’๐ต๐พ๐พ๐‘œ๐ถ ๐ด โˆ’ ๐ต๐พ โˆ’ ๐พ๐‘œ๐ถ

โˆ’1๐ต๐ต

+ ๐ท

โˆ’1

Pole Placement Control Design Technique

G(s) u y r

-

Gc(s)

Grc(s)

uy

ur

Plant u y

Observer ๐‘ฅ

N

K

r

-

Page 17: lqr feedforward

Observer-based controller design using pole placement

Example: Given the plant ๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข๐‘ฆ = ๐ถ๐‘ฅ + ๐ท๐‘ข

with ๐ด =โˆ’0.3 0.1 โˆ’0.051 0.1 0

โˆ’1.5 โˆ’8.9 โˆ’0.05, ๐ต =

204

,

๐ถ = 1 2 3 , ๐ท = 0 โ€ข Design an observer-based controller ๐‘ข = โˆ’๐พ๐‘ฅ + ๐‘๐‘Ÿ so the closed-loop poles are

at: ๐‘1,2,3 = โˆ’1,โˆ’2,โˆ’3 and the observer poles are at ๐‘ 1,2,3 = โˆ’10,โˆ’20,โˆ’30

Matlab code: A=[-0.3,0.1,-0.05; 1,0.1,0; -1.5,-8.9,-0.05];

B=[2; 0; 4]; C=[1,2,3]; D=0;

pcdes=[-1, -2, -3]; podes=[-10, -20, -30];

K=place(A,B,pcdes), Ko=place(A',C',podes)',

N=inv(dcgain(ss([A,-B*K;Ko*C,A-B*K-Ko*C],[B;B],[C,-D*K],D))),

Gcl=ss([A,-B*K;Ko*C,A-B*K-Ko*C],[B;B]*N,[C,-D*K],D*N);

Step(Gcl);

Pole Placement Control Design Technique

Controller gains: ๐พ = 3.6496 5.7189 โˆ’0.3873 ,

๐พ๐‘œ =โˆ’225.8203โˆ’17.9695107.1698

,

๐‘ = โˆ’0.1106

0 2 4 6 8-0.2

0

0.2

0.4

0.6

0.8

1

1.2Step Response

Time (sec)

Am

plitu

de

Page 18: lqr feedforward

Decoupling Control of Multivariable Systems

Decoupling control with state feedback โ€ข Plant (A,B,C,D) with m inputs and m outputs

โ€ข State feedback control: ๐‘ข = ๐‘๐‘ฃ โˆ’ ๐พ๐‘ฅ

For each row ๐‘๐‘—๐‘‡ of ๐ถ , let ๐‘‘๐‘— โˆˆ 0,1,โ‹ฏ , ๐‘› โˆ’ 1 be the smallest integer where ๐‘๐‘—

๐‘‡๐ด๐‘‘๐‘—๐ต โ‰  0

Decoupler gains: ๐‘ = ๐ต1โˆ’1, ๐พ = ๐‘

๐‘1๐‘‡๐ด๐‘‘1+1

โ‹ฎ๐‘๐‘š

๐‘‡๐ด๐‘‘๐‘š+1 , (if ๐ต1 =

๐‘1๐‘‡๐ด๐‘‘1๐ตโ‹ฎ

๐‘๐‘š๐‘‡๐ด๐‘‘๐‘š๐ต

is nonsingular)

Decoupled model:

๐บ1 ๐‘  = ๐‘‘๐‘–๐‘Ž๐‘”1

๐‘ ๐‘‘1+1, โ‹ฏ ,

1

๐‘ ๐‘‘๐‘š+1

Now, design a controller ๐บ๐‘๐‘— for each ๐บ1๐‘—:

๐บ๐‘ ๐‘  = ๐‘‘๐‘–๐‘Ž๐‘” ๐บ๐‘1 ๐‘  ,โ‹ฏ , ๐บ๐‘๐‘š ๐‘ 

Matlab function: decoupler(),

Syntax: [G1,K,d,N]=decoupler(G) where G and G1 are the plant and decoupled models,

K and N are the feedback and feedforward gains,

d is the vector of djโ€™s

Matlab code for decoupler function: function [G1,K,d,Gam]=decoupler(G) A=G.a; B=G.b; C=G.c; [n,m]=size(G.b); B1=[]; K0=[]; for j=1:m,

for k=0:n-1, if norm(C(j,:)*A^k*B)>eps, d(j)=k; break; end,

end, B1=[B1; C(j,:)*A^d(j)*B]; K0=[K0; C(j,:)*A^(d(j)+1)];

end, Gam=inv(B1); K=Gam*K0; G1=minreal(tf(ss(A-B*K,B,C,G.d))*inv(B1));

G(s) u y r

-

K

Gc(s) v

N -

Decoupled Model G1(s)

x

Page 19: lqr feedforward

Decoupling Control of Multivariable Systems

Pole placement decoupling control with state feedback โ€ข State feedback control: ๐‘ข = ๐‘๐‘Ÿ โˆ’ ๐พ๐‘ฅ

Define: ๐ธ =๐‘1

๐‘‡๐ด๐‘‘1๐ตโ‹ฎ

๐‘๐‘š๐‘‡๐ด๐‘‘๐‘š๐ต

and ๐น =

๐‘1๐‘‡ ๐ด๐‘‘1+1 + ๐‘Ž1,1๐ด

๐‘‘1 +โ‹ฏ+ ๐‘Ž1,๐‘‘1+1๐ผ

โ‹ฎ๐‘๐‘š

๐‘‡ ๐ด๐‘‘๐‘š+1 + ๐‘Ž๐‘š,1๐ด๐‘‘๐‘š +โ‹ฏ+ ๐‘Ž๐‘š,๐‘‘๐‘š+1๐ผ

Pole placement: Assign control gains so that the transfer function of the jth subsystem is equal to

the nj-th-order optimal ITAE standard TF: ๐‘‡๐‘›๐‘— ๐‘  =1

๐‘ ๐‘›๐‘—+๐‘Ž1๐‘ 

๐‘›๐‘—โˆ’1+โ‹ฏ+๐‘Ž๐‘›๐‘—โˆ’1๐‘ +๐‘Ž๐‘›๐‘—

, ๐‘›๐‘— = ๐‘‘๐‘—+1, with parameters:

Decoupled transfer function: ๐บ1 ๐‘  = ๐‘‘๐‘–๐‘Ž๐‘”๐‘Ž1,๐‘‘1+1

๐‘ ๐‘‘1+1+๐‘Ž1,1๐‘ ๐‘‘1+โ‹ฏ+๐‘Ž1,๐‘‘1+1

, โ‹ฏ ,๐‘Ž๐‘š,๐‘‘๐‘š+1

๐‘ ๐‘‘๐‘š+1+๐‘Ž๐‘š,1๐‘ ๐‘‘๐‘š+โ‹ฏ+๐‘Ž๐‘š,๐‘‘๐‘š+1

Control gains: ๐พ = ๐ธโˆ’1๐น, ๐‘ = ๐ธโˆ’1๐‘€, with ๐‘€ = ๐‘‘๐‘–๐‘Ž๐‘”(๐‘Ž1,๐‘‘1+1, โ‹ฏ ,+๐‘Ž๐‘š,๐‘‘๐‘š+1), (if ๐ธ is nonsingular)

G(s) u y

-

K

r N

Decoupled System

x

n Mp nts Denominator of ๐‘‡๐‘› ๐‘  with ๐’‚๐’ = ๐Ž๐’๐’

1 ๐‘  + ๐œ”๐‘›

2 4.6% 6.0 ๐‘ 2 + 1.41๐œ”๐‘›๐‘  + ๐œ”๐‘›2

3 2% 7.6 ๐‘ 3 + 1.75๐œ”๐‘›๐‘ 2 + 2.15๐œ”๐‘›

2๐‘  + ๐œ”๐‘›3

4 1.9% 5.4 ๐‘ 4 + 2.1๐œ”๐‘›๐‘ 3 + 2.4๐œ”๐‘›

2๐‘ 2 + 2.7๐œ”๐‘›3๐‘  + ๐œ”๐‘›

4

5 2.1% 6.6 ๐‘ 5 + 2.8๐œ”๐‘›๐‘ 4 + 5.0๐œ”๐‘›

2๐‘ 3 + 5.5๐œ”๐‘›3๐‘ 2 + 2.4๐œ”๐‘›

4๐‘  + ๐œ”๐‘›5

6 5% 7.8 ๐‘ 6 + 2.25๐œ”๐‘›๐‘ 5 + 6.6๐œ”๐‘›

2๐‘ 4 + 8.6๐œ”๐‘›3๐‘ 3 + 7.45๐œ”๐‘›

4๐‘ 2 + 2.95๐œ”๐‘›5๐‘  + ๐œ”๐‘›

6

Matlab code for std_tf function: function G=std_tf(wn,n) if n>6, disp('n must be less than 7'); end M=[1,1,0,0,0,0,0; 1,1.4,1,0,0,0,0; 1,1.75,2.15,1,0,0,0; 1,2.1,3.4,2.7,1,0,0; 1,2.8,5,5.5,3.4,1,0; 1,3.25,6.6,8.6,7.45,3.95,1]; G=tf(wn^n,M(n,1:n+1).*(wn*ones(1,n+1)).^[0:n]);

Page 20: lqr feedforward

Pole placement decoupling control with state feedback Matlab functions: std_tf(), decouple_pp(),

Syntax: G=std_tf(wn,n);

[G1,K,d,N]=decouple_pp(G,wn)

Pole Placement Control Design Technique

Controller gains: ๐พ =

โˆ’0.125 2.1250.625 โˆ’0.875

โˆ’0.375 โˆ’4.375โˆ’0.125 2.125

,

๐‘ =โˆ’7.5 1.252.5 0

Decoupled TF:

๐บ1 ๐‘  =

5

๐‘ +50

05

๐‘ +5

Matlab code for decouple_pp function: function [G1,K,d,N]=decouple_pp(G,wn) A=G.a; B=G.b; C=G.c; [n,m]=size(G.b); E=[]; F=[]; for j=1:m,

for i=0:n-1, if norm(C(j,:)*A^i*B)>eps, d(j)=i; break; end,

end, g1=std_tf(wn,d(j)+1); [~,cc]=tfdata(g1,'v'); F=[F; C(j,:)*polyvalm(cc,A)]; E=[E; C(j,:)*A^d(j)*B];

end, Gam=inv(E); K=Gam*F; G0=tf(ss(A-B*K,B,C,G.d)); N=Gam*inv(dcgain(G0*Gam)); G1=minreal(G0*N);

Example: For plant ๐‘ฅ = ๐ด๐‘ฅ + ๐ต๐‘ข๐‘ฆ = ๐ถ๐‘ฅ + ๐ท๐‘ข

with

๐ด =

2.25 โˆ’52.25 โˆ’4.25

โˆ’1.25 โˆ’0.5โˆ’1.25 โˆ’0.25

0.25 โˆ’0.51.25 โˆ’1.75

โˆ’1.25 โˆ’1โˆ’0.25 โˆ’0.75

, ๐ต =

4 62 42 20 2

, ๐ถ =0 00 2

0 10 2

,

๐ท =0 00 0

โ€ข Design an observer-based controller ๐‘ข = โˆ’๐พ๐‘ฅ + ๐‘๐‘Ÿ so the closed-loop poles are defined by the optimal ITAE standard transfer function with ๐œ”๐‘› = 5 rad/sec

Matlab code: A=[2.25,-5,-1.25,-0.5; 2.25,-4.25,-1.25,-0.25; 0.25,-0.5,-1.25,-1; 1.25,-1.75,-0.25,-0.75]; B=[4,6; 2,4; 2,2; 0,2]; C=[0,0,0,1; 0,2,0,2]; D=[0,0; 0,0]; G=ss(A,B,C,D); [G1,K,d,N]=decouple_pp(G,5), step(G1);

-1

-0.5

0

0.5

1From: In(1)

To

: O

ut(

1)

0 1 2 30

0.5

1

To

: O

ut(

2)

From: In(2)

0 1 2 3

Step Response

Time (sec)

Am

plitu

de