PID controller using rapid control prototyping techniques

Received Jun 19, 2018 Revised Dec 18, 2018 Accepted Dec 29, 2018 To analyze the performance of the PID controller in a buck type converter implemented in real time. We begin by designing a continuous controller using the analytical method for calculating PIDs. Pulse width modulation is then used and bifurcation diagrams analyzed to reveal some problems of switching and sampling time. The model converter is then implemented with a PID controller in dSPACE. The experimental results provide detailed requirements of sampling frequency and switching speed, and show the performance of the PID controller. Converters are used in power generation solar systems and conmuted power sources for feed telecommunication devices, smart grids, and other applications.


INTRODUCTION
The buck converter is a switching power supply with two semiconductor devices [1], a transistor ( ) and diode ( ), an inductor ( ), an output capacitor ( ), and its respective load as shown in Figure 1. This system converts an unregulated DC voltage to another regulated lower voltage. The transistor switches the input power by pulse width modulation (PWM) to feed the filter . The diode conducts when the transistor is off if there is positive current in the coil. The inductor does not allow rapid changes in current and the capacitor does not support abrupt changes of voltage, creating between them a low pass filter. A MOSFET is used for switching, thus, the control technique must determine the OFF and ON switch times. This control form is known as pulse width modulation (PWM) [2]- [6]. Figure 2 shows a block diagram of the system under study. This system is divided into two major subgroups: the hardware that includes the physical and electronic components and the software implemented on a dSPACE, which performs the signal acquisition and implementation of PID control technique. The hardware consists of a sensors (high-impedance resistors connected in parallel) to measure the state variable (capacitor voltage). The converter's switch is handled from the control and development card through the PWM and the pulse is opto-isolated through fast optocouplers. The digital part is developed in the control and development card dSPACE DS1104 [7], where the PID control technique is implemented. PID was used due to its easy availability and compatibility with some series of PLCs, DCS software, Advantech 6022, and popular software such as LabView and MATLAB [8], [9]. The card is programmed using the MATLAB/Simulink® platform and has a display interface called "ControlDesk." The controller is implemented in Simulink® and downloaded to the DSP to operate at a given frequency [10]. The state variable comes to the controller through the 12-bit ADC input with a sampling rate set for the experiment at 10 kHz and then 30 kHz. The controller parameters are set through variable gain blocks because they were tuned in real time. At each sampling period, the controller calculates the duty cycle in real time and its equivalent in the PWM control switch. This article is intended for the digital PWM approach, which presents rich nonlinear dynamics and has the following advantages: immunity to analog component variations; faster process design; low sensitivity to changes in parameters; programmability; allows reduction or elimination of passive external components; allows calibration of protection algorithms; and supports digital system interfaces for implementing nonlinear control techniques [11]- [16]. However, the DPWM also has disadvantages as it is affected by two limitations: quantization effects [12], [13] and delays in the control loop [17], [18].

BUCK CONVERTER MODEL
Where is the internal resistance of the MOSFET ( ) plus the resistance source ( ) and the resistance coil ( ) plus the shunt resistor's resistance used for the current measure ( ) as shown in Figure 1. By summation of currents in the capacitor's node we obtain If the switch stays OFF (u=0), then the equation becomes X =AX because it does not take into account the diode's voltage.
In the case where the switch is closed, we find the transfer function using which yields (2) In (2), the following values will be replaced to find the system's response: The poles for (3) are The root locus is shown Figure 3. Therefore, the system is stable with the values used for constants and it is underdamped. The response to stepped E volts can be seen in Figure 4, which shows an overshoot that must be reduced and a steady-state error of about 2 volts, indicating the system is underdamped. In low-power buck converters, such as computer sources, it is usual to find a zener diode and transistor-based regulation of the converter output. This technique has the advantage of avoiding the use of control; however, it has the disadvantage of increasing the probability of failure on points where it handles the power output. To obtain the desired voltage with proper MOSFET handling and without adding elements that may fail in the converter output is the goal of implementing a controller.

CONTINUOUS PID CONTROLLER
The method used is known as the "analytical method." We start from the desired behavior as determined by the second-order canonical equation, which should match the characteristic equation of the closed-loop system with PID, to find the constants Kp, Kd, and Ki.

Second-order canonical equation (desired behavior):
Poles on:

Closed loop with unknown PID constants
Replacing the parameters in the transfer function and making a change of variables = 8739229, = 1372, and = 9191377, we must close the loop with unknown PID. Block diagram as shown in Figure 5. However, before matching the characteristic equations, we must first increase the degree of the second-order characteristic equation. This is achieved by adding a remnant pole to the characteristic equation so as to not affect the desired behavior; in this case, that is five times away from the dominant poles. This modification usually affects the amplitude, but the behavior of the canonical system is preserved: Thus, it is now possible to match the coefficients: Replacing these constants in the closed-loop transfer function, the simulation is then performed with a step value of E volts. Figure 6 shows that the controlled system does not reach the desired overshoot; however, it is normal to do some tuning, preferably when the controller is already modulated by the PWM so as to avoid double tuning. The settling time and the steady-state error are the desired outcomes.

