Anda di halaman 1dari 31

NON - LINEAR CONTROL SYSTEM

WAHYU RAHMANIAR
102521604

Magnetic Levitation System

A magnetic ball suspension systems is a nonlinear inherently unstable system. The


position of the steel ball controlled by current in the electromagnet through the input
voltage.

Mathematical Model of the Magnetic Levitation System


= () (, )
With:
F = ma
F(g) = mg
Where:
F = Resultant force moving the ball
F(g) = Gravitational force
m= Mass of the ball
g = Gravitational acceleration
h = distance between the ball and the winding (ball position)

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

The total inductance is a nonlinear function of the position of the ball:


= +

Lc = Constant
Le = Additional inductance in the equilibrium point
he = Equilibrium point of the ball

Derivation of the State Space Model


x1 = h = position of the ball
x2 = dh/dt = velocity of the ball
x3 = I = inductor current
The vector format of the dynamics of the system is:
2
0
32
1

0
[2] =
12 + [1] , (0) = 0

[ 3 ]
= [1 2

3] = [1 0 0][1 2

2]

In shorter the equation can be expressed by the standard nonlinear model:


= () + ()
= ()
Where f(x), g(x) and h(x) are nonlinear functions of the state vector.

Linearization of the Magnetic Levitation System at Equilibrium


The linearization of the nonlinear model of the magnetic levitation system is done
around its equilibrium point.

At equilibrium:
= 1 =
1
=0

= 1

2 =
3

The linearized state space representation of the system is:


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

Parameter of the System


= 8.27 103
= 9.81 1
= 0.0001
= 0.01[]
= 0.84[]
1 = 0.012[]
The state space representation of the systems becomes:
0
1
[2] = [9875
0
3

1
0
0

0
1
0
141.1] [2] + [ 0 ] , (0) = 0
100 3
100
= [1 0

1
0] [2]
3

The transformation of the representation of the system to transfer function is:


() =

()
= ( )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)

The system is of third order so we have three poles and no zeros.

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)

Fig 1. Pole Zero Map

Simulink Block Diagram


Initial position (xe1) = 0.012.
% Magnetic levitation system parameters for nonlinear simulation
clear
clc
g=9.81 % Gravitational force
k=0.0001
m=8.27*10^-3 % Mass of the ball
R=1 % Internal resistance of the inductor
L=0.01 % Inductance
i=0.84, % input current
x=0.012, % position of the ball at equilibrium point
yo=[0.001 0 0]
i0=x*(m*g/k)^0.5, % Current at equilibrium point
% State space representation of the magnetic levitation system
A=[0 1 0;(2*k/m)*(i^2/x^3) 0 -(2*k/m)*(i/x^2);0 0 -R/L], % State
Matrix A
B=[0;0;1/L], % Control Matrix B
C=[1 0 0], % Output Matrix C
D= 0, % Matrix D

Fig 2. Simulink Diagram of Nonlinear State Space Model

Fig 3. Nonlinear State Space Result

Fig 4. Simulink Diagram of Linear Model System

Fig 5. Linear Model Result

Analysis of the result:


The linear model is a good approximation of the plant behaviour only around the
none stable equilibrium point xe1 = 0.012[m]. And the plant is not under control
and set continuous force is applied, the magnetic levitation system is moving far
from the point xe1 = 0.012[m].
The position state response of the magnetic levitation nonlinear model shows that
under step continuous force, the ball position moves toward infinity.
This analysis confirms that that the magnetic ball levitation is a nonlinear open
loop unstable system that needs to be controlled effectively.

Pole Placement Method


Closed loop system:
= +
=
= +

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

characteristic equation () = [ ( )] = 0 at desired places under the


restriction that the complex poles have to be complex conjugates.

Fig 6. Close-Loop System Block Diagram

Controllability of the System


