0% found this document useful (0 votes)
9 views

Implementation of Parallel Fuzzy Logic Controller in FPGA Circuit For Guiding Electric Wheelchair

This document discusses the implementation of a parallel fuzzy logic controller in an FPGA circuit to guide an electric wheelchair. Key points: - A dedicated architecture was developed using FPGA to implement a fuzzy logic control system for an electric wheelchair with two DC motors. - The system uses joystick position, feedback on motor speed differences, and a rule base to generate output signals to control the motors. - A parallel implementation allows evaluating the activation level of each rule simultaneously to efficiently control the motors in real-time. - The FPGA implementation offers benefits over software by processing fuzzy rules in parallel to minimize required resources and execution time for real-time control.

Uploaded by

chemistryraja123
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Implementation of Parallel Fuzzy Logic Controller in FPGA Circuit For Guiding Electric Wheelchair

This document discusses the implementation of a parallel fuzzy logic controller in an FPGA circuit to guide an electric wheelchair. Key points: - A dedicated architecture was developed using FPGA to implement a fuzzy logic control system for an electric wheelchair with two DC motors. - The system uses joystick position, feedback on motor speed differences, and a rule base to generate output signals to control the motors. - A parallel implementation allows evaluating the activation level of each rule simultaneously to efficiently control the motors in real-time. - The FPGA implementation offers benefits over software by processing fuzzy rules in parallel to minimize required resources and execution time for real-time control.

Uploaded by

chemistryraja123
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

+6, .

UDNRZ3RODQG0D\

Implementation of Parallel Fuzzy Logic


Controller in FPGA Circuit
for Guiding Electric Wheelchair
Marek Popáawski, and Michal Bialko
Department of Electronics and Computer Science,
Koszalin University of Technology, Koszalin, Poland
[email protected]

 defuzzification (b_out) [4].


Abstract — This paper describes an implementation of a In papers [5][6] parallel fuzzy logic systems are
fuzzy logic control system for guiding a wheelchair, using an introduced, in which for each rule an individual equipment
architecture based on a FPGA circuit. For this purpose, a (MIN blocks) is assigned. During operation of such a
dedicated architecture was elaborated, which was
simulationed in FPGA circuit. Input and output linguistic
system, parallel verification of the degree of activation of
variables and corresponding fuzzy sets were defined and each fuzzy rule is performed. In hardware realization of
based on those a fuzzy rule base was formed. The proposed fuzzy systems only 2^n rules from L^n rules existing in
fuzzy system cooperates with two permanent magnet DC the rule base are activated (where L - number of input
motors, which are controlled by an inverter operating in fuzzy sets, n – number of input linguistic variables). The
configuration of H-bridge. utilization of technique of addressing in fuzzy systems
allows to process only active rules [7]. Elimination of
Keywords — fuzzy logic controller, fuzzy system, FPGA
verification of degree of activation of all fuzzy rules
circuit, electric wheelchair.
allows to limit occupied equipment stocks (memory). In
the proposed system a technique of addressing is applied,
I. INTRODUCTION which is implemented in parallel mode.

T HE objective of this work is a presentation of practical


implementation of a digital parallel fuzzy logic
controller, for steering of electric wheelchair for unable
persons.

