ect191_fuzzy logic

Document Sample
ect191_fuzzy logic Powered By Docstoc
					             Collection Technique ..........................................................................




             Cahier technique no 191

             Fuzzy logic




F. Chevrie
F. Guély
Cahiers Techniques are a collection of documents intended for engineers
and technicians, people in the industry who are looking for information in
greater depth in order to complement that given in display product
catalogues.

These Cahiers Techniques go beyond this stage and constitute practical
training tools.
They contain data allowing to design and implement electrical equipement,
industrial electronics and electrical transmission and distribution.
Each Cahier Technique provides an in-depth study of a precise subject in
the fields of electrical networks, protection devices, monitoring and control
and industrial automation systems.

The latest publications can be downloaded on Internet from the
Schneider server.
Code: http://www.schneider-electric.com
Section: Mastering electricity

Please contact your Schneider representative if you want either a Cahier
Technique or the list of available titles.

The “Cahiers Techniques” collection is part of the Groupe Schneider’s
“Technical series”.


Foreword
The author disclaims all responsibility further to incorrect use of information
or diagrams reproduced in this document, and cannot be held responsible
for any errors or oversights, or for the consequences of using information
and diagrams contained in this document.

Reproduction of all or part of a Cahier Technique is authorised with the prior
consent of the Scientific and Technical Division. The statement “Extracted
from Schneider Cahier Technique no..... (please specify)” is compulsory.
no 191
Fuzzy logic




François CHEVRIE

After joining Telemecanique in 1987, he joint the Advanced
Automation Laboratory of the Research Division in 1993. A CNAM
Industrial Automation engineering graduate, his dissertation was
based on the integration of fuzzy logic in Schneider programmable
controllers.
He played an active part in the preparation of the fuzzy logic product
offer for the Micro/Premium PC range, and helped implement this
technique, particularly in the car and food industries.




François GUELY

After graduating from the Ecole Centrale de Paris in 1988, he joined
Telemecanique in Japan in 1990 and was awarded his PhD in fuzzy
logic based automatic control in 1994. He has been in charge of
Schneider’s Advanced Automatic Department since 1995 where he
has helped prepare the extension to fuzzy logic of the IEC language
standard for programmable controllers.




ECT 191 first issued, december 1998

                                      Cahier Technique Schneider no 191 / pp.1
