Вы находитесь на странице: 1из 40

CCA yck(Jan 2003) 1

Topic 5 - Fuzzy Logic Control


Topic 5
Topic 5
FUZZY LOGIC CONTROL
FUZZY LOGIC CONTROL
Instructional Objectives
1. State the factors involved in a fuzzy logic controller design.
2. Sketch and describe the structure of fuzzy logic controllers.
3. Define fuzzification and defuzzification strategies.
4. Explain the mechanism involved in fuzzy reasoning.
5. Describe what are linguistic terms.
6. Explain how data base and rule base are used in fuzzy logic controllers.
7. Sketch and explain Mandani's and Larsens inferences.
8. Define mean of maxima and center of area methods.
9. Describe how fuzzy control rules are derived.
CCA yck(Jan 2003) 2
Topic 5 - Fuzzy Logic Control
CONTENTS
5.1 Introduction
5.2 Basic Structure of Fuzzy Logic Controllers
5.3 Fuzzy Logic Controller Design Issues
5.4 Design of Fuzzy Control Rules
5.5 Detail Examples on Fuzzy Logic Control
Self-Test Questions
REFERENCES
1. Using Fuzzy Logic by J. Yan, M. Ryan & J. Power
( pages 45 - 61 )
CCA yck(Jan 2003) 3
Topic 5 - Fuzzy Logic Control
5.1 INTRODUCTION
Digital control is more flexible due to the wide variety of algorithms
that may be used. Digital systems are generally better for coping with
varying environments arising from load disturbances, process non-
linearities, changes of plant parameters and so on.
.
The algorithm used may be based on proportional-integral-derivative
(PID), model reference adaptive control and fuzzy logic. The PID
control is effective for a fixed control environment, but is unable to
cope with a varying control system non-linearity. The fuzzy logic
approach uses inputs, outputs and control response that are specified in
terms similar to that used by a human expert. Complex mathematical
models of the system under control are not required.
.
Fuzzy logic controllers have been applied to cement process plant,
robot control, motor control, automatic train operation, crane control,
servo loop control and many more.
CCA yck(Jan 2003) 4
Topic 5 - Fuzzy Logic Control
The principal factors in designing a fuzzy logic controller are:
The actual inputs and outputs and their universes of discourse i.e.
the range of values which each may take.
The scale factors of the input-output variables.
The fuzzy membership functions to be used in setting up the fuzzy
values for each input and output variable.
The fuzzy control rule base.
The key issue in the design are the construction of the membership
functions and the fuzzy control rules. A fuzzy logic controller may
also have self-organizing or learning capabilities.
CCA yck(Jan 2003) 5
Topic 5 - Fuzzy Logic Control
5.2 BASIC STRUCTURE OF FUZZY
LOGIC CONTROLLERS
FLC Plant
R U
E Y
+
-
The fuzzy logic controller (FLC) is normally incorporated in a
closed-loop control system.
The main elements of the FLC are a fuzzification unit, a fuzzy
logic reasoning unit, a knowledge base and a defuzzification
unit
CCA yck(Jan 2003) 6
Topic 5 - Fuzzy Logic Control
Fuzzy Reasoning
Mechanism
Fuzzification
Unit
Defuzzification
Unit
Rule Base Data Base
Input E Output U
The fuzzy knowledge base contains 2 main types of information:
A data base defining the membership functions of the fuzzy sets used
as values for each system variables
A rule base that maps fuzzy values of the input to fuzzy values of the
outputs.
Measured from
controlled process
Used by FLC to
control the process
CCA yck(Jan 2003) 7
Topic 5 - Fuzzy Logic Control
Fuzzification strategy involves
Acquiring crisp values of input values.
Mapping crisp values of the inputs into corresponding universes
of discourse.
Converting the mapped data into fuzzy singletons or into suitable
linguistic terms.
Defuzzification involves weighting and combining a number of fuzzy
sets resulting from the the fuzzy inference process that will give
single crisp value for each output.
The rule base part consists of a number of fuzzy rules which
expresses the control relationship such as
.
Rule k: IF x is PB THEN y is NB
.
where x is an input variable, y is an output variable, PB is one of the fuzzy
sets defined for x in X and NB is one of the fuzzy sets defined for y in Y.
CCA yck(Jan 2003) 8
Topic 5 - Fuzzy Logic Control
The fuzzy logic reasoning module uses fuzzy logic in a manner
similar to some aspects of human decision making. It performs
fuzzy inference to arrive at the fuzzy control actions by evaluating
the knowledge base for the fuzzified inputs.
The 3 basic operations involve are:
.
Determination of degree of match between fuzzy input data and
the defined fuzzy sets for each system input variable.
Carry out fire strength calculations for each rule based on the
degree of match and the connectives used in the antecedent part.
Derive the control outputs based on the calculated fire strength
and the defined fuzzy sets for each output variable in the
consequent part.
CCA yck(Jan 2003) 9
Topic 5 - Fuzzy Logic Control
5.3 FUZZY LOGIC CONTROLLER
DESIGN ISSUES
System Variable and Fuzzy Parameters
The number of input and output variables determines the complexity
of the fuzzy system starting with single-input-single-output system
(SISO), MISO and MIMO.
When a FLC is designed to replace a conventional PID controller in
a MISO system, 3 input variables are normally used:
State error, e
Sum of the state error, e
Derivative of state error, de
A vector E = [ e e de ]
t
is commonly used. The output variable is
a control signal u.
CCA yck(Jan 2003) 10
Topic 5 - Fuzzy Logic Control
Linguistic terms are usually used to define each system variable in
the fuzzy sets such as PB (positive big), PM(positive medium), PS
(positive small), ZE (Zero), NS ( negative small), NM( negative
medium), NB (negative big), etc.
Selection of membership functions based on the range and shape
for a variable is somewhat a subjective design choice.
Symmetrically distribute the fuzzy sets across the defined
universe of discourse.
Use an odd number of fuzzy sets for each variable.
Overlap adjacent fuzzy sets to ensure no crisp value fails to
correspond to any set.
Use triangular or trapezoidal membership functions as these
require less computation.
CCA yck(Jan 2003) 11
Topic 5 - Fuzzy Logic Control
Fuzzification Strategies
In process control, the observed data is usually crisp and
fuzzification is required to map the observed range of crisp inputs to
corresponding fuzzy values for the system input variables. The
mapped data are further converted into suitable linguistic terms as
labels of the fuzzy sets defined for system input variables.
EXAMPLE : Voltage Reading From A Digital Voltmeter
voltage
Low voltage

