Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

K.S.R.

COLLEGE OF ENGINEERING
TIRUCHENGODE.

Topic: Fuzzy logic with real-time applications

Abstract:

The Smart A ir Conditioner, automatically adjusts the flow of air according to the surrounding temperature.The Smart TV: adjusts its contrast and colour modes for every new frame. The Smart Washing Machine: adds more detergent when there is more dirt. All with the push of a button. Great!!! We are witnessing a miracle in technology. Too good to be true. But enough!!! How do such miracles occur? How complicated is the math ? HOW DOES IT WORK!!!! This article describes the procedures required in designing fuzzy logic machines starting with the basics, fuzzy rules, moving on to the fuzzy controller and finally considering a case study where a real life useful application of fuzzy logic is applied

SYNOPSIS:

- Introduction - How fuzzy logic is applied - Examples where fuzzy logic is applied - Misconception and controversies - Application - Fuzzy rules - Fuzzy control - Real-time example washing machine fuzzy-traffic light controller

Conclusion

INTRODUCTION:

'''Fuzzy logic''' is an extension of Boolean logic dealing with the concept of partial truth. Whereas classical logic holds that everything can be expressed in binary terms (0 or 1, black or white, yes or no), fuzzy logic replaces boolean truth values with degrees of truth. Degrees of truth are often confused with probabilities, although they are conceptually distinct, because fuzzy truth represents membership in vaguely defined sets, not likelihood of some event or condition. To illustrate the difference, consider this scenario: Bob is in a house with two adjacent rooms: the kitchen and the dining room. In many cases, Bob's status within the set of things "in the kitchen" is completely plain: he's either "in the kitchen" or "not in the kitchen". What about when Bob stands in the doorway? He may be considered "partially in the kitchen". Quantifying this partial state yields a fuzzy set membership. With only his little toe in the dining room, we might say Bob is 0.99 "in the kitchen", for instance. No event (like a coin toss) will resolve Bob to being completely "in the kitchen" or "not in the kitchen", as long as he's standing in that doorway. Fuzzy sets are based on vague definitions of sets, not randomness. Fuzzy logic allows for set membership values between and including 0 and 1, shades of gray as well as black and white, and in its linguistic form, imprecise concepts like "slightly", "quite" and "very". Specifically, it allows partial membership in a set. It is related to fuzzy sets and possibility theory. It was introduced in 1965 by Dr. Lotfi Zadeh of Berkeley. Fuzzy logic is controversial despite wide acceptance: it is rejected by some control engineers for validation and other reasons, and by some statisticians who hold that probability is the only rigorous mathematical description of uncertainty. Critics also argue that it cannot be a superset of ordinary set theory since membership functions are defined in terms of conventional sets.

HOW FUZZY LOGIC IS APPLIED:

Fuzzy logic usually uses IF/THEN rules, or constructs that are equivalent, such as fuzzy associative matrices.

Rules are usually expressed in the form:

IF variable IS set THEN action

For example, an extremely simple temperature regulator that uses a fan might look like this:

IF temperature IS very cold THEN stop fan

IF temperature IS cold THEN turn down fan

IF temperature IS normal THEN maintain level

Notice there is no "ELSE". All of the rules are evaluated, because the temperature might be "cold" and "normal" at the same time to differing degrees.

The AND, OR, and NOT operators of boolean logic exist in fuzzy logic, usually defined as the minimum, maximum, and complement; when they are defined this way, they are called the Zadeh operators, because they were first defined as such in Zadeh's original papers. So for the fuzzy variables x and y:

NOT x = (1 - truth(x)) x AND y = minimum(truth(x), truth(y)) x OR y = maximum(truth(x), truth(y)) There are also other operators, more linguistic in nature, called hedges that can be applied. These are generally adverbs such as "very", or "somewhat", which modify the meaning of a set using a mathematical formula.

EXAMPLES WHERE FUZZY LOGIC IS USED:

Automobile subsystems, such as ABS and cruise control Air conditioners The MASSIVE engine used in the Lord of the Rings films, which helped show huge scale armies create random, yet orderly movements Cameras Digital image processing, such as edge detection Rice cookers Dishwashers Elevators

Washing machines and other home appliances. Video game artificial intelligence

Fuzzy logic has also been incorporated into some microcontrollers and microprocessors, for instance, the Motorola 68HC12.

