Search Entire Site:
Explore | Login | Register | Contact Us | About Us


Introduction to fuzzy control
By Dan Simon
Source: Embedded.com

Posted: 06/19/2003
Rating: 3.5 (Good!)

Fuzzy logic is a tool to help you control complex systems.

Most control systems are based on proportional integral derivative (PID) technology ("Closed-Loop Control," August 2002, p. 55). Some systems, however, require a more complex control. For such systems, one option is fuzzy control.

Fuzzy logic
Fuzzy logic imitates the logic of human thought, which is much less rigid than the calculations computers generally perform. Consider the task of driving a car. As you drive along, you notice that the stoplight ahead is red and the car in front of you is braking. Your (very rapid) thought process might be something like this: "I see that I need to stop. The road is wet because it's raining. The car is only a short distance in front of me. Therefore, I need to apply significant pressure to the brake pedal immediately." This reasoning takes place subconsciously, of course, but that's the way our brains work—in fuzzy terms.

Human brains do not base such decisions on the precise distance to the car ahead or the exact coefficient of friction between the tires and the road, as an embedded computer might. Likewise, our brains do not use a Kalman filter to derive the optimal pressure that should be applied to the brakes at a given moment. Our brains use common-sense rules, which seems to work pretty well.

But when we finally get around to pressing the brake pedal, we apply an exact force, let's say 23.26 pounds. So although we reason in fuzzy terms, our final actions are considerably less so. The process of translating the results of fuzzy reasoning to a nonfuzzy action is called defuzzification.

Let's think about how a fuzzy cruise control system might work. The cruise controller maintains a constant vehicle speed in spite of neverending changes in road grade, wind resistance, and other variables. The controller does this by comparing the commanded speed with the actual speed. We can call the difference between commanded and actual speed current error. The error change is the difference in error from one sample period to the next.

If the current error is a small positive number—vehicle speed is slower than commanded—the controller needs to slightly increase the throttle angle in order to speed up the vehicle appropriately.

If both current error and error change are positive, the vehicle is going too slowly and decelerating. In this case, the controller needs to increase the throttle angle by a larger amount to achieve the desired speed.

Table 1: Fuzzy rules for the cruise controller

Current Error


Error Change Negative Zero Positive
Negative Large Negative Negative Zero
Zero Negative Zero Positive
Positive Zero Positive Large Positive

Such specifications are called fuzzy rules. Table 1 shows a set of fuzzy rules that might be used for a cruise controller. The controller inputs are the variables current error and error change. The output represents a fuzzy specification of how much to change the throttle.

The terms "negative," "large negative," and so on in Table 1 are not precise numbers; they're fuzzy quantities. The engineering challenge is to define these fuzzy quantities. What does a "positive" output change mean? What is "zero" current error? The definitions of these terms are constituted by fuzzy membership functions.

Fuzzy membership functions quantify the degree to which some variable belongs to some class. For example, it is overly simplistic to say that someone is either tall or not tall. A range of degrees exists between those two extremes. We might say that a male who is 6'6" or taller is 100% "tall," whereas a man who is 5'6" or shorter is 0% tall. In between 5'6" and 6'6" is a continuous curve that defines the extent to which a male belongs to the "tall" class. A six-foot tall male, for example, might be "tall" at a level of 50%. That continuous curve is a fuzzy membership function. It's up to the fuzzy logic designer to specify that function.

Defuzzification
Suppose current error is -5 mph and error change is -1 mph/s. We might define a speed error of -5 mph as 75% "negative" and 25% "large negative." Similarly, we might define an error change of -1 mph as 50% "zero" and 50% "negative."


Figure 1: Fuzzy membership functions

"Negative" errors can be represented by the membership function on the left in Figure 1. That is, the error is considered negative if it is between -8 mph and 0 mph. The level of membership of error increases from 0 to 1.0 as error increases from 0 mph to -4 mph. The level of membership decreases from 1 to 0 as error increases from -4 mph to -5 mph; such large errors are also partial members of the "large negative" fuzzy set. An error of -5 mph belongs to the "negative" class, with a level of membership equal to 0.75.

Similarly, from the membership function in the center of Figure 1, we see that an error change of -1 mph/s belongs to the "zero" class with a level of membership equal to 0.5.

The rules in Table 1 say that if current error is "negative" and error change is "zero," then throttle change should be "negative." The fuzzy output corresponding to "negative" might be represented by the rightmost function in Figure 1. We want a "negative" output, but our output only has a level of membership of 0.5 in the "negative" class. This is because 0.5 is the minimum contributor to this fuzzy rule. That is, since current error is 0.75 "negative" and error change is 0.5 "zero," the minimum of these two (0.5) is used as the level of membership of the output.

