0% found this document useful (0 votes)
33 views

Robot Engineering and Control (Fuzzy Logic Control)

This document discusses fuzzy logic control and its components. It introduces fuzzy logic as a means of controlling systems that rely on imprecise variables like "clean" or "hot" rather than discrete values. It explains that fuzzy logic uses fuzzy sets and membership functions to define degrees of truth for input and output variables. The key components of a fuzzy control system are identified as fuzzification, a rule base of fuzzy inference rules, and defuzzification. Common membership functions like triangular, trapezoidal and Gaussian are shown. The role of the rule base in evaluating fuzzy logic statements with "and" and "or" is also covered.

Uploaded by

Mohamed M
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Robot Engineering and Control (Fuzzy Logic Control)

This document discusses fuzzy logic control and its components. It introduces fuzzy logic as a means of controlling systems that rely on imprecise variables like "clean" or "hot" rather than discrete values. It explains that fuzzy logic uses fuzzy sets and membership functions to define degrees of truth for input and output variables. The key components of a fuzzy control system are identified as fuzzification, a rule base of fuzzy inference rules, and defuzzification. Common membership functions like triangular, trapezoidal and Gaussian are shown. The role of the rule base in evaluating fuzzy logic statements with "and" and "or" is also covered.

Uploaded by

Mohamed M
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

Robot Engineering and Control

Fuzzy Logic Control

Dr. Mohamed Fawzy Abd El Hamed


Fuzzy Logic Control
Introduction
•consider a temperature control thermostat. Suppose we want to control the temperature
at 75o such that if the temperature is higher, the air conditioning turns on; if it is cooler,
it turns off. To do this, we want to set the thermostat control to 75o . In a simple
microprocessor control, we may have a control statement such as:

•This means that as soon as the temperature is 75o or more, the air conditioning will
turn on. However, as you notice, the system will not turn on even if temperature is
74.9o. Considering the fuzzy descriptions we saw earlier, is this what we intend?

•consider a washing machine. In most machines, except for a simple time-of wash, there
are no other choices the user can make based on how much fabric is washed and how
dirty the clothes are. Would it not be better if there were a system where the water is
tested for its cleanliness and the washing (scrubbing) mode is adjusted accordingly? In
this case, we need to know how to define clean water versus dirty water. What is
considered clean (and how clean is clean) and what is dirty (and how dirty)?
Fuzzy Logic Control
Fuzzy Control: What Is Needed

•Now we have added a bit of flexibility to the system, as it is not just dependent on one
single value to operate but will also react differently depending on the temperature.
Notice that still for each statement, the controller reacts to one single value. As a result,
even at 78.99o the system is at 90% full-power.
•In the next sections, we will see how fuzzy inferences can be defined (called Fuzzy
Sets and Fuzzification), how a collection of control laws (called Fuzzy Inference Rules
Base) can be written, and how to convert the results into a useful engineering output
(called Defuzzification).
Fuzzy Logic Control
Crisp Values versus Fuzzy Values
•A crisp value is a clearly defined value with one interpretation. A crisp value of 75o F
means the same in any system, and it is a clearly defined and measurable value.
•a fuzzy value is unclear and may be interpreted differently depending on the
circumstances.
Fuzzy Logic Control
Fuzzy Sets: Degrees of Membership and Truth
•To be able to use a fuzzy description in a control setting, we define a fuzzy set whose
members describe the fuzzy variable at different degrees of membership or truth. Each
value in the fuzzy set has a degree of membership within the set, varying from 100%
(1) to 0% (0). This means that, in contrast to a crisp value that is the only true value and
all other values relative to it are false, a fuzzy set has fuzzy values with different
degrees of membership or truth, varying from 100% to 0% true.
•To understand this, let’s once again consider a washing machine and the following
statement:
•If we assume that CLEAN_WATER represents a purely clean water sample, then as a
crisp value, when the water sample is purely clean (no other material in the water), the
clean-water statement is true; otherwise, for all other samples, even with a slight
amount of impurity, the statement is false and the water is not clean.
Fuzzy Logic Control
Fuzzy Sets: Degrees of Membership and Truth

•in a fuzzy set defining CLEAN_WATER, a purely clean water sample will have a
degree of membership of 100% (or 1) in the set; it is purely clean water. However,
water with a slight amount of dirt is still somewhat clean, perhaps 95%. Water with a
little more dirt is not as clean, but perhaps 90% clean. So, every value in the set relates
to some definition of clean water, with only one single crisp value (called singleton),
but also containing countless other clean water possibilities with different degrees of
membership and different levels of truth. In this case, a dirty water sample could still be
a part of a CLEAN_WATER set, but may have a very low degree of membership.
•On the other hand, if we also define a fuzzy set called DIRTY_WATER, the purely
clean water sample mentioned earlier will have a degree of membership (or truth) of
zero in the DIRTY_WATER set, while the dirty water sample will have a 100% degree
of membership in that set. The water with a 90% degree of membership in the
CLEAN_WATER set may have a 15% degree of membership in the DIRTY_- WATER
set as well. So, if we define two sets, a water sample will have two defined values—one
in each set, each with a different degree of membership.
Fuzzy Logic Control
Fuzzy Control system
Fuzzy Logic Control
Fuzzy Control system
Fuzzy Logic Control
Fuzzification
•Fuzzification is the process of converting input and output values into their
membership functions. The result of fuzzification is a set of graphs or equations that
describe the degree of membership of different values in different fuzzy variables.
•To fuzzify a variable, its range of possible values is divided into a number of sets, each
describing a particular portion of the range. Subsequently, each range is represented by
an equation or a graph that describes the degree of truth or membership of each value
within the range.
•The number of sets, the range that each set represents, and the type of representation is
arbitrary and a choice of the designer of the system. As we will see later, these can be
modified and improved when the system is simulated and analyzed.
•A number of possible representations are available for each set. If you create your own
fuzzy system, you may use any representation you find appropriate.

