Fuzzy Logic PID Controller Based On FPGA For Process Control
Fuzzy Logic PID Controller Based On FPGA For Process Control
Abstract
In this paper. a fuzzy proportional integral derivative (PID) controller, which is fabricated on a Field Programmable
Gate Array (FPGA). is proposed to conitrol an ilndustrial process. The fuzzy logic is provided to tune the PID parameters
by using a gain scheduhng method. The tuning scheme is represented by a fuzzy svsten. which consists of
fuzzification, rule inference and defuzzification. The fabricated FPGA chip, XC2S50-Stq-144. is embedded with the
fuzzy system. which the chip is called fuzzv-PID controller. The fuzzy-PID controller is contained several circuits, such
as multiplier, adder, subtraction and some of the otlher logic gate. The controller system uses two converter cards:
TDA8763AM/3 (10 bits, high speed) to convert from analog to digital signal, DAC08 (8 bits) to convert from digital to
analog. The maximum speed of the controller about 2.1 psec per action at 40.550 AIH.Z. is calculated from timing
summary. The fuzzy-PID controller based on FPGA is verified by using to control model of lev,el and temperature
process. From the experimental results of the level and temperature control. the fuzzy-PID controller lhas achieved and
shown the better performance than stanidard PID controller E50AK. which is automatic tuneable parameter system.
Keywords
FPGA, PID, Fuzzy- logic, Process control. Fuzzy-PID controller.
-
the following:
wlhere AT denotes the sampling period, FrY is controller 11i
Zo = v
l/Z (5)
output at the nth sampling instant and e, is error at the ;ith V
sampling instant.
wlhere , and zv are the weiglht (value) and center (in the
From Eq. (1) and (2), the digital PID is formulated as Eq. universe of discourse). respectively. The output of the
(4). fuzzxv inference engine is Z.v which is a crisp set.
IRo =1Ti'
0 0,
+(K +XK
p
+Kd)e
a'f n
-(K, +2K4)en-l++Kde.-'
e de
(4)
4
2.3 Fuzzy gain scheduling
According to the methodology proposed by Zhao et al.
where K, = KpVT/T and Kd = KpTd/VT [3]. the three cunrent PID parameters are determined as
following.
2.2 Fuzzy Logic Kp= (Kp, ma,~
) K; + Kpn, l
1496
values of Kp and Kd½ which have the values in the range FPGA. Thus, all of operators consist of 3 circuits that
of zero and one. These constants are determined by the are: full adder, which has 3 inputs at each input has 20
following rule of thumb. bits, full adder, which has 2 inputs at each input has 10
Kp,min = 0.322K,, Kp,m = 0.6K. bits, and multipliers, which has 2 inputs at each input has
(7) 10 bits. Each process is controlled by state machine.
Kd,min 0.08KT, Kdm, = 0. 15K4T0 which related to clock signal.
K2, and T, are the gain and the period of oscillation at the
stabilitvh limit under proportional control, respectivel.
Processl Process2 Proce ss 3
The input e(t) and Ae(t) of the fuzzv module use seven
triangular membership functions. The output K 'p and K'd
use two exponential membership functions: meanwhile. V ;4K~e I K.+T;' a A
ac uses four singleton membership functions. The fuzz's
rule-base is determined with heuristic based on the step
response of the process. Thus, the sets of rule-base are (g) / i + 2Kg .) e,?. + K,, eii+ [ T?'
[ o = (X + K + K'). e 'K-
slhown in table 1 (for K 'p). K 'd and a are shown in table
2 and table 3, respectively. Figure 2: The process within digital PID processor.
3.2 Fuzzy - PID Processor
Table 1: Fuzzy tuning rules for K'0
Ae(t) Fuzzy-PID processor. XC2S50-5tq-144, is designed with
NB NM NS ZO PS PMJ PB the fuzzx gain schleduling metlhod [3]. which consists of
NB B B B B B B B
NM S B B B B B S two inputs (e(t) and Ae(tb) of the process. Each input
NS S S B B B S S uses seven triangle membership functions. which
e(tj zo s s s B S S S
PS
PM
S
S
S
B
B
B
B
B
B
B
S
B
S
S
provide to formulate PID parameters: Kp, Kd and ua. The
PB B B B B B B B six triangle membership functions are used to assign
output variables (Kp and Kd). oc uses five singleton
Table 2: Fuzzy tuning rules for K d membership functions. Figure 3 and 4 are shown the
Ae(t) membership functions of inputs and outputs. The fuzzy
NB
NB
S
NM
S
NS
S
ZO
S
PS
S
PM
S
PB
S
rules are heuristically determined based on the step
NM B B S S S B B response of process.
NS B B B S B B B
e(t) ZO
PS
B
B
B
B B
B B B B B NB NM NS ZO PS PM PB
S B B B
PM B B S S S B B
PB S S S S S S S e(t)
or
Aeft)
Table 3: Fuzzy tuning rules for oc Figure 3: Membership function for e(t) and Ae(t)
Ae(t)
NB NM NS ZO PS PM PB Z VS S M B VB
NB 2 2 2 ' I 2
NM 3 3 2 2 2 3 3
NS 4 3 3 2 3 3 4 Kp
or
e(t) Zo S 4 3 3 3 4 5 o
PS 4 3 3 2 3 4 Kd
PM
PB
3
2
3
2
2
2
2 2
2
3 3 Figure 4: Membership function for Kp and Kd
The linguistic variables of Figure 3 and 4 are given as
3 METHODOLOGY following:
NB: Negative Big: NM: Negative Medium:
3.1 PID processor NS: Negative Small: Z: Zero,
The digital PID processor is embedded on chip FPGA. PS: Positive Small: PM: Positive Medium:
which uses algoritlun of digital PID equation. The block PB: Positive Big, VS: Very Small:
of diagram is shown in figure 1. Let SP and PV be 10 S: Small: M: Medium!
bits, k-p. Ki and Kdbe 8 bits, and VO be 12 bits. B: Big: VB: Very Big.
8 bit 8 bit 8 bit
Figure 5 shows block diagram of fuzzy processor.
Fuzzification blocks use the Look Up Table (LUT)
10 bit K, K- Kc technique to transfer crisp value to fuzzy value (Notice:
SPF
10bit Digital PID Processor the degree of overlap between membership function does
12 bit not exceed two functions). The block of rule inference
Figure 1: Block diagram of digital PID processor. are used to approximate of reasoning, which corresponds
with variables of inputs and outputs. Defuzziflcation
The internal mechanisms of digital PID processor consist block uses to convert fuzzy output to crisp value by
of 3 processes as shown in Figure 2. Process 1. 2 and 3 using COG method that shown in equation (5). All block
are a sharing operator in order to reduce gate number of is controlled by clock signal.
1497
processor is operating to compute the parameters p4 Kd?
and K,: the processor uses 16 clock signals for nmultiplier
3 clock signals for adder, 56 clock signals for division. 5
clock signals for PID processor and some of the other
uses 5 clock signals. The block diagran of the fuzzy-
PID controller is shown in figure 9, which consist of
ADC. DAC and fuzzy - PU) processor.
4 bit h t
MF t - ?t RuleO
t Fuzz Rule
1498
Tables 4 and 5 show fuzzv nile-base of Kp and Kd, which Table 7: Fuzzy rule-base forK, of temperature control.
use the membership functions in Figure 3 and 4. The Ae(i)
linguistic variables are defined separation of interval of NB
NB
VB
NM
VB
NS
VB
ZO
VB
PS
VB
PM
VB
PB
VB
Kp and Kd. The fuzzv rules of a are slhown in table 6. NM
NS
S
VS
M
S
B
M
VB
VB
B
M
M
S
S
VS
Table 4: Fuzzy rule-base for K, of level process control.
e(t) Zo
PS
Z
Z
z
VS
z
S
MB Z
S
Z
VS
Z
Z
PM Z S M B M S Z
Ae(W) PB VB VB VB VB VB VB VB
NB NM NS ZO PS PM PB
NB VB VB VB VB VB VB VB
NM Z B S VB S B Z Table 8: Fuzzv rule-base forLd of temperature control.
NS Z VS VS VB VS VS Z
zo
PS Z
z z
VS
VS
VS
VB
VB
VS
VS
VZ
VS
Z NB NM
Ae(t)
NS ZO PS PM PB
Z
PM Z B S VB S B Z NB Z Z Z Z Z Z Z
PB VB VB VB VB VB VB VB NM NI S VS Z VS S Z
NS B M VS S VS M B
e(t) zo VB VB VB VB VB VB VB
Table 5: Fuzzy rule-base for LTd of level process control. PS
PM
VB
VB
VB VB M VB VB VB
VB M S M VB VB
Ae(t) PB B B B B B B B
NB NM NS ZO PS PM PB
NB Z Z Z Z Z Z Z
NM
NS
VB
VB
VB
B
VS
B
Z
Z
VS
B
VB
B
VB
VB
4 EXPERIMENTAL RESULT
e(t) Zo VB VB VB VB VB VB VB
PS
PM
VB
VB
B
VB
B
VS
Z
Z
B
VS
B
VB
VB
VB
4.1 Simulation Results
PB Z Z Z Z Z Z Z
The fabricated processor is verified by simulation, wh1ich
uses the application program ModelSimXE. The
Table 6 Fuzzy} rule-base for (x . simulations of fuzzy-PID processor to observe the
Ae(t) changing of parameter are slhown in figure 12.
NB NM NS ZO PS PM PB
NB 2 2 2 2 2 ..
.W . W ......
.^s [email protected]
NNM 3 3 2 2 2 3 3
NS 4 3 3 2 3 3 4
e(tJ Zo 5 4 3 3 3 4 5
PS 4 3 3 2 3 3 4
PM 3 3 2 2 2 3 3 .0sr
PB 2 2 2 2 2
1499
Figure 15. The response of standard PID controller to photographs of equipments, that use to experiment, are
control temperature at 50 °C is shown in figure 16. slhown in figure 16 and 17.
p`K~
, I's,
/ .:.>Y -..:
L.
/l
1
The efficient of controllers are shown in table 9. which is pp. 1 17-143, 1982.
compared both level and temperature controllers. The [6] A. Visioli, "Tuning of PID controllers with fuzzy
logic.*' IEE pr-oc.-Control Theory Appl.. Vol.
148.No.1, 2001.
1500