Fuzzy Controller Design for Ball and Beam
Fuzzy Controller Design for Ball and Beam
1
trail on the sample time. In order to increase the range of solution space and decrease the
The ant system (AS) was the first algorithm within the ACO number of iteration, the α can be undated by
algorithms framework [2]. The AS algorithm was successfully
applied to the traveling salesman problem, and it had α = α + ∆α (3)
satisfactory results compared with traditional methods such as
GA, EA, and SA. The TSP is typically a combinational where ∆α is a heuristic value.
optimization problem, which can be modeled as G = (V , E ) ,
B. The Fuzzy Pheromone
where V = {1,2,..., N } is a set of nodes and
The pheromone level is updated by (2) and ∆τ ij = 1 / Lgb ,
E = {(i, j ) | (i, j ) ∈ V × V } is a set of arcs. The object of the TSP
Lgb is the length of the optimal global tour from the beginning
is to find the minimum length Hamiltonian circle on G . The
cost function is defined as the distance of edge (i, j ) . The of the trail. In this paper, a modified pheromone updating is
given as follows
distance between each pair of nodes ( xi , yi ) and ( x j , y j ) is
represented by d (i, j ) that is the Euclidean distance between τ ij = ρτ ij + f ( Lgb ) (4)
node i and j , where d (i, j ) = d ( j , i ) . Let τ ij be the value of
pheromone trails. In AS, the probability that an ant k , currently where f (⋅) is a fuzzy function. The proposed fuzzy inference
located at the city i, chooses the city j as the next city is given by system is represented as
τ ij = ρτ ij + ∆τ ij (2) VS S M L VL VS S M L VL
2
conventional ACO methods, the pheromone trails arise quickly dynamic objects, i.e. beam and ball. Therefore, the control of
on the best path that can lead to most ants toward this path. The the ball and beam system is decoupled into two subsystems, the
pheromone of the best path is much larger than other paths and position control of ball and the balance control of beam. Two
the selection probability of the other paths could be much unique fuzzy control strategies are utilized to balance the beam
smaller. Therefore, the phenomenon of stagnation will be and to keep the ball in the designated position. The proposed
occurred. In this paper, a clear mechanism is proposed as FACO optimized control scheme contains a fuzzy
follows beam-balance controller, a fuzzy ball-position controller, and
the FACO tuning mechanism.
0, if Prandom < Pclear
τ ijmax = max (6)
τ ij , otherwise
l
r o4
τb
o3
α
where τ ijmax is the pheromone of the best path, Prandom is L1 o2
τg L2
randomly number, 0 < Prandom < 1 , and Pclear is parameter of θ
τm o1
the clear mechanism. When the clear mechanism is performed, o0
the pheromone trails of the best path will be reset to zero. d
Consequently, the ants can select other paths and deviate from
the local optimal solution. Fig. 2. Scheme diagram of ball and beam system.
necessary torque of interest, o1 represents the big gear that can EB FBBC kB
+
-
control the angle of the beam, o2 , and o3 denote the link and C3 C4 B1 B6 kB1 kB6
3
variables ( FFBPC and FFBBC ) be fuzzily partitioned into nine Integral of the Absolute value of the Error (IAE)
fuzzy sets, negative very big (NV), negative big (NB), negative
N
medium (NM), negative small (NS), zero (ZO), positive small IAE = ∑ x1* (t ) − x1 (t ) (12)
(PS), positive medium (PM), positive big (PB), positive very t =1
big (PV). The fuzzy IF-THEN rules are expressed as
Integral of the time multiplied by the Absolute value of the
RBi : IF E B is MFBi , THEN FFBBC is OBi (8) Error (ITAE)
RPi : IF E P is MFPi , THEN FFBPC is OPi (9)
N
ITAE = ∑ t x1* (t ) − x1 (t ) (13)
where the fuzzy sets MFBi , MFPi , OBi , OPi , i = 1,2,...,9 are t =1
defined in Table 3.
The initial states of the ball and beam system are set to be
NV NB NM NS ZO PS PM PB PV x = [0 π 0 0] and the disturbance is added at 10 sec. Fig. 5
1 indicates the responses of the ball and beam system with
EP conventional ACO and FACO fuzzy controllers. It can be seen
0 EB that, from Fig. 5(a) and Fig. 5(b), before 10 sec, the ball is
−1 P1 P2 P3 0 P4 P5 P6 1 stopped as desired and the beam is also at the required angle,
−1 B1 B2 B3 0 B4 B5 B6 1 respectively. In Fig. 5(a), the response of the proposed method
NV NB NM NS ZO PS PM PB PV has no overshoot and quickly converges to he desired position.
1 In particular, with the disturbance added at 10 sec, the proposed
FFBPC method still has the best performance among other conventional
0 FFBBC ACOs. The Table 5 presents the criteria with all methods. It can
−1 k P1 k P2 k P3 0 k P4 k P5 k P6 1 be shown that the proposed algorithm is better than other
−1 k B1 k B2 k B3 0 k B4 k B5 k B6 1 conventional ACO optimization methods.
Fig. 4. Membership functions for the FBPC and the FBBC.
Table 4. Parameter table
Table 3. Fuzzy rule base Membership Function
Metho Error Constant, C j
i 1 2 3 4 5 6 7 8 9 MF Value, Pi , Bi , k Pi , kbi
d
E P ( MFPi ) i =1 i = 2 i = 3 i = 4 i = 5 i = 6 j =1 j = 2 j = 3 j = 4
input NV NB NM NS ZO PS PM PB PV E P -0.75 -0.57 -0.04 0.04 0.57 0.75
E B ( MFBi ) in
AS E B -0.76 -0.70 -0.25 0.25 0.70 0.76
FFBPC (OPi ) PV PB PM PS ZO NS NM NB NV 13 8 12 0.85
[2] FFBPC -0.75 -0.54 -0.25 0.25 0.54 0.75
output out
FFBBC (OBi ) NV NB NM NS ZO PS PM PB PV FFBBC -0.75 -0.50 -0.21 0.21 0.50 0.75
E P -0.55 -0.54 -0.05 0.05 0.54 0.55
in
To show the effectiveness of the proposed method, the FACO ACS E B -0.70 -0.54 -0.23 0.23 0.54 0.70
7 4 13 0.7
is proposed to adjust the parameters of the mentioned fuzzy [1] FFBPC -0.75 -0.54 -0.25 0.25 0.54 0.75
out
controllers. The parameters of controllers contain the error FFBBC -0.76 -0.50 -0.22 0.22 0.50 0.76
constant, c1 ~ c4 , the parameters of the input membership E P -0.92 -0.80 -0.10 0.10 0.80 0.92
in
functions, B1 ~ B6 , P1 ~ P6 , and the parameters of the output MMAS E B -0.85 -0.50 -0.15 0.15 0.50 0.85
14 7 11 0.6
[13] FFBPC -0.75 -0.50 -0.15 0.15 0.50 0.75
membership functions, k B1 ~ k B6 , k P1 ~ k P6 . In this case, the out
FFBBC -0.75 -0.5 -0.25 0.25 0.5 0.75
aim of optimization is that minimizes the cost function. The cost E P -0.76 -0.60 -0.05 0.05 0.60 0.76
function is the root mean square error (RMSE), and it is defined in
E B -0.97 -0.60 -0.25 0.25 0.60 0.97
as follows FACO 10 7 8 1
FFBPC -0.95 -0.50 -0.20 0.20 0.50 0.95
out
FFBBC -0.75 -0.55 -0.25 0.25 0.55 0.75
N
1
Cost =
N
∑ (( x1* (t ) − x1 (t )) 2 + ( x3* (t ) − x3 (t )) 2 ) (10)
Table 5. Simulation performance criterion with disturbance
t =1
IAE ISE ITSE
where N is the number of samples. The optimized parameters AS 4.05 × 10 4 4.53 × 105 7.99 × 108
are represented in Table 4. For evaluating the proposed method ACS 3.66 × 10 4 3.97 × 105 7.00 × 108
and other algorithms, some criteria are selected as MMAS 2.96 × 10 4 3.39 × 105 3.67 × 108
Integral of Square Error (ISE) FACO 2.79 × 10 4 3.14 × 105 2.67 × 108
N
ISE = ∑ (( x1* (t ) − x1 (t )) 2 (11)
t =1
4
40
Proposed VI. CONCLUSION
ball position (cm) ACS
35
30
MMAS
AS This paper presents an ACO-optimized fuzzy controller for a
25 (a) beam and ball system. The proposed fuzzy-based ACO
20
algorithm has the enhanced capability of pheromone updating.
15 For the fuzzy controller design of a beam and ball system, the
0 2 4 6 8 10 12 14 16 18 20
time (sec) proposed improved ACO algorithm is applied to optimize the
0.2
Proposed
parameter settings of the input and output membership functions.
ball velocity (m/sec)
0.1
ACS
MMAS
Simulation and experimental results illustrate that the improved
AS
0
ACO algorithm can provide better control performance subject
(b) to disturbance. io
t
-0.1 a
tr n
o
o i
p
s t
i
cea n s
o
-0.2 fr ra p e
l
0 2 4 6 8 10 12 14 16 18 20 Address Bus et T A/D Converter l g
l n
[4:0] n
i interface a a
time (sec) Fuzzy b m
a Actuator
EMIF
f e
Controller PWM generator o b
0.1 l
a f
Proposed n o
Motor speed g l
ACS i a
beam angle (rad)
encoder S n
0.05 g
MMAS
Data Bus i
TMS320C6713 DSP Altera Stratix FPGA S
AS [32:0]
0
(c)
-0.05
A/D
-0.1 Converter
0 2 4 6 8 10 12 14 16 18 20 AD7862
time (sec)
PWM
beam angle velocity (rad/sec)
Encoder
1
Proposed
ACS
0.5 MMAS
AS Ball & Beam System
0
(d) Fig. 6. Control scheme of the beam and ball control system.
-0.5
-1
0 2 4 6 8 10 12 14 16 18 20
time (sec)
20
Proposed
motor voltage (volt)
ACS
10 MMAS
AS
0
(e)
-10
-20
0 2 4 6 8 10 12 14 16 18 20 Beam and Beam System
time (sec)
Fig. 5. Simulation response: (a) ball position, (b) ball velocity, (c)
beam angle, (d) beam angle velocity, (e) controller output. Driver
are showed in Table 6 and Table 7. It can be shown that the IAE ISE ITSE
proposed method has better performance than other methods. AS 1.48 × 10 4
3.04 × 10 5
5.26 × 107
ACS 1.26 × 10 4 2.30 × 105 3.30 × 107
MMAS 1.17 × 10 4 1.85 × 105 2.97 × 107
FACO 1.08 × 10 4 1.36 × 105 2.19 × 107
5
40 (A.1) yields
ball position (cm) d ∂L ∂L
35
J
30 τB = − = r(mB + B2 ) − mB rα 2 + mB g sin α (A.4)
25 (a) dt ∂r ∂r
R
20
d ∂L ∂L
τb = −
dt ∂α ∂α
15
0 1 2 3 4 5 6 7 8 9 10
ti ( )
1
l
ball velocity (m/sec)
0.05
K K K l
0
(c) τ b = n( b Va − b t θm ) cos α cos θ (A.6)
-0.05
Ra Ra d
-0.1
In (A.4), there is no external force, i.e. τ B = 0 . From
0 1 2 3 4 5 6 7 8 9 10
ti ( ) (A.4)-(A.6), the state equation of the ball and beam system can
beam angle velocity (rad/sec)
1
be represented as (7)
0.5
0 (d) ACKNOWLEDGMENT
-0.5
This work is partially supported by Ministry of Economic
-1
0 1 2 3 4 5 6 7 8 9 10 Affairs, Taiwan under Technology Development Program for
20
Academia (TDPA) in the project “Developing A Brain Medical
motor voltage (volt)
-20
REFERENCES
0 1 2 3 4 5 6 7 8 9 10
time(sec) [1] M. Dorigo, L.M. Gambardella, “Ant colony system : a cooperative
Fig. 8. Experiment response ( x1 (0) = 38cm, x3 (0) = −1 ): learning approach to the traveling salesman problem, ” IEEE Tran. on
Evolutionary Computation, vol. 1, no. 1, pp. 53-66, 1997.
(a) ball position, (b) ball velocity, (c) beam angle, (d) beam angle [2] M. Dorigo, V. Maniezzo, and A. Colorni, “Ant system: optimization by a
velocity, (e) controller output. colony of cooperating agents,” IEEE Tran. on Systems, Man, and
Cybernetics, Part B: Cybernetics, vol. 26, no. 1, pp. 29-41, 1996.
[3] C. Blum, “Ant colony optimization: Introduction and recent trends, ”
Physics of Life Reviews, vol. 2, no. 4, pp. 353-373, 2005.
APPENDIX [4] Y. Li and S. Gong, “Dynamic ant colony optimisation for TSP, ” The
The ball and beam system is a classic underactuated International Journal of Advanced Manufacturing Technology, vol. 22,
pp. 528-533, 2003.
nonlinear system. The system parameters for the ball and beam [5] C.F. Tsai, C.W. Tsai, and C.C. Tseng, “A new hybrid heuristic approach
system model are listed in Table 2. To obtain the possible for sloving large travling salesman problem, ” Information Sciences, vol.
mathematical model of a ball and beam system, the associated 166, no. 1, pp. 67-81, 2004.
Euler-Lagrange dynamic equation is first addressed in (A.1). [6] S.C. Negulescu, C.V. Kifor, and C. O, “Ant colony solving multiple
constrains problem: Vehicle route allocation, ” International Journal of
d ∂L ∂L
− =Q Computers, Communications and Control, vol. 3, no. 4, pp. 366-373,
(A.1)
dt ∂q ∂q 2008.
[7] J. Heinonen and F. pettersson, “Hybrid ant colony optimization and
where q = [r α ]T Q = [τ B τ b ]T , L=(the kinetic energy, K)-(the visibility studies applied to a job-shop scheduling problem, ” Applied
Mathematics and Computation, vol. 187, no. 2, pp. 989-998, 2007.
potential energy, P), r is the position of the ball, α is the beam [8] L.Y. Tseng and S.C. Liang , “A hybrid metaheuristic for the quadratic
angle, τ b is a torque provided by a DC motor to the beam via assignment problem,” Computational Optimization and Applications, vol.
14, no. 1, pp. 85-113, 2006.
gear and linker, and τ B is an exogenous torque to the Ball. It is [9] S. Tsutsui, “Solving the quadratic assignment problems using parallel
noted that τ B is physically considered as the disturbance to the ACO with symmetric multi processing, ” Transactions of the Japanese
Society for Artificial Intelligence, vol. 24, no. 1, pp. 46-57, 2009.
ball. As show in Fig. 1, to derive the dynamic equation of the [10] A.P. Engelbrecht, Computational Intelligence: An Introduction, 2nd,
ball and beam system, the kinetic energy K and P can be Wiley, 2007.
represented as follows: [11] C. Martinez, O. Castillo, and O. Montiel, “Comparison between ant
colony and genetic algorithms for fuzzy system optimization, ” Studies in
1 1 r 2 1 1
K = mB r 2 + J B ( ) 2 + ( J B + mB r 2 )α 2 + J bα 2 (A.2) Computational Intelligence, vol. 154, no. 4, pp. 71-86, 2008.
2 2 R 2 2 [12] C.F. Juang and C. Lo, “Zero-order TSK-type fuzzy system learning using
a two-phase swarm intelligence algorithm, ” Fuzzy Sets and Systems, vol.
l
P = mb g sin α + mB gr sin α (A.3) 159, no. 21, pp. 2910-2926, 2008.
2 [13] T. Stutzle, H.H. Hoos, “Max-Min ant system, ” Future Generation
Substituting (A.2) and (A.3) into Lagrange dynamic equation Computer Systems, vol. 16, no. 8, pp. 889-914, 2000.