You are on page 1of 9

Bacterial Foraging Based Optimization Design of Fuzzy

PID Controllers

Hung-Cheng Chen

Department of Electrical Engineering, National Chin-Yi University of Technology,


35, Lane 215, Sec. 1, Chungshan Road, Taiping, Taichung 411, Taiwan
hcchen@ncut.edu.tw

Abstract. In this paper, a bacterial foraging optimization scheme (BFOS) is


proposed for the multi-objective optimization design of a fuzzy PID controller
and applies it to the control of an active magnetic bearing (AMB) system. Dif-
ferent from PID controllers with fixed gains, the fuzzy PID controller is ex-
pressed in terms of fuzzy rules whose rule consequences employ analytical PID
expressions. The PID gains are adaptive and the fuzzy PID controller has more
flexibility and capability than the conventional ones. Moreover, it can be easily
utilized to develop a precise and fast control algorithm in optimal design. The
BFOS is used to design the fuzzy PID controller. The centers of the triangular
membership functions and the PID gains for all fuzzy control rules are selected as
parameters to be determined. The dynamic model of AMB system for axial mo-
tion is also presented. The simulation results of this AMB system show that a
fuzzy PID controller designed via the proposed BFOS has good performance.
Keywords: Bacterial foraging optimization, Active Magnetic Bearing, Fuzzy
PID Controller.

1 Introduction

In the past decades, conventional PID controllers are widely applied in industry process
control. This is mainly because PID controllers have simple control structures, and are
simple to maintain. [1,2]. To design such a controller, the proportional gains, the inte-
gral gains, and the derivative gains must be determined. However, a conventional PID
controller may have poor control performance for nonlinear and/or complex systems
that have no precise mathematical models. Various types of modified traditional PID
controllers such as auto-tuning and adaptive PID controllers were developed to over-
come these difficulties [3,4]. Since the PID gains are fixed, the main disadvantage is
that they usually lack in flexibility and capability. Recently, many researchers at-
tempted to combine conventional PID controllers with fuzzy logic [5,6]. Despite the
significant improvement of these fuzzy PID controllers over their conventional coun-
terparts, it should be noted that they still have some disadvantages. For example, the
locations of the peak of the membership functions are fixed and not adjustable, and the
fuzzy control rules are handed-designed rules.
To overcome the weaknesses mentioned above, we propose a multi-objective op-
timization method for the parameter tuning of fuzzy PID controllers based on a

D.-S. Huang et al. (Eds.): ICIC 2008, LNCS 5226, pp. 841 – 849, 2008.
© Springer-Verlag Berlin Heidelberg 2008
842 H.-C. Chen

bacterial foraging optimization scheme (BFOS) to solve the control problem of an


AMB system. In this scheme, the foraging behavior of E. coli bacteria present in our
intestines is mimicked. They undergo different stages such as chemotaxis, swarming,
reproduction, elimination and dispersal [7,8]. In the proposed BFOS-tuning method,
a cost function is defined in a systematic way such that the centers of the triangular
membership functions and the PID gains for all fuzzy control rules can be selected as
parameters to be determined. The performance of this controller will be verified by
the simulation results.

2 Fuzzy PID Controllers

In fuzzy PID controllers, the input variables of the fuzzy rules are the error signals and
their derivatives, while the output variables are the PID gains. The rules of a dou-
ble-input and single input (DISO) fuzzy PID controller are usually expressed as
Rij : IF x is Ai and y is B j

THEN u ij (t ) = K Pij e(t ) + K Iij ∫ e(t )dt + K Dij e(t ) (1)

where x denotes e(t) and x ∈ X , y denotes e(t ) and y ∈ Y , i=1,2,...,n, j=1,2 ,...m,
u(t) denotes output variable. Employing singleton fuzzifier, sum-product inference, and
center-average defuzzifier, the output of a fuzzy PID controller is expressed as

n m

∑∑ w ( x, y) u
i =1 j =1
ij
ij

u (t ) = n m (2)
∑∑ w ( x, y)
i =1 j =1
ij

where wij ( x, y ) = Ai ( x) B j ( y ) is the firing strength of the rule denoted as Rij.