membership
Crisp Reading
1
0.5
Fuzzy singleton
voltage
0.4
Medium
voltage
membership
Fuzzy Reading
1
Fuzzy number
CCA yck(Jan 2003) 12
Topic 5 - Fuzzy Logic Control
Knowledge Base
Data Base Rule Base
+
Data Base
Defines the universe of discourse for each variable, determining the
number of fuzzy sets and designing the membership functions.
Sampling & Quantization resolution
Input variable
Discretization of
universe of discourse
CCA yck(Jan 2003) 13
Topic 5 - Fuzzy Logic Control
Discretization of universe of discourse is important such that the
performance of a FLC will be less sensitive to small deviations in
values of the system variables. Quantization during analog-to-
digital conversion must be selected at an appropriate quantization
level known as resolution.
EXAMPLE
A universe of discourse is discretized into 7 levels with 5 fuzzy sets.
Level no. Range NB NS ZE PS PB
-3 x < -12 1.0 0.3 0.0 0.0 0.0
-2 -12 < x < -8 0.3 1.0 0.3 0.0 0.0
-1 -8 < x < -4 0.0 0.7 0.7 0.0 0.0
0 -4 < x < +4 0.0 0.3 1.0 0.3 0.0
1 +4 < x < +8 0.0 0.0 0.7 0.7 0.0
2 +8 < x < +12 0.0 0.0 0.3 1.0 0.3
3 +12 < x 0.0 0.0 0.0 0.3 1.0
CCA yck(Jan 2003) 14
Topic 5 - Fuzzy Logic Control
Rule Base
A collection of fuzzy control based on the control goals and control
policy given by the experts. Each fuzzy rule is a set-level implication
representing expert knowledge. A typical MISO system will have the
following rule base:
.
Rule 1: IF x
1
is A
11
AND AND x
m
is A
1m
THEN y is B
1
.
Rule 2: IF x
1
is A
21
AND AND x
m
is A
2m
THEN y is B
2
.