Lexicon


                            Activation:                                          the two discrete values 0 (the element does not
                            See degree of truth.                                 belong...) or 1 (...belongs to the set). A fuzzy set
                            Conclusion:                                          is defined by a membership function which can
                            A rule conclusion is a statement combining a         take any real values between 0 and 1.
                            linguistic variable and a linguistic term written    Inference:
                            after the then of the rule. A conclusion can be      Calculation of the degrees of activation of all the
                            made up of a combination of several statements.      rules in the base as well as of all the fuzzy sets
                            Condition:                                           of the linguistic variables contained in the
                            See predicate.                                       conclusions of these rules.
                            Data merge:                                          Knowledge base:
                            Data merge consists of extracting, from several      Set of membership functions and rules of a fuzzy
                            pieces of data, one or more items of information     system containing expertise, knowledge of the
                            which may be different kinds.                        operator, expert, etc.
                            For example: from variables R, V and B giving        Linguistic term:
                            the colour of a biscuit, the cooking state of the    Term associated with a membership function
                            biscuit can be deduced. The term “Sensor             characterising a linguistic variable.
                            merge” is also used.                                 Linguistic variable:
                            Defuzzification:                                     Numerical variable with a name (pressure,
                            Conversion, after inference, of a fuzzy set of a     temperature… to which are associated inguistic
                            linguistic output variable into a numerical value.   terms.
                            Degree of activation:                                Membership function:
                            See degree of truth.                                 Function µA (x) associating to any input value x
                            Degree of membership:                                its degree of membership to the set A. This
                            An element x belongs to a fuzzy set A with a         gradual value belongs to the [0; 1] interval.
                            degree of membership between 0 and 1, given          Predicate:
                            by the membership function µ A (x).                  Also known as premise or condition, a rule
                            Degree of truth:                                     predicate is a statement combining a linguistic
                            The degree of truth, or degree of activation, of a   variable and a linguistic term written between
                            rule is a value y between 0 and 1 deduced from       the if and the then of the rule. A predicate can
                            the degrees of membership of the rule                be made up of a combination of several
                            predicates. It directly affects the value of the     statements linked by AND, OR, NOT operators.
                            conclusions of this rule. The rule is also said to   Premise:
                            be active at y.                                      See Predicate.
                            Fuzzification:                                       Sensor merge:
                            Conversion of a numerical value into a fuzzy         See Data merge.
                            degree of membership by evaluating a                 Singleton:
                            membership function.                                 Membership function µA (x), equals to zero for all
                            Fuzzy set:                                           x, except at a singular point x0.
                            In the classical set theory, the characteristic
                            function defines the set: this function only takes




Cahier Technique Schneider n o 191 / pp.2
                                   Fuzzy logic


                                   Initially a theory, today fuzzy logic has become an operational technique.
                                   Used alongside other advanced control techniques, it is making a discrete
                                   but appreciated appearance in industrial control automation systems.
                                   Fuzzy logic does not necessarily replace conventional control systems.
                                   Rather it completes such systems. Its advantages stem from its ability to:
                                   c formalise and simulate the expertise of an operator or designer in
                                   process control and tuning,
                                   c provide a simple answer for processes which are difficult to model,
                                   c continually take into account cases or exceptions of different kinds, and
                                   progressively incorporate them into the expertise,
                                   c take into account several variables and perform “weighted merging” of
                                   influencing into variables.
                                   How does this technique contribute to industrial process control?
                                   What is the effect on product quality and manufacturing cost?
                                   Following a few basic theoretical notions, this Cahier Technique answers
                                   the questions asked by automatic control engineers and potential users by
                                   means of industrial examples, in terms of implementation and competitive
                                   advantages.




Contents
1 Introduction                     1.1 Fuzzy logic today                                                 pp. 4
                                   1.2 The history of fuzzy logic                                        pp. 4
                                   1.3 Value and use of fuzzy logic for control                          pp. 5
2 Theory of fuzzy sets             2.1 Notion of partial membership                                      pp. 6
                                   2.2 Membership functions                                              pp. 6
                                   2.3 Fuzzy logic operators                                             pp. 8
                                   2.4 Fuzzy rules                                                       pp. 9
3 A teaching application example   3.1 Introduction                                                      pp. 14
                                   3.2 Presentation of the example                                       pp. 14
                                   3.3 Linguistic variables and terms                                    pp. 15
                                   3.4 Rules and outputs                                                 pp. 15
4 Implementation                   4.1 when can fuzzy rule bases be used?                                pp. 16
                                   4.2   Designing an application                                        pp. 16
                                   4.3   Using an application                                            pp. 17
                                   4.4   Choosing the implementation technology                          pp. 17
                                   4.5   Standards                                                       pp. 18
5 Fuzzy application                5.1 Application types                                                 pp. 19
                                   5.2 Examples of industrial achievements                               pp. 20
6 Conclusion                                                                                             pp. 24
Appendix                                                                                                 pp. 26
Bibliography                                                                                             pp. 28




                                                                         Cahier Technique Schneider no 191 / pp.3
1 Introduction



1.1 Fuzzy logic today
                            In the majority of present-day applications, fuzzy   In continuous and batch production processes,
                            logic allows many kinds of designer and operator     as well as in automation systems (which is the
                            qualitative knowledge in system automation to        subject of this Cahier Technique), applications
                            be taken into account.                               have also increased. Fuzzy logic has developed
                            Fuzzy logic began to interest the media at the       in this area as it is an essentially pragmatic,
                            beginning of the nineties. The numerous              effective and generic approach. It allows
                            applications in electrical and electronic            systematisation of empirical knowledge and
                            household appliances, particularly in Japan,         which is thus hard to control. The theory of fuzzy
                            were mainly responsible for such interest.           sets offers a suitable method that is easy to
                            Washing machines not requiring adjustment,           implement in real time applications, and enables
                            camcorders with Steadyshot (TM) image                knowledge of designers and operators to be
                            stabilization and many other innovations brought     transcribed into dynamic control systems.
                            the term “fuzzy logic” to the attention of a wide    This makes fuzzy logic able to tackle automation
                            public.                                              of procedures such as startup and setting of
                            In the car industry, automatic gear changes,         parameters, for which few approaches were
                            injection and anti-rattle controls and air           previously available.
                            conditioning can be optimized thanks to fuzzy        This Cahier Technique describes fuzzy logic and
                            logic.                                               its application to production processes.



1.2 The history of fuzzy logic
                            Appearance of fuzzy logic                            Boom
                            The term “fuzzy set” first appeared in 1965 when     Fuzzy logic experienced a veritable boom in
                            professor Lotfi A. Zadeh from the university of      Japan where research was not only theoretical
                            Berkeley, USA, published a paper entitled            but also highly application oriented. At the end of
                            “Fuzzy sets”. Since then he has achieved many        the eighties fuzzy logic had taken off in a big
                            major theoretical breakthroughs in this field and    way, and consumer products such as washing
                            has been quickly joined by numerous research         machines, cameras and camcorders with the
                            workers developing theoretical works.                mention “fuzzy logic” were too numerous to be
                                                                                 counted. Industrial applications such as
                            Initial applications                                 treatment of water, harbour container cranes,
                            At the same time, some researchers turned their      undergrounds and ventilation/air conditioning
                                                                                 systems began to use fuzzy logic too. Finally,
                            attention to the resolution by fuzzy logic of
                                                                                 applications developed in such other fields such
                            problems considered to be difficult. In 1975
                                                                                 as finance and medical diagnosis.
                            professor Mamdani from London developed a
                                                                                 From 1990 onwards, many applications began to
                            strategy for process control and published the
                                                                                 emerge in large numbers in Germany, as well
                            encouraging results he had obtained for the          as, to a lesser extent, in the USA.
                            control of a steam motor. In 1978 the Danish
                            company, F.L. Smidth, achieved the control of a
                            cement kiln. This was the first genuine industrial
                            application of fuzzy logic.




Cahier Technique Schneider n o 191 / pp.4
1.3 Value and use of fuzzy logic for control
                  Value                                                 Fuzzy rule bases are advantageous in control as
                  Fuzzy logic stems from several observations,          they allow:
                  namely:                                               c consideration of existing qualitative expertise,
                  c The knowledge that a human being has of any         c consideration of variables the effect of which
                  situation is generally imperfect,                     would be difficult to model with traditional means,
                  v it can be uncertain (he doubts its validity),       but is known in a qualitive way,
                  v or imprecise.                                       c improvement of conventional controller
                  c Human beings often solve complex problems           operation by:
                  with approximate data: accuracy of data is often      v self-tuning of controller gains off line or on line,
                  useless; for example, in order to choose an           v modification of their output (feed forward)
                  apartment he may take into account surface            according to events that cannot be taken into
                  area, proximity of shops, distance from the           account using a conventional technique.
                  workplace and rent without, however, needing a
                  very precise value for each piece of information.     Using knowhow to its best advantage
                  c In industry and technology, operators               A vital condition for the use of fuzzy rules is the
                  frequently solve complex problems in a relatively     existence of human expertise and knowhow.
                  simple manner without needing to model the            Fuzzy rule bases cannot provide a solution when
                  system. Likewise, it is common knowledge that a       no-one knows how the system operates or
                  mathematical model is not required to drive a         people are unable to manually control it.
                  car, and yet a car is a highly complex system.        When such knowhow exists and can be
                  c The more complex a system, the more difficult       transcribed in the form of fuzzy rules, fuzzy logic
                  it is to make precise assertions on its behaviour.    simplifies its implementation, and operation is
                                                                        then easily understood by the user.
                  The following are naturally deduced from these        Fuzzy logic also enables maximum benefit to be
                  observations:                                         derived from practical knowhow, often sought for
                  c rather than modelling the system, it is often       in order to prevent loss of knowhow or to share
                  more useful to model the behaviour of a human         this knowhow with other people in the company.
                  operator used to control the system;                  When collecting expertise, unconscious omission
                  c rather than using equations, operation can be       of information, the difficulty to explain and the
                  described by qualitatively with an appropriate        fear to disclose knowhow are obstacles that are
                  quantitative translation.                             frequently encountered. This stage must
                                                                        therefore be prepared and conducted with care,
                  Use for control purposes
                                                                        taking into account the human factor.
                  Fuzzy logic is well known by automatic control
                  engineers for its applications in process control     If human expertise exists, then fuzzy rules can
                  and monitoring, then commonly referred to as          be used, particularly when system knowledge is
                  “fuzzy control”. Just like a conventional             tainted by imperfections, when the system is
                  controller, the fuzzy controller is incorporated in   complex and hard to model and when the
                  the control loop and computes the control to be       method used requires a global view of some of
                  applied to the process according to one or more       its aspects. Fuzzy rules do not replace
                  setpoints and one or more measurements taken          conventional automatic control methods, rather
                  on the process.                                       they complete these methods.




                                                                                    Cahier Technique Schneider no 191 / pp.5
2 Theory of fuzzy sets



2.1 Notion of partial membership
                            In the sets theory, an element either belongs or               The notion of a fuzzy set was created in order to
                            does not belong to a set. The notion of a set is               take situations of this kind into account. The
                            used in many mathematical theories. This                       theory of fuzzy sets is based on the notion of
                            essential notion, however, does not take into                  partial membership: each element belongs
                            account situations which are yet both simple and               partially or gradually to the fuzzy sets that have
                            common. Speaking of fruits, it is easy to define               been defined. The outlines of each fuzzy set
                            the set of apples. However, it is harder to define             (see fig.1 ) are not “crisp”, but “fuzzy” or
                            the set of ripe apples. We understand that an                  “gradual”.
                            apple ripens progressively... the notion of a ripe
                            apple is thus a gradual one.



                                                                                                          “Fuzzy” or “gradual”
                                               y                A                  B
                                                                                                          outline


                                                                                                      t
                                                                                           z

                                                                    x
                             “Crisp” outline                                                                         x belongs neither to A nor B
                                                                                                                     y belongs completely to A
                                                                                                                     z belongs completely to B
                                       A: conventional set                             B: fuzzy set                  t belongs partially to B

                            Fig. 1 : comparison of a conventional set and a fuzzy set.




2.2 Membership functions
                            A fuzzy set is defined by its “membership                      range [1.60 m; 1.80 m] and “1” for heights in that
                            function” which corresponds to the notion of a                 range. The fuzzy set of people of “medium
                            “characteristic function” in classical logic.                  height” will be defined by a “membership
                            Let us assume that we want to define the set of                function” which differs from a characteristic
                            people of “medium height”. In classical logic, we              function in that it can assume any value in the
                            would agree for example that people of medium                  range [0;1].
                            height are those between 1.60 m and 1.80 m                     Each possible height will be assigned a “degree
                            tall. The characteristic function of the set                   of membership” to the fuzzy set of “medium
                            (see fig. 2 ) gives “0” for heights outside the                heights” (see fig. 3 ) between 0 and 1.



                            Degree of membership µ                                         Degree of membership µ

                               1                                                               1
                                                                                                                           Characteristic function
                                                            Characteristic function                                        “medium height”
                                                            “medium height”

                               0                                                               0
                                            1m60       1m80             Variable: height                      1m72                Variable: height

                            Fig. 2 : characteristic function.                              Fig. 3 : membership function.




Cahier Technique Schneider n o 191 / pp.6
A number of fuzzy sets can be defined on the                    c they are simple,
same variable, for example the sets “small                      c they contain points allowing definition of areas
height”, “medium height” and “tall height”, each                where the notion is true and areas where it is
notion being explained by a membership function                 false, thereby simplifying the gathering of
(see fig. 4 ).                                                  expertise.
                                                                We have chosen to use membership functions of
                                                                this kind in the rest of this document.
      µ
                                                                In some cases, membership functions may be
          Small       Medium                Tall                equal to 1 for a single value of the variable, and
1                                                               equal to 0 elsewhere. They are then known as
0.7                                                             “singleton membership functions”. A fuzzy
                                                                singleton (see fig. 6 ) defined on a real variable
                                                                (height) is the expression in the fuzzy field of a
0.3
                                                                specific value (Paul’s height) of this variable
    0                                                           (see appendix).
                  1.60         1.80        2       Height (m)

Fig. 4 : membership function, variable and linguistic term.
                                                                     µ

This example shows the graduality that enables                   1
fuzzy logic to be introduced. A 1.80 m tall person
belongs to the “tall” set with a degree of 0.3, and
to the set “medium height” with a degree of 0.7.
In classical logic, the change from average to tall              0
would be sudden. A 1.80 m person would then                                                 1.78 m           Paul's height
be of medium height, whereas a 1.81 m person
would be tall, an assertion which shocks                        Fig. 6 : singleton membership function.
intuition. The variable (for example: height) as
well as the terms (for example: medium, tall)
defined by the membership functions, are known                  Fuzzification - Degree of membership
as linguistic variable and linguistic term                      Fuzzification enables a real value to be
respectively.                                                   converted into a fuzzy one.
As we shall see further on, both linguistic                     It consists of determining the degree of
variables and terms can be used directly in rules.              membership of a value (measured by example)
                                                                to a fuzzy set. For example (see fig. 7 ), if the
Membership functions can assume any shape.
                                                                current value of the “input” variable is 2, the
However they are often defined by straight
                                                                degree of membership to the “low input”
segments and said to be “piece-wise linear”
                                                                membership function is equal to 0.4 which is the
(see fig. 5 ).
                                                                result of the fuzzification.
“Piece-wise linear” membership functions are
                                                                We can also say that the “low input” proposal is
frequently used as:
                                                                true at 0.4. We then talk of degree of truth of the
                                                                proposal. Degree of membership and degree of
                                                                truth are therefore similar notions.
µ                      “Totally”
                     medium height

                                                                         µ
      Small              Medium                Tall
                                                                             Low
                                                                     1

                                                       Height    0.4


Small “not at all”                Tall “not at all”                  0
medium                            medium                                                        2                    Input

Fig. 5 : piece-wise linear membership functions.                Fig. 7 : fuzzification.




                                                                                   Cahier Technique Schneider no 191 / pp.7
2.3. Fuzzy logic operators
                            These operators are used to write logic                   NB: this fuzzy OR is compatible with classical
                            combinations between fuzzy notions, i.e. to               logic: 0 OR 1 yields 1.
                            perform computations on degrees of truth. Just
                            as for classical logic, AND, OR and NOT                   Complement
                            operators can be defined.                                 The logic operator corresponding to the
                            For example: Interesting Apartment =                      complement of a set is the negation.
                            Reasonable Rent AND Sufficient Surface Area.              µ(NOT A) = 1 - µ(A)
                            Choice of operators                                       For example:
                            These operators have many variants (see                   “Low Temperature” is true at 0.7
                            appendix). However the most common are the                “NOT Low Temperature” that we will normally
                            “Zadeh” operators described below.                        write as “Temperature NOT Low” is therefore
                                                                                      true at 0.3.
                            The degree of truth of a proposal A will be
                            noted µ(A).                                               NB: the negation operator is compatible with
                                                                                      classical logic: NOT(0) yields 1 and NOT(1)
                            Intersection                                              yields 0.
                            The logic operator corresponding to the
                                                                                      Fuzzy ladder
                            intersection of sets is AND. The degree of truth
                            of the proposal “A AND B” is the minimum value            Ladder language or contact language is
                            of the degrees of truth of A and B:                       commonly used by automatic control engineers
                                                                                      to write logic combinations, as it enables their
                            µ(A AND B) = MIN(µ(A),µ(B))                               graphic representation. Schneider has
                            For example:                                              introduced the use of ladder representation to
                            “Low Temperature” is true at 0.7                          describe fuzzy logic combinations.
                            “Low Pressure” is true at 0.5                             Below is an example dealing with the comfort of
                            “Low Temperature AND Low Pressure” is                     ambient air:
                            therefore true at 0.5 = MIN(0.7; 0.5).
                                                                                      hot, damp air is uncomfortable (excessive
                            NB: this fuzzy AND is compatible with classical           perspiration); likewise breathing is difficult in air
                            logic 0 and 1, yelds 0.                                   that is cold and too dry. The most comfortable
                                                                                      thermal situations are those in which air is hot
                            Union                                                     and dry, or cold and damp. This can be
                            The logic operator corresponding to the union of          transcribed by the fuzzy ladder in figure 8
                            sets is OR. The degree of truth of the proposal           corresponding to the following combination:
                            “A OR B” is the maximum value of the degrees
                                                                                      Good comfort = (Low Temperature AND High
                            of truth of A and B:
                                                                                      Humidity) OR (High Temperature AND Low
                            µ(A OR B) = MAX(µ(A),µ(B))                                Humidity).
                            For example:                                              It represents a possible definition of the
                            “Low Temperature” is true at 0.7                          sensation of comfort felt by a person in a thermal
                            “Low Pressure” is true at 0.5                             environment in which air does not move.
                            “Low Temperature OR Low Pressure” is
                            therefore true at 0.7.


                            µ                                  µ

                                 Low          High                 Low         High


                                                                                                    Low               High          Good
                                                                                                    temperature       humidity      comfort


                            10           20          30   °C        50                  100   %
                                                                                                    High              Low
                                       Temperature                        Humidity                  temperature       humidity

                            Fig. 8 : fuzzy ladder.




Cahier Technique Schneider n o 191 / pp.8
                   Fuzzy classification                                   belongs to a varying degree to the class of “fresh
                   Classification normally consists of two steps:         lettuces”.
                   c preparation: determining the classes to be           Classification methods, whether they produce a
                   considered,                                            gradual, boolean or probabilistic result, can be
                   c on line: assigning the elements to classes.          developed from:
                   The notions of class and set are identical             c an experiment (case of “fuzzy ladder”
                   theoretically.                                         mentioned above),
                   There are three types of assignment methods            c examples used for learning purposes (e.g. for
                   according to the result produced:                      neuron network classifiers),
                   c boolean: the elements either belong or do not        c mathematical or physical knowledge of a
                   belong to the classes,                                 problem (for example, the comfort of a thermal
                                                                          situation can be evaluated from thermal balance
                   c probabilistic: the elements have a probability of
                                                                          equations).
                   belonging to boolean classes, such as for example
                   the probability that a patient has measles given       Gradual (or fuzzy) classification methods can be
                   the symptoms that he shows (diagnosis),                used in control loops. This is the case of the
                   c gradual: the elements have a degree of               industrial cooking example for biscuits described
                   membership to the sets; for example a lettuce          later on.


2.4. Fuzzy rules
                   Fuzzy logic and artificial intelligence
                   The purpose of fuzzy rule bases is to formalise        Inputs                                        Outputs
                   and implement a human being’s method of
                   reasoning. As such it can be classed in the field
                   of artifical intelligence.
                   The tool most commonly used in fuzzy logic                 Fuz-                                Defuz-
                                                                                               Inferences
                   applications is the fuzzy rule base. A fuzzy rule          zification                          zification
                   base is made of rules which are normally used in
                   parallel but which can also be concatenated in
                   some applications.
                   A rule is of the type:                                 Numerical               Fuzzy             Numerical
                                                                          values                  area              values
                   IF “predicate” THEN “conclusion”.
                   For example: IF “high temperature and high             Fig. 10 : fuzzy processing.
                   pressure” THEN “strong ventilation and wide
                   open valve”.
                                                                          Predicate
                   Fuzzy rule bases, just like conventional expert        A predicate (also known as a premise or
                   systems, rely on a knowledge base derived from         condition) is a combination of proposals by AND,
                   human expertise. Nevertheless, there are major         OR, NOT operators.
                   differences in the characteristics and processing
                   of this knowledge (see fig. 9 ).                       The “high temperature” and “high pressure”
                                                                          proposals in the previous example are combined
                   A fuzzy rule comprises three unctional parts           by the AND operator to form the predicate of the
                   summarised in figure 10 .                              rule.


                   Fuzzy rule base                                        Conventional rule base (expert system)
                   Few rules                                              Many rules
                   Gradual processing                                     Boolean processing
                   Concatenation possible but scarcely used               Concatenated rules A OR B ⇒ C,
                                                                                                          C ⇒ D,
                                                                                                             D AND A ⇒ E
                   Rules processed in parallel                            Rules used one by one, sequentially
                   Interpolation between rules that                       No interpolation, no contradiction
                   may contradict one another

                   Fig. 9 : fuzzy rule base and conventional rule base.




                                                                                       Cahier Technique Schneider no 191 / pp.9
                            Inference                                                   conclusions are uncertain. The theory of
                            The most commonly used inference mechanism                  possibilities, invented by Lotfi Zadeh, offers an
                            is the “Mamdani” one. It represents a                       appropriate methodology in such cases.
                            simplification of the more general mechanism                Likewise, negation is not used in conclusions for
                            based on “fuzzy implication” and the                        Mamdani rules. This is because if a rule were to
                            “generalised modus ponens”. These concepts                  have the conclusion “Then ventilation not
                            are explained in the appendix. Only the                     average”, it would be impossible to say whether
                            “Mamdani” rule bases are used below.                        this means “weak ventilation” or “strong
                                                                                        ventilation”. This would be yet another case of
                            Conclusion
                                                                                        uncertainty.
                            The conclusion of a fuzzy rule is a combination of
                            proposals linked by AND operators. In the                   Mamdani inference mechanism
                            previous example, “strong ventilation” and “wide            c Principle
                            open valve” are the conclusion of the rule.
                                                                                        A Mamdani fuzzy rule base therefore contains
                            “OR” clauses are not used in conclusions as they            linguistic rules using membership functions to
                            would introduce an uncertainty into the                     describe the concepts used (see fig. 11 ).
                            knowledge (the expertise would not make it
                                                                                        The inference mechanism is made up of the
                            possible to determine which decision should be
                                                                                        following steps:
                            made). This uncertainty is not taken into account
                            by the Mamdani inference mechanism which                    c Fuzzification
                            only manages imprecisions. Therefore the                    Fuzzification consists of evaluating the
                            “Mamdani” fuzzy rules are not in theory suitable            membership functions used in rule predicates, as
                            for a diagnosis of the “medical” kind for which             is illustrated in figure 12 :



                                       IF “high pressure”       AND     “high temp.”      THEN       “valve wide open”

                                             µ                          µ                            µ




                                                            High                          High                           Wide



                                                             Pressure                  Temperature               Valve opening




                                        IF “average pressure”      AND “high temp.”      THEN        “average valve opening”

                                             µ                          µ                            µ




                                                            Average                        High                      Average



                                                             Pressure                  Temperature               Valve opening

                            Fig. 11 : implication.




Cahier Technique Schneider n o 191 / pp.10
              IF “high pressure”        AND         “high temp.”             THEN        “valve wide open”
                   µ                                    µ                                µ


                                     High                                  High                                  Wide
             0.5
                                                  0.3


                           2.5 bar                                17°C
                                      Pressure                       Temperature                     Valve opening

Fig. 12 : fuzzification.


c Degree of activation
The degree of activation of a rule is the                              (see section 2.3.), as shown in figure 13 . The
evaluation of the predicate of each rule by logic                      “AND” is performed by realising the minimum
combination of the predicate proposals                                 between the degrees of truth of the proposals.



              IF “high pressure”            AND         “high temp.”        THEN            “valve wide open”
                   µ                                    µ                                   µ


                                                                                   Min                           High
             0.5
                                                  0.3                             } = 0.3
                           2.5 bar                                 17°C
                                      Pressure                        Temperature                     Valve opening

