BudimanAzzaliBasirMFKE2007TTT

i
CONTROL OF CART-BALL SYSTEM USING STATE FEEDBACK
AND FUZZY LOGIC CONTROLLER
BUDIMAN AZZALI BIN BASIR
A project report submitted in partial fulfillment of the
requirements for the award of the degree of
Masters of Engineering (Electrical-Mechatronic & Automatic Control)
Faculty of Electrical Engineering
Universiti Teknologi Malaysia
MAY 2007
PSZ 19:16 (Pind. 1/97)
UNIVERSITI TEKNOLOGI MALAYSIA
BORANG PENGESAHAN STATUS TESIS υ
JUDUL: CONTROL OF CART-BALL SYSTEM USING STATE FEEDBACK
AND FUZZY LOGIC CONTROLLER
SESI PENGAJIAN:
Saya
2006/2007
BUDIMAN AZZALI BIN BASIR
(HURUF BESAR)
mengaku membenarkan tesis (PSM/Sarjana/Doktor Falsafah)* ini disimpan di Perpustakaan
Universiti Teknologi Malaysia dengan syarat-syarat kegunaan seperti berikut:
1.
2.
3.
4.
Tesis adalah hakmilik Universiti Teknologi Malaysia.
Perpustakaan Universiti Teknologi Malaysia dibenarkan membuat salinan untuk
tujuan pengajian sahaja.
Perpustakaan dibenarkan membuat salinan tesis ini sabagai pertukaran antara institusi
pengajian tinggi.
**Sila tandakan ( )
SULIT
(Mengandungi maklumat yang berdarjah keselamatan atau
kepentingan Malaysia seperti yang termaktub di dalam
(AKTA RAHSIA RASMI 1972)
TERHAD
(Mengandungi maklumat TERHAD yang telah ditentukan
oleh organisasi/badan di mana penyelidikan dijalankan)
TIDAK TERHAD
Disahkan oleh
(TANDATANGAN PENULIS)
(TANDATANGAN PENYELIA)
Alamat tetap:
1128 KAMPUNG TELUK
SUNGAI DUA
13800 BUTTERWORTH
PULAU PINANG
Nama Penyelia:
PM. DR. MOHAMAD NOH B. AHMAD
Tarikh: 10 MEI 2007
Tarikh: 10 MEI 2007
CATATAN:
* Potong yang tidak berkenaan.
** Jika tesis ini SULIT atau TERHAD, sila lampirkan surat daripada pihak
berkuasa/organisasi berkenaan dengan menyatakan sekali sebab dan
tempoh tesis ini perlu dikelaskan sebagai SULIT atau TERHAD.
υ Tesis dimaksudkan sebagai tesis bagi Ijazah Doktor Falsafah dan
Sarjana secara penyelidikan, atau disertasi bagi pengajian secara kerja
kursus dan penyelidikan, atau Laporan Projek Sarjana Muda (PSM).
“I hereby, declare that I have read this thesis and in my
opinion this thesis is sufficient in terms of scope
and quality for the award of degree of
Master of Engineering (Electrical-Mechatronics and Automatic Control)
Signature
: ______________________
Name of Supervisor
: PM. DR. MOHAMAD NOH B. AHMAD
Date
: 10 MAY 2007
ii
I declare that this thesis entitled “Control of Cart-Ball System Using State Feedback and
Fuzzy Logic Controller” is the result of my own research except as cited in the
references. The thesis has not been accepted for any degree and is not concurrently
submitted in candidature of any other degree.
Signature
: ................................................................
Name
: BUDIMAN AZZALI BIN BASIR
Date
: 10 MAY 2007
iii
To all my beloved family. Thank for all your support .
iv
ACKNOWLEDGEMENT
My sincere thanks goes to my supervisor, Associate Prof. Dr Mohammad Noh
bin Ahmad, for his guidance in the execution of the project, for keeping me on my toes,
and for his kind understanding. I am especially grateful for all the help he provided and
resources he made available without which the project would not have reached its
current stage. I am also indebted to thank Dr Zaharuddin bin Mohamed, for being most
efficient in coordinating the project.
Finally, I would like to thank my beloved family for just being there, giving me
the strength, love and much needed moral support. Thank you.
v
ABSTRACT
A cart-ball system and the associated control design is an excellent platform for
testing and evaluating different control techniques since such a system is an open-loop
unstable system and demonstrates some basic concepts in control being nonlinear,
multivariable and non-minimum phase. Industrial applications of such type of systems
can be found in, for example, precise position control in production line. To control such
a system, a controller should be designed to adjust the cart in a desirable manner through
a DC motors. The cart position and ball angle form vertical are measured variables and
manipulated variable is the horizontal force acting on the cart. The cart-ball
mathematical model is derived and then linearized to be a linear model. The whole
system then has been model in state space equation. The controller design is based on
the theory of state feedback control approach and fuzzy logic control approach.
Experimental results presented are useful for demonstrating practical aspects of the
analysis. Furthermore, the cart-ball control system developed, is ideal for demonstrating
the design and hardware implementation of optimal controllers based on modern control
theory.
vi
ABSTRAK
Sistem bebola muatan dan rekabentuk kawalan yang berkaitan adalah platform
terbaik untuk menguji dan menilai pelbagai teknik kawalan untuk sistem tidak stabil
gelung terbuka dan memperlihatkan beberapa konsep asas dalam kawalan tidak linear,
berbilang pembolehubah dan fasa bukan minimum. Aplikasi industri untuk sistem
berkenaan dapat dilihat, seperti kawalan kedudukan tepat dalam barisan pengeluaran.
Untuk mengawal sistem sebegini, pengawal hendaklah direkabentuk supaya melaraskan
muatan ke kedudukan yang bersesuaian mengunakan motor DC. Kedudukan muatan
dan sudut bebola dari menegak adalah pembolehubah yang boleh diukur dan
pembolehubah yang boleh dimanupulasi adalah daya mendatar yang bertindak keatas
muatan. Model matematik bebola muatan diterbitkan dan dilinearkan menjadi model
linear. Seluruh sistem dimodel dalam bentuk persamaan “state space”. Rekabentuk
pengawal adalah berdasarkan teori kawalan “state feedback” dan “fuzzy logic”.
Keputusan eksperimen yang dilampirkan adalah berguna untuk demonstrasi analisis
aspek praktikal. Tambahan lagi sistem kawalan bebola muatan yang dibangunkan adalah
ideal untuk demonstrasi rekabentuk dan perlaksanaan perkakasan pengawal optimal
berdasarkan teori kawalan moden.
vii
TABLE OF CONTENTS
CHAPTER
1
TITLE
PAGE
DECLARATION
ii
DEDICATION
iii
ACKNOWLEDGEMENTS
iv
ABSTRACT
v
ABSTRAK
vi
TABLE OF CONTENTS
vii
LIST OF TABLES
x
LIST OF FIGURES
xi
LIST OF SYMBOLS
xiii
LIST OF ABBREVIATIONS
xiv
INTRODUCTION
1.1
Introduction
1
1.2
Objectives of the Project
2
1.3
Scope of the Project
3
1.4
Research Methodology
3
1.5
Layout of Thesis
4
viii
2
3
4
CART-BALL SYSTEM
2.1
Introduction
5
2.2
Mathematical Model of Cart-Ball System
7
2.3
Summary
13
STATE FEEDBACK CONTROLLER DESIGN
3.1
Introduction
14
3.2
State Feedback to Control Cart-Ball System
15
3.3
Computer Simulation Using Matlab/Simulink
19
3.4
Summary
20
FUZZY LOGIC CONTROLLER DESIGN
4.1
Introduction
21
4.2
Design Procedure
24
4.2.1
Fuzzy Controller Input and Output
25
4.2.2
Computer Simulation Using
Matlab/Simulink
4.3
Summary
29
30
ix
5
SIMULATION RESULTS AND DISCUSSION
5.1
Introduction
5.2
Results and Discussion for State
Feedback Controller
5.3
5.4
6
REFERENCES
31
31
Results and Discussion for Fuzzy Logic
Controller
32
Summary
38
CONCLUSION AND SUGGESTION
6.1
Introduction
39
6.2
Conclusion
40
6.3
Suggestion
42
41
x
LIST OF TABLES
TABLE NO.
2.1
TITLE
Cart-Ball Parameters. Jan Jantzen [1]
PAGE
11
xi
LIST OF FIGURES
FIGURE NO.
TITLE
PAGE
2.1
Cart-Ball System. Jan Jantzen [1]
5
2.2
Ball position measurement. Jan Jantzen [1]
6
2.3
Definition of symbols and directions
7
3.1
Simulink Model of State Feedback Controller
18
3.2
Subsystem of State Feedback Controller Model
19
4.1
Fuzzy controller architecture
21
4.2
Fuzzy Logic Toolbox (Using mamdani method)
24
4.3
Input1 Membership Function
25
4.4
Input2 Membership Function
26
4.5
Output Membership Function
27
4.6
Rule Base
28
4.7
Simulation Model
28
5.1
Cart Position for State Feedback Controller
31
5.2
Ball Angle for State Feedback Controller
31
5.3
Cart Phase Plot for State Feedback Controller
32
xii
5.4
Ball Phase Plot for State Feedback Controller
33
5.5
Cart Position for Fuzzy Logic Controller
34
5.6
Ball Position for Fuzzy Logic Controller
34
5.7
Cart Phase Plot Fuzzy Logic Controller
35
5.8
Ball Position for Fuzzy Logic Controller
36
xiii
LIST OF SYMBOLS
R
M
Cart radius of the arc
Cart weight, including equivalent mass
of motor and transmission
y
Cart position
F
Cart driving force
r1
Ball radius
r
Ball rolling radius
ψ
Ball rolling angle [radian]
ϕ
Ball angular deviation [radian]
m
Ball weight
I
Ball moment of inertia
V
Ball vertical reactive force [N]
H
Ball horizontal reactive force [N]
U
Motor voltage
U:F
g
Motor transmission ratio
Gravity
xiv
LIST OF ABBREVIATIONS
DC
Direct Current
ISL
Is Left
ISM
Is Middle
ISR
Is Right
MVL
Move Left
SST
Stay Still
MVR
Move Right
PHL
Push Hard Left
PHR
Push Hard Right
SOC
Self Organizing Controller
1
CHAPTER 1
INTRODUCTION
1.1
Introduction
The ball-balancer, or cart-ball system, demonstrates some basic concepts in
control since it is nonlinear, multivariable and non-minimum phase. The control
objective is to balance the ball on the top of the arc and at the same time place the cart in
the desire position. It is basically an inverted pendulum problem with little difference in
term of its physical configuration.
The whole system is needed to be modeled first by using a state space equation.
It has been found that this system results a non linear model. From this nonlinear model,
the linearization process has to be done. After the linearized model has been acquired,
the next task to do is to control the cart-ball system until it become stable.
2
In this project, the main task is to control the angular deviation ϕ from the
vertical of the ball and the position of the cart y . If the angular deviation ϕ and cart
position y is equal is equal to the set point, it can be concluded that the designed
controller is successful in controlling the ball angular deviation ϕ and cart position
y system become stable. In this project, there are 2 types of controllers that have been
used. First, it is the Pole Placement technique and another one is Fuzzy Logic Controller.
The performance of both controllers in controlling the cart-ball system is
evaluated through extensive computer simulation using MATLAB/SIMULINK
1.2
Objective of the project
The objectives of this project are as follows:
(i)
To formulate the complete state-space representation of Cart-Ball System.
(ii)
To design a controller using Fuzzy Logic approach.
(iii)
To compare the performance of the Fuzzy Logic Controller with the pole
placement technique via simulation result.
3
1.3
Scope of Project
The work undertaken in this project is limited to the following aspects:
(i).
The nonlinear mathematical model of cart-ball system based on Jan Jantzen [1]
and the linear mathematical model is derived afterwards.
(ii).
Simulation work using MATLAB/SIMULINK as a platform to prove the
effectiveness of the both designed controller.
(iii).
Comparative study between the Fuzzy Logic Controller and pole placement
technique will be done.
1.4
Research Methodology
The research work undertaken in the following five development stages:
(i)
The development of linear mathematical model for cart-ball system.
(ii)
The design of controller base on pole placement technique.
(iii)
The design of Fuzzy Logic Controller.
(iv)
Perform simulation using MATLAB/SIMULINK for pole placement and Fuzzy
Logic Controller.
(v)
Comparative study of both controllers is done.
4
1.5
Layout of Thesis
This thesis contains six chapters. Chapter 2 contains a brief introduction of cartball system. The derivation of the mathematical model, which is a nonlinear model of
the cart-ball system, is also presented. The linear mathematical model of the system is
derived and then transforms into the state space representations.
Chapter 3 presents the brief introduction of pole placement technique.
Chapter 4 presents the brief introduction of fuzzy logic controller.
Chapter 5 presents both the results of pole placement technique and fuzzy logic
controller. For every controller there will be two graphs presented. The first one is the
ball angular deviation and the other one is the cart position. At the end of this chapter,
the comparison between the pole placement technique and fuzzy logic controller is done.
Chapter 6 presents the analysis and discussions about the results obtained in the
previous chapter.
Chapter 7 concludes the work undertaken, suggestions for future work are also
presented in this chapter.
5
CHAPTER 2
CART-BALL SYSTEM
2.1
Introduction
Figure 2.1 Cart-Ball System. Jan Jantzen [1]
Figure 2.1 shows a cart-ball system Jan Jantzen [1]. By pushing the cart left and
right manually, it is possible to get the ball on top of the arc, but it is impossible to
position the cart at a particular position at the same time. An automatic control system
can do that, however. The cart position and ball angle form vertical are measured
variables and manipulated variable is the horizontal force acting on the cart.
6
The ball rolls on curved pipes, one of which is made of aluminium while the
other is a coil of resistance wire. The ball’s angle from the vertical is determined by
measuring its position on the pipes. The ball, being made of steel, connects the pipe
electrically, and acts as a voltage divider producing a voltage proportional to the position
(Figure 2.2). The cart position is measured the same way using a carbon wheel contact,
mounted on the cart, which rolls on a coil alongside the rails.
Figure 2.2 Ball position measurement Jan Jantzen [1].
The rails are cylindrical bars mounted on the support, and the cart wheels are
small, low-friction ball bearing which rolls on the bars. A wire pulls the cart, passing
over a pulley in one end and a wire drum in the other end, both attached to the support.
The wire drum is driven by a current-driven direct current (DC) print-motor. Although
the motor is current-driven, we assume the voltage is proportional to the current and in
turn that the force is proportional to the current. This is approximation, but it is a
relatively fast DC motor with small electrical and mechanical time-constants.
7
2.2
Mathematical Model of Cart-Ball System
Figure 2.3 Definition of symbols and directions
Figure 2.3 shown the definition of the symbols and directions adopted in this
work. All directions are assumed positive towards right. The analysis of the ball and cart
are done separately and apply the physical equations related to the vertical reaction force
V and the horizontal force H. Friction forced are neglected.
The horizontal movement of the ball
m
d2
[ y + (R + r )sin ϕ ] = H
dt 2
(2.1)
The vertical movement of the ball
m
d2
[(R + r )cosϕ ] = V − mg
dt 2
(2.2)
The rotational movement of the ball
Iψ&& = r (V sin ϕ − H cos ϕ )
(2.3)
8
The horizontal movement of the cart
M&y& = F − H
(2.4)
The relationship between ϕ and ψ
ψ =
R=r
ϕ
r
(2.5)
The variables (ψ ,V,H ) can be eliminated from (2.1)-(2.5), yielding two second
order differential equations in ϕ and y
(M + m )&y& = −m(r + r )(ϕ&& cosϕ − ϕ& 2 sin ϕ ) + F
I
R+r
ϕ&& = mr ( R + r )(−ϕ&& sin 2 ϕ − ϕ& 2 cosϕ sin ϕ )
r
(2.6)
(2.7)
+ mgr sin ϕ + Mr&y& cos ϕ − Fr cos ϕ
The equations (2.6) and (2.7) are nonlinear due to trigonometric functions, and
the equations are coupled such that &y& occurs on the left side of (2.6) and on the right side
of (2.7), the situation is reversed in the case of ϕ&& .
Let the state vector x of state variable as follows
x1 = y
x2 = y&
x3 = ϕ
x4 = ϕ&
(2.8)
Then,
x&1 = x2
(2.9)
9
x&2 =
− m( R + r )(−(r + R)ms) sin x3 cos 2 x3 ) x42 + mgr sin x3 cos x3
 I (R + r)