Rule n: IF x
1
is A
n1
AND AND x
m
is A
nm
THEN y is B
n
.
.
( A
ij
and B
i
are fuzzy sets such as PB, PM, PS, ZE, NS, NB )
A fuzzy control algorithm should be able to infer a proper control
action for any input in the universe of discourse referred to as
completeness.
CCA yck(Jan 2003) 15
Topic 5 - Fuzzy Logic Control
Number of Control Rules
If the number of fuzzy sets or predicates for each input variable is mand
the number of system input variables is n, then there are m
n
different
rules required for a completeness in a conventional system. FLC rule
base typically uses a small number of rules to attain completeness.
EXAMPLE
A FLC has been designed to improve the autofocus function in video camcorders.
The fuzzy logic control system uses 7 input variables to be judged and produces
one output, the focus. How many rules might be used if 3 predicates were utilized?
Number of rules = 3
7
or 3 x 3 x 3 x 3 x 3 x 3 x 3 = 2187.
If the number of predicates increase to 7, we will have 7
7
or 823,543 rules.
In this case, only 20 rules have been used in the FLC system and the
system performance is greatly enhanced.
CCA yck(Jan 2003) 16
Topic 5 - Fuzzy Logic Control
Reasoning Techniques
The 2 main fuzzy inference methods commonly used in industrial
FLC are:
.
The point-valued MAX-MIN fuzzy inference.
The point-valued MAX-DOT fuzzy inference.
Due to the nature of industrial process control, the input data is
most often crisp in nature. Hence, fuzzification involves treating
these as fuzzy singletons that are used with either MAX-MIN or
MAX-DOT.
Taking a fuzzy control rule base with 2 rules:
Rule 1: IF x is A
1
AND y is B
1
THEN z is C
1
.
Rule 2: IF x is A
2
AND y is B
2
THEN z is C
2
.
The fire strength of the ith rule for inputs x
0
and y
0
of the rule base are:

1
=
A1
(x
0
)
B1
(y
0
) and
2
=
A2
(x
0
)
B2
(y
0
)
is the min operator.
CCA yck(Jan 2003) 17
Topic 5 - Fuzzy Logic Control
Mamdanis Inference: MAX-MIN
The membership of the inferred consequence C is given by:

C
(w) = (
1

C1
(w) ) (
2

C2
(w) )
Input values x
0
and y
0
are regarded as fuzzy singletons.
= min
= max
CCA yck(Jan 2003) 18
Topic 5 - Fuzzy Logic Control
Larsens Inference: MAX-DOT
The membership of the inferred consequence C is given by:

C
(w) = (
1

C1
(w) ) (
2

C2
(w) )
Input values x
0
and y
0
are regarded as fuzzy singletons.
= product
= max
CCA yck(Jan 2003) 19
Topic 5 - Fuzzy Logic Control
Defuzzification Strategies
The process of mapping from a space of inferred fuzzy control actions
to a space of crisp ( non-fuzzy ) control actions that best represents
the possibility distribution of the inferred control action.
.
In real-time implementation of fuzzy logic control, the common
defuzzification strategies used are the mean of maximum (MOM)
and the center of area (COA).
Mean of Maximum
Generates a control action that represents the mean value of all
local actions whose membership functions reach the maximum.
z
MOM
= z
j
/ m = z dz / dz
m
j=1
z = support value at which the
membership value reaches
maximum value.
m = number of support values.
CCA yck(Jan 2003) 20
Topic 5 - Fuzzy Logic Control
Center of Area
EXAMPLE

