# An Introduction To Fuzzy Control Systems

v1.0 / 23 dec 95 / gvg

* This document is an elementary introduction to fuzzy control systems; it provides an overview of their theory of operation, followed by elementary examples of their use, and concludes with a review of implemented fuzzy control systems.

## [1.0] INTRODUCTION TO FUZZY LOGIC & FUZZY CONTROL

* "Fuzzy logic" has become a common buzzword in machine control as a means of making machines more capable and responsive ... however, the term itself invites a certain skepticism, much as if it had been named "half-baked logic" or "bogus logic".

Some other nomenclature might have been preferable (it's too late now) but fuzzy logic is actually quite straightforward. Fuzzy logic is a way of interfacing inherently analog processes that move through a continuous range to a digital computer that likes to see things as well-defined numeric values.

For example, consider an antilock braking system, directed by a microcontroller; the microcontroller has to make decisions based on brake temperature, speed, and other variables in the system.

The variable "temperature" in this system can be divided into a range of "states": "cold", "cool", "moderate", "warm", "hot", "very hot". However, the transition from one state to the next is hard to pin down; an arbitrary threshold might be set to divide "warm" from "hot", but this would result in a discontinuous change when the input value passed over that threshold. The microcontroller should be able to do better than that.

The way around this is to make the states "fuzzy" -- that is, allow them to change gradually from one state to the next. You could define the input temperature states using "membership functions" such as the following:

```        cold        cool  nominal  warm        hot
+-----------------------------------------------+
|                                               |
1 -+ * * * *       *       *       *       * * * * |
|        *     * *     * *     * *     *        |
|         *   *   *   *   *   *   *   *         |
|          * *     * *     * *     * *          |
|           *       *       *       *           |
|          * *     * *     * *     * *          |
|         *   *   *   *   *   *   *   *         |
|        *     * *     * *     * *     *        |
0 -+-------*-------*-------*-------*-------*-------+
T0      T1      T2      T3      T4      T5      T6  ```

Now the input variable's state no longer jumps abruptly from one state to the next; instead it loses value in one membership function while gaining value in the next. At any one time, the "truth value" of the brake temperature will almost always be in some degree part of two membership functions: 0.6 nominal and 0.4 warm, or 0.7 nominal and 0.3 cool, and so on.

The input variables in a fuzzy control system are in general mapped into by sets of membership functions similar to this -- "fuzzy sets", so to speak, and the process of converting a crisp input value to a fuzzy value is called "fuzzification". Note that a control system may have various types of switch (on/off) inputs along with its analog inputs, and such switch inputs of course will always have a truth value equal to either 1 or 0 -- but such inputs are really just a simplified case of a fuzzy variable and so the system can deal with them without trouble.

Given "mappings" of input variables into membership functions and truth values, the microcontroller then makes decisions for what action to take based on a set of "rules" that take the form:

```   IF brake temperature IS warm AND speed IS not very fast
THEN brake pressure IS slightly decreased.  ```

-- where, in this case, the two input variables are "brake temperature" and "speed". The output variable, "brake pressure", is similarly generated from a fuzzy set that can have values like "static", "slightly increased", "slightly decreased", and so on.

Anyway ... this rule by itself is very puzzling since it looks like a simple rule that could be used without worrying about fuzzy logic -- but remember the decision is based on a set of rules: all the rules that apply are invoked, using the membership functions and truth values obtained from the inputs, to determine the result of the rule -- which in turn will be mapped into a membership function and truth value controlling the output variable -- and then these results are combined to give a specific ("crisp") answer, the actual brake pressure ... a procedure known as "defuzzification". This combination of fuzzy operations and rule-based "inference" describes a "fuzzy expert system".

Traditional control systems are in general based on mathematical models that describe the control system using one or more differential equations that define the system response to its inputs; such systems are often implemented as so-called "PID" (proportional-integral-derivative) controllers. Such controllers are the products of decades of development and theoretical work and are highly effective.

If PID and other traditional control systems are so well-developed, why worry about fuzzy control? Only because it has some advantages: in many cases, the mathematical model of the control process may not exist or may be too "expensive" in terms of computer processing power and memory -- and a system based on empirical rules may be more effective.

Furthermore, fuzzy logic is well-suited to low-cost implementations based on cheap sensors, low-resolution analog-to-digital converters, and 4-bit or 8-bit one-chip microcontrollers, and such systems can be easily upgraded by adding new rules to improve performance or add new features. In many cases, fuzzy control can be used to improve existing controller systems by adding an extra layer of intelligence to the current control method.

## [2.0] FUZZY CONTROL IN DETAIL

* Fuzzy controllers are very simple conceptually; they consist of an input stage, a processing stage, and an output stage. The input stage maps sensor or other inputs (such as switches, thumbwheels, and so on) to the appropriate membership functions and truth values; the processing stage invokes each appropriate rule and generates a result for each, then combines the results of the rules; and finally the output stage converts the combined result back into a specific control output value.

The most common shape of membership functions is triangular, although trapezoidal and bell curves are also used, but the shape is generally less important than the number of curves and placement. From 3 to 7 curves are generally appropriate to cover the required range of an input value (the "universe of discourse" in fuzzy jargon).

The processing stage is, as already discussed, based on a collection of logic rules in the form of IF-THEN statements, where the IF part is called the "antecedent" and the THEN part is called the "consequent". Typical fuzzy control systems have dozens of rules.

Consider a rule for a thermostat:

`   IF (temperature is "cold") THEN (heater is "high")  `

This rule uses the truth value of the "temperature" input (some truth value of "cold") to generate a result in the fuzzy set for the "heater" output (some value of "high"); this result is used with the results of other rules to finally generate the crisp composite output. Obviously, the greater the truth value of "cold", the higher the truth value of "high" (though this does not necessarily mean that the output itself will be set to "high" ... again, this is only one rule among many).

In some cases, the membership functions can be modified by so-called "hedges" that are equivalent to adjectives; common hedges include "about", "near", "close to", "approximately", "very", "slightly", "too", "extremely", and "somewhat". These operations may have precise definitions, though the definitions can vary considerably; "very", for one example, squares membership functions -- since the membership values are always less than 1, this narrows the membership function. "Extremely" cubes the values to give greater narrowing; while "somewhat" broadens the function by taking the square root.

In practice, the fuzzy rule sets usually have several antecedents that are combined using fuzzy operators, such as AND, OR, and NOT (though again the definitions tend to vary): AND (in one popular definition) simply uses the minimum weight of all the antecedents, while OR uses the maximum value. (There is also a NOT operator that subtracts a membership function from 1 to give the complementary function.)

There are several different ways to define the result of a rule, but one of the most common and simplest is the so-called "max-min" inference method, in which the output membership function is given the truth value generated by the premise.

Rules can be solved in parallel in hardware or sequentially in software. The results of all the rules that have fired are "defuzzified" to a crisp value by one of of several methods; there are dozens in theory, each with various advantages and drawbacks.

The "centroid" method is very popular, in which the "center of mass" of the result provides the crisp value; another approach is the "height" method, which takes the value of the biggest contributor. The centroid method favors the rule with the output of greatest area, while the height method obviously favors the rule with the greatest output value.

The diagram below demonstrates max-min inferencing and centroid defuzzification for a system with input variables "x", "y", and "z" and an output variable "n"; note that "mu" is standard fuzzy-logic nomenclature for "truth value":

```   __________________________________________________________________

Centroid Defuzzification Using Max-Min Inferencing
__________________________________________________________________

rule 1:  IF x IS A THEN n IS D:

|
A  *          |         *  D
* *         |        * *
*   *        |       *   *
*     *       |      *     *
*       * -----+---- x x x x x   mu(x)
*        |*     |    x x x x x x
*         | *    |   x x x x x x x
*          |  *   |  x x x x x x x x
-------------+------+-----------------------------------
x

rule 2:  IF y IS B THEN n IS E:

|
B  *          |                 *  E
* *         |                * *
*   * -------+-------------- y y y   mu(y)
*    |*       |              y y y y
*     | *      |             y y y y y
*      |  *     |            y y y y y y
*       |   *    |           y y y y y y y
*        |    *   |          y y y y y y y y
-----------+--------+-----------------------------------
y

rule 3:  IF z IS C THEN n IS F:

|
C  *          |                         *  F
* *         |                        * *
*   *        |                       *   *
*     *       |                      *     *
*       *      |                     *       *
*         *     |                    *         *
*           * ---+------------------ z z z z z z z   mu(z)
*            |*   |                  z z z z z z z z
---------------+----+-----------------------------------
x
__________________________________________________________________

defuzzification:
|
|
|
|                 E
|               y y y
|         D    y y y y
|     x x x x x y y y y
|    x x x x x x y y y y    F
|   x x x x x x x y y y y z z z z
|  x x x x x x x x y y y y z z z z
+-----------------------------------
^
|
crisp value = n
__________________________________________________________________
```

Note how each rule provides a result as a truth value of a particular membership function for the output variable; in centroid defuzzification the values are OR'd (that is, the maximum value is used and values are not added) and the results are then combined using a centroid calculation.

* Fuzzy control system design is based on empirical methods -- basically a methodical approach to trial-and-error. There are few predefined rules at the present time since the technology is still young; the general process is as follows:

• Document the system's operational specifications and inputs and outputs.
• Document the fuzzy sets for the inputs.
• Document the rule set.
• Determine the defuzzification method.
• Run through test suite to validate system, adjust details as required.
• Complete document and release to production.

As a general example, consider the design of a fuzzy controller for a steam turbine. The block diagram of this control system appears as follows:

```             +---------+        +---------------------+   +---+
| cold    +-----+->| IF T IS cool        |   |   |
| cool    |     |  | AND P is weak       +-->|   |
temp -->| nominal |  +--|->| THEN throttle is P3 |   | d |
| warm    |  |  |  +---------------------+   | e |
| hot     |  |  +->| IF T IS cool        |   | f |
+---------+  |  |  | AND P is low        +-->| u |
+--|->| THEN throttle is P2 |   | z |
|  |  +---------------------+   | z +--> throttle
|  +->| IF T IS cool        |   | i |
+---------+  |  |  | AND P is ok         +-->| f |
| weak    +--+--|->| THEN throttle is Z  |   | i |
| low     |  |  |  +---------------------+   | e |
pressure -->| ok      |  |  +->| IF T IS cool        |   | r |
| strong  |  |     | AND P is strong     +-->|   |
| high    |  +---->| THEN throttle is N2 |   |   |
+---------+        +---------------------+   +---+
| ... other rules ... |   ```

The input temperature variable maps into the following fuzzy set:

```        cold            cool      nominal      warm            hot
+---------------------------------------------------------------+
|                                                               |
1 -+ * * * *           *           *           *           * * * * |
|        *         * *         * *         * *         *        |
|         *       *   *       *   *       *   *       *         |
|          *     *     *     *     *     *     *     *          |
|           *   *       *   *       *   *       *   *           |
|            * *         * *         * *         * *            |
|             *           *           *           *             |
|            * *         * *         * *         * *            |
|           *   *       *   *       *   *       *   *           |
|          *     *     *     *     *     *     *     *          |
0 -+---------*-------*---*-------*---*-------*---*-------*---------+
T0        T1      T2  T3      T4  T5      T6  T7      T8        T3  ```

-- while the pressure input variable is mapped as follows:

```        weak            low         ok         strong          high
+---------------------------------------------------------------+
|                                                               |
1 -+ * * * *           *           *           *           * * * * |
|        *         * *         * *         * *         *        |
|         *       *   *       *   *       *   *       *         |
|          *     *     *     *     *     *     *     *          |
|           *   *       *   *       *   *       *   *           |
|            * *         * *         * *         * *            |
|             *           *           *           *             |
|            * *         * *         * *         * *            |
|           *   *       *   *       *   *       *   *           |
|          *     *     *     *     *     *     *     *          |
0 -+---------*-------*---*-------*---*-------*---*-------*---------+
P0        P1      P2  P3      P4  P5      P6  P7      P8        P9  ```

The output variable (throttle setting) is mapped as follows:

```       N3           N2      N1       Z       P1      P2           P3
+---------------------------------------------------------------+
|                                                               |
1 -+ * *           *       *       *       *       *           * * |
|    *         * *     * *     * *     * *     * *         *    |
|     *       *   *   *   *   *   *   *   *   *   *       *     |
|      *     *     * *     * *     * *     * *     *     *      |
|       *   *       *       *       *       *       *   *       |
|        * *       * *     * *     * *     * *       * *        |
|         *       *   *   *   *   *   *   *   *       *         |
|        * *     *     * *     * *     * *     *     * *        |
|       *   *   *       *       *       *       *   *   *       |
|      *     * *       * *     * *     * *       * *     *      |
0 -+-----*-------*-------*---*---*---*---*---*-------*-------*-----+
MIN                              0                              MAX  ```

-- where:

```   N3:   Large negative.
N2:   Medium negative.
N1:   Small negative.
Z:    Zero.
P1:   Small positive.
P2:   Medium positive.
P3:   Large positive.  ```

The rule set includes such rules as:

``` rule 1:  IF temperature IS cool AND pressure IS weak,
THEN throttle is P3.

rule 2:  IF temperature IS cool AND pressure IS low,
THEN throttle is P2.

rule 3:  IF temperature IS cool AND pressure IS ok,
THEN throttle is Z.

rule 4:  IF temperature IS cool AND pressure IS strong,
THEN throttle is N2.  ```

In practice, the controller accepts the inputs and maps them into their membership functions and truth values; these mappings are then fed into the rules. If the rule specifies an AND relationship between the mappings of the two input variables (as the examples above do), the minimum of the two is used as the combined truth value; if an OR is specified, the maximum is used. The appropriate output state is selected and assigned a membership value at the truth level of the premise; the truth values are then and defuzzified.

For an example, consider the temperature being in the "cool" state and the pressure being in the "low" and "ok" states. The pressure values ensure that only rules 2 and 3 fire:

```   __________________________________________________________________

Rule 2 evaluation:

|       cool
1 -+        *
|       * *
|      *   *
|     *     *           0.48
|    * ----- * --------------+
|   *|        *              |     |                 P2
|  * |         *             |  1 -+                 *
+-*-------------*--------->  |     |                * *
temp  T                       |     |               *   *
|     |              *     *
|       low                  +-----|-----------> 222222222
1 -+        *                   |     |            22222222222
|       * *                  |     |           2222222222222
|      *   *            0.57 |     +----------222222222222222-->
|     *     * ---------------+    throttle
|    *      |*
|   *       | *
|  *        |  *
+-*-------------*--------->
pressure     P

Rule 3 evaluation:

|       cool
1 -+        *
|       * *
|      *   *
|     *     *           0.48
|    * ----- * --------------+
|   *|        *              |     |          Z
|  * |         *             |  1 -+          *
+-*-------------*--------->  |     |         * *
temp  T                       |     |        *   *
|     |       *     *
|               ok           |     |      *       *
1 -+                *           |     |     *         *
|               * *          +-----|--- 3333333333333
|              *   *         |     +---333333333333333--------->
|             *     *        |
|            *       *  0.25 |
|           *-------- * -----+
|          *|          *
+---------*-------------*->
pressure      P
__________________________________________________________________  ```

The two outputs are then defuzzified through centroid defuzzification:

```   __________________________________________________________________

|          Z      P2
1 -+          *       *
|         * *     * *
|        *   *   *   *
|       *     * *     *
|      *       222222222
|     *       22222222222
|    333333332222222222222
+---33333333222222222222222-->
^
+150
__________________________________________________________________   ```

The output value will adjust the throttle and then the control cycle will begin again to generate the next value.

## [3.0] BUILDING A FUZZY CONTROLLER

* Consider implementing with a microcontroller chip a simple feedback controller:

```                  +-----+       +---------+    +---------+
setpoint ----->| +   | error |  fuzzy  |    | process |
+-->| -   +------>| control +--->|         +--+--> output
|   +-----+       +---------+    +---------+  |
|                                             |
+---------------------------------------------+  ```

A fuzzy set is defined for the input error variable "e" (and the derived change in error, "delta", as well as the "output") as follows:

```   LP:  large positive
SP:  small positive
ZE:  zero
SN:  small negative
LN:  large negative  ```

If the error ranges from -1 to +1, with the analog-to-digital converter used having a resolution of 0.25, then the input variable's fuzzy set (which, in this case, also applies to the output variable) can be described very simply as a table, with the error / delta / output values in the top row and the truth values for each membership function arranged in rows beneath:

```   _______________________________________________________________________

-1    -0.75  -0.5   -0.25    0     0.25   0.5    0.75    1
_______________________________________________________________________

mu(LP)      0      0      0      0      0      0     0.3    0.7     1
mu(SP)      0      0      0      0     0.3    0.7     1     0.7    0.3
mu(ZE)      0      0     0.3    0.7     1     0.7    0.3     0      0
mu(SN)     0.3    0.7     1     0.7    0.3     0      0      0      0
mu(LN)      1     0.7    0.3     0      0      0      0      0      0
_______________________________________________________________________
```

-- or, in graphical form (where each "X" has a value of 0.1):

```          LN           SN           ZE           SP           LP
+------------------------------------------------------------------+
|                                                                  |
-1.0  |  XXXXXXXXXX   XXX          :            :            :           |
-0.75 |  XXXXXXX      XXXXXXX      :            :            :           |
-0.5  |  XXX          XXXXXXXXXX   XXX          :            :           |
-0.25 |  :            XXXXXXX      XXXXXXX      :            :           |
0.0  |  :            XXX          XXXXXXXXXX   XXX          :           |
0.25 |  :            :            XXXXXXX      XXXXXXX      :           |
0.5  |  :            :            XXX          XXXXXXXXXX   XXX         |
0.75 |  :            :            :            XXXXXXX      XXXXXXX     |
1.0  |  :            :            :            XXX          XXXXXXXXXX  |
|                                                                  |
+------------------------------------------------------------------+  ```

Suppose this fuzzy system has the following rule base:

```   rule 1:  IF e = ZE AND delta = ZE THEN output = ZE
rule 2:  IF e = ZE AND delta = SP THEN output = SN
rule 3:  IF e = SN AND delta = SN THEN output = LP
rule 4:  IF e = LP OR  delta = LP THEN output = LN  ```

Note that these rules are typical for control applications in that the antecedents consist of the logical combination of the error and error-delta signals, while the consequent is a control command output.

These outputs can be defuzzified using a discrete centroid computation:

`   SUM( I = 1 TO 4 OF ( mu(I) * output(I) ) ) / SUM( I = 1 TO 4 OF mu(I) )  `

OK ... now suppose that at a given time we have:

```   e     = 0.25
delta = 0.5  ```

Then this gives:

```   ________________________

e     delta
________________________

mu(LP)      0      0.3
mu(SP)     0.7      1
mu(ZE)     0.7     0.3
mu(SN)      0       0
mu(LN)      0       0
________________________  ```

Plugging this into rule 1 gives:

```   rule 1:  IF e = ZE AND delta = ZE THEN output = ZE

mu(1)     = MIN( 0.7, 0.3 ) = 0.3
output(1) = 0  ```

-- where:

• mu(1):

Truth value of the result membership function for rule 1. In terms of of a centroid calculation, this is the "mass" of this result for this discrete case.

• output(1):

Value (for rule 1) at where the result membership function (ZE) is maximum over the output variable fuzzy set range -- that is, in terms of a centroid calculation, the location of the "center of mass" for this individual result.

Note that this value is independent of the value of "mu"; it simply identifies the location of ZE along the output range.

The other rules give:

```   rule 2:  IF e = ZE AND delta = SP THEN output = SN

mu(2)     = MIN( 0.7, 1 ) = 0.7
output(2) = -0.5

rule 3: IF e = SN AND delta = SN THEN output = LP

mu(3)     = MIN( 0.0, 0.0 ) = 0
output(3) = 0.75

rule 4: IF e = LP OR  delta = LP THEN output = LN

mu(4)     = MAX( 0.0, 0.3 ) = 0.3
output(4) = -1  ```

The centroid computation yields:

```     mu(1)*output(1) + mu(2)*output(2) + mu(3)*output(3) + mu(3)*output(3)
---------------------------------------------------------------------
mu(1) + mu(2) + mu(3) + mu(4)

( 0.3 * 0 ) + ( 0.7 * -0.5 ) + ( 0 * 0.75 ) + ( 0.3 * -1 )
= ----------------------------------------------------------
0.3 + 0.7 + 0 + 0.3

0 - 0.35 + 0 - 0.3
= ------------------
1.3

= -0.65 / 1.3

= -0.5  ```

-- for the final control output. Simple. Of course the hard part is figuring out what rules actually work correctly in practice.

* If you have problems figuring out the centroid equation, remember that a centroid is defined by summing all the moments (location times mass) around the center of gravity and equating the sum to zero. So if X0 is the center of gravity, Xi is the location of each mass, and Mi is each mass, this gives:

```   0 = ( X1 - X0 ) * M1 + ( X2 - X0 ) * M2 + ... + ( Xn - X0 ) * Mn

0 = ( X1 * M1 + X2 * M2 + ... + Xn * Mn ) - X0 * ( M1 + M2 + ... + Mn )

X0 * ( M1 + M2 + ... + Mn ) = ( X1 * M1 + X2 * M2 + ... + Xn * Mn )

( X1 * M1 + X2 * M2 + ... + Xn * Mn )
X0 = -------------------------------------
( M1 + M2 + ... + Mn )  ```

In our example, the values of mu correspond to the masses and the values of X to location of the masses.

* This system can be implemented on a standard microprocessor ... however, dedicated fuzzy chips are now available. For example, Adaptive Logic INC of San Jose, California, can accept four analog inputs and generate four analog outputs. A block diagram of the chip is shown below:

```              +---------+                              +-------+
analog --4-->| analog  |                              | mux / +--4--> analog
in         |   mux   |                              |  SH   |        out
+----+----+                              +-------+
|                                       ^
V                                       |
+-------------+                             +--+--+
| ADC / latch |                             | DAC |
+------+------+                             +-----+
|                                       ^
|                                       |
8         +-----------------------------+
|         |                             |
|         V                             |
|   +-----------+      +-------------+  |
+-->| fuzzifier |      | defuzzifier +--+
+-----+-----+      +-------------+
|                   ^
|  +-------------+  |
|  |    rule     |  |
+->|  processor  +--+
| (50 rules)  |
+------+------+
|
+------+------+
|  parameter  |
|    memory   |
|   256 x 8   |
+-------------+

DAC:  digital-to-analog converter
SH:   sample/hold  ```

The AL220 operates at 10 kilosamples per second on its inputs and contains an internal ROM that can contain up to 50 rules; the chip is clocked at 10 MHz and can perform up to 500,000 rule evaluations per second. Adaptive Logic sells a Windows-based development system that can be used to develop the fuzzy system, simulate its operation, and program the chip.

## [4.0] HISTORY & APPLICATIONS

* Fuzzy logic was first proposed by Lotfi A. Zadeh of the University of California at Berkeley in a 1965 paper; he elaborated on his ideas in a 1973 paper that introduced the concept of "linguistic variables", which in this article equates to a variable defined as a fuzzy set. Other research followed, with the first industrial application -- a cement kiln built in Denmark -- coming on line in 1975.

Fuzzy systems were largely ignored in the US because they were associated with artificial intelligence, a field that periodically oversells itself and which did so in a big way in the mid-1980s, resulting in a lack of credibility with industrial firms.

The Japanese did not have this prejudice; interest in fuzzy systems was sparked by Seiji Yasunobu and Soji Miyamoto of Hitachi, who in 1985 provided simulations that demonstrated the superiority of fuzzy control systems for the Sendai railway; their ideas were adopted and fuzzy systems were used to control accelerating, braking, and stopping when the line opened in 1987.

Another event in 1987 helped promote interest in fuzzy systems: during a international meeting of fuzzy researchers in Tokyo that year, Takeshi Yamakawa demonstrated the use of fuzzy control (through a set of simple dedicated fuzzy logic chips) in an "inverted pendulum" experiment -- a classic control problem in which a vehicle tries to keep a pole mounted on its top by a hinge upright by moving back and forth.

Observers were impressed with this demonstration, as well as later experiments by Yamakawa in which he mounted a wine glass containing water or even a live mouse to the top of the pendulum; the system maintained stability in both cases. Yamakawa eventually went on to organize his own fuzzy-systems research lab to help exploit his patents in the field.

Following such demonstrations, the Japanese became infatuated with fuzzy systems, developing them for both industrial and consumer applications; in 1988 they established the Laboratory for International Fuzzy Engineering (LIFE), a cooperative arrangement between 48 companies to pursue fuzzy research.

Japanese consumer goods widely incorporate fuzzy systems. Matsushita vacuum cleaners use 4-bit controllers running fuzzy algorithms to interrogate dust sensors and adjust suction power accordingly; Hitachi washing machines use fuzzy controllers to load-weight, fabric-mix, and dirt sensors and automatically set the wash cycle for the best use of power, water, and detergent.

As a more specific example, Canon developed an autofocusing camera that uses a charge-coupled device (CCD) to measure the clarity of the image in six regions of its field of view and use the information provided to determine if the image is in focus; it also tracks the rate of change of lens movement during focusing and controls its speed to prevent overshoot. The camera's fuzzy control system uses 12 inputs: 6 to obtain the current clarity data provided by the CCD and 6 to measure the rate of change of lens movement. The output is of course the position of the lens. The fuzzy control system uses 13 rules and requires 1.1 kilobytes of memory.

As another example of a practical system, an industrial air conditioner designed by Mitsubishi uses uses 25 heating rules and 25 cooling rules. A temperature sensor provides input, with control outputs fed to an inverter, a compressor valve, and a fan motor. Compared to the previous design, the fuzzy controller heats and cools 5 times faster, reduces power consumption by 24%, increases temperature stability by a factor of 2, and uses fewer sensors.

The enthusiasm of the Japanese for fuzzy logic is reflected in the wide range of other applications they have investigated or implemented: character and handwriting recognition, optical fuzzy systems, robots (including one for making Japanese flower arrangements), voice-controlled robot helicopters (no mean feat: hovering is a "balancing act" rather similar to the inverted pendulum problem), control of flow of powders in film manufacture, elevator systems, and other so on.

Work on fuzzy systems is also proceeding in the US and Europe, though not with the same enthusiasm shown in Japan. The US Environmental Protection Agency has investigated fuzzy control for energy-efficient motors, and NASA has studied fuzzy control for automated space docking: simulations show that a fuzzy control system can greatly reduce fuel consumption. Firms such as Boeing, General Motors, Allen-Bradley, Chrysler, Eaton, and Whirlpool have worked on fuzzy logic for use in low-power refrigerators, improved automotive transmissions, and energy-efficient electric motors.

In 1995 Maytag introduced an "intelligent" dishwasher based on a fuzzy controller and a "one-stop sensing module" that combines a thermistor (for temperature measurement), a conductivity sensor (to measure detergent level from the ions present in the wash), a turbidity sensor that measures scattered and transmitted light to measure the soiling of the wash, and a magnetostrictive sensor to read spin rate. The system determines the optimum wash cycle for any load to obtain the best results with the least amount of energy, detergent, and water; it even adjusts for dried-on foods by tracking the last time the door was opened and estimates the number of dishes by the number of times the door was opened.

Research and development is also continuing on fuzzy applications in software (as opposed to firmware) design, including fuzzy expert systems and integration of fuzzy logic with neural-network and so-called adaptive "genetic" software systems, with the ultimate goal of building "self-learning" fuzzy control systems; however, this subject is beyond the scope of this document.

* I have no background in control systems nor in fuzzy logic, but something about fuzzy logic intrigues me ... I had accumulated notes on the subject off and on for a few years and then reached a threshold where I decided to merge them into my own tutorial, focusing on control applications.

Fuzzy logic is a subject of a little controversy: one book was published promoting it as a "revolutionary new paradigm" for science and engineering, which invites a certain amount of skepticism, and the common statement that it "models natural human reasoning processes" is, if too broad and general a statement to be worth arguing, a little pompous-sounding ... beyond such irritants, however, there are pertinent criticisms that even in practical applications fuzzy logic is oversold.

For example, Bob Pease, crusty columnist for ELECTRONIC DESIGN magazine, has hammered on fuzzy logic quite a bit, pointing out (among other persuasive barbs) that its claim to provide "smoother" control are absurd, since you can obtain any system response you like using traditional methods: although Mr. Pease has softened his comments somewhat, he does point out that fuzzy advocates have often compared current fuzzy technology with poor implementations of traditional control technology.

Other criticisms claim that the simplicity of fuzzy systems is something of an illusion because it merely hides the complexity of control system design in determining the rule set (a common criticism of expert systems in general), or that fuzzy logic is little more than a restatement of traditional statistical methods in new and obscure nomenclature.

Not my quarrel, really ... I have neither the knowledge nor the interest in trying to make a judgement one way or another. I simply find the concept of fuzzy control systems rather elegant; the ultimate value of fuzzy systems will be determined by those who actually apply it and can compare its utility with that of traditional systems (in fact, it seems that many of the Japanese organizations that have adopted them have that expertise). I suspect that as this is done, fuzzy logic will simply become another element of the control-system designer's toolkit and will cease to be controversial or even of much general interest.

• "Designing With Fuzzy Logic" by Kevin Self from IEEE SPECTRUM, November 1990, pages 42:44,105.

• "Fuzzy Fundamentals" by Earl Cox from IEEE SPECTRUM, October 1992, pages 58:61. Notes from this article constitue the core of this tutorial.

• "Fuzzy Logic Flowers In Japan" by Daniel G. Schwartz & George J. Klir from IEEE SPECTRUM, July 1992, pages 32:35.

• "Clear Thinking On Fuzzy Logic" by Lawrence A. Berardinis from MACHINE DESIGN, 23 April 1992, pages 46:52.

• "Fuzzy Controller Challenges 8-bit MCUs" from COMPUTER DESIGN, November 1995 provided a description of the AL220 fuzzy controller chip. This is the article that pushed me over the edge to put together this dcoument.

• "Dishwasher Cleans Up With Fuzzy Logic" from MACHINE DESIGN, 23 March 1995.

• "How To Design Fuzzy Logic Controllers" from MACHINE DESIGN, 26 November 1992, provided some short (and cryptic) notes that were expanded (with considerable pain and struggle) into the example on the fuzzy microcontroller system.

• "A Case For Fuzzy Logic" from EMBEDDED SYSTEMS PROGRAMMING, December 1995, by Byron Miller, pages 42:70.

• The Internet fuzzy-logic FAQ ("frequently-asked questions") list, by Mark Kantrowitz, Erik Horstkotte, and Cliff Joslyn. This is relatively academically- and software-oriented and I mainly used it as a crosscheck (and in some senses a foil since I had different objectives); however, I am strongly indebted to it for giving me the correct spelling of the name "Lotfi" (misspelling people's names is so embarrassing).

A preliminary copy of this document was placed on Internet News for review; I got extensive comments from Dr. David I. Brubaker of Huntington Advanced Technology (who also runs a fuzzy column for EDN magazine). All his suggestions were quite good but some would have involved extending the scope of this document more than I felt inclined to do for the moment; but various statements that were made in a categorical fashion in the preliminary document were softened (or "fuzzified" if you like) in the initial release.

* The author implies no assurances or guarantees for any information in this document; the author is solely responsible for any errors in its contents and in no way does it reflect any policy or opinion of his employer. This article may be freely copied or modified for use by HP personnel for HP business, and for any non-commercial use. If you have a non-HP commercial use, please contact the author:

`   Greg Goebel / HP-MXD / gvg@lvld.hp.com  `