Copyright ~ IFAC Intelligent Components and Instruments for Control Applications, Annecy, France, 1997
A NEW WAY TO REPRESENT GRAPHICALLY FUZZY LOGIC EQUATIONS: FUZZY LADDER N. Perroti , F. Guelyl, G. Trystram i
I Ecole
Nationale des Industries Agricoles et Alimentaires (ENSIA). Food Engineering Department, Institut National de Recherche Agronomique. I avenue des Olympiades, 9/305 Massy cedex, France. fax: 33 I 699351 85; Phone: 33 J 69935069; Email:
[email protected]·fr 2Schneider Electric (DR), 33 bis avenue du Mal Jofjre, 92002 Nanterre cedex, France.
Abstract: Different graphical representation methods are used to expressed logic Boolean equations. A well known method, inspired from electrical schematics, is the ladder diagrams method. It is the most widely used language for progranunable controllers. We propose to extend the notion of ladder to the theory of fuzzy sets and more especially to fuzzy logic equations. Thus we introduce the fuzzy ladder diagrams method that provide an attractive way to represent graphically fuzzy logic equations. Examples of application of fuzzy ladder to fuzzy diagnosis and fuzzy multidimensional membership function are presented. Keywords: fuzzy logic, ladder diagrams, graphic, diagnosis, membership functions
INTRODUCTION
1. FUZZY LADDER
We propose to introduce Fuzzy Ladder Diagrams, a generalization of ladder diagrams, a well-known graphical representation method of sequences of Boolean equations inspired from electrical schematics. Ladder diagrams are currently the most widely used language for progranunable controllers. That is due to essentially two reasons:
Ladder diagrams (international standard: lEC 11313) (Bouteille, et al. , 1987) stem from an analogy between a flow of information and a flow of electricity. This analogy seems to be rather straightforward, as electricity is widely used to carry information. but has shown its usefulness through the years. They are intended to look like electrical diagrams. The principle of these diagrams is that virtual electricity is flowing from the left to the right hand side of the diagram. Virtual electricity is used to represent a Boolean state. We propose the extension of ladder diagrams to variables assuming fuzzy states in the [0,1] interval (Guely, 1995). A variable A will have a state (or truth value) J.L A E [0,1]. Such diagrams will be called Fuzzy Ladder Diagrams. Fuzzy Ladder diagrams are constituted of the following logical elements: fuzzy relays wires and coils.
- Ladder diagrams are inspired from electrical logic diagrams, and thus gained quick acceptance from users familiar with relay based logic cabling. - Ladder is a graphic representation and thus more convenient to handle for users than lists of logical Boolean equations. Ladder diagrams are built out of several simple elements (relays, coils, wire). Here we propose to extend this notion in order to be able to represent fuzzy logic equations. In this paper we will first introduce Fuzzy Ladder, and second give two examples of application of this concept.
161
1.1 Fuzzy relays.
-----It:
Relays of a classical ladder enable virtual electricity to flow or not to flow, according to the state (Jl) of a Boolean variable that is associated to them. This variable can be an input, an output or an internal variable of the system, so that the relay can refer to an internal or an external state. Figure 1 shows a relay associated with a given Boolean variable A. If the state of A (Jl.J is equal to 0, the relay is open and virtual electricity can not flow. On the contrary, if !lA is equal to 1, the relay is closed and virtual electricity flows.
J--- - '
B
Fig. 4. Parallel connection of two wires.
1.3. Fuzzy coils Fuzzy relays and wires enable to define any logical combination of existing fuzzy variables (taking values in the range [0,1]). The result of a combination can be stored (Le. assigned) to internal or output variables through coils. Coils are located at the right hand side of the diagram. Figure 5 is equivalent to the following logical equation (eq. I) :
flow of "virtual electricity"
---ill-I-A
(1)
D = «NOT A) AND B) OR C
Fig. 1. Relay of a ladder diagram We propose an extension of this notion that we will call: fuzzy logical relays (FLR). In this case the variable A assuming fuzzy states in the [0,1] interval (Zadeh, 1965; Dubois and Prade, 1980). According to the electrical analogy, the state !lA of
Fig. 5. Ladder diagram of D ORe.
a fuzzy variable A associated to a fuzzy relay can be interpreted as the degree of opening of the relay. The fuzzy relay is an analogic device allowing electricity to flow progressively. "Chaining" two relays enables to perform a fuzzy logical "AND" operation (fig. 2), where electricity flows at the right hand side of the diagram according to the state of CA AND B) .
----!I I A
= «NOT A) AND B)
Fuzzy ladder diagrams are read from the upper part to the lower part. Variables assigned through coils can be used in subsequent relays. Figure 6 means that the following two fuzzy logical equations are executed sequentially (eq. 2): E=AANDB F = (NOT C) OR D
(2)
I 1-1- B
Fig. 2. Chaining of two relays
o
"Negative relays" refer to the opposite of the state of the variable they are referring to (fig. 3). "Negative relays" therefore stand for the fuzzy logical "NOT" operator.
Fig. 6. A ladder diagram representation of two logical equations: 11 E=A AND B; 21 F=(NOT C)ORD
----II/1r----
For example here if we use the classical operators introduced by Zadeh (1965) that are defined as follows (eq. 3):
A
Fig. 3. Negative relay
!lA AND B = MINIMUM ( !lA, !lB) 1.2. Fuzzy wires
(3)
!lA OR B = MAXIMUM ( !lA, JlB) JlNOT A = 1 - JlA
Wires enable virtual electricity to flow from the left hand side to the right hand side of the diagram. A vertical wire at the left of the diagram stands for a given potential, thus is a source of potential. A vertical wire at the right hand side of the diagram stands for a mass, thus enabling virtual electricity to "flow" out of the diagram. Parallel connection of two wires enables to perform a fuzzy logical "OR" operation (fig . 4), where electricity flows at the right hand side of the diagram according to the state of (A OR B).
J.l A =0.4, J.l B =0.6, J.l c =0, J.l D =0.8, have at the end of the diagram: J.l E =0.4 ,
For a given then we
=
J.l F 1. The final result of the calculus of a ladder diagram is equivalent to the result of a corresponding logical table . Therefore ladder diagrams fundamentally differ from electrical
162
methods, like the method of the fuzzy k-nearest neighbors (Keller, et al., 1985).
diagrams : they are a graphic way of representing sequences of logical equations.
We propose to build multi-dimensional membership functions using Fuzzy Ladder. Fuzzy Ladder can be used to represent a combination of usual onedimension membership functions through logical equations. If there is an existing expert knowledge of this logic combination, this method has the advantage of being completely graphic (onedimension membership functions can be drawn easily, and Fuzzy Ladder is graphic), though easy to understand. Let us take as a simplified example the case of membership functions evaluating the degree of comfort of a person in a room with a given temperature and humidity.
2. APPLICA nONS Fuzzy ladder can be applied to represent human knowledge expressed as a fuzzy logical combinatory problem. Several purposes can be involved as for example diagnosis or building explicit . multidimensional membership functions. The following examples explain such applications in a simple way. Concerning the example of diagnosis, this concept was effectively used in an application of quality feed-back control of a continuous baking process. More precisely fuzzy ladder was used to represent a combinatory expertise indicating a state of the process upon the different sensory labels of the global quality of biscuits. The information expressed in this form was a kind of high level sensory information including process technology. Such a representation has improved significantly the global understanding of this complex process (Perrot, 1994).
r
bw
XX --
I
70
50
~ ~('Xo»)
90
a bw
middle
2.1. Multidimensional Membership Function A field of application for Fuzzy Ladder is membership functions taking into account several variables (i.e. multidimensional membership functions) (Perrot, et al., 1996). Let X be a set. A fuzzy subset A is defined on X as (eq. 4):
A = {(x, J.1 A(x»),x
E
X}
Fig. 7: Fuzzy membership function of the variable humidity (a) and temperature (b). Application of fuzzy ladder to multidimensional membership functions . Resorting to expert knowledge, we might obtain the membership functions given in figure 7 and the fuzzy ladder given in figure 8 representing a fusion of two variables in a sensory way and as a result a multidimensional membership function of the variable: comfort.
(4)
X ~ [0,1]
J.1 A: {
x ~
J.1A (x)
J.1 A
is called membership function of the fuzzy set A. If X = R (mono-dimensional case) membership functions are often defined as piecewise-linear. Piecewise-linear membership functions are the most commonly used type of membership functions, as they are simple and are easy to determine from experts or operators.
humidity bw
I
......aoy-
I humidity high humodiIyhigh
I
hlomOdity _
......aoylow
I hl.ll'lidily_
If X = R3, representing for instance the RGB (Red, Green, Blue) three-dimensional color space, it would be convenient to be able to define a new color, say "pink" with a membership function (eq. 5): !!pink: R 3 ~ [0,1] (5)
Fig.
r, g, b I~ !!pink(r, g, b)
,_togh
'"
co-.."':'good
I
,-"'""'I
lemp«atl.n low
,."",o.aoftlow
,....,
_"':'I'd
I
'-high '~high I
.0-
_:coId
,_turolow
8: Example of a fuzzy ladder of a multidimensional membership function of the notion of comfort of a person in a room.
2.2. Diagnosis Diagnosis knowledge can often be expressed as a combinatory expertise. In the following example (Perrot, 1994), such knowledge is used to diagnose the cause of quality defects observed on biscuits cooked in a tunnel type oven. The result of this
Unfortunately, it is difficult to build such threedimensional membership functions. Among the existing methods to do it, we can mention direct implicit methods as triangulation methods (Benoit and Foulioy, 1993) and gradual classification 163
CONCLUSION
diagnosis is then used to modify the control of the temperature and the humidity in the oven. Let us assume that we are able to evaluate truth degrees for the following statements concerning the humidity and the color of the biscuits coming out of the oven : humidity low, humidity middle, humidity high, color light, color middle, color dark. If the notion is defined on one variable, it is possible to obtain these degrees of truth through membership functions. The truth degrees for the color can be obtained through fuzzy classification methods (Perrot, et aI. , 1996).
Fuzzy Ladder can be a convenient tool for a variety of applications. It is a graphical and thus easy to handle way to build diagnosis methods and gradual evaluation methods, when an expert knowledge is available. It can also be used to graphically represent the premises of fuzzy rules used in fuzzy rule bases.
REFERENCES
Let us assume that the defects in the biscuits come from the fact that the oven is too humid, too hot or too cold, and that we want to implement the following fuzzy logical equations, obtained through the oven's operators' knowledge:
-
Benoit, E., L. Foulloy (1993). "Exemple de Capteur SymboJique FIou en Reconnaissance des Couleurs", Revue Generate d'Electricite, 3, 22-27. BouteiIIe, D ., N . Bouteille, S. Chantreuil, R. Collot, I.P. Frachet, H. Le Gras, C. Meriaud , I . Selosse & A. Sfar (1987). "Les automatismes programmables" CEPADUES Editions. Dubois, D. , H. Prade (1980) . "Fuzzy Sets and Systems, Theory and Applications", Academic Press. Guely, F. (1995) "Automate de logique floue pour I'agroalimentaire", Schneider Electric, internal report. Keller, I. , M . Gray, J. Givens (1985) "A fuzzy kIEEE nearest neighbor algorithm" ,
=
humidity strong AND ( color oven too humid middle OR color light)
=(
oven too hot humidity middle OR humidity low ) AND color dark
=(
humidity middle OR humidity oven too cold low) AND color light Figure 9 represents the equivalent Fuzzy Ladder, easier to understand than the textual expressions.
I ~~rmiddle
humidity Slrang
Transactions on Systems, Cybernetics,1S (4),580-85.
oven too humid
~iddle
I coIor dar1<
oven loo hol
coIor tighl
oven loo a>ld
humidity low humidity
~ddle
humidity low
Fig. 9: Fuzzy ladder of the quality defects observed on biscuits cooked in an industrial tunnel type oven. Let us chose Zadeh AND and OR operators, and assume that we know that: J..lhumidity low = 0, J..lhumidity middle = O. I , J..l humidity strong J..lcolor light 0.5.
=0.9.
=0, J..lcolor middle =0.5 , J..lcolor dark =
The result is obtained as follows : J..loven too humid 0.5
= MIN ( 0.9, MAX ( 0.5 , 0 )) =
J..loven too hot = MIN ( MAX ( O. I , 0), 0.5 ) = O. I J..loven too cold
and
Perrot, N . (1994) "Applications de la logique floue aux fours de cuisson en biscuiterie", master thesis, ENSIA-Massy (France). Perrot, N., G. Trystram, D. Le Guenec, F. Guely (1996) "Sensor fusion for real time quality of biscuit during baking. evaluation Comparison between bayesian and fuzzy approaches" . Journal of Food Engineering , 29, 301 -315 . Zadeh, L. A. (1965 ) "Fuzzy Sets" , Information and Control, 8,. 338-353 .
c:oIor Ughl humidity
Man
=MIN ( MAX ( 0.1 , 0), 0 ) =0
164