z
A
Smallest of Max.
Largest of Max.
Mean of Max. (MOM)
Center of Area (COA)
Generates the center of gravity of the possibility distribution of the
control action.
z
COA
=
A
(z) z dz /
A
(z) dz
z = amount of control output.

A
(z) = membership value in
the output fuzzy set A.
=
A
(z) . z /
A
(z)
CCA yck(Jan 2003) 21
Topic 5 - Fuzzy Logic Control
5.4 DESIGN OF FUZY CONTROL RULES
Four principal methods have been employed to derive fuzzy control
rules based on the following:
.
An Experts Experience or Control Engineering Knowledge.
It is a heuristic approach aimed at capturing the experts rules of
thumb. Its is an iterative process, with the fuzzy parameters of the
initial system being tuned and adjusted until satisfactory
performance is achieved. Fuzzy control rules provide a natural
framework for capturing expert knowledge.
.
Modeling The Operators Control Actions.
It is a deterministic approach where modeling the operators
control actions is carried out by observing the human controllers
actions over a period of time and expressing them in terms of the
operational input-output data. The structure and control parameters
can be determined that satisfied the control objective.
CCA yck(Jan 2003) 22
Topic 5 - Fuzzy Logic Control
Fuzzy Modeling.
It is a qualitative modeling scheme by which the behavior of the
system to be controlled is qualitatively described using fuzzy
quantities or languages. Based on the fuzzy model model, we
can generate a set of fuzzy control rules to obtain optimal
performance of the system.
Self Organizing or Learning.
Fuzzy control systems can be built which simulate human
leaning and have the ability to create fuzzy control rules and to
modify them based on system performance. Such schemes
include neural networks, self-tuning and self-organization.
CCA yck(Jan 2003) 23
Topic 5 - Fuzzy Logic Control
EXAMPLE 1
FLC Plant
E
CE
CI
Y
Y
d
-
Objectives
Design a set of
fuzzy control
rules to reduce
the overshoot
and the rise
time.
5.5 DETAIL EXAMPLES ON FUZZY LOGIC CONTROL
CCA yck(Jan 2003) 24
Topic 5 - Fuzzy Logic Control
Assume that the fuzzy subsets for each input and output are represented by
the terms Negative, Zero and Positive i.e. [ N, Z, P ]. Then 2 fuzzy control
rules can be formulated as:
.
Type 1 - Shorten the rise time of the system.
IF E is Positive AND CE is negative THEN CI is Positive.
.
Type 2 - Decrease the overshoot of the system.
IF E is Negative AND CE is negative THEN CI is Negative.
Rule No. E CE CI References Functions
1 P Z P points a, e, i shortens rise time
2 Z N N points b, f, j reduce overshoot
3 N Z N points c, g, k reduce overshoot
4 Z P P points d, h, l reduce oscillation
5 Z Z Z set point braking system
6 P N P ranges A, E shorten rise time
7 N N N ranges B, F, J reduce overshoot
8 N P N ranges C, G reduce overshoot
9 P P P ranges D, H reduce oscillation
10 P N Z range I braking system
11 N P Z range K braking system
CCA yck(Jan 2003) 25
Topic 5 - Fuzzy Logic Control
Finer fuzzy partitions for each input/output variable will result in
better control performance such as using the following set
[ NB, NM, NS, ZE, PS, PM, PB ] for the fuzzy variable [ E,CE, CI ].
The principles to construct the fuzzy control rules for a FLC in
process control can be generalized as follows:
.
If the output has the desired value and the change of error is zero,
keep the output of the FLC constant.
.
If the output diverges from the desired value, the control action
depends on the sign and value of the error and its change.
A matrix can be used to express this control process. It is used to
approximate a human operators thinking and actions. Projecting the
matrix on an axis perpendicular to the main diagonal, we will have
the control form and policy.
CCA yck(Jan 2003) 26
Topic 5 - Fuzzy Logic Control
CE
-B -M -S -Z +Z +S +M +B
+B +Z +S -M -B -B -B -B -B
+M +S -Z -S -M -M -M -B -B
+S +M +S -Z -S -S -S -M -B
+Z +M +M +S +Z -Z -S -M -M
E -Z +M +M +S +Z -Z -S -M -M
-S +B +M +S +S +S +Z -S -S
-M +B +B +M +M +M +S +Z +Z
-B +B +B +B +B +B +M +Z +Z
-B -M -S -Z+Z+S+M+B
+B
+M
+S
-Z
+Z
-S
-M
-B
B