DISCRETE TIME SYSTEM
For a continuous time, system, the general solution is given by Therefore, the solution in discrete time form is given by (4  ) The solution of Equation (4) Then, the solution of is (6) From (6) and applying Laplace's anti-transformation, we obtain the matrix : At this point, we probe that evaluated at = 0 is equal to the identity matrix. Knowing , an algorithm was implemented in MATLAB® to produce the discrete equivalent shown in Figure 7. The continuous time system has = 5.9 ms, so we can choose a sampling rate = 50 μseg. Initializing the necessary variables, we obtain the output shown in Figure 7. Thus, we can see how the discrete equivalent is very close to the real equivalent.

PID MODULATED BY PWM
The found constants will be used in this controller. Initializing variables and respective vectors to zero the output ( ) (load voltage) shown in Figure 8. We observe that the overshoot appears even higher than previously estimated; to reduce the overshoot, we follow Table 1 taken from [13], showing an online tuning form of PID, depending on the output characteristics required by the user. This table is valid as long as the constants to tune are calculated with a known method. Therefore, from the values that we have calculated, we reduce = 2400 to obtain an overshoot close to zero as shown in Figure 9, which is very convenient for such converters.  The bifurcation diagram is a tool to analyze the dynamic system and provides information on it limits of stable operation. For this system, only the constant Kp has to be varied as this affects the others.
This requires the industrial form of PID: Figures 10 and 11 show that the operating range of Kp has an upper limit of 19 units apx before the system becomes chaotic. Figure 10. 's bifurcations Figure 11. D's bifurcations Figure 12 shows that for small values of T (sampling period), the system has a one periodic wave for high frequencies; however, by increasing the sampling period equal to the switching period (around 110 μseg), the systems begins to turn chaotic.

MATLAB/SIMULINK® SIMULATION
The next simulation performed in simulink moves us closer to real-time implementation performed in dSPACE. Figures 14 and 15, respectively, show the circuit diagrams and elements used. Figure 16 displays the output in open-and closed-loop systems with PID. Reducing the sampling rate to half causes the signal to lose symmetry because it receives fewer sampling points and, therefore, the integration process struggles as it adds more than needed or rests more than needed, for the same reason. This explains the strong oscillations seen in Figure 17. This effect is accentuated in the implementation.

EXPERIMENTAL RESULTS
For real-time implementation, the control and development card dSPACE was used. The converter's PID controller was implemented in simulink as diagrammed in Figure 18, where it controls the controller implemented on hardware through the PWM generation block. The results presented in this section were obtained with the experimental prototype and the parameters defined in Table 2. By changing the reference voltage to 10 V, 20 V, and 30 V, and varying the sampling and switching frequency, we show that the real system is much more sensitive to a low sampling rate. Figure 19 corresponds to a sampling frequency of 10 kHz. Increasing the sampling frequency three times (30 kHz) in Figure 20 results in a little improvement in the regulated signal and, especially, a reduction in the sound produced by the inductor due to the switching frequency growth of the transistor.
By increasing significantly the value of the capacitor to 376 μF as shown in Figure 21, we improve the converter's filtering and find a better answer with a lower steady-state error, even for the design parameters shown in Table 2. The reason is that more capacity filters higher frequencies and, therefore, the regulation is better, thus reducing considerably the system's chaos. It can be seen in Figures 22 and 23 that if we make instant load changes going from 14.59 Ω to 39.3 Ω with a capacitor of 376 μF and switching to 10 kHz, then the system regulates too well with errors less than 2%; hence, not only the good performance of the PID controller must be considered.

CONCLUSIONS
Because the increased value of the capacitor produced a substantial improvement in the system, it is necessary to propose a detailed study of the buck converters currently on the market in order to determine and compare which and what values of their elements are most appropriate to apply with different control techniques. It is likely that the implemented converter does not have the best features to adequately respond to PID control. The PID controller in the continuous case shows good performance in terms of regulating output voltage ( ). In some systems, a continuous PID control can react in a way and when is modulated by PWM change substantially; therefore, we should not assume that what is found in continuous time can be applied without restrictions in discrete time. The switching and sampling frequencies affect a major proportion of the integral because it needs to add the highest possible amount of points to successfully complete the integration process. Having hardware that supports high sampling and switching frequencies is a very important factor when implementing a system. For the implemented converter, the PID controller did not respond in the best way. It is necessary to filter or remove the derivative and select appropriate sampling and switching frequencies.

ACKNOWLEDGMENTS
This work was supported by the Universidad Nacional de Colombia, Sede Medellín under the projects HERMES-34671 and HERMES-36911. The authors thank the School of Physics for their valuable support to conduct this research. This research paper corresponds to "programa reconstrucción del tejido social en zonas de pos-conflicto en Colombia del proyecto Modelo ecosistémico de mejoramiento rural y construcción de paz: instalación de capacidades locales," financed by the "Fondo Nacional de Financiamiento para la Ciencia, la Tecnología y la Innovación, Fondo Francisco José de Caldas con contrato No 213-2018 con Código 58960."