Number 33 December 92 The Huntington Technical Brief By David Brubaker Ph.D. PSEUDO-FUZZY, TABLE-DRIVEN KERNEL --------------------------------- INTRODUCTION The intent of this Technical Brief issue is to discuss the operation of a pseudo-fuzzy kernel, easily implementable on an inexpensive microcontroller, yet providing good system level performance. I call the kernel "pseudo-fuzzy" because although it does not use fuzzy logic, its output never-the-less approximates the response surface of a fuzzy, rule-based system. DESCRIPTION The heart of the system is a table. Each table entry represents a single, crisp value to be output by the system. The entries collectively represent the response function of the system. The indices into the table are derived from system inputs. For example, in a system with two inputs, an eight-by-eight table will use three bits of each input as the two indices into the table. As each input varies over its range, the indices will point to different rows and columns of the table, and will thereby specify different output values. To cover the entire range of each input, the three table index bits must be the three MSBs of the input values. Recognizing that the coarse quantization achieved with a table thus defined will rarely be sufficient at input values about a null, as some predefined region of the table is entered, a nested table providing finer quantization replaces the coarser quantized table. This nesting can occur to a depth defined by the size of the input words. Multiple separate tables may be used, or a single table with the output values scaled (divided) by a constant. EXAMPLE This example is of a system with two, five-bit inputs (represented in base-2, two's complement) and a single five-bit output. The odd value size (five-bits) reduces the example to two nested levels, thereby simplifying the description. However, the same approach is easily applied both to larger sized values and to a greater number of inputs. Additional outputs can be added by increasing the number of entries at each location in the table. The three most significant bits of each input are used to index into the coarse control table. Three bits define eight ranges for each input, which, for two inputs, defines an eight-by-eight element table. The three least significant bits of each input are used to index into the fine control table, when the most significant bits are either 000 or 111. There is a one bit overlap. That is, the middle bit of the five bit word acts both as the LSB of the coarse control index and the MSB of the fine control index. This overlap indirectly defines the size of the region within the coarse table that "falls through" to the fine table. With respect to the coarse table, each column and row is four input counts wide, represented by the two bits of each input not used as part of the index. That is, the left-most column is addressed by the three MSBs of that input, and therefore is selected when 10000 .le. Input .le. 10011. The next column to the right is active for 10100 .le. input .le. 10111 the next column for 11000 .le. input .le. 11011 and so forth. As indicated previously, the value to be output is the table entry. For example, if one input is 00010 and the other is 10110, the output is the value of the table entry addressed by 000 on one axis (from the first input) and 101 on the other axis (from the second input). COMMENT Is the system fuzzy? Not really, although this may be a matter of perspective. First, each input is divided into what are constant width, crisp, non-overlapping input sets. However, even given that crisp, rather than fuzzy, input sets are used, the output can be made to resemble the response surface of a traditional fuzzy system; however with choppy transitions between the output levels over the input universe. CONCLUSION For those who want to implement a fuzzy logic system on a simple microcontroller or microprocessor, but are not interested in wading through the details of a truly fuzzy approach, this issue has presented a "pseudo-fuzzy", table-driven kernel. A system based on this architecture can be put together quickly, using software structures familiar to most embedded software engineers. When the resulting choppy, stairstep response function is not a concern, the ease of both design and implementation would warrant its investigation. ---------------------------------------------------------------- The Huntington Technical Brief is published monthly as part of the marketing effort of Dr. David Brubaker of The Huntington Group. The unedited version complete with all figures is available at a subscription price of $24.00 per year. Past issues are available for $1.00 and samples of the Huntington Report are available at no charge. Please call Dr. David Brubaker at the number below for complete details. The 42-page report "Introduction to Fuzzy Logic Systems" is available for $35.00. For the past sixteen years Dr. Brubaker has provided technical consulting services in the design of complex systems, real-time, embedded processor systems, and for the past five years, fuzzy logic systems. If you need out-of-house expertise in any of these, please call 415-325-7554. ---------------------------------------------------------------- Copyright 1992 by The Huntington Group 883 Santa Cruz Avenue, Suite 31 Menlo Park, CA 94025-4608 This information is provided by Aptronix FuzzyNet 408-428-1883 Data USR V.32bis