Fig. 1. Electric wheelchair. Fig. 2. General block diagram of fuzzy logic system for guiding a
wheelchair.
The electric wheelchair is driven by two permanent
magnet DC motors – M0 and M1 having the power of
II. LINGUISTIC VARIABLES
250[W] each, which are supplied from 24[V] battery
(fig.1). Steering of the wheelchair is based on differential In fig. 3 assumed shapes of fuzzy terms corresponding
control of electric motors driving back wheels of the to input signals (left/ right – l/r, front/ back – f/b) are
wheelchair, allowing driving the wheelchair in left/ right shown. The source of steering signal of the system is a
and onward/ back directions. The task of fuzzy system joystick – JOY (fig. 2), which is constructed of two
(fig. 2) is a generation of output signals (s0,s1), steering variable resistors. These resistors are supplied from a 5
electric motors (M0,M1) based on input signals (left/ right [V] DC battery, and the voltage drops on resistors are
– l/r, front/back – f/b), created by the operator using directly proportional to deflection of the joystick. The
joystick JOY; additionally a feedback signal (ǻv) is used neutral state of the joystick correspond to 2,5 [V] and is
to cancel a difference of rotations of electric motors, while coded as a state “ZE”. The deflection of the joystick from
driving straight on [1][2][3]. neutral state “ZE” in left/ right (or front/ back) causes a
The knowledge, based on which steering signals are change of value of signal l/r (or f/b).
generated is included in fuzzy rules and terms of linguistic Steering of the two motor electric wheelchair requires a
variables. The propossed fuzzy system is based on constant correction of the direction of the drive, because
classical Mamdani model in which one can distinguish the the speed of driving motors differ slightly. Using the
blocks (fig. 2): fuzzification (b_in), inference (b_inf) and feedback signal ǻv proportional to the difference of wheel
rotation speed ǻv allows to correct their speed during
driving straight on, what increases the quality of steering

1-4244-1543-8/08/$25.00
Authorized licensed ©2008
use limited to: NATIONAL INSTITUTE IEEE
OF TECHNOLOGY TIRUCHIRAPALLI. Downloaded on September 18,2023 at 11:33:49 UTC from IEEE Xplore. Restrictions apply.
of the wheelchair. Measurement of rotary speed is premises connected by conjunction operator – AND, and
performed by incremental encoders (en0 and en1), which has the form:
are installed on driving wheels. Signal of difference of Ra: If (x0 = A0) AND (x1 = A1) AND (x2 = A2)
wheel speed - ǻv is supplied to input fuzzy system, which then (y0 = B0)
corresponds to input linguistic variable – x2, which fuzzy Rb: If (x0 = A0) AND (x1 = A1) AND (x2 = A2)
terms are shown in figure 4a. then (y1 = B1)
where
x0,x1,x2 – input linguistic variables corresponding to
input signals: p/t, l/p, 'v,
A0,A1,A2 - terms of linguistic variable xi (i=0,1,2),
y0,y1 - output linguistic variable, which corresponding to
output signals p0 and p1,
B0,B1 - terms of linguistic variable yi (i =0,1)
A possible number of rules describing this system
equals to 2*5^3=250 rules or 125 pair of rules. In table 1 a
part of the rule table board, corresponding to driving
motors M0/M1 is presented (assuming that input value of
linguistic variable x2,ҏ ǻv = „ZE”). At sides of the rule
table the increases of values of input linguistic variables
Fig. 3 Fuzzy-sets of input linguistic variable a) l/r and b) f/b (N- negativ, are shown (neutral value marked as the zero – ZE), and in
ZE – zero, P – positiv, B – big, S - small).
the interior of the table output steering signals y0/y1 for
motors M0/M1 are given.

TABLE 1: The Part of the look-up table rules of the fuzzy system
for signal ǻv = „ZE” (n- negativ, ze – zero, p – positiv, b – big, s
- small).
l/r Negative - left ZERO Positiv – right
p/t NB NS ZE PS PB
Positiv PB NS/DD UM/DD DD/DD DD/DM DD/DM
Onward
PS UM/DD ZE/DD DS/DS DD/ZE DD/DM
ZERO ZE ZE/DD ZE/DM ZE/ZE DM/ZE DD/ZE
Negativ NS ZE/UM ZE/UM UM/UM UM/ZE UM/ZE
back
NB ZE/UD ZE/UM UD/UD ZE/UM UD/ZE

Fig. 4 Fuzzy-sets of linguistic variables a) input value corresponding to A. Control block


error signal 'v, b) output values s0,s1 corresponding to rotation speed of
driving motors (N- negativ, ZE – zero, P – positiv, B – big, S - small).