MISCONCEPTIONS AND CONTROVERIES:


Fuzzy logic is the same as "imprecise logic". Fuzzy logic is not any less precise than any other form of logic: it is an organized and mathematical method of handling inherently imprecise concepts. The concept of "coldness" cannot be expressed in an equation, because although temperature is a quantity, "coldness" is not. However, people have an idea of What "cold" is, and agree that something cannot be "cold" at N degrees but "not cold" at N + 1 degrees a concept classical logic cannot easily handle due to the principle of bivalence. Fuzzy logic is a new way of expressing probability. Fuzzy logic and probability refer to different kinds of uncertainty. Fuzzy logic is specifically designed to deal with imprecision. However, this is a point of controversy. Many statisticians are persuaded by the work of Bruno de Finetti that only one kind of mathematical uncertainty is needed and thus fuzzy logic is unnecessary. On the other hand, Bart Kosko argues that probability is a subtheory of fuzzy logic, as probability only handles one kind of uncertainty. He also claims to have proved a theorem demonstrating that Bayes' theorem can be derived from the concept of fuzzy subsethood. Lotfi Zadeh, the creator of fuzzy logic, argues that fuzzy logic is different in character from probability, and is not a replacement for it. He has created a fuzzy alternative to probability, which he calls possibility theory. Other controversial approaches to uncertainty include Dempster-Shafer theory and Rough Sets. Fuzzy logic will be difficult to scale to larger problems In a widely circulated and highly controversial paper, Charles Elkan in 1993 commented that "...''there are few, if any, published reports of expert systems in real-world use that reason about uncertainty using fuzzy logic. It appears that the limitations of fuzzy logic have not been detrimental in control Applications because current fuzzy controllers are far simpler than other knowledge-based systems. In future, the technical limitations of fuzzy logic can be expected to become important in practice, and work on fuzzy controllers will also encounter several problems of scale already known for other knowledge-based systems''". Reactions to Elkan's paper are many and varied, from claims that he is simply mistaken, to others who accept that he has identified important limitations of fuzzy logic that need to be addressed by system designers.

APPLICATIONS:
Fuzzy logic can be used to control household appliances such as washing machines (which sense load size and detergent concentration and adjust their wash cycles accordingly) and refrigerators. A basic application might characterize subranges of a continuous variable. For instance, a temperature measurement for anti-lock brakes might have several separate membership functions defining particular temperature ranges needed to control the brakes properly. Each function maps the same temperature value to a truth value in the 0 to 1 range. These truth values can then be used to determine how the brakes should be controlled.

In this image, cold, warm, and hot are functions mapping a temperature scale. A point on that scale has three "truth values" one for each of the three functions. For the particular temperature shown, the three truth values could be interpreted as describing the temperature as, say, "fairly cold", "slightly warm", and "not at all hot".

A more sophisticated practical example is the use of fuzzy logic in highperformance error correction to improve information reception over a limitedbandwidth communication link affected by data-corrupting noise using turbo codes. The front-end of a decoder produces a likelihood measure for the value intended by the sender (0 or 1) for each bit in the data stream. The likelihood measures might use a scale of 256 values between extremes of "certainly 0" and "certainly 1". Two decoders may analyse the data in parallel, arriving at different likelihood results for the values intended by the sender. Each can then use as additional data the other's likelihood results, and repeats the process to improve the results until consensus is reached as to the most likely values.

FUZZY RULES:

Human beings make descisions based on rules. Even though, we may not be aware of it, all the descisions we make are based on computer like if-then statements. If the weather is fine, then we may decide to go out. If the forecast says the weather will be bad today, but fine tommorow, then we make a descision not to go today, and postpone it till tommorow. Rules associate ideas and relate one event to another. Fuzzy machines, which always tend to mimick the behaviour of man, work the same way. Only this time the descision and the means of choosing that descison are replaced by fuzzy sets and the rules are replaced by fuzzy rules. Fuzzy rules also operate using a series of if-then statements. For instance, X then A, if y then b, where A and B are all sets of X and Y. Fuzzy rules define fuzzy patches, which is the key idea in fuzzy logic. A machine is made smarter using a concept designed by Bart Kosko called the Fuzzy Approximation Theorem(FAT). The FAT theorem generally states a finite number of patches can cover a curve as seen in the figure below. If the patches are large, then the rules are sloppy. If the patches are small then the rules are fine.