rM (cos 2 x3 )m( R + r ) 

( M + m)
+ rm(sin 2 x3 )( R + r ) +
r
( M + m)


I (R + r)


m( R + r ) x42 sin x3
+ x42 rm(sin 3 x3 )( R + r ) 
r


+
2
 I (R + r)
rM (cos x3 )m( R + r ) 

( M + m)
+ rm(sin 2 x3 )( R + r ) +
r
( M + m)


+
(r + R)(mr 2 + I )
 I (R + r)
rM (cos 2 x3 )m( R + r ) 

r ( M + m)
+ rm(sin 2 x3 )( R + r ) +
r
( M + m)


x&3 = x4
F
(2.10)
(2.11)


2 2 R+r
(cos x3 sin x3 ) + mgr sin x3 
 − rm x4
M +m


x&4 =
2
I (R + r)
rM (cos x3 )m( R + r )
+ rm(sin 2 x3 )( R + r ) +
r
( M + m)
m
M +m
F
−
I (R + r)
rM (cos 2 x3 )m( R + r )
2
+ rm(sin x3 )( R + r ) +
r
( M + m)
r (cos x3 )
(2.12)
In order to avoid errors, the model is linearised around the origin by using the
following approximations to the trigonometric function,
cos ϕ ≈ 1, sin ϕ ≈ ϕ , cos 2 ≈ 1, sin 2 ϕ ≈ 0
(2.13)
The angle ϕ is the order of ± 0.22 radian, and the error introduce by the
linearization is small. Thus the equations (2.6) and (2.7) reduce to
(M + m )&y& = −m( R + r )ϕ&& + F
(2.14)
10
I
R+r
ϕ&& = mgr + Mr&y& − Fr
r
(2.15)
After some rearranging, ones gets
2.3
&y& = −
mr 2 g
mr 2 + I
ϕ
F
+
MI + mI + mr 2 M
MI + mI + mr 2 M
(2.16)
ϕ&& = −
mr 2 g ( M + m)
mr 2
ϕ+
F
( R + r )( MI + mI + mr 2 M )
( R + r )( MI + mI + mr 2 M )
(2.17)
State-space Model
Introducing the substitution variables
m2r 2 g
a=−
MI + mI + mr 2 M
mr 2 + 1
b=
MI + mI + mr 2 M
c=
mr 2 g ( M + m)
( R + r )( MI + mI + mr 2 M )
mr 2
d =−
( R + r )( MI + mI + mr 2 M )
and the state vector (2.8), one obtain a linear state-space model
(2.18)
11
x& = Ax + Bu
y = Cx
(2.19)
The matrices are simply
0
0
A=
0