In proposed system the control of motor driving speed


is based on pulse width modulation (PWM); the value of
aspect ratio of modulated signal is determined by
defuzzificated output values (s0,s1). The output variables
are represented by five singletons (fig. 4b). All fuzzy sets
are stored in system's memory.

III. FUZZY LOGIC SYSTEM


Proposed digital fuzzy system assigned for steering
electric wheelchair was simulationed in FPGA circuit
Spartan III XC3S1000 [7][8]. This system has 3
independent inputs and 2 outputs, and is composed of 3
internal blocks: fuzzification (b_in), inference (b_inf) and
defuzzification (b_out). The terms of input linguistic Fig. 5. Block structure of proposed parallel fuzzy system.
variables (fig. 3 and 4a) are described by 256 samples, at 8
- bit resolution. The distribution and shapes of fuzzy sets The main element of the digital parallel fuzzy system
(fig. 3 and 4a) allow to activate one or two fuzzy rules for (fig. 5) is the block “control” which realizes steering
one discrete (sharp) value of the input variable. The fuzzy functions. The task of this block is appropriate sequence
rule base was created based on relations between input and connections of logic signals from outputs: e_gen, e_max,
output variables, which was written in system’s memory e_min, e_ram, e_fuz, e_defuz, r_max, s_gen to the
as a look-up table. A single pair of rules (Ra, Rb) executive blocs „fuzzy_x” (where x=0,1,2), „inference”
controling two electric motors consists of three simple and „defuzzx” (where x=0,1). The block “control” is

Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY TIRUCHIRAPALLI.


406 Downloaded on September 18,2023 at 11:33:49 UTC from IEEE Xplore. Restrictions apply.
controlled by internal clock’s counter – “La”. The values correspond to input linguistic variables x2,x1,x0; in
of counter “La” cause connection of mentioned above particular value of the weight – ‘0’ corresponds to
outputs to suitable blocks, initiating their actions. connection of the value ‘0’ and the T0 code, and ‘1’
corresponds to connection of the value ‘1’ and the T1 code
B. Fuzzification process
Based on the values of weights b2, b1, b0 in the range
The fuzzification process changes input signal value tx(2:0) tx(2:0), tx(5:3) and tx(8:6) (where x=0,1,2) a
from the fields of real numbers to the value of sequential linking of codes of active fuzzy sets is
membership function µ(x) of the fuzzy sets. In the performed; in this way a 9 - bit address of the conclusion
proposed fuzzy system the fuzzification process is is created. At the same time the inputs mix0, mix1 (where
performed by reading out from system’s memory the x=0,1,2) are connected to outputs mix (where x=0,1,2).
values of membership function of activated sets and also The table 2 shows values of weights - b2, b1, b0, based
codes of these sets. The input block (b_in) is divided into on which the codes of input fuzzy sets in the range tx(2:0)
three independent fuzzy channels composed of blocks and tx(6:4) (where x=0,1,2) are read out from input of the
„fuzzy_x” (where x=0,1,2). block “address_generatorx” (where x=0-7) and
The appearance of the high state on the input “enable” corresponding to them values of membership functions
of fuzzy_x (where x=1,2,3) blocks begins the fuzzification from input mix0, mix1 (where x=0,1,2) are also read.
process. A sharp value of the input signal „input(7:0)” TABLE 2. THE VALUE OF STATE IN BLOCKS „ADDRESS_GENERATORX”
generates the address of memory, which indicates the (WHERE X=0-7), WHERE VALUE IF INPUT LINGUISTIC VARIABLE: X0 –
appropriate discreet sample of the point of the rule (T0=100, µ0=6;T1=011, µ1=94), X1 – (T0=000, µ0=84; T1=001, µ1=16),
X2 – (T0=010, µ0=100; T1=011, µ1=0)
activation stored in the memory of the block „fuzzy_x”
(where x=0,1,2). This discreet sample contains two 8-bit b2 b1 b0 mi2 mi1 mi0 Read out codes Address
value of the point of the rule activation (µ0, µ1) and two 3 0 0 0 100 84 6 010 000 100 010000100

