Fuzzy Control System
Fuzzy Control System
Educational Material
Author(s):
Geering, Hans P.
Publication date:
1998
Permanent link:
https://doi.org/10.3929/ethz-a-004953512
Rights / license:
In Copyright - Non-Commercial Use Permitted
This page was generated automatically upon download from the ETH Zurich Research Collection.
For more information, please consult the Terms of use.
Introduction to Fuzzy Control
Hans P. Geering
Abstract
In this report, some of the basic mathematical definitions and rules
of fuzzy system theory are described inasmuch as they are relevant for
fuzzy control. Two examples are covered in detail, viz., a fuzzy closed-
loop halting control scheme for the forward motion of a mobile robot in
an automatic factory and a dog chasing a cat using fuzzy control.
Issues of computational efficiency are discussed. And some recommen-
dations to potential designers of fuzzy controllers are summarized.
After studying this report, the reader should be in a position to design
simple fuzzy controllers and simulate the behaviour of the resulting fuzzy
control system on a general purpose digital computer.
IMRT Press
°c Measurement and Control Laboratory
Swiss Federal Institute of Technology (ETH)
ETH-Zentrum
CH-8092 Zurich, Switzerland
3rd ed., September, 1998
i
ii GEERING: FUZZY CONTROL
CONTENTS iii
Contents
1 Fuzzy Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Fuzzification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3 Fuzzy Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
4 Fuzzy Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4.1 Introducing Fuzzy Variables . . . . . . . . . . . . . . . . . . . . . 3
4.2 Fuzzification Revised . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.3 Fuzzy Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5 Fuzzy Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.1 Fuzzy SISO-Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.2 Fuzzy AND-Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.3 Other Fuzzy Rules . . . . . . . . . . . . . . . . . . . . . . . . . . 6
7 Defuzzification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
9 Computational Issues . . . . . . . . . . . . . . . . . . . . . . . . . 18
9.1 Efficient Defuzzification . . . . . . . . . . . . . . . . . . . . . . . 18
9.2 Derivatives of the Control Function . . . . . . . . . . . . . . . . . 20
9.3 Observations and Suggestions . . . . . . . . . . . . . . . . . . . . 21
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
iv GEERING: FUZZY CONTROL
1 FUZZY SETS 1
1 Fuzzy Sets
Definition: A fuzzy set s is an ordered pair (X, f ), where X is a vector space
(usually the real line R) and f is a set membership function mapping X onto
the interval [0, 1] of the real line R, i.e., f : X → [0, 1].
6
fi
NL NS Z PS PL
1
@ T A T
@ T A T
@ T A T
@ T A T
@ T0 A T - X
-20 -10 0 10 20
Figure 1: Fuzzy sets N L (negative large), N S (negative small), Z (zero), P S
(positive small), and P L (positive large) covering the real line X = R.
The following two scalar characteristics of a fuzzy set will be useful later.
Definition: The weight w and the centroid c of a fuzzy set s = (X, f ) are
defined as follows:
Z
w = f (x) dx
and
R
xf (x) dx
c= R
f (x) dx
where all of the integrals are taken over the signal space X.
2 GEERING: FUZZY CONTROL
2 Fuzzification
Consider a signal space X covered by several fuzzy sets si , i = 1, . . . , k. The
fuzzy question is: Given a vector x ∈ X, to which of the fuzzy sets si does x
belong or, in which of the sets Si associated with the fuzzy sets si does x lie?
In mathematical set theory, the answer for each of the sets Si is a binary
one. In fuzzy set theory, set membership is “by degree”.
Hence, the answer to the fuzzy question is: x belongs to each of the fuzzy
sets si to some degree, viz., to degrees di = fi (x), i = 1, . . . , k.
3 Fuzzy Logic
Fuzzy logic defines the rules governing the operators intersection and union of
fuzzy sets.
Consider two fuzzy sets s1 = (X, f1 ) and s2 = (X, f2 ) defined on the same
signal space X and their associated sets S1 ⊂ X and S2 ⊂ X, respectively.
Consequently, the union operator and the intersection operator yield the
fuzzy sets s1 ∪ s2 = (X, max(f1 , f2 )) and s1 ∩ s2 = (X, min(f1 , f2 )), respectively.
Notice that the intersection s1 ∩ s2 is a degenerated fuzzy set in the sense that
its set membership function min(f1 , f2 ) does not map onto the interval [0, 1] as
requested by the definition of a fuzzy set. This detail is not pursued any further
here because in fuzzy control, all calculations are done with fuzzy variables
rather than with fuzzy sets.
4 FUZZY VARIABLES 3
4 Fuzzy Variables
4.1 Introducing Fuzzy Variables
Definition: A fuzzy variable v is an ordered pair (s, d) where s is a fuzzy set
and d ∈ [0, 1] a real bounded variable.
Fuzzy variables arise in the fuzzification operation in a natural way: For the
variable x ∈ X, the real variable d is the degree of membership in the fuzzy
set s. (Cf. Section 4.2)
In another interpretation of a fuzzy variable, the real variable d “modulates”
the fuzzy set s: The scalar d and the set membership function f : X → [0, 1] of
the fuzzy set s define a new function g : X → [0, 1]. There are two modulation
schemes:
a) “linear modulation”: g(x) = d ·f (x)
b) “modulation by clipping”: g(x) = min(f (x), d).
6
g, f 6g, f
1 p p p p p fp p a)
1 p p p p p fp p b)
p ppp p ppp
ppp p pp ppp p pp
pp p g ppp pp p g ppp
pp p XXX p p p p pp p p
@p p p p
pp HH p p
ppp
pp ppp
pp p HH p - X
p pp @ @ pp -
0 0 X
Figure 2: Example of a fuzzy variable: fuzzy set (X, f ) modulated by d = 0.5:
a) linear modulation, b) modulation by clipping.
The author prefers the linear modulation scheme because the function g ob-
tained by linear modulation typically contains more detailed information about
the structure of the fuzzy variable.
In Section 1, the weight w and the centroid c of a fuzzy set s = (X, f ) have
been defined. Obviously, the weight and the centroid of a fuzzy variable v can
be defined in an analogous way by replacing the set membership function f by
the modulated function g in these formulae.
Notice that the linear modulation scheme results in a linear reduction of the
weight of the fuzzy variable, wv = d · ws , while the centroid remains unchanged,
cv ≡ cs for all d ∈ (0, 1].
For calculations with a fuzzy variable, it is more practical to use the “mod-
ulated” function g than to keep the scalar d and the set membership function
f of the underlying fuzzy set s apart. Furthermore, the restriction g(x) ≤ 1 for
all x ∈ X can be dropped. This is practical when sums of fuzzy variables are
calculated.
4 GEERING: FUZZY CONTROL
The relation operator “∼ =” points out the fact that, in the last vector, the fuzzy
sets si are not explicitly noted down but are implied by the indices i.
On the other side, every fuzzy n-vector can be represented by the corre-
sponding modulated set membership functions gi :
(s , d ) (w , c )
v1 1 1 g1 g1 g1
v2 2 2 g2 g2 , cg2 )
(s , d ) (w
. = = . ∼ .
.. .. . = ..
. . .
vn (sn , dn ) gn (wgn , cgn )
5 Fuzzy Rules
Fuzzy rules are used in fuzzy control in order to define the map from the fuzzified
input signals (error signals, measured signals, or command signals) of the fuzzy
controller to its fuzzy output signals (control signals).
Definition: The AND-rule mapping the fuzzy input variables ve1 = (se1 , de1 )
and ve2 = (se2 , de2 ) to the fuzzy output variable vu = (su , du ) is defined by
vu = (su , min(de1 , de2 )).
7 Defuzzification
Defuzzification is the process of assigning a representative value to a fuzzy vari-
able. Consider a fuzzy variable vu on the signal space U = R which is repre-
sented by the modulated function gu .
where both of the integrals are calculated over the signal space U = R. The
defuzzification operator D is understood to accept an arbitrary representation
of the fuzzy variable vu as its argument.
Upon conclusion of the fuzzy control algorithm, precise values u1 (t), . . . , um (t)
must be assigned to the components of the control vector. However, the fuzzy
associative memory P yields m fuzzy variables vui (t) represented by their sum
functions gui (·, t) = j gij (·, t). Defuzzifying yields the control signals
R
βgui (β, t) dβ
ui (t) = D{vui (t)} = R i = 1, . . . , m
gui (β, t) dβ
- uo
CF F
uc - ?
+
w - i e- CF B iu- P -y
+ +
6
−
Figure 3: Fuzzy control system consisting of the plant P , the fuzzy feedback
controller CF B , and the fuzzy feed-forward controller CF F .
in Figure 3 are precise (i.e., crisp or non-fuzzy) signals. The internal structures
of the feed-forward controller and the feedback controller are identical.
Figure 4 depicts the major components of the fuzzy feedback controller CF B ,
viz., the fuzzifier F, the fuzzy associative memory F AM , and the defuzzifier D.
The “wiggly” or “fuzzy” double arrow emphasizes the fact that even for a scalar
error signal e(t), the quantity ve (t) = F{e(t)} is a fuzzy vector (cf. Sections 4.2
and 4.3). On the other hand, vu (t) is a fuzzy variable which is defuzzified to
the scalar control signal uc (t).
Figure 5 shows a detailed block diagram of a fuzzy controller with two input
signals and one output signal. The error signals e1 and e2 are fuzzified to the
fuzzy N -vector ve1 and the fuzzy M -vector ve2 , respectively. The components
of the fuzzy vectors, i.e., the N + M fuzzy variables are shipped to the N ·M
fuzzy AND-rules. The fuzzy variables at the outputs of the AND-rules are
summed up. This yields the fuzzy control variable vuc at the output of the
fuzzy associative memory and the defuzzified control signal uc . — Notice that,
typically, one and the same fuzzy set of the control signal is fired by several of
the fuzzy AND-rules.
8 FUZZY CONTROL SYSTEMS 9
∼∼∼∼>
1
AN D ∼∼∼∼>
i
∼∼∼∼>
1
pp
pp
∼∼∼∼>
1
AN D ∼∼∼∼>
j
∼∼∼∼>
M
e1 ve1
- F ≈≈≈≈≈≈> p
p vuc u
p + ∼∼∼∼∼∼> D -c
e2 ve2 p
- F ≈≈≈≈≈≈>
∼∼∼∼>
N
AN D ∼∼∼∼>
k
∼∼∼∼>
1
pp
pp
∼∼∼∼>
N
AN D ∼∼∼∼>
`
∼∼∼∼>
M
The error signals ep (t) = wp (t) − p(t) and ev (t) = wv (t) − v(t) are processed
in a fuzzy feedback controller which produces the feedback force uc (t). The
detailed block diagram of this fuzzy two-input one-output feedback controller
corresponds to the one shown above in Figure 5. Finally, the total traction force
is u(t) = sat{uo (t) + uc (t)}. (It is clipped to +500 N or −500 N, respectively,
whenever the sum exceeds the limit of the available traction force.)
The fuzzy halting control law is deactivated as soon as the velocity vanishes
for the first time, v(t) = 0. Simultaneously, the parking brakes are set.
The fuzzy sets covering the signal space Ep = R where the position error
ep (t) lives are shown in Figure 6. The fuzzy sets covering the signal space
Ev = R where the velocity error ev (t) lives are shown in Figure 7.
6 fpi
PNL PNS PZ PPS PPL
HH @ A
1
@
HH @ A @
HH @ A
@
HH@ A @
HH
A
@ 0 @ - p
-4 -2 0 2 4 [mm]
Figure 6: Fuzzy sets for the position error: P N L (negative large), P N S (nega-
tive small), P Z (zero), P P S (positive small), and P P L (positive large).
6fvi
V NL V NS VZ V PS V PL
1
@ @ @ @
@ @ @ @
@ @ @ @
@ @ @ @
@ @0 @ @ - v
-4 -2 0 2 4 [mm/s]
Figure 7: Fuzzy sets for the velocity error: V N L (negative large), V N S (nega-
tive small), V Z (zero), V P S (positive small), and V P L (positive large).
The fuzzy sets chosen for the feedback traction force uc (t) are depicted in
Figure 8. Notice that the centroids of the fuzzy sets U P X and U N X are
located at −500 N and +500 N, respectively, in order to give the fuzzy feedback
controller full authority over the range −500 . . . + 500 N. Furthermore, no fuzzy
set U Z centered at 0 N is introduced in order to obtain “stiff” characteristics of
the fuzzy feedback control law.
In Figure 9, the set of 20 fuzzy rules defining the fuzzy associative memory
of the fuzzy feedback controller is displayed. The entries of this tabloid should
12 GEERING: FUZZY CONTROL
6fui
UNX UNL UNS UPS UPL UPX
1
T T L L T T
T T L L T T
T T L L T T
T T L L T T
T T L0 L T T - u
-500 0 500 [N]
Figure 8: Fuzzy sets for the control of the traction force: U N X (negative extra
large), U N L (negative large), U N S (negative small), U P S (positive small),
U P L (positive large), and U P X (positive extra large).
Figure 9: Fuzzy associative memory for the fuzzy closed-loop servo controller
containing twenty fuzzy rules.
8 FUZZY CONTROL SYSTEMS 13
ṗ(t) = v(t)
p(0) = −2 m
1
v̇(t) = {u(t) − sign(v(t))γmg}
m
v(0) = 2 m/s ,
where m = 150 . . . 450 kg is the true mass of the robot, g = 9.81 m/s2 the
gravitational constant, and γ = 0.01 the coefficient of roll friction. For the
simulations, digital control with a sampling and control rate of 500 Hz is as-
sumed. This fairly high sampling rate is chosen in order to prevent mechanical
resonances in the mobile robot.
In Figures 10 and 11, the trajectory of the robot is shown in the phase plane
(p, v) in several scales for a true mass m = 450 kg and m = 150 kg, respectively.
For the complete trajectory labelled “a)”, the units for p and v are m and m/s,
respectively. For the increasingly enlarged final parts “b)”, “c)”, and “d)” of
the trajectory, the units are dm and dm/s, cm and cm/s, and mm and mm/s,
respectively.
As the Figures show, the heaviest robot (m = 450 kg) overshoots the station
by less than 0.2 mm, whereas the lightest robot (m = 150 kg) stops less than
0.2 mm short of the station. Hence, the specifications are met.
This servo control example is deceptively simple because the plant under con-
sideration essentially is a double integrator and because with a PD-controller
or with the equivalent linear state feedback controller one cannot arrive at an
unstable control system, provided the signs of the two control gains are chosen
correctly. The only open question is whether the specifications for the precision
of halting are met.
From the next example it can be inferred that asymptotic stability of a
fuzzy control system is not necessarily obtained by choosing the fuzzy control
scheme with straightforward commonsense logic. As a matter of fact, proving
the asymptotic stability of a fuzzy control system (even of moderate complexity)
can turn out to be very difficult.
14 GEERING: FUZZY CONTROL
Figure 10: Trajectory of a robot with a mass of 450 kg in the phase plane (p, v).
Scales: a) m and m/s; b) dm and dm/s; c) cm and cm/s; d) mm and mm/s.
Figure 11: Trajectory of a robot with a mass of 150 kg in the phase plane (p, v).
Scales: a) m and m/s; b) dm and dm/s; c) cm and cm/s; d) mm and mm/s.
8 FUZZY CONTROL SYSTEMS 15
6fαi
AN L AN S AZ AP S AP L
1
A A B A
A A B A
A A B A
A A0 B A - α
◦
-180 -45◦ 0◦ 45◦ 180◦
Figure 12: Fuzzy sets for the line of sight angle: AN L (negative large), AN S
(negative small), AZ (zero), AP S (positive small), and AP L (positive large).
6fui
UNL UNS UZ UPS UPL
1
@ B B B @
@ B B B @
@B B B @
@B 0 B B -
@ ∆γ
-180◦ -90◦ -45 ◦
0◦ 45◦ 90◦ 180◦
Figure 13: Fuzzy sets for the dog’s change of heading angle: U N L (negative
large), U N S (negative small), U Z (zero), U P S (positive small), and U P L (pos-
itive large).
The five fuzzy rules of the fuzzy associative memory of the fuzzy feedback
controller can be written in shorthand as follows: AN L ⇒ U N L, AN S ⇒ U N S,
16 GEERING: FUZZY CONTROL
In [9], the fuzzy pursuit problem of this example has been extended to a
fuzzy pursuit and evasion game, i.e., both the dog and the cat use fuzzy control
schemes.
8 FUZZY CONTROL SYSTEMS 17
Figure 14: The dog chases the cat with gain K = 0.5.
9 Computational Issues
9.1 Efficient Defuzzification
Consider the task of simulating a fuzzy control system on a general purpose
digital computer. For the simulation of the fuzzy (feedback) controller, Figures
4 and 5 suggest that the following sequence of operations should be executed at
every sampling time:
• Fuzzify each of the error signals ei to the corresponding fuzzy vector vei :
vei = F(ei ).
• Evaluate all of the fuzzy rules defined for the fuzzy controller. Each of the
fuzzy rules yields a fuzzy variable vj which is represented by the modulated
function gj (u).
Notice that for piecewise linear functions gj (u), the sum g(u) is also a piece-
wise linear function and both of the integrals of the defuzzification operation can
be calculated analytically. Therefore, using fuzzy sets with piecewise linear set
membership functions only (such as “triangles”, “trapezoids”, or piecewise lin-
ear approximations of more sophisticated smooth functions) can lead to rather
efficient program code.
In order to further reduce the run time of the simulation significantly, the
result of the following lemma is needed.
Consider the modulated functions gj , j = 1, . . . , N , and the corresponding
PN
function g = j=1 gj of the fuzzy control signal vu . Let wgj and cgj be the
weights and the centroids, respectively, of the modulated functions gj , i.e.,
Z
w gj = gj (u) du
and Z
ugj (u) du Z
1
cg j = Z = ugj (u) du .
wgj
gj (u) du
9 COMPUTATIONAL ISSUES 19
X
N
wgj cgj
j=1
u = D(vu ) = .
X
N
wgj
j=1
Proof:
Z X N Z
X X
Z N N
u gj (u) du ugj (u) du wgj cgj
ug(u) du
j=1 j=1 j=1
u = D(vu ) = Z = Z N = N Z = .
g(u) du X X X
N
gj (u) du gj (u) du wgj
j=1 j=1 j=1
Notice that the weight wgj and possibly the centroid cgj vary as the degree
dj of firing for the corresponding fuzzy set sj varies.
However, if the linear modulation scheme is used, the variable weights wgj
and centroids cgj can be expressed by the constant weights wj and centroids cj
of the set membership functions fj as follows:
Notice that j numbers the fuzzy rules rather than the fuzzy sets defined for the
control signal. One and the same fuzzy set of the control signal may be fired by
more than one fuzzy rule (cf. Figure 9).
Discontinuities of these partial derivatives are caused both by the “corners”
of the (piecewise linear) set membership functions of the fuzzy sets covering
the signal spaces where e1 , . . . , ep live and the “corners” of the functions
dj = min(· · ·) of the fuzzy AND-rules.
9 COMPUTATIONAL ISSUES 21
• If none of the fuzzy sets of the control signal u is fired to a strictly positive
degree, the value of the defuzzified control signal is undefined. Therefore,
the signal space E, where the error signal e lives, must be covered com-
pletely by its collection of fuzzy sets, and these fuzzy sets should overlap.
In other words, every error e ∈ E should belong to at least one fuzzy set to
a strictly positive degree. Furthermore, in the associative memory, every
fuzzy set of the error signal should fire (at least) one of the fuzzy sets of
the control signal.
• If two neighbouring fuzzy sets of the error signal “touch” at e1 but do not
overlap, the control function is discontinuous at e1 . For e = e1 , the result
of the defuzzification operator is undefined. The value of the control signal
must be defined separately. — In Example 1 (fuzzy halting control), the
analogous situation occurs for ep = ev = 0. The obvious extra definition
is uc (0, 0) = 0.
• Assume that the linear modulation scheme is applied. For the purpose of
implementing a finished design of a fuzzy controller, only the weights wi
and the centroids ci of the fuzzy sets for the control signals are needed in
the defuzzification operation (cf. Section 9.1). — On the other hand, the
complete specifications of the set membership functions of the fuzzy sets
for the control signals are needed, if the fuzzy rules of the controller must
be “learnt” by watching an expert performing the task at hand. This topic
is beyond the scope of this report. The interested reader is referred to [1],
and [8], and the references cited there.
ei (k) and the delayed error signals ei (k −1), ei (k −2), etc., and perhaps
previously issued control signals uj (k−1), uj (k−2) etc.. In the latter case it
is efficient to refuzzify the defuzzified control signals in order to obtain the
required delayed fuzzy control variables. All or most of the processing is
performed in the fuzzy part of the controller. In more sophisticated cases,
non-fuzzy dynamic compensation (e.g., in the form of a full state observer)
can be performed in a preprocessor to the fuzzy controller proper.
References
[1] B. Kosko, Neural Networks and Fuzzy Systems: A Dynamical Systems Ap-
proach to Machine Intelligence, Prentice-Hall, Englewood Cliffs, NJ, USA,
1992.
[2] H.-J. Zimmermann, Fuzzy Set Theory and its Applications, 2nd ed., Kluwer,
Boston, MA, USA, 1991.
[3] W. Pedrycz, Fuzzy Control and Fuzzy Systems, Electronic & Electrical En-
gineering Research Studies, Control Theory and Applications Series, vol. 3,
Research Studies Press (Wiley), Taunton, Somerset, England, 1989.
[4] D. J. Dubois, H. M. Prade, Fuzzy Sets and Systems, Academic Press, New
York, NY, 1980.