An Au oma ed Design Flow om Linguis ic Models o
Piecewise Polynomial Digi al Ci cui s
Iluminada Ba u one San iago Sánchez-Solano And és A. Ge sno iez, and Ma ía B ox
Dp o. Elec ónica y Elec omagne ismo – IMSE IMSE Dp o. A q. Compu ., Elec ón. y Tecn. Elec ónica
Uni . o Se ille – CNM (CSIC) CNM (CSIC) Uni . o Co doba
Se ille, Spain Se ille, Spain Co doba, Spain
[email protected] san [email protected] and [email protected] mb[email p o ec ed]
Abs ac —This pape desc ibes how he di e en CAD ools o
he en i onmen X uzzy 3, de eloped in Mic oelec onics
Ins i u e o Se ille and Uni e si y o Se ille, allow o ansla e
exp essi e linguis ic models in o ma hema ical ones, in
pa icula , in o a combina ion o piecewise polynomial sys ems
ha can be implemen ed e icien ly in ha dwa e. The new
syn hesis ool o X uzzy 3 au oma es communica ion wi h Xilinx
Sys em Gene a o in Ma lab, hus acili a ing implemen a ion o
he linguis ic model in o an FPGA om Xilinx. This is
illus a ed wi h he design o a na iga ion con olle o an
au onomous obo .
I. INTRODUCTION
Model-based app oaches a e cu en ly gaining popula i y
o ackle he g owing complexi y o embedded sys ems
de elopmen since hey allow wo king wi h a high deg ee o
abs ac ion, enhance unde s anding and educe he ime o
ma ke . Pa icula ly linguis ic models, ha is, desc ip ions o
sys ems ob ained om heu is ic knowledge o human expe s
exp essed linguis ically, acili a e unde s anding and apid
de elopmen . In o de o ansla e linguis ic models in o
ma hema ical ones, which can be implemen ed in ha dwa e
and/o so wa e, uzzy logic-based sys ems ha e been
employed widely in he ecen yea s [1]. Howe e , while
exp essi e linguis ic models ha e been employed in many
so wa e applica ions, he models implemen ed in ha dwa e
and embedded so wa e only con ain a single (plain) ule base
wi h simple an eceden s and consequen s, hus educing he
applicabili y o ha dwa e app oaches. This is he case o many
design en i onmen s o uzzy sys ems, such as FIDE,
FLASH, and FuzzyTECH, when gene a ing embedded
so wa e o speci ic p ocesso s, and he case o many uzzy
digi al ci cui s.
This pape desc ibes how he di e en CAD ools o he
en i onmen X uzzy 3, de eloped in Mic oelec onics
Ins i u e o Se ille and Uni e si y o Se ille [2], ease o ill
he gap be ween he desc ip ion o exp essi e linguis ic
models and i s e icien ha dwa e implemen a ion. The idea is
o ans o m successi ely an ini ial linguis ic model in o a
combina ion o plain uzzy ule bases implemen ed e icien ly
by piecewise polynomial digi al ci cui s.
The pape is o ganized as ollows. Sec ion II summa ies
how plain uzzy ule bases a e equi alen o piecewise
polynomial sys ems (in pa icula o PWL ones) when
imposing ce ain cons ain s. Sec ion III desc ibes b ie ly he
di e en CAD ools o X uzzy 3 ha acili a e ans o ming an
exp essi e linguis ic model in o he combina ion o piecewise
polynomial modules, pa icula ly he new ha dwa e syn hesis
ool, x sg, which au oma es he communica ion be ween
X uzzy 3 and he Xilinx Sys em Gene a o (SysGen) Simulink
oolbox o Ma lab. Sec ion IV illus a es his au oma ed design
low wi h he design o a na iga ion con olle o an
au onomous obo . Finally, Sec ion V summa izes
conclusions.
II. RULE BASES AND PIECEWISE POLYNOMIAL SYSTEMS
A plain uzzy ule base is a se o IF-THEN ules whose
an eceden pa s con ain uzzy e alua ions o he inpu
a iables. Fuzzy se s a e ep esen ed by membe ship unc ions
ha de ine a pa i ion o he inpu uni e ses o discou se. The
se s a e uzzy because hei membe ship unc ions o e lap
among hem and ake alues be ween 0 and 1 (null o ull
membe ship). Hence, gi en an inpu da a, he e is a piece o
ules wi h an ac i a ion deg ee g ea e han ze o ha is
esponsible o he ou pu alue. Depending on he an eceden
and consequen membe ship unc ions and he uzzy ope a o s
employed, a plain ule base can pe o m as a piecewise
polynomial sys em. This pe o mance is a e y good ade-o
be ween e sa ili y o he ule base (i ea u es uni e sal
app oxima ion capabili y) and e iciency o i s ha dwa e
implemen a ion.
Le us conside B-spline amilies o o de ze o, one and
wo o ep esen he inpu membe ship unc ions. Fig. 1 shows
how hese unc ions a e no malized, ha is, he sum o he
membe ship deg ees o any inpu o hem is always he uni y.
Le us conside ha an eceden pa s only in ol e
conjunc ions ha a e ep esen ed by wo ope a o s: he
ex ension o he mee ope a o [3] and he p oduc . Table I and
This wo k has been pa ially suppo ed by Eu opean Communi y unde
he MOBY-DIC P ojec FP7-IST-248858 (www.mobydic-p ojec .eu), by
Minis e io de Ciencia y Tecnología unde he P ojec TEC2008-04920 and
by Jun a de Andalucía unde he P ojec P08-TIC-03674.
(a) (b) (c)
Figu e 1. B-spline amilies o o de (a) ze o, (b) one and (c) wo, as de ined wi h he ool x edi in X uzzy 3.
II summa ize he equi alences be ween piecewise polynomial
app oxima o s and ule bases ha employ, espec i ely, a
ze o-o de Takagi-Sugeno in e ence me hod ( he ules’
consequen s a e single on o non uzzy alues) and a i s -
o de in e ence me hod ( he ules’ consequen s a e linea
unc ions in he inpu s). B-splines o deg ee ze o a e no a
uzzy solu ion because he e is no o e lapping, and B-splines
o deg ee wo ha e low linguis ic meaning since o al
membe ship is no possible. Hence, B-splines o o de one a e
he mos adequa e o linguis ic models. Using hem,
piecewise linea , mul ilinea , quad a ic, and mul iquad a ic
sys ems can be gene a ed [3]-[4]. The plain ule bases
conside ed he ein (depic ed wi h bold on s in Table I and II)
use he p oduc as an eceden connec i e.
Se e al au ho s ha e epo ed e icien digi al
a chi ec u es o implemen such ule bases. In pa icula , he
one conside ed he ein is he ac i e- ule d i en a chi ec u e
epo ed in [5]. The cons i uen blocks o his a chi ec u e a e
membe ship unc ion ci cui s (MFCs), which can implemen
B-spline amilies o o de one wi h uni o m o non uni o m
(Fig. 1b) dis ibu ion; ule selec ion block, which selec s he
ules ac i a ed by he inpu s; an eceden connec i e, which can
be selec ed as he p oduc ; ule memo y, which s o es 1 alue
pe ule in he case o ze o-o de Takagi-Sugeno in e ence o
n+1 alues (being n he numbe o inpu s) in he case o i s -
o de Takagi-Sugeno sys em; de uzzi ie block, which in he
case o B-spline amilies and Takagi-Sugeno sys ems, can be
selec ed as a weigh ed sum (no di ide is equi ed); and a
con ol block, which gene a es he con ol and empo iza ion
signals o p ocess sequen ially only he 2n ac i e ules.
III. XFUZZY 3 AND EXPRESSIVE LINGUISTIC MODELS
Plain piecewise polynomial ule bases a e adequa e o
desc ibe a simple linguis ic model wi h 1, 2 o e en 3 inpu s
and wi h a ew membe ship unc ions pe inpu , due o he
cu se o dimensionali y. Howe e , complex linguis ic models
can in ol e many inpu s and membe ship unc ions. The i s
s ep o acili a e ha dwa e implemen a ion o complex
linguis ic models should be o use hie a chical sys ems as
much as possible, which combine modules o 1 and 2 inpu s,
p e e ably. An ad an age o linguis ic models is ha hie a chy
is usually p esen in he model om he beginning o can be
pu sued in subsequen e inemen s. The design en i onmen
X uzzy 3 helps in his p ocess because i allows desc ibing
hie a chical sys ems consis ing o se e al modules ha can
in e change uzzy o c isp in o ma ion among hem. Each
module can be a se o uzzy IF-THEN ules o a non uzzy
(c isp) module desc ibed by any ma hema ical desc ip ion
connec ing i s inpu s and ou pu s. The CAD ool x edi in
X uzzy 3 acili a es desc ibing his kind o sys ems. Fig. 2, o
example, shows he main window o he ool x edi when
desc ibing a sys em wi h h ee modules (one o hem c isp).
The uzzy modules included in he hie a chical sys em a e
no usually piecewise polynomial ule bases i hey a e
ob ained om IF-THEN ules exp essed in na u al language.
Such ules in na u al language do no always ollow a Takagi-
Sugeno in e ence scheme wi h an eceden s ep esen ed by B-
splines o deg ee one and only connec ed by p oduc . X uzzy
3 employs a o mal speci ica ion language, named XFL3, ha
acili a es ansla ing IF-THEN ules exp essed in na u al
language because o i s exp essi eness. No only inpu
a iables can be e alua ed as uzzy ( o example, ‘powe is
medium’) bu also he uzzy concep s and he p oposi ions
i sel can be e alua ed linguis ically by using linguis ic
hedges ( o example, ‘powe is g ea e han medium and mo e
o less speed is high o a ea is low’). The las example in
TABLE I. ZERO-ORDER TAKAGI-SUGENO RULE BASES
An eceden
connec i e
O de o B-spline amily in an eceden s
0 1 2
Ex ension
o mee
Piecewise
cons an
Piecewise
linea (PWL) Piecewise quad a ic
P oduc Piecewise
cons an
Piecewise
mul ilinea
Piecewise
mul iquad a ic
TABLE II. FIRST-ORDER TAKAGI-SUGENO RULE BASES
An eceden
connec i e
O de o B-spline amily in an eceden s
0 1
Ex ension
o mee Piecewise linea (PWL) Piecewise quad a ic
P oduc Piecewise linea (PWL) Piecewise mul iquad a ic Figu e 2. Main window o he ool x edi .
XFL3 would be:
powe > medium & ~ (speed == high | a ea == low)
Ano he ea u e o XFL3 exp essi eness is ha con idence
weigh s can be assigned o he ules. The CAD ool x edi in
X uzzy 3 con ains many g aphical use in e aces so as o
allow desc ibing complex ules wi hou a deep knowledge o
XFL3. The use o X uzzy 3 can e en de ine new ope a o s
(conjunc i e, disjunc i e, implica ion, agg ega ion, e c.) apa
om hose al eady de ined in he en i onmen so as o be e
ansla e he linguis ic meaning o he ules. The CAD ool
x pkg in X uzzy 3 has a g aphical use in e ace o acili a e
he in oduc ion o new ope a o s and c isp modules.
Once he uzzy modules ha e an ini ial ma hema ical
desc ip ion, he ollowing s ep is o ans o m hem in o
piecewise polynomial modules. Such ans o ma ion is always
possible because piecewise polynomial modules a e uni e sal
app oxima o s. Se e al CAD ools o X uzzy 3 a e e y
help ul in his p ocess. One o hem is he ool x plo ha
allows ep esen ing g aphically he ou pu o he linguis ic
module e sus 1 o 2 o i s inpu s and sa e he inpu -ou pu
nume ical da a in o a ile. These nume ical da a p o ided by
he linguis ic knowledge (and any o he nume ical da a
p o ided by ano he kind o knowledge) is employed by he
ool x dm in X uzzy 3 o ex ac he ini ial s uc u e o he
piecewise polynomial module. This ool con ains se e al g id-
based algo i hms so as o iden i y he numbe and ini ial
dis ibu ion o B-splines pe inpu . Tuning o his ini ial
s uc u e o minimize app oxima ion e o o nume ical da a is
done wi h he ool x sl, which includes se e al supe ised
lea ning algo i hms [6]. Simpli ica ion o he uned
membe ship unc ions and ules o each module is done wi h
he ool x sp, which includes p uning, simila i y-based,
clus e ing-based and abula ion simpli ica ion algo i hms [7].
A inal uning is again pe o med wi h x sl.
The ollowing s ep a e ob aining a hie a chical sys em
wi h piecewise polynomial modules is o e i y i s beha io .
X uzzy 3 con ains se e al CAD ools o help in his p ocess.
One o hem is x sim, which uses a model o he con ex whe e
he sys em is in ol ed so as o simula e he sys em
dynamically. Ano he ool is x m , which allows moni o ing
each o he cons i uen ule bases o unde s and how he ou pu
alues a e in e ed om he inpu ones. The ool x plo is he
o he e i ica ion ool ha can be again used o compa e he
inpu -ou pu beha io (s a ic beha io ) o he ans o med and
he ini ial sys ems.
S a ic and dynamic e i ica ions in X uzzy 3 do no
conside ha dwa e implemen a ion aspec s such as he
in luence o pa ame e wo d sizes ( he s a ic beha io
analyzed in X uzzy does no conside quan iza ion) and
echnology de ails so as o e alua e i he design mee powe ,
a ea, and speed equi emen s ( he dynamic beha io simula ed
in X uzzy is a high le el). Since hese de ails depend on he
a ge pla o m, ou app oach has been o exploi he design
en i onmen s o he ha dwa e pla o ms and de elop a
syn hesis ool in X uzzy whose objec i e is o au oma e
communica ion be ween bo h en i onmen s. In his sense, he
new syn hesis ool de eloped o X uzzy, named x sg, ac s as
an in e ace be ween X uzzy and Xilinx Sys em Gene a o
(SysGen) ool in Ma lab. Using he Xilinx Blockse in
Simulink, a lib a y o modules, named X uzzy Blockse o
X uzzyLib, has been de eloped o implemen piecewise
polynomial digi al ci cui s acco dingly o he p e iously
commen ed ac i e ule-d i en a chi ec u e. These modules
ha e masks ha allow de ining hei pa ame e s by Ma lab
command window o a con igu a ion ile. The ool x sg
gene a es au oma ically hese con igu a ion iles. Some o he
equi ed pa ame e s a e ob ained om he XFL3 desc ip ions
(numbe o membe ship unc ions pe inpu , kno s o he B-
splines and consequen s o he ules). The o he pa ame e s
ela ed o bi size o he a iables in he uzzy and c isp
modules should be in oduced by he use h ough a g aphical
in e ace. Fig. 3 shows he window o x sg co esponding o
he hie a chical sys em al eady shown in Fig. 2.
In addi ion, x sg can gene a e he Simulink model o he
whole sys em. Hence, simula ion pe o med in X uzzy can
now be done in Simulink conside ing ha dwa e de ails. E en
he design can be syn hesized and implemen ed in he FPGA
and a ha dwa e-in-a-loop simula ion can be ealized.
IV. APPLICATION EXAMPLE
The design low desc ibed abo e has been applied o
de elop an embedded con olle o a ca -like au onomous
obo . The p oblem add essed has been o con ol he obo
speed, , and he angle o he on wheels ha a e esponsible
o he ajec o y cu a u e, , so as o d i e backwa d he obo
om any con igu a ion (x, y, , , ) o an objec i e
con igu a ion (0, 0, 0, 0, 0) in he e e ence sys em shown in
Fig. 4. The con olle , he e o e, has 2 ou pu s and up o 5
inpu s. Ins ead o looking o a single ule base, which would
be di icul o design, heu is ic knowledge can be exploi ed o
ob ain a hie a chical sys em wi h 1- and 2-inpu modules. The
Figu e 3. Main window o he ool x sg.
x
y
x
y
Figu e 4. Na iga ion p oblem add essed.
Figu e 7. Ha dwa e/so wa e cosimula ion in Ma lab.
(a) (b)
Figu e 5. Simula ion esul s in: (a) X uzzy 3, (b) Ma lab.
i s s ep is o sepa a e speed and cu a u e con ol. Speed
con ol depends on e ical posi ion, y, and p e ious cu a u e.
Cu a u e con ol depends on global posi ion, x, y, and
o ien a ion, . A second simpli ica ion is o u he decompose
cu a u e con ol in o wo modules connec ed in cascade. The
i s one e alua es, depending on x and y, which o ien a ion, ,
should ha e he obo so as o d i e backwa d wi h a ze o
cu a u e. The second module e alua es he di e ence
be ween and o decide he cu a u e. The s uc u e o he
cu a u e con olle is ha al eady shown in Fig. 2.
The 2-inpu module in cha ge o con olling speed is
designed by ansla ing linguis ically exp essed ules. Using
he ools x plo , x dm, x sl, and x sp, his module is ansla ed
in o a piecewise mul ilinea sys em wi h 4 B-spline unc ions
co e ing y and 3 unc ions co e ing. Simila ly, he 1-inpu
module o he cu a u e con olle is designed om linguis ic
ules and hen ansla ed in o a piecewise linea sys em wi h 6
B-spline unc ions co e ing i s inpu . The 2-inpu module o
he cu a u e con olle is designed om combining heu is ic
knowledge (exp essed as linguis ic IF-THEN ules) and
geome ical analysis o he p oblem (exp essed as inpu -ou pu
nume ical da a). Again using he ools x plo , x dm, x sl, and
x sp, his module is designed as a piecewise mul iquad a ic
sys em wi h 5 B-spline membe ship unc ions co e ing x, 3
unc ions co e ing y, and 15 consequen s ha depend linea ly
on he inpu s.
Beha io o he designed con olle wo king in a closed-
loop wi h he obo model is e i ied wi h he ool x sim. Fig.
5a shows one o hese simula ed ajec o ies.
Using he ool x sg, con igu a ion iles a e p o ided
au oma ically o gene a e a Simulink model ha uses modules
o he X uzzy Blockse (which use, in u n, he modules in he
Xilinx Blockse ). Fig. 6 shows he Simulink model
co esponding o he cu a u e con olle . Ha dwa e/so wa e
cosimula ion o SysGen can be employed o implemen he
whole con olle in a FPGA (in his case a Spa an3 xc3s700a
o a Spa an 3A S a e Ki ) and analyze i s beha iou when
wo king in a closed loop wi h a model o he obo (Fig. 7).
Visualiza ion u ili ies o Ma lab allow ob aining he
ajec o ies o he obo , like ha in Fig. 5b. These esul s ha
conside ha dwa e de ails may no mee con ol equi emen s.
In hose cases, he use can go back in he design low and
i e a e wi h, o ins ance, di e en bi sizes o pa icula
wo ds. Since he whole design low is au oma ed, he use can
mo e easily bo om o up and up o bo om.
V. CONCLUSIONS
The di e en CAD ools o X uzzy 3 a e e y help ul o
pa e he way be ween exp essi e linguis ic models and
e icien ha dwa e implemen a ions. Heu is ic knowledge
exp essed linguis ically and any o he knowledge exp essed
nume ically can be exploi ed by X uzzy o desc ibe a
hie a chical sys em made up o piecewise polynomial
modules. Au oma ed communica ion be ween X uzzy and
Xilinx Sys em Gene a o in Ma lab allows he use o conside
ha dwa e de ails wi hin he whole design low.
REFERENCES
[1] A. M. Ib ahim, “Fuzzy logic o embedded sys ems applica ions”,
Else ie Science, 2004.
[2] X uzzy web si e: h p://www.imse-cnm.csic.es/X uzzy.
[3] R. Ro a i, “Fuzzy piecewise mul ilinea and piecewise linea sys ems
as uni e sal app oxima o s in Sobole no ms”, IEEE T ans. on Fuzzy
Sys ems, ol. 6 (2), pp. 235-249, 1998.
[4] R. Ro a i, “High speed implemen a ion o piecewise-quad a ic Takagi-
Sugeno sys ems”, P oc. IEEE In e na ional Fuzzy Sys ems Con ., pp.
292-297, 1999.
[5] S. Sánchez-Solano, A. Ba iga, C. J. Jiménez, and J. L. Hue as,
“Design and applica ions o digi al uzzy con olle s,” in P oc. IEEE
In . Con . Fuzzy Sys ., ol. 2, pp. 869–874, Jul. 1997.
[6] F.J. Mo eno-Velo, I. Ba u one, A. Ba iga, S. Sánchez-Solano,
“Au oma ic uning o complex uzzy sys ems wi h X uzzy”, Fuzzy Se s
and Sys ems, ol. 158, pp. 2026 – 2038, 2007.
[7] I. Ba u one, F. J. Mo eno-Velo, A. A. Ge sno iez, “A CAD app oach
o simpli y uzzy sys em desc ip ions”, P oc. FUZZ-IEEE’2006, pp.
2392-2399, Vancou e (Canada), July 2006.
Figu e 6. Simulink model o he cu a u e con olle .