0
1 0 0
0 a 0
0 0 1

0 c 0
0
b 
B= 
0
 
d 
(2.20)
1 0 0 0
C=

0 0 1 0 
By using the data from Table 2.1 the actual values of the constants are
(a,b,c,d) = (-1.34,0.301,14.3,-0.386)
(2.21)
12
Table 2.1 Cart-Ball Parameters Jan Jantzen [1].
Parameter
Value
Units
Cart length
0.35
m
Cart width
0.12
m
R
0.50
m
M
3.1
kg
Cart radius of the arc
Cart weight, including equivalent mass of
motor and transmission
Symbol
Cart position
y
Cart driving force
F
Ball maximum angle
N
± 0.22
radian
Ball radius
r1
0.0275
m
Ball rolling radius
r
0.025
m
Ball rolling angle [radian]
ψ
Ball angular deviation [radian]
ϕ
Max 0.22
radian
Ball weight
m
0.675
kg
Ball moment of inertia
I
ψ
µm
Ball vertical reactive force [N]
V
N
Ball horizontal reactive force [N]
H
N
Bar length
radian
1.4
m
Bar diameter
0.025
m
Motor power
Max 21
W
U
Max 13
V
U:F
1:1
Motor voltage
Motor transmission ratio
Motor speed
Gravity
g
3700
rpm
9.81
ms −2
13
2.3
Summary
This chapter had introduced the brief description of a cart-ball system and its
nonlinear mathematical model. After some suitable assumption, the linearized model is
successfully derived. Using the physical parameters of the cart-ball system, the complete
linear state space equation had successfully obtained and it is shown in equation (2.19).
14
CHAPTER 3
STATE FEEDBACK CONTROLLER DESIGN
3.1
Introduction
This chapter contains the introduction to state feedback design using the
linearized model derived in the previous chapter.
The state feedback is designed based on second order closed loop characteristic
equation:
s 2 + 2ξωn s + ωn 2 = 0
(3.1)
But because the cart-ball system is fourth order system, two more poles should
be added to obtain a fourth order closed loop characteristic equation. This two added
poles must be located at least five times far than the dominant poles. So the new closed
loop characteristic equation will be
15
( s 2 + 2ξωn s + ωn 2 )( s + a)( s + b) = 0
(3.2)
After obtaining equation (3.2), the next step is to find the feedback vector K.
Lastly, after obtaining the feedback vector K, the computer simulation diagram
using MATLAB/SIMULINK can be constructed.
3.2
State Feedback to Control Cart-Ball System
The state feedback controller is to be designed to achieve the following specifications:
Percentage Overshoot = 10% and Ts = 0.1 s
The formula to calculate the percentage overshoots (Nise, N.S.,2004)
% O.S = e
− πξ
1−ξ 2
(3.12)
16
When the overshoot is 10%:
10 = e
2.3 = −
5.29 =
− πξ
1−ξ 2
πξ
1− ξ 2
π 2ξ 2
1− ξ 2
5.29 − 5.29ξ 2 = 9.87ξ 2
Therefore the damping ratio is:
5.29
9.87 + 5.29
ξ
=
ξ
= 0.35
= 0.6
The formula to calculate the settling time The formula to calculate the percentage
overshoots (Nise, N.S.,2004):
Ts =
4
ξωn
When, Ts = 0.1 second,
0.1 =
4
ξωn
(3.13)
17
Therefore, the natural frequency is:
ωn =
4
(0.1)(0.6)
= 66.67 rad/sec
By using these two parameters, the close-loop characteristic equation can be obtained
using the formula below:
s 2 + 2ξωn s + ωn 2 = 0
(3.14)
Substitute ξ = 0.6 and ωn = 66.67 rad/sec into equation (3.14):
s 2 + 2(0.6)(66.67) s + (66.67) 2 = 0
s 2 + 80 s + 4445 = 0
( s + 40 + j 53.33)( s + 40 − j 53.33) = 0
(3.15)
The poles are, s = − 40 + j 53.33 and s = − 40 − j 53.33 . To implement the pole
placement technique, two more poles are required to be added to make the characteristic
equation as a 4th order equation. Two more poles that had been added are s = − 240 .and
s = − 250 . These two poles are chosen because they are 6 times bigger than those two
dominant poles. So by adding s = − 240 and s = − 250 to the s-plane, the system still
behaves like a second order characteristic equation. So the new characteristic equation
( s + 40 + j 53.33) ( s + 40 − j 53.33) ( s + 240) ( s + 250) = 0
s 4 + 570 s 3 + 103641s 2 + 6976036 s + 266453400 = 0
(3.16)
18
After obtaining equation (3.16), the feedback vector K can be calculated. Using
equation (2.13),
0
0
A − BK = 
0

