FPGA Implementation of PID Controller For The Stabilization of A DC-DC "Buck" Converter
FPGA Implementation of PID Controller For The Stabilization of A DC-DC "Buck" Converter
FPGA Implementation of PID Controller For The Stabilization of A DC-DC "Buck" Converter
1. Introduction
Actually the development of control systems in embedded systems presents a great advantage
in terms of easy design, immunity to analog variations, possibility and implement complex
control laws and design a short time (Mingyao Ma et al., 2010). One of the devices that
allows embedded systems arrangements are eld-programmable gate array (FPGA). Several
advantages of using FPGAs in industrial applications can be seen in (Joost & Salomon, 2005).
The use of FPGAs to implement control laws of various systems can be observed in different
articles. In (Hwu, 2010) performance a technique based on a eld programmable gate array
to design PID controller applied to the forward converter to reduce the effect of input voltage
variations on the transient load response of the output converter. The main characteristic of
this technique is the on-line tuned parameters of the PID controller. To validate the topology
implemented, they designed a forward converter with an input voltage of 12V, and output
dc voltage of 5.12V with a rated output DC current of 10A and a switching frequency at rated
load of 195 kHz. The results show than the measured transient load response has no oscillation
with on-line tuning applied to the controller.
In the work of LI et al. (Bo Li et al., 2011) presents a digital pulse-width-modulator based
sliding-mode controller and FPGA for boost converter. The proposed model they used
was higher order delta-sigma modulator. The problem with this modulator is the stability
problem. To resolve this problem they implemented a Multi-stage-noise shaping delta-sigma
DPWM (MASH sigma-delta DPWM). To verify the function of the proposed controller they
implemented a boost converter connected to a Virtex-II Pro XC2VP30 FPGA with and Analog
to digital converter as interface. The experimental results show than the MASH sigma-delta
DPWM has a faster recovery time in load changes, compared with a PID controller.
In (Mingyao Ma et al., 2010) proposed a FPGA-based mixed-signal voltage-mode controller
for switching mode converters. The architecture of the scheme consists of a DPWM generation
with a PID controller implemented on FPGA, a DAC and a comparator. The switching mode
converters state variables are digitalized via an ADC to the PID controller. The control signal
goes to the DPWM module to generate the PWM waveforms. They implemented the PID and
the DPWM on a Cyclone II series EP2C25, in other hand; they implemented a single phase
216
2
full-bridge inverter like the switching mode converter to test the architecture of the controller.
Their architecture allows integration of a control system in FPGA.
An implementation of PID controller on FPGA for low voltage synchronous buck converter
is presented in (Chander et al., 2010). They use MATlab/Simulink for the PID controller
design to generate the coefcients of the controller. They did a comparison between
different coefcients to obtain a reasonable controller for the converter. The architecture was
implemented in FPGA Virtex-5 XC5VLX50T.
In this article, we will focus on the PID average output feedback controller, implemented in an
FPGA, to stabilize the output voltage of a buck" power converter around a desired constant
output reference voltage. The average control inputs are used as a duty ratio generator in
a PWM control actuator. The architecture control, used for the classical PID control, has the
following features:
The PWM actuator is implemented through a triangular carrier signal and a comparator.
The main function of this modulator is the average signal conversion to a pulsing signal
that activates and deactivates the converter power transistor, at a switching frequency of
48kHz.
The processing time control for the PID is 20.54s. This processing time were achieved
thanks to the parallel execution of units modeled within a FPGA Monmasson & Cirstea
(2007)-Rogriguez-Andina et al. (2007).
The output voltage is obtained through an Analog to Digital Converter (ADC), which is
the only additional hardware needed to operate to the controllers. The used ADC is the
ADC0820, which is an 8 bits converter.
The rest of the document is organized as follows: section 2 presents the mathematical model
of the buck" converter. The design of the PID control is shown in the section 3, while
the simulation of the PID control design is presented in section 4. The architecture of the
implemented control is found in section 5. The experimental results of the implementation
of the FPGA based controller, are found in section 6. Finally, the conclusions of this work are
given section 7.
(1)
where i L represents the inductor current and v0 is the output capacitor voltage. The control
input u, representing the switch position function, takes values in the discrete set 0, 1. The
system parameters are constituted by: L and C which are, respectively, the input circuit
inductance and the capacitance of the output lter, while R is the load resistance. The external
voltage source exhibits the constant value E. The average state model of the buck converter
circuit, extensively used in the literature (a) Linares & Sira, 2004; b) Linares & Sira, 2004;
FPGA
Implementation
Controller
forBuck
the Converter
Stabilization of a DC-DC Buck Converter
FPGA Implementation
of PID Controllerof
for PID
the Stabilization
of a DC-DC
2173
Linares et al., 2011; Sira & Agrawal, 2004) may be directly obtained from the original switched
model, (1), by simply identifying the switch position function, u, with the average control,
denoted by u av . Such an average control input is frequently identied with the duty ratio
function in a Pulse Width Modulation implementation. The control input u av is restricted to
take values in the closed interval [0, 1]. From (1), the buck converter system is clearly a
second order linear system of the typical form: x = Ax + bu and y = c T x.
iL
L
E
+
Vo
0 L1
1
1
C RC
E
(2)
cT = 0 1
Hence, the Kalman controllability matrix of the system C = [b, Ab], is given by:
E
0
C= L E
0 LC
(3)
The determinant of the controllability matrix is ( LE2 C = 0). Therefore, the system is controllable
(Dorf & Bishop, 2011), now we design a classic PID control in the following section.
E
LC
1
1
RC s + LC
(4)
1
+ Td s)
Ti s
(5)
E
(K p Td Ti s2 + K p Ti s + K p )( LC
)
1
s3 + ( RC
+
EK p Td 2
LC ) s
(1+ EK p )
EK
s + LCTpi
LC
(6)
218
4
E(s)
+-
U(s) Buck
Vo(s)
PID
Converter
Controller
EK p Td 2 (1 + EK p )
EK p
1
+
)s +
=0
s+
RC
LC
LC
LCTi
(7)
The coefcients K p , Ti and Td are chosen so that (7) becomes a third order Hurwitz polynomial
of the form (Dorf & Bishop, 2011; Ogata, 2010):
p(s) = (s2 + 2n s + n 2 )(s + )
(8)
Equating the characteristic polynomial coefcients (7) with those of the desired Hurwitz
polynomial (8), we obtain the following values of the parameters for the PID controller,
2n LC + n 2 LC 1
E
EK p
Ti =
LCn 2
LC
1
Td =
( + 2n
)
EK p
RC
Kp =
(9)
FPGA
Implementation
Controller
forBuck
the Converter
Stabilization of a DC-DC Buck Converter
FPGA Implementation
of PID Controllerof
for PID
the Stabilization
of a DC-DC
2195
220
6
Fig. 6. Simulink block with the inputs and outputs of the PSIM circuit.
FPGA
Implementation
Controller
forBuck
the Converter
Stabilization of a DC-DC Buck Converter
FPGA Implementation
of PID Controllerof
for PID
the Stabilization
of a DC-DC
2217
222
8
Fig. 10. Output voltage of buck converted with a desired voltage of 4 V in cosimulation.
Now, we must dene an efcient design methodology and the abstraction level to model the
system, and choose an appropriate sampling period and the suitable format for coefcients
and variables.
The PID controller design is based on a hierarchical and modular approach using Top-Down
methodology (Palnitkar, 2003), where the modules can be dened with diverse levels of
abstraction. Thus, for this design the schematic description was chosen as top level and
the controller components were modeled with the VHDL hardware description language
(using a behavior level modeling). Previous analysis and simulations showed that due
to the range of results generated by the operations involved in the discrete controller is
necessary to use a oating point format; for this intention, the IEEE Standard for Binary
Floating-Point Arithmetic, IEEE Std 754-1985 (IEEE, 1985) was chosen. Now, based on
top-down methodology, an initial modular partitioning step is applied on the FPGA-based
PID controller, this process generate four components, Clock manager, ADC control, Control
law and PWM generator (see Fig. 11).
The PID controller work with a frequency of 50 MHz (Clk_PID). The Clk_main signal is
generated from Clk_main signal by the Clock manager component. The principal element of
this component is the Digital Clock Manager (DCM). The DCM is embedded on the Spartan3E
FPGAs families and it provides exible complete control over clock frequency, maintaining
its characteristics with a high degree of precision despite normal variations in operating
temperature and voltage. The DCM provides a correction clock feature, ensuring a clean
Clk_PID output clock with a 50% duty cycle.
FPGA
Implementation
Controller
forBuck
the Converter
Stabilization of a DC-DC Buck Converter
FPGA Implementation
of PID Controllerof
for PID
the Stabilization
of a DC-DC
2239
Clock
manager
Clk_PID
Clk_main
Clk_PWM
PWM
generator
Control
law
System
System
output
ADC
control
ADC
Signal
conditioning
Sensor
Float-point encoder
8
32
FP_Rdata
data_ADC0..7
data_OK
ADC0820
data_in0..7
CLK
RD
INT
DB0..7
/RD
/INT
CLK
t
0
( F (t) F (t))dt + Kd
d( F (t) F (t))
dt
(10)
224
10
where Ki =
Kp
Ti
and Kd = K p Td .
(12)
The Fig. 13 shows the proposed architecture for discrete approximation of a continuous
integral given by (12).
Stage 3
Stage 4
Stage 5
Stage 6
Stage 7
Stage 8
Cte=3
?t/2
F [n]- F [n]
F [n + 1]
I(31:0)
O(31:0)
I(31)
O(31)
I(30:0)
y
y [ n ] y [ n 1]
)n
t
t
( F (t) F (t))
,
t
(13)
using the nite differences
(14)
The Fig. 14 shows the proposed architecture for discrete approximation of a continuous
derivative given by (14).
The architecture consists of six multipliers and six adders. Then, it is necessary to implement
single-precision oating point custom-adder and custom-multiplier.
225
11
FPGA
Implementation
Controller
forBuck
the Converter
Stabilization of a DC-DC Buck Converter
FPGA Implementation
of PID Controllerof
for PID
the Stabilization
of a DC-DC
Stage 4
Stage 5
Stage 6
F [n]
F[n]
?t
I(31:0)
I(31)
O(31:0)
O(31)
I(30:0)
F[n-1]
Fig. 14. Block diagram of the discrete approximation of a continuous derivative.
The Xilinx ISE Design Suite 12.2 includes the CORE Generator tool, which allows generating
pre-optimized elements for Xilinxs FPGA. Our controller architecture uses multipliers and
adders of single-precision oating-point, standard Std-754, generated by this tool. The
symbols of the multiplier and adder generated by the CORE Generator tool are showed in
the Fig. 15.
Fig. 15. Adder and Multiplier modules generated for Xilinx CORE Generator tool.
The proposed PID controller architecture is composed of 10 pipeline stages (see Fig. 16) and
each of them needs 100 cycles to fulll its function (2 s), this indicates that the processing
time of one data is 20 s (time between 2 consecutive data delivered by the controller to the
next component, the PWM). The enable signals (Stage_enable0..9) have the control each one
of the pipeline registers that composed the proposed architecture.
Stage 1
Stage 2
Stage 3
Stage 4-7
Stage 8
Stage 9
Stage 10
Kp
Fd
ADC0820
8
32
Kd
ADC control
normalization and
float-point encoder
Clk_main
Clock
manager
Ki
32
20
Floating-point
to fixed-point
conversion
To PWM
Fixed-point to 8-bit
unsigned binary
conversion
Clk_PID
Stage_enable
Fig. 16. Architecture proposed for the discrete PID controller implemented into the
Spartan-3E1600 FPGA.
In the last stage the PID controller output must be adequacy for the PWM module. This
adequation consists of Float-point to 8 bit unsigned binary conversion.
226
12
The last component of the proposed architecture is the PWM. The PWM component consists
of single up-down counter unit and one magnitude comparator unit (see Fig. 17(a)).
PWM Top
PWM component
A
Up-down counter
B
PWM Bottom
B?A
B<A
Clk_PWM
PWM
signals
Count value
From GPI
controller
PWM period
PWM period
GPI controller
output value
Time
(a)
(b)
CLK_PW M
25MHz
=
= 48.828KHz
2(maximuncount + 1)
512
(15)
The implementation result of the complete architecture for discrete PID controller are reported
in Table 1.
Mod.
1
Slices
Flip-Flops
4-inputs
Max. Freq
Pre-opt -elem.
-LUTs
(MHz)
1 BRAM (2 %)
1 DCM (12 %)
60.37
6. Experimental results
The PID control and the Pulse Width Modulator (PWM) actuator for the regulation of output
voltage of the buck converter were implemented in a Spartan 3E board. The only external
hardware connected to the FPGA for measuring the buck converter output voltage was the
analog digital converter ADC0820. Figure 18 illustrates the block diagram of the FPGA-based
control system based on PID controller.
6.1 Requirements of the PID controller
Figure 19 shows the open-loop response of the buck converter with the following
specications: L = 1mH, C = 100F, R = 100, E = 24V, f = 48.828KHz, v0 /v0 = 0.013%,
i L = 0.092 and a duty cycle D = 0.75. The output voltage response is a steady-state error of
5.56% and has a settling time of 15ms. On the other hand, we get that the diagram bode of the
transfer function given by (4) with the same parameters, has a gain margin Gm = In f (at
Inf rad/sec) and a phase margin Pm = 0.377deg (at 1.58 104 rad/sec). Given that the
buck converter system has innite gain margin, it can withstand greater changes in system
parameters before becoming unstable in closed loop. Since the system has this characteristic,
we will design our controllers in closed loop with the following requirements: Overshoot
227
13
FPGA
Implementation
Controller
forBuck
the Converter
Stabilization of a DC-DC Buck Converter
FPGA Implementation
of PID Controllerof
for PID
the Stabilization
of a DC-DC
iL
L
E
D
Vo
GPI or PID
controller
PWM
ADC
Vref
FPGA
Fig. 18. Block diagram of the FPGA-based control system for PID controller.
less than 4.32%, Setting time less than 5 milliseconds, Steady-state error less than 1%, and
Maximum sampling time 40s.
20
Steady state error 5.56%
18
16
ts=15ms
Voltage [V]
14
12
10
8
6
4
2
0
2
0.01
0.005
0.005
0.01
Time [s]
0.015
0.02
0.025
0.03
Fig. 19. Output voltage transient response of the buck converter with the PID control
scheme.
The PID controller gains obtained by the design requirements were:
K p = 0.15; Ti = 1.2 103 ; Td = 5.9 104
(16)
228
14
Figure 20 shows the performance of the PID control law, in the stabilization task for the buck
converter output voltage. As before, we used a constant reference of 18 V. The continuous line
corresponds to the PID controlled response. The settling time of the response of the buck
converter output voltage through the PID controller, is 13.64 ms. The PID controller tuning
was done through a third order Hurwitz polynomial.
Table 2 exhibits the performance of the synthesized controller. The main specications of the
transient response, the bandwidth of the PID controller (see Table 2), these frequencies are
calculated in the closed-loop through the damping ratio and settling time (Messner & Tilbury,
1999). The damping coefcient value is 0.707, while the value of settling time is: 13.64 ms.
22
Mp(%)=2.2% (PID)
20
18
Voltage [V]
16
14
ts(PID)=13.6ms
12
10
td(PID)=2.52ms
8
6
4
tr(PID)=4.00ms
2
0
0.01
0.005
0.005
0.01
Time [s]
0.015
0.02
0.025
0.03
Fig. 20. Output voltage transient response of the buck converter with the PID control
scheme.
Delay time
Rise time
Time of peak
Percentage of overshoot
Settling time
Bandwith
td
tr
tp
Mp
ts
B
2.52 ms
4 ms
6.24 ms
2.2 %
13.64 ms
414.85 Hz
229
15
FPGA
Implementation
Controller
forBuck
the Converter
Stabilization of a DC-DC Buck Converter
FPGA Implementation
of PID Controllerof
for PID
the Stabilization
of a DC-DC
25
Vo [V]
a)
Time recovery=70.1ms
20
15
10
6
Uav [V]
b)
5
4
3
0.02
0.02
0.04
Time [s]
0.06
0.08
0.1
0.12
Fig. 21. Output voltage response of the buck converter with sudden connection of a DC
motor.
7. Conclusions
In this work, we have applied the Proportional Integral Derivative control scheme,
synthesized via a Field Programmable Gate Array implementation, for the output voltage
regulation in a DC/DC power converter of the buck type. The performance of the PID
control action was synthesized via a FPGA. The results obtained by cosimulation allowed
to study each of the units designed and modeled in VHDL, correcting some errors and, in
addition, the cosimulation was a perfect tool allowing faster design process to get a full system
simulation before implement the system in the FPGA board. Also we conclude that the PID
controller has a good transient response. When we connect a static and a dynamic load to
the buck converter output, we observed that the PID control results in a signicantly faster
response, regarding the output voltage recovery time to the desired reference. Finally, the
experimental results show the effectiveness of the FPGA realization of both the PID controller,
in this case, programmed into the FPGA. This methodology of design can be used to design
switched mode power supplies with efciency greater than 95%.
8. References
Ascher, U. & Petzold, L. (1998). Computer Methods for Ordinary Differential Equations
and Differential-Algebraic Equations. SIAM: Society for Industrial and Applied
Mathematics.
Bo Li; Shuibao Guo; Xuefang Lin-Shi & Allard, B. (2011) , Design and implementation of the
digital controller for boost converter based on FPGA,IEEE International Symposium on
Industrial Electronics (ISIE), pp. 1549-1554.
Burden, R. & Douglas, F. (2000). Numerical Analysis. Brooks/Cuelo.
Chander, S.; Agarwal, P. & Gupta, I. (2010) , FPGA-based PID controller for DC-DC converter,
Power Electronics, Drives and Energy Systems (PEDES) & 2010 Power India, 2010 Joint
International Conference on, Dec. 2010, pp.1-6.
Dorf, R. C. & Bishop,R. H., (2011).Modern Control Systems.Twelfth Edition: Prentice-Hall.
230
16
Hwu, K. I. (2010). Forward Converter with FPGA-Based Selft-Tuning PID Controller. Tamkang
Journal of Science and Engineering, Vol. 13, No. 2, June 2010, 173-180, ISSN:1560-6686
IEEE Computer Society. (1985). IEEE Standard for Binary Floating-Point Arithmetic, IEEE Std
754-1985.
Joost, R. & Salomon, R., (2005). Advantages of FPGA-based multiprocessor systems in
industrial applications, Industrial Electronics Society, 2005. IECON 2005. 31st Annual
Conference of IEEE, Nov. 2005, pp. 445-450.
Linares-Flores, J. & Sira-Ramrez, H. (2004). DC motor velocity control through a DC-to-DC
power converter, Proc. 43rd IEEE Conf. Dec. Control, pp. 5297-5302.
Linares-Flores, J. & Sira-Ramrez, H. (2004). Sliding Mode-Delta Modulation GPI Control of
a DC Motor through a Buck Converter,Proc. 2nd Symposium on System, Structure and
Control, Mxico.
Linares-Flores, J.; Antonio-Garca, A. & Orantes-Molina, A. (2011). Smooth Starter for a
DC Machine through a DC-to-DC buck converter, Revista Ingeniera, Investigacin y
Tecnologa, Universidad Autnoma de Mxico (UNAM), Vol. XII, No. 2, April 2011,
ISSN: 1405-7743.
The MathWorks, Inc. (2008). Release Notes for Matlab R2008a.
Messner, W. C. & Tilbury, D. W., (1999). Control tutorial for matlab and simulink: A web-Based
Approach, Addison-Wesley.
Mingyao Ma; Wuhua Li & Xiangning He. (2010), An FPGA-based mixed-signal controller for
switching mode converters,IECON 2010 - 36th Annual Conference on IEEE Industrial
Electronics Society, Nov. 2010, pp.1703-1708.
Monmasson, E. & Cirstea, M. N., (2007). FPGA design methodology for industrial control
systems-A review, IEEE Transactions on Industrial Electronics, vol. 54, no. 4, August
2007, pp. 1824-1842.
Ogata, K. (2010). Modern Control Engineering. 5th Edition: Prentice-Hall.
Palnitkar, S. (2003). A guide to digital design and synthesis. 2nd Edition, USA: Printece-Hall.
Phillips, C. L. & Nagle, H. T., (1995). Digital Control Systems Analysis and Design, Third Edition:
Prentice-Hall.
Powersim, Inc. (2006). PSIM Users Guide
Rodriguez-Andina,J. J.; Moure, M. J. & Valdes, M. D., (2007). Features, design tools, and
application domains of FPGAs, IEEE Transactions on Industrial Electronics, vol. 54, no.
4, August 2007, pp. 1810-1823.
Sira-Ramrez, H. & Agrawal, S. K. (2004).Differentially Flat Systems,Marcel Dekker, New York.