M


S





Z





S



M


B
P
o
s
i
t
i
v
e
N
e
g
a
t
i
v
e
Fuzzy Control
Matrix
Fuzzy Control
Resolution
CCA yck(Jan 2003) 27
Topic 5 - Fuzzy Logic Control
EXAMPLE 2
FLC Plant
E
CE
U
Y
Y
d
-
N Z P
P Z P P
Z N Z P
N N N Z
CE
E
Control Rules
Note: P - positive, N - negative, Z = zero
Find the output U given that E = 0.5
and CE = 0.25 using COA method.
1
E
P Z N
0 1 -1
1
CE
P Z N
0 0.5 -0.5
Membership
Functions
1
U
0 5 -5
N Z P
CCA yck(Jan 2003) 28
Topic 5 - Fuzzy Logic Control
1
E
P Z N
0 1 -1
1
CE
P Z N
0 0.5 -0.5
1
U
0 5 -5
N Z P
E=0.5 CE=0.25
0.5 0.5
At E = 0.5,
the fire strength for Z is 0.5
the fire strength for P is 0.5.
At CE = 0.25,
the fire strength for Z is 0.5
the fire strength for P is 0.5.
Thus, there are 4 active rules:
.
Rule 1: IF E is Z AND CE is Z THEN U is Z.
Rule 2: IF E is Z AND CE is P THEN U is P.
Rule 3: IF E is P AND CE is Z THEN U is P.
Rule 4: IF E is P AND CE is P THEN U is P.
CCA yck(Jan 2003) 29
Topic 5 - Fuzzy Logic Control
Outcome of the rules:
.
Rule 1: .. U is Z. output = 0V.
Rule 2: .. U is P. output = 5V.
Rule 3: .. U is P. output = 5V.
Rule 4: .. U is P. output = 5V.
Defuzzification using COA method:
U
crisp
= [ (0 x 0.5) + (5 x 0.5 ) + (5 x 0.5) + (5 x 0.5) ]
0.5 + 0.5 + 0.5 + 0.5
= 3.75.
CCA yck(Jan 2003) 30
Topic 5 - Fuzzy Logic Control
EXAMPLE 3
A moving crane is often
required in a factory workshop
to carry loads of various sizes
and weights. The load will
swing when the motion of the
crane is accelerated or
decelerated. A fuzzy control
can be developed to enable
high speed crane travel with
minimal load swing.
Position sensors are used to detect the swing angle . The swing
angular velocity is computed by differentiating the swing angle
and the previous swing angle.
CCA yck(Jan 2003) 31
Topic 5 - Fuzzy Logic Control
The swing angle and swing angular velocity are taken as inputs
to the fuzzy logic controller (FLC). The inferred output control
signal from the FLC is the change of the crane travel speed, CV.
Fuzzy Set Fuzzy Set
Fuzzy Set CV
CCA yck(Jan 2003) 32
Topic 5 - Fuzzy Logic Control
Using the human operators knowledge and intuition about the crane
operation, a fuzzy knowledge base is constructed. Some of the fuzzy
control rules are listed below:
Rule 1: IF is NB AND is N THEN CV is PS.
Rule 2: IF is NB AND is P THEN CV is PB.
Rule 3: IF is NS AND is N THEN CV is ZE.
Rule 4: IF is NS AND is P THEN CV is PS.
Rule 5: IF is ZE AND is Z THEN CV is ZE.
Rule 6: IF is PB AND is N THEN CV is NS.
Rule 7: IF is PB AND is P THEN CV is NB.
Rule 8: IF is NS AND is N THEN CV is ZE.
Rule 9: IF is NS AND is P THEN CV is NS.
Rule 10: IF is ZE AND is P THEN CV is NS.
Rule 11: IF is ZE AND is N THEN CV is PS.
CCA yck(Jan 2003) 33
Topic 5 - Fuzzy Logic Control
The crane swing control is realized by the control of the crane
speed that is implemented using the procedure below:
Crane is traveling
Load swing detection
Measure
i
Fuzzy inference
Inferred CV
Modify crane speed
V = V + CV
Compute
=
i