0
1
0  0 
0 − 1.34 0  0.301 
[K1
−
0
0
1  0 
 

0 14.3 0 − 0.386
0
0
A − BK = 
0

0
1
0
K2
K3
0
0
0 


0.301K 2
0 − 1.34 0  0.301K1
−
0
0
0
0
1 
 
0 14.3 0 − 0.386 K1 − 0.386 K 2
0
0
1

− 0.301K − 0.301K
1
2
A − BK = 

0
0

0.386 K 2
 0.386 K1
K4 ]
(3.17)
0
0.301K 3
0
− 0.386 K 3

0.301K 4 
(3.18)
0 

0.386 K 4 
0

− (1.34 + 0.301K 3 ) − 0.301K 4 

0
1

14.3 + 0.386 K 3
0.386 K 4 
0
0
(3.19)
Then,
s
0
sI − ( A − BK ) = 
0

0
0
1
0 0 0 


s 0 0 − 0.301K1 − 0.301K 2
−
0
0
0 s 0 
 
0.386 K 2
0 0 s   0.386 K1
s

 0.301K
1
sI − ( A − BK ) = 

0

− 0.386 K1
−1
s + 0.301K 2
0
− 0.386 K 2
0
0

− (1.34 + 0.301K 3 ) − 0.301K 4 

