Vous êtes sur la page 1sur 10

INTRODUCTION TO FUZZY LOGIC

Shailendra Kumar Jain, PhD


Dept. of Electrical Engg.
MANIT, Bhopal
Modern control-theory based controllers are state-feedback controllers, selftuning controllers, and model reference adaptive controllers etc.These controllers also
need mathematical models and are therefore sensitive to parameter variation.
Recently, fuzzy logic controllers (FLCs) have generated a good deal of interest
in certain application. The advantages of FLCs over the conventional controllers are : (i)
it does not need accurate mathematical model; (ii) it can work with imprecise inputs; (iii)
it can handle non-linearity, and (iv) it is more robust than conventional nonlinear
controllers.
FUZZY LOGIC
Fuzzy logic is another form of artificial intelligence, but its history and applications
are more recent than expert system. It is argued that human thinking does not always
follow crispy yes no logic, but is often vague, uncertain, indecisive, or fuzzy. Based
on this, Lofty Zadeh, a computer scientist at the University of California, Berkerly,
originated the fuzzy logic or fuzzy set theory in 1965 that gradually emerged as a
discipline in AI. The general methodology of reasoning in fuzzy logic and expert system
are the same, and therefore, it is often defined as fuzzy expert system. Fuzzy logic
helps to supplement the expert system, and it is sometimes hybrided with the latter to
solve complex problems. Fuzzy logic has recently been applied in process control,
modeling, estimation, identification, diagnostics, stock market prediction, agriculture,
military science, and so on. It is interesting to note that there is a fuzzy logic version of
Mycin, the medical diagnostic program in expert system.
FUZZY LOGIC PRINCIPLE
What is fuzzy logic? Fuzzy logic, unlike Boolean or crispy logic, deals with
problems that have vagueness, uncertainty, imprecision, or qualitative-ness, as
mentioned before. It tends to mimic human thinking, which is often fuzzy in nature. In
conventional set theory based on Boolean logic, a particular object or variable is either a

Shailendra Jain, PhD, NIT Bhopal

member (logic 1) of a given set or it is not (logic 0). On the other hand, in fuzzy set
theory based on fuzzy logic, a particular object has a degree of membership in a given
set that may be anywhere in the range of 0 (completely not in the set) to 1 (completely in
the set). This property helps fuzzy logic to deal with non statistical uncertain situations in
a fairly natural way. It may be mentioned that although fuzzy logic deals with imprecise
information, it is based on sound quantitative mathematical theory that has been
advanced in recent years. In this section, the simple fuzzy logic theory that is applicable
to process control, modeling, and estimation will be discussed.
A fuzzy variable has values that are expressed by natural English language. For
example, the stator temperature of a motor can be defined by qualifying linguistic
variables (also defined as fuzzy sets or fuzzy subsets) COLD, MILD, or HOT (Fig. 1),
where each is represented by triangular or straight line segment membership functions
(MFs). The fuzzy sets can have more subdivision, such as ZERO, VERY COLD,
MEDIUM COLD, MEDIUM HOT, VERY HOT and so on, for precious description of the
variable. Although the triangular membership function is most commonly used, the
shape may be trapezoidal or Gaussian (bell shaped). If the temperature is below 40o F,
it belongs completely to the set COLD; that is, the membership function value is 1,
whereas for 55o F, it is in the set COLD by 30% (MF = 0.3) and to the set MILD by 50%
(MF = 0.5). For the temperature above 80oF, it belongs completely to the set of HOT (MF
= 1). The membership functions can either be defined by mathematical equation or lookup table. In figure, the corresponding crispy or Boolean classification is provided for
comparison; that is, the temperature range below 55oF belongs to the COLD set only
(MF = 1), 55oF to 65oF belongs to mild set only (MF = 1), and above 65oF belongs to
HOT set only (MF = 1). The sets are not member (MF = 0) beyond the defined ranges.
The numerical interval that is relevant for the description of a fuzzy variable
(temperature) is defined as universe of discourse (20oF to 90oF).
The basic properties of Boolean logic are also valid for fuzzy logic. The basic
fuzzy set operations needed for the evaluation of fuzzy rules are AND (), OR (), and
NOT (--). Where A (x) denote the degree of membership of a given element x in a fuzzy
set A. These properties are illustrated in Fig. 2.
1. AND Intersection :