– bit codes of fuzzy sets (T0,T1). In the memory of the 0 0 1 100 84 94 010 000 011 010000011
0 1 0 100 16 6 010 001 100 010001100
block „fuzzy_x” altogether 256 of such samples
0 1 1 100 16 94 010 001 011 010001011
describing the input linguistic variables are stored. 1 0 0 0 84 6 011 000 100 011000100
Reading a 3 - byte value of the sample from the memory 1 0 1 0 84 94 011 000 011 011000011
and transferring it to the output mi0, mi1,t of block 1 1 0 0 16 6 011 001 100 011001100
“fuzzy_x” finishes operations of fuzzyfication. Next these 1 1 1 0 16 94 011 001 011 011001011

data are transferred to the inference block (b_inf).


The creation of the address of the conclusion causes
based on the steering signal “e_rom” coming from the
block “control” (fig. 5) parallel initialization of eight
blocks of 8 – bit rule memory. In this memory containing
512 bytes (fig. 6), the conclusion codes are stored at
precisely determined address, which values correspond to
premises of activated rules.
During the reading of indicated codes of rule
conclusion, the block “control” initiates an action of 8
blocks - “min”. These blocks (“min”) perform operations
of the type MIN, which relies on choice of the smallest
value of the membership function. The result of operation
- “MIN” is transferred to the output “min_out”. Reading
out the codes of the conclusion from blocks “rom” and
Fig. 6. The part of inference block. parallel performing the operation of the “MIN” type by
C. Inference block blocks “min” begins the operation of aggregation
The inference block shown in fig. 5 consists of eight (“MAX”). In the proposed fuzzy system for each of initial
parallelly connected blocs „address_generatorx” (where output fuzzy sets, the block MAX is assigned. The tasks of
x=0-7), „min” and „rom” (fig. 6). A high state of the this block are calculations (choice) of the greatest value
steering line “e_gen” coming from the block “control” of activated output fuzzy sets.
begins the inference process; to the block D. Defuzzification
“address_generatorx” (where x=0-7) 3 - bit codes of active The task of block „defuzzx” (where x=0,1) is a
fuzzy sets are introduced, through 8-bit inputs in the range determination of the resulting output variable in the form
tx(2:0) and tx(6:4) (where x=0,1,2) and are also of concrete sharp real number based on output values of
introduced corresponding to them values of membership aggregated fuzzy sets. In the defuzzification process a
functions through inputs mix0, mix1 (where x=0,1,2). The CoGS (Center of Gravity for Singletons)(1) was used:
task of each block “address_generatorx” (where x=0-7) is
appropriate connection of shown inputs to the outputs of
the block based on individual 3- bit code with weights -
b2,b1,b0 written in the memory. These weights

Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY TIRUCHIRAPALLI.


407 Downloaded on September 18,2023 at 11:33:49 UTC from IEEE Xplore. Restrictions apply.
n
addressing technique requires writing of rule conclusions
~ ¦h * y
i 1
i i
(1) in strictly determined address in the system memory, what
y n increases the time necessary to form the rule base.
¦hi 1
i

~
where y - sharp value of output linguistic variable, , hi
– values of membership function for output singletons, yi
– values of locations of output singletons. In hardware
realization, the defuzzification process is performed
parallelly for two output channels in defuzzx (where
x=0,1) blocks. Next this result is transferred into the
block controlling the drive of the wheelchair motors.

IV. SIMULATIONS AND TESTING