Fig. 13 : activation.


c Implication
The degree of activation of the rule is used to                        The conclusion fuzzy set is built by realising the
determine the conclusion of the rule: this                             minimum between the degree of activation and
operation is called the implication. There are                         the membership function, a sort of “clipping”
several implication operators (see appendix), but                      of the conclusion membership function
the most common is the “minimum” operator.                             (see fig. 14 ).



              IF “high pressure”            AND             “high temp.”      THEN           “valve wide open”
                   µ                                        µ                                µ
                                                                                                         Wide

                                                                                     Min
             0.5
                                                   0.3                             } = 0.3
                           2.5 bar                                  17°C
                                      Pressure                         Temperature                     Valve opening
Fig. 14 : implication.




                                                                                     Cahier Technique Schneider no 191 / pp.11
                            c Aggregation
                            The output global fuzzy set is built by                          output. The rules are considered to be linked by
                            aggregation of the fuzzy sets obtained by each                   a logic “OR”, and we therefore calculate the
                            rule concerning this output. The example below                   maximum value between the resulting
                            shows the case when two rules act on an                          membership functions for each rule (see fig. 15 ).



                                       IF “high pressure”        AND      “high temp.”         THEN      “valve wide open”
                                             µ                            µ                              µ
                                                   High                               High                            Wide



                                                                                                   0.3
                                                   2.5 bar                        17°C
                                                              Pressure               Temperature                    Valve opening



                                       IF “average pressure”       AND    “high temp.”         THEN      “valve wide open”
                                             µ                            µ                              µ
                                                   Average                            High                      Average




                                                   2.5 bar                        17°C
                                                              Pressure               Temperature                    Valve opening
                                                                                                         µ

                                                                                                                Aggregation:
                                                                                                                MAXIMUM




                                                                                                                    Valve opening
                            Fig. 15 : aggregation of rules.


                            Defuzzification                                                  “Free” and “able” rules
                            At the end of inference, the output fuzzy set is                 Fuzzy rule bases, in their general case, use
                            determined, but cannot be directly used to                       membership functions on system variables, and
                            provide the operator with precise information or                 rules that can be written textually. Each rule uses
                            control an actuator. We need to move from the                    its own inputs and outputs, as shown by the
                            “fuzzy world” to the “real world”: this is known as              example below:
                            defuzzification.                                                 R1:    IF “high temperature”
                            A number of methods can be used, the most                               THEN “high output”
                            common of which is calculation of the “centre of
                            gravity” of the fuzzy set (see fig. 16 ).                        R2:    IF “average temperature”
                                                                                                    AND “low pressure”
                                                                                                    THEN “average output”

                              µ                           ∫xµ(x)dx                           R3:    IF “average temperature”
                                                                                                    AND “high pressure”
                                                           ∫ µ(x)dx                                 THEN “low output”
                                                                                             R4:    IF “low temperature”
                                                                                                    AND “high pressure”
                                                 35.6°                Valve opening
                                                                                                    THEN “very low output”
                            Fig. 16 : defuzzification by centre of gravity.