A B (x) = min [A(x), B(x)]

2. OR - Union :

A B (x) = max [A(x), B(x)]

3. NOT - Complement :

A (x) = 1 - A (x)

Shailendra Jain, PhD, NIT Bhopal

Fig. 2 Properties of Fuzzy Logic


FUZZY CONTROL
Let us now review the principles of fuzzy control. Fuzzy control, similar to expert
system-based control, is described by IF THEN production rules. An example of fuzzy
rule (also called fuzzy implementation) in a process control is
IF TEMPERATURE IS LOW AND
PRESSURE IS HIGH
THEN SET THE FUEL VALVE TO MEDIUM
The heuristic rule for a boiler control is derived from the operators experience.
Here the temperature, pressure, and fuel valve setting are the fuzzy variables that are
described by the corresponding fuzzy sets LOW, MEDIUM, HIGH, and so on. Each set
has the characteristic membership function, as shown in figure 1. In comparison, a
corresponding structure of an expert system rule may appear as
IF TEMPERATURE < 150oF AND PRESSURE > 50 PSI
THEN SET THE FUEL VALVE 50%
Where temperature, pressure, and fuel valve setting are the parameters. The rule
processes the logic variables generated by the parameter conditions. The fuzzy expert

Shailendra Jain, PhD, NIT Bhopal

system rules contain fuzzy knowledge. It can be shown that fuzzy control requires much
fewer rules compared to that of expert system.
To design a fuzzy controller, a fuzzy rule base consisting of a set of rules must
be constructed. Consider a hypothetical fuzzy speed control system for a DC motor,
where the speed loop error (E) and rate of error change, (i.e., the error change (CE)
within the sampling time of digital control) are used to determine the rate of change in
control (i.e., change in control DU), which in this case, is the increment of command
armature current Ia*. A part of the rule base, as indicated in figure 3, would be

NB

NM

-1
1

-0.5

, ce

NS ZE

PS

PM

0.25

0.5

-0.25

PB

error 'e' and change in

Fig 3 . Membership functions for the inputs e


and ce

Rule 1:
IF error (E) is zero (Z) AND change in error (CE) is negative small (NS) THEN change in
control (DU) is negative small (NS).
Rule 2:
IF error (E) is positive small (PS) AND change in error (CE) is negative small (NS) THEN
change in control (DU) is zero (Z).
Here, error (E), change in error (CE), and change in control (DU) are the fuzzy
variables, with possible values given by fuzzy sets such as positive small (PS), negative
small (NS), and so on. As illustrated in the figure, a given numeric of a fuzzy variable can
be a member of more than one fuzzy set. This means that, for a particular input pair of
values (E and CE), more than one rule could be activated or fired. Therefore, there
should be a method to combine the individual control actions of fired rules, such that a
single, meaningful action is taken. In fuzzy logic terms, the composition or inference
operation is the mechanism by which such a task is performed. Several composition

Shailendra Jain, PhD, NIT Bhopal

methods, such as MAX MIN (or SUP MIN) and MAX DOT, have been proposed in
the literature, but the SUP MIN method is most popularly used. Figure 3 illustrates the
fuzzy composition by SUP MIN principle for the two stated rules. Note that the output
membership function of each rule is given by MIN operator, whereas the combined fuzzy
output is given by the SUP operator.
FUZZY CONTROL SCHEME
In a fuzzy logic controller, the control action is determined from the evaluation of
a set of simple linguistic rules. The development of the rules requires a thorough
understanding of the process to be controlled, but it does not require a mathematical
model of the system. Fig.4 shows the internal structure of the fuzzy logic controller from
which only the regulated voltage Vdc is scaled and then sampled and compared with the
ref. Voltage to obtain the error e = Vdc,ref Vdc,act, and change of error ce(n) = e(n) e(n1) at nth sampling instant, to create the inputs to the fuzzy control algorithm.
The output of the fuzzy control algorithm is the change in reference current
Imax(n)/firing signal. The peak reference current Imax(n), at the nth sampling time, is
determined by adding the previous reference current Imax(n-1) to the calculated change
in reference current :
Imax(n) = Imax(n-1) + Imax(n)
In classical control theory, this is an integrating effect, which increases the system type
and improves the steady-state error. The main components of fuzzy control are (i)