0
1

14.3 + 0.386 K 3
0.386 K 4 
(3.20)

(1.34 + 0.301K 3 )
0.301K 4 

s
−1

− (14.3 + 0.386 K 3 ) s − 0.386 K 4 
0
0
(3.21)
19
The characteristic equation is :
sI − ( A − BK ) = ( s[ s + 0.301K 2 [ s 2 − 0.386 K 4 s − 14.3 − 0.386 K 3 ] + 1.34 + 0.301K 3
− 0.386 K 2 + 0.301K 4 (0.386 K 2 s )) + (1)(0.301K1[ s ( s − 0.386 K 4 − 14.3 − 0.386 K 3 ]
(3.22)
+ 1.34 + 0.301K 3 − 0.386 K1 + 0.301K 4 (0.386 K1s )
Solving equation. (3.22) gives :
Feedback vector, K = [K1
K2
K3
K4 ]
K = [24 24 162 44]
3.3
Computer Simulation Using MATLAB/SIMULINK
Figure 3.1 Simulink Model of State Feedback Controller
(3.23)
20
Figure 3.2 Subsystem of State Feedback Controller Model
3.4
Summary
The state space design method based on state feedback is very straight forward
approach. It is a time-domain method. The desired closed-loop poles can be arbitrarily
placed, provided the plant is completely state controllable. In designing a system using
the state feedback approach, several different sets of desired closed-loop poles need be
considered, the response characteristics compared and the best one chosen.
In this chapter, a sets of feedback vector K had been obtained. After that, the
simulation diagram for state feedback controllers had been successfully constructed. The
results are shown in Chapter V.
The results are shown in Chapter V.
21
CHAPTER 4
FUZZY LOGIC CONTROLLER DESIGN
4.1
Introduction
This chapter contains the introduction and the design of a fuzzy logic controller
for cart-ball system.
Fuzzy control provides a formal methodology for representing, manipulating and
implementing a human’s heuristic knowledge about how to control a system. There are
specific components characteristic of a fuzzy controller to support a design procedure.
Figure 4.1 shows the basic architecture of a fuzzy logic controller. It has four main
components. The following explains the block diagram.
22
Figure 4.1 Fuzzy controller architecture
a. Fuzzification
The first component is fuzzification, which converts each piece of input data to
degrees of membership by a lookup in one of several membership functions. The
fuzzification block thus matches the input data with the conditions of the rules to
determine how well the condition of each rule matches that particular input instance.
b.Rule base
The rule base contains a fuzzy logic quantification of the expert’s linguistic
description of how to achieve good control.
c. Inference engine
For each rule, the inference engine looks up the membership values in the condition of
the rule.
Aggregation
The aggregation operation is used when calculating the degree of
fulfillment or firing strength of the condition of a rule. Aggregation is equivalent to
fuzzification, when there is only one input to the controller. Aggreagtion is sometimes
also called fulfillment of the rule or firing strength.
23
Activation The activation of a rule is the deduction of the conclusion, possibly reduced
by its firing strength. A rule can be weighted by a priori by a weighting factor, which is
its degree of confidence.
The degree of confidence is determined by the designer, or a learning program trying to
adapt the rules to some input-output relationship.
Accumulation All activated conclusions are accumulated using the max operation.
d. Defuzzification
The resulting fuzzy set must be converted to a number that can be sent to the processes
as a control signal. This operation is called defuzzification.
The output sets can be singletons, but they can also be linear combinations of the inputs,
or even a function of the inputs. The T-S fuzzy model was proposed by Takagi and
Sugeno in an effort to develop a systematic approach to generating fuzzy rules from a
given input-output data set [4]. Its rule structure has the following form:
R i : if x1 is A1i , x2 is A2i ,L , xm is Ami , then y i = P0i + P1i + P1i x1 + P2i x2 + L + Pmi xm
Where Aij is a fuzzy set, x j is the j − th input, m is the number of inputs
output specified by the rule R i
y i is the
Pji is the truth value parameter. Using fuzzy inference
based upon product-sum-gravity at a given input , x = [ x1 , x2 ,L , xm ]T
the final output
of the fuzzy model , y n ( i = 1, 2,L , n) is inferred by taking the weighted average of y i
m
∑ω y
i
yi =
i
i =1
n
∑ω
i
i =1
where n is the number of fuzzy rules, the weight, ω i implies the overall truth value of
the i − th rule calculated based on the degrees of membership values:
m
ωi = ∏ µA (x j )
i =1
i
j
24
The simulation results can be obtained by the designed program using matlab.
Initial conditions can be changed and controller gains can be adjusted. Then the desired
results can be obtained.
4.2
Design procedure
Fuzzy control design essentially amounts to
(i).
choosing the fuzzy controller inputs and outputs
(ii).
choosing the preprocessing that is needed for the controller inputs and
possibly postprocessing that is needed for the outputs.
(iii).
designing each of the four components of the fuzzy controller shown in
Figure.4.1
4.2.1
Fuzzy controller inputs and outputs
Figure 4.2 shown the Fuzzy Logic Toolbox using mamdani method. The cart-ball
system consist of two input and a output function. The range -100 ,100 is based on
length of the steel rail in the cart-ball system.
25
Figure 4.2 Fuzzy Logic Toolbox (Using mamdani method)
Figure 4.3 shown the membership functions of input1. Input1 represent the ball
variable. Consists of the function which are ISL(is left), ISM(is middle) and ISR(is
right) with respect to the ball location on the cart.
26
Figure 4.3 Input1 Membership Function
Figure 4.4 shown the membership functions of input2. Input2 represent the cart
variable. Consists of the function which are MVL(move left), SST(stay still) and
MVR(move right) with respect to the cart location on the steel rail.
27
Figure 4.4 Input2 Membership Function
Figure 4.5 shown the membership functions of output1. Output1 represent the
output variables. Consists of the function which are PHL(push hard left), PSL(push slow
left), 000 (no movement), PSR(push slow right) and PHR(push hard right) with respect
to cart position.
28
Figure 4.5 Output Membership Function
Figure 4.6 shown the rulebased of the fuzzy logic controller for the cart-ball
system. Consist of nine rulebased using If-and-then rules condition. Example one of the
rules “ If Input1 is ISL and Input2 is MVL then outpu1 is PHL.
29
Figure 4.6 Rule Base
4.2.3
Computer simulation
Figure 4.7 Simulation Model
30
4.3
Summary
This chapter presents the step by step procedure of designing the fuzzy logic
controller for car-ball system using Fuzzy Toolbox in MATLAB/SIMULINK. This
chapter starts with the introduction to fuzzy logic controller. Before the fuzzy logic can
be designed its necessary to determine the inputs variable and output variable thus their
value function. Then using this variables to define the rules. Minimum rules are based
on the inputs and output variables. The simulation results are shown in Chapter V.
31
CHAPTER 5
SIMULATION RESULTS AND DISCUSSION
5.1
Introduction
This chapter contains all of the results of the simulation mentioned in the
previous chapters. There are 8 graphs in this chapter. For every controller simulation,
there will be 4 graphs presented. The first two graph represents the output variables of
the system which are ϕ angular of the ball and y the position of the cart. The last two
graph represent are the phase portrait for stability analysis.
32
5.2
Results and Discussion for State Feedback Controller
Figure 5.1 Cart Position for State Feedback Controller
Figure 5.2 Ball Angle for State Feedback Controller
33
Figure 5.1 and figure 5.2 shown the output results of state feedback controller.
From the graph, the initial condition of the cart is at the center of the rail and the initial
condition of the ball is at -12degree. When a horizontal force F is given, the state
feedback controller will control the cart to move the ball onto its center as well control
the cart to the center of the rail.
From transient response analysis, the cart settling time is at 3.7sec with a
minimal overshoot while the ball settling time is at 3.0sec but overshoot to 12degree
before decrease to 0degree.
Figure 5.3 Cart Phase Plot for State Feedback Controller
34
Figure 5.4 Ball Phase Plot for State Feedback Controller
The stability analysis can be observed using a phase portrait. Figure 5.3 and
figure 5.4 shows the phase plot state feedback controller. Figure 5.5 phase plot is plotted
with condition velocity G2 versus position G1 and there are no disturbance that presence
in the system. As can be observed, the value of velocity G1 and position G2 finally go
back to the set point, which mean the model system is stable.
Figure 5.4 phase plot is plotted with condition velocity G4 versus angle G2 and
there are no disturbance that presence in the system Also, the value of velocity G4 and
angle G3 finally go back to the set point, therefore the model system is stable.
35
5.3
Results and Discussion for Fuzzy Logic Controller
Figure 5.5 Cart Position for Fuzzy Logic Controller
Figure 5.6 Ball Position for Fuzzy Logic Controller
36
Figure 5.5 and figure 5.6 shown the output results of fuzzy logic controller. From
the graph, the initial condition of the cart is at the center of the rail and the initial
condition of the ball is at -12degree. When a horizontal force F is given, the fuzzy logic
controller will control the cart to move the ball onto its center as well control the cart to
the center of the rail.
From transient response analysis, the cart settling time is at 4.1sec with a higher
overshoot compare to state feedback controller while the ball settling time is at 3.8sec
but overshoot to 13degree before decrease to 0degree.
Figure 5.7 Cart Phase Plot Fuzzy Logic Controller
37
Figure 5.8 Ball Position for Fuzzy Logic Controller
Also for fuzzy logic controller, the stability analysis can be observed using a
phase portrait. Figure 5.7 and figure 5.8 shows the phase plot for fuzzy logic controller.
Figure 5.7 phase plot is plotted with condition velocity G2 versus position G1 and there
are no disturbance that presence in the system. As can be observed, the value of velocity
G1 and position G2 finally go back to the set point, which mean the model system is
stable.
Figure 5.8 phase plot is plotted with condition velocity G4 versus angle G2 and
there are no disturbance that presence in the system Also, the value of velocity G4 and
angle G3 finally go back to the set point, therefore the model system is stable.
38
5.4
Summary
For state space form stability is guaranteed if none of the eigenvalues of the
closed-loop system matrix A+BK are in the right half of the complex plane. Jorgensen
[4] went through the calculations and his main results is that all k’s must be positive.
Consequently if just one of them is zero the system will be unstable, therefore all four
state variables must be available to the controller.
In fuzzy logic control, the universes of discourse of variables are the sets of
observed values. Each input variable may take values from the set of fuzzy sets
associated to it. The output variables take their values from the set of fuzzy singletons
(one-element sets). The number of the controller inputs, that is, the number of inputs in
the rule base, determines the number of basic premises in the IF part of the rule, such as
the dimensions of the table.
39
CHAPTER 6
CONCLUSIONS AND SUGGESTIONS
6.1
Introduction
In this chapter the conclusions of the project as well as some constructive
suggestions for further development and the contribution of this project will be
discussed. The project outcome is concluded in this chapter. As for future
development, some suggestions are highlighted with the basis of the limitation of
the effectiveness mathematical model equation and simulation analysis executed
in this project. The aim of the suggestion is no other than the improvement of the
study.
40
6.2
Conclusions
The first objective is to represent the mathematical model of cart-ball system
state space equation has been achieved. Later using the state space equation obtain to
design two controller which are the state feedback controller and the fuzzy logic
controller. From the results that had been shown and with some discussion that had been
done in Chapter 5.
6.3
Suggestions
For further development for the cart-ball system, two type of controllers can be
developed, there are the Self Organizing Controller (SOC) and the cascade control.
Self Organizing Controller (SOC) is suggested because it provides faster settling time
compare to fuzzy logic controller.
A cascade control will divide the system into two subsystems, one for the ball
and another for the cart to make the system more manageable. It seems that the ball need
faster control reaction compare to the cart positioning.
41
REFERENCES
1.
Jantzen, J.(1996a). Diagrah analyses of linear control system, Technical Report
(no number), Technical University of Denmark: Dept of Automation, Bldg 326,
DK-2800 Lyngby, Denmark. 127 pp.
2.
Jantzen, J. (1996b). Fuzzy control course on the internet,
http://www.iau.dtu.dk/~jj/learn.
3.
Jantzen, J. and Dotoli, M. (1998). A fuzzy control course on the internet, in P.K.
Chawdry, R. Roy and R.K. pants 9eds), Soft Computg in Engineering Design
and Manufacturing, Springer Verlag London Ltd, pp. 122-130. ew York.
4.
Jorgensen, V (1974). A ball-balancing system for demosration of basic concepts
in the state-space control theory, INT.J.Elect.Enging Educ. 11:367-376.
5.
Takagi, T. and Sugno, M. (1985). Fuzzy identification of systems and its
applications to modeling and control, IEEE Trans. Systems, Man & Cybernetics
15(1): 116-132.
6.
Nise, N.S., (2004), “Control System Engineering.” 4th Edition, John Wiley and
Sons: pp 764-767.
7.
K. M. Passino and S. Yurkovich(1997). Fuzzy control, 1st edn, Addision Wesley
Longman, Colifornia.
8.
Pedrycz, W.(1993). Fuzzy control and fuzzy systems, second edn, Wiley and
Sons, New York.