ADAPTIVE TUNING OF FUZZY LOGIC CONTROLLERS
E. K. JUUSO, J. MYLLYNEVA and K. LEIVISKA
Univer.~ty
of 011.111., Department of ProcelJlJ Engineering, Control Engineering Laboratory
Linnanmaa, 90570 Oulu, Finland
Abstract. A Linguistic Equation Framework developed for adaptive expert systems provides a
flexible enviro nment for tuning fuzzy logic controllers. Simulation results, expert knowledge and
process experiments can be combined in the development procedure. Controllers represented by
compact matrix equations are easi ly combined with corresponding linguistic process models. The
controllers are tuned by adjusting the meanings of the linguistic variab les to different working areas.
The results are used in real control practice by transferring them to automation systems, or to a
fuzzy logic controller FuzzyCon where the rules and the membership functions can be changed online. FuzzyCon is connected to processes with a data acquisition card , and the data is transferred
throug h DOE-links .
Key Words. Adaptive systems; fuzzy systems; process control; expert systems : process models :
simulation: nonlinear systems; knowledge engineering
1. I:'-l"TRODUCTION
lating the models and in defining the estimates of
some membership functions. Operator's control
actions are used together with fuzzy and linguistic models in tuning the system.
The theory of fuzzy logic provides a method for
con\"erting the control knowledge of an operator into a control strategy. Usually, a fuzzy
logic controller models the operator rat.her than
the process. This is a quite useful procedure
if t here really is a lack of a well-posed mathematical model, or if the process is highly nonlinear and sensitive in the operation region. The
method also prO\ides an intuitively appealing
form of rules which arc more readily customizable in nat.urallanguage terms than conventional
cont rollers.
2. LINGUISTIC Sn.lULATIO:'-J
Rule-based programming is commonly used III
the development of expert systems. However ,
this paradigm leads to serious problems in practical applications. Maintaining massive rulebased systems is practically impossible. Actually, it is not even possible to reliably test the
system in the first place. Therefore , linking the
rule-based systems to more efficient modelling
methods is essential for practical systems.
However, there are also serious problems in designing a fuzzy logic controller. Acquiring the
knowll'dge from the human operator is a tedious
and time-consuming task at least if the ruleb<1.'ied procedure is used. Also a trial-and-error
h<1.<;ed tuning is non-trivial and time consuming,
and therefore, far from acceptable. The optimality and stability of the FLC is also hard to
prow . Especially for more complicated applications, the designing procedure of FLC must be
improved. Actually, it is better to use FLC together with conventional control systems.
2.1 . Linguistic rules
The linguistic simulation was originally ba..<;ed on
linguistic rules,
n
M
if
Z; then Y'
(1)
j=l
where Z· and Y' are linguistic vectors, and there
was a clear distinction between input and output variables (Juuso and Leiviska., 1990) . In
the present tuning system, the linguistic rules
used in previous systems are replaced by linguistic relations and linguistic equations (Juuso and
Leiviska, 1991). In order to get flexibility, the
rules are usually used in final applications.
In this paper, the emphasis is laid on the methods which could be useful in combining existing
simulation models and new ideas of describing
qualitative models for t.he development of combined control system . Expert's experience and
control engineering knowledge is used in formu-
82
Linguistic Equations Procedure
I
Interaction Matrix
I I
Fuzzy Constraints
Matrix Equation
I
Rule-based
knowledge
I
I
.! Rules
1Relations
Tuning
I
Simulation
I I
Expert Knowledge
I
IProcess Experiments I
1Membership Functions
Relations
Rule.s
Adaptive Expert System
I
Application
I
Figure 1: Development of adaptive expert systems.
2.2. Linguistic relations
The linguistic process model is described by
groups of linguistic relations: each group can be
ba.<;ed on a single fuzzy model, or several fuzzy
equations can be aggregated into a single group
of linguistic relations (Juuso and Leiviskii., 1991).
The variables of the relations are chosen in such
a way that the directions of the changes are balanced, e.g. the change-of-control output, flu,
de('fea.<;es with increasing error, e, and increasing change-of-error, fle.
E
r
r
o
PB
§]~
PS
§J §] ~
ZO
§]~
NS
~§J]
KB
§] §] §] §] §]
r
A fuzzy PI controller is usually represented
by relations control(x,y,z) where x, y and
z are the linguistic values for the error, e,
the change-of-error, fle, and the change-ofcontrol output, flu, respectively. Each relation describes which linguistic values belong togt'ther, e.g. control(normal, normal, normal),
control (negative_small, positive_small, normal).
The complete set shown in Fig. 2 consists of
25 linguistic relations if each variable has five
linguistic values: negative_big, negative_small,
zero, positire_small, positive_big. Also finer
partit ions are used for control purposes.
NB
NS
§] §]
ZO
PS
PB
Derivative fle
Figure 2: The rule base of a Fuzzy PI Controller.
guistic values depends on the working point of
the process. This presentation is ea.<;ily generalized for finer fuzzy partitions and transferred
between the programming systems (Juuso and
Leiviskii., 1993).
A set of linguistic relations can be changed into
a compact equation
2.3. Lmguzstic Equations
m
2:
A Linguistic Equation approach developed for
expert systems provides a flexible environment
for combining expertise. The knowledge base
of the expert system is represented by linguistic relations which can be changed into matrix
equations. The reasoning is based on these equations or on the aggregated sets of linguistic relations obtained by solving the equations. The
system is adaptive since the meaning of the lin-
AijXj
= 0,
(2)
j=l
where Xj is a linguistic level for the variable j,
j = l...m, i.e. the linguistic values veryJow,
low, normal, high, and very_high are replaced
by numbers -2, -1, 0, 1 and 2. The direction
of the interaction is represented by coefficients
Aij E {-1,0, I}. If an interaction is not present,
Aij
83
= O.
3.
2
1
E
r
r
0
0
r
-1
-2
00000
00000
00000
00000
08]8]00
-2
-1
1
0
Derivative
CO~TRLE
TU~I:"JG
Membership functions are tuned by simulation
experiments with multilayer szmulatzon systems.
The simulation system can also be (partly) replaced by experts or by experiments with real
systems (Fig. 1). Both analytical and IH'uristic
knowledge can be used simultaneously. As many
rules as possible are replaced by linguistic relations. However, some of them are needed , alid
the system provides a flexible environment for
combining these rules with more efficient modelling methods. In the linguistic equation approach, the relations are developed gradually:
only a small part of the problem is taken into
account at a time.
2
~e
Figure 3: The rule base of a Fuzzy PI Controller
in the matrix form.
3.1 Controller Rules
In the general case, a set of fuzzy inference
rules is represented by a single linguistic equation (Juuso, 1993a)
Fuzzy PI Controller. The rule base shown in
Fig. 2 can be represented in a matrix form if the
linguistic values, negativcbig, negative_small,
zero, positivcsmall, positivcbig, are replaced
by numbers -2, -I, 0, 1 and 2 (Fig. 3). All
these rules can be obtained from a single linguistic equation
~u
=
e+
~e,
m
U
where u is a control action, alHi Xj a linguistic
level for the variable j obtained hy the mea<;urements. is also applicable on more detailed fuzzy
partitIOns. This procedure produces always a
rule set which is complete, consistent. alld continuous. If a noncomplete set is satisfactory, a
part of the rules Call he rejected already before
tuning.
(3)
IT.
Fuzzy PD Controller. The table of rules shown
in Fig. 2 can used also for fuzzy PD Controller
represented by a single linguistic equation
e+ ~e,
(5)
j=1
which is a special case of Equation 2 with the
interaction matrix A = [1 1 -1 l, and variables X = [e ~e
~u
u =
= LAijXj ,
As all these control equations are only special
cases of the model above, the system can easily take into account the principles of the model
reference control by combining the control equations and the process model into a single set of
equations.
(4)
which is a special ca'>e of Equation 2 with the
interaction matrix A = [1 1 -1], and variables X = [e ~e
u jT. The PI and PD contro11('rs shown above can also be combined into a
single matrix equation, i.e. there are two output
variables.
For an industrial project, the control system wa<;
originally developed on the basis of operator's
control actions. Eight variables wa'> used, and
the resulting rule ba<;e of 22 rules was challged
into five sets of rules which corresponded to five
linguistic equations. After solving the equation,
a more complicated system was handled by 27
rules. The equation system can be used in developing a rule base for finer partitions as well.
Several equa.tions. Several sets of linguistic relations can be combined by matrix presentation
AX = O. In order to solve this problem, a sufficient number of these variables should be known
or variated. Because of nearly singular matrices, some of these combinations cannot be used.
However, only the integer solutions are required,
and exactly the same set of solutions is obtained
by any combination.
In the Linguistic Equation Method, interactions
are benefical: they reduce the number of rules
necessary for halldling the system. It is also
possible to identify interactions on the basis of
experimental data. In the equation form, large
systems are handled quite easily compared to
conventional fuzzy methods. For some systems,
a really drastic reduction of rules is achieved
(Juuso and Leiviskii, 1993).
The result is an aggregated set of those linguistic
relations which are relevant if the process constraints described by the complete set of linguistic equations are taken into account. As noninteger alternatives correspond to the solutions
in finer fuzzy partition, they can be excluded.
84
3.2 Membership Functions
3.3 Controller Testing
The controller tuning is started by defining the
working area for variables, e, and ~e,
by fuzzy
trapezoidal numbers, several experts are used if
available. Fuzzy differential constraints can be
used in a similar way as in the DSS applications
(Juuso et al. 1993). Alternatively, the feasible
range can be defined on the basis of experimental data. Actually, the approach is chosen for
each variable separately. The feasible range corresponds normally to labels -1, 0 and 1 (Fig. 4).
In the tuning system, crosspoint ratio between
the membership functions of the neighbouring
labels is one for both antecedent and COllSequent variables. Therefore, the fuzzijication of
the crisp input values on the basis of trapezoidal
membership functions is implemented very efficiently. The knowledge base and the inference
engine are implemented in two alternative ways,
i.e. traditional rule-based controller and mat rix
controller. Actually, the rule-ba.'ied controller is
also running in a matrix form similar to one used
in FuzzyCon.
The final membership functions of the labels are
obtained by a polynomial regression model (Fig.
4) which takes into account the sequence of the
lahels, e.g. positive big is bigger than positive
etc. The polynomial model produces more labels
close to the working point. The system generates
membership functions for finer partition levels.
Error
...A". ___ .-
8'
-5r
Enor
,
58
~
__ •. _ . k
~
4
i
q
.'
/
\
1
-I
-2
11
i
2
8
..... 8
_,..---1-
11
8
'
... _
/
8 .9
8
8
-2
Cha"!fe-of-controJ output 1
28 - · -- - - - - - -
I,
-1
-2
_ ~
8·
-
-2
-
-1
-
-)il
:
8
.. --.
-28
28
8
\/
/\
48
/
\/I! \//
n
'.
x
\
' 1;\
I.
-1
8
= -25 . 79
x
= 1.eBL
= -1.124
x
=
2
Change-or-contra I output 1
.. ~
\ .:'
};
8.~
2
i,
),
I'
t.
!\i',
0.& "!fe-of -I!!'ror
;
. -><-
--y::
-2~
)t----. •
I
/\\
Ch ..nge-or-error
8:
\/ y\/
The defuzzijication module is ba.'ied 011 the
Center-of-Area method (Fig. 5), in the litterature also referred to as Center of Gravity
method . In a general ca..,e, this method is rather
complex and slow. However, our implemetation is quite fast since it is specialized to the
membership functions with the crosspoint ratio
is one. The resulting control surface (Fig. 6)
is very smoothly varying compared to trial-anderror based fuzzy controllers . As the Fig. 5
shows, diagnostical features are a essential part
of the system (Juuso 1994).
8
-28
V
)
!,
.\
-18
.,
,
r
8
18
Error
58
1
:
8t-··· ....··_··,,·
-5,1t8-
-2
8
I,
. .. _ ._-,,-.j:
1
- -- - - - - - '
-1
1
:le
Contra I output 2
Control output 2
2
8'j
8
-28
,
2.2413
,
,. ,
I
X,\/' ff,\ /\Y
\ '
\
)
\
I,
8
28
48
-111
Cha . . ~ot-c"r
Figure 4: Labels and membership functions for
~Ul'
and U2 .
e, ~e,
11
18
48
I output 1
Figure 5: Control Example of a Fuzzy PI Controller with diagnostical features.
The membership functions of the process state
variables, E, and ~e,
are used in developing scenarios for experts (or simulations system), and
the response produces data for the estimation
of membership functions for the labels of the
change-of-control-output, ~u
(Fig. 4). For some
variables, the scenarios and the expert response
is replaced by experimental data. In this case,
selected input variables are classified by fuzzification routines, i.e. several relations must be
taken into account simultaneously. The same
methodology is also used when the system is
adapted to several working points close to each
other.
3.3 FuzzyCon
For adaptive tuning of fuzzy logic controllers, it
is necessary to have a FLC where the rules and
the membership functions can be changed online. Although a wide variety of fuzzy logic tools
available on a PC enviroment were examined,
none of them could come up with the requirements of on-line tuning. The knowledge about
the systems was limited, and transfering to new
computer enviroments would have been difficult.
85
Some additional labels are required for the systems consisting of several sets of rules: A:\Ylabel in the premise part of the rule means that
the input has no influence on the rule, and a
star in some output in the consequent part of
the rule means that the rule has no influence on
that output. Rules are stored in number form
which makes their treatment ea,>ier .
,
.. 18
.-
.-
5
5:
~
.-
•
.~
8
C
Fuzzification is made by calculating the valm's
of membership functions of all the fuzzy sets for
input value in question (Viot 1993). :\lamdani's
min-max method was selected because it provided reasonably good results and wa<; fastest
and easiest to calculate (Lee 1990). FuzzyCon
does not require similar restrictions for membership functions as the tuning system dpscribed
above, and therefore, the fast algorthm for the
Center-of-Area method cannot be used . TIIP defuzzification module is based on the Center-ofSums method which is one of the most common
defuzzification techniques in control.
r• -5 ..
I
1
u
-18 '
48
Figure 6: Control Surface of a Fuzzy PI Controller.
User interface. FuzzyCon provides valuable Ollline tools for the controller tuning . The llser
interface is easy to use and several windows can
be open at the same time for showing differellt
kind of data. FuzzyCon can also save definitions,
membership functions and rules on the file system in matrix forms which are closely related to
the matrices used in the tuning system.
Usually, fuzzy logic development tools permit
changes in rules and membership functions in
simulation mode , but when the codp is compiled
alld the program is running, changes call not be
done whithout compiling the code again. The
calculation tim e in adaptive FLC is a little bit
longer thall in strictly bound FLC (Brubaker
1993), but the speed is enough for controlling
processes in process industry.
For users, the rules are shown in linguistic form
and the membership functions in numeric and
graphical form. Users can add and edit rules in
rule window and edit membership functions in
membership function windows, or the rules and
membership functions created in some other way
can be read to FuzzyCon from the file or traI1Sfer with DDE-links. The rules and membership
functions can changed on-line by both methods.
FllzzyCon allows adaptive tuning and offers good
tools for tuning , and is specially designed for
fuzzy control in process industry (Juuso et al.
1994). As a \Vindows application created in Visual Ba<;ic 3.0, it uses the advantages of Windows: graphical interface, windows and DDElinks. The links are created after applications
arp started and there is no need to know the
mpmory addresses beforphand. The data acquisition application makes conversions, if needed,
to crisp input data and sends them to FuzzyCon.
At the moment FuzzyCon can handle ten inputs
and five outputs, but the expansion is ea,>y.
FuzzyCon offprs several aids to examine control
(Juuso et al. 1994) . The completeness of the rulC'
base can be tested by simulation. During control
and simulation there is chance for monitoring the
firing of the rules and the forming of degrees of
membership for inputs and outputs.
The data acquisition card ha'> a \Vindows support, so thp data acquisition program can use
DLL-library commands for reading measured
data from the card.
4. ADAPTIVE FUZZY
CONTROLLERS
Fuzzy logic controller. The knowledge base contains membership functions and rules.
The
membership functions are trapezoidal or triangular defined by four points (Fig. 4). The maximum number of membership functions is nine
for each input and output variable. In the general form, each rule contains several inputs and
outputs: at the moment, FuzzyCon can handle
ten inputs and five outputs.
The Control System is adaptive since the meaIling of the linguistic values depends on the working point of the process. Only five parameters
are needed for reconstructing the set membership functions for any variable on any level of
fuzzy partition (Fig. 4). In control applications,
this level does not usually change, aIld it is better
to use a set of corner points of the membership
functions also shown in Fig. 4.
86
The adaptivity is pretuned, i.e. the tuning of
the membrrship functions is performed for different working point areas defined by some suitable statr variables, e.g. flow velocity, temperat1lre etc. The resulting membership functions,
and tlH' corresponding control surface, depend
on the working point, i.e. the cube containing
the control surface has rubber likr dimensions.
The selection of alternative tuning area.., corresponds to the table shown in Fig. 2, and each
variable of the control rules requires an own table.
Juuso, E. K. 1993. "Linguistic Simulation in
Process Control." In Applied Simulation in
Industry. Proceedings of the 35th SIMS
Simulation Conference (Kongsberg, NOT'way, 9 - 11 June), T. Iversen, ed., 107-113.
Juuso, E. K. 1994. "Fault Diagnosis Based
on Linguistic Equation Framework." To be
presented in SAFEPROCESS'94 (E8poo ,
Finland, 13-15 June, 1994).
Juuso, E. K., J .C. Bennavail, and M.G. Singh
1993. "Hybrid Knowledge-Based System
for Managerial Decision :'1aking in l" lIcertainty Environment." In Qualitatzve Reasoning and Decision Technologies, Proceedings of the QUARDET'93 (Ba.rcelona, June
16 - 18), ~. Piera Carrete and :M. G. Singh,
eds., CI~NE,
Barcelona, 234-243 .
These tables are used together with linguistic
equation models, if available, to obtain the appropriate definitions for the sets of membership functions. This procedure a1lowes gradual
changes in any part of the set of membership
functions, and therefore, it is more flexible than
::\ ormalization-Denormalization procedure. By
this approach, adaptive control can be realized
ill FuzzyCon or in automation systems a.., well.
Thr membership function can be regenerated by
the database produced by the tuning system.
Juuso, E. K. and K. Leiviska. 1990.
"Expert Systems Combined with a Multilayer Simulation System." In MATHEMATICAL and INTELLIGENT models in system simulation, R. Ha.J.1Us and P . Kool and
S. Tzafestas, eds., Baltzer, Scientific Publishing, 325-330.
If the databa..'le defining the membership functions is changed online, the adaptation should
he rrstricted to an appropriate range depending
on the working point. Otherwise, the normal
problrms of adaptive systems may arise. Neural
nrts are planned to use in fine tuning especially
when extending the operating area of the adaptive fuzzy controller.
5.
CO~L
Juuso, E. K. and K. Leiviska. 1991.
"Adaptive Expert Systems for Metallurgical Processes." In Expert Systems in Mineral and Metal Processing, Proceedings of
the IFAC Workshop (Espoo, Finland, August 26-28, 1991), IFAC Workshop Series,
1992, Number 2, S.-L. Jamsa-Jounela and
A. J. Niemi, eds., Pergamon, Oxford, UK,
119-124.
USIONS
In the linguistic equation approach, the relations
are developed gradually: only for a small part
of the problem is taken into account at a time.
By the matrix method, it is very easy to dewlope and tune adaptive fuzzy control applications. The linguistification methods have a vital
importance in connect.ing this methodology to
the real practice: the relations are tuned by adjusting the meanings of the linguistic variables.
Juuso, E. K. and K. Leiviska. 1993.
"Linguistic Equation Approach for Adaptive Expert Systems." In Proceedings of the
EUFIT'93 (Aachen, September 7 - 10), H.J. Zimmermannn, ed., Augustinus, Aachen,
Vol. 3, 1550-1556.
The resuits of the adaptive tuning method are
used in real control practice by transferring them
to FuzzyCon which is a fuzzy logic controller
wllt're the rules and the membership functions
can be changed on-line. FuzzyCon is connected
to processes with a data acquisition card, and
the data is transferred through DDE-links.
Juuso, E. K., J. Myllyneva, and K. Leiviska I!
"Fuzzy Logic Controller and Adaptive
Tuning." To be presented in ESM'94
(Barcelona, Spain, 1-3 June, 1994).
Lee, C. C. 1990. " Fuzzy Logic in Control Systems: Fuzzy Logic Controller - Part I & n."
IEEE Transactions on Systems, Man, and
Cybernetics, 20:404-435.
6. REFERENCES
Viot, G. 1993. "Fuzzy logic in C, creating a
fuzzy-based inference engine." Dr Dobb's
Journal, 18(2):40-49.
Brubaker, D. 1993. "An accelerated kernel
for fuzzy systems." AI Expert 8, no. 3:3944.
87