Fuzzy Patches In a fuzzy system this simply means that all our rules can be seen as patches and the input and output of the machine can be associated together using these patches. Graphically, if the rule patches shrink, our fuzzy subset triangles gets narrower. Hence, with this simple theorem, even novices can build control systems that beat the best math models of control theory. It is math-free system.

FUZZY CONTROL:

Fuzzy control which directly uses fuzzy rules is the most important application in fuzzy theory. Using a procedure originated by Ebrahim Mamdani in the late 70s, three steps are taken to create a fuzzy controlled machine: 1)Fuzzification(Using membership functions to graphically describe a situation) 2)Rule evaluation(Application of fuzzy rules) 3)Defuzzification(Obtaining the crisp results) As a simple example on how fuzzy controls are constructed, consider the following classic situation: the inverted pendulum. Here, the problem is to balance a pole on a mobile platform that can move in only two directions, to the left or to the right. The angle between the platform and the pendulum and the angular velocity of this angle are chosen as the inputs of the system. The speed of the platform hence, is chosen as the corresponding output. Step 1 First of all, the different levels of output (high speed, low speed etc.) of the platform is defined by specifying the membership functions for the fuzzy_sets. The graph of the function shown below

zero

Similary, the different angles between the platform and the pendulum and...

zero

the angular velocities of specific angles are also defined

Step 2 The next step is to define the fuzzy rules. The fuzzy rules are mearly a series of if-then statements as mentioned above. These statements are usually derived by an expert to achieve optimum results. Some examples of these rules are: i) If angle is zero and angular velocity is zero then speed is also zero. ii) If angle is zero and angular velocity is low then the speed shall be low. The full set of rules is summarised in the table below. Speed negative high v negative high e negative low l zero o positive low c negative high negative low zero negative low Angle zero negative high negative low zero low high zero positive low positive high positive low positive high

An application of these rules is shown using specific values for angle and angular velocities. The values are seen in the following graphs.

negJugh

wegJow

posJow

posJiigh

-maxangle

^actuala n g l e
negJow posJow

^ angle maxangle

negJugh

posJiigh

-maxvelocity actual velocity

angulai velo city maxvelocity

As seen in the figure above the result patch yielded by the rule "if angle is zero and angular velocity is zero, the speed is zero", is a bit tricky since there are two variables relating to one point. The actual value belongs to the fuzzy set zero to a degree of 0.75 for "angle" and 0.4 for "angular velocity". Hence, since this is an AND operation, the minimum criterion is used , and the fuzzy set zero of the variable "speed" is cut at 0.4 and the patches are shaded up to that area. This is illustrated in the figure below.
angle

actual angular velocity zero

The following figures show the result patches yielded by the rule "if angle is zero and angular velocity is negative low, the speed is negative low", "if angle is positive low and angular velocity is zero, then speed is positive low" and "if angle is positive low and angular velocity is negative low, the speed is zero".

speed

speed

speed

negJow

posJow

The four results are overlaps and is reduced to the following figure
speed

the result

Step 3: The result of the fuzzy controller so far is a fuzzy set (of speed). To choose an appropriate representative value as the final output(crisp values), defuzzification must be done. This can be done in many ways, but the most common method used is the center of gravity of the set as shown below.
speed

final output of speed

n?

CASE STUDY:FUZZY TRAFFIC LIGHT CONTROLLER

This part of the article describes the design procedures of a real life application of fuzzy logic: A Smart Traffic Light Controller. The controller is suppose to change the cycle time depending upon the densities of cars behind green and red lights and the current cycle time.

Background
In a conventional traffic light controller, the lights change at constant cycle time, which is clearly not the optimal solution. It would be more feasible to pass more cars at the green interval if there are fewer cars waiting behind the red lights. Obviously, a mathematical model for this decision is enormously difficult to find. However, with fuzzy logic, it is relatively much easier.

FUZZY DESIGN:

First, eight incremental sensors are put in specific positions as seen in the diagram below. K o D
S

<d
0 h
D

d>

:
D

