Académique Documents
Professionnel Documents
Culture Documents
Dpartement dInformatique
Laboratoire de Microinformatique
Jelena Godjevac
LAMI IN F EPFL Ecublens
1015 Lausanne
email: godjevac@di.epfl.ch
Abstract
The goal of this work is to make an analysis of the performances of a fuzzy controller and a
comparative study of fuzzy control algorithms with a conventional control approach (PID)
in the case of linear dynamic process control. This comparative study is made using computer simulation.
The first part is devoted to the formal framework of the theory of fuzzy sets and fuzzy controllers. The second part of this paper is a description of a simulated system, and a presentation of simulated controllers. In the second part, fuzzy controller is examined in details. A
sensitivity of the fuzzy logic controller to design parameters, different shapes and superposition of membership functions, is tested. Moreover, the simulations are done for the different types of fuzzy reasoning and defuzzification methods.
1. Introduction
The humans, when making decisions tend to work with vague or imprecise concepts which can often be
expressed linguistically. One of the ways of modelling this decision making process has been proposed
by Zadeh [Zadeh65] and is based on the theory of Approximate Reasoning which enables certain
classes of linguistic statements to be treated mathematically. First investigations by prof. Zadeh
[Zadeh73] concerned how to use mathematical tools to represent a human language and human knowledge. He was the first who introduced the term of fuzzy rules and linguistic variables in control theory.
His paper from 1972 [Zadeh72] claims that fuzzy algorithms underlie much of human thinking. We use
them both consciously and subconsciously when we walk, park a car, recognize patterns. This use is
more intuitive and qualitative than systematic and quantitative. Moreover, Zadeh believes that the modern control theory must become less preoccupied with mathematical rigor and precision, and more concerned with the development of qualitative or approximate solutions to pressing real world problems. In
short, he proposed that all problems in which the data, the objectives and the constraints are too complex, or too ill-defined to admit a precise mathematical analysis have to be treated by approximate
(fuzzy) solutions. This new approach is receiving more and more attention, not only in test cases but
also in industrial applications.
Fuzzy controllers were developed to imitate the performance of human expert operators by encoding
their knowledge in the form of linguistic rules [Mamdani75]. They provide a complementary alternative to the conventional analytical control methodology. Some authors argue that fuzzy controllers are
suitable where a precise mathematical model of the process being controlled is not available [Kickert78] [Li88]. But, it is impossible to build a controller which need not assume anything about its environment.
An often remarked disadvantage of the methods based on the fuzzy logic is the lack of appropriate tools
for analysing the controllers performance, such as stability, optimality, robustness, etc. The main advantage is the possibility to implement a human experience, intuition and heuristics into the controller.
The goal of this work is to study the performances of a fuzzy controller and to compare it with a classical control approach. In the first part, the basic notions of fuzzy logic will be presented. The second part
is devoted to the description of the fuzzy controller, its architecture and the different types of fuzzy reasoning. The third part is the presentation of the linear system simulated in order to test the performance
of the fuzzy controller, and after a classical control approach will be presented. The last part is devoted
to the analyse of the results of simulation.
In the classical set theory one element can either belong to a set, or not. This property can be represented by a degree of membership. In the case shown before, the element b belongs to A, and its degree
of membership is 1. The element a doesnt belong to A and its membership is 0. We can form a function
which represents this property:
A ( x) = {
1
0
if x A
if' x A
This concept is basic in the classical set theory. The main concept of fuzzy theory is a notion of fuzzy
set. Fuzzy set is an extension of crisp set. Zadeh [Zadeh65] gave the following definition:
A fuzzy set is a class of objects with a continuum of grades of membership. Such a set is characterized
by a membership (characteristic) function which assigns to each object a grade of membership ranging
between zero and one.
After him, many authors found different ways of denoting fuzzy sets. Zimmermann [Zimmerman90]
writes:
A fuzzy set is denoted by an ordered set of pairs, the first element of which denotes the element (x) and
the second (A(x)) the degree of membership:
A = { x, ( x ) x X }
A
2.1.1
2.1.2
or:
Note that in the above definition, / does not refer to a division and is used as a notation to separate the
membership of an element from the element itself.
Fuzzy sets can be regarded as a generalization of the concept of the ordinary (simple, crisp) sets whose
membership function only takes two values {0,1}.
2. 2 Linguistic variable
We can use fuzzy sets to represent linguistic variables. Linguistic variables represent the process states
and control variables in a fuzzy controller. Their values are defined in linguistic terms and they can be
words or sentences in a natural or artificial language. For example, for the linguistic variable: temperature, we can define a set of terms:
2. 3 Membership function
Every fuzzy set can be represented by its membership function. In the example above, the referential set
is a finite set. Membership values are discrete values defined in the [0,1]. If the referential set is infinite
set, we can represent these values as a continuous membership function. In general, the shape of membership function depends of the application and can be monotonic, triangular, trapezoidal or bell-shaped
as shown in Figure 1.
1
FIGURE 1. Different shapes of membership functions: monotonic, triangular, trapezoidal and bell-shaped
Suppose that we want to represent the property: positive small for the linguistic variable: temperature
(Figure 2). In the example below, if the measured temperature in one system is x, then the level of membership of x in the fuzzy set positive small is given by (x) (Figure 2) and it is 0.8. We can say that the
level of truth for the proposition: The temperature x is positive small is 0.8 or 80%.
1
(x)
(0.8)
positive small
temperature
temperature
NEGATIVE
BIG
NEGATIVE
MEDIUM
NEGATIVE
SMALL
POSITIVE
SMALL
ZERO
POSITIVE
MEDIUM
POSITIVE
BIG
One of the first steps in every fuzzy application is to define the universe of discourse (dynamic range)
4
for every linguistic variable. The set of terms: T(temperature) can be characterized as fuzzy sets whose
membership functions are shown in Figure 3. Every fuzzy set in a universe of discourse represents one
linguistic value or label.
and
BBE
It means that the Aristotelian non contradiction is not acceptable with fuzzy sets.
2. 4. 2 Intersection or Triangular Norms
For the intersection of fuzzy sets Zadeh [Zadeh65] suggested the min operator and the algebraic product. Following Zadehs idea a lot of researchers proposed various operators for this operation. [Zimmerman90]
Let A and B be two fuzzy sets in U universe of discourse, with membership functions A and B
respectively. The most important intersection operators are:
min operator
A(x) and B(x) = min { A(x), B(x)}
algebraic product
A(x) and B(x) = A(x)*B(x)
bounded product
A(x) and B(x) = max (0, A(x)+B(x)-1)
drastic product
x
A and B = y
if y = 1
if x = 1
if x,y < 1
Einstein product
A ( x) B ( x)
A and B = ------------------------------------------------------------------------------------------2 [ A ( x) + B ( x) A ( x) B ( x) ]
Hamacher product
A ( x) B ( x)
A and B = --------------------------------------------------------------------------A ( x) + B ( x) A ( x) B ( x)
All these operators belong to the so-called triangular or t-norms. Functions t define a general class of
intersection operators for fuzzy sets and can be parametric or nonparametric. Here, we mentioned only
nonparametric operators.
2. 4. 3 Union Triangular Co-Norms
For the union of two fuzzy sets, there is a class of operators named t-conorms or s-norms. The most
used in the literature are:
max operator
A(x) or B(x) = max { A(x), B(x)}
algebraic sum
A(x) or B(x) = A(x)+B(x)-A(x)* B(x)
bounded sum
A(x) or B(x) = min { 1, A(x) + B(x) }
drastic sum
x
A or B = y
if y = 0
if x = 0
if x,y > 0
Einstein sum
A ( x) + B ( x)
A or B = ---------------------------------------1 + A ( x) B ( x)
Hamasher sum
A ( x ) + B ( x ) 2 A ( x ) B ( x )
A or B = -----------------------------------------------------------------------------1 A ( x) B ( x)
disjoint sum
A(x) or B(x) = max { min (A(x), 1 - B(x)), min(1 - A(x), B(x)) }
Suppose that we defined two fuzzy sets by their membership functions A and B which have triangular
shape (dotted lines on Figure 4). The application of t - norm (in this example the operator is min) gives
the fuzzy set andB which is represented by its membership function AandB(x) (solid line on
6
Figure 4a). The application of t-conorm (here max operator) on these fuzzy sets gives the fuzzy set represented with solid line on the Figure 4b.
AorB (x)
AandB (x)
x
x
Triangular co-norm
max operator
Triangular norm
min operator
2. 4. 4 Semantic operators
In the ordinary set theory the only operators used are complementation, union and intersection and their
logical combinations. In the fuzzy set theory the semantics and the subjectivity are taken into account,
which permit to introduce the semantic operators such as: very, closer, almost, fairly, more or less etc.
These operators are the modifiers of the fuzzy sets. Of course, the definitions of these operators are subjective, which produces in fact an infinity of different operations [Berenji92].
For example, the mostly used operator for the term very is a concentration, which is commonly defined
as:
CON ( A) ( x ) = A ( x )
2
A ( x)
control variable and represents the action of the operator. High (A) and small (B) are linguistic values
or labels characterised by appropriate membership functions of fuzzy sets. They are defined in the universe of discourse of the linguistic variables x and y.
Takagi and Sugeno [Takagi83] proposed the form which has the fuzzy sets only in the premise part of
the rule, and the consequent part is described by a non-fuzzy equation of the input variable.
Example: If velocity is high, then force is k*(velocity)2
An other form of this rule is:
Rule: If x is A, then y is k*x2.
or more general,
Rule: If x is A, then y is f(x)
Like in the rule of Zadeh, high (A) is the linguistic label characterised by an appropriate membership
function. Every fuzzy rule is implemented by a fuzzy implication.
Also:
R = (A and B) C
This control rule is implemented by a fuzzy implication (fuzzy relation) [Lee90] and is defined as follows:
R = AandB C ( x, y, z ) = [ A ( x ) and B ( y ) ] C ( z )
3.1.1
A, B and C are fuzzy sets defined in the universes of discourse for x, y and z. R is the firing strength or
weight (level of the truth) for the statement R and A is the level of membership (membership value) of
the variable x in fuzzy set A.
As shown above, there are many ways to define the fuzzy implication and the fuzzy operator and. The
operators used for and are all t-norms functions and the most used are product and min operator.
Knowledge base
Data base
Fuzzification
interface
Rule base
Decision
making unit
Defuzzification
interface
FUZZY
input
Process
output
w1
w2
.
..
Defuzzification
wn
10
decreasing [Tsukamoto79]. Then, the overall output is the weighted average of each rules crisp output induced by the rule strength and output membership functions.
Type 4: Takagi and Sugeno method. Each rules output is a linear combination of input variables.
The crisp output is the weighted average of each ruless output [Jang92].
To illustrate these four types of fuzzy reasoning, we will take the system shown in the Figure 6. Suppose that two rules are activated. (A rule is activated when its firing strength is different than zero.) The
rules are the following:
R1: If x is A1 and y is B1 then z is C1
R2: If x is A2 and y is B2 then z is C2
The decision procedure for the four types of fuzzy inference systems is shown on the Figure 7. Fuzzy
operator and is min. One can notice that operator or is different for every type of system.
A1
Type 2
product
or min
B1
Type 3
C1
C1
C1
Type 4
z1 = f1(x,y)
C1
C1
= ax+by+c
w1
x
y
1
A2
B2
C2
C2
z1
C2
C2
C2
z2 = f2(x,y)
w2
= px+qy+r
x
Inputs
z2
C1 or C2
C1 or C2
z
z
z=
rizi
zi
Center
of gravity
Mean of
maxima
z=
w1z1 + w2z2
w z + w2z2
z= 1 1
w1 + w2
w1 + w2
Tsukamotos
method
Weighted
average
4. 3 Defuzzification strategies
Defuzzification is an operation with the aim to produce a nonfuzzy control action. It transforms an
union of fuzzy sets into a crisp value. There are several methods for the defuzzification, proposed in the
literature. We will describe here four of them shown in the Figure 7.
11
r z
i i
z =
i=1
--------------n
i=1
where n is the number of quantisation levels, ri is the amount of control output at the quantisation level
i and zi represents its membership value [Berenji92].
4. 3. 2 The mean of maximum method
The mean of maxima method generates a crisp control action by averaging the support values which
their membership values reach the maximum. In the case of discrete universe:
l
z =
ri
--l-
i=1
where l is the number of the quantized r values which reach their maximum memberships [Lee90].
4. 3. 3 Tsukamotos method
If monotonic membership functions are used, then the crisp control action can be calculated as follows:
n
w z
i i
z =
i=1
---------------n
i=1
where n is the number of rules with firing strength wi is grater than zero and zi is the amount of control
action recommended by the rule i [Tsukamoto79].
4. 3. 4 The weighted average method
This method is used when the fuzzy control rules are the functions of their inputs [Takagi83] as shown
in the Figure 7 for type 4 of fuzzy reasoning. In general, the consequent part of the rule is:
z = f(x,y)
If wi is the firing strength of the rule i, then the crisp value is given by:
n
w f (x , y )
i
i=1
z = -------------------------------n
i=1
e0=0
t
Tr
Ts
FIGURE 8. Expressing servo specifications in terms of requirements on the step response [Buhler83]
The example system that we simulated is the same as in [Li88] and [Boverie91].
That system can be represented by a diagram in Figure 9, where:
u is an input voltage (control variable)
y observed output
e - electrical time constant (0.0028 sec)
m mechanical time constant (0.28sec)
K static gain of the motor (K=0.25)
As e<<m, the equivalent transfer function will be:
K
G ( s ) = --------------------------s ( 1 + m s)
13
1+es
1+ms
K
s
General structure of this system in a control loop is shown in the Figure 10. Reference signal is a step
function shown in the Figure 11.
r(k)
+
e(k)
Controller
u(k)
Plant
y(k)
r(t)
1
t
FIGURE 11. Reference signal
Sampling period taken in this simulation is 10ms according to the Shannons theorem. Discretised
transfer function [Astrom89] is:
1
1
1
G ( z ) = K ( 1 z ) Z --- --------------------------s s ( 1 + s m )
b1 z + b2
= ----------------------------2
z + a1 z + a2
where:
T
-----
m
T
b 1 = K m ----- 1 + e
m
b 2 = K m
T
1 1 + ----- e
m
T
-----
m
a1 = 1 + e
a2 = e
14
T
----m
T
----m
5.1
de
u ( t ) = K p e ( t ) + K i e ( s ) ds + K d ----dt
where u is the control variable, e is the error defined as e = r - y (Figure 10) where r is the reference
value (Figure 11) and y is the process output.
Kp
e(k)
Ki
dt
Kd
u(k)
d
dt
There are three parameters to adjust Kp, Ki and Kd. The structure of the controller is represented in the
Figure 12. A reasonably realistic PID regulator can be described by:
k
u ( kT ) = K p e ( kT ) + K i
e ( jT) + K
[ e ( kT ) e ( ( k 1 ) T ) ]
6.1
j=0
One of the most used method for the adjustment of parameters for PID controller is Ziegler-Nichols
method [Astrom89]. This simulation is done with PD because the controlled system has an intergrator
term. The response of the system with the controller in the closed loop is given in the Figure 13.
t
FIGURE 13. Step response of the system controlled with the PID in the closed loop
15
Control signal and error signal are represented in the Figure 14. One can notice that the range for the
control signal is [0, 12] and the range for the error signal is [0, 1]. Changes in the error e are in the
[0,1]. It is very important for the design of the fuzzy controller.
e
t
FIGURE 14. Control and error signal of the system
7. Fuzzy controller
There are several methods to design a fuzzy controller:
modellization of the knowledge of the control engineer
modellization of the human operator actions and his experience
fuzzy modellization of the controlled plant
There is no systematic methodology to design the fuzzy controller. The most used approach is to define
membership functions of the inputs and outputs, after rule data base and to test a controller. Fuzzy controller is nonlinear and it is very difficult to examine the influence of certain parameters. Because of
that, the only method would be to test the controller on the system, and to adjust parameters which seem
to be wrong. Our goal is to examine the influence of certain parameters and to control a linear system
with known parameters and transfer function.
A basic structure of a system controlled by the fuzzy controller is presented in the Figure 10. Inputs variables, or process states in the fuzzy controller are:
the error e(k)
the change in error e(k) = e(k) - e(k-1)
Since the inputs in this controller are the same as for one PD controller, we can consider that the fuzzy
controller simulated here corresponds to the classical PD controller. Its structure is presented in the
Figure 5. The design of fuzzy controller is related with a choice of following parameters:
1. Knowledge base
the rule base (choice of input and control variables and control rules)
the universe of dicourse for every process state (choice of membership functions with their
parameters and shapes)
2. Decision making logic
definition of fuzzy implication
interpretation of the terms and and also (choice of the type of fuzzy reasoning)
3. Defuzzification mechanism
16
In this simulation, we partitioned a space of input and output variables into 7 fuzzy subsets. They are
presented by 7 membership functions as in the Figure 3. These functions are:
Negative Big (NB)
Negative Medium (NM)
Negative Small (NS)
Close to Zero (ZR)
Positive Small (PS)
Positive Medium (PM)
Positive Big (PB)
The rule base that we have taken the rule base proposed by Mamdani [Mamdani75] for the simulation
of PD controller. These rules are shown in the Table 1. The table is read in the following way:
If the error is negative small (NS) and the change of error positive big (PB),
than the control action is positive medium (PM).
TABLE 1. Rule base
e
NB
NM NS
ZR
PS
PM
PB
NB
NB
NB
NB
NB
NS
ZR
PS
NM
NB
NB
NB
NM
NS
ZR
PS
NS
NB
NB
NM
NS
ZR
PS
PM
ZR
NB
NM
NS
ZR
PS
PM
PB
PS
NM
NS
ZR
PS
PM
PB
PB
PM
NS
ZR
PS
PM
PB
PB
PB
PB
ZR
PS
PM
PB
PB
PB
PB
Fuzzy reasoning methods that were simulated are the methods of type 1 and 2 presented in the Figure 7,
and the defuzzification strategies are the center of gravity and mean of maximum method.
NL
NM NS ZR PS PM
-Em
NL
PL
Em
NM NS ZR PS PM
-Em
PL
Em
B C
D
E
E
t
a
b
FIGURE 16. Responses of the system with fuzzy controller, emax = 3, emax = 1
t
a
b
FIGURE 17. Responses of the system with fuzzy controller, umax = 14, emax = 1
A. emax = 0.5, B. emax = 1.1, C. emax = 3, D. emax = 7, E. emax = 10
a) triangular membership functions
b) bell-shaped membership functions
18
y
B,C,D,E
B,C,D,E
FIGURE 18. Responses of the system with fuzzy controller, umax = 14, emax = 3
A. emax = 0.1, B. emax = 0.5, C. emax = 1, D. emax = 2, E. emax = 5
a) triangular membership functions
b) bell-shaped membership functions
From the results shown in the Figure 17 and Figure 18, we can conclude that the choice of emax and
emax corresponds to the choice of constants Kp and Kd ( 6.1). The changes of the emax have the same
effect to the quality of the response as the changes of the constant Kd and the changes of the emax have
the same effect to the quality of the response as the changes of the constant Kp which prove that this
controller corresponds to the classical PD controller.
As we can see in the Figure 18 the response is not very sensitive to the changes of emax if emax is
bigger that 0.5. It is due to the fact that the most of the time the changes of the error signal are very
close to zero and that the most activated function is ZR.
The shape of the membership functions is not an important parameter, but we can observe that the triangular functions give the slightly better result. Specially, the risetime and setting time are shorter when
triangular functions are used.
For the limits of u, the best choice is to take the range of control signal same as for the PID controller,
since the response of the fuzzy controlled system is very sensitive to this parameter (Figure 16).
19
NL
NM NS
ZR
PS PM
NL
PL
NM
NS ZR PS
PM
PL
A
FIGURE 19. Nonuniform distribution of the membership functions
NL
NM NS ZR PS PM
PL
NL
NM
NS
ZR
PS
PM
PL
y
A
C,D
FIGURE 21. Response of the system for different distributions of membership functions (Figure 19 and
Figure 20)
We can notice that the system is very sensible to the distribution of the membership functions, and that
the parameters that we adjusted for the regular distribution are not the adequate. It means that the con-
20
A,B,C
FIGURE 22. Response of the system for different fuzzy reasoning methods and methods for defuzzification
A. Min max and center of gravity
B. Max Dot and center of gravity
C. Min max and mean of maximum
D. Max Dot and mean of maximum
9. Conclusions
Fuzzy controllers have the advantage that can deal with nonlinear systems and use the human operator
knowledge. Here we tested it with a linear system of second order with known parameters. In order to
compare it with one classical controller we simulated the same system controlled by PID.
PID controller has only three parameters to adjust. Controlled system shows good results in terms of
response time and precision when these parameters are well adjusted.
Fuzzy controller has a lot of parameters. The most important is to make a good choice of rule base and
parameters of membership functions. Once a fuzzy controller is given, the whole system can actually be
21
considered as a deterministic system. When the parameters are well chosen, the response of the system
has very good time domain characteristics. The fuzzy controlled system is very sensitive to the distribution of membership functions but not to the shape of membership functions.
Fuzzy controlled system doesnt have much better characteristics in time domain that PID controlled
system, but its advantage is that it can deal with nonlinear systems.
One of the most important problems with fuzzy controller is that the computiong time is much more
long that for PID, because of the complex operations as fuzzification and particularly defuzzification.
Some optimization can be done if the defuzzification method is simplified. It means that it is recommended to avoid center of gravity method.
PID controller can not be applied with the systems which have a fast change of parameters, because it
would require the change of PID constants in the time. It is necessary to further study the possible combination of PID and fuzzy controller. It means that the system can be well controlled by PID which is
supervised by a fuzzy system.
10. References
[Astrom84] K. J. Astrom, B. Wittenmark, Computer Controlled systems, Prentice-Hall Information
and System Sciences Series, 1984
[Astrom89] K. J. Astrom, B. Wittenmark, Adaptive control, Addison-Wesley Publishing Company,
1989
[Berenji92] H. Berenji, Fuzzy Logic Controllers, in An Introduction to Fuzzy Logic Applications in
Intelligent System, Editors R. Yager, L. Zadeh, Kluwer Academic Publishers, 1992, p. 69-96
[Berenji91] H. R. Berenji, Y. Y. Chen, C. C. Lee, J. S. Jang, S. Murugesan, A Hierarchical Approach to
Designing Approximate Reasoning-Based Controllers for Dynamic Phisical Systems, Uncertainty in
Artificial Intelligence 6, P. P. Bonissone, M. Henrion, L. N. Kanal and J. F. Lemmer (Editors), Elseiver
Science Publishers B. V. 1991, p. 331-343
[Bezdek93] J. Bezdek, Editorial Fuzzy Models - What Are They, and Why, Fuzzy Systems, Vol. 1, No.
1, Feb. 93, p. 1-6
[Boverie91] S. Boverie, B. Demaya, A. Titli, Fuzzy Logic Control Compared with Other Automatic
Control Approaches, 30th IEEE-CDC, Conf. on Decision and Control, Brighton, Dec. 1991
[Boverie92] S. Boverie, B. Demaya, R. Ketata, A. Titli, Performance Evaluation of Fuzzy Controller,
IFAC, Symposium on Intelligent Components and Instruments for Control Applications, Malaga, Spain
May 1992
[Buhler83] H. Buhler, Rglages chantillonns vol 1 et 2, Trait dElectricit, Presses polytechniques
romandes 1983
[Chen89] Y. Y. Chen, T. C. Tsao, A Descprition of the Dynamical Behavior of Fuzzy Systems, IEEE
Trans. on Systems, Man and Cybernetics, vol. 19, no. 4, 1989, p. 745-755
[Jang92] J.-S. Roger Jang, ANFIS, Adaptive-network-based fuzzy inference systems, IEEE Trans. on
systems, Man and Cybernetics, 1992
[Kaufmann88] A. Kaufmann, Le paramtrage des moteurs dinfrence, Hermes, 1988
[Kickert78] W. J. M. Kickert, E. H. Mamdani, Analysis of a Fuzzy Logic Controller, Fuzzy Sets and
Systems 1, 1978, North Holland Publishing Company, p. 29-44
[Lee90] C. C. Lee, Fuzzy logic in control systems: fuzzy logic controller- part 1 and part 2, IEEE Trans.
22
23