Artificial Intelligence: Fuzzy Logic Explained

Fuzzy logic for most of us: It’s not as fuzzy as you might think and has been working quietly behind the scenes for years. Fuzzy logic is a rule-based system that can rely on the practical experience of an operator, particularly useful to capture experienced operator knowledge. Here’s what you need to know.

11/04/2011


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.

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.

Figure 2

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.

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.

www.emptechgroup.com 

www.ni.com 

Design trends in PLC-based control systems

Designing Your Own Control System

Nonlinear control: All you wanted to know about fuzzy logic



No comments
Consulting-Specifying Engineer's Product of the Year (POY) contest is the premier award for new products in the HVAC, fire, electrical, and...
Consulting-Specifying Engineer magazine is dedicated to encouraging and recognizing the most talented young individuals...
The MEP Giants program lists the top mechanical, electrical, plumbing, and fire protection engineering firms in the United States.
2014 Product of the Year finalists: Vote now; Boiler systems; Indirect cooling; Integrating lighting, HVAC
High-performance buildings; Building envelope and integration; Electrical, HVAC system integration; Smoke control systems; Using BAS for M&V
Pressure piping systems: Designing with ASME; Lab ventilation; Lighting controls; Reduce energy use with VFDs
Case Study Database

Case Study Database

Get more exposure for your case study by uploading it to the Consulting-Specifying Engineer case study database, where end-users can identify relevant solutions and explore what the experts are doing to effectively implement a variety of technology and productivity related projects.

These case studies provide examples of how knowledgeable solution providers have used technology, processes and people to create effective and successful implementations in real-world situations. Case studies can be completed by filling out a simple online form where you can outline the project title, abstract, and full story in 1500 words or less; upload photos, videos and a logo.

Click here to visit the Case Study Database and upload your case study.

Protecting standby generators for mission critical facilities; Selecting energy-efficient transformers; Integrating power monitoring systems; Mitigating harmonics in electrical systems
Commissioning electrical systems in mission critical facilities; Anticipating the Smart Grid; Mitigating arc flash hazards in medium-voltage switchgear; Comparing generator sizing software
Integrating BAS, electrical systems; Electrical system flexibility; Hospital electrical distribution; Electrical system grounding
As brand protection manager for Eaton’s Electrical Sector, Tom Grace oversees counterfeit awareness...
Amara Rozgus is chief editor and content manager of Consulting-Specifier Engineer magazine.
IEEE power industry experts bring their combined experience in the electrical power industry...
Michael Heinsdorf, P.E., LEED AP, CDT is an Engineering Specification Writer at ARCOM MasterSpec.