WAHYU RAHMANIAR
102521604
The force created by the winding defined as f(h,i) is a function of the air gap or
distance between the winding and the ball.
(, ) =
2 ()
2
Lc = Constant
Le = Additional inductance in the equilibrium point
he = Equilibrium point of the ball
0
[2] =
12 + [1] , (0) = 0
[ 3 ]
= [1 2
3] = [1 0 0][1 2
2]
At equilibrium:
= 1 =
1
=0
= 1
2 =
3
0
1
2 32
(
) 0
12
[
0
0
2 3
( 2 ) 1
0
1 [2] + [1] , (0) = 0
3
1
[
]
= 1 0 0 [2]
3
1
0
0
0
1
0
141.1] [2] + [ 0 ] , (0) = 0
100 3
100
= [1 0
1
0] [2]
3
()
= ( )1 +
()
Where D = 0 in the considered case, b(s) and a(s) are the polynomial in the numerator
and denominator of transfer function.
0 0
= [0 0]
0 0
() =
1.411 104
( 99.37)( + 99.37)( + 100)
Two poles are located on the left hand side and one is located on the right hand side of
the complex plane which means that the system is highly unstable.
P1 = -100
P2 = -99.37
P3 = 99.37 (make the system unstable)
Then, u is substituted:
= ( ) +
=
The matrix H changes the states matrix of the closed loop system. If the plant is
completely controllable the matrix H gives the possibility to place the poles of the
2 ]
0
1
0
0
0
= [9875 0 141.1] [ 0 ] = [14110]
0
0 100
100
10000
0
14110
9875
0
141.1
2 = [ 0
9875 14110 ] [ 0 ] = [14.11105 ]
100
106
0
0
104
The controllability matrix is:
0
= [ 0
100
0
14110
10000
14110
14.11105 ]
106
Poles Selection
Settling time < 0.67 seconds
Overshoot < 1.5%
Damping ratio:
=
%
( 100 )
%
2 ( 100 )
1.5
(100)
1.5
2 (100)
= 0.8
4
4
=
= 5.97
0.67
3]
() = | + |
0 0
0
1
0
0
() = [0 0] [9875 0 141.1] + [ 0 ] [1 2 3]
0 0
0
0 100
100
1
0
0
0
0
141.1 ] + [ 0
() = [9875
0
0 ]
0
0 ( + 100)
1001 1002 1003
() = [9875
1001
1002
0
141.1
]
( + 100 + 1003)
0.381]
Result:
A =
1.0e+003 *
0
9.8751
0
0.0010
0
0
0
-0.1411
-0.1000
B =
0
0
100
C =
1
D =
0
Cl =
1.0e+006 *
0
0
0.0001
0
-0.0141
-0.0100
-0.0141
1.4107
1.0000
Rank_Cl =
3
K =
-43.5551
-0.7463
-0.3806
K1 =
-43.5551
K2 =
-0.7463
K3 =
-0.3806
a =
x1
0
9875
4356
x1
x2
x3
x2
1
0
74.63
x3
0
-141.1
-61.94
b =
x1
x2
x3
u1
0
0
100
y1
x1
1
y1
u1
0
c =
x2
0
x3
0
d =
Fig 13. Control signal response with initial conditions of [0.035; 0; 0.89]
0
[2] =
12 + [1] , (0) = 0
[ 3 ]
= [1 2
3] = [1 0 0][1 2
2]
3 2
( )
1
L L () = 0.
y=
3 2
( )
1
A third differentiation is required as the input and output are not directly related.
3 2
( ) + 0.
1
y = 3 h(x) + L 2 ()
2
3 h(x)
2 2 3 2
2 3 2
=
(
) +
( )
1 3
1 2
L 2 () =
2 3
( )
1 2
2 2 3 2
2 3 2
2 3
y=
( 3 ) +
( 2)
( )
1
1
1 2
The third differentiation shows a direct relationship between the input and output, at
the same time the systems relative degree is 3, because the output has to be
differentiated three times to find its relationship with the input.
2
3 2
( )
1
1
[2] = [ ]
2
2 2 3 2
2 3 2
2 3
3
( 3 ) +
( 2)
( )
1
1 2 ]
[ 1
The last derivative is the new input to the linear system and can be rewritten as:
= =
Where A is a 3x3 matrix and b is a 3x1 vector.
2
0
= [3] = [0
1 0 1
0
0 1] [2] + [0]
0 0 3
1
v = 3 h(x) + L 2 ()
2 2 3 2
2 3 2
(
)
+
3
h(x) +
1 3
(1 2 )
u=
=
= () + ()
2 3
L 2 ()
(1 2 )
where
(x) =
(x) =
3 h(x)
L 2 ()
1
L 2 ()
Controllability:
rankC = rank[
Observability:
rankO = rank[
The model of the extended system needed for design of the integral optimal control is:
1
0 1
2
[ ] = [0 0
0 0
2
0 1
0
1
0
0
0 1
0 ] [2] +
0 3
0
0
[0] = +
1
0
=
= y = z1 = z2
Matlab code:
% Magnetic levitation system parameters for simulation of the
linearized by input-state nonlinear controller closed loop system
clear
clc
g=9.81 % Gravitational force
k=0.0001
m=8.27*10^-3 % Masse of the ball
R=1 % Internal resistance of the inductor
L=0.01 % Inductor Value was 0.01
i=0.84, % input current
x=0.09, % position of the ball at linearization point
% State space representation of the Brunovsky reference system
A=[0 1 0;0 0 1;0 0 0], % State Matrix A
B=[0;0;1], % Control Matrix B
C=[1 0 0], % Output Matrix C
D= 0, % Matrix D
poles=eig(A)
%====================================================================
% Controllability of the system
Cl=ctrb(A,B)
Rank_Cl=rank(Cl)
% Design of the linear-quadratic(LQ) state-feedback regulator by
using the
% function lqr in matlab
% The Q matrix is selected as positive definite and R is positive
definite
% Real symetric matrix
Q=[100 0 0;0 1 0;0 0 1]
R=0.1
[K, P, E]=lqr(A,B,Q,R), % feedback control gain
K1=K(1)
K2=K(2)
K3=K(3)
A_opt= A-B*K
%====================================================================
% Augmented matrices
% Design of an integral controller for the reference model using lqr
method
A_integral=[0 1 0 0;0 0 1 0;0 0 0 0;-1 0 0 0]
B_integral=[0;0;1;0]
C_integral=[1 0 0 0]
D_integral=0
%====================================================================
% Controllability of the augmented system
Cil=ctrb(A_integral,B_integral)
Rank_Cil=rank(Cil)
Q_integral=[10000000 0 0 0;0 2500 0 0;0 0 500 0;0 0 0 10]
R_integral=1
[K_integral, P_integral,
E_integral]=lqr(A_integral,B_integral,Q_integral,R_integral), %
feedback control gain
K1_integral=K_integral(1)
K2_integral=K_integral(2)
K3_integral=K_integral(3)
K4_integral=K_integral(4)
A_opt_integral= A_integral-B_integral*K_integral
Result:
poles =
0
0
0
Cl =
0
0
1
0
1
0
1
0
0
0
1
0
0
0
1
Rank_Cl =
3
Q =
100
0
0
R =
0.1000
K =
31.6228
21.7368
7.3126
68.7377
23.1243
3.1623
23.1243
12.7329
2.1737
3.1623
2.1737
0.7313
P =
E =
-3.7727
-1.7699 + 2.2911i
-1.7699 - 2.2911i
K1 =
31.6228
K2 =
21.7368
K3 =
7.3126
A_opt =
0
0
-31.6228
A_integral
0
0
0
-1
1.0000
0
-21.7368
=
1
0
0
0
B_integral =
0
0
1
0
0
1
0
0
0
1.0000
-7.3126
0
0
0
0
C_integral =
1
0
1
0
0
0
0
0
0
-1
D_integral =
0
Cil =
0
0
1
0
0
1
0
0
Rank_Cil =
4
Q_integral =
10000000
0
0
0
0
2500
0
0
0
0
500
0
R_integral =
1
K_integral =
1.0e+003 *
3.1628
0.4970
0.0387
-0.0032
0.1222
0.0160
0.0005
-0.0001
0.0032
0.0005
0.0000
-0.0000
-0.0016
-0.0001
-0.0000
0.0100
0
0.0010
-0.0387
0
0
0
0.0032
0
P_integral =
1.0e+006 *
1.5717
0.1222
0.0032
-0.0016
E_integral =
-23.0388
-7.8060 + 8.7365i
-7.8060 - 8.7365i
-0.0010
K1_integral =
3.1628e+003
K2_integral =
496.9779
K3_integral =
38.6517
K4_integral =
-3.1623
A_opt_integral =
1.0e+003 *
0
0.0010
0
0
-3.1628
-0.4970
-0.0010
0
0
0
0
10
Fig 19. Simulink block diagram of the linear state feedback integral controller
Result:
Initial conditions: [0.2; 0; 0.894; 0]
Set point: 0.55
Fig 22. Linear control signal when the set point is at 0.55
Fig 23. Error signal between the set point and the nonlinear plant output when the set
point is 0.55
Fig 24. Velocity of the ball when the set point is 0.55
Fig 25. Nonlinear linearizing control signal when the set point is 0.55
Conclusion:
The system is stable.
There is no time delay.
The errors signals go to zero.
The plant output always follows the reference model and the set points trajectories.
All the states of the system are stabilized.
Lyapunov Theory
Calculation of the first derivative of the Lyapunov function:
The expressions from both sides of the equation are scalars, which depend on time.
Matlab code:
% Magnetic levitation system parameters for simulation of the
linearized by Lyapunov and MRC based nonlinear controller
clear
clc
g=9.81 % Gravitational force
m=0.12% Masse of the ball
a=0.95 % Internal resistance of the inductor
b=6.28 % Inductor Value was 0.01
c=0.15, % input current
x=0.05, % position of the ball at linearization point was 0.012
Gain=1
% State space representation of the magnetic levitation system
A_l=[0 1;-2 -3], % State Matrix A
B_l=[0;1], % Control Matrix B
C_l=[1 0], % Output Matrix C
D_l= 0, % Matrix D
A_Eigen=eig(A_l)
% Form the linear model
sys_l = ss(A_l,B_l,C_l,D_l)
Cl=ctrb(A_l,B_l)
R_l = rank(Cl)
%====================================================================
% Design the linear-quadratic (LQ) state-feedback regulator by using
% function lqr for the linear model in oder to find the closed-loop
poles
% Where Q is a positive-definite Hermitian or real symmetric matirx
and R
% is a positive definite Hermitian or real symmetric matrix.
Q = [ 530 0;
0 8]
R=1;
[K_l_hat, S_l_hat,E_l_hat]= lqr (A_l, B_l, Q, R)
%====================================================================
%====================================================================
% Form the desired model matrix A
% 4 by 4 matrix
A_d_n = A_l
EigenVal=eig(A_d_n)
%====================================================================
% Formation of a matrix A for closed-loop system
A_d_hat = [A_d_n zeros(2,1); -C_l 0]
% Calculation and formation of matrix B
B_d_hat = [B_l ; 0]
% Formation of a matrix C D
C_d = [1 0 0] % from C it can be seen that y = x + length*theta
D_d = 0
% Compute the controllability matrix
Co=ctrb(A_d_hat,B_d_hat)
% The system is controllable if Co has full rank n
% Check the rank of Co in order to find if the syste mis controllable
R_sys_d = rank(Co) % R_sys_d = 4 proves the system is controllable
% Form the desired system
sys_d = ss (A_d_n,B_l,C_l,D_l)
% Compute controllability and observability grammians
Wc = gram(sys_d,'c')
Wo = gram(sys_d,'o')
%====================================================================
%====================================================================
Result:
A_Eigen =
-1
-2
a =
x1
x2
x1
0
-2
x1
x2
u1
0
1
y1
x1
1
y1
u1
0
x2
1
-3
b =
c =
x2
0
d =
1
-3
R_l =
2
Q =
530
0
0
8
K_l_hat =
21.1084
4.6953
S_l_hat =
171.8252
21.1084
21.1084
4.6953
E_l_hat =
-3.8476 + 2.8817i
-3.8476 - 2.8817i
A_d_n =
0
-2
1
-3
EigenVal =
-1
-2
A_d_hat =
0
1
-2
-3
-1
0
0
0
0
B_d_hat =
0
1
0
C_d =
1
1
-3
0
-3
7
-1
D_d =
0
Co =
0
1
0
R_sys_d =
3
a =
x1
x2
x1
0
-2
x1
x2
u1
0
1
b =
x2
1
-3
c =
y1
x1
1
y1
u1
0
x2
0
d =
0.0000
0.1667
0.9167
0.2500
0.2500
0.0833
Wo =
Q =
100000
0
0
Khat =
315.3096
0
650
0
32.9113
-9.4868
Shat =
1.0e+004 *
1.1380
0.0315
0.0315
0.0033
-0.0341
-0.0009
-0.0341
-0.0009
0.3010
Ehat =
-20.3141
-15.5672
-0.0300
K1_integral =
315.3096
K2_integral =
32.9113
K3_integral =
-9.4868
Q1 =
1
0
0
1
-6
1
1
0
P2 =
P21 =
1.2500
0.2500
0.2500
0.2500
EigenValues_P21 =
0.1910
1.3090
0
0
90
EigenValues_P2 =
-6.1623
0.1623
R_P2 =
[]
P_P2 =
1
R_Q1 =
1
0
0
1
P_Q1 =
0
Fig 29. Simulink block diagram of the nonlinear linearizing controller on the basis of
Lyapunov second method
Result:
Initial conditions: [0.05; 0; 0]
Set point: 0
Fig 31. Errors between the reference model and the plant states
Conclusions:
The system is stable.
The errors signals go to zero.
The plant output always follows the reference model and the set points trajectories.
All the states of the system are stabilized.
REFERENCES
Mfoumboulou,
Y.C,
Development
of
Nonlinear
Control
Algorithms
for