The membership functions of input variables commonly adopt triangular functions
in order to convenience calculation. In this paper, we assume that X and Y are universes
of discourse for input variables e and e respectively. { Ai ( x ) ∈ F ( X ), i = 1,2,..., n}
are a cluster of fuzzy sets on X with triangular membership functions as shown in
Fig. 1. The apexes of { Ai } are denoted as xi, and conform to x1 < x2 < ... < xn . The
membership functions of { Ai } can be calculated by

⎧ ( x − xi −1 ) /( xi − xi −1 ), x ∈ [ xi −1 , xi ], i = 2,3,..., n

Ai ( x) = ⎨( xi +1 − x) /( xi +1 − xi ), x ∈ [ xi , xi +1 ], i = 1,2,..., n − 1 (3)
⎪ 1, x < x1 or x > xn

Bacterial Foraging Based Optimization Design of Fuzzy PID Controllers 843

y Ai ( x ) Ai + 1 ( x )
1
In put
M Fs
x
xi x x i +1 xn

ym

( i , j + 1) ( i + 1, j + 1)
y j +1
B j +1 ( y ) Inference C ell
IC ( i , j )
y
B j (y) (i, j ) ( i + 1, j )
yj

Fig. 1. The membership function of { Ai } and {B j }

Similar to { Ai } , {B j ( y ) ∈ F (Y ), j = 1,2,..., m} are also a cluster of fuzzy sets


on Y with triangular membership functions as shown in Fig. 1, the apexes of {B j } are
denoted as yj, and conform to y1 < y2 < ... < ym . The membership functions of
{B j } can be calculated by
⎧ ( y − y j −1 ) /( y j − y j −1 ), y ∈ [ y j −1 , y j ], j = 2,3,..., m

B j ( y ) = ⎨ ( y j +1 − y ) /( y j +1 − y j ), y ∈ [ y j , y j +1 ], j = 1,2,..., m − 1 (4)
⎪1, y < y1 or y > y m

The rule base plane can be decomposed into many inference cells (ICs) with output
rules on its four corners, as shown in Fig. 1. The inference can be operated on these ICs.
Assume that xi and xi+1 are any two adjacent apexes of { Ai } , yj and yj+1 are any two
adjacent apexes of {B j } . xi ≤ x ≤ xi +1 , y j ≤ y ≤ y j +1 forms an inference cell
IC(i,j) in X × Y input space. See Fig. 1. On the activated inference cell IC(i,j), the
output of the fuzzy PID controller adopts dualistic piecewise interpolation functions of
parameters of rule consequences, as follows [9]
i +1 j +1 i +1 j +1
u (t ) = [∑∑ wst ( x, y ) K Pst ] e(t ) + [∑∑ wst ( x, y ) K Ist ] ∫ e(t )dt
s =i t = j s =i t = j
i +1 j +1
(5)
+ [∑∑ wst ( x, y ) K ] e(t ) st
D
s =i t = j

Equation (5) is an analytical model of fuzzy PID controller.

3 BFOS-Based Optimal Fuzzy PID Controller Design


The output trajectory of a sign-symmetry system is symmetrical to the original when
the initial conditions and inputs are changed in sign. In many case, just like the AMB
controller discussed in this paper, the system that has nonlinear control plant is also
844 H.-C. Chen

sign-symmetry. We select that the input variables e(t) and e(t ) are divided into 5
fuzzy sets named as Negative Big (NB), Negative Small (NS), Zero (ZO), Positive
Small (PS), Positive Big (PB), respectively. The 5 fuzzy sets employ 50% overlapped
triangular membership functions on the universe of discourse. Thus the parameters of
input variables can he simplified to 4: the apex position x4 of PS and x5 of PB for e(t),
y4 of PM and y5 of PB for e(t ) . The PID expressions of fuzzy control rule conse-
quences, each has 3 modulus, are sign-symmetry. Therefore, when the membership
functions of input variables are symmetrical to 0, there are only 15 independent rules in
the 25 fuzzy control rules described in (1). In this way, there are totally 49 parameters to
be determined when implementing a BFOS.
Natural selection tends to eliminate animals with poor foraging strategies and favor
the propagation of genes of those animals that have successful foraging strategies, since
they are more likely to enjoy reproductive success. After many generations, poor for-
aging strategies are either eliminated or shaped into good ones. This activity of foraging
led the researchers to use it as an optimization process. The E. coli bacteria that are
present in our intestines also undergo a foraging strategy. The control system of these
bacteria that dictates how foraging should proceed can be subdivided into four sections:
chemotaxis, swarming, reproduction, and elimination and dispersal:
(a) Chemotaxis: This process in the control system is achieved through swimming
and tumbling via flagella. Therefore, an E. coli bacterium can move in two different
ways: it can run (swim for a period of time) or it can tumble, and alternate between
these two modes of operation in its entire lifetime. To represent a tumble, a unit length
random direction, say, φ ( j ) , is generated; this will be used to define the direction of
movement after a tumble. In particular
θ i ( j + 1, k , l ) = θ i ( j , k , l ) + C (i )φ ( j ) (6)