Cahier Technique Schneider n o 191 / pp.12
In diagram form, the “areas of action” of the rules         it does not interest us. It is best to verify it as this
and their overlapping can be represented in the             may be an omission;
table in figure 17 .                                        c the first rule only takes temperature into
                                                            account: this situation is normal in that it reflects
                                                            the existing expertise.
   Pressure                                                 However, many applications define rule “tables”.
                                                            In this context, the space is “gridded” and each
                                                            “box” in the grid is assigned a rule. This
                                                            approach has the advantage of being
                                                            systematic, but:
           Very                                             c it does not always allow simple expression (in
                            Low
High       low
                           output                           a minimum number of rules) of the existing
          output                                            expertise,
                                                            c it can be applied only for two or three inputs,
                                            High
                                           output           whereas ”free” rule bases can be built with a
                                                            large number of variables.
                         Average                            Remarks
Low
                          output
                                                            c The behaviour of a fuzzy rule base is static
                                                            and non-linear with respect to its inputs.
                                                            c Fuzzy rule bases are not themselves dynamic,
         Low             Average          High      Temp.
                                                            although they often use as inputs variables
Fig. 17 : implication represented in a table.               expressing system dynamics (derivatives,
                                                            integrals, etc. ) or time.
                                                            c The main advantage of the “fuzzy PID”
We can make the following observations:                     controller, often presented as a teaching
c not all the space is necessarily covered: the             example to give an idea of fuzzy logic, is to make
combination “low temperature and low pressure”              a non-linear PID, which rarely justifies its use in
is not taken into account in this case. The                 the place of a conventional PID. Moreover it
explanation is for example that this combination            would be hard to incorporate an existing
is not physically possible for this machine or that         expertise in this case.




                                                                        Cahier Technique Schneider no 191 / pp.13
3 A teaching application example



3.1 Introduction
                            Most fuzzy logic achievements require preliminary        following example is based on a fictitious
                            specialist knowledge of the application area. In         application and is designed to illustrate the
                            order to be easily understood by the reader, the         procedure for creating a fuzzy rule base.



