Documente Academic
Documente Profesional
Documente Cultură
Khurshid Ahmad,
Professor of Computer Science,
Department of Computer Science
Trinity College,
Dublin-2, IRELAND
1
October 29/Nov 5th, 2010
https://www.cs.tcd.ie/Khurshid.Ahmad/Teaching/Teaching.html
1
FUZZY CONTROL
Control Theory?
•The term control is
generally defined as a
mechanism used to guide
or regulate the operation of
a machine, apparatus or
constellations of machines
and apparatus.
2
FUZZY CONTROL
Control Theory?
An Input/Output Relationship 3
FUZZY CONTROL
Control Theory?
6
FUZZY CONTROL
Control Theory?
•Typically, rules contain membership functions for both
antecedents and consequent.
Mamdani Controller
If e(k) is positive(e) and Δe(k) is positive(Δe)
then Δu(k) is positive (Δu)
Takagi-Sugeno Controllers:
If e(k) is positive(e) and Δe(k) is positive(Δe) then Δu(k)
=e(k)+ß Δe(k)+δ;
11
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers
Mamdani style inference:
The Bad News: This method involves the computation of a two-
dimensional shape by summing, or more accurately integrating
across a continuously varying function. The computation can be
expensive.
For every rule we have to find the membership functions for the
linguistic variables in the antecedents and the consequents;
15
A solution for the coefficients of the
consequent in TSK Systems
Rule 1 : x is m1 ( x) THEN y p0 p1 x
COMPOSITIO N
m1 ( x) *[ p0 p1 x]
y
m1 ( x)
y1 p0 p1 x1
There are two
unknowns: p0 and y2 p0 p1 x2
p1. So we need
y1 y2
two simultaneous p1 ;
equations for two x1 x2
values of x, say x1
and x2, and two y1 y2
p0 y1
values of y – y1 and x1 x2 16
A solution for the coefficients of the
consequent in TSK Systems
Consider a two rule system:
COMPOSITIO N
m ( x) * [ p01 p11 x] m 2 ( x) *[ p02 p12 x]
y 1
m1 ( x) m 2 ( x)
m1 ( x) *[ p01 p11x] m 2 ( x) * [ p02 p12 x]
mˆ1 ( x)
m1 ( x) m 2 ( x)
y mˆ1 ( x) * [ p01 p11x] mˆ 2 ( x) * [ p02 p12 x] 17
A solution for the coefficients of the
consequent in TSK Systems
There are 4 unknowns p01, p11, p02, p12, so we need 4
equations. And, these can be obtained from 4
observations comprising 4 diffierent values of
and
y 4mˆ ( x) *[ p p x] mˆ ( x) *[ p p x]
1 01 11 2 02 12
P [ X T X ]1X T Y 21
A solution for the coefficients of the
consequent in TSK Systems
In order to determine the values of the parameters p in the
consequents, one solves the LINEAR system of algebraic
equations and tries to minimize the difference between the
ACTUAL output of the system (Y) and the simulation
[X]T[P] :
Y X P T
22
A solution for the coefficients of the
consequent in TSK Systems
In order to determine the values of the parameters p in the
consequents, one solves the LINEAR system of algebraic
equations and tries to minimize the difference between the
ACTUAL output of the system (Y) and the simulation
[X]T[P] :
Y X P T
23
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers
Takagi and Sugeno have described a fuzzy implication R as:
R: if (x1 is mA(x1),… xk is mA(xk)) then y = g(x1, …, xk), where:
24
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
25
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
26
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
A Mamdani Controller
Recall that the rules governing the air-
conditioner are as follows:
RULE#1: IF TEMP is COLD THEN SPEED is MINIMAL
27
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
28
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
1
0.9
0.8 Cold
Truth Value
0.7
0.6
Cool
0.5 Pleasent
0.4
0.3 Warm
0.2 Hot
0.1
0
0 5 10 15 20 25 30
Temperature Degrees C
30
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
The analytically expressed membership for the reference fuzzy subsets for the
temperature are:
T
' COLD ' m COLD (T )
1 0 T 10;
10
T
' COOL ' m COOL (T ) 0 T 12.5
12.5
T
m COOL (T ) 3.5 12.5 T 17.5;
5
T
' PLEASENT ' m PLEA (T ) 6 15 T 17.5
2.5
T
m PLEA (T ) 8 17.5 T 20;
2.5
T
'WARM ' ' m W ARM (T ) 3.5 17.5 T 22.5
5
T
m W ARM (T ) 5.5 22.5 T 27.5
5
T
' HOT ' m HOT (T ) 11 25 T 30
2.5 31
m HOT (T ) 1 T 30
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
1
0.8 MINIMAL
Truth Value
0.6 SLOW
MEDIUM
0.4 FAST
0.2 BLAST
0
0 10 20 30 40 50 60 70 80 90 100
Speed
32
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
1
0.9
0.8
Membership Function
0.7 MINIMAL
0.6 SLOW
0.5 MEDIUM
0.4 FAST
0.3 BLAST
0.2
0.1
0
0 20 40 60 80 100 120 140
Speed
35
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
FUZZIFICATION: Consider that the temperature is 16oC
and we want our knowledge base to compute the speed.
The fuzzification of the the crisp temperature gives the
following membership for the Temperature fuzzy set:
mCOLD mCOOL mPLEASENT mWAR mHOT
M
36
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
37
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
COMPOSITION: The COOL and PLEASANT sets have an output of 0.3 and
0.4 respectively. The singleton values for SLOW and MEDIUM have to be given an
alpha-level cut for these output values respectively:
0.45
Membership Function (alpha-cut)
0.4
0.35
0.3 MINIMAL
0.25 SLOW
MEDIUM
0.2
FAST
0.15 BLAST
0.1
0.05
0
0 20 40 60 80 100 120
Speed
38
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
1
y m
output
( y)
m
output x 1...... xn
x 1...... xn
( y) 39
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
y m output
( y)
x1 ...... xn
mx
output
1...... xn
( y)
m (.) m x ''
SLOW MEDIUM
_
x'
_ (.)
40
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
m (.) m x ''
SLOW MEDIUM
_
x'
_ (.)
(0.3 * 30 0.4 * 50)
41.42857
(0.3 0.4)
41
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
20 0.3 0 0.3 6
The
22.5 0.3 0 0.3 6.75
27.5
30
0.3
0.3
0
0
0.3
0.3
8.25
9
speed
32.5
35
0.3
0.3
0
0
0.3
0.3
9.75
10.5
is
36.91
37.5 0.3 0 0.3 11.25
40 0.3 0 0.3 12
42.5
45
0.3
0.25
0.25
0.4
0.3
0.4
12.75
18
RPM
47.5 0.125 0.4 0.4 19
50 0 0.4 0.4 20
55 0 0.4 0.4 22
DEFUZZIFICATION:
η= (0.4*50)/0.4=50 RPM
44
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
Takagi- Mamdani
Controller Sugeno (RPM)
(RPM)
Centre of
Area 41.43 36.91
Mean of
Maxima 50.00 50.00
45
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
x is μ A and y is μB μ A μB
47
FUZZY CONTROL
FUZZY CONTROLLERS- An example
A worked example
Consider an FLC of Mamdani type:
e(k)
N Z P
e(k) N N N Z
Z N Z P
P Z P P
The nine rules express the dependence of (change) in the value of control
output on the error (the difference between expected and output values)
and the change in error).
This dependence will capture some very complex non-linear, and linear
relationships between e and Δe and Δu. 49
FUZZY CONTROL
FUZZY CONTROLLERS- An example
A zero-order Takagi-Sugeno Controller
e(k)
N Z P
e(k) N 1 2 3
Z 4 5 6
P 7 8 9
e(k)
N Z P
e(k) N 1e+ß1 e +δ1 2e+ß2 e+ δ2 3e+ß3 e+ δ3
Z 4e+ß4 e +δ4 5e+ß5 e+ δ5 6e+ß6 e+ δ6
P 7e+ß7 e+ δ7 8e+ß8 e+ δ8 9e+ß9 e+ δ9
Rule 1:If e(k) is negative AND e(k) is negative then u(k) =1e+ß1 e+δ1
Rule 9:If e(k) is positive AND e(k) is positive then u(k) =9e+ß9 e+δ9
51
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers
Takagi and Sugeno have described a fuzzy implication R is of the
format:
R: if (x1 is mA(x1),… xk is mA(xk)) then y = g(x1, …, xk), where:
R: if x1 is m1 and … and xk is mk
then y = p0 + p1x1 + … + pkxk.
Reasoning Algorithm
Recall the arguments related to the membership
functions of the union and intersection of fuzzy sets.
The intersection of sets A and B is given as:
mAB = min (mA, mB)
We started this discussion by noting that we will
explore the problems of multivariable control
(MultipleInputSingleOutput). Usually, the rule base in
a fuzzy control system comprises a number of rules;
in the case of multivariable control the relevant rules
have to be tested for what they imply. 56
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers
Consider a system with n implications (rules); the variable of
consequence, y, will have to be notated for each of these implications,
leading to yi variables of consequence. There are three stages of
computations in Takagi-Sugeno controllers:
FUZZIFICATION: Fuzzify the input. For all input variables compute the
implication for each of the rules;
INFERENCE or CONSEQUENCES: For each implication compute the
consequence for a rule which fires. Compute the output y for the rule by
using the linear relationship between the inputs and the output (y = p0 +
p1x1 + … + pkxk.).
AGGREGATE (& DEFUZZIFICATION): The final output y is inferred
from n-implications and given as an average of all individual implications
yi with weights |y= yi |:
y = ( |y= yi | * yi )/ |y= yi |
58
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers
The membership function for small1, small2, big1 and
big2 are given as follows
x Sm all1 Sm all2 Big1 Big2
0 1 1 0 0
1 0.938 0.875 0 0
2 0.875 0.75 0 0
3 0.813 0.625 0 0.125
4 0.75 0.5 0 0.25
5 0.688 0.375 0 0.375
6 0.625 0.25 0 0.5
7 0.563 0.125 0 0.625
8 0.5 0 0 0.75
9 0.438 0 0 0.875
10 0.375 0 0 1
11 0.313 0 0.1 1
12 0.25 0 0.2 1
13 0.188 0 0.3 1
14 0.125 0 0.4 1
15 0.063 0 0.5 1
16 0 0 0.6 1
17 0 0 0.7 1
18
19
0
0
0
0
0.8
0.9
1
1 59
20 0 0 1 1
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers
The membership function for small1, small2, big1 and big2 are
given as follows
Takagi-Sugeno Example pp 117
1
0.9
0.8
Membership Function
0.7
Small1
0.6
0.5
Small2
0.4
0.3 Big1
0.2
0.1 Big2
0
0 5 10
Input x
15 20
60
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers An example
x1 = 12 & x2 = 5
using Takagi and Sugeno’s formula:
y = (Σ |y= yi | * yi )/ Σ |y= yi |
62
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers An example
INFERENCE & CONSEQUENCE:
x1 = 12 & x2 = 5
Truth Value
Min (Premise 1 & Premise2)
Rule Premise 1 Premise 2 Consequenc
e
R1 Small1 ( x1 ) Small2 ( x2 ) y(1)= x1 + x2 Min(0.25, 0.375)=0.25
= 0.25 = 0.375 =12+5
63
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers An example
AGGREGATION (&DEFUZZIFICATION):
x1 = 12 & x2 = 5
y = ( |y= yi | * yi )/ |y= yi |
Using a Centre of Area computation for y we get:
y y (i )
* y (i )
i 1,3
y
y y (i )
i 1,3
0.25 *17 0.2 * 24 0.375 *15
y 17.8
0.25 0.2 0.375 64
FUZZY CONTROL
FUZZY CONTROLLERS
Key difference between a Mamdani-type fuzzy system and the
Takagi-Sugeno-Kang System?
A zero-order Sugeno fuzzy model can be viewed as a special
case of the Mamdani fuzzy inference system in which each rule
is specified by fuzzy singleton or a pre-defuzzified consequent.
In Sugeno’s model, each rule has a crisp output, the overall
input is obtained by a weighted average – this avoids the time-
consuming process of defuzzification required in a Mandani
model. The weighted average operator is replaced by a
weighted sum to reduce computation further. (Jang, Sun,
Mizutani (1997:82)).
65
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers
X
X
X
X X
Takagi, T., & Sugeno, M. (1985). ‘Fuzzy Identification of Systems and its
Applications to Modeling and Control’. IEEE Transactions on Systems, Man and 66
Cybernetics. Volume No. SMC-15 (No.1) pp 116-132.
FUZZY CONTROL
FUZZY CONTROLLERS – Takagi-Sugeno Controllers
e(k)
N Z P
e(k) N N N Z
Z N Z P
P Z P P
where the matrix interrelates the error value e(k) at a given time k, e(k) denotes
the change in error (= e(k) - e(k-1)), and the control change u(k) is defined as
the difference between u(k) and u(k-1). The term-sets of the input and output
variables of the FLC error e, error change e and control change u by the
linguistic labels negative (N), approximately zero (Z) and positive (P). The
68
above FLC matrix can equivalent antecedent/consequent rule set
FUZZY CONTROL
FUZZY CONTROLLERS
e is approximately zero
u is positive
e is negative
69
FUZZY CONTROL
FUZZY CONTROLLERS
Consider a fuzzy rule base comprising an n-rule rule-
base inputs A&B and output C. Let χAm and χBm and χCm
denote the linguistic values represented as fuzzy subsets
of the respective universes of discourse α (for A), β (for
B), and κ (for C):
IF A is A & B is B THEN C is C
1 1 1
IF A is A & B is B THEN C is C
2
2 2 2
IF A is An & B is B THEN C is C
n n 70
FUZZY CONTROL
FUZZY CONTROLLERS
The rule-base in itself is a DISJUNCTION in that given an
input value for A and B, all rules will be tested and whilst
some will fire and others will fail to fire. The degree of
firing or level of firing of the ith rule with respect to input
values A=α1 and B=β1
τi= (χAi Λ χBi)≈ min(χAi,χBi)
will be chosen. This looks like an OR operation over all the
rules.
IF A is A & B is B THEN C is C
1 1 1
IF A is A & B is B THEN C is C
2
2 2 2
IF A is An & B is B THEN C is C 71
n n
FUZZY CONTROL
FUZZY CONTROLLERS
Note that the degree of firing or level of firing of the ith rule
with respect to input values A=α1 and B=β1
72
FUZZY CONTROL
FUZZY CONTROLLERS
Another way of writing a fuzzy rule-base is as
follows
IF A is A & B is B THEN C is C
1 1 1
ALSO
IF A is A & B2is B THEN C is C
2 2 2
ALSO
IF A is An & B is B THEN C is C
n n
Fi i Ci 74
FUZZY CONTROL
FUZZY CONTROLLERS
Next we have to look at the aggregation of the
output of all the rules for finally generating an
output: The overall system output is given as
F ( ) i Fi ( )
or
F ( ) i ( i i ( ))
75
FUZZY CONTROL
FUZZY CONTROLLERS
Defuzzification
76
FUZZY CONTROL
FUZZY CONTROLLERS
A CONTROL PROCEDURE
77
FUZZY CONTROL
FUZZY CONTROLLERS
The level of matching: between the linguistic label Bi1 and
the input value x1 is determined by the membership
grade of x1* in the fuzzy set representing Bi1: Bi1(x1*)
as the level of matching for the first antecedant.
Similarly Bi2(x2*) is the level of matching for the
second antecedant.
1. The level or degree of firing for a rule set of the type
Rule: If U1 is Bi1 AND U2 is Bi2 THEN V is Di
which has a conjunctive connection.
The degree of firing (DOF) of the ith rule with
respect to input values U1 is x1* and U2 is x2* is given
as i: i = Bi1(x1*) Bi2(x2*)
min(Bi1(x1*), Bi2(x2*))
78
FUZZY CONTROL
FUZZY CONTROLLERS
EXAMPLE
U1 error e(k)
U2 change of error e(k)
and
V change of control u
B11 positive
B32 approximately zero
Given the inputs to an FLC are the values U1 = x1*
and U2 = x2*, then we are faced with the problem
of determining the appropriate value of the
variable V.
79
FUZZY CONTROL
FUZZY CONTROLLERS
2. The output of individual rule (Fi(y)) depends on the
interaction between the DOF) (i) and the consequent
of the rule (Di).
Fi(y) = i Di
min (i, Di)
80
FUZZY CONTROL
FUZZY CONTROLLERS
3. The aggregation of the individual rule outputs to
obtain the overall control system output (Fy).
The rules are ‘chained’ through ALSO thus
individual rule outputs are aggregated using the
disjunctive connective ALSO. The overall system
output is:
(Fy) = ViFi(y) = Vi(iDi(y))
OR connective
e(k)
N Z P
e(k) N 1e+ß1 e+δ1 2e+ß2 e+δ2 3e+ß3 e+δ3
Z 4e+ß4 e+δ4 5e+ß5 e+δ5 6e+ß6 e+δ6
P 7e+ß7 e+δ7 8e+ß8 e+δ8 9e+ß9 e+δ9
which expresses rules like:
Rule 1: If e(k) is negative AND e(k) is negative then u(k) =1e+ß1 e+δ1
Rule 9: If e(k) is positive AND e(k) is positive then u(k) =9e+ß9 e+δ9
83
FUZZY CONTROL
FUZZY CONTROLLERS- An example
Example
FLC of Takagi-Sugeno type:
e(k)
N Z P
e(k) N k1 k2 k3
Z k4 k5 k6
P k7 k6 k0
which expresses rules like:
84
FUZZY CONTROL
FUZZY CONTROLLERS- An example
Example
FLC of Mamdani type:
e(k)
N Z P
e(k) N N N Z
Z N Z P
P Z P P
http://ist.psu.edu/yen/FLtext/matlab/FuzzyControl/
86
FUZZY CONTROL
FUZZY CONTROLLERS- An example
The membership functions for the three elements of the term set for the
error e are given as:
0 e0
e2
m negative
error
(e) 2e0
e 2
1
0 e0
e2
m error
positive(e) 0e2
e 2
1
0 e 2 & e 2
e
m zero
error
(e) 1 2e 2
2
1 e0 87
FUZZY CONTROL
FUZZY CONTROLLERS
The reference fuzzy set for the error for a specific case is given as:
Reference Fuzzy Sets for Error e
1
0.9
Membership Function
0.8
0.7
0.6 Negative
0.5 Zero
0.4 Positive
0.3
0.2
0.1
0
-3 -2 -1 0 1 2 3
Error Value
88
FUZZY CONTROL
FUZZY CONTROLLERS- An example
The membership functions for the three elements of the term set for the
change in error e are given as:
0 e 0
m error change
negative (e) 2e 1 / 2 e 0
e 1 / 2
1
0 e 0
m error change
positive (e) 2e 0 e 1
2
e 1 2
1
0 e 1 2 & e 1
2
m error change
zero (e) 2 e 1 1 2 e 1 2
e 0
1
89
FUZZY CONTROL
FUZZY CONTROLLERS
The reference fuzzy set for the change in error e is given as:
1
0.9
Membership Value
0.8
0.7
0.6 Negative
0.5 Zero
0.4 Positive
0.3
0.2
0.1
0
-1 -0.5 0 0.5 1
Error Change
90
FUZZY CONTROL
FUZZY CONTROLLERS- An example
The membership functions for the three elements of the term set for the
change in control u are given as:
0 u 0
controlchange
mnegative ( u ) 1 3 u 3 u 0
u 3
1
0 u 0
change
m error
positive ( u ) 13 u 0 u 3
u 3
1
0 u 3 & u 3
errorchange
u
m zero ( u ) 3 1 3 u 3
1 u 0
91
FUZZY CONTROL
FUZZY CONTROLLERS
The reference fuzzy set for the change in control u is given as:
Reference Fuzzy Sets for Change of Control
0.9
Membership Values
0.8
0.7
0.6 Negative
0.5 Zero
0.4 Positive
0.3
0.2
0.1
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
Change of Control
92
FUZZY CONTROL
FUZZY CONTROLLERS – An example
93
FUZZY CONTROL
FUZZY CONTROLLERS – An example
94
FUZZY CONTROL
FUZZY CONTROLLERS – An example
95
FUZZY CONTROL
FUZZY CONTROLLERS – An example
96
FUZZY CONTROL
FUZZY CONTROLLERS – An example
97
FUZZY CONTROL
FUZZY CONTROLLERS – An example
98
FUZZY CONTROL
FUZZY CONTROLLERS – An example
We need the the membership functions for the output in a discrete form.
By equidistant discretization of the universe Y
Y=[-6,-4.5,-3,-1.5,0,1.5,3,4.5,6])
we have:
Negative Negative Zero Negative Zero Positive Zero Positive Positive
u D1 D2 D3 D4 D5 D6 D7 D8 D9
-6 1 1 0 1 0 0 0 0 0
-4.5 1 1 0 1 0 0 0 0 0
-3 1 1 0 1 0 0 0 0 0
-1.5 0.5 0.5 0.5 0.5 0.5 0 0.5 0 0
0 0 0 1 0 1 0 1 0 0
1.5 0 0 0.5 0 0.5 0.5 0.5 0.5 0.5
3 0 0 0 0 0 1 0 1 1
4.5 0 0 0 0 0 1 0 1 1
6 0 0 0 0 0 1 0 1 1
99
FUZZY CONTROL
FUZZY CONTROLLERS – An example
Consider the case where e(k)= -2.1 and e(k)= 0.5. The fuzzification of the
input leads to two observations:
0 e0
e2
m error
negative (e) 2 e 0
e 2
1
m error
negative ( 2.1) 1
0 e 0
m error change
positive (e) 2e 0 e 12
1 e 12
m error change
positive (0.5) 1
100
FUZZY CONTROL
FUZZY CONTROLLERS – An example
Consider the case where e(k)= -2.1 and e(k)= 0.5. The fuzzification of the
input leads to two observations:
0 e0
e2
m error
negative (e) 2 e 0
e 2
1
m error
negative ( 2.1) 1
0 e 0
m error change
positive (e) 2e 0 e 12
1 e 12
m error change
positive (0.5) 1 101
FUZZY CONTROL
FUZZY CONTROLLERS – An example
For the case where e(k)= -2.1 and e(k)= 0.5, the level or degree of firing for
the 9-rule rule set:
Rule1 1 & 0 0
Rule2 1 & 0 0
Rule3 1 & 1 1
Rule4 0 & 0 0
Rule5 0 & 0 0
Rule6 0 & 1 0
Rule7 0 & 0 0
Rule8 0 & 0 0
Rule9 0 & 1 0
102
FUZZY CONTROL
FUZZY CONTROLLERS – An example
The output of individual rule (Fi(y)) depends on the
interaction between the degree (level) of firing (DOF or i)
and the consequent of the rule (Di). We are considering the
case where e(k)= -2.1 and e(k)= 0.5.
D1 [ 1 1 1 0.5 0 0 0 0 0 ] 0
D2 [ 1 1 1 0.5 0 0 0 0 0 ] 0
D3 [ 0 0 0 0.5 1 0.5 0 0 0 ] 1
D4 [ 1 1 1 0.5 0 0 0 0 0 ] 0
D5 [ 0 0 0 0.5 1 0.5 0 0 0 ] 0
D6 [ 0 0 0 0 0 0.5 1 1 1 ] 0
D7 [ 0 0 0 0.5 1 0.5 0 0 0 ] 0
D8 [ 0 0 0 0 0 0.5 1 1 1 ] 0
D9 [ 0 0 0 0 0 0.5 1 1 1 ] 0
103
FUZZY CONTROL
FUZZY CONTROLLERS – An example
The MAMDANI method suggests that:
Fi(y) = i Di min (i, Di)
We are considering the case where e(k)= -2.1 and e(k)= 0.5.
F1=D11 [ 0 0 0 0 0 0 0 0 0 ]
F2=D22 [ 0 0 0 0 0 0 0 0 0 ]
F3=D33 [ 0 0 0 0.5 1 0.5 0 0 0 ]
F4=D44 [ 0 0 0 0 0 0 0 0 0 ]
F5=D55 [ 0 0 0 0 0 0 0 0 0 ]
F6=D66 [ 0 0 0 0 0 0 0 0 0 ]
F7=D77 [ 0 0 0 0 0 0 0 0 0 ]
F8=D88 [ 0 0 0 0 0 0 0 0 0 ]
F9=D99 [ 0 0 0 0 0 0 0 0 0 ]
104
FUZZY CONTROL
FUZZY CONTROLLERS – An example
The aggregation of the individual rule outputs to obtain the
overall control system output (Fy). The rules are ‘chained’
through ALSO thus individual rule outputs are aggregated
using the disjunctive connective ALSO.
F ( y) F ( y) ( D ( y))
i i i i i
The overall system output for the inputs e(k)= -2.1 and
e(k)= 0.5 is:
F( u) =[ 0 0 0 0.5 1 0.5 0 0 0]
u =[ -6 -4.5 -3 -1.5 0 1.5 3 4.5 6]
105
FUZZY CONTROL
FUZZY CONTROLLERS – An example
The extraction of a crisp output value: The output fuzzy set
cannot be used directly as input to the controlled system.
We need to select one element y* from the universe Y (e.g.,
u* from all possible values of u - the change of control).
So we should defuzzify: typically used methods of
defuzzification include the so-called centre of area method.
Let the output Y be a finite universe of discourse and F(y)
be a DISCRETE membership
function:
n
F ( yi ) yi
y* i 1
F ( yi )
106
FUZZY CONTROL
FUZZY CONTROLLERS – An example
The extraction of a crisp output value: Centre of Area
Computation:
The weighted average of the output fuzzy set with the
corresponding value of the membership function for each of
the change in control u for the inputs e(k)= -2.1 and e(k)=
0.5 is:
F( u) =[ 0 0 0 0.5 1 0.5 0 0 0]
u =[ -6 -4.5 -3 -1.5 0 1.5 3 4.5 6]
Defuzzifie d value of
[0 * (6) 0 * (4.5) 0 * (3) 0.5 * (1.5) 1* 0 0.5 *1.5 0 * 3 0 * 4.5 0 * 6]
u (k )
[0 0 0 0.5 1 0.5 0 0 0]
u (k ) 0 / 2 0
107
FUZZY CONTROL
FUZZY CONTROLLERS – Another example
For the case where e(k)= -0.9 and e(k)= 0.2, the level or degree of firing for
the 9-rule rule set:
e & e (=min {e, e})
Negative Zero Positive Negative Zero Positive Output
108
FUZZY CONTROL
FUZZY CONTROLLERS – Another example
The output of individual rule (Fi(y)) depends on the
interaction between the degree (level) of firing (DOF or i)
and the consequent of the rule (Di). We are considering the
case where e(k)= -0.9 and e(k)= 0.2
Negative Negative Zero Negative Zero Positive Zero Positive Positive
D1 D2 D3 D4 D5 D6 D7 D8 D9 Output
1 1 0 1 0 0 0 0 0 0
1 1 0 1 0 0 0 0 0 0.45
1 1 0 1 0 0 0 0 0 0.4
0.5 0.5 0.5 0.5 0.5 0 0.5 0 0 0
0 0 1 0 1 0 1 0 0 0.55
0 0 0.5 0 0.5 0.5 0.5 0.5 0.5 0.4
0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 1 0 1 1 0
0 0 0 0 0 1 0 1 1 0
109
FUZZY CONTROL
FUZZY CONTROLLERS – Another example
The MAMDANI method suggests that:
Fi(y) = i Di min (i, Di)
We are considering the case where e(k)= -0.9 and e(k)= 0.2.
F1=D11 [ 0 0 0 0 0 0 0 0 0 ]
F2=D22 [ 0.45 0.45 0.45 0.45 0 0 0 0 0 ]
F3=D33 [ 0 0 0 0.4 0.4 0.4 0 0 0 ]
F4=D44 [ 0 0 0 0 0 0 0 0 0 ]
F5=D55 [ 0 0 0 0.5 0.55 0.5 0 0 0 ]
F6=D66 [ 0 0 0 0 0 0.4 0.4 0.4 0.4 ]
F7=D77 [ 0 0 0 0 0 0 0 0 0 ]
F8=D88 [ 0 0 0 0 0 0 0 0 0 ]
F9=D99 [ 0 0 0 0 0 0 0 0 0 ]
110
FUZZY CONTROL
FUZZY CONTROLLERS – Another example
The aggregation of the individual rule outputs to obtain the
overall control system output (Fy). The rules are ‘chained’
through ALSO thus individual rule outputs are aggregated
using the disjunctive connective ALSO.
F ( y) F ( y) ( D ( y))
i i i i i
The overall system output for the inputs e(k)= -0.9 and
e(k)= 0.2 is:
112
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example
113
FUZZY LOGIC & FUZZY SYSTEMS
Knowledge Representation & Reasoning: The Air-conditioner Example