Columnist: March 16, 1995
Both fuzzy PD+I and linear PID controllers use the integral component to remove steady-state error. With no I-based term and a normal P gain, the error (the difference between the commanded and actual capacitor voltage) nears but never fully reaches zero. This is because the P gain approaches zero as the error approaches zero, and is, therefore, not large enough to complete the job. Because a fuzzy system can have a nonlinear gain-for example, large gain for large error, medium gain for medium error, and large gain again for small error-you might be tempted to get by with a PD controller alone. I have seen a number of such systems. Because of the high P gain for small error, outputs tend to oscillate about the setpoint. If this oscillation is acceptable, go for it. Otherwise, using the integral term is straightforward, not as a third input to a PID rulebase, but, rather, as the single input to a rulebase whose output is then summed with the PD rulebase output.
A starting point for the I response function is to simply let the gain be proportional to the integral value itself. Linear PID controllers work this way, without a fuzzy rulebase. An op amp does nicely. The resulting PD+I system works well for a constant C but poorly when the value of C varies over its required operating range 50 µFóCó200 µF. For smaller values of C, the integral of the error is small because of faster rise times, and the final voltage settles below the setpoint. Similarly, for larger values of C, the error integral is large because of the slower rise times, and the final voltage settles above the setpoint.
An alternate approach is to select a gain function that provides large incremental gains for small values of the integral and small or zero incremental gains (nearly constant or constant absolute gains) for large integral values. Fig 2 shows one possible response function. This may look familiar-it's the function we approximated in the October 13 column. This time around, we'll implement it a bit differently. In October, we used evenly spaced input and output functions and formed the desired function with the rules, mapping each input to the appropriately valued output. This time we'll again use evenly spaced input-membership functions, but we'll define rules that map each input to a unique output singleton. We will then space the singletons to achieve the desired response. Fig 3 shows the input-membership functions, output singletons, and rules.
The rulebase has 21 rules. Why so many? Rather than worry about membership size and placement, we "oversample" the input space with many narrow input-membership functions. Many functions result in many rules. We could accurately approximate this function with far fewer rules; with proper choice of membership functions (they would be neither triangular nor trapezoidal), two rules would be sufficient. However, that is far beyond this tutorial.
The system is complete. Let's compare its (simulated) performance with the (simulated) performance of a linear PID controller, designed to the same requirements set. For those who wish to duplicate the models, parameters of interest are
| Linear Gains | Fuzzy Gains |
| AP = 22 | APscale= 0.273 |
| AI = 0.08 | ADscale= 3.5 |
| AD = 120 | AIscale= 0.009 |
| APDdrive= 35 | |
| AIdrive= 6 |
Fig 4 shows both VC and VIN (the voltage applied to the RLC input) of both the fuzzy controller and the PID controller for C=100 µF. The responses are nearly identical-not surprising.
Now let's change C to both 50 µF and 200 µF. Fig 5 shows the step responses for both the fuzzy (upper plot) and the linear (lower plot) cases. The linear controller exhibits a faster rise time for the smaller capacitor value and a slower rise time for the larger value; it also has substantial undershoot and overshoot. The fuzzy controller, showing similar rise times, exhibits significantly less overshoot.
There is a sad tendency in many fuzzy-control articles published over the past half decade. A fuzzy controller in-variably beats the pants off a linear PID controller in a staged comparison. Implied moral: Never again consider a linear PID controller in place of a fuzzy version, and, in fact, strongly consider ripping out all current linear implementations and replacing them with fuzzy. Not!
In making this comparison, in no way do I imply that it represents the best possible nonfuzzy ap-proach. I am using the PID results as a standard for comparison and am not claiming any relative value. The linear PID controller is a workhorse: It's well understood, easy to design, and performs beautifully in most linear control applications with unchanging parameters. I used it to show that:
(1) a fuzzy PD+I controller performs equally well with constant valued C
(2) the fuzzy controller is more robust when facing changing capacitor values. (As an aside, I recently designed a linear PID system with controlled gains that adapted itself to changing system parameters. I used both feedforward and feedback to make the system adaptive and had a fuzzy rulebase in each path. It was a marriage made in heaven.)
I promised I would discuss translating the design to one running on an embedded microcontroller. I would like to defer that task to the future, because it is a sufficiently important topic to have a full column of its own.
A final note: With this basic tutorial sequence now complete, I will be alternating column topics among questions and answers, deeper tutorials, and descriptions of applications. I am always looking for the latter. If you have or know of a fuzzy application that is currently working, and that can be discussed in fairly decent detail, please drop me a note. Many thanks for your many observations, comments, and questions. All are welcome.
Long ago, on the first day of one of my graduate-level classes, the professor announced that he would make two intentional errors in his lectures during the quarter. The first student to correctly identify each error would receive an "A" for the course.
Somewhere near the end of that first lecture, he made his first mistake, a subtle, probably unintentional one, al-though I am certain he wouldn't admit it. I would not have recognized it had I not spent the past four years in industry. I called it to his attention, he acknowledged it, and assured me of my "A". (I continued to attend class and even did the problem sets, although I admit I did not take the midterm and final.)
With this spirit, I hereby award an "A" to Jim Schimpf of Nu-Metrics of Vanderbilt, PA, the first reader to catch and notify me that Fig 3 in the November 10 column is incorrect. The resulting drive current should be 1.40A, rather than the 1.23A indicated. The rest of you who also pointed out this error will receive a "B+", except those who took the opportunity to gripe-you get a "C-." I shall redouble my efforts to see it doesn't happen again; although, I make no promises of limiting the number to two.

David Brubaker is a consultant in fuzzy-system design. You can reach him at Huntington Advanced Technology, 883 Santa Cruz Ave, Suite 31, Menlo Park, CA 94025-4608 or on the Internet at: brubaker@cup.portal.com.