3.2 Presentation of the example
                            The example concerns a process for washing               v Save water
                            lettuce for the production of prepacked lettuce in       v Save chlorine.
                            the “fresh produce” counters of supermarkets.
                                                                                     The operators manually controlling the process
                            The lettuce is cut, washed and packed. The               usually inspect the dirty water at the end of the
                            purpose of washing is to remove earth from the           tunnel washing. If the water is clear, they deduce
                            lettuce as well as any micro-organisms which             by experience that the lettuce will have a
                            could proliferate during product shelf-life. The         “clean” appearance. The decision is thus made
                            manufacturer wishes to automate the washing              to install an optic “turbidity” sensor designed to
                            process.                                                 determine the degree of transparency of the
                            Washing is a continuous process. The lettuce             water.
                            leaves are placed in “drums” which move                  Moreover, operators use once an hour a report
                            through a “tunnel” fitted with nozzles spraying          based on analysis conducted in the factory which
                            chlorinated water. The water removes the earth,          gives the ratio of micro-organisms and residual
                            whereas the chlorine kills the micro-organisms           chlorine found in washed and prewashed lettuce
                            (see fig. 18 ).                                          at the end of the line.
                            The following priorities were formulated by the
                                                                                     The aim is therefore to use the above
                            marketing department and listed in the order of
                                                                                     information to improve control of:
                            their importance:
                                                                                     c lettuce conveyor belt speed (in order to
                            c With respect to the customer
                                                                                     increase production output),
                            v Guarantee quality
                                                                                     c the amount of chlorine sprayed,
                            - “Very clean” lettuce (appearance)
                            - No taste of chlorine.                                  c the amount of water sprayed.
                            v Guarantee safety                                       Limits are imposed:
                            - Acceptable level of micro-organisms                    c on conveyor belt speed, by the mechanism,
                            c With respect to profitability                          c on water flow to prevent damaging the lettuce
                            v Maximise production                                    leaves.



                                               Water flow                        Chlorine flow


                                                                                         Tunnel


                                 Drum
                                                                                                               Measurement off line of:
                                                                                                               - chlorine ratio
                                                                                                               - micro-organism ratio


                               Belt speed                                             Turbidity measurement
                                                                 Waste water
                                                                 after washing
                            Fig. 18 : lettuce washing process.




Cahier Technique Schneider n o 191 / pp.14
3.3. Linguistic variables and terms
                  The following variables will therefore be                    c   outputs:
                  chosen:                                                      v   modification of water flow: Water_f_var
                  c inputs:                                                    v   modification of chlorine flow: Cl_f_var
                  v micro-organism ratio: Micro_ratio                          v   modification of speed: Speed-var
                  v residual chlorine ratio: Cl_ratio                          A session with an experienced operator, a
                  v turbidity of water: Turbidity                              microbiology specialist and a lettuce “taster”
                  v conveyor belt speed: Speed                                 produces the following membership functions
                  v water flow: Water_f                                        (see fig. 19 ):



                  µ                                                                             µ
                                                                                   Negative         Positive    Positive
                      Acceptable                  High                                                          big

                                                                Cl_ratio                                                   Water_f_var
                  µ                                                                             µ
                                                                                   Negative         Positive    Positive
                      Low                         High                                                          big

                                                                Turbidity                                                  CI_f_var
                  µ                                                                             µ
                                     Acceptable                                    Negative         Positive
                      Low                                High
                                                                TMicro_ratio                                               Speed_var
                  µ

                      Not high                           High
                                                                Water_f
                  µ

                      Not high                           High
                                                                Speed

                  Fig. 19 : piece-wise linear membership functions.




3.4. Rules and outputs
                  Writing fuzzy rules                                          Speed_var IS Positive AND Cl_f_var IS Positive
                  A meeting with operators enables the seven                   AND Water_f_var IS Positive.
                  rules below to be determined, each                           c Lettuce tastes of chlorine, but there are no
                  corresponding to a specific case:                            micro-organisms
                  c Lettuce badly washed                                       IF Cl_ratio IS High AND Micro_ratio IS NOT High
                  IF Turbidity IS High AND Water_f IS NOT High                 THEN Cl_f_var IS Negative.
                  THEN Water_f_var IS Positive big.                            c Everything is fine and production is maximum:
                  c Lettuce badly washed but high conveyor belt                save water.
                  speed                                                        IF Speed IS High AND Cl_ratio IS Acceptable
                  IF Turbidity IS High AND Water_f IS High THEN                AND Turbidity IS Low THEN Water_f_var IS
                  Speed_var IS Negative.                                       Negative.
                  c Too many micro-organisms                                   c No micro-organisms: save chlorine
                  IF Micro_ratio IS High THEN Cl_f_var IS Positive             If Micro_ratio IS Low THEN Cl_f_var IS Negative.
                  big.
                  c Everything is fine and production can be                   Defuzzification
                  increased                                                    Insofar as the aim is progressive behaviour of
                  IF Turbidity IS Low and Micro_ratio IS NOT High              the rule base in all cases and an interpolation
                  AND Speed IS NOT High and CL_ratio IS                        between the rules, the centre of gravity is chosen
                  Acceptable AND Water_f IS NOT High THEN                      as the defuzzification operator.




                                                                                              Cahier Technique Schneider no 191 / pp.15
4 Implementation



4.1 When can fuzzy rule bases be used?
                            Fuzzy rule bases can be chosen to solve                   c the variables (inputs and outputs) can be
                            application problems when the following                   measured or observed, (measurability),
                            conditions are satisfied:                                 c qualitative expertise (if it is mathematical,
                                                                                      conventional automatic control should be
                            c it is possible to act on the process                    preferred),
                            (controllability),                                        c gradual expertise (if it is boolean, expert
                            c an expertise or knowhow exists,                         systems are more suitable).



4.2 Designing an application
                            Choice of operators                                       Methodology
                            In most applications, “Mamdani” rule bases are            Designing a fuzzy rule base is an interactive
                            used. This choice is suitable except if the               process. The largest portion of the task consists
                            expertise contains indeterminations.                      of collecting knowledge. One of the advantages
                                                                                      of fuzzy logic is the possibility of having the rule
                            In most cases, the choice is also made to use             base validated by the people who provided the
                            “trapezoidal” membership functions as they                expertise before testing it on a real system.
                            are easier to implement and simplify the                  Figure 20 illustrates the procedure used.
                            gathering of expertise. Output membership
                            functions are often singletons, except when rules         Collecting knowledge
                            are concatenated. A triangular output                     This is a three-step process:
                            membership function in fact implies an
                                                                                      c listing the variables to be taken into account:
                            uncertainty on the output to be applied, and does
                                                                                      they will become the linguistic variables of the
                            not have much effect on interpolation between
                                                                                      rule base;
                            the rules.
                                                                                      c listing the qualitative quantities to be taken into
                            Finally, defuzzification takes place using the            account and specifying when they are true and
                            “centre of gravity” for control (all active rules are     false: these quantities will become the linguistic
                            taken into account): the use of the “average of           terms of the rule base;
                            maxima” for decision-making problems enables              c formulate how these concepts are manipulated:
                            a decision to be made when rules are                      which cases should be considered, how they are
                            “conflicting” and avoids intermediate decisions.          characterised, how should you act in each case.


                            Professional expertise level:
                                                                Gathering
                            - Expert                            knowledge
                            - Operator
                            - Designer                                                    Validation of
                                                                                            principle

                                                                                                                    Validation of
                                                                                                                     operation


                            Programming level:
                                                                 Interpretation in form of rules
                            - Automatic control engineer           and membership functions
                            - Ladder / Grafcet
                                                                                                                   « Open loop »
                                                                                    Implementation                     tests

                            Fig. 20 : design methodology.




Cahier Technique Schneider n o 191 / pp.16
                  Transcription in fuzzy rule form is then straight      c if the process can be simulated, closed loop
                  forward. However as few membership functions           simulations can also be performed.
                  and rules as possible should be written in order
                  to limit the number of parameters which will have      Tuning
                  to be tuned later on and to ensure legibility of the   The rule bases written in this manner often give
                  base. We observe that it is easier to add rules in     satisfaction right away. However the rule base
                  order to take new situations into account than to      may need to be modified or tuned. The following
                  remove them.                                           principles will act as a guideline in searching for
                                                                         the probable cause of the deviation observed:
                  Validating the knowledge base
                                                                         c if the behaviour of the closed loop controller is
                  This takes place in a number of steps:                 the opposite to what you expected, some rules
                  c presentation of the rule base to the experts         have most likely been incorrectly written;
                  who helped collect knowledge, and discussion.          c if you wish to optimise performance, it is
                  The aim of the discussion is to identify points        normally preferable to properly tune the
                  that have not been covered and to ensure that          membership functions;
                  the rules are understood by everyone;                  c if the system is not robust and works in some
                  c “open loop” simulation: the experts compare          cases but not all the time, it is likely that not all
                  the behaviour of the rule base to the behaviour        cases have been taken into account and that
                  that they expect on cases chosen beforehand;           rules must be added.



