Motorola HC12 Refrence Manual page 305

Table of Contents

Advertisement

9.2.2 Rule Evaluation (REV and REVW)
Rule evaluation is the central element of a fuzzy logic inference program. This step
processes a list of rules from the knowledge base using current fuzzy input values from
RAM to produce a list of fuzzy outputs in RAM. These fuzzy outputs can be thought of
as raw suggestions for what the system output should be in response to the current
input conditions. Before the results can be applied, the fuzzy outputs must be further
processed, or defuzzified, to produce a single output value that represents the com-
bined effect of all of the fuzzy outputs.
The CPU12 offers two variations of rule evaluation instructions. The REV instruction
provides for unweighted rules (all rules are considered to be equally important). The
REVW instruction is similar but allows each rule to have a separate weighting factor
which is stored in a separate parallel data structure in the knowledge base. In addition
to the weights, the two rule evaluation instructions also differ in the way rules are en-
coded into the knowledge base.
An understanding of the structure and syntax of rules is needed to understand how a
microcontroller performs the rule evaluation task. The following is an example of a typ-
ical rule.
If temperature is warm and pressure is high then heat is (should be) off.
At first glance, it seems that encoding this rule in a compact form understandable to
the microcontroller would be difficult, but it is actually simple to reduce the rule to a
small list of memory pointers. The left portion of the rule is a statement of input condi-
tions and the right portion of the rule is a statement of output actions.
The left portion of a rule is made up of one or more (in this case two) antecedents con-
nected by a fuzzy and operator. Each antecedent expression consists of the name of
a system input, followed by is , followed by a label name. The label must be defined by
a membership function in the knowledge base. Each antecedent expression corre-
sponds to one of the fuzzy inputs in RAM. Since and is the only operator allowed to
connect antecedent expressions, there is no need to include these in the encoded
rule. The antecedents can be encoded as a simple list of pointers to (or addresses of)
the fuzzy inputs to which they refer.
The right portion of a rule is made up of one or more (in this case one) consequents.
Each consequent expression consists of the name of a system output, followed by is ,
followed by a label name. Each consequent expression corresponds to a specific
fuzzy output in RAM. Consequents for a rule can be encoded as a simple list of point-
ers to (or addresses of) the fuzzy outputs to which they refer.
The complete rules are stored in the knowledge base as a list of pointers or addresses
of fuzzy inputs and fuzzy outputs. In order for the rule evaluation logic to work, there
must be some means of knowing which pointers refer to fuzzy inputs, and which refer
to fuzzy outputs. There also must be a way to know when the last rule in the system
has been reached.
CPU12
REFERENCE MANUAL
FUZZY LOGIC SUPPORT
MOTOROLA
9-5

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cpu12

Table of Contents