Proposed digital parallel fuzzy system was described in
language of the description of equipment VHDL, and was
simulated in the Activ- Hdl environment of the Aldec
company. For this purpose in the memory of the system
the values of the membership functions of the fuzzy sets as
well as the table of rules were written. Next the test values Fig. 7. Part of simulation process in rule inference block of the
of input linguistic variables x0, x1, x2 were introduced proposed fuzzy system where: „state” – state of counter La in block
(tab 3). „control”, „x0”, „x1”, „x2” – input linguistic variable, „t” – codes of
TABLE 3. EXAMPLES OF NON-FUZZY SHARP AND FUZZY VALUES OF INPUT activated input fuzzy sets, „adressx” (where x=0-7) – addresses of
VARIABLES: X0, X1, X2 conclusion, „t0_out, t1_out” – codes of conclusion from first block
Input Sharp Fuzzy value Codes „rom”.
linguistic value P0 P1 T0 T1
variable ACKNOWLEDGMENT
x0 252 6 94 100 011
The authors are grateful to the anonymous referees for
x1 8 84 16 000 001
their valuable comments, which have improved the
x2 128 100 0 010 011
presentation of this contribution.

Based on test input values a simulation of the inference REFERENCES


process of the proposed digital parallel fuzzy system (tab.
[1] M. Kalus, T. Skoczkowski: Sterowanie napĊdami
3) was performed (fig. 7). The results of the simulation asynchronicznymi i prądu staáego Gliwice 2003.
confirmed correct parallel operation of blocks: “fuzzy_x” [2] A. Piegat, Modelowanie i sterowanie rozmyte, Akademicka Oficyna
(where x=0,1,2), “address_generatorx” (where x=0-7), Wydawnicza EXIT, Warszawa, 1999.
”rom” and “max”. [3] R.R. Yager, D.Filev, Essentials of fuzzy modeling and control,
USA, New York, 1994.
In the second stage of testing, the proposed fuzzy
[4] M. J. Patyra, J. L. Grantner, Hardware implementaions of digital
system was programed in FPGA circuit Spartans 3 [7]. fuzzy logic controller, Elesiver Information Science 113 (1999) pp.
Results of measurements confirmed again correct 19-54.
operation of the system. The time of system processing [5] F. Vidal-Verdu , M. Delgado-Restituto, R. Navas, A. Rodriguez A
design approach for analog neuro/fuzzy systems in CMOS digital
was tp=0,4[Ps] at the clock frequency 50[MHz]. technologies, Computers and Electrical Engineering 25 (1999)
Additionally a speed of proposed fuzzy system, – that is [6] L. J. McDaid, T. M. McGinnity, L. P. Maguire BiCMOS
the number of processed rules in a time unit was implementation of a fuzzy system, Computers & Electrical
Engineering 24 (1998)
determined. In the proposed system for number of 2*8
[7] http://direct.xilinx.com/bvdocs/publications/ds099.pdf -
rules (at tp=0,4 Ps), the speed of processing was 2*20 “XC3S1000” , Technical documentation, Xilinx.
[MFLIPS] (mega fuzzy logic inferences per second). [8] Altium-LiveDesign
Using the technique of addressing [9][10] in the “LiveDesign_Eval_Board_Tech_Ref_Manual.pdf”
inference process, allow for very quick selection of only [9] D. Falchieri, A. Gabrielli, E. Gandolfi, M. Masetti, Very fast VLSI
fuzzy processor: 2 inputs 1output, Fuzzy Sets & Systems,
the active rules from the base of many rules. In the November 2002, Volume/Issue 132/2 pp. 261-272.
proposed parallel fuzzy system reading the 8 conclusions, [10] Davide Falchieri, Alessandro Gabrielli, Enzo Gandol Very fast rate
as well as calculation of the degree of activation of rules 2-input fuzzy processor for high energy physics Italy Fuzzy Sets and
was performed during only 4 clock cycles [fig. 7].Used Systems 132 (2002) pp. 261 – 272

Authorized licensed use limited to: NATIONAL INSTITUTE OF TECHNOLOGY TIRUCHIRAPALLI.


408 Downloaded on September 18,2023 at 11:33:49 UTC from IEEE Xplore. Restrictions apply.

You might also like