Check if the system is completely state controllable:
= [

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

The rank of the matrix M is 3 therefore it is controllable.

Poles Selection
Settling time < 0.67 seconds
Overshoot < 1.5%

Damping ratio:
=

%
( 100 )

%
2 ( 100 )

1.5
(100)

1.5
2 (100)

= 0.8

The phase angle of the pole is:


= 1 = 1 0.8 = 36.8

The real and imaginary values of poles are:


() = =

4
4
=
= 5.97

0.67

() = () tan() = 5.97 36.8 = 4.47


Poles selected:
1 = () + () = 5.97 + 4.47
2 = 5.97 4.47
P3 choose based on experiment P3 = 50.

Calculation of the Controller Parameter


= ( ) +
H = [1

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)

() = 3 + (100 + 1003) 2 (9875 + 141.1102 2)


(987500 + 9875003 + 141.1102 1)
() = ( + 5.97 4.47)( + 5.97 + 4.47)( + 50)
= 3 + 61.94 2 + 652.62 + 5781
h1, h2 and h3 can be found by identification:
61.94 = 100 + 100h3
= .
652.62 = (9875 + 141.1x102 2)
= .
2781 = (987500 + 987500h3 + 141.1x102 1)
= .
The full state feedback control gain based on pole placement is:
H = [43.52 0.75

0.381]

Pole Placement Simulation


Matlab code:
% Magnetic levitation system parameters for Pole Placement simulation
clear
clc
g=9.81 % Gravitational force
k=0.0001
m=8.27*10^-3 % Mass of the ball
R=1 % Internal resistance of the inductor
L=0.01 % Inductor Value
i=0.84, % input current
x=0.012, % position of the ball at linearization point
i0=x*(m*g/k)^0.5
% ============State space representation of the magnetic levitation
system
A=[0 1 0;(2*k/m)*(i^2/x^3) 0 -(2*k/m)*(i/x^2);0 0 -R/L], % State
Matrix A
B=[0;0;1/L], % Control Matrix B
C=[1 0 0], % Output Matrix C
D= 0, % Matrix D
% ============Controllability of the system
Cl=ctrb(A,B)
Rank_Cl=rank(Cl)
p1=-5.97+4.47i;
p2=-5.97-4.47i;
p3=-50;
K= place(A,B,[p1 p2 p3])
K1=K(1)
K2=K(2)
K3=K(3)
sys_cl=ss(A-B*K,B,C,0)
step(sys_cl)
%====================================================================

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 7. Pole Placement Result

Simulink Diagram of the Pole Placement Method

Fig 8. Simulink diagram of the closed-loop magnetic levitation system

Set point: 0.15


Initial conditions: [0.09; 0; 2.56]

Fig 9. Control signal response with initial conditions of [0.09; 0; 2.56]

Fig 10. Position response with initials conditions of [0.09; 0; 2.56]

Fig 11. Velocity response with initials conditions of [0.09; 0; 2.56]

Fig 12. Current response with initials conditions of [0.09; 0; 2.56]

Set point: 0.15


Initial conditions: [0.035; 0; 0.89]

Fig 13. Control signal response with initial conditions of [0.035; 0; 0.89]

Fig 14. Position response with initial conditions of [0.035; 0; 0.89]

Fig 15. Velocity response with initial conditions of [0.035; 0; 0.89]

Fig 16. Current response with initial conditions of [0.035; 0; 0.89]

Input State Linearization


Nonlinear model of the magnetic levitation model:
2
0
32
1

0
[2] =
12 + [1] , (0) = 0

[ 3 ]
= [1 2

3] = [1 0 0][1 2

2]

First derivation of the output:


y = 1
y = L h(x) + L ()
L h(x) = 2
L () = 0.
y = 2
The first differentiation shows that there is no straightforward relationship between
the input and the output.

Second derivation of the output:


y = 2
y = 2 h(x) + L L ()
2 h(x) =

3 2
( )
1

L L () = 0.
y=

3 2
( )
1

A third differentiation is required as the input and output are not directly related.

Third derivation of the output:


y=

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 ()

Linear Quadratic Regulator Design for the Linearized Model


The first step is to check the controllability and observability of the Bruvonsky model:
-

Controllability:
rankC = rank[

2 ] = 3, where C is the controllability matrix.

Observability:
rankO = rank[

2 ] = 3, where O is the observability matrix.

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

Fig 17.Input State Linearization Block Diagram

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 18. Simulink Diagram of the Input State Linearization

Fig 19. Simulink block diagram of the linear state feedback integral controller

Fig 20. Nonlinear linearizing controller structure

Fig 21. Input-state transformation function

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 calculation of the nonlinear linearization controller u is done by some


transformations of the expression for N:

The expressions from both sides of the equation are scalars, which depend on time.

Fig 26. Block Diagram of Lyapunov Closed-loop System

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')
%====================================================================
%====================================================================

% Design linear-quadratic (LQ) state-feedback regulator for statespace


% systems
% Where Q is a positive-definite Hermitian or real symmetric matirx
and R
% is a positive definite Hermitian or real symmetric matrix.
Q = [ 100000 0 0;
0 650 0;
0 0 90]
R=1;
[Khat, Shat,Ehat]= lqr (A_d_hat, B_d_hat, Q, R)
K1_integral=Khat(1)
K2_integral=Khat(2)
K3_integral=Khat(3)
%====================================================================
% Lyapunov matrix
% set the positive definite matrix Q1
Q1 = [1 0; 0 1]
% By using Q to calculate P, where -Q1 = A'P+PA
%syms P2
A_transp=A_l';
P2 = -Q1 /(A_transp + A_l)
P21=lyap(A_l',Q1)
EigenValues_P21=eig(P21)
EigenValues_P2=eig(P2)
% Check P2 whether positive definite
[R_P2,P_P2] = chol(P2)
[R_Q1,P_Q1] = chol(Q1)
% If X is not positive definite, an error message is printed
% Both P2 and Q1 are positive definite

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 =

Continuous-time state-space model.


Cl =
0
1

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 =

Continuous-time state-space model.


Wc =
0.0833
0.0000

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

Simulink block diagram:

Fig 27. Simulink diagram of the Lyapunov direct method

Fig 28. Simulink block diagram of the linear integral controller

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 30. Linear control signal

Fig 31. Errors between the reference model and the plant states

Fig 32. Nonlinear linearizing control signal

Fig 33. Position of the ball

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

Implementation in Distributed Systems, Cape Peninsula University of Technology,


June 2014.

Anda mungkin juga menyukai