LQR Feedforward
LQR Feedforward
LQR Feedforward
, ,
= 2 + 2
= + + () () + ()
2
where () is the Lagrangian multiplier
=0
+ = 0
= 1
= () + = () = +
So, let
= +
+ =
= ()
= ()
Optimal LQ control:
() = ()()
r=0
u
-
where () = 1 ()
and () is the solution of the differential Riccati equation (DRE):
= () + () + ()1 () ,
=
Plant
() = () + ()
;
() = () + ()
, ,
=
where =
+
0 are weight matrices
For = , = (constant)
LQR control:
r=0
() = ()
u
-
K
where = 1
and is the solution of the algebraic Riccati equation (ARE):
+ + 1 = 0
Plant
() = () + ()
;
() = () + ()
, ,
Let = +
u
+
= +
= +
Or, equivalently, =
Plant
Example:
0
0
= 0 , = 1
0
30
Plant
[K,P]=lqr(A,B,Q,R);
[P,L,K]=care(A,B,Q,R,S,E);
0.2
0
() = () + ()
Let
, with = 0
() = () + ()
0
0
0.5
0.5
0
0
0
0
1.6
14.3
0
0
0
0
85.8
33.3
0
0
0
0 ,
100
10
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
0.0326
0.0044
0.0004
0.0009
0.0056
Optimal solution:
P=
0.3563
0.0326
0.0026
0.0056
0.0309
Plant
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
= +
Closed-loop Step Response
P=are(A,B*inv(R)*B',Q),
K=inv(R)*B'*P,
Step Response
1.4
States x2, , x5
=1
1.2
Closed-loop states
Amplitude
=5
0.6
0.4
-2
0.2
-4
0.8
-6
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0.5
1
Time (sec)
1.5
( + 1) = () + ()
;
() = () + ()
, ,
=
+
=0
2
Discrete LQ control:
() = ()
where = 1 ()
and () is the solution of the dynamic/difference Riccati equation (DRE):
= + 1 + 1 1 + 1 + , =
Discrete LQR
() = ()
where = + 1
and = 1 +
Matlab functions:
dlqr(), dare(),
= () + () () 1 () ,
= 0
Equivalently, let = 1 ()
() = () + () 1 ,
= 0
() = () + ()
() = () + ()
=2
() = ()
() = ()
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)
where = 1
and the modified ARE is: ( + ) + + + 1 = 0
Observer Design
LQR assumptions:
1. Plant model is perfectly known:
() = () + ()
() = () + ()
= + + ( )
= +
Choose the observer gain so that all eigenvalues of are in LHP
Plant
u
Observer
= + +
() = () + ()
() = () + ()
= + +
Plant
Observer
Or, by superposition:
= +
= +
= +
- - uu G (s)
u
u
Observer-based controller, ( = + ):
= +
()
=
= +
=
=
() = + ()
Guc(s)
G(s)
Gy(s)
u
Gy(s)
G(s)
[Ac,Bc,Cc,Dc]=reg(A,B,C,D,K,Ko);
Or:
Gc=-reg(G,K,Ko)
Example:
= 1 0
Let
() = () + ()
, with
() = () + ()
0 0 0 , =0.
0
0
0
0.2 0.5
0
1.6
0
0
0
0.5
0
0
14.3 85.8
0 , = 0 ,
= 0
0
0
0
0
33.3 100
30
0
0
0
0
10
G(s)
Step Response
From: In(1) To: u1
1.6
Observer-based
LQR
1.4
1.2
Amplitude
Matlab code:
Gc(s)
1
0.8
Full-state feedback
LQR
0.6
0.4
0.2
0
0.5
1.5
Time (sec)
2.5
, = 1, ,
=1
Feedback gain =
= + 1 1 + + 1 +
1 = 1
= 1
1 = 1
=
= ?
and , as
= 1 1
where
= 1 1
, =
1 2
2 3
1 , and =
1 1
1
1
1
Ackermanns algorithm
Can be applied only to SISO systems
= 0
where = 1
0 1 1
, =
2
0
1
0
0
0
0
0
0
0
0
1
0 2
0
0
0
0
3
0
1
0
0
1
= +
with
= +
0
1
2
1
0
0
0 , = 0
1 , =
1 0 0 0
0
0 1
0
0
1
0
0
0
0 0 , =0
Matlab code:
Control gains:
Step Response
From: In(1)
From: In(2)
3.5
3
2.5
2
Amplitude
Response to u1
Response to u2
1.5
1
0.5
0
-0.5
-1
6
0
Time (sec)
0
= +
with
= 0
= +
0
0
1 0 0
0
0 1 0 , = 1 ,
0 0 1
0
0 11 0
1
4 , =0
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),
Observer gain:
0.2203
= 0.4750
0.4238
1.2247
Plant:
Controller:
Equivalently:
()
+
()
0
()
+
= =
()
u
uy
G(s)
Gc(s)
Closed-loop system:
=
+
DC-gain = (0) = 1
Observer
ur
Grc(s)
Plant
2
0.05
0 , = 0 ,
4
0.05
= 1 2 3 , =0
=
17.9695 ,
Step Response
1.2
1
0.8
Amplitude
Matlab code:
0.6
0.4
0.2
0
-0.2
4
Time (sec)
Decoupler gains:
1 1 +1
1 1
= 1 1 , =
, (if 1 =
is nonsingular)
+1
Decoupled model:
1 =
, , +1
1 +1
Define:
1 1 +1 + 1,1 1 + + 1,1 +1
1 1
=
and =
+1
+ ,1 + + , +1
Decoupled System
r
u
y
N
G(s)
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: =
n
Denominator of with =
Mp nts
2 + 1.41 + 2
2 4.6% 6.0
2%
3 + 1.75 2 + 2.152 + 3
7.6
4 1.9% 5.4
5 2.1% 6.6
5%
Control gains:
1 =
, = +1 , with parameters:
1
3
1
+1 ++ 1 +
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]);
1,1 +1
1 +1 +1,1 1 ++1,1 +1
,,
, +1
+1 +,1 ++,+1
= +
with
= +
0.5
4
0.25 , = 2
2
1
0
0.75
6
4 , = 0
2
0
2
0
2
0 1
,
0 2
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);
From: In(2)
1 =
+5
0
5
+5
Amplitude
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);
Decoupled TF:
0.5
0
-0.5
-1
1
To: Out(2)
Matlab code:
To: Out(1)
0.5
3 0
Time (sec)