But that's not all. An error of -5 mph may also belong to the "zero" class with a certain level of membership. Another fuzzy rule from Table 1 says that if current error is "zero" and error change is "zero," our output should be "zero." There is a fuzzy output corresponding to "zero", similar to the fuzzy output for "negative" on the right in Figure 1. So there are actually two fuzzy outputs: a "negative" output with a 0.5 level of membership and a "zero" output with a different level of membership.


Figure 2: Centroid-based defuzzification

At this point we must defuzzify the output to convert our fuzzy outputs to a single number. There are many ways to defuzzify, but the most common approach is to compute the center of mass of the set of fuzzy outputs. This process is illustrated in Figure 2. The process shown there can be represented mathematically as:

where x is the value of the horizontal coordinate and f(x) is the sum of all of the fuzzy output values. Although this integral would be difficult to calculate in an embedded system, the math can be simplified considerably depending on the type of fuzzy membership functions that are used.

When to get fuzzy
PID controllers and variations thereof work well in many control systems. But when the system to be controlled contains uncertainty or is highly complex, poorly understood, or nonlinear, fuzzy control may work better. In the example discussed here, the very nature of the problem suggests the use of fuzzy logic.

Once mastered, fuzzy logic is a valuable tool in the control engineer's repertoire.

Dan Simon is a professor in the Electrical and Computer Engineering Department at Cleveland State University. His teaching and research interests include signal processing, control theory, embedded systems, fuzzy logic, and neural networks. His e-mail address is d.j.simon@csuohio.edu.

Further reading
Miller, Byron. "A Top-Down Approach to Fuzzy Logic Design," Embedded Systems Programming, July 1998, p. 52.


 

This orange tubing is made of what material?
(HINT: You can find the answer in the Multimedia Wiki.)
  PVC
  Silicone
  EPDM Rubber
  Teflon

Do you know the answer?
Do you want to be rewarded?
Login to Mechatropolis or Become a Citizen.
To add search tags or to rate Articles, please Login to Mechatropolis or Become a Citizen
Search Tags: controls  article  tutorial  fuzzy-logic  cmp  fuzzy_logic  
Comments:


 
Community Status
 
Top Citizen: Inaki Z.
723056 Points
Are you smarter?
Login or Register

Invite A Friend
Your
E-Mail:
Friend's
E-Mail:
 

Related Articles
CyberKnife® System...
External Link: http://www.accuray.com/Pr...
Click for more information.
Fuzzy logic does real time on the DSP...
Fuzzy logic doesn't require strange hardware or new programming languages, just a different approach t...
Under The Hood: TI 65-nm chip at heart o...
The Nokia 2610 is an entry-level dual band cell phone for the GSM 900 and 1800 network. Compared to other ent...
Using simulation software to simplify DS...
Now that we have modelled the basic equations and dynamics we need in Part 1 and Part 2 in this series,...
View all Articles

Editor's Selection
Freescale Samples Flexis Series 8/32-bit...
External Link: http://www.automotivedesi...
Click for more information.
Advances in servo system development ...
The recent trend in has been to reduce cost, size and complexity of servo systems while increasing performance...
Driverless vehicles meeting challenge...
PORTLAND, Ore. — The winners of the last Grand Challenge, an autonomous vehicle race sponsored by the ...
View all Articles

Popular Mechatropolis Articles
Getting in touch with touchscreen tech...
Touchscreen technology is emerging as a killer app all by itself  Thanks to advances in mec...
PCI Express image-acquisition board set ...
Imaging and video have always interested me. As a youth in the early 1960s I tinkered with a surplus ph...
Generate stepper-motor speed profiles in...
A new algorithm for stepper-motor acceleration allows speed profiles to be parameterized and calculate...
Tutorial: Improving the Transient Immuni...
When it comes to protecting their designs from a variety of transient electrical disturbances, developers of m...
View all Articles

ArticlesTag Cloud
  accelerometer     actuator     ADC     aerospace     Atmel     automotive     AVR     CAN     Celoxica     controls     debug     DSP     Echelon     ECU     electronics     ENOVIA     Freescale     HILS     I2C     industrial     keypad     LIN     LONworks     MCU     mechanics     medical     Microcontroller     prototyping     Pyxos     robotics     Semiconductor     sensor     ShortStack     simulation     SPI     switch     Toshiba     XBox     zigbee  


Do you have a question or suggestion?
Send us a message using this form:
Name:
E-Mail:
Subject:
Message:
Verify:This Is CAPTCHA Image (enter code)
 

Which of the following is the coolest Mechatronic device?
 
i-Robot Roomba
Wii Remote Controller
Coffee Maker
Blood Preasure Monitor
 
 

Home | Videos | Articles | AppNotes | Webcasts | Courses | Wiki Teardowns | VirtuaLabs | Challenges
Explore | Login | Register | Contact Us | About Us

Privacy Policy | Your California Privacy Rights | Terms of Service
© 2008 TechInsights, a division of United Business Media Limited. All Rights Reserved.