where θ i ( j , k , l ) represents the ith bacterium at jth chemotactic, kth reproductive and
lth elimination and dispersal step. C(i) is the size of the step taken in the random di-
rection specified by the tumble (run length unit).
(b) Swarming: When a group of E. coli cells is placed at the centre of a semisolid
agar with a single nutrient sensor, they move out from the centre in a traveling ring of
cells by moving up the nutrient gradient created by consumption of the nutrient by the
group. The spatial order results from outward movement of the ring and the local re-
leases of the attractant; the cells provide an attraction signal to each other so they
swarm together. The mathematical representation for swarming can be represented by:
S
Jcc (θ , P( j, k, l )) = ∑ Jcci (θ , θ i ( j, k , l ))
i =1
S p S p
(7)
= ∑[−datt exp(−ωatt ∑(θm − θ ) )] + ∑[−hrep exp(−ωrep ∑(θm − θ ) )]
i 2
m
i 2
m
i =1 m=1 i =1 m=1

where J cc (θ , P( j , k , l )) is the cost function value to be added to the actual cost


function to be minimized to present a time varying cost function. S is the total number
of bacteria, p the number of parameters to be optimized that are present in each
Bacterial Foraging Based Optimization Design of Fuzzy PID Controllers 845

bacterium and d att , ωatt , hrep , ωrep are different coefficients that are to be chosen
properly.
(c) Reproduction: The least healthy bacteria die and the other healthiest bacteria
each split into two bacteria, which are placed in the same location. This makes the
population of bacteria constant.
(d) Elimination and dispersal: It is possible that in the local environment the life of a
population of bacteria changes either gradually (e.g. via consumption of nutrients) or
suddenly due to some other influence. Events can occur such that all the bacteria in a
region are killed or a group is dispersed into a new part of the environment. They have
the effect of possibly destroying the chemotactic progress, but they also have the effect
of assisting in chemotaxis, since dispersal may place bacteria near good food sources.
From a broad perspective, elimination and dispersal are parts of the population-level
long-distance motile behavior. This Section is based on the work in [7]. As this paper
concentrate on applying the new method to fuzzy PID design an in-depth discussion
over the bacterial foraging strategy is not given here. The detailed mathematical deri-
vations as well as theoretical aspect of this new concept are presented in [7]. The
overall flowchart is shown in Fig. 2.
To evaluate the controller performance and get the satisfied transient dynamic, the
cost function includes not only the four main transient performance indices, overshoot,
rise time, settling time and cumulative error, but also the quadratic term of control input
to avoid that the control energy became too big. The cost function is designed as

J =1 ∫ 0
[ω1te 2 (t ) + ω 2u 2 (t )]dt + ω3t r + ω4σ + ω5t s (8)

where e(t) is the system error, u(t) is the controller input,tr is the rise time, σ is the
maximal overshoot, t s is the settling time with 5% error band, ω1 , ω2 , ω3 , ω4 , ω5 are
weighting coefficients. This research has picked the weighting coefficients
ωi = 0.2, i = 1,2, … ,5 to cover all the performance indices completely.

STA RT 1

choose P , S , N c , N s , N re ,
N ed , Ped , C ( i ) ∈ R S tumble Δ (i ) ∈ R P i = 1, 2 , ,S
set i = 1, j = 1
pick d att ( h rep ), ω att , ω rep
chemotaxis and swarming
initial value θ i ∈ R S
N
i=i+1 i=S
set j = k = l = 1 Y
N
j=j+1 j=Nc
J (i , j , k , l ) = J ( i , j , k , l ) Y
+ J cc (θ i ( j , k , l ), P ( j , k , l )) reproduction
N
i
J last i = 1,2 , ,S j=1, k=k+1 k=Nre
Y
elimination and dispersal
1
N
j=1, k=1, l=l+1 l=Ned
Y
find best J last

