Copyright © IFAC Control of Industrial Systems, Belfort, France, 1997
FUZZY LOGIC CONTROLLERS: A COMPARATIVE STUDY
M. Watheq EI-Kharashi and M. A Sheirah
Computer and Systems Engineering Dept., Faculty ofEngineering - Ain Shams University, 1 EI-Sarayat st., 11517 Abbassia, Cairo, Egypt
Abstract: The purpose of this paper is to make a comparative study between some of these methods. The work here is performed in order to foster and promote unbiased and accurate comparison of different FLC techniques. The motivation is to execute this study by the demonstrated good performance of this type of controllers. To assess the usefulness of each tool in designing the controller, the inverted pendulum, lP, as a benchmark problem is selected and then engaged in a comparison of the control system design which results from the application of each control technique. The comparison of these controllers highlights the power and weak points of each technique. Key words:
Fuzzy Logic, Sliding Mode Control, Model Following, Adaptive control.
I. INlRODUCTION
the cart and rod is constrained in the vertical plane.
Practically, fuzzy logic has been successfully applied in many control systems. In this paper evaluation and comparison between: Simple FLC, S-FLC (Berenji 1992); Simple fuzzy sliding mode control, S-FSMC (Lin S. C. et al. 1992, Palm R1992, Boverie S. et al. 1994, Ting C. S. et al. 1994); and Model following FLC, MF-FLC (Kung Y. S. et al. 1994), is presented.
lS-8Im/.?' IJ.·V
f •
~ IJ. - 0.1 Kgls
xv
Fig. (I). Inverted pendulum.
The inverted pendulum, IP, is a classical control problem that admits a mathematical model. So it has been used in the literature as a benchmark to study real world nonlinear control problems. This system is inherently unstable, and has severe nonlinearity. Performance is evaluated in terms of: attributes related to the controller itself, system response to initial conditions, response to noisy control forces, robustness, and sensitivity to disturbance.
System parameters and dynamics : Mass of the cart, M = 2Kg, Mass of the rod, m=IKg, Distance from the pivot to the rod's centered, L=0.5m, Friction coefficient, ~ = 0.1 Kg/s. The system has four variables B. ~ x, and v and one input, f 8(t): Angular displacement of the rod from the vertical direction, w(t) = dB(t)/dt: Rod angular velocity, x(t): Linear displacement of the cart, v = dx(t)/dt: Cart velocity, f Horizontal applied control force. The inverted pendulum model is a fourth order nonlinear system:
2. THE lP-BALANCING PROBLEM 2.1 System Assembly
x
Figure (I) shows the involved lP. The cart can move back and forth along a fixed track. The movement of
=
4([ -
J.Ji) -
1.5 mg sin
2e
+ 4ml
4(M + m) - 3m cos
B= ~ * [g * sinB - i * cosBJ 4L
757
2
e
iJ2 sin e
... ( I)
(2)
2.2 Controller Job
Figure (6) shows the response to initial conditions in the time domain with an initial angle 12.5° for some values of Ko>- The phase plane for one case is shown for demonstration in Fig. (7).
The basic problem is to carry the rod upward in an efficient way from initial, deviated, and stationary positions. The rod should be accelerated to some maximum allowable speed, then slow down and eventually stop when it is close to the upward position.
Table (1). S-FLC linguistic rule table ~e
Highly Left, HI.. Left,L Slightly Left, SL NIT... Slightly Right, SR Right, R Highly Right, HR
2.3 Fuzzy Control Rules (Kosko 1992) The rules to solve this problem may have a commonsensical fonn like: I-If the pendulum tilts to the right, the force should be positive to compensate, 2-The further the pendulum tilts, the larger force should be, and 3-If the rod is just a little bit off center and heading toward it, slow down the cart.
In order to give unbiased and accurate comparison the following will be considered during the study: 1Every item related to the controller structure is presented for comparison: The controller block diagram, All the system membership functions, The rule base, and The control surface, f, 2- The response to initial conditions will be shown in Time domain and/or phase plane, 3- Response to a noisy control signal will be shown. The noise selected is a damped high frequency sinusoidal wave:
and 4-Finally, the examined.
L
HI.. HI.. HI.. HI.. L L HI.. SL SL
HR NIL NIL R HR HR HR HR
Repeat Sample pendulum angle and speed of rotation; f= Kt*(force~defuzzify(FLC~infer (angle.fuzzify (81Ke),speed.fuzzify (Cil/K,.,))); Applyfto the cart; Until end of operation;
3. STUDY FRAMEWORK
N(t) = 2 * (e- 1o o/ + 0.1) * cos(lOO*t) ...
SL NIL SR R NIT... NIL NIL NIL SR SR L SL NIL SR R L SL SL SR SR HR NILNIT... NILR R HR NILNIL NIT...HR HR HR
HI.. HI.. HI.. HI.. HI..
Fig. (3). S-FLC algorithm.
(3)
effect of disturbance will be
Fig. (4). Input and output membership functions
4. SIMPLE FLC CONTROLLER (S-FLC) 1.00
0.75
4.1 The Incorporated FLC ...
,
.
.
.~ S-FLC
1.00
0.75
0.50
025
oo
.B .\.
.o.is 'bot>o
SpHd of rotation
Fig. (2). S-FLC block diagram
Fig. (5). S-FLC control surface
The FLC has, the angle and speed of rotation as an input, and the control force, f as an output, Fig. (2). The rule base is described in table (1). The control algorithm is shown in Fig. (3). Figure (4) shows the input and output membership functions which has a linear shape. Figure (5) shows the control surface.
1\
i! -:···\\·············'v··.······~~.~
;................•............
._.\
1:::\1.· · · -· · 7· · ~· ~.::'::':f\::'::'
. :'
A: : ..."... :.....:... ; .. : . . : : ...:: ....: ....::.::-:: .. : . . .
'0._ 0-
I
il--+---:':-=-:~;:-+.:-b'-T:I~~~~~"""'::'~~~
4.2 Response to Initial Conditions
v~:fJO.~
~
G~
G.'.
..1 ··1
The factor K{j) has a large effect on the dynamic response of the output, the effect of its varying on the dynamic characteristics of the output is investigated.
Fig. (6): Output response in the time domain.
758
i··
........~~.::2~-!~
Fig. (7): Response in the phase plane for
Kw = 600.
.....
Fig. (8): () in response to noisy control force. ..
4.3 Response Under Noisy Control Signal
..
.
.. -··t···-_···__ ·:·········:·····-··'7·__ ···~ Kw· 200
The control force is projected to the noise given in Eq. (3). For K w =200, the angle is shown in Fig. (8).
4.4 Response to disturbance -...-....
Consider an IF under control to be stabilized and suddenly, due to any external force, its deviation from the stable position is altered to a new state defined by a new angle and speed. The response in phase plan is shown in Fig. (9).
Fig. (9): Effect of disturbance.
5. FUZZY SLIDING MODE CONfROL (FSMC)
5.1 The incorporated FLC S-FSMC
The FLC, Fig (10), has as an input, the veroendzcular distance from the linear sliding surface in the phase plane, D. It has as an output the control force, f The control algorithm is shown in Fig. (11). The FLC is a nonnalized one. Figure (12) shows input and output membership functions which, have a bell-shape, GAUSSIAN. The rule base may be described compactly as in table (2). Figure (13) shows the control surface. The design parameters are as follows: Input, the perpendicular distance, D, scaling factor: KD = 10 and Output, control force,/, scaling factor: Kf = 1500.
Fig. (10). S-FSMC block diagram Repeat Sample pendulum angle and speed of rotation; Calculate the perpendicular distance from the linear surface from (1 ) D (C)
=
0 (C) + T·
(J)
(C)
(1)
Jj;T2 / =
Kf * (force ~ defuzzify (FLC ~
infer (distance.fuzzify (DfKo )))); Apply/to the cart; Until end of operation;
Fig. (11). FSMC algorithm
5.2 Response to initial conditions
Table(2). S-FSMC control rules
Here the evaluation of the system response to initial conditions under different time constant, T is shown. Figure (14) shows the rod angle tracking the trajectory with an initial angle 12S. The operation in the phase plane is shown in Fig. (15). Figure (16) shows the input to the controller, the deviation in phase plane, D.
Surface Deviation-S Distant Far
Medium Near Close Exact Positive Negative
5.3 Response Under Noisy Control Signal The control force is projected to the noise given in Eq. (3). For T = 0.10 s, the deviation in the phase plane, D, the model reference error in the time domain, E is shown in Fig. (17).
Control force-f Huge Strong Moderate
Low weak Adequate Positive Negative
5.4 Response To Disturbance Consider an IF under control to be stabilized and suddenly, due to any external force, its deviation from the stable position is altered to a new state 759
defined by a new angle and speed of rotation. The system response is shown in Fig. (18).
..
o'·r . : . . .•. J •. \·1·\ I!
0.0
)
\
-'0
I \) \ ) \ I) \
-0.8
-0.15
-0.2
-0."
;; .. "
0.2
0.4
A-.-..
.\
_
.
,, _.:,::-,;;·o;o~·;;;: ::::::..7.=
0'"
_
-
_
,
_
_
..
_ ..
11";"""
1.0
Fig. (16): Surface deviation, D. .... , -l
"-_ ••
I 06
0.'
-
-1-
,
,
s
_._~~.·_I
,
-.,
i ..
l··· ..·..':'
I
1\
,
--
_,
i
~
1----*-+-1H-+-++--H-t--lH-H-+-+----1t----1
,
~
I~:::~-I-
~: ".~·. ·.·r·.·:~·······~~·~:· L.~ .~-.~~ ~ ~."."~.~.·.1. ·~.
0.2
, .. _
..
...."-'.•. + .. _.._
Fig. (12a): S-FSMC surface deviation, D, membership functions :0"'-
-
\ o,a
0.6
_....
····tl ........ :· ........ ·~'.....
.
I \I \I \
\
0.0
-
'j "•.•:::.:::.::.:.::' :: : : ::.:. ::: . • :.::::.:.: : ::::: :: :::::::: ::.::'::::: i , ,.•..• : -- , , - _ - .
I
L.L'
-
t ::.:
:: ·~~·I\,"·t~A~···~~···if···W;··~~···~T;~~/~··~ .
·····1·· · ;··..····..,"":
· ::
;
-
_
···,··..· ·..·
,.,::-,.:"
-..-
- .. ··,1
· ..·-..·.··-· · ·-· .. ·i
· ..·
-..,
··..·
--
, ,·· ·-· -. · ·
-
TeO.le:scc
.
--
__
,..__.1
;
··
1
· ..· ·..·..·..-,··..··--··..··· · ·.. ·--·1
,
Fig. (17): Reference error in noisy system.
Fig. (12b): S-FSMC control force, f, membership functions.
I
' ,-........
i·...·..
.
~.....
\
:--....,~
,\.-
:
: .._:
:
,.
:,
,:
,·,
~,.= ,'
!~~
:
-·..·1 _
,
'=O,l"~cc
. ,
.
~~:
~IJ _ ..;
[
,..:
:_
:_
;
1
.;~ ·: -:-:::,.,"" ,
:
;
,- ;., _.
1
1
Fig. (18): Effect of disturbance phase plane 6. MODEL FOLLOWING FLC MF-FLC
Fig. (13): S-FSMC control surface
6. J The Incorporated FLC .............R-..•.•.•. +
·.:It:· 0._ .
- ,
+
,-
T".O, .1,.0:. ,• .cc-:::
a._
~._
+ -, ",
+1 _
,.. !
a._ ,
~.~
, , 3._
,
4._
~._
Fig. (19) shows the MF-FLC block diagram. The FLC has as an input, the deviation from the model reference in the time domain, E, and its rate of change, dE, which are calculated by substitute in the selected reference, and as an output the control force, f The membership functions are the same as those for the S-FLC with the same rule base. Figure. (20) shows the control algorithm.
, .
~
,._
Fig. (14): Output response in the time domain.
i~: I --..~" ~ -
t
'-.. ~
"..
~
-.-eo
!"
'1..·..··'..·..···• '1 +·· "
>
oo.ioscc
~::-.
-
·
~"" :::;::..= :
~ '·"""1 .. ··: ·····•.. · ··· .. "
:,.
--c;-.~""'
H'+···-..···--· ¥'
:
_ ..
·.._··..· ·.-;.. ····..·· ..·_··· .. - ~ ""~: , -- ..
,
,
-
·i
·•·· ..·•···
,-..+- .: -,
·
, ..·····,·······
-..,
+. ,
--I
,..-··-:.. ·..···--1 MF-FLC
Fig. (19). MF-FLC block diagram
Fig. (15): Response in the phase plane. 760
The design parameters are as follows: The model reference error scaling factor: KE = 0.01, The model reference change in error scaling factor: KdE = 15, and The control force scaling factor: Kf = 500.
6.4 Response To Disturbance Consider an IP under control to be stabilized and suddenly, due to any external force, its deviation from the stable position is altered to a new state defined by a new angle and rotation speed. The system response is shown in Fig. (26) in phase plane.
Repeat Sample pendulum angle and speed of rotation; Calculate the model reference error from Eq. (4)
E(t) = e - R *e(-tlT) (4) Calculate the model reference error rate from Eq. (5)
1
dE(t) = de + !i*e(·tIT) (5) T f=Kr*(force-+defuzzify(FLC-.+infer(model.fuzzify (ElKE),dmodel. fuzzify( dElK.sE»); Apply f to the cart; Until end of operation;
I t
····I··· .. ·.., ·······~··
·•·······
T
~ ..
,.. ;
= 0.1 O~'.:~:e:c:
I
,
,
,
I
c...
;................. •
_....,
:
!! I--*-'n~~~o:±:~e-'~-:"~~-:'e-":'::~ 1\ /'0... ..- .,.. •.- 0._ •.- 0._ .l
. "''1
Fig. (20) S-FSMC algorithm
6.2 Response to Initial Conditions
Fig. (23): Surface deviation, D.
Evaluation of the system response to initial conditions under different time constant, T will be considered. Figure (21) shows, in the time domain, the rod angle tracking a first order trajectory with an initial angle 12.5°. The phase plane is shown'in Fig. (22). Figure (23) shows the input to the controller. Fig. (24) shows the model reference error, E, in the time domain.
;
..'·"'··1········..··........·-··........,..·..·· ·.....···..··..··,·..·.... ,.... .,..... •
..
~
~,_
:
.._.~~_ .. ~ \\
~
T._.• .••O I
o
ee
... -..~ ........
;
;
+__
,
L
.
,
..
11-._·...._····1-·-1.-:::-: \=--=:-.:--::-:-::--".,=:--::-=-~,...--;:--=--=-'=-::-:=-i o.~ ~ 0._
O.-..a
0
0
..•'!.~.•..
....,
t.:-
,
,
, _
_c
,
·+····1
,
Fig. (24): Model reference error, E.
1,..~
:
} ······..····1···:
........·..·1- · a.~.
0._
0._
o.~
0._
0__
0._
!···-~·..····
o~
i
; , ; .;.
+..
,
'r"
·..· ..·······•··..·.... ..•. .. _.,
,
1
:...
1
,-
.-.,.-.~.:.--r~.~·-~~~.·.~~-~o~·~r~·~_~~o.~_-:'o-.::._~_~._~
~~
Fig. (21): Output response in the time domain.
:
..,-....................................... ·· .. 1 ; : -; '1
T"'··_".'Oc :I.. ~·· ·c.."..·•.. : ..·..··..···;,"'"
·:
_., '
~
:
6.3 Noisy Control Force Response Fig. (25): Reference error, E in noisy system. The control force is projected to the noise given in Eq. (3). For T = 0.10 seconds, the deviation in the phase plane, D, the model reference error in the time domain, E is shown in Fig. (25).
!..-... ~ .. ....
.
"-t
j .. , - .:
.~~
.... """ "'--:----1··
\...........
. . . . . . . .c. . . .,.._;.. . . ·.·__..:. ·.· . · ,. \ ·- :. ·.· ,. . .
~I'"
~o
:~::7
l...:..-..;.....~=~
. :. .· .
_
,
__ c . ,
.
........•...
Fig. (22):Output response in the phase plane.
761
, .. ··..·..·..·..
~· · ~
'-_
'
.. I
:::::··1
.
-..... -" "'I.L", ·_· · .. c
Fig. (26): Effect of disturbance.
· ·····j
,=r.. . ;. ; ·i ~
. .
·~;';'.I··""···""·"-"·""""·"-""··"·"'''·''''··'''''····''·''·'''''''·
:I
T - O.IO.cc
.. ::::.::'; '" """ .
~ ~.... .. __..••.•.•..
., """ ..,
.. . . . - \
!
;./':"1
:...
,.
T = o..I .lu ) """
~ ~...:~:
1~~. ?'~:~""' ~ ;. Eh<>..
!~~.-"'. ~:: ;_ ". ;.
~Ic.._
.•,
;
.. +i
+ _.
"::-.~,,""- 4
..
7. COMPARATIVE STIJDY
Table (5). Input generation evaluation Evaluation will be made quantitatively in some parts. While in other parts, this will be made qualitatively. The perfonnance is graded as (Bad, Weak, OK, Good, Excellent), for each technique in relation to the aspect under evaluation. In testing, the response to a certain quantity will be given weights such as (Nil, Moderate, High, Huge). It has to be noted that, in this study each technique is first tuned to give its best perfonnance and evaluation is based on this structure.
Evaluation
S-FLC Excellent
S-FSMC OK
MF-FLC Weak
Inference Process, Table (6) : Comparison from the view points of the number of rule antecedents, and the number of inference engines for system variables and the number of layers. Table (6). Inference process evaluation
7.1 Control/er structure
# Antecedents # Inference
Fuzzy Sets : Here comparison will be from the view points of: number of fuzzy sets and subsets in each, subset distributions, Table (3).
process Layers Evaluation
S-FLC
S-FSMC
MF-FLC
2 I
I I
2 I
I
I
I
Good
Excellent
Good
Table (3). Fuzzy sets evaluation # Input sets # Subsets
Fuzzy parameters Fuzzy weights Linear Distribution Sensitivity to shape Sensitivity to membership function Evaluation
S-FLC
S-FSMC
2
I 11 x x x
7 x x ./
2
7 x x ./
Nil
Nil
Moderat e Nil
Good
OK
Good
Nil
Denorrnalization, Table (7) : For S-FLC and MFFLC, mapping the controller output to force linearly but for S-FSMC mapping the controller output to force nonlinearly.
MF-FLC
Table (7). Denormalization evaluation Evaluation
S-FLC Excellent
S-FSMC Good
MF-FLC Excellent
Trial and Error Size, Table (8) : Comparison will be on number of scaling factors and whether they need trial and error or not.
Nil
7.2 Controlling Dynamic Quantities, Table (9)
Rule Base, Table (4) : Evaluation will be made according to: number of antecedents, fuzziness, number of required rules. For the system parameter, assume (m) subsets. In rule extraction: The S-FLC, and MF-FLC are based on the dynamic signal analysis of the output. The FSMC based method is based on a nonlinear gain.
This means getting an output with precise quantities such as (1.2 sec settling time). Some of the methods under study has an explicit method to allow controlling the dynamics characteristics of the output. This is mainly related to the concepts behind the method. S-FLC: Varying the rotation scaling factor, K", gives different responses. However, these responses can not be described, quantitatively. FSMC: Enable us to vary the sliding surface in the phase plane which enforces the system to inherent some dynamic quantities. Varying these quantities is done by selecting the time constant, T. MF-FLC: A reference model is selected to follow its evolution with time.
Controller Input Generation, Table (5) : S-FLC: The error signal and change in it are input directly to the FLC. S-FSMC: Needs calculating the perpendicular distance from the surface at each state. MF-FLC: Needs generating the reference model with time, and evaluating its change. Table (4). Rule base evaluation
7. 3 Initial Conditions Response S-FLC # Antecedents Unity Rule Fuzziness # Rules Ex: (N=7, M=3) Rule Extraction Evaluation
S-FSMC
MF-FLC
2
I
2
./
./
./
n2
n 7 Excellent Excellent
n2
49
OK Weak
S-FLC: Evaluation will be made via the integral of absolute error, e, and the control force,! S-FSMC: EvaluatiOlI will be made via the integral of absolute: first order system, E, linear sliding surface deviation, D, and the control force,! MF-FLC: Evaluation will be made via the integral of absolute: model reference
49
OK Weak
762
Table (12). Control force evaluation
error, E, phase plane trajectory, D, and the control force,! Table (8). Trial and error size evaluation
# Scaling Factors Trial and Error (Scaling Factors) Trial and Error (Fuzzy Sets) Trial And Error (Fuzziness) Evaluation
SFLC
S-FSMC
MF-FLC
3
2
3
,/
,/
,/
x
,/
x
x
l<
x
OK
Excellent
OK
Chattering JIForce I Max. Force Evaluation
S-FLC
S-FSMC
MF-FLC
x
,/
,/
Bad Bad
Good
OK
Excellent
good
,/
x
l<
Bad
Good
OK
S-FLC Bad Oscillates
S-FSMC
Good
MF-FLC OK
,/
,/
OK
Good
Good
OK
Good
OK
Good
OK
good
REFERENCES
Bad
Bad
Berenji H. R., (1992). Fuzzy logic controllers, in Yager R. R., and zadeh L. A., An introduction
to fuzzy logic applications in intelligent systems, Kluwer Academic Publishers, New York, pp. 69-96. Boverie S., Cerf P., and Le Quellec 1. M., (1994). Fuzzy sliding mode control application to idle speed control. In Proc. of the Third IEEE International conference on fuzzy systems, pp. 974-977, Orlando, Florida. Kosko B., (1992). Neural networks and fuzzy systems: A dynamical system approach to machine intelligence. Prentice Hall, Englewood
7.4 Response to Disturbance
S-FLC: The steady state oscillations increase after the disturbance. S-FSMC: This takes the same surface as a target to slide over, which takes some time to reach the surface. However, as the surface is static with time, the system may be able to follow the surface quickly. MF-FLC: This is affected heavily by the disturbance as it compares the response with a model reference generated by time. So even the output is deviated from its state, the reference is not affected. So compared with M-FSMC, the time factor in the reference greatly affects the response to the disturbance.
Cliffs, New Jersey Kung Y. S., and Liaw C M. (1994). A fuzzy
controller improving a linear model following controller for motor drives, IEEE Trans. Fuzzy. Syst., vol. 2, no. 3, pp. 194-202. Lin S. C, Kung C C, (1992)A linguistic fuzzysliding mode controller, in Proc. of the American Control Conference, pp. 1904-1905. Palm R., (1992). Sliding mode fuzzy control, In Proc.
Table (11). Phase plane evaluation
Performance Chattering JIDeviation I Max.Deviation Evaluation
OK
There is not enough evidence to conclude that one FLC technique could replace the other. In principle, all controllers could perform similarly. Ease of design and implementation would be the deciding criteria for selection as well as familiarity with the tool. Familiarity with the tool (control) and system are two issues of the success of any controller design. One must be careful not to over generalize the results of these simulation based on the lP, as while the results somewhat promising, it lacks: 1- A mathematical analysis of the stability and convergence properties of the FLCs. Up till now there is no guarantee of stability or convergence. 2An analysis of how well the knowledge base of the FLC is filled in. 3- Comparison of only five types of FLCs, with one application, for a limited class of reference inputs is demonstrated.
Table (10). Time domain evaluation
Performance Steady state JIModel error I JIOutput error I Max. model error Evaluation
MF-FLC Bad OK
good
S-FSMC Excellent Excellent Bad
8. CONTROL ENGINEERING PERSPECTIVE
Table (9). Controlling dYnamic quantities evaluation
Quantitatively Accuracy Easiness Oscillations Evaluation
S-FLC OK Bad
S-FLC Weak Weak
Weak
S-FSMC Good
Excellent Bad
good Good
MF-FLC OK OK Bad OK OK
of the First IEEE International conference on fuzzy systems, pp. 519-526, San Diego. Ting CS., and Li T., and Kung F. C, (1994). Fuzzy sliding mode control of nonlinear system. In Proc. of the Third IEEE International conference on fuzzy systems, pp. 1620-1625, Orlando, Florida.
763