Transcript Document

A fuzzy system is an universal approximator


A fuzzy rule-base system, FRBS = (ab, R, T, S, DEF), is a
family of fuzzy systems with membership functions ab a fuzzy
rule base R, the t-norm, for fuzzy aggregation T (i.e. operations
within one rule), the s-norm for fuzzy composition S (i.e.
operations among rules), and the defuzzification method DEF.
Defuzzification consists of the conversion of the fuzzy output
into a single crisp output.
Any given fuzzy system FS  FRBS is a universal approximator
according to a theorem. Let the fuzzy rule-based system FRBS
be the set of all fuzzy systems FS and f: U  Rn  R be a
continuous function defined on a universe of discourse U. For
each  > 0, there exists a FSe  FRBS such that
sup {  f(x) - FSe(x)  , x  U }  
Defuzzification
Process that converts a fuzzy set or fuzzy number into
a crisp value or number
 Defuzzification is such inverse transformation which
maps the output from the fuzzy domain back into the
crisp domain. The following defuzzification methods
are of practical importance:

• Center-of-Area (C-o-A)
• Center-of-Maximum (C-o-M)
• Mean-of-Maximum (M-o-M)


The Center-of-Area method is often referred to as the Center-ofGravity method because it computes the centroid of the composite area
representing the output fuzzy term.
Figure shows the membership functions of a linguistic output variable
MotorPower where the areas of ZE and PM are combined by the union
operator and thus their contour becomes the composite fuzzy output
for MotorPower. C-o-A defuzzification method computes the centroid
of this area
N
u* 
 u  u 
i 1
N
i
OUT
i
  u 
i 1
OUT
i



The Center-of-Maximum requires only the peaks of the membership
functions. Defuzzified value is determined by finding the fulcrum where
the weights are balanced. This method is also called by Height-Method
The crisp output is computed as a weighted mean of the term
membership maxima, weighted by the inference results.
Equations are very similar, except that for C-O-A it is used the areas of
each membership functions. For C-O-M it is used only their maxima.
Naturally the results are slightly different.
N
u* 
n
 u    u 
i
i 1
N
k 1
O ,k
i
n
  u 
i 1 k 1
O ,k
i

The Mean-of-Maxima is used when the maxima of the membership
functions are not unique, one can then take the mean of all maxima.
Max (I) is the inferred fuzzy output term with the highest degree of
truth and M is the integer number of such peaks.
M
um
u*  
m 1 M



It may be desirable to leave out the boundaries of the
control inference membership function. Hence, the set
over which the defuzzification is performed is only an acut in which the a is the threshold value.
The idea here is to try to make defuzzification insensitive
to multimodal fuzzy output inference.
Height method is a good choice when using triangular or
trapezoidal functions. However, the Gaussian membership
functions have a couple of important properties:
1. produces smooth mapping
2. universal approximation property can be easily proven
3. central limit theorem: usually data distributions tend to
be normal which can be approximated well by Gaussian
basis functions
• Recommended to use Center of Area