i-1
CCA yck(Jan 2003) 34
Topic 5 - Fuzzy Logic Control
EXAMPLE 4
A process control of inflow
valve V1 and outflow valve
V2 is used to measure the
liquid level L inside the tank
that is kept constant at 50%
level. The fuzzy variables
are level and valve positions
as shown.
The fuzzy rules used are:
Rule 1: IF the level is normal AND valve 2 is open THEN open valve 1.
Rule 2: IF the level is high AND valve 2 is half-open THEN close valve 1.
Rule 3: IF the level is low THEN open valve 1.
Rule 4: IF the level is low OR valve 2 is open THEN half open valve 1.
CCA yck(Jan 2003) 35
Topic 5 - Fuzzy Logic Control
Evaluation of
Rules 1, 2 & 4
for level of 70%
and valve 2
position at 60%.
CCA yck(Jan 2003) 36
Topic 5 - Fuzzy Logic Control
Continue
All activated rules are aggregated by using the max operator to
form a max-min inference and defuzzified using the COG or
COA method yielding a 50% valve position for V1.
How would the result change if max-product inference is used ?
CCA yck(Jan 2003) 37
Topic 5 - Fuzzy Logic Control
SELF-TEST QUESTIONS
Question 1
Which one is not a main element in
a fuzzy logic controller structure ?
(a) Knowledge base.
(b) Fuzzification unit
(c) Defuzzification unit
(d) PID rules.
Question 2
How many fuzzy rules are there if
the number of fuzzy sets for each
input variable is 3 and the number
of system input variables 4 ?
(a) 81
(b) 64
(c) 48
(d) 12
CCA yck(Jan 2003) 38
Topic 5 - Fuzzy Logic Control
Question 3
Fill in the blanks with the most appropriate answers.
The key issues in the design of a fuzzy logic controller are
construction___________________ and ________rules.
The fuzzy knowledge base consist of 2 main types of information
which are ____________ and ___________.
The process of acquiring crisp values and mapping this crisp values
into corresponding universe of discourse is called ______________.
Linguistic terms are used to define each system variable in the fuzzy
sets. Name some of these terms. Answer: _____________________.
The 2 main fuzzy inference used in industrial FLC are ___________
and ___________ inferences.
CCA yck(Jan 2003) 39
Topic 5 - Fuzzy Logic Control
Question 4
What are the 2 most popular method of defuzzification ?
(a) _____________ (b) ____________
Question 5
List down 4 ways that fuzzy control rules can be design ?
(a) _____________________________
(b) _____________________________
(c) _____________________________
(d) _____________________________
CCA yck(Jan 2003) 40
Topic 5 - Fuzzy Logic Control
Question 6
Apply the 2 most popular defuzzification methods to the following:

z
(a)
(b)
(c)
(d)