
ST52F510/F513/F514
56/106
Figure 8.3 Fuzzyfication
8.4 Defuzzyfication
In
this
phase the output crisp
values are
determined by implementing the consequent part
of the rules.
Each consequent Singleton Xi is multiplied by its
weight values
ω
i, calculated
by the Decision
processor, in order to compute the upper part of
the Defuzzyfication formula.
Each output value is obtained from the consequent
crisp values (Xi) by carrying out the following
Defuzzyfication formula:
where:
i = identifies the current output variable
N = number of the active rules on the current
output
ω
ij = weight of the j-th singleton
Xij = abscissa of the j-th singleton
The Decision Processor outputs are stored in the
RAM location i-th specified in the assembler
instruction OUT i.
8.5 Input Membership Function
The Decision Processor allows the management of
triangular Mbfs. In order to define an Mbf, three
different parameters must be stored on the
Program/Data Memory (see Figure 8.4):
s
the vertex of the Mbf: V;
s
the length of the left semi-base: LVD;
s
the length of the right semi-base: RVD;
In order to reduce the size of the memory area and
the computational effort the vertical range of the
vertex is fixed between 0 and 15 (4 bits)
By using the previous memorization method
different kinds of triangular Membership Functions
may be stored. Figure 8.5 shows some examples
of valid Mbfs that can be defined in ST52F510/
F513/F514.
Each Mbf is then defined storing 3 bytes in the first
Kbyte of the Program/Data Memory.
The Mbf is stored by using the following instruction:
MBF
n_mbf lvd v rvd
where:
n_mbf is a tag number that identifies the Mbf
lvd, v, and rvd are the parameters that describe the
Mbf’s shape as described above.
Figure 8.4 Mbfs Parameters
Input 1
X1
α1
Input 2
X2
α2
OR = Max
IF INPUT 1 IS X1 OR INPUT 2 IS X2 THEN .......
Input 1
X1
α1
Input 2
X2
α2
IF INPUT 1 IS X1 AND INPUT 2 IS X2 THEN .......
Y
i
X
ij ωij
j
N
ω
ij
j
N
---------------------
=
X
15
LVD
RVD
V
15
0
Input Mbf
Output Singleton
Output Variable
Input Variable
w