Criteria for comparison:
• Continuity
• Disambiguity (producing a crisp output for every combination of output
membership functions
• Plausibility (output lies approximately in the middle of support and has
a high degree of membership)
• Computational complexity
• Weight counting (weight information is not lost)




Which defuzzification method for what application?
Closed-loop control: continuity is important because jumps in the
controller output can cause instabilities and oscillations.
Pattern recognition: can use M-o-M defuzzification, because if one
wishes to identify objects by classification based on the most
plausible result yielding the similarity of the signal to the standard
objects.
Decision support: the choice of defuzzification technique depends on
the context of the decision. Quantitative decisions can use C-o-M
while M-o-M is recommended for qualitative decisions.
FUZZY CONTROL SYSTEM

A Fuzzy Control System consists of four blocks:
INPUT
FUZZIFICATION
DECISION
MAKING
LOGIC
KNOWLEDGE
BASE
OUTPUT
DEFUZZIFICATION
Six steps for creation and execution of a
rule based fuzzy system
1.
2.
3.
4.
5.
6.
Identify the inputs and their ranges and name them.
Identify the outputs and their ranges and name them.
Create the fuzzy partitions (degree of fuzzy
membership function) for each input and output.
Construct the rule base that the system will operate
under
Decide how the action will be executed by assigning
strengths to the rules
Combine the rules and defuzzify the output.

A seven rules fuzzy
system to output an
action for an
inverted pendulum
Where the fuzzy sets come from ?

Polling: The question “Do you agree that x is A?” is
stated to different individuals.
• An average is taken to construct the membership
function. Answers are typically yes/no type.

Direct rating: “How A is x?” This approach
supposes that the fuzziness arises from individual
subjective vagueness.
• The person is made to classify an object over and over
again in time in such a way that it is hard for he/she to
remember the past answers.
• The membership function is constructed by estimating
the density function.

Reverse rating: The question “Identify x which is A to the
degree A( x)” is stated to an individual or a group of
individuals.
• Responses are recorded and normally distributed distributions are
formed (mean and variance are estimated).

Interval estimation: The person is asked to give an interval that
describes best the access of x. This is suited to random set -view
of membership functions.
• Membership exemplification: “To what degree x is A?” Person may
be told to draw a membership function that best describes A.

Pairwise comparison: “Which is a better example of A, x1 or x2
and by how much?”
• The results of comparisons could be used to fill a matrix of relative
weights and the membership function is found by taking the
components of the eigenvector corresponding to the maximum
eigenvalue

Clustering methods: Membership functions are constructed
given a set of data.
• Euclidean norm is used to form clusters on data.

Neurofuzzy techniques: Neural networks are used to construct
membership functions.
• An essential part of forming membership functions is the input
space partitioning.A grid, which is fixed beforehand and it does not
change later. Set to some “initial value” and tuned.
• Fuzzy clusters are best suited for classification problems, because
they implement a similarity measure.

Genetic algorithm techniques:
• Evolutionary approach to optimize the cluster of data into fuzzy
sets
COLD
HOT
COOL GOOD WARM
1.0
8
o
11
o
14
o
o
o
o
17
20 23
26
o
Temperature ( C)
o
29
o
32
o
90 100
30 40 50 60 70 80
Motor Speed (RPM)
BLAST
STOP
IF COLD,
THEN
STOP
10 20
IF COOL,
THEN
SLOW
0
IF GOOD,
THEN
MEDIUM
SLOW MEDIUM FAST
Example of Fuzzy
Controller
Air – Conditioning
System
1.0

IF HOT,
THEN
BLAST
IF WARM,
THEN
FAST
Rules for the Air-Conditioning System
Rule 1
If temperature is cold then stop motor, vent is downward
Rule 2
If temperature is cool then motor speed is slow, vent is downward
Rule 3
If temperature is comfortable then motor speed is medium, vent is horizontal
Rule 4
If temperature is warm then motor speed is fast, vent is upward
Rule 5
If temperature is hot then blast motor speed, vent is upward

Fuzzy Inference Relating
Motor Speed and Vent
Angle For Temperature Input
Implementing Fuzzy Controllers

Can be either implemented in hardware or software

There are many degrees of freedom inherent to fuzzy
system design, requiring a great deal regarding trialand-error and the availability of easy ways to select
different fuzzification and defuzzification schemes.
Such flexibility suggests the use of software.
Development of Fuzzy Controller
with Matlab
.m programs are useful to translate the
implementation in other languages (C) and to have the
feeling in how to implement
 FIS Editor displays high-level information about a
Fuzzy Inference System. At the top is a diagram of the
system with each input and output clearly labeled. By
double-clicking on the input or output boxes, you can
bring up the Membership Function Editor. Doubleclicking on the fuzzy rule box in the center of the
diagram will bring up the Rule Editor.


The following program is an implementation in
MatLab® of a fuzzy controller with the following
characteristics:
• Rule based fuzzy controller
• It supports any number of inputs, limited only by the
processing capability of your computer and Matlab
• It supports any number of outputs, limited only by the
processing capability of your computer and Matlab
• Any input and output can have any number of triangular
membership functions. Each input or output may have
different number of membership functions
• You can defuzzify either by the height method or by
computing the center of gravity
Flowchart
Initialize execution
Controller Definition
Keyboard Data Input
Input Users Data
Fuzzification
Rules Computation
Defuzzification
Screen Output Data
Data Output
Inputs and Outputs Definition
1
E x am p le o f o n e v ar iab le w ith
5 m em b er sh ip f u n ctio n s
U n iv er se o f d isco u r se
1
E x am p le o f o n e v ar iab le w ith
3 m em b er sh ip f u n ctio n s
ne 2
ns  2
name_inputs  (var1, var2)
name_outputs  (s1, s2)
nr  4
e
ig
ar1= B
ule1: IFv
R
2
r_e 
1
1
r_ s 
2
1
2
2
0
1
2
1
1
0
1

2
2

al
m
ar2= S
ule2: IFv
R
Fuzzification
Rules Evaluation





The rules were generated by the vectors r_e e r_s . For
rules evaluation, the following procedure is made:
An auxiliary vector is used “aux” with ne (number of
inputs) elements equal to “1”.
For each input variable it is verified if that variable (j)
participate for the antecedent of that rule, if that is positive,
the element aux(j) is attributed the fuzzified input value
correspondent to the membership function of that rule
condition.
The truth value of the rule is the minimum value of aux
and it is stored into the matrix output_aux((i,j,k) where the
i indicates which is the output number, j indicates which is
the membership function and k indicates the rule number.
The final output matrix is the maximum value of each
input membership function evaluation
Defuzzification
ns

Height Method
s(i) 
(j - 1)
 ((output(i, j) * (nps(i)- 1)
j 1
ns
 output(i,j)
j 1

Center of Gravity

 (j - 1)

(j - 1)  ns 
1




 
area(i,
j)*

double_are
a(i,
j)*







(nps(i)- 1)  j 1 
j 1 
 (nps(i)- 1) (nps(i)- 1)  
ns
s (i ) 
ns
ns
j 1
j 1
 area(i, j)   double_area(i, j)
2


1 - output(i,j)  1
1
area(i, j)  
*




nps(i)
1
nps(i)
1

 2
2


1 - 2 * m in([0.5,output(i,j),output(i,j  1)]  1
1
double_area(i, j)  
*




nps(i)
1
nps(i)
1

 8
Two cases are presented

Case 1: 2 inputs were considered, one with 2 membership
functions within an universe of discourse between 5 and 50, and
another with three membership functions within an universe of
discourse between 0 and 1. 2 outputs were considered, one with 2
membership functions within an universe of discourse between 1
and 10, and another with 3 membership functions within an
universe of discourse between 4 and 20.

Case 2: The efficiency of fuel consumption for a car can be
described linguistically. It depends on the car velocity, air
dragging, thermal cycle.

The file case1.m shows the Matlab implementation
for this fuzzy modeling
Simulation
for Case 1
What is the variable_1 (5.0<x<50.0)?
45
What is the variable_2 (0.0<x<1.0)?
0.8
Defuzzification results with height method
The variable_3 is : 6.4
The variable_4 is : 10.56
Defuzzification results with center of gravity method
The variable_3 is : 5.944
The variable_4 is : 11.206
Simulation
for Case 1
What is the variable_1 (5.0<x<50.0)?
23
What is the variable_2 (0.0<x<1.0)?
0.2
Defuzzification results with height method
The variable_3 is : 4.6
The variable_4 is : 10.8571
Defuzzification results with center of gravity method
The variable_3 is : 5.056
The variable_4 is : 11.3363
Evaluation of fuel consumption
Efficiency of fuel consumption for a car can be
described linguistically.
 For small velocity the car takes too much fuel for the
thermal cycle itself, since the RPM is not optimized
 As your RPM is optimized and the speed increases the
air-dragging adds friction
 There is an intermediate optimal speed point

The car velocity is divided into three fuzzy sets as
below (Small, Medium and High)
FUNCOES DE PERTINENCIA - (OP OM OG)
1
0.9
0.8
0.7
0.6
SAIDA

0.5
0.4
0.3
0.2
0.1
0
0
10
20
30
40
50
60
70
UNIVERSO DE DISCURSO
80
90
100
Consumo x Velocidade
90
Large
80
Medium High
Medium
70
60
Medium
Medium Low
Consumo

Figure below shows the fuel consumption on the left side
depicted in from the linguistic description of the car velocity.
The Rules are:
1. If Vel is Small Then Consumption is High
2. If Vel is Medium Then Consumption is Low
3. If Vel is High Then Consumption is Medium
Consumption

50
40
Low
30
20
10 km/h 40 km/h 60 km/h 80 km/h
Car velocity
10
0
10
20
30
40
50
60
Velocidade
70
80
90
100

The file case2.m shows the Matlab implementation
for this fuzzy modeling

Development of fuzzy coding can
be easily done by using a Shell
Environment. There are several
companies with visual based
development platforms, Togai,
FuzzyTech, FIDE, just to name a
few.
•
•
•
•
Real-time on-line debugging and
tuning of rules, membership
functions and rule weights,
including addition and deletion of
rules
Graphical object-based "point and
click" CASE tool
User-defined inference methods
Color rulebase and operator
visualization tools
•
•

Fully integrated graphical
simulation of fuzzy systems and
conventional methods
ANSI and Keil C code generation
from the Fuzzy-C compiler
Those environments make
provisions for the following:
•
•
•
•
Reduction of programming efforts
Fast prototyping
Availability of several options
regarding several degrees of
freedom( typical of a fuzzy
systems)
Visual feedback for assessing fuzzy
controller modifications
Project Editor: Defining the control structure
“Spreadsheet Editor”: Defining the rule base
Membership editor: Graphically defining the
membership functions
Various types of defuzzification methods can be
selected
1
1
1
0.8
0.8
0.8
0.6
0.6
0.6
0.4
0.4
0.4
0.2
0.2
0.2
0
0
5
10
0
15 30
0
55
80
E
M
P
E
R
A
T
U
R
E
P
R
E
S
S
U
R
E T
0%
50%
100%
V
A
L
V
E
S
E
T
T
IN
G

The reason for using the fuzzy software development system described in the
foregoing is to tune the initial fuzzy design. This requires many iterations
involving modifications of both the rules and the membership functions. By
using the Interactive Debug option the designer can immediately visualize the
effect of each of such changes, thus he knows whether or not a particular
change has caused an improvement in system response. This visual feedback
is essential for fuzzy system design.

The Interactive Debug window, provides for entries for both inputs and
displays the current output as determined by the current fuzzy controller. If the
displayed value is incorrect, the designer can make modifications in the rules,
or the degree of support of the rules, or the membership functions
interactively, until the displayed output matches with the output value required
for the specific input combinations entered. By monitoring the threedimensional control surface the designer can also change the fuzzy inference
structure from max-min to another type provided by the software package. For
example, a smoother response with no creases or abrupt jumps of the control
surface can be obtained by using max-product type fuzzy inference.
Fuzzy Controllers in Industrial Environment
Industrial electronics use PID control,implemented by
embedded system or PLC programming
 PID control works well for linear processes
 PID control has poor performance in non-linear
processes
 Fairly complex systems usually need human control
operators for operation and supervision

Fuzzy Controllers
PID fuzzy control can implement a single feedback
loop
 A supervisory control can be implemented with fuzzy
rules to control the operation of standard PID
controllers running on every loop

c1(3)
c2(7)
1.2
c3(11)
b1(2)
Second-order
system output
1.0
Let us understand
the dynamics
of a controller
d1(4)
b2(6)
d3(12)
a3(9)
a2(5)
0.8
Reference
Level
b3(10)
d2(8)
0.6
0.4
0.2
a1(1)
0.0
0
5
10
15
20
25
Time (sec)
PB
PM
PS
AZ
NS
NM
NB
E \ DE
NB
NM
NS
AZ
PS
PM
PB
-5
0
0
0
0
0
0.4
1
-4
0
0
0
0
0.1
0.7
0.7
-3
0
0
0
0.1
0.4
1
0.4
-2
0
0
0.1
0.4
0.7
0.7
0.1
-1
0
0
0.4
0.7
1
0.4
0
NB
NM
NS
PM(17)
PB(4)
PM(8)
AZ(19)
PS(12)
0
0
0.1
0.7
1
0.7
0.1
0
AZ
NB(3)
NM(7)
NS(11)
AZ(13)
PS(9)
PM(5)
PB(1)
1
0
0.4
1
0.7
0.4
0
0
2
0.1
0.7
0.7
0.4
0,1
0
0
3
0.4
1
0.4
0.1
0
0
0
4
0.7
0.7
0.1
0
0
0
0
5
1
0.4
0
0
0
0
0
PS
PM
PB
NS(10)
AZ(18)
NM(16)
NB(2)
NM(15)
PM(14)
Rule Table
E
CE
NVL
NL
NM
NS
ZE
PS
PM
PL
PVL
NVL
NL
NM
NS
ZE
NL
NL
NM
NS
ZE
PS
NM
NL
NM
NS
ZE
PS
PM
NS
ZE
PS
PM
PL
PVL
NL
NM
NS
ZE
PS
PM
PL
NVL
NL
NM
NS
ZE
PS
PM
PL
PVL
NL
NM
NS
ZE
PS
PM
PL
NM
NS
ZE
PS
PM
PL
NS
ZE
PS
PM
PL
ZE
PS
PM
PL
Fuzzy – PI Controller
Block Diagram
KE
r +
*
Er
 r(pu)
r
FUZZY
CONTROL
+
Dr
Dr(pu)
KCE
-1
Z
KT
De*
+
Di*qs(pu)
T*e
+
Z-1
Supervising a multi-loop PID industrial process
PID
SUPERVISORY
FUZZY
CONTROLLER
PID
PROCESS
PID
Observable
variables
Control
Variables
PLANT
OUTPUTS
Fuzzy Decision Support Algorithm