Fuzzification ; which is the classification of input data into suitable linguistic


values or sets;

(ii)

Decision making : which is inferring fuzzy control action from knowledge of


the control rules and the linguistic variable definition; and

(iii) Defuzzification : which is the conversion of the inferred fuzzy control action
to a crisp or non-fuzzy control action.
Fuzzification
Fuzzy logic uses linguistic variables instead of numerical variables. In the real
world, measured quantities are real numbers (crisp). The process of converting a
numerical variable (real number) into a linguistic variable (fuzzy number) is called
fuzzification. Here error e (Vdc,ref Vdc) and change of error ce (en en-1) are used as
numerical variables from the real system. To convert these numerical variables into
linguistic variables, following seven fuzzy levels or sets are chosen as -

Shailendra Jain, PhD, NIT Bhopal

NB

negative big

NM

negative medium

NS

negative small

ZE

zero

PS

positive small

PM

positive medium

PB

positive big

The numbers of fuzzy levels are not fixed and depends on the input resolution
needed in an application. The larger the number of fuzzy levels, the higher is the input
resolution. The inputs are not quantized in the classical sense that each input is
assigned to exactly one level. Instead, each input is assigned a membership grade ()
to each fuzzy set. The fuzzy control implemented here uses triangular fuzzy-sets values.
Trapezoidal or bell-shaped sets may also be employed. The triangular functions are
used here just for simplicity. Fig. 5 shows the normalized triangular membership
functions used in fuzzification. For a given crisp input, fuzzifier finds the degree of
membership in every linguistic variables. Since there are only two overlapping
memberships in this specific case, all linguistic variables except two will have zero
membership.

Shailendra Jain, PhD, NIT Bhopal

e(n)

Imax(n)
Fuzzification

Vdc,ref
Vdc

Imax=Imax(n-1)
+Imax(n)

Defuzzification

ce(n)
output

Decision making
Fuzzy Logic Controller

Fig. 4 Internal structure of the Fuzzy Logic Controller

e , ce
NB

NM

-1

-0.5

NS ZE

-0.25

PS

PM

0.25

0.5

PB

error 'e' and change in error 'ce'


(a)

NB

-1

NM

-0.5

Imax

NS ZE

-0.2

PS

0.2

PM

0.5

PB

change in reference current, Imax


(b)
Fig. 5 (a) Membership functions for the inputs e and ce
(b) Membership functions for the output Imax

Shailendra Jain, PhD, NIT Bhopal

Rule Evaluator (Decision Making)


In conventional controllers, the control gains or control laws are the combination
of numerical values. In FLC, the equivalent term is rule and they are linguistic in nature.
The control rules that associate the fuzzy output to the fuzzy inputs are derived from the
general knowledge of the system behavior. However, some of the control actions in the
rule table are also developed using trial and error and from an intuitive feel of the
process being controlled. A typical rule can be written as follows Ri : If error (e) is Ai and change of error (ce) is Bi then output is Ci.
Where, Ai, Bi, Ci are the labels of linguistic variables of error (e), change of error
(ce) and output (Imax) respectively. e, ce and Imax represent degree of membership. To
evaluate the rules fuzzy set theory is used.
Fuzzy Set
Let X be a collection of objects denoted generically by { x }, which could be
discrete or continuous, X is called the universe. If an element in the universe, say x, is a
member of fuzzy set A then mapping is given as
(x) [ 0, 1]
A = [x, (x) | x X ]
The basic fuzzy set operations needed for the evaluation of fuzzy rules are AND
(), OR (), and NOT (--).
4. AND Intersection :

A B = min [A(x), B(x)]

5. OR - Union :

A B = max [A(x), B(x)]

6. NOT - Complement :

A = 1 - A (x)

By definition of AND, evaluation of rule Ri results in a minimum of Ai(x), Bi(x)


allocated to Ci(x).
In this effort, the control rules for a typical system are shown in Fig 6, obtained
from an understanding of the system behavior. Since every e and ce belongs to at
most two fuzzy sets, a maximum of four rules are considered at any sample, to process
any combination of feedback signals (e, ce).

Shailendra Jain, PhD, NIT Bhopal