The first sensor behind each traffic light counts the number cars coming to the intersection and the latter counts the cars passing the traffic lights. The amount of cars between the traffic lights is determined by the difference of the reading of the two sensors. For example, the number of cars behind traffic light North is s7s8. The disatnce D, chosen to be 200ft., is used to determine the maximum density of cars allowed to wait in a very crowded situation. This is done by adding the number of cars between to paths and dividing it by the total distance. For instance, the number of cars between the East and West street is (s1-s2)+(s5s6)/400. Next comes the fuzzy descision process which uses the three step mentioned above(fuzzyification, rule evaluation and defuzzification). Step 1 As before, firstly the inputs and outputs of the design has to be determined. Assuming red light is shown to both North and South streets and distance D is constant, the inputs of the model consist of : 1) Cycle Time 2)Cars behind red light 3) Cars behind green light

The cars behind the light is the maximum number of cars in the two directions. The corresponding ouput parameter is the probabilty of change of the current cycle time. Once this is done, the input and output parameters are divided into overlapping member fuctions, each function corresponding to different levels. For inputs one and two the levels and their corresponding ranges are zero(0,1), low(0,7), medium(4,11), high(7,18), and chaos(14,20). For input 3 , the levels are ver short(0,14), short(0,34), medium(14,60), long(33,88), very long(65,100), limit(85,100). The levels of output are no(0), probably no(0.25), maybe(0.5), probably yes (o.75), and yes(1.0). Note: For the output, one value(singleton position) is asosciated to each level instead of a range of values. The corresponding graphs for each of these membersip function is drawn in the similar way above. Step 2 The rules, as before are formulated using a series of if-then statements, combined with AND/OR opearotors. Ex: if cycle time is medium AND Cars Behind Red is low AND Cars Behind Green is medium, then change is Probably Not. With three inputs, each having 5,5,and 6 membership functions, there are a combination of 150 rules. However using the minimum ar maximum criterion some rules are combined to a total of 86. Step 3 This process, also mentioned above converts the fuzzy set output to real crisp value. The method used for this system is center of gravity: Crisp Output={Sum(Membership Degree*Singleton Position)}/(Membership degree) For example, if the output membership degree, after rule evaluation are: Change Probability Yes=0, Change Probability Probably Yes=0.6, Change Probability Maybe=0.9, Change Probability Probably No= 0.3, Change Probability No=0.1 then the crisp value will be: Crisp Output=(0.1*0.00) +(0.3*0.25)+(0.9*0.50)+(0.6*0.75)+(0*1.00)/0.1+0.3+0.9+0.6+0 =0.51

Is Fuzzy Controller better ?


Testing of the controller The fuzzy controller has been tested under seven different kinds of traffic conditions from very heavy traffic to very lean traffic. 35 random chosen car densities were grouped according to different periods of the day representing those traffic conditions. Performance evaluation The performace of the controller was compared with that of a conventional controller and a human expert. The criteria used for comparison were number of cars allowed to pass at one time and average waiting time. A performance index which maximises the traffic flow and reduces the average waiting time was developed. A means of calculating the average waiting time was also developed, however, a detailed calculation of this evaluation is beyond the scope of this article. All three traffic controller types were compared and can be summarized with the following graph of performance index in all seven traffic categories.

0 -I
1

4 5 7 different traffic categories

Performance Index for 7 different traffic catagories The fuzzy controller passed through 31% more cars, with an average waiting time shorter by 5% than the theoretical minimum of the conventional controller. The performance also measure 72% higher. This was expected. However, in comparison with a human expert the fuzzy controller passed through 14% more cars with 14% shorter waiting time and 36% higher performance index. Result: Machine beats Man!!!!

CONCLUSION:

In conclusion, as Man gets hungry in finding new ways of improving our way of life, new, smarter machines must be created. Fuzzy logic provides a simple and efficient way to meet these demands and the future of it is limitless.

References: 1. Fuzzy Thinking Author: Bart Kosko 2. IEEE Journals: Fuzzy traffic Light Controller Author: Dr. Devinder Kaur, Elisa Konga, Esa Konga, University of Toledo 3. Fuzzy Logic and Control-Software and hardware Applications Author: M. Jamishi et al 4. Preference Relations on a Set of Fuzzy Utilities as a Basis for Descision Making Author: K. Nakamura 5. Fuzzy Set Theory and its Applications Author: H. J. Zimmerman

You might also like