FUZZY LOGIC - AN INTRODUCTION
by Steven D. Kaehler
This is the sixth and final article in a series intended to share information and experience in the realm of fuzzy logic (FL) and its application. This article will conclude the tutorial discussion of the ongoing FL example. For the interested reader, informational references are included.
The last step completed in the example in the last article was to determine the firing strength of each rule. It turned out that rules 4, 5, 7, and 8 each fired at 50% or 0.5 while rules 1, 2, 3, 6, and 9 did not fire at all (0% or 0.0). The logical products for each rule must be combined or inferred (max-min'd, max-dot'd, averaged, root-sum-squared, etc.) before being passed on to the defuzzification process for crisp output generation. Several inference methods exist.
The MAX-MIN method tests the magnitudes of each rule and selects the highest one. The horizontal coordinate of the "fuzzy centroid" of the area under that function is taken as the output. This method does not combine the effects of all applicable rules but does produce a continuous output function and is easy to implement.
The MAX-DOT or MAX-PRODUCT method scales each member function to fit under its respective peak value and takes the horizontal coordinate of the "fuzzy" centroid of the composite area under the function(s) as the output. Essentially, the member function(s) are shrunk so that their peak equals the magnitude of their respective function ("negative", "zero", and "positive"). This method combines the influence of all active rules and produces a smooth, continuous output.
The AVERAGING method is another approach that works but fails to give increased weighting to more rule votes per output member function. For example, if three "negative" rules fire, but only one "zero" rule does, averaging will not reflect this difference since both averages will equal 0.5. Each function is clipped at the average and the "fuzzy" centroid of the composite area is computed.
The ROOT-SUM-SQUARE (RSS) method combines the effects of all applicable rules, scales the functions at their respective magnitudes, and computes the "fuzzy" centroid of the composite area. This method is more complicated mathematically than other methods, but was selected for this example since it seemed to give the best weighted influence to all firing rules.
DEFUZZIFICATION - GETTING BACK TO CRISP NUMBERS
The RSS method was chosen to include all contributing rules since there are so few member functions associated with the inputs and outputs. For the ongoing example, an error of -1.0 and an error-dot of +2.5 selects regions of the "negative" and "zero" output membership functions. The respective output membership function strengths (range: 0-1) from the possible rules (R1-R9) are:
The defuzzification of the data into a crisp output is accomplished by combining the results of the inference process and then computing the "fuzzy centroid" of the area. The weighted strengths of each output member function are multiplied by their respective output membership function center points and summed. Finally, this area is divided by the sum of the weighted member function strengths and the result is taken as the crisp output. One feature to note is that since the zero center is at zero, any zero strength will automatically compute to zero. If the center of the zero function happened to be offset from zero (which is likely in a real system where heating and cooling effects are not perfectly equal), then this factor would have an influence.
Figure 8 - The horizontal coordinate of the centeriod is taken as the crisp output
The horizontal coordinate of the centroid of the area marked in Figure 8 is taken as the normalized, crisp output. This value of -63.4% (63.4% Cooling) seems logical since the particular input conditions (Error=-1, Error-dot=+2.5) indicate that the feedback has exceeded the command and is still increasing therefore cooling is the expected and required system response.
TUNING AND SYSTEM ENHANCEMENT
Tuning the system can be done by changing the rule antecedents or conclusions, changing the centers of the input and/or output membership functions, or adding additional degrees to the input and/or output functions such as "low", "medium", and "high" levels of "error", "error-dot", and output response. These new levels would generate additional rules and membership functions which would overlap with adjacent functions forming longer "mountain ranges" of functions and responses. The techniques for doing this systematically are a subject unto itself.
The logical product of each rule is inferred to arrive at a combined magnitude for each output membership function. This can be done by max-min, max-dot, averaging, RSS, or other methods. Once inferred, the magnitudes are mapped into their respective output membership functions, delineating all or part of them. The "fuzzy centroid" of the composite area of the member functions is computed and the final result taken as the crisp output. Tuning the system amounts to "tweaking" the rules and membership function definition parameters to achieve acceptable system response.
This completes this article series on FL control and one way it can be done. The author has applied something close to this particular approach to a PC-based temperature controller which could be the topic of a future article series if there is interest. The PC solution has been implemented in Qbasic 1.0 and Borland's Turbo C running on the PC using iotech hardware ADC's and DAC's. This functionality has also been implemented using PIC's and 68HC11 processors.
Fuzzy Logic provides a completely different, unorthodox way to approach a control problem. This method focuses on what the system should do rather than trying to understand how it works. One can concentrate on solving the problem rather than trying to model the system mathematically, if that is even possible. This almost invariably leads to quicker, cheaper solutions. Once understood, this technology is not difficult to apply and the results are usually quite surprising and pleasing.
 "The Coming Age of Fuzzy Logic" Proceedings of the 1989 IFSA Congress, J.C. Bezdek, ed. (University of Washington, Seattle, WA 1989).
 "The Current Mode Fuzzy Logic Integrated Circuits Fabricated by Standard CMOS Process" (IEEE Trans. on Computers, Vol. C-35, No. 2, pp. 161-7, February 1986).
 "Fuzzy Logic - From Concept to Implementation", (Application Note EDU01V10-0193. ((c) 1993 by Aptronix, Inc, (408) 428-1888).
 "Fuzzy Motor Controller" Huntington Technical Brief, D. Brubaker ed. (April 1992, No. 25, Menlo Park, CA 1992).