For instance, let e = 0.4 and ce = -0.2. From Fig. 5(a) error e belongs to the
fuzzy sets PS and PM with PS(e) = 0.4 and PM(e) = 0.6 while change in error ce
belongs to the fuzzy set NS and ZE with NS(ce) = 0.8 and ZE(ce) = 0.2 . Therefore, the
combinations of e and ce are (PS, NS), (PS, ZE), (PM, NS), and (PM, ZE). The
inferred degree of membership for the rest of the rules is zero. The inference result of
each rule consists of two parts, the weighting factor, i, of the individual rule, and the
degree of change in duty cycle, Ui, according to the rule. The weighting factor i is
obtained by means of Mamdanis min fuzzy implication of e(e) and ce(ce). Ui is
retrieved from the control rule table. The inferred output of each rule using Mamdanis
min fuzzy implication is written as
zi = min {e(e), ce(ce)}Ui
= i Ui
where zi denotes the fuzzy representation of change in duty cycle inferred by the ith rule.
Since the inferred output is a linguistic result, a defuzzification operation is performed
next to obtain a crisp result.
Defuzzification:
The reverse of fuzzification is called defuzzification. The rules of FLC produce
required output in the form of linguistic variable (Fuzzy Number). According to the real
world requirements, linguistic variables have to be transformed to crisp output (Real
number). In defuzzification operation as shown in Fig. 7, a logical sum of the inference
result from each of the four rules is performed. This logical sum is the fuzzy
representation of the change in reference current (output). The choices available for
defuzzification are numerous. So far the choice of strategy is a compromise between
accuracy and computational intensity. Here, a crisp value for the change in reference
current is calculated using the center of gravity method. The product of centroid mi of Ui
(obtained from control rules) and the weighting factor i gives the contribution of ith
inference result to the crisp value of the change in reference current. The resultant
change of reference current/angle Imax can therefore be represented by
4

i mi

I max ( n ) =

i =1

(1)

i =1

Shailendra Jain, PhD, NIT Bhopal

The calculation of Imax involves multiplication and division of variables, not just
the scaling of signals by constant gains. Therefore, the computational complexity of (1)
is much greater than that of a simple linear digital filter.
Hence, the fuzzy controller used is characterized as follows -

Seven fuzzy sets for each input and output

Triangular membership functions for simplicity

Fuzzification using continuous universe of discourse

Implication using Mamdanis min operator

Defuzzification using Height method.

References
1.
2.
3.
4.
5.
6.
7.

B. K. Bose, Expert Systems, Fuzzy Logic, and Neural Network Applications in Power
Electronics and Motion Control,
C. C. Lee, Fuzzy Logic in Control Systems: Fuzzy Logic Controller Parts I and II, IEEE
Transaction on syst, Man, Cybern, vol. 20, Apr. 1990, pp 404-435.
3. V.S.C.Raviraj and P.C. Sen, Comparative study of Proportional-Integral, Sliding Mode,
and Fuzzy Logic Controllers for Power Converters, IEEE Transaction on Industry
Applications, Vol. 33, No. 2, Mar/Apr. 1997, pp 518-524.
C. C. Lee, Fuzzy logic in control system: fyzzy logic controller-part I, IEEE Transaction on
Systems, Man, and Cybernatics, Vol. 20, No.2, Mar/Apr. 1990, pp 404-415.
Han-Xiong Li and H. B. Gatland, A New Methodology for Designing a Fuzzy Logic
Controller, IEEE Transaction on Systems, Man, and Cybernatics, Vol. 25, No.3, Mar 1995,
pp 505-514.
Tarun Gupta, R.R.Boudreaux, R.M. Nelms and John Y. Hung, Implementation of a Fuzzy
Controller for DC-DC Converters Using an inexpensive 8-bit Microcontroller, IEEE
Transaction on Industrial Electronics, Vol. 44, No. 5, Oct. 1997, pp 661-668.
Shailendra jain, P. Agarwal, and H.O. Gupta, A fuzzy logic controlled shunt active
power filter for power quality improvement, IEE Proc. Electric Power Applications,
vol. 149, issue 5, Sept. 2002, pp. 317-328

10

Shailendra Jain, PhD, NIT Bhopal

Vous aimerez peut-être aussi