Professional Documents
Culture Documents
University
ASTU
School of EEC
www.hhu.ac.kr
1
Contd
Structure of FLC
(2)
(1) (4)
(3)
(1) Fuzzification interface
(2) Knowledge base
(3) Decision-making logic
(4) Defuzzification interface
2. Fuzzification interface
Designing steps
• Identification of variables− input, output and state
variables must be identified of the plant which is
under consideration.
• Fuzzy subset configuration− The universe of
information is divided into number of fuzzy subsets
and each subset is assigned a linguistic label.
• Obtaining membership function− obtain the
membership function for each fuzzy subset.
• Fuzzification− The fuzzification process is initiated
in this step.
2
Contd
• Fuzzy rule base configuration− formulate the
fuzzy rule base by assigning relationship between
fuzzy input and output.
• Combining fuzzy outputs− By applying fuzzy
approximate reasoning, locate the fuzzy output and
merge them.
• Defuzzification− Finally, initiate defuzzification
process to form a crisp output.
Contd
Fuzzification interface
Crisp Scaling -1~1 Fuzzy
Fuzzifier
-5~5 factor 0~1
• Consists of the scaling factor and fuzzifier.
• Multiply the scaling factor so that the input value is
mapped to a predetermined set.
• The scaling factor is divided into linear, and
nonlinear which divides into several intervals and
multiplies different values.
• Converts input values into fuzzy values for use by
the fuzzy controller.
3
Contd
A (u ) fuzzy set A
u
-1 0 0.2 0.6 1
scaling factor
crisp
input 0.2
u 0= 2
Contd
When the measured value(u0) is reliable, u0 is
converted into a fuzzy singleton.
1 u u0
A (u )
0 u u0
4
Contd
When the measured value(u0) is not reliable, u0 is
converted into a fuzzy set.
If the error range of the sensor is ±, then u0 is
generally converted to a triangular fuzzy set with
widths of 1, 2, and 3 times as .
3. Knowledge base
Knowledge Base (KB)
• KB consists of database(DB) and rule base(RB).
• The DB provides necessary definitions, which are
used to define linguistic control rules and fuzzy data
manipulation.
- Discretization and normalization method of the
whole set of input variables, for example,
normalized to the interval [-1, 1] and discretized
- The form of an MF to define a fuzzy set
• The RB characterizes the control goals and control
policy of the domain experts.
5
Contd
• The number of levels nlevel is the number of levels to
discretize a variable.
• nlevel should be odd considering precision and
computational load.
• Precision= (b-a) / (nlevel-1), where a and b are end
points.
A B
u
-1 0 1
mfA= [0, 0, 0, 0, 0.3, 1, 0.3, 0, 0, 0, 0]
mfB= [0, 0, 0, 0, 0, 0, 0.3, 0.6, 1, 1, 1]
Contd
(Definition) Trapzoidal MF
Its shape is determined by four parameters a, b, c, d
(abcd). If a, b, or c, d are the same, one side
becomes vertical MF.
0 xa
xa
a xb
ba
A ( x) 1 bxc
d x
cxd
d c
0 dx
6
Contd
% Trapezoidal MF
function mf= trapmf(x, para)
a= para(1); b= para(2); c= para(3); d= para(4);
if a > b | b > c | c > d | a > d
error('Check the parameters a, b, c and d');
end
mf= ones(size(x));
index= find(x <= a | x >= d);
mf(index)= zeros(size(index));
Contd
if a ~= b
index= find(a < x & x < b);
mf(index)= (x(index)-a)/(b-a);
end
if c ~= d
index= find(c < x & x < d);
mf(index)= (d-x(index))/(d-c);
end
7
Contd
% Primary function calling trapmf
x= -1:0.01:1;
A1= trapmf(x, [-1 -1 -0.5 0]);
A2= trapmf (x, [-0.5 -0.1 0.1 0.5]);
A3= trapmf (x, [0 0.5 1 1]);
plot(x,[A1; A2; A3], 'k', 'linewidth',2)
axis([-1 1 0 1.2])
xlabel('x'), ylabel('\mu(x)')
box off
Contd
A1 A2 A3
1
0.8
(x)
0.6
0.4
0.2
0
-1 -0.5 0 0.5 1
x
8
Contd
(Definition) Triangular MF
Its shape is determined by three parameters a, b and c
(abc). Likewise, if a and b or b and c are the same,
one side becomes vertical MF.
0 xa
xa
a xb
b a
A ( x)
c x bxc
c b
0 cx
Contd
% Triangular MF
function mf= trimf(x, para)
a= para(1); b= para(2); c= para(3);
if a > b | b > c | a > c
error('Check the parameters a, b and c');
end
mf= zeros(size(x));
index= find(x < a | x > c);
mf(index)= zeros(size(index));
9
Contd
if a ~= b
index= find(a < x & x < b);
mf(index)= (x(index)-a)/(b-a);
end
if b ~= c
index= find(b < x & x < c);
mf(index)= (c-x(index))/(c-b);
end
Contd
% Primary function calling trimf
x= -1:0.01:1;
A1= trimf(x, [-0.5 0 0.5]);
A2= trimf(x, [0 1 1]);
A3= trimf(x, [-1 -1 0]);
plot(x,[A1; A2; A3], 'k', 'linewidth',2)
axis([-1 1 0 1.2])
xlabel('x'), ylabel('\mu(x)')
box off
10
Contd
A1 A2 A3
1
0.8
(x)
0.6
0.4
0.2
0
-1 -0.5 0 0.5 1
x
Contd
(Definition) Gauss MF
This function is determined by the two parameters
and c where c is the mean and the standard
deviation. The larger , the wider the MF.
( x c )2
A ( x)
2
e 2
11
Contd
% Gaussian curve MF
function mf= gaussmf(x, para)
sigma= para(1); c= para(2);
mf= exp(-0.5*(x-c).^2/sigma^2);
Contd
A1 A2 A3
1
0.8
(x)
0.6
0.4
0.2
0
-1 -0.5 0 0.5 1
x
12
Contd
(Definition) Sigmoid curve MF
Its shape is determined by two parameters a and c. c
is the inflection point and if the sign of a is negative,
the left side is open, and if it is positive, the right side
is open. The larger the absolute value of a, the steeper
the curve near the inflection point.
1
A ( x)
1 e a ( x c )
Contd
% Sigmoid curve MF
function mf= sigmf(x, para)
a= para(1); c= para(2);
mf= 1./(1+exp(-a*(x-c)));
13
Contd
A1 A2
1
0.8
(x)
0.6
0.4
0.2
0
-1 -0.5 0 0.5 1
x
Contd
(Definition) S-shaped curve MF
Its shape is determined by two parameters, l and r
where c = (l + r) / 2. The following is an example of
this function:
0 xl
2( x l )2 lxc
r l
A ( x)
1 2( x r )2 cxr
r l
1 xr
14
Contd
% S-shaped curve membership function.
function mf= smf(x, para)
L= para(1); R= para(2);
if L >= R
error('Check the parameters');
end
C= (L+R)/2;
mf= zeros(size(x));
Contd
index= find(x <= L);
mf(index)= zeros(size(index));
15
Contd
% Primary function calling sMF
x= -1:0.01:1;
A1= smf(x, [0 1]);
A2= 1-smf(x, [-1 0]);
plot(x,[A1; A2], 'k', 'linewidth',2)
axis([-1 1 0 1.2])
xlabel('x'), ylabel('\mu_A(x)')
box off
Contd
A1 A2
1
0.8
(x)
0.6
0.4
0.2
0
-1 -0.5 0 0.5 1
x
16
Contd
(Definition) Generalized bell curve
Its shape is determined by three parameters: a, b, and
c. c is the center of the curve, and the larger a, the
flatter the nipple, and the larger the value of b, the
steeper the inflection point.
1
A ( x) 2b
xc
1
a
, (b>0)
Contd
% Generalized bell curve MF
function mf= gbellmf(x, para)
a= para(1); b= para(2); c= para(3);
mf= 1./(1+abs((x-c)/a).^(2*b));
17
Contd
A1 A2 A3
1
0.8
(x)
0.6
0.4
0.2
0
-1 -0.5 0 0.5 1
x
Contd
Examples of discrete MFs
18
Contd
Fuzzy Partition of Input Space
• Fuzzy partition divides the input space into several
fuzzy slices, each of which is specified by a MF.
• Fuzzy partition should allow overlap between
adjacent fuzzy sets.
• For example, if three fuzzy values are set for input
variables x1 and x2, the input space consisting of up
to 33= 9 can be divided, and up to 9 different
control rules can be generated in terms of the input
space.
Contd
For example, 2-inputs and x1
1-output FLC u
x2 FLC
A1 A2 A3
C1 C2 C3
x1
-1 0 1
B1 B2 B3 u
0 0.5 1
x2
-1 0 1
19
Contd
Overlap of MFs
A1 A2 A3
No overlap x
A1 A2 A3 A1 A2 A3
x x
Moderate overlap Too much overlap
Contd
x1
u
x2 FLC
x2
R1: if x1 is A1 and x2 is B1, then u
B3 C2 C2 is C1 also
R2: if x1 is A1 and x2 is B2, then u
B2 C1 C1 is C1 also
B1 C1 C3 C4 .
x1 ..
A1 A2 A3
R7: if x1 is A3 and x2 is B3, then u
is C2
20
Contd
x1
u
x2 FLC
Contd
Fuzzy Control Rules
The rules are generally described by if-then statements.
Mamdai-type
R1: if x is A1 and y is B1, then z is C1 also
R2: if x is A2 and y is B2, then z is C2 also
…
Rn: if x is An and y is Bn, then z is Cn
Sugeno-type
R1: if x is A1 and y is B1, then z = f1(x,y)
R2: if x is A2 and y is B2, then z = f2(x,y)
…
Rn: if x is An and y is Bn, then z = fn(x,y)
21
Contd
Derivation of Fuzzy Control Rules
• Expert's experience and knowledge
- Many experts have found that fuzzy control rules
provide a convenient way to express their knowledge
and experience in the form of fuzzy if-then rules
• Based on operator's control actions
- Skilled human operators can control such systems quite
successfully without having any quantitative models in
mind.
- Control rules can be deduced from the observation of
human controller’s actions in terms of the input-output
operating data
Contd
22
Contd
Contd
• Based on the fuzzy model of a process
- The linguistic description of the dynamic
characteristics of a process may be viewed as a fuzzy
model. Based on the fuzzy model, we can generate a
set of fuzzy control rules.
• Based on learning
- Many FLCs have been built to emulate human
decision-making behavior, but few are focused on
human learning, namely, the ability to create fuzzy
control rules and to modify them based on experience.
- Procyk and Mamdani described the first self-
organizing controller (SOC).
23
4. Decision-Making
Contd
Mamdani-type Inference
input : x1 is A' (u0 ) and x2 is B ' (v0 )
rule R1: if x1 is A1 and x2 is B1, then z is C1 also
rule R2: if x1 is A2 and x2 is B2 , then z is C2
result : z is C '
24
Contd
input : x1 is u0 and x2 is v0
rule R1: if x1 is A1 and x2 is B1 , then z is C1
1 C1 ( w )
(w)
(w) C1'
C1'
w here 1 A1 ( u 0 ) B 1 ( v 0 )
Contd
input : x1 is u0 and x2 is v0
rule R2: if x1 is A2 and x2 is B2 , then z is C2
( w) 2 C2 ( w)
(w)
C 2'
C 2'
w here 2 A2 ( u 0 ) B 2 ( v 0 )
25
Contd
Contd
Sugeno-type Inference
input : x1 is u0 and x2 is v0
rule R1: if x1 is A1 and x2 is B1 , then z f1 ( x1, x2 )
rule R2: if x1 is Ai and x2 is Bi , then z f 2 ( x1 , x2 )
result : z= w0
26
Contd
Contd
For fuzzy singletons x1= u0 and x2= v0, i is
calculated as Sugeno-type inference, the final result
is calculated by
1 f1 ( u 0 , v 0 ) 2 f 2 ( u 0 , v 0 )
z
1 2
27
5. Defuzzification
Contd
Center Of Gravity(COG) Method
w0
w ( w)dw
c'
(w)dw
c'
28
Contd
For example, the inferred result of a fuzzy system is
as follows:
C'= 0.1/-1+0.5/-0.5+0.3/0+0.2/0.5, wC'
C ' ( w)
w
-1 -0.5 0 0.5
By the COG method
0.1 (1) 0.5 (0.5) 0.3 0 0.2 0.5
w0
0.1 0.5 0.3 0.2
0.1 0.25 0 0.1
0.227
1.1
Contd
For example, the inferred result of a fuzzy system is as
follows: C ' ( w)
0.5
w
-1 0
By the COG method 01 1 0
C' 0.5 w2 dw w3
w0 01 2 6
1
2
1 1 2 0 3
wdw
1 2 4
w
1
dw w
-1 0
29
Contd
Bisector Of Area(BOA) Method
BOA generates the element at the point where the left
and right MF areas of the fuzzy set are equal
w0 w(U )
w( L )
C ' ( w)dw
w0
C ' ( w)dw
Contd
For example
C'= 0.1/-1+0.5/-0.5+0.3/0+0.2/0.5, C'W
C ' ( w)
w
-1 -0.5 0 0.5
when w= -1, the left and right MGs are
Left= 0.1, Right= 0.5+0.3+0.2= 1.0
when w= -0.5
Left= 0.1+0.5= 0.6, Right= 0.3+0.2= 0.5
w0= -0.5
30
Contd
C ' ( w)
For example,
0.5
w
-1 0 0.5 1
By the BOA method
w0 0.5
C ' ( w) 0
(w 0.5)dw w0
(w 0.5)dw
0.5 1
w02 w0 0 w0 0.146
8
w
-1 0 w0 0.5 1
Contd
(Quiz 1) Consider the inferred result C' of a fuzzy
system. Determine w0 using the COG and BOA
methods, where C'W
C'= {(-1.5,0.1), (-1.0,0.1), (-0.5,0.7), (0,0.5), (0.5,
0.2), (1,0.2)}
C ' ( w)
w
-1.5 -1.0 -0.5 0 0.5 1.0
COG method BOA method
w c' ( w)dw w0 w(U )
w0
c' ( w)dw w( L )
C ' ( w)dw w0
C ' ( w)dw
31
Contd
Answer: COG method
C'= {(-1.5,0.1), (-1.0,0.1), (-0.5,0.7), (0,0.5), (0.5, 0.2),
(1,0.2)} C ' ( w)
w
-1.5 -1.0 -0.5 0 0.5 1.0
Contd
BOA method
C'= {(-1.5,0.1), (-1.0,0.1), (-0.5,0.7), (0,0.5), (0.5, 0.2),
(1,0.2)} C ' ( w)
w
-1.5 -1.0 -0.5 0 0.5 1.0
32
Contd
(Quiz 2) Consider the inferred result of a fuzzy
system. Determine w0 using the COG and BOA
methods, where C'W
C ' ( w)
0.5
0.3
w
-0.5 0 0.5 1
COG method BOA method
Contd
Answer: C ' ( w)
0.5
COG method 0.3
w
-0.5 0 0.5 1
0.5 1
w0
0
0.5wdw
0.5
0.3wdw
0.5 1
0.5dw
0 0.5
0.3dw
1 2 0.5 0.3 2 1
w w
4 0 2 0.5 0.175
0.4375
0.5 0.5 0.5 0.3 0.4
33
Contd
C ' ( w)
BOA method 0.5
0.3
w
-0.5 0 0.5 1
w0 0.5 1
0
0.5dw w0
0.5dw
0.5
0.3dw
Contd
Smallest Value Of Maximum(SOM) Method
If the MF of the fuzzy set has the maximum element
as
w j arg max C ' ( w)
w
SOM generates the smallest of wj.
w0 min( w j )
j
34
Contd
For example, we have C'W
C ' ( w)
0.5
0.3
w
-1 0 0.5 1
Contd
Largest Value Of Maximum(LOM) Method
If the MF of the fuzzy set has the maximum element
as
w j arg max C ' ( w)
w
LOM generates the largest of wj.
w0 max( w j )
j
35
Contd
For example, we have C'W
C ' ( w)
0.5
0.3
w
-1 0 0.5 1
Applying LOM yields
w j arg max C ' ( w) {w | 0 w 0.5}
w
w0 0.5
Contd
Mean Value Of Maximum(MOM) Method
If the MF of the fuzzy set has the maximum element
as
w j arg max C ' ( w)
w
MOM generates the mean of wj.
n
1
w0
n j 1
wj
36
Contd
For example, consider the inferred fuzzy set C'= 0.1/-
1+0.5/-0.5+0.5/0+0.2/0.5 where C'W
C'
w
-1 -0.5 0 0.5
Applying MOM yields
Contd
For example,
C ' ( w)
0.5
0.3
w
-1 0 0.5 1
Applying MOM yields
w j arg max C ' ( w) {w | 0 w 0.5}
w
w0 (0 0.5) / 2 0.25
37
Contd
(Quiz 3) Given the inferred fuzzy set C', defuzzify C'
to the corresponding crisp value w0 using COG,
BOA, SOM, LOM, and MOM, where C'W
C'= 0.1/-1+0.6/-0.5+0.6/0+0.3/0.5+0.1/1
C'
w
-1 -0.5 0 0.5 1
Contd
Answer: (1) COG method
C'= 0.1/-1+0.6/-0.5+0.6/0+0.3/0.5+0.1/1
38
Contd
(2) BOA method
C'= 0.1/-1+0.6/-0.5+0.6/0+0.3/0.5+0.1/1
C'
w
-1 -0.5 0 0.5 1
w= -0.5, the left and right MGs are
Left= 0.1+0.6= 0.7
Right= 0.6+0.3+0.1= 1.0
w0= -0.5
Contd
(3) SOM method
w j arg max C ' ( w) {0.5, 0}
w
w0 0.5
C'
(4) LOM method
w0= 0 w
-1 -0.5 0 0.5 1
(5) MOM method
w0= (-0.5+0)/2= -0.25
39
6. Advantages & Disadvantages
Advantages of FLC
• Robust− FLCs are more robust than PID controllers
because of their capability to cover a huge range of
operating conditions.
• Customizable− FLCs are customizable.
• Emulate human deductive thinking − Basically
FLC is designed to emulate human deductive
thinking, the process people use to infer conclusion
from what they know.
• Reliability − FLC is more reliable than conventional
control system.
• Efficiency − Fuzzy logic provides more efficiency
when applied in control system.
Contd
Disadvantages of FLC
• Requires lots of data − FLC needs lots of data to be
applied.
• Useful in case of moderate historical data − FLC
is not useful for programs much smaller or larger
than historical data.
• Needs high human expertise − This is one
drawback as the accuracy of the system depends on
the knowledge and expertise of human beings.
• Needs regular updating of rules − The rules must
be updated with time.
40
Q&A
41