4.3 Using an application
                  The function of the operators                          knowhow and to validate the resulting
                  The degree of involvement of operators                 behaviour.
                  controlling an application using fuzzy logic varies
                                                                         Production changes
                  considerably.
                                                                         During an application, the rule base must be able
                  The following cases can be observed:                   to be adapted to changes in the production
                  c completely autonomous system: the end-user           system and the products manufactured. These
                  is not familiar with fuzzy logic and is not aware of   changes can be of various kinds:
                  its use,                                               c objectives have changed (cooking
                  c fuzzy logic is a “black box” which can be            temperature, etc.), for example due to a change
                  disconnected or changed to “manual mode” by            in product manufactured. The setpoints or rule
                  the operator,                                          input membership functions must then be
                  c the operator is able to modify (tune) the            modified;
                  membership functions according to the situation,       c system dimensions have changed; the
                  and he does this for a production change (for          membership functions must then be modified;
                  example);
                                                                         c the type of system has changed (e.g. portage
                  c the operator is able to read the rules (e.g. their
                                                                         of the rule base from one machine to another);
                  degree of activation): he understands and is able
                                                                         the rules and membership functions must then
                  to interpret the actions of the rule base. For
                                                                         be modified.
                  example he can control the rule base in
                  exceptional situations;                                The most common changes are of the first type.
                  c the operator is the main designer of the base:       They can then be managed by qualified
                  he has been given the means to record his own          operators.



4.4 Choosing the implementation technology
                  Most of today’s applications run on standard           implementation of fuzzy rule bases without
                  hardware platforms (micro-controller, micro-           programming.
                  processor, programmable controller, micro-
                                                                         Fuzzy inferences can be directly programmed
                  computer, etc.).
                                                                         (assembler, C language, etc.). The disadvantage
                  Many software programs designed to help                of this solution is that it is slower in the prototype
                  develop fuzzy rule bases and aimed at micro-           phase and requires programming skills and
                  controllers, programmable controllers and micro-       command of fuzzy logic algorithms.
                  computers (to name but a few), enable rapid




                                                                                    Cahier Technique Schneider no 191 / pp.17
                            For applications with exacting response time                  now commonly integrated inside micro-
                            demands or in order to obtain very low mass                   controllers, even low cost ones, where they are
                            production cost prices, use of fuzzy logic ICs is             used to accelerate fuzzy inferences.
                            advantageous. Use of such electronic chips is
                                                                                          Figure 21 shows as an example the
                            increasing as:
                                                                                          applicational needs that can be encountered in
                            c the operations required to produce fuzzy                    number of rules (complexity of the application)
                            inferences are elementary and feasible in                     and cycle time (rapidity) as well as the possible
                            integers,                                                     technologies (1993 figures). The rules
                            c some operations can be carried out in parallel,             considered have one predicate and one
                            c the calculation takes place in successive                   conclusion.
                            steps, thereby enabling simple “pipeline”
                                                                                          The necessary technical-economic choice is
                            architectures to be made.
                                                                                          thus a compromise between the flexibility
                            In particular, numerous ASIC components                       provided by software solutions, scale economy
                            designed for specific markets exist (car,                     and the performance of dedicated hardware
                            electrical household appliances, etc.). They are              solutions.


                                             Cycle time (s)

                                             10-7

                                             10-6

                                             10-5
                                                          RISC
                                             10-4                   Image
                                                                    processing
                                                          32 bits
                                             10-3                   Control system, car
                                                 -2       16 bits
                                             10
                                                          8 bits                     Cameras
                                             10-1

                                             1            4 bits                     Control
                                                                      Washing
                                             10                       machines                     Financial analyses
                                                 2
                                             10                                                    Medical diagnosis
                                                 3
                                             10                                                                                   Number of
                                                                                                                                  rules
                                                      1             10                100               1 000            10 000

                                   Micro-programming technology                           ASIC technology                Analog technology
                            Fig. 21 : performance of components and application areas.




4.5 Standards
                            Components                                                    Today, a work group in which Schneider plays
                            Absence of standards is one of the main                       an active part, has incorporated the “fuzzy logic”
                            problems holding up the use of fuzzy logic chips.             language standard into the language standard of
                            This is because these components are not                      programmable controllers (first official draft of
                            compatible with one another as each one is the                standard IEC 61131-7 available in 1997). Other
                            result of choices made by manufacturers.                      initatives in the field of fuzzy logic
                                                                                          standardisation should spring from this.
                            Software
                            Regarding software, lack of portability has also
                            slowed down widespread use of fuzzy logic in
                            industry.




Cahier Technique Schneider n o 191 / pp.18
5 Fuzzy applications



5.1 Application types
                  Functions performed
                  The following table shows the functions most
                  often performed in industry by means of fuzzy
                                                                              Fuzzy              Theory of
                  systems (X means possible use, XX that the                   logic            possibilities
                                                                                                                  Probabilities
                  technique is suitable for this type of problem).
                  Rule bases excel in cases when interpolation
                  and action are required, whereas classification         Imprecision                               Uncertainty
                  methods are suitable for evaluation and                and graduality
                  diagnosis tasks normally performed upstream.
                  Applications sometimes combine several of
                  these functions, while retaining the graduality of
                  the information.                                                               Expertise
                                                                                                 Fuzzy rules
                                            Rule        Classification
                                            bases       algorithms
                  Regulation,               XX                                 Neuron                             Conventional
                  control                                                      network                          automatic control
                                                                                Data                                Model
                  Automatic                 XX
                  parameter
                  setting
                                                                         Fig. 22 : comparing fuzzy logic with other control
                  Decision-making help      XX          X                techniques.
                  Diagnosis                 X           XX
                  Quality                               XX
                  control                                                fuzzy logic may be preferred for the ease with
                                                                         which it is understood by operators.
                  Fuzzy logic and other techniques                       Hybridation of techniques
                  Fuzzy logic is above all an extension and a            Fuzzy logic is often used in combination with
                  generalisation of boolean logic. It enables            other techniques. These combinations are
                  graduality to be introduced into notions which         advantageous when each approach make use of
                  were previously either true or false.                  its own strong points.
                  Probabilities, without challenging the binary          c Learning fuzzy rules or neurofuzzy
                  nature of events (either true or false) enable the
                                                                         Fuzzy rule bases can be modified using learning
                  uncertainty of these events to be managed.
                                                                         methods.
                  On the boundary between these two                      The first methods known as “self-organizing
                  approaches, the theory of possibilities (invented      controller” were developed as early as 1974 and
                  by Lotfi Zadeh) enables both graduality and
                                                                         aimed at heuristically modifying the content of
                  uncertainty to be taken into account (see fig. 22 ).
                                                                         fuzzy rules belonging to a “rules table”. The
                  Fuzzy base rules are often compared for control/       actual expertise is modified by the learning, but
                  regulation applications to neuron networks and         the membership functions remain the same.
                  conventional automatic control. These three
                                                                         A second approach, consists of modifying
                  approaches require respectively, in order to be
                                                                         parameters representative of the membership
                  applied, an expertise, data for learning purposes,
                                                                         functions. Unlike the first method, the rules and
                  and a dynamic model of the process.
                                                                         structure of the expertise are not altered. The
                  These approaches can only be compared when             membership function parameters are modified
                  all three are available at the same time, which is     using optimisation methods, for example
                  often the case in theoretical studies but rare in      gradient methods, or global optimisation
                  practice. If all three are available, practical        methods such as genetic algorithms or simulated
                  considerations often take priority. In particular,     annealing. This approach is often referred to as




                                                                                       Cahier Technique Schneider no 191 / pp.19
                            “neurofuzzy”, in particular when the gradient is      c Using fuzzy logic in association with automatic
                            used. Use of the gradient to optimise these           control
                            parameters is likened to “retropropagation” used      A fuzzy rule base is sometimes part of a
                            in neuron networks known as “multi-layer              controller. Use of fuzzy logic to simulate a
                            perceptrons” in order to optimise weights             proportional term allows all kinds of non-
                            between neuron network layers.                        linearities. Specific cases of downgraded
                            A third approach (that can be qualified as            operation such as overloads, maintenance or
                            structural optimisation of the rule base) aims at     partial failures are easily integrated.
                            simultaneously determining rules and membership       A fuzzy rule base is used to greater advantage
                            functions by learning. The learning process then      outside the control loop, to supervise a
                            normally takes place without referring to an          controller. It then replaces an operator in order to
                            expertise. The resulting rules can then               tune controller parameters according to control
                            theoretically be used to help build an expertise.     system operating conditions.



