Fuzzy logic is not as fuzzy as you might think and has been working quietly behind the scenes for more than 20 years in more places than most admit. Fuzzy logic is a rule-based system that can rely on the practical experience of an operator, particularly useful to capture experienced operator knowledge. Fuzzy logic is a form of artificial intelligence software; therefore, it would be considered a subset of AI. Since it is performing a form of decision making, it can be loosely included as a member of the AI software toolkit. Here’s what you need to know to consider using fuzzy logic to help solve your next application. It’s not as fuzzy as you might think.
Fuzzy logic has been around since the mid 1960s; however, it was not until the 70s that a practical application was demonstrated. Since that time the Japanese have traditionally been the largest producer of fuzzy logic applications. Fuzzy logic has appeared in cameras, washing machines, and even in stock trading applications. In the last decade the United States has started to catch on to the use of fuzzy logic. There are many applications that use fuzzy logic, but fail to tell us of its use. Probably the biggest reason is that the term “fuzzy logic” may have a negative connotation.
Fuzzy logic can be applied to non-engineering applications as illustrated in the stock trading application. It has also been used in medical diagnosis systems and in handwriting recognition applications. In fact a fuzzy logic system can be applied to almost any type of system that has inputs and outputs.
Fuzzy logic systems are well suited to nonlinear systems and systems that have multiple inputs and multiple outputs. Any reasonable number of inputs and outputs can be accommodated. Fuzzy logic also works well when the system cannot be modeled easily by conventional means.
Many engineers are afraid to dive into fuzzy logic due to a lack of understanding. Fuzzy logic does not have to be hard to understand, even though the math behind it can be intimidating, especially to those of us who have not been in a math class for many years.
Binary logic is either 1 or 0. Fuzzy logic is a continuum of values between 0 and 1. This may also be thought of as 0% to 100%. An example is the variable YOUNG. We may say that age 5 is 100% YOUNG, 18 is 50% YOUNG, and 30 is 0% YOUNG. In the binary world everything below 18 would be 100% YOUNG, and everything above would be 0% YOUNG.
The design of a fuzzy logic system starts with a set of membership functions for each input and a set for each output. A set of rules is then applied to the membership functions to yield a “crisp” output value.
For this process control explanation of fuzzy logic, TEMPERATURE is the input and FAN SPEED is the output. Create a set of membership functions for each input. A membership function is simply a graphical representation of the fuzzy variable sets. For this example, use three fuzzy sets, COLD, WARM, and HOT. We will then create a membership function for each of three sets of temperature as shown in the cold-normal-hot graphic, Figure 1.
We will use three fuzzy sets for the output, SLOW, MEDIUM, and FAST. A set of functions is created for each output set just as for the input sets.
It should be noted that the shape of the membership functions do not need to be triangles as we have used in Figure 1 and Figure 2. Various shapes that can be used, such as Trapezoid, Gaussian, Sigmoid, or user definable. By changing the shape of the membership function, the user can tune the system to provide optimum response.
Now that we have our membership functions defined, we can create the rules that will define how the membership functions will be applied to the final system. We will create three rules for this system.
- If HOT then FAST
- If WARM then MEDIUM
- If COLD then SLOW
The rules are then applied to the membership functions to produce the “crisp” output value to drive the system. For simplicity we will illustrate using only two input and two output functions. For an input value of 52 degrees we intersect the membership functions. We see that in this example the intersection will be on both functions, thus two rules are applied. The intersection points are extended to the output functions to produce an intersecting point. The output functions are then truncated at the height of the intersecting points. The area under the curves for each membership function is then added to give us a total area. The centroid of this area is calculated. The output value is then the centroid value. In this example 44% is the output FAN SPEED value. This process is illustrated in Figure 3.
This is a very simple explanation of how the fuzzy logic systems work. In a real working system, there would be many inputs and possibility several outputs. This would result in a fairly complex set of functions and many more rules. It is not uncommon for there to be 40 or more rules in a system. Even so, the principles remain the same as in our simple system.
National Instruments has included in LabVIEW a set of pallet functions and a fuzzy system designer to greatly simplify the task of building a fuzzy logic system. It has included several demo programs in the examples to get started. In the graphical environment, the user can easily see what the effects are as the functions and rules are built and changed.
The user should remember that a fuzzy logic system is not a “silver bullet” for all control system needs. Traditional control methods are still very much a viable solution. In fact they may be combined with fuzzy logic to produce a dynamically changing system. The validation of a fuzzy logic system can be difficult due to the fact that it is a nonformal system. Its use in safety systems should be considered with care.
I hope this short article will inspire the exploration and use of fuzzy logic in some of your future designs. I encourage the reader to do further study on the subject. There are numerous books and articles that go into much more detail. This serves as a simple introduction to fuzzy logic controls.
– Norm Dingle is a senior system engineer with EMP Technical Group of Noblesville, IN. He holds a BSE from Purdue University.