TEORI KONTROL OPTIMUM
TUGAS
Oleh RIRIN SISPIYATI NIM : 20106003 Program Studi Matematika
INSTITUT TEKNOLOGI BANDUNG 2009
1
2.2-5
Comparison of Different Discrete Controllers
x k 1
a.
12 3
2 1 xk u k , 1 2 0 1 2
Find the open-loop control
Ja
u 0 ,u1
8 x0 4
to drive the initial state to
x 2 0 while minimizing the cost
1 1 T 2 0 uk uk 2 k 0 0 1
Check your answer by “simulation” (i.e., apply your
u 0 ,u1
to the plant to verify that
x 2 0 ).
Penyelesaian :
Persamaan state :
x k 1 Ax k Bu k ,
1 A 2 3
dimana :
Hamiltonian:
H
1 1 T u k Ru k pkT1 Axk Bu k , 2 k 0
dimana:
2 0 R 0 1
Persamaan Costate:
pk
2 1 ; B 2 0 1 1 2
1 3 H AT p k 1 1 2 p k 1 x k 2 1
Stationary:
0
2 0 2 2 H Ru k B T p k 1 uk p k 1 u k 0 1 1 0
sehingga:
1 0 2 2 1 1 1 1 T u k R 1 B T p k 1 2 p k 1 p k 1 A 1 0 1 0 0 1 1 0
N 2,
pN
maka :
1 1 T uk A 1 0
k 1
N k 1
1 k
p2
x k A k x0 A k i 1 BR 1 B T AT i 0
1 i
p2
Sehingga :
2
1
x 2 A 2 x0 A1i BR 1 B T AT
1i
i 0
1
G0, 2 A1i BR 1 B T AT
1i
p2
ABR 1 B T AT BR 1 B T
i 0
3 2 12 1 2 2 12
1 2 3
1 2
3 3 2 14 1 2 2 - 32
- 32 3 2 134 12 17 2 2 12 19
Maka :
p 2 G0, 2
1
38 123 A x0 x2 1 123
2
1 123 13 246
74 9 2
3 4 5 2
1 1 T 1 1 12 u0 A p 2 1 0 1 1 0 2
4188 1 1 1 1 148 41 u1 p 2 1 0 60 148 1 0 41 41
38 8 0 123 1 4 0 123
1 123 13 246
11 148 41 60 26 41
3 148 120 41 41 254 60 1 41 41
Cek /simulasi :
1 x1 2 3
12 2 1 x u 0 2 0 0 3 1
412 8 2 1 120 2 494 41 41 41 254 240 1060 1 4 2 0 41 20 41 41
1 x2 2 3
12 2 1 x u 1 2 0 1 3 1
324 412 2 1 4188 324 0 41 41 41 1060 148 176 176 1 41 2 0 41 41 41 0
1 2
1 2
1 2
1 2
3
b.
Find a constant state variable feedback to input component one of the form
u 1k Kx k where
u k u 1k
u k2
, to yield a deadbeat control (all closed-loop poles at the origin). Find the closed-loop state T
trajectory. Penyelesaian : Misalkan :
K k1 k2 Maka :
u10 Kx0 k1
8 120 k2 8k1 4k2 41 4
u Kx1 k1
412 41 k2 1060 88 412k1 1060k2 ...(2) 41
1 1
maka dari (1) dan (2) diperoleh Jadi,
...(1)
k1 0, 40259 dan k2 0,0734 .
K 0, 40259 0, 0734
4
c.
Let
J c 10 x 2T x 2 J a , with J a
as in part a. Solve the Riccatti equation to determine the optimal control
u 0 ,u1 .
Find the optimal cost. Penyelesaian:
J c 10 x 2T x 2
1 1 T 2 0 uk , uk 2 k 0 0 1
20 0 0 0 2 0 S2 ; Q ; R 0 20 0 0 0 1
berarti :
Persamaan Riccatti:
S k Q AT S k 1 I BR 1 B T S k 1
1
A AT S k 1 I BR 1 B T S k 1
1
A
Maka :
S 1 A T S 2 I BR 1 B T S 2 12 12
3 20 1 0
10 10 10 10
6 0 61 20 40
1
A
0 1 20 0
0 3 1 2
2 20 2 0
1
0 12 20 3
1 1
2
1
1 40 1 2 2 41 3 1 1 6 0 41 901 40 901 1 2 2 20 40 901 461 901 3 1
13585 901 5465 901
901
5465 2225
901
Kontrol Optimal :
u k R 1 B T S k 1 I BR 1 B T S k 1
1
Ax k
Maka:
u 0 R 1 B T S1 I BR 1 B T S1
1 1
1 13585 901 0 5465 901
8120 901 13585 901
3240
8120 901 13585 901
3240
1
Ax0
1 2225 901 0
5465
30726 901 16240 5465 901 901 901
797 3578 1160 5465 901 1789 3652012523 2,916 6,151 11005 1789 901
0 3 2 13585 901 1 2 2 5465 901
901
1
1 2 2225 901 3
5465
901
8 1 4 1
2
1
1 1 2 2 8 3 1 4 5579 901 11945 1 1 25046 2 2 8 15363 1 4 12523 3
11945
901
5
u1 R 1 B T S 2 I BR 1 B T S 2
1
Ax0 1
1 20 0 1 0 3 2 20 0 1 2 0 0 20 0 1 2 2 0 20 3 1 20 20 41901 40 901 1 2 2 8 0 40 901 461901 3 1 4 20 1 20 901 420 901 1 2 2 8 820 901 800 901 3 1 4 1 1
8 1 4 1
2
80400 36941 2,176 124880 3,380 36941
x1 Ax0 Bu0 1 2 3
8 2 1 36520 12523 2 15007512523 125029 12523 9,984 1 4 2 0 110051789 20 73040 12523 323500 12523 25,832 1
2
x 2 Ax1 Bu1 1 2 3
9,984 2 1 2,176 7,924 7,733 0,191 1 25,832 2 0 3,380 4,119 4,353 0,234 1
2
Optimal Cost
J c 10 x 2T x 2
1 1 T 2 0 uk uk 2 k 0 0 1
0,191 1 2 0 2,916 2 0 2,176 100,191 0,234 2,916 6,151 2,176 3,380 0,234 2 0 1 6,151 0 1 3,380 1 0,909 54,849 20,902 0,909 37,876 38,785 2
d.
Compare the state trajectories of parts a, b, and c. Penyelesaian :
Untuk fixed final state diperoleh:
412 8 0 41 x0 ; x1 1060 ; x2 4 0 41
Untuk free final state diperoleh :
8 9,984 0,191 x0 ; x1 ; x2 4 25,832 0, 234 Perbandingan trajectory untuk fixed dan free final state, dapat dilihat pada gambar berikut :
6
e. Now suppose
x0 1 2
T
. How must the controls of parts a, b, and c be modified?
Penyelesaian:
Bagian a : Kasus open loop control (fixed-final state) dengan
x 2 0 , x0 1 2
T
1 1 T 2 0 uk uk 2 k 0 0 1
Ja
, dan
maka analog dengan bagian a:
k 1
x k A k x0 A k i 1 BR 1 B T AT
1 i
i 0
1 1 T uk A 1 0
1 k
p2
p2
Sehingga :
1
x 2 A 2 x0 A1i BR 1 B T AT i 0
1
G0, 2 A1i BR 1 B T AT
1i
1i
p2
ABR 1 B T AT BR 1 B T
i 0
1 2 3
3 2 12 1 2 2 12 1 2
3 3 2 14 1 2 2 - 32
- 32 3 2 134 12 17 2 2 12 19
Maka :
38 1 p 2 G0,2 A 2 x0 x2 123 1 123
1 123 13 246
74 9 2
3 4 5 2
38 1 0 123 1 2 0 123
1 123 13 246
14 413 1 1 2 41
7
1 1 T 1 1 12 u0 A p 2 1 0 1 1 0 2
3 413 412 1 411 823
1 1 1 1 413 414 u1 p 2 1 0 1 3 1 0 41 41 Cek /simulasi :
1 x1 2 3
12 2 1 x u 0 2 0 0 3 1
1 2 1 412 12 8211 15 41 3 4 37 1 2 2 0 82 1 41 41
1 x2 2 3
12 2 1 x u 1 2 0 1 3 1
4111 0 15 2 1 414 11 41 41 3 8 8 1 37 2 0 41 41 41 0 41
1 2
1 2
1 2
1 2
Bagian c : Kasus closed loop control (free-final state) dengan
J c 10 x 2T x 2
1 1 T 2 0 uk , uk 2 k 0 0 1
maka analog dengan bagian a: Kontrol Optimal :
u k R 1 B T S k 1 I BR 1 B T S k 1
1
Ax k
Sehingga:
u 0 R 1 B T S1 I BR 1 B T S1
1 1
1 13585 901 0 5465 901
8120 901 13585 901
3240
901 13585 901
3240
30726 901 16240 5465 901 901 901
901
Ax0
1
1
1 2 2225 901 3
5465
901
1 1 2 1
2
1
1 1 2 2 1 5579 1 2 901 3 11945 1 1 25046 2 2 1 3 1 2 15363 12523
11945
797
u1 R 1 B T S 2 I BR 1 B T S 2
0 3 2 13585 901 1 2 2 5465 901
901
5465
1
1 2225 901 0
5465
3578 1160 901 1789 610 12523 0,048 265 7156 0,037 8120
901
>
Ax0
8
1 20 0 1 0 0 20 0
1 1
20 20 41901 40 901 1 2 0 40 901 461901 3 20 1 20 901 420 901 1 2 2 1 3 1 2 820 800 901 901 3580 0,097 36941 2620 0,071 36941
1 2 x1 Ax0 Bu0 3
1 2 x 2 Ax1 Bu1 3
2.3-1
1
0 3 2 20 0 1 2 1 2 2 0 20 3
1 1 2 1
2
1 1 2 1
2
1 2 1 61012523 1 2 6735 50092 18311 50092 0,365 1 2 2 0 265 7156 1 1220 12523 1130312523 0,903 1
2
18311 50092 2 1 3580 36941 384314312 9780 36941 0,00377 1 1130312523 2 0 2620 36941 972150092 7160 36941 0,00024 1
2
Digital Control of Harmonic Oscillator An harmonic oscillator is described by
x1 x 2 x 2 n2 x1 u a.
…(2.1)
Discretize the plant using a sampling period of T. Penyelesaian: Sistem (2.1) dapat ditulis :
x (t ) Ax(t ) Bu (t ) dimana :
0 A 2 n
1 0 dan B 0 1
Diskritisasi dari sistem diatas dengan periode sampling T adalah:
x k 1 A s x k B s u k dimana :
A e s
AT
A nT n I n! n 1
9
1 1 0 0 1 n2 T 2! 2 0 1 n 0 0 1 1 2 4 A11s 1 nT nT 2! 4! 1 1 A12s T n2T 3 n4T 5 3! 5!
0 2 10 T 4 3! n n2
n2 3 1 n4 T 4! 0 0
0 4 1 0 T 5! n6 n4
n4 5 T 0
cos nT
sin nT n
n sin nT
1 4 3 1 6 5 n T n T 3! 5! 1 1 2 4 A22s 1 nT nT 2! 4! A21s n2T
cos nT
Jadi,
sin nT cos nT A n n sin nT cos nT s
sin n 0 cos n B e Bd n d 1 0 0 sin cos n n n T
T
A
s
cos n T sin n n2 d n sin n 0 cos n n
1 cos nT n2 sin nT n
T
0
Dengan demikian, diperoleh suatu sistem diskrit:
x k 1
b.
1 cos nT sin nT cos nT n2 x u k sin nT k sin T cos T n n
…(2.2)
With the discretized plant, associate a performance index of
J
1 1 N 1 s1 ( x 1N ) 2 s 2 ( x N2 ) 2 q1 ( x1k ) 2 q 2 ( x k2 ) 2 ru k2 2 2 k 0
where the state is
x k x 1k
x k2
. Write scalar equations for a digital optimal controller. T
Penyelesaian: Diketahui sistem :
x k 1 Ax k Bu k
10
dimana :
dan
1 cos nT sin nT cos nT n2 A ; B n sin nT n sin n T cos nT n
J
1 T s1 xN 2 0
Oleh karena
Sk
s S a sb
sb sc
B T S k 1 B R
0 1 1 T q1 x x s 2 N 2 k 0 k 0
0 x ru k2 q 2 k
simetri untuk setiap k, maka misalkan :
1 cos nT 1 cos nT sin nT s a s b n2 r n s b s c sin nT n2 n 1 cos nT s a sin nT s b 1 cos nT s b sin nT s c 1 cos nT 2 n n n2 2 n n maka:
K k k1
k 2 B T S k 1 A /
1 1 cos nT n2
sin nT s a n s b
sin nT r
sin nT sb cos nT n sc n sin nT cos nT
1 1 cos nT s a sin nT s b n n2
1 cos nT s b sin nT s c cos nT n n2
n sin nT
1 cos nT s a sin nT sb n n2 1 k2 n
sin nT 1 cos nT s b sin nT s c n n2
cos nT
k1
Matriks plant closed-loop adalah:
11
1 cos nT k1 cos nT n2 Akcl A BK k sin T sin nT k1 n n n
Misalkan
a11cl A cl a 21 cl k
sin nT 1 cos nT k 2 n n2 sin nT k 2 cos nT n
a12cl , maka diperoleh persamaan-persamaan skalar: cl a 22
a11cl cos nT
1 cos nT k1 ; n2
cl a 21 n sin nT
sin nT k1 ; n
a12cl
sin nT 1 cos nT k 2 ; n n2
cl a 22 cos nT
sin nT k 2 n
Selanjutnya,
s S k AT S k 1 Akcl Q a sb
sb s c
sehingga diperoleh : cl s a cos nT s a n sin nT s b a11cl cos nT s b n sin nT s c a 21 q1 cl sb cos nT s a n sin nT s b a12cl cos nT s b n sin nT s c a 22
sin nT s a sin nT sb cl cos nT sb a11cl cos n T s c a 21 n n sin nT s a sin nT s b cl s c cos nT s b a12cl cos nT s c a 22 q2 n n Optimal kontrol diberikan oleh persamaan :
u k K k xk c.
Write a MATLAB subroutine to simulate the plant dynamics, and use the time response program lsim.m to obtain zero-input state trajectories.
d.
Write a MATLAB subroutine to compute, store the optimal control gains, and to update the control
uk
given the current
state . Write a MATLAB driver program to obtain tim response plots for the optimal controller.
Penyelesaian:
% Program Digital Control of Harmonic Oscillator T = 0:.05:5; U = zeros(1,101); A=[0 1;w^2 0]; b = [0;1] ; c= eye(2); d= zeros(2,1); ic = [10 10];
12
lsim(A,b,c,dU,T,ic); axis( [0 5 0 60] );
Function u=m(A_d,b_d,q,r,s,N,T,x0,C,S) % Iterasi untuk Cost Kernl dan Feedback Gains For k=N:-:1 C=cos(w*T); S= sin(w*T); w2=w^2; Div=r + (((1-C1*s(1))/w2 + S*s(2)/w)*(1-C)/w2) + ((1-C1*s(2))/w2 + S*s(3)/w)*S/w)) ;
% Feedback Gains K(k,1) = (((1-C1*s(1))/w2 + S*s(2)/w)*C - ((1-C1*s(2))/w2 + S*s(3)/w)*w*S)/div; K(k,2) = (((1-C1*s(1))/w2 + S*s(2)/w)*S/w) +((1-C1*s(2))/w2 + S*s(3)/w)*C)/div;
% Closed loop Plant Matrix Acl(1,1) = C-(1-C*K(k,1)/w2); Acl(1,2) = S/w-(1-C*K(k,2)/w2); Acl(2,1) = -w*S-(S*K(k,1))/w; Acl(2,2) = C-(S*K(k,2))/w;
% Cost Kernel Update s(3) = (S*s(1)/w + C*s(2))*Acl(1,2)+ (S*s(2)/w+C*s(3))*Acl(2,2)+q(2); temp=s(2); s(2) = (C*s(1)-w*S*temp)*Acl(1,2) + (C*temp-w*S*s(3))*Acl(2,2); s(1) = (C*s(1)-w*S*temp)*Acl(1,1) + (C*temp-w*S*s(3))*Acl(2,1)+q(1);
% Optimal Control x(:,1)=x0 for k=1:N % Menghitung Optimal Control U(k) = -K(k,:)*x(:, k); % Plant State x(:, k+1) = A_d* x(:, k) + b_d*u(k); end
13
2.4-1
Steady-State Behavior. In this problem we consider a rather unrealistic discrete system because it is simple enough to allow an analytic treatment. Thus, let the plant
0 1 0 x k 1 x k u k 0 0 1
…(3.1)
have performance index of
J0
1 T 1 N 1 q1 x N x N x kT 2 2 k 0 q 2
Find the optimal steady-state (i.e., N
a.
steady-state gain
K
q2 2 x ru k k q3
) Riccatti solution
...(3.2)
S and show that it is positive definite. Find the optimal
and determine when it is nonzero.
Penyelesaian:
Diketahui plant :
0 1 A ; 0 0
dengan
Jika
N
J
dengan
x k 1 Ax k Bu k ,
maka
0 B 1
x 0 , sehingga index performansi dapat dimodifikasi menjadi:
1 T x k Qx k ru k2 2 k 0
q Q 1 q 2
q2 q3
Persamaan Riccatti :
1
S k AT S k 1 S k 1 B BT S k 1 B R BT S k 1 A Q Oleh karena
Misalkan
N dan misalkan S k
s S 1 s2
s2 , maka : s 3
1
konvergen, maka
S S k S k 1 .
S AT S SB BT SB R BT S A Q
14
0 0 s1 S 1 0 s 2 0 0 s1 1 0 s 2 0 0 s1 1 0 s 2
s2 s2 s 1 r s 3 0 1 1 s 3 s3 s2
0 0 s1 1 0 s 2
s2 2 s 2 r s3 s 3 s 2 s 3 r s3
q1 q 2
q1 S q 2
Karena
s 2 s 2 s 0 1 1 s 3 s3 s 2
s 2 0 r s3 1
s 2 0 r s 3 1
1
s q1 s1 2 r s 3
s S 1 s2
s2 , berarti : s 3
0 1
s 0 1 1 s2
s 2 s3 r s 3 0 1 q1 2 s 3 0 0 q 2 r s 3
1
s1 s2
s 2 0 1 q1 s3 0 0 q 2
s 2 0 1 q1 s3 0 0 q 2
s 2 0 1 q1 s 3 0 0 q 2
2 s s s2 s1 s2 2 3 0 r s3 r s 3 0 1 q1 2 0 s 2 s3 s 3 0 0 q 2 s3 s 2 r s3 r s3 q2 2 s q1 s1 2 r s 3
0 1
Jadi,
s 2 0 s 0 1 1 s 3 1 s2
s 2 s1 s 3 s 2
q2 q 3
q2 q 3
q2 q3
q2 q3
q2 q 3
q2
2
…(3.3)
s1 q1 s2 q2 2
s3 q1 s1
s2 2 s3 r s 3 2q1 r s3 q 2 r s3 s3 r 2q1 s3 q 2 2q1r 0 2
s3 s3
2
2q1 r r 2q1 2 4q 2 2 2q1r 2
2q1 r
r 2 4 q1 q 2 4q1 r 2
2
2
15
Oleh karena:
r0
Q adalah matriks definit positif, berarti
Dengan demikian,
det( S ) q1 q 2 2
2
q1 0 , dan det(Q) q1 q 2
2
2
0.
r 2 4 q1 q 2 4q1 r qr 1 0 2 2 2
2
Jadi S adalah matriks definit positif.
K K k B T SB R
1
B T SA
1 s1 0 1 s 2 r s3 0 Berarti
b.
s 2 0 1 s 3 0 0
s2 r s3
K 0
jika
s2 0 , yaitu jika s 2 0 . r s3
Find the optimal steady-state closed-loop plant and demonstrate its stability. Penyelesaian: Misal
Acl
adalah steady-state closed loop plant matrix, maka:
0 1 0 A A BK 0 0 0 1
cl
x k 1
c.
0 s 2 0 1 r s 3 0 0 0
0 0 1 s2 s 0 2 r s3 r s3
1 0 A BK x k 0 s 2 x k r s 3
Now the suboptimal constant feedback
u k K x k is applied to the plant. Find scalar updates for the components of the suboptimal cost kernel steady-state cost kernel
S
and demonstrate that
S k . Find the suboptimal
S = S .
16
Penyelesaian:
Misalkan :
K k k1
k2 ,
maka matriks plant closed-loop adalah:
0 1 0 Akcl A BK k k1 0 0 1
Misalkan
A
cl k
a 11cl cl a 21
a 12cl cl a 22
a11cl 0;
a12cl 1;
cl a 21 k1
cl a 22 k 2
0 1 0 k2 0 0 k1
0 0 k 2 k1
1 k 2
, maka diperoleh persamaan-persamaan skalar:
Updated cost kernel adalah:
Sk AT SAkcl Q 0 0 0 s1 s2 a11cl a12cl q1 q2 cl cl cl cl 1 0 s2 s3 a21 a22 q2 q2 s1a11 s2 a21 q1 q2 cl cl cl cl q2 s1a11 s2 a21 q1 s1a12 s2 a22 q1 cl cl q2 q1a11 s2 a21
Misalkan
S
q1 s a s a q2 0
cl 1 12
cl 2 22
q2 q1
q1 q a s a q2
cl 1 12
cl 2 22
adalah sub-optimal steady state cost kernel maka :
S AT SAcl Q 0 0 s1 1 0 s2
Dari persamaan (3.3),
Berati
0 1 0 0 s2 q q q 1 2 2 1 s s 2 2 q q2 0 s1 s3 0 q2 r s3 2 r s3 q2 q1 2 s S q 2 q1 s1 2 r s 3
q1 q2 q2 q2
s q1 s1 2 r s3 q2
2
S S
17