•The following membership functions are common:


1- Gaussian membership function: As shown in Figure 10.1, this is a natural way to
represent a distribution. Generally, more mathematical operations are needed to use the
Gaussian distribution; therefore, as we will see next, the Gaussian representation is
modified into simpler forms for easier application.
Fuzzy Logic Control
Fuzzification

2- Trapezoidal membership function: Figure 10.2 shows the common trapezoidal


membership function used to represent a Gaussian function in a simpler way. Here, the
membership function is represented by three simple lines, requiring only four points.
Each section is a straight line between successive points, and therefore, the degree of
membership for each value of the variable can easily be calculated from the line
equations.
3- Triangular membership function: This is also a
very common membership function that simplifies
a Gaussian function, requiring only three points. As
shown in Figure 10.3, each section is a straight line
between successive points. Degrees of membership
for each value of the variable are simply calculated
from the line equations.
Fuzzy Logic Control
Fuzzification

4-Z-shaped and S-shaped membership functions: These second-order functions depicted


in Figure 10.4 may be used to represent the upper and lower limits of a variable, where
the degrees of membership may remain the same (0 or 1) for a range of values.
•To see how these membership functions may be
used, let’s consider a system in which one variable
is temperature that may vary between 60o F and
100o F. To define the temperature variable in fuzzy
form, we divide the desired range into a number
of sets. For the purpose of illustration, let’s use
triangular and trapezoidal functions and assign
corresponding temperature ranges to sets of
VERY-HOT, HOT, WARM, and COLD, as shown
in Figure 10.5.
Fuzzy Logic Control
Fuzzification
•Each set contains a range of temperatures, where every temperature has a degree of
membership. As we discussed earlier, any temperature, say 78o , has corresponding
membership values in different sets. In this case, the values are 0.27 in HOT and 0.7 in
WARM.
•The membership functions modeled in this manner are easy to formulate by expressing
two points on each segment. All points on the line can then be easily identified. As an
example, we may use the following arbitrary syntax to express the membership function
for VERY-HOT and HOT:

•Based on these definitions, all membership values on all sets can be calculated from
the limits shown.
Fuzzy Logic Control
Fuzzy Inference Rule Base
•Fuzzy Inference Rule Base is the controller part of the system and is based on truth
table logic. The rule base is a collection of rules related to the fuzzy sets, the input
variables, and the output variables and is meant to allow the system to decide what to
do in each case.
•It generally takes one of the following forms, depending on the number of input and
output variables:

•As an example, for a system where the temperature is one input variable, humidity is
the second input variable, and the power setting of the air conditioning system is the
output variable, a fuzzy rule may be:

•Obviously, these two rules will behave differently. Based on commonly used truth tables,
in the first case, both conditions must be true for the consequence, while in the second
case, either condition will result in a consequence. However, remembering that these are
all rather fuzzy not crisp values, they do not result in true or false consequences.
Therefore, to evaluate the ‘‘and’’ and the ‘‘or’’ rules, we use the following:
Fuzzy Logic Control
Fuzzy Inference Rule Base

•With this definition, the system can check all the rules for the given inputs and
calculate a corresponding output. The logic system that checks the rules and finds the
corresponding output is called a fuzzy inference engine.
•The total number of rules in a rule base is equal to the product of the numbers of sets
of each input variable. For example, if there are three input variables, with m, n, and p
fuzzy sets, the total number of rules is R = m x n x p.
Fuzzy Logic Control
Defuzzification
•Defuzzification is the conversion of a fuzzy output value to an equivalent crisp value
for actual use.
•As the fuzzy rules are evaluated and corresponding values are calculated, the result
will be a number related to the corresponding membership values for different output
fuzzy sets.
•We will consider two common and useful techniques for defuzzification called Center
of Gravity and Mamdani’s Inference Method.
•Center of Gravity Method:
The following is a summary of this method:
1. Multiply the membership degrees for each output variable by the singleton value of
the output set.
2. Add all of the above together and divide by the summation of output membership
degrees.
As an example, suppose the values obtained for the output of the air conditioning
system membership sets are 0.4 for LOW and 0.6 for Medium, and further suppose that
the singleton value for LOW is 30% and for MEDIUM is 50% of full power. The output
value for the air conditioning would then be:
Fuzzy Logic Control
Defuzzification
•Mamdani’s Inference Method
Mamdani’s method can be summarized as
follows:
1. Truncate each output membership function at
its corresponding membership value, which is
found from the rule base as shown in figure 10.7.
2. Add the remaining truncated membership
functions with an ‘‘or’’ function in order to
consolidate them into one area describing the
output.
3. Calculate the center of gravity of the
consolidated area as the crisp output value.

•Through the process of fuzzification, application of the rules base, and defuzzification,
an output value is calculated that can be applied to the output. The following examples
demonstrate this procedure for the calculation of an output value.
Fuzzy Logic Control
Example
Fuzzy Logic Control
Example
Fuzzy Logic Control
Example
Fuzzy Logic Control
Example
Fuzzy Logic Control
Example
Fuzzy Logic Control
Example
Fuzzy Logic Control
Example
Fuzzy Logic Control
Example

You might also like