Fuzzy Module 2
Fuzzy Module 2
Fuzzy Module 2
Module 2
UTM
CAIRO
Fakulti Kejuruteraan Elektrik
Universiti Teknologi Malaysia
Module 2 Objectives
marzuki@utmkl.utm.my
www.cairo.utm.my
At the end of the module, the student should be able to understand the
basic components of a fuzzy logic controller and how they function.
2
Module 2 Contents
Position
Speed
Liquid level
Temperature
Pressure
Turgidity
Concentration
Intensity
Etc.
5
Setpoint
Control signal
Controller
Process
Output
Summer
(Op-Amp)
Feedback
Control objective
In many control systems, the objective is to design a controller such
that output can be controlled by giving the desired signals at the input.
Example of control
Alignment of the front wheel of a vehicle follows that of the drivers
steering wheel
Rudders of a boat follow its steering wheel
Concentration in liquids follows a given set-point
Temperature of furnace follows a given set-point
6
A military helicopter
A space shuttle
9
10
Modern
Classical
Artificial Intelligence
Root Locus
Bode Plot
Nichols Chart
Nyquist Plots
Neuro-Control
Fuzzy Control
Genetic Algorithms
Knowledge Based Systems
State Feedback
State Estimation
Observers
Optimal Control
Robust Control
H-Infinity
Internal Model Control
Adaptive Control
11
Example of Controllers
that can be applied in control systems
Conventional Controllers
Bang-Bang (on-off)
Proportional
PID Controller
Adaptive Controllers
Self-Tuning Controller
Self-Tuning PID Controller
Auto-Tuning PID Controller
Pole Placement
Predictive Controllers
Smith Predictor
Generalized Predictive Controllers
Intelligent Controllers
Knowledge Based
Fuzzy Logic Controllers
Neuro-Controllers
Adaptive Fuzzy
12
2.1.2
During the past decade, fuzzy logic control has emerged as one of the most active
and fruitful research areas in the application of fuzzy set theory, fuzzy logic and fuzzy
reasoning.
The idea was first proposed by Mamdani and Assilian around 1972.
Many industrial and consumer products using fuzzy logic technology have been built
and successfully sold worldwide.
Prof. E. H. Mamdani
Founder of Fuzzy
Logic Control
14
2.2
Designing a Fuzzy
Logic Control System
Where do we start?
What are the Basics/Background needed?
What are the components of a Fuzzy
Controller?
Where can it be applied?
17
Control Signal
Rateof Change
of Error
Ru le s
Process
Defuzz
Fuzz
Fuzzy Controller
Setpoint or InputTransducer
Reference
+
Output or
Controlled Variable
Output Transducer
or Sensor
18
2.2.1
Components of the
fuzzy logic controller
19
Fuzzifier
Process Output
& State
Fuzzy
Inference
Engine
Process
Defuzzifier
Crisp Control
Signal
20
Design Process
Identify controller Inputs and Outputs as the Fuzzy
variables
Break up Inputs and Outputs into several Fuzzy Sets
and label them according to the problem to be solved
and set up the fuzzy variables on the appropriate
universes of discourse <FUZZIFICATION>
Configure/develop RULES to solve the problem
Choose Inference Encoding procedure
Choose a DEFUZZIFICATION Strategy
Tune the adjustable parameters
21
Rule base
IFXisAAND Yis B
THEN Zis C
Defuzzification
Inference Mechanism
Fuzzification
Sensor
readings
Control
signal
24
2.2.2
Fuzzification
What is
Fuzzification?
26
Fuzzification
Involves the conversion of the input/output signals
into a number of fuzzy represented values (fuzzy
sets).
Choose an appropriate Membership Function to
represent each Fuzzy Set
Label the Fuzzy Sets appropriately such that they
reflect the problem to be solved
Set up the Fuzzy Sets on appropriate Universes
of Discourse
Adjust / tune the widths and centerpoints of
membership functions judiciously
27
28
29
Fuzzification
+
,
*%
+ %"
#
$
&%
%
'(
$"
#
.
(
+ %
$)
%
30
Fuzzification
/
%
4(
5
1
2"
/ 0 )/
, 3,
+
,
*%
31
%"
4(
5
1
2"
/ 0 )/
, 3,
+ %W
%
4(
5
1
2"
/ 0 )/
, 3,
( + %
32
6
7
1
'
Negative Medium
NM
Negative Small
NS
Zero
ZE
Positive Small
PS
Positive Medium
PM
33
62/ -8-1
96628 )::96 .6 8 28.+21
Usually fuzzy sets are overlapped by about 25%.
It can be observed that in fuzzy logic control the transition
from one fuzzy set to another provides a smooth transition
from one control action to another.
If there is no overlapping in the fuzzy sets then the control
action would resemble bivalent control (transition from one
error region to another is rather abrupt).
On the other hand if there is too much overlap in the fuzzy
sets, there would be a lot of fuzziness and this blurs the
distinction in the control action.
35
NM
NS
ZE
NM
NS
ZE
NM
NS
ZE
0
m
1
1
0
PM
PS
PM
PS
PM
0
mv
PS
Pendulum Angle,
Angular Velocity,
Motor Voltage, v
2.2.3Knowledge Base
The knowledge base of a fuzzy logic controller consists of a data base and a rule
base.
The basic function of the data base is to provide the necessary information for the
proper functioning of the fuzzification module, the rule base and the defuzzification
module.
(i)
(ii)
(iii)
(iv)
38
39
(ii)
Based on operators control actions
This method tries to model an operators skilled actions or
control behavior in terms of fuzzy implications using the inputoutput data connected with his control actions.
40
(iii)
Based on fuzzy model of a process
In the linguistic approach, the linguistic description of the dynamic
characteristics of a controlled process may be viewed as a fuzzy
model of the process.
The set of fuzzy control rules forms the rule base of the fuzzy logic
controller.
41
(iv)
Based on learning
There are now many examples of fuzzy controllers which have the
capability to learn and to compose the rules involving neural networks
and genetic algorithm.
42
43
Example 2.1
(Consequent)
THEN Z
45
e
De
N
Z
P
46
Rules?
47
48
e(k ) = r (k ) y (k )
de(t )
dt
e( k ) = (e( k ) e( k 1) )
Rule base
IF X is A AND Y is B
TH EN Z is C
Defuzzification
Inference Mechanism
Fuzzification
Sensor
rea dings
Control
signal
49
More specifically,
R1:
R2:
Setpoint
ee+
e+
e+
e+
e+
e+
e-
e- e+ e+ e- e- e+
e- e- e+ e+ e- e-
a1
1
6 7 8
9 10 11 12
51
TABLE I
PROTOTYPE OF FUZZY CONTROL RULES WITH TERM SETS
(NEGATIVE, ZERO, POSITIVE)
Rule No.
a1, a2, a3
d1, d2, d3
c1, c2, c3
b1, b2, b3
set point
Reference Point
TABLE 2
P ROTOTYPE OF F UZZY C ONTROL R ULES W ITH T ERM S ETS
( N EGATIVE, Z ERO, P OSITIVE)
Rule No.
1 (rise time), 5
2 (overshoot), 6
Reference Point
3, 7
4, 8
10
11
10
52
TABLE 3
PROTOTYPE OF FUZZY CONTROL RULES WITH TERM SETS
{NB, NM, NS, ZE, PS, PM, PB}
Rule No.
1
PB
ZE
PB
Reference Point
a1
PM
ZE
PM
a2
PS
ZE
PS
a3
ZE
NB
NB
b1
ZE
NM
NM
b2
ZE
NS
NS
b3
NB
ZE
NB
c1
NM
ZE
NM
c2
NS
ZE
NS
c3
10
ZE
PB
PB
d1
11
ZE
PM
PM
d2
12
ZE
PS
PS
d3
13
ZE
ZE
ZE
set point
53
TABLE 4
PROTOTYPE OF FUZZY CONTROL RULES WITH TERM SETS
{NB, NM, NS, ZE, PS, PM, PM}
E
14
PB
NS
PM
1 (rise time)
15
PS
NB
NM
2 (overshoot)
Rule No.
Reference Point
16
NB
PS
NM
17
ND
PB
PM
18
PS
NS
ZE
19
NS
PS
ZE
10
54
What is an Inference
Procedure in FLCS?
Knowledge
Base
Fuzzy
Fuzzifier
Process Output
& State
Fuzzy
Inference
Engine
Process
Defuzzifier
Crisp Control
Signal
55
Two most common methods used in fuzzy logic control are the maxmin composition and the max-(algebraic) product composition.
The inference or firing with this fuzzy relation is performed via the
operations between the fuzzified crisp input and the fuzzy relation
representing the meaning of the overall set of rules.
56
Example 2.2
Consider a simple system where each rule comprises two antecedents and
one consequent. A fuzzy system with two non-interactive inputs x1 and x2
(antecedents) and a single output y (consequent) is described by a collection
of n linguistic if-then propositions:
IF x1 is A1(k) and x2 is A2(k) THEN y(k) is B(k),
k = 1,2,...n.
where A1(k) and A2(k) are fuzzy sets representing the kth antecedent pairs and
B(k) are the fuzzy sets representing the kth consequent.
Based on the Mamdani implication method of inference, and for a set of
disjunctive rules, the aggregated output for the n rules will be given by
B(k)(y) = Max Min[A1(k)(input(i)), A2(k)(input(j))]
A 11
A 12
B1
min
0
input( i)
x1
x2
input( j)
Rule 2
A 21
A 22
B2
1
min
input( i)
x1
input( j)
x2
Defuzzification
1
y*
59
The figure illustrates the graphical analysis of two rules, where the
symbols A11 and A12 refer to the first and second fuzzy antecedents of
the first rule, respectively, and the symbol B1 refers to the fuzzy
consequent of the first rule.
The symbols A21 and A22 refer to the first and second fuzzy
antecedents, respectively, of the second rule, and the symbol B2
refers to the fuzzy consequent of the second rule.
61
Example 2.3
A 11
A 12
input( i)
x1
Rule 2
x2
input( j)
x1
input( i)
A 21
B1
A 22
B2
x2
input( j)
Defuzzification
y*
2.2.5
63
Defuzzification
Knowledge
Base
Fuzzifier
Process Output
& State
Crisp
Fuzzy
Fuzzy
Inference
Engine
Process
Defuzzifier`
Crisp Control
Signal
64
65
for all z Z
1
0
z*
z
67
z* =
( z ). z
(z)
Z
z*
z
68
( z ).z
( z)
z
z* =
z1
z2
69
z* =
z* b
z
70
2.3
Firstly, the designer have to identify the process input and output variables
that need to be considered. Thus, one must have a good knowledge on
the system to be controlled.
Next, one should determine on the number of fuzzy partitions (or fuzzy
subsets) for the input and output linguistic variables.
This number has an essential effect on how fine a control can be obtained.
71
Finally, once the fuzzy control system has been constructed, the
simulation of the system can be carried out.
The performance of the system can be analyzed. If the results are not
as desired, changes are made either to the number of the fuzzy
partitions or the mapping of the membership functions and then the
system can be tested again.
Parameters Tuning
- mapping of membership
functions
- fuzzy inference rules
- scaling factors
No
OK
Yes
End
74