5.2 Examples of industrial achievements
                            Today fuzzy logic is accepted as being one of         costs, air flow is kept to a minimum compatible
                            the methods commonly used to control industrial       with the biological process.
                            processes.                                            Added to these requirements is the consideration
                            Although PID controllers still suffice for most       of some specific operating cases, such as for
                            applications, fuzzy logic is increasingly             example a very high upstream flow, which is an
                            recognised and used for its differentiating           extreme circumstance under which parameters
                            advantages, particularly for controlling quality of   are seriously modified and sewage capacity
                            production and costs. Due to the competitive          affected.
                            advantages offered by fuzzy logic in some
                            applications, the integrator or end-user do not       Although partial mathematical models of plants
                            normally wish to mention the subject. These           are available, there are no complete models, and
                            applications benefit from extensive acquisition of    the overall control strategy must often be
                            knowhow or use of a crafty technical short-cut.       heuristically developed.
                            Confidentiality is then essential. This explains      Use of fuzzy logic is relatively common
                            why it was not possible to describe in a detailed     nowadays in sewage plants. The plant shown in
                            way all the examples given below.                     figure 23, based in Germany, has been in
                                                                                  operation since 1994. Fuzzy logic was produced
                            Sewage plant                                          on a Schneider Modicon programmable
                            Most modern sewage plants use biological              controller by means of its standard fuzzy control
                            processes (development of bacteria in ventilated      functional modules.
                            tanks) to purify sewage water before discharging      The designer highlights the advantage of using
                            it into the natural environment. The organic          fuzzy logic in control: exceptions, i.e. situations
                            matter contained in the waste water is used by        when sewage capacity is partially downgraded,
                            the bacteria to create its cellular components.       are treated simply and without discontinuity.
                            The bacteria discharges carbon dioxide (CO2)
                                                                                  The method chosen to introduce these
                            and nitrogen (N2). Air is blown into the tanks.
                                                                                  exceptional states into a control loop is
                            The energy used for ventilation purposes
                                                                                  described below:
                            frequently accounts for more than half the global
                            energy consumed by the plant. In order to             A proportional term which must adapt to the
                            ensure correct development of bacteria and            exceptional circumstances is identified in the
                            sewage, the NH4 and O2 concentrations in the          control loop: this term is first transcribed in fuzzy
                            ventilation tanks must be carefully controlled, all   logic, then this fuzzy logic element is inserted in
                            the more so since in order to reduce energy           the control loop.




Cahier Technique Schneider n o 191 / pp.20
                                    Precipitant tanks
                                    for phosphates                                    Control station and
          Blower
                                                                                      operating building
                                                    Recirculation

                                                                                                             Grid building

                   10                                   11


                                                                                                 4      3              2     1


 7                                                                   6            5



                                                                                           1 - Sewage water supply
                                                                                           2 - Inlet mechanism lifting
                                                                                           3 - Ventilated sediment removal
                                                                                               basin
                                                                                           4 - Venturi drain
                                                                                           5 - Excess sludge
                                                8            7                             6 - Recycled sludge
  9                                                                                        7 - Sludge scraper
                                                                                           8 - Final purification I
                                                                                           9 - Final purification II
Outlet                                                                                    10 - Nitrification channels
                                                                                          11 - Denitrification basin
Fig. 23 : block diagram of the sewage plant.


Once the membership functions have been                          IF average input THEN average output
suitably tuned, two rules are sufficient to                      (see fig. 24 ).
describe the proportional controller:
                                                                 Once the proportional term has been simulated,
IF low input THEN low output.                                    the exceptions are introduced in the form of
IF high input THEN high output.                                  other rules depending on other input variable
A third rule is added at the operators’ request as               combinations.
they find it improves their understanding of the                 A simple example of this possibility is illustrated
operation:                                                       in figure 25 .


      µ
                                                                                       Controlled output z
          Low           Average        High                         Area corresponding to the                Exception
          input         input          input                        proportional controller                  influencing area




      µ
          Low           Average        High
          output         output        output


                                                                    Input
                                                                    variable x
                                                                                                                 Exception y

Fig. 24 : simulating a controller proportional term.             Fig. 25 : introducing an exception into a proportional term.




                                                                                 Cahier Technique Schneider no 191 / pp.21
                            The table in figure 26 lists the rules for                input variables “nitri O2 content” and “denitri O2
                            recirculation. The proportional term is created           content” define an exceptional situation in the
                            from the input variable “NOx content”. The two            first rule.


                            IF nitro O2 content           AND denitri O2 content    AND NOx content         THEN recirculation quantity

                            Not low                       Greater than 0                                    Low
                                                                                    Low                     Low
                                                                                    Normal                  Normal
                                                                                    High                    High

                            Fig. 26 : recirculation function rules table.


                            Below is another treatment using fuzzy logic: part        The exceptional condition is detected by the
                            of the sludge deposited in the downstream basin           strong turbidity, as sludge deposits minimum
                            is recycled and re-injected upstream. The table in        sediment due to the excessively high flow.
                            figure 27 lists the rules for sludge recycling. The
                                                                                      For information, other installation functions use
                            first rule expresses an exception due to an
                                                                                      fuzzy logic:
                            excessively high upstream flow. In these
                            conditions, a high degree of recycling would              c air injection,
                            result in increased overload of the installation.         c management of excess sludge.



                            IF turbity                    AND drained off quantity AND sludge level         THEN quantity
                            of discharged water           of recycled sludge

                            High                                                    Low                     Low
                                                          Normal                    Low                     Low
                                                          High                      Low                     Normal
                                                          Low                       Normal                  High
                                                          Normal                    Normal                  Normal
                                                          High                      Normal                  High
                                                          Low                       High                    Normal
                                                          Normal                    High                    High

                            Fig. 27 : sludge recycling function rules table.


                            Food produce                                              The chosen example is an aperitive biscuit
                            Automation of industrial oven production lines            production line.
                            used for cooking biscuits interests biscuit               A French group contacted Schneider who then,
                            manufacturers both in France and Germany. For             in co-operation with ENSIA (French Higher
                            this control type, a conventional solution is not         Institute of Agricultural and Food Industries)
                            satisfactory due to the non-linearities, multiplicity     worked out an automated solution.
                            and heterogeneity of sensitive parameters.
                            Modelling of the cooking process is both                  The main characteristics that can be measured
                            complex and uncomplete. However, experienced              in a biscuit are its colour, humidity and
                            operators are perfectly able to control cooking           dimensions. These characteristics can be
                            using their empirical knowledge.                          affected by variations in quality of pastry




Cahier Technique Schneider n o 191 / pp.22
ingredients, environmental conditions and the               c Subjective evaluation
time the biscuit remains in the oven... These               Most quality defining notions depend on a
influences must be compensated by oven setting              number of variables. One of the factors for
and conveyor belt speed. Control of production              evaluating quality is colour which is three-
quality of this kind of food process can be broken          dimensional: hence the interest of defining
down into the following functional steps:                   membership functions upon several variables.
c conditioning and merging of data,                         Classification algorithms, based on the input
c evaluation of subjective quantities (linked to            variables perform a gradual evaluation of such
quality),                                                   qualitative variables (top of biscuit well cooked,
c diagnosis of quality deviations,                          over cooked,...).
c decision-making,                                          c Diagnosis
c subjective evaluation                                     The fuzzy ladder was used to diagnose quality
Fuzzy logic enables qualitative variables to be             deviations observed on biscuits (see fig. 29 ).
taken into consideration and existing                       The oven has 3 sections.
“professional” expertise to be used. Fuzzy rule             The overall operating evaluation is satisfactory.
bases have been used associated with other
techniques (see. fig. 28 ).                                 Other examples
                                                            c Automation systems
                                                            G.P.C.s (Global Predictive Controllers) are
Functions                  Associated techniques            extremely effective, but require the setting of 4
                                                            parameters: N1, N2, Nu, l (2 control horizons,
Sensor melting                                              prediction horizon, weighting factor). Such
Subjective evaluation      Fuzzy classification             setting is both lengthy and difficult and normally
Diagnosis                  Fuzzy ladder                     requires an expert. Schneider’s NUM subsidiary
                                                            is currently developing numerical controls and
Decision making            Fuzzy rule bases
                                                            would like to use G.P.C.s in future productions.
Fig. 28 : functions and associated techniques.




        High biscuit                 Bottom of biscuit       Top of biscuit          Section 1
        humidity                     well cooked             well cooked             temperature too low




                                     Bottom of biscuit       Top of biscuit
                                     a little over cooked    a little over cooked




                                     Bottom of biscuit       Top of biscuit
                                     far too cooked          far too cooked




                                     Bottom of biscuit       Top of biscuit
                                     undercooked             undercooked
