4.1. Manual Tuning of a Digital PID Controller
Imagine the following use case: one desires to implement a digital control algorithm in an HDL language for a given power stage, but the power stage is not yet manufactured. Therefore, only its design parameters are known: topology (synchronous or asynchronous), inductance, capacitor, component parasitic (diode serial resistance, forward voltage, etc., or
RDS(on) of the MOSFET transistors, ESR of inductance and capacitor less) are known. Generally, the first step is modeling. As the power stage is modeled as an analog circuit, but the control loop is sought to be implemented with digital technology, it is difficult to choose an adequate modeling environment. A first choice is to use a system modeling environment, such as MATLAB/Simulink [
19]. This is a powerful tool that (i) can be interfaced with HDL simulation tools, (ii) allows the modeling of active and passive electrical components, and (iii) has support for many signal processing and conditioning components. Another way is to use a mixed-signal design flow from an EDA vendor.
Mixed-signal design environments usually can simulate electrical circuits and HDL code together. Both MATLAB and mixed-signal design flows are closed source, expensive software tools.
As pointed out in previous sections, the buck power stage can be modeled using any HDL languages, and event-driven logic simulators yield accurate results. Thus, we propose to carry out the modeling of both analog and digitals sections in an event-driven logic simulator. A PID controller was designed to demonstrate the ease of use, and manual tuning was carried out to find out the PID controller parameters.
A popular adaptive algorithm for power converter control employs PID control [
20].
Figure 7 shows the diagram of a buck converter with a PID controller. The PID regulator compares the value of the voltage measured at the output of the
vout(
t) power stage, digitized through a digital-to-analog converter, with the reference value specified
Vref. The converter works with a sampling frequency equal to 1 MHz. 10 samples are averaged, so the input of the PID controller is
vout[
n] at the frequency of 100 kHz. Then, the error
e[
n] is processed to calculate the duty cycle of the PWM modulated signal
d(
t) controlling the power stage. The error signal is processed by the proportional, integrative and derivative blocks, resulting in
p[
n],
i[
n] and
d[
n] signals, respectively.
The “proportional” block computes the proportional component of the setting, having the computing formula:
The integration performed by the “integration” block is represented by the equation:
where
acc[
n] represents the accumulated value of the integrative component and is calculated by:
The “derivative” block computes the derivative part by implementing the relation:
The components in
Figure 7 were described in VHDL. The parameters of the power stage are summarized in
Table 4. In the analog section, the numerical values were represented using floating-point representation. Note that this section is not intended to be later synthesized. The boundaries between the analog and digital sections are marked by the pulse width modulator (noted PWM in
Figure 7) and analog-digital converter (ADC). The sampling frequency of the converter is
Fsampling, while the switching frequency of the pulse width modulator is
Fswithcing. The digital section can use fixed-point numerical representation instead of power and aria-hungry floating-point presentation, as the ADC has a finite resolution anyhow. In the actual VHDL description, we used 32 bits wide signals, 22 bits for the integer part and 10 bits for the fractional part (basically, a scaling factor of 2
10 was applied). The PID controller was manually tuned, obtaining the values in
Table 5.
Several analyses were carried out using the gHDL logic simulation: buck startup/soft-startup, load regulation and line regulation. These results are presented in
Figure 8.
Figure 8a shows the response of the PID converter at start-up for an input voltage of 12 V and a load of 2 Ohm. If the “soft start” function is not activated, the voltage at the converter output has an overshoot of 1.16 V and a stabilization time of approximately 4 ms. With the “soft start” function active (by slowly varying the reference voltage
Vref), the voltage increase is negligible.
In
Figure 8b, the result of the “load regulation” analysis is presented. At 5 ms, the load changes from 2 Ohm to 4 Ohm, and at 20 ms, it changes to 2 Ohm. The supply voltage is 12 V. The undershoot and overshoot at the load variation are less than ±3% of the desired voltage value of 3.3 V.
Figure 8c presents the result of the “line regulation” analysis with a constant load of 2 Ohm. If the supply voltage changes at 4 ms, the
Vin supply voltage changes from 12 V to 16 V, and at 8 ms, it changes back to 12 V. The overshoot at the variation of the supply voltage is 475 mV, and the undershoot increase is 273 mV.
4.2. PID Controller Implementation on FPGA
Let us imagine another use case: one desires to implement a digital control algorithm for an off-the-shelf (COTS) buck power stage, i.e., TI’s Digital Power Buck Converter BoosterPack [
21] using a FPGA. Nowadays, even FPGAs incorporated ADC. Thus, it is recommended to select one with this feature. Our choice was a low-cost evaluation board CMOD-S7 [
22] equipped with 7th Series Spartan FGPA by Xilinx, 7s25csga225-1. A hardware emulator modeling the Digital Power Buck Converter BoosterPack was developed as a first step of the design. For the sake of this example, let us suppose that the hardware emulator was necessary because a long shipping time of the actual power stage hardware was too long, so in its absence, development had to be carried out without it.
The experimental setup is depicted in
Figure 9. The BoosterPack consists of a synchronous buck power stage and other complementary circuits for: (i) driving the high and low side switches
Q1 and
Q2; (ii) measuring the inductor current
iL; and (iii) creating a feedback voltage
Vfb with the use of a resistive voltage divider.
The CMOD-S7 dev board is used to implement the digital control loop consisting of: (i) an ADC converter fitted in FPGA SoC; (ii) the digital PID controller; (iii) a digital PWM generator; (iv) a Virtual Input/Output (VIO) Interface—a Xilinx intellectual property (IP) [
23]—connected to a host computer by a JTAG over USB port; and (v) the power stage emulator. The feedback voltage
Vfb is lowpass filtered to prevent aliasing effects. In addition to filtering a voltage limiting is inserted as the dynamic range of the internal ADC is 1 V. A programmable load is connected to the output of the power stage, allowing the simulation of a changing load. A programmable voltage supply is used to sweep
Vin, the input voltage, and a multimeter is connected to
Vout, the voltage output of the power stage. The host computer is running the VIO application, thus the user can programmatically set the reference voltage
Vref. This way the user can effectively set the desired output voltage. Moreover, the VIO interface allows the user to set the PID controller’s coefficients
Kp,
Ki and
Kd., and thus the PID controller can be configured. The VIO facilitates the selection of two paths with the use of a multiplexer: a controller tuning path, where the hardware emulator takes the place of the actual power stage, and an online operation path, when the actual power stage is connected to the control loop.
When the actual power stage arrived, the setup in
Figure 10 was assembled. With the PID controller already tuned, the user can switch to online operation mode. The setup is ready, and measurements can be conducted. The COTS components are highlighted and numbered in the figure.
In
Figure 11, we present the result of three tests: we varied the reference voltage,
Vref to 1.2 V, 1.8 V and 3.3 V, while the input voltage,
Vin, was swept between 7 V to 14 V with a step of 0.1 V. The output voltage of the converter was as required, and the voltage ripple was measured and plotted. The same measurement was carried out with the power stage’s reference digital voltage mode control. As a conclusion, one can state that the designed PID controller has slightly higher ripple then a standard voltage mode control, but the order of magnitude is the same.