Fuzzy logic is the offspring of traditional expert systems and the fuzzy set theory developed and named by Lotfih Zadeh. An expert system evaluates inputs as either true or false. The underlying rules that generate outputs are based on the state of the inputs. The outputs may take the form of actions, decisions or intermediate conditions, which may be further processed as inputs in subsequent evaluations. Expert systems are limited, however, to input that can be evaluated as true or false. Its output is frequently binary, as well.
Imagine a problem that can be solved with logical rules and analog inputs. The question of whether the cup is half empty or half full illustrates the problem. Fuzzy set theory says that the partially filled cup can belong to both the sets of full cups and empty cups simultaneously. Each member of a fuzzy set has a property called the degree of membership that indicates the extent to which the member belongs. If the cup is full, it should be emptied. If it's empty, it should be refilled. What should be done when it's filled halfway? Or less? A traditional expert system would need many rules to deal with every possible state.
Enter fuzzy logic
Fuzzy logic invokes expert system-styled rules, but it can deal with shades of gray. Fuzzy variables reduce the number of rules to evaluate. Outputs are weighted according to the degree that inputs are "true."
Fuzzy logic is an excellent decision support tool. It more closely mimics human decision-making. People usually make decisions based on "fuzzy" inputs like warm and cool, big and small or fast and slow. A frequently cited example is a common bathroom shower. One doesn't need to know the exact temperature to decide whether the water is too hot. One doesn't need to know the flow rate to decide whether to increase it. If the flow rate and temperature are both unacceptable, we know intuitively how to adjust the valves.
Our thought process identifies simple rules to follow. If too hot, turn the cold water up and the hot water down. If the flow is too low, increase both hot and cold water. This is open loop feedback control. We might also make a large correction when the water is very hot and a smaller correction when water is barely too hot. The concept of using logical rules, but tempering the output based on inputs is the essence of fuzzy logic.
Fuzzy logic frames a control solution in terms of logical consequences. This characteristic is a double-edged sword. While it is suitable for many problems, its power comes from the rules. These are not easily generalized and the research and development in this technology becomes diluted with many one-of-a-kind solutions with limited opportunity for reuse. Clearly, there are notable examples where fuzzy logic has been demonstrated. The classic academic example is the inverted pendulum--a meta-stable system that's difficult to control for any feedback controller. Fuzzy logic is readily capable of keeping the inverted pendulum centered above the pivot point.
Another more practical example is crane control. The objective is to lift and move a large object to its destination, as quickly as possible. However, the object has mass and momentum can't be ignored. Movement must be controlled to prevent overshoot and swinging at the end of the movement. Fuzzy logic uses rules that maximize travel speed during most of the move, but decelerate the crane as the object approaches its destination. The load stops directly below the crane without swinging.
An example from the process industry is wastewater pH control. There are several ways to control pH using fuzzy logic, but the general premise is that rules control the addition of chemical on the basis of the current pH and how the pH has been changing with time. If the pH is far too high and a large dose of acid failed to correct it, then another, perhaps larger dose is called for. The amount of acid addition drops as the pH approaches the target.
Fuzzy vs. PID
PID feedback control is a simple, elegant design based on the deviation, or error, between a target value (set point) and the value of a process variable. An output, or manipulated, variable that affects the controlled variable is made to change. The output variable is usually a control valve or variable speed drive. Its signal is calculated from the magnitude of the error (proportional mode) the persistence of the error (integral mode) and the rate-of-change of the error (derivative mode).
In the early to mid 1970's, Mamdani investigated the fuzzy logic control as an alternative to the PID controller. He designed a controller that followed rules rather than a numerical formula. His rules were analogous to PI control. As a result, rules generated an output by evaluating error and change in error. For a reverse acting control loop, a large positive error calls for a large negative output change, while a small positive error calls for a small negative output change. Similarly, large change in error calls for large change in direction of the output, while a small change in error calls for a small change in direction. When there is no error or change in error, there is no change in output. This is an excellent application of fuzzy logic control because it's easily generalized to almost any process.
The rules can be represented in a truth table (see Sidebar). Note the symmetry of the outputs for these rules. The next issue is to define what constitutes a large error and large output. Membership functions are created for error, change-in-error and change-in-output. Mamdani defined five to seven membership functions for each variable. They were triangular in shape, symmetrical, evenly spaced and overlapping. Some experimentation was done with different numbers and shapes of membership functions, but the increase in complexity was not adequately rewarded by a performance improvement. However, the size and overlap of membership functions are tunable parameters analogous to conventional proportional, integral and derivative gains. Judicious selection of these fuzzy tuning parameters results in more or less aggressive control for a given process.