Encoder Front Page
SRS Home | Front Page | Monthly Issue | Index
Search WWW Search seattlerobotics.org



by Steven D. Kaehler


This is the third in a series of six articles intended to share information and experience in the realm of fuzzy logic (FL) and its application. This article and the three to follow will take a more detailed look at how FL works by walking through a simple example. Informational references are included at the end of this article for interested readers.


In the last article the concept of linguistic variables was presented. The fuzzy parameters of error (command-feedback) and error-dot (rate-of-change-of-error) were modified by the adjectives "negative", "zero", and "positive". To picture this, imagine the simplest practical implementation, a 3-by-3 matrix. The columns represent "negative error", "zero error", and "positive error" inputs from left to right. The rows represent "negative", "zero", and "positive" "error-dot" input from top to bottom. This planar construct is called a rule matrix. It has two input conditions, "error" and "error-dot", and one output response conclusion (at the intersection of each row and column). In this case there are nine possible logical product (AND) output response conclusions.

Although not absolutely necessary, rule matrices usually have an odd number of rows and columns to accommodate a "zero" center row and column region. This may not be needed as long as the functions on either side of the center overlap somewhat and continuous dithering of the output is acceptable since the "zero" regions correspond to "no change" output responses the lack of this region will cause the system to continually hunt for "zero". It is also possible to have a different number of rows than columns. This occurs when numerous degrees of inputs are needed. The maximum number of possible rules is simply the product of the number of rows and columns, but definition of all of these rules may not be necessary since some input conditions may never occur in practical operation. The primary objective of this construct is to map out the universe of possible inputs while keeping the system sufficiently under control.


The first step in implementing FL is to decide exactly what is to be controlled and how. For example, suppose we want to design a simple proportional temperature controller with an electric heating element and a variable-speed cooling fan. A positive signal output calls for 0-100 percent heat while a negative signal output calls for 0-100 percent cooling. Control is achieved through proper balance and control of these two active devices.

Figure 1 - A simple block diagram of the control system.
It is necessary to establish a meaningful system for representing the linguistic variables in the matrix. For this example, the following will be used:
"N" = "negative" error or error-dot input level
"Z" = "zero" error or error-dot input level
"P" = "positive" error or error-dot input level
"H" = "Heat" output response
"-" = "No Change" to current output
"C" = "Cool" output response
Define the minimum number of possible input product combinations and corresponding output response conclusions using these terms. For a three-by-three matrix with heating and cooling output responses, all nine rules will need to be defined. The conclusions to the rules with the linguistic variables associated with the output response for each rule are transferred to the matrix.


Figure 2 - Typical control system response
Figure 2 shows what command and error look like in a typical control system relative to the command setpoint as the system hunts for stability. Definitions are also shown for this example.


INPUT#1: ("Error", positive (P), zero (Z), negative (N))
INPUT#2: ("Error-dot", positive (P), zero (Z), negative (N))
CONCLUSION: ("Output", Heat (H), No Change (-), Cool (C))
INPUT#1 System Status
Error = Command-Feedback
P=Too cold, Z=Just right, N=Too hot
INPUT#2 System Status
Error-dot = d(Error)/dt
P=Getting hotter Z=Not changing N=Getting colder
OUTPUT Conclusion & System Response
Output H = Call for heating - = Don't change anything C = Call for cooling

Linguistic rules describing the control system consist of two parts; an antecedent block (between the IF and THEN) and a consequent block (following THEN). Depending on the system, it may not be necessary to evaluate every possible input combination (for 5-by-5 & up matrices) since some may rarely or never occur. By making this type of evaluation, usually done by an experienced operator, fewer rules can be evaluated, thus simplifying the processing logic and perhaps even improving the FL system performance.

Figures 3 & 4 - The rule structure.
After transferring the conclusions from the nine rules to the matrix there is a noticeable symmetry to the matrix. This suggests (but doesn't guarantee) a reasonably well-behaved (linear) system. This implementation may prove to be too simplistic for some control problems, however it does illustrate the process. Additional degrees of error and error-dot may be included if the desired system response calls for this. This will increase the rulebase size and complexity but may also increase the quality of the control. Figure 4 shows the rule matrix derived from the previous rules.


Linguistic variables are used to represent an FL system's operating parameters. The rule matrix is a simple graphical tool for mapping the FL control system rules. It accommodates two input variables and expresses their logical product (AND) as one output response variable. To use, define the system using plain-English rules based upon the inputs, decide appropriate output response conclusions, and load these into the rule matrix.


[9] "Fundamentals of Fuzzy Logic: Parts 1,2,3" by G. Anderson (SENSORS, March-May 1993).

[10] "Fuzzy Logic Flowers in Japan" by D.G. Schartz & G.J. Klir (IEEE Spectrum, July 1992, pp. 32-35).

[11] "Fuzzy Logic Makes Guesswork of Computer Control" by Gail M. Robinson (Design News, Vol. 47, Nov. 28, 1991, pp. 21).

[12] "Fuzzy Logic Outperforms PID Controller" by P. Basehore (PCIM, March 1993).

File: FL_PART3.HTM 2-13-98