Fig. 29 : fuzzy ladder for quality deviation diagnosis.




                                                                        Cahier Technique Schneider no 191 / pp.23
                            Schneider has thus developed for NUM a                  the Danish company, F.L. Smidth Automation, to
                            method for automatically setting the parameters         control cement kilns. This process takes many
                            for such controllers by means of fuzzy rule             variables into account, and in particular the
                            bases. Some twenty rules suffice for rapid,             climatic influences on the kiln which is several
                            reliable parameter setting. Moreover, the               dozen metres high.
                            presence of a monitoring and control specialist,
                            hard to find in numerical control installations, is     c General public electrical and electronic
                            no longer necessary.                                    household appliances
                                                                                    A large number of applications are now available
                            c Car industry                                          to the general public, especially in Japan. For
                            Renault and Peugeot (PSA) have announced an             example, compact size digital camcorders are
                            automatic gear box which uses fuzzy logic to            highly sensitive to movement. Fuzzy logic
                            adapt to the type of driving of the person behind       controls the stadyshop image stabilization of
                            the wheel.                                              these devices.
                            c Cement plants
                            The first industrial application of fuzzy logic, then
                            copied by other manufacturers, was produced by




6 Conclusion


                            c Classed as an artificial intelligence technique,      (see fig. 30 ), and offer simple evaluation
                            fuzzy logic is used to model and replace process        possibilities.
                            control expertise and designer/operator expertise.
                                                                                    c Evaluation limited to competition with the other
                            c A tool for enhancing quality and increasing           conventional control tools is not productive as
                            productivity, fuzzy logic offers competitive            such tools (e.g. PID controllers) continue to be
                            advantages to industrial firms seeking technical-       useful in most application areas.
                            economic optimisation.
                                                                                    c Fuzzy logic has its own special areas in which
                            c This Cahier Technique specifies the areas in          it works wonders: these are areas involving
                            which this interesting approach can be used to          expertise, nuanced decision-making,
                            advantage.                                              consideration of non-linear phenomena and
                                                                                    subjective parameters, not to mention
                            c Thanks to suitable programmable controllers
                                                                                    contradictory decision-making factors. Contact
                            and user-friendly tools, fuzzy logic is now
                                                                                    with Schneider specialists will enable users and
                            accessible to all automatic control engineers
                                                                                    designers to find a suitable answer to their
                            wishing to increase the scope of their skills and
                                                                                    perfectly understandable question:
                            the performance of their achievements. These
                            tools are available in the development                  “What decisive advantages can fuzzy logic offer
                            environment of some programmable controllers            me in my application?”.




Cahier Technique Schneider n o 191 / pp.24
a - configuration of the fuzzy logic module                                c - writing of rules




b - definition of membership functions                                     d - simulation - validation




Fig. 30 : for fuzzy logic, the Schneider programmable controllers are equipped with user-friendly development tools on PC.




                                                                                                         Cahier Technique Schneider no 191 / pp.25
Appendix


                            Operators between fuzzy sets
                            The table in figure 31 shows the ZADEH operators.



                                                                             ZADEH              Logic
                                                                             operator          operation

                                                      A∩B
                                                 A               B
                                                                                                                     µA             µB

                            Intersection                              µA∩B = MIN (µA, µB)         AND


                                                                                                                            µA∩B

                                                      A∪B
                                                 A               B
                                                                                                                     µA             µB
                            Union                                     µA∪B = MAX (µA, µB)          OR



                                                                                                                            µA∪B
                                             _
                                             A
                                                                                                                     µA             µA
                                                                                                                                     _

                            Negation                   A              µA
                                                                       _
                                                                           = 1 - µA               NOT
                                                           A




                            Fig. 31 : operators between fuzzy sets.


                            Singleton output membership functions                         µ

                            “Singleton” membership functions are often                1
                            used as output membership functions for fuzzy                        Low
                            rules.
                            This is because they allow the same                                                  Average
                            interpolation effect between rules as for
                            triangular membership functions (for example)                                                    High
                            for far simpler calculations. There is no need to
                            calculate the maximum of output membership                                                               Output
                            functions (aggregation), and the centre of gravity                          Action
                            is also simplified. Figure 32 illustrates this            Fig. 32 : defuzzification of singleton membership
                            calculation.                                              functions.




Cahier Technique Schneider n o 191 / pp.26
Fuzzy inferences: fuzzy implication and
Generalised Modus Ponens                                                         Rules (implications)
As shown in figure 33 , the conventional forward
inference mechanism “from the front” or “modus
ponens” consists of using rules, also known as           Facts
implications, and a deduction mechanism (the             observed                    Modus Ponens            Conclusions
modus ponens) to deduce conclusions from
observed facts.                                          Fig. 33 : principle of inference from the front.
The implication “A ⇒ B” is considered to be true
as long as it is not invalidated (A true and                                 A                                   A'
B false): see figure 34 . With knowledge whether
the implication is true or false, the modus ponens           A⇒B         0       1                       B' 0     1
enables a conclusion B’ to be deduced from an                       0    1       0                       0   0    0
                                                               B                             A⇒B
observation A’.                                                     1    1       1                       1   0    1
The same theoretical principle can be
                                                                   Implication                    Modus Ponens
generalised in fuzzy logic. The general diagram
is given in figure 35 .
                                                         Fig. 34 : principle of implication and Modus Ponens.


                                           Rules (fuzzy implications)




Inputs              Fuzzification          Generalised Modus Ponens                    Defuzzification                Outputs

Fig. 35 : principle of fuzzy inferences.


The mechanism generalising the implication is            The Lukeziewicz operator behaves like the
known as the “fuzzy implication”. There are              conventional implication when we limit ourselves
several fuzzy implication operators, including           to boolean values. This is not the case for the
those mentioned below:                                   Larsen and Mamdani operators used in the
MAMDANI: µA ⇒B = MIN (µA, µB)                            Mamdani rule bases. These operators are the
LARSEN: µA ⇒B = µA . µB                                  most extensively used as:
LUKASIEWICZ: µA ⇒B = MIN (1,1 - µA + µB )                c they offer a high degree of robustness in
The fuzzy implication works like a conventional          applications.
implication, where A and B are fuzzy sets.               c calculations are considerably simplified and
The mechanism generalising the modus ponens              allow simple graphic interpretation (see section
is known as the “generalised modus ponens”. It           2.4.). Calculations on input x and output y are
obeys the following formula, and is used to              decoupled, as the formula below shows:
determine a B’ conclusion fuzzy set. In most             µB’(y) = MAXx (Min (µA’ (x), µA(x), µB(y)) )
cases the operator T used is the Minimum
(known as the Zadeh operator).                                  = Min (µB(y), MAXx (Min (µA’(x), µA(x)) )
µB’ (y) = MAXx (T(µA’(x), µA⇒B (x,y)) )
where T: modus ponens operator (t - standard),




                                                                        Cahier Technique Schneider no 191 / pp.27
Bibliography



                            Standards
                            IEC 61131-7: Programmable Controllers part 7
                            Fuzzy Control Programming.

                            Miscellaneous works
                            c Fuzzy models for pattern recognition.
                            IEEE Press, 1992.
                            James C. BEZDEK & Sanker K. PAL.
                            c Fuzzy sets and systems: Theory and
                            applications.
                            Academic Press 1980, Mathematics in Sciences
                            and Engineering vol. 144.
                            D. DUBOIS, H. PRADE.
                            c Evaluation subjective ; méthodes, applications
                            et enjeux.
                            Les cahiers des clubs CRIN, club CRIN logique
                            floue.
                            c A.I. and expert system myths, legends and
                            facts.
                            IEEE Expert 02/90, pp 8-20, 29 réf.
                            M.S. FOX.
                            c La logique floue et ses applications.
                            Addison-Wesley, 1995.
                            Bernadette BOUCHON-MEUNIER.

                            Internet
                            c http://www-isis.ecs.soton.ac.uk/research/nfinfo/
                            fuzzy.html
                            c http://www.ortech-engr.com/fuzzy/
                            reservoir.html
                            c http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/
                            project/ai-repository/ai/areas/fuzzy/0.html




Cahier Technique Schneider n o 191 / pp.28
                                                                                                  © 1998 Schneider




Schneider   Direction Scientifique et Technique,   Edition: Schneider
            Service Communication Technique        Real: AXESS - Saint-Péray (07).
            F-38050 Grenoble cedex 9               Printing: CLERC-Fontaine-France-1000
            Télécopie : (33) 04 76 57 98 60        -100FF-

007431                                                                                    12-98

				
DOCUMENT INFO