END

Fig. 2. The overall flowchart of BFOS


846 H.-C. Chen

4 Simulations and Discussion

Fig. 3 shows the schematic of the controlled AMB system. It consists of a levitated
object (rotor) and a pair of opposing E-shaped controlled-PM electromagnets with coil
winding. An attraction force acts between each pair of hybrid magnet and extremity of
the rotor. The attractive force each electromagnet exerts on the levitated object is
proportional to the square of the current in each coil and is inversely dependent on the
square of the gap. The entire system becomes only one degree of freedom of one axis,
namely the axial position. Assuming a minimum distance to the length of the axis, the
two attraction forces assure the restriction of radial motions of the axis in a stable way.
The rotor position in axial direction is controlled by a closed loop control system,
which is composed of a non-contact type gap sensor, a fuzzy PID controller and an
electromagnetic actuator (power amplifier). This control is necessary since it is im-
possible to reach the equilibrium only by permanent magnets.
The rotor with mass m is suspended. Two attraction forces F1 and F2 are produced
by the hybrid magnets. The applied voltage E from power amplifier to the coil will
generate a current i which is necessary only when the system is subjected to an external
disturbance w. Equations governing the dynamics of the system, linearized at the op-
eration point (y=yo, i=0), are

E lectro m agn et
Pow er
A m plifier

P erm anent
M agnet
Rotor
Fu zzy PID
C ontroller

G ap
Sensor

Input Signal
B ase

Fig. 3. The schematic of the controlled AMB system

⎡Δy ⎤ ⎡ 0 1 0 ⎤ ⎡Δy ⎤ ⎡0⎤ ⎡0⎤


d ⎢ ⎥ ⎢
Δy = a21 0 a23 ⎥⎥ ⎢⎢Δy ⎥⎥ + ⎢⎢0⎥⎥ E + ⎢⎢d ⎥⎥ w (9)
dt ⎢ ⎥ ⎢
⎢⎣ Δi ⎥⎦ ⎢⎣ 0 a32 a33 ⎥⎦ ⎢⎣ Δi ⎥⎦ ⎢⎣b⎥⎦ ⎢⎣ 0 ⎥⎦
where

1 ∂ ΔF 1 ∂ ΔF N ∂ Δφ
a21 = , a23 = , a32 = − (10)
m ∂y m ∂ Δi L ∂y
Bacterial Foraging Based Optimization Design of Fuzzy PID Controllers 847

R 1 1 ∂ Δφ
a33 = − , b= , d = , L=N (11)
L L m ∂ Δi
y is the distance from gap sensor to bottom of rotor. R and N are the resistance and
number of turns of the coil. φ1 and φ2 are the flux of the top and bottom air gap,
respectively.
To demonstrate the feasibility of the proposed scheme, the fuzzy PID controller is
designed based on the proposed BFOS. The searched 49 optimal parameters including
the triangular membership functions and the PID gains of fuzzy control rules are shown
in Table 1 and Table 2, respectively.

−3
Table 1. Center and width values of the optimized membership function ( × 10 )

e(t ) e(t )
center width center width
NB -2.3702 0.9235 -892.02 249.36
NS -2.0765 2.3702 -750.64 892.02
ZO 0 4.1530 0 1501.28
PS 2.0765 2.3702 750.64 892.02
PB 2.3702 0.9235 892.02 249.36

Table 2. The optimized PID gains of fuzzy control rules

e(t )
K Pij
NB NS ZO PS PB
NB 3.2072 2.5176 5.8527 3.0434 3.3078
NS 2.5176 2.3537 5.7214 3.9418 2.1030
e(t ) ZO 5.8527 5.7214 5.4519 3.3293 4.9865
PS 3.0434 3.9418 3.9418 4.1751 3.8631
PB 3.3078 2.1030 4.9865 3.8631 2.9493
e(t )
K Iij
NB NS ZO PS PB
NB 47.054 26.107 98.298 39.332 49.041
NS 26.107 32.259 43.730 12.285 71.399
e(t ) ZO 98.298 43.730 20.220 81.691 4.5374
PS 39.332 12.285 81.691 23.286 44.780
PB 49.041 71.399 4.5374 44.780 21.041
e(t )
K Dij
NB NS ZO PS PB
NB 0.078019 0.035901 0.059289 0.037525 0.054979
NS 0.035901 0.023338 0.066779 0.050989 0.090065
e(t ) ZO 0.059289 0.066779 0.061549 0.016826 0.099087
PS 0.037525 0.050989 0.016826 0.044090 0.068130
PB 0.054979 0.090065 0.099087 0.068103 0.084035
848 H.-C. Chen

The step responses of rotor position from the gap sensor in the AMB system using
the optimized fuzzy PID controller and the optimized conventional PID controller are
shown in Fig. 3. It shows that the fuzzy PID controller has remarkably reduced the
overshoot and settling time compared with the optimized conventional PID controller.
The fuzzy PID controller has achieved good performances in both transient and steady
state periods. Fig. 4 shows the converging patterns of the PID parameters. The PID
gains are adaptive and the fuzzy PID controller has more flexibility and capability than
the conventional ones.

0 .0 0 4
O p tim iz e d F u z z y P ID
O p tim iz e d P ID

0 .0 0 3
Position (m)

0 .0 0 2

0 .0 0 1

0 .0 0 0
0 1 2 3 4 5

T im e ( s e c )

Fig. 4. The step responses of rotor position from the gap sensor in the AMB system using the
optimized fuzzy PID controller and the optimized conventional PID controller

(a) (b)

(c)

Fig. 5. The converging patterns of the PID parameters (a) Kp (b) Ki (c) Kd
Bacterial Foraging Based Optimization Design of Fuzzy PID Controllers 849

5 Conclusions
This paper has proposed a bacterial foraging optimization scheme for the
multi-objective optimization design of a fuzzy PID controller and applies it to the
control of an AMB system. Another merit of the proposed scheme is the way to define
the cost function based on the concept of multi-objective optimization. This scheme
allows the systematic design of all major parameters of a fuzzy PID controller and then
enhances the flexibility and capability of the PID controller. Since the PID gains gen-
erated by the proposed scheme are expressed in the form of fuzzy rules, they are more
adaptive than the PID controller with fixed gains. The simulation results of this AMB
system show that a fuzzy PID controller designed via the proposed BFOS has good
performance.

Acknowledgments. The research was supported in part by the National Science Council
of the Republic of China, under Grant No. NSC 96-2221-E-167-029-MY3.

References
1. Bennett, S.: Development of the PID Controller. IEEE Control Syst Mag. 13, 58–65 (1993)
2. Chen, G.: Conventional and Fuzzy PID Controller: An Overview. Int. J. Intell. Control
Syst. 1, 235–246 (1996)
3. Na, M.G.: Auto-tuned PID Controller Using a Model Predictive Control Method for the
Stream Generator Water Level. IEEE T Nucl. Sci. 48, 1664–1671 (2001)
4. Lin, L.L., Jan, H.Y., Shieh, N.C.: GA-based Multiobjective PID Control for a Linear
Brushless DC Motor. IEEE T Mech. 8, 56–65 (2003)
5. Misir, D., Malki, H.A., Chen, G.: Design and Analysis of a Fuzzy Proportional- Inte-
gral-Derivative Controller. Int. J. Fuzzy Set Syst. 79, 297–314 (1996)
6. Tao, C.W., Taur, J.S.: Robust Fuzzy Control for a Plant with Fuzzy Linear Model. IEEE T
Fuzzy Syst. 13, 30–41 (2005)
7. Passino, K.M.: Biomimicry for Optimization, Control, and Automation. Springer, London
(2005)
8. Mishra, S.: A Hybrid Least Square-Fuzzy Bacterial Foraging Strategy for Harmonic Esti-
mation. IEEE T Evolut. Comput. 9, 61–73 (2005)
9. Xiu, Z., Ren, G.: Optimization Design of TS-PID Fuzzy Controllers Based on Genetic Al-
gorithms. In: 5th World Congress on Intelligent Control and Automation, Hangzhou, China,
pp. 2476–2480 (2004)