Design and implementation of PSO/ABC tunned PID controller for Buck converters

In the recent years, Buck converters have been widely involved in a variety of the everyday applications such as smartphones and PCs. Buck converters can provide better and steadier performance when integrating a control system in the design. Therefore, it is interesting to work on this integration and gain the required efficiency in term of the gained voltage. In this paper, PID controller is adopted to control the output voltage of the Buck converter. An optimization is achieved on the performance of the Buck converter using two bio-inspired algorithms namely, Particle Swarm Optimization (PSO) and Artificial Bee Colony (ABC). The voltage controlled Buck converter system is simulated using Matlab environment to validate the proposed PID controller system. In this study, the voltage regulation process of Buck converter is investigated based on many working disturbances such as the change in the supply voltage, reference voltage, and load resistance in order to verify the robustness of the proposed PID controller. Finally, the feedabck voltage control system of the Buck converter is implemented experimentaly in real-time to validatde the simulated PID controller.


Introduction
In the last four decades, the appropriate use of electrical components has noticeably grown. Currently, there is strong competition among worldwide companies in making the electronic devices smaller aiming at reducing the power consumption and increasing the lifetime of the devices. Technologies such as power converters devices that have attracted the attention of many researchers and developers around the world since these power electronic devices have currently played a significant role in wide applications fields.
In electrical engineering, power conversion reflects the process of converting the current form of electricpower to another form. The conversion may happen between AC and DC; it also can happen when changing the frequency or voltage or the combination of both. The DC-DC type of converters has been widely utilized in industrial and commercial applications. A recent statistic estimated that approximately 70% of the consumed power is mainly processed by electronic technologies and devices [1].
A DC-DC converter is an electric circuit that is able to convert the level of DC voltage to another level [1]. A Buck converter can perform three main functions ; 1) steps down the output voltage of the converter to a desired value. 2) stable the output voltage. 3) buck converter can be used as a quality factor. Buck Converters are a type of DC-DC-converters that aims to step down or lower the input DC voltage to a stable output DC voltage [3].
Buck converters, which are also called step-down converters, are considered a DC-DC switch-mode power supply. The main purpose of this type of voltage converters is to lower or buck the input DC voltage to a stable lower output DC voltage [3]. There are two main types of buck converters; classical and hybrid. The classical buck converter is simple in terms of concept and topology. Classical buck converters are widely and efficiently used as a voltage regulator. Practically, adding additional components (e.g., capacitors or inductors [4]) to a classical buck converter will lead to having a large number of converter topologies with a high ratio of voltage conversion [5]. The classical buck converters cannot provide smart electronic devices such as mobile devices, which are under continous development, with the required voltage regulation process. Therefore, the hybrid buck converters have been introduced and developed by many power researchers. This kind of converters can provide the load with fast transient response with seamless loop transition automatically . Most of modern devices like electric tools, smartphones, tablets, laptops, etc.) use hybrid buck converters. Moreover, fast response and high-efficiency circuitry are the central and core needs for any electronic device.
Inductors and capacitors components can be used with buck converters for the purpose of increasing the power conversion efficiency [6]. These components are mainly used to control and transfer the input to the output based on the current state of the switch. In OFF stat, no power is provided by the source, else the inductor plays the role of the voltage source . In a buck converter, the energy storage in the inductor is controlled by the switch. The inductor is considered the current source aiming at keeping the output capacitor charged . While the capacitor is used to reduce the ripples in the output of the converter. In this case, it waves-off the output by filtering the harmonic currents away from the load.
According to the aforementioned description, the buck converters can be used for high efficiency over a large load current range as well as for fast load line transient response [7]. Several controller techniques have been developed by many power researchers to perform feedback voltage control of buck converters [2], such as Proportional Integral Derivative (PID), Neural Networks, Fuzzy Controller and Hybrid Control System approaches. PID is a type of controller technique that is widely used for regulating and controlling process variables of systems such as position, speed, temperature and pressure, etc. using control loop feedback. The idea of a PID controller was first introduced in 1911 by the scientist Elmer Sperry and then implemented by Taylor Instrumental Company (TIC) in 1933 [8]..PID controller can be used to control the output voltage of Buck Convertor [9]. The performance of the PID controller can be optimized by using bio-inspired algorithms and computations, such as Genetic Agorithm (GA), Partical Swarm Optimization (PSO), Bacteria Foraging Optimzation Algorithm (BFOA), Artificial Bee Colony (ABC) etc. The optimization methods are involved to do tuning process of the controller parameters. The integration of Buck converters, PID controllers, and bioinspired computations has been widely used in a variety of applications [9].
Furat [10] proposed an approach that used the ABC algorithm where a three-channel cost function was used to, separately, search the "optimum" value of each of the parameters. The reason behind using a three-channel was because the single cost function did not reflect the different impact of each parameter. The approach resulted in providing efficient performance, which was also confirmed in [10]. Civelek et al. In [11], ABC algorithm is adopted to optimize the PID controller for buck converter system. The presented approach showed efficient performance in terms of overshoot, settling and rise times when using the Mean Squared Error (MSE) as the cost function. The authors Sonmez et al. [12] benchmarked the voltage regulation performance of ABC based PID controller versus GA-PID controller. They executed several simulations using both algorithms and found that the ABC algorithm outperformed the performance of the GA algorithm in terms of steady-state error and settling time. Alma'aitah et al. [13] proposed an approach to tune the parameters of feedback control system for buck-boost converter with the PSO algorithm. The authors tested the presented regulation system by varying the input voltage and the output load resistance. Another work proposed by Borin et al. [14] in which PSO algorithm is used to develop fixed gain parameters of PID controller for buck converter. They minimized the deviations to the desired level, which mitigated the time consumed to obtain the required gains. This case was experimented with by Tumari et al. [15], who involved the PSO algorithm in the design of the PID controller with buck converters. They used a derivative filter PID (PIDF) in their suggested tuning technique. They found the optimal gains when implementing a priority-based fitness on the PSO algorithm . Musyafa et al. [16] proposed an approach that used Arduino with a PSO-based PID in obtaining the best control parameters for a turbine power control system. The response of the system is assessed using standard performance parameters, which include settling, rise, peak, and delay times. The results reflected the efficiency of the proposed approach in terms of the aforementioned measurements. Anead et al. [17] suggested a PSO-PID based method that was used to assess the nanofluid parameters using the PID and the PSO algorithm implemented in Arduino. The method successfully provided accurate and efficient outcomes in terms of response and reliability. Furthermore, the performance of the PSO algorithm has been benchmarked with other bio-inspired algorithms. Another benchmarking was performed by Moshayedi et al. [18], who compared three bio-inspired algorithms namely, the PSO, ABC, and Firefly (FA) algorithms. They found that each algorithm was successful in a particular aspect with some advantage to the PSO algorithm.
According to the literature, there are some limitations and drawbacks in the proposed voltage regulation approaches. Most of the presented voltage control systems did not test their approaches in specific cases such as a sudden change in the input voltage or in load. In addition, most of the proposed buck regulation systems did not pay enough attention to the expected working disturbances, output voltage (V out) , and reference voltage (V ref ,). Hence, this artical is presented to sort out all these drawbacks. The contribution of this work is to design an efficient voltage regulation system for buck converters using PID controller by considering many disturbances such as the sudden change in the reference voltage (V ref ), input voltage (V in ), and load resistance. The gain parameters of the controller are tuned optimally using two optimization algorithms, PSO and ABC. These algorithms can positively contribute to the whole PID systems' performance and results. The simulation results are validated through the real time implementation of the optimized PID controller in Arduino electronic device.

Converter setup
The Buck converter is a switched mode voltage regulation system which produces an output voltage less than the input voltage. The main structure of the Buck converter includes an inductor, capacitor, diode, power switch and load. Figure 1 presents electrric setup system of the classic Buck converter. The inductor is a power storage unit in the converter system. It reduces the current ripple and make it smoother. It is also used to decrease the high values of d i /d t that are caused at switching process. In addition, it is used to improve the regulation process of the converter output voltage, this process is considered crucial during the switching flow in current that leads to protect the switch when it is under stressed. The capacitor it performs a filter stage in converter circuit, which is needed for the output voltage waveform to be smoothened. It is also able to filter the rippled waveform and provide a constant output voltage across the load. The diode is a feewheeling device, which serves as a controlled switch that uses to provide a path for the inductor current to flow through the load as soon as the switch is ON. While the power switch is based on MOSFET transistor, which its switching process is controlled by Pulse Width Module (PWM) signals generated from feedback cotrol system. In case of the input voltage to the transistor gate is zero, the MOSFET transistor conducts virtually no current and the converter output voltage is equal to the supply voltage. Finally, the load is any appliance that is connected across the output terminals of the converter. It can be a simple resistive or complex resistive with passive and active elements. According to the above figure, the voltage regulation behavior of the Buck converter depends on two states of switching [3], which will be discussed in detail in the next subsection.

Buck converters working modes
There are two modes of operations in Buck converters, which are given below:

. Discrete condition mode (DCM)
In this working mode, there is a zero-inductor current period between the ON and OFF switching operations [19]. Therefore, the inductor current is not continuous. The size and cost of the discrete mode are reduced compared to the continuous mode [20]. The discrete mode has a fast recovering of the rectifying diode and high allowable power for the switching transistor. The discrete condition mode is not the concern in this work because the proposed converter approach is based on the continuous condition mode.

. Continuous Conduction Mode (CCM)
In continuous working mode, the current of the inductor flows continuously during the switching period ( T ). During this mode, a priority for reducing the output ripple voltage and harmonics is considered [21]. The operation of the Buck converter bases on the switching function. Therefore, based on the switch state, two electric circuits are considered, one for the ON state and other for the OFF state.

Buck converters switching modes
Buck converters work in two switching modes as described.

Switch ON state
In this working state, the switch is connected to ON state and the voltage source is included to the converter circuit. Figure 2 demonstrates a Buck converter diagram in case the switch status is ON. Under this state, a reverse current is occurred during the Reverse Recovery Time of the diode, which causes a loss as a side effect of the ON state as well as the time consumed in the reverse recovery [22]. In low-voltage switching, the Reverse Voltage and Reverse Current of the diode are low. During this working case, the diode is Reverse Biased and the load is connected to the supply voltage through the inductor in a direct way. The inductor current flows through the switch and the voltage of the inductor can be as follows: while the capacitor current is as follows: In state space formulation of the Buck converter, the inductor current, and capacitor voltage are chosen as the state variables, is chosen as an input signal, while as the output signal. The state vector and control input vector of the Buck converter are given by (3) and (4) respectively: Based on (1) and (2), the state space representation of the converter system is as follows: Where the state matrix The state and output equations of the Buck converter system based on switch OFF state they are given in Equations 11 and 12 respectively.
To derive an average model of the power converter system over one switching cycle,the following techniques are used: 1-Averaging the circuit: it is an opposed to equation averaging and it is a common approach for circuit simulations. It can also be applied by separating the switch from the remainder of the converter, then, define ports of the switch. After that, it is needed to average the switch waveforms. 2-Averaging the state space: it means dividing the switching circuit into two or three structures. The derivatives of the inductor currents and capacitor voltages are defined for each structure. The voltages and currents are averaged over one switching cycle. 3-PWM switch modeling: it is a simple continuous space-state method that uses currents and voltage sources for controlling DC-DC convertors, which is different form the first mentioned technique.
The state space averaging has advantages compared to the first techniques. For instance, the second technique has a more compact representation of equations as well as its ability to obtain more transfer functions. Also, in the state-space, both AC and DC transfer functions can be easily obtained. Based on the aforementioned advantages, this work utilizes the state-space approach.
In this work, the model of the system is formed by state-space averaging technique. The state space representation of the Buck converter model can be formulated using state space averaging approach by multiplying (7) (8) by and (13) (14) by and the resulting equations are added together. The resulting general state and output equations of the converter are given in (15) and (16) respectively: Taking the Laplace transform of Equation 3.15, the transfer function of the DC-DC Buck converter system with respect to supply voltage is given by (17).
Based on (15) and (16), the above transfer function equation is expressed as follows In steady state, the average capacitor current is assigned to be zero, the current of the inductor is equal to the output current of the converter Based on the above equation, the duty cycle ( d ) is formalized as follows: The suitable values for the system parameters are listed in Table 1.

Controller technique
PID controller is used to control the output voltage of a Buck converter using known parameters. Despite the ongoing developments in control theory throughout the last decades, the PID controller has remained the most popular control technology for a wide range of industrial engineering applications. This is due not only to its simple structure and ease of implementation in reality, but also to the fact that it gives appropriate and reliable performance in a variety of control situations. Because it combines proportional, integral, and differential control, the PID controller is often known as a "three term" controller. The controller's standard time structure is as follows: where ) (t u is the controller-command-signal acting on the error signal, ) (t e i p K K , and d K are the proportional, the integral and the derivative PID gain respectively. Considering the Laplace transform for (21), the s-domain transfer function of the controller is formulated as follows:

Optimization algorithms
In this paper, two optimization techniques are adopted to optimize the performance of feedback PID controller, namely PSO and ABC.

PSO tuning method
In the PSO tuning approach, a software agent called "Particle" to the search space of the problem. The potential optimal solution is characterized or represented by the position of the particle. Hence, each particle in the search space seeks for best positions aiming at having optimal solutions. The change in the position of a particle can be achieved by changing the velocity according to some rules [22].
The steps of implementing the basic version of the PSO algorithm are depicted in the flowchart presented in Figure 4 [23]. According to the figure, the initial step is to initialize the population (swarm), which is a group of particles (candidate solutions). Then, it is needed to initialize the best-known positions for the particles. After that, each particle moves in the search space aiming at finding better a position compared to the initial position. Now, when the particle finds the better position, it updates its best position and calculates the velocity accordingly. Then, the algorithm tests the termination criterion whether it is met. These steps are repeated until reaching the termination criterion. In this case, it is not guaranteed to reach a satisfied solution.
The aforementioned description is the basic implementation of the PSO. However, the algorithms can be updated based on the needs and the goals of the implementation. Most of the updates achieved by developers were related to the method of how the velocity is updated for the particles. Hence, many variants of the basic PSO algorithm have been considered in the literature. For instance, the PSO was almost designed to search in domains that are continuous. A discrete version of the PSO was proposed to work in discrete spaces such as the Binary PSO that was proposed by Kennedy and Eberhart in 1997 [24]. This update assumes discrete particle positions and continuous velocity. Another update was introduced by Clerc and Kennedy in 2002 and was called Constriction Coefficient [25]. It assumes that velocity is restricted by a particular form that guaranteed a good update to the velocity. Barebones is another version of the PSO algorithm that was proposed by Kennedy in 2003 [26]. In this variant, the velocity and position of particles are restricted by a particular procedure that, in turn, is based on sampling a parametric Probability Density Function (PDF). The other variant is called Fully Informed PSO, which follows a strategy that allows particles to use information about the neighbors for updating their velocity. This version was proposed in 2004 by Mendes et al. [27]. The literature includes many versions of the PSO that try to obtain better optimization outcomes for control problems. Furthermore, PSO has also been used in optimizing PID controllers with Buck converters. This algorithm has proven its efficiency in optimizing controllers.

.2. ABC tuning method
The ABC algorithm is an optimization approach that is inspired by the foraging behavior of bees. It was first introduced in 2005 by the scientist Dervis Karaboga [28]. In the context of bees' colonies, three groups of bees represent the whole community namely, scouts' bees, onlookers' bees, and employed bees. In the latter group, only one bee is assumed for each food source. This means the number of employed bees equals the food sources around the colony's hive. The function of each group can be summarized as follows [28]:  Employed bees: they "GO" to food sources and "COME BACK" to their colony's hive. Then they perform specific movements in different directions (e.g., dance-like) aiming at describing the coordinates of a food source.  Scouts bees: the employed bees whose food source is abandoned becomes scouts. Then, they start seeking new food sources. Onlookers bees: This kind of bees interpret the performed movements by the employed bees and then target food sources based on interpretations.
To apply the ABC in an application, it is needed to interpret each of the concepts mentioned in the above steps to its corresponding optimization concept [29]. The potential solutions are represented by the positions of food sources. The quality of solutions corresponds to the amount of nectar and the number of solutions equals the number of employed bees. Now, at the initial step, the initial population (randomly distributed) is generated, which represents food source positions. After that, the search processes cycle of the scouts, onlookers, and employed bees.
Here, the employed bees modify the source position and consider a new source position. Hence, if the amount of nectar of the new source is higher than the previous one, the bee forgets the previous source position and considers the new one. Otherwise, the bee maintains the current considered source position. After completing the search processes by the employed bees, the position information of the sources is shared with the onlooker bees on the movements area (dance area) [29]. Each onlooker assesses the information about nectar is assessed by the onlooker bees, they select the food sources according to the sources amounts of nectar. Repeating these steps will contribute to determining the abandoned sources by the artificial scouts. Figure 5. Flowchart of the ABC algorithm.

Control design
The DC-DC Buck converter is utilized to produce a stable desired output voltage. Figure 6 shows Buck converter under closed-loop voltage control system. The feedback control is based on PID controller, which is designed to regulate the output voltage of Buck converter with uncertainties. In the voltage control procedure, the converter output signal is compared with the desired output signal to generate the error signal which fed to the PID controller.Based on error signal and controller gain parameters the command signal is calculated and then compared with a sawtooth voltage signal to produce a variable duty cycle PWM signal. The generated PWM signal is supplied to the gate of the MOSFET to control switching process of the transistor. Proper tuning for gain parameters can produce control signal required to enable the converter output to follow the desired input effectively. Figure 6. Block diagram of ABC-PID control system for Buck converter Using the ABC optimization, a tuning process was performed on the gain parameters of the controller. For the purpose of assessing the robustness of the suggested controller, the regulation performance of the closed-loop Buck converter was tested under three input disturbances, variation in input power, output voltage, and load resistance. The performance of the optimized PID controller was tracked for the reference signal trajectories and assessed using the parameters of transient and steady state responses that, in turn, include rise and settling time, maximum overshoot and steady state error.
In this paper, an optimized ABC-PID controller is designed aiming at enhancing the dynamic performance of Buck converter through to convert a varying DC input voltage (1-40V)  . The ABC tuning also seeks to minimize the fitness function based on the converter system's transient and steady state performance characteristics, which is stated for constant and variable desired inputs: This is performed by determining the optimized tuning gain parameters for the suggested PID controller.

Simulation and results
The simulations of the voltage controlled Buck converter system with uncertainses were performed using Matlab enviroment to evaluate the performance of the proposed PID controller based on PSO and ABC optimization approaches.

ABC-PSO case #1
In this working case, the Buck converter system is simulated under variation in the value of supply voltage, reference voltage and load resistance. The reference voltage is triangle signal with amplitude of 5 v and frequency 0.5 Hz. Figure 7 shows simulink model of the Buck converter scheme with parameters values listed in Table 2. The simulation response of the system based on PSO-PID and ABC-PID controllers is shown in Figure 8. It can be seen from the mini-plot of Figure 8.  In this working case, the Buck converter system is simulated under variation in the value of supply voltage, reference voltage and load resistance. The desired voltage is a sawtooth signal with amplitude of 5 v and frequency of 0.5 Hz. The Simulink model block diagram of the Buck converter scheme is the same as in figure 7 except the reference voltage became a [0 5v] sawtooth signal with parameters values as listed in Table 2. The simulation response of the system based on PSO-PID and ABC-PID controllers is shown in Figure 9. It can be seen from the mini-plot of Figure 9 that the tracking response of ABC-PID controller is better than that of PSO-PID controller in terms of steady state error.

ABC-PSO case #3
In this working case, the Buck converter system is simulated under variation in the value of supply voltage, reference voltage and load resistance. The reference voltage is square signal with an amplitude of 10 v and frequency of 0.5 Hz.. The Simulink model block diagram of the Buck converter scheme same as figure 7 except the reference voltage became is [0 10v] square signal inductance is 45mH, while the rest of parameters value are the same as in Table 2. The simulation response of the system based on PSO-PID and ABC-PID controllers is shown in Figure 10. It can be seen from the mini-plot of Figure 10 that the ABC-PID controller showed a more stable output voltage signal with low fluctuation compared with that of PSO-PID controller. The results of the simulations of Buck converter based on ABC algorithm under triangle reference voltage are more accurate with fast achieved response compared with the PSO algorithm.

Real hardware implementation
The real time implementation of the Buck converter is achieved using Arduino device (Arduino Mega 2560) Schematic diagram and setup circuit of the Buck converter system based on PID controller using Arduino electronic device are shown Figure 11 and 12 respectively.
In this application, the Arduino electronic device works at 4 kHz and the frequency of the triangle signal used to generate PWM command signal is 4 kHz. Based on these frequency, the Arduino can read the converter output online and implement the controller process on the measured output voltage in real time. The practical output voltage of the Buck converter based on ABC tuning method is shown Figure .13. The real-time response of the Buck converter reveals that the optimized ABC-PID controller is able to deliver as stable and accurate output voltage.

Conclusion
In this paper, a classic and simple PID controller is adopted to regulate the output voltage of DC-DC Buck converters. The performance of the proposed controller is optimized by using two optimization algorithms, PSO and ABC, which are adopted to obtain best values for the PID gain parameters. The voltage controlled Buck converter system is modeled mathematically and then simulated using MATLAB software to validate the performance of the optimized PSO-PID and ABC-PID controllers. In this work, the voltage regulation process of the Buck converter is evaluated based on three working disturbances, which are variation in source voltage, reference voltage and load resistance, to validate the robustness of the proposed PID feedback control system. The time response of the Buck converter with PSO-PID and ABC-PID controllers is evaluated based on the standard characteristics parameters, which are rise time, settling time, overshoot and steady state error. The simulation results have shown that the two controllers succeeded in adjusting the output voltage of the Buck converter. However, the ABC-PID controller showed faster response with lower steady state error compared with that of the PSO-PID controller. Finally, the voltage control system for the Buck converter is implemented in real-time using an Arduino electronic device to verify the performance of the proposed ABC-PID controller. The experimental results revealed the effectiveness of the ABC-PID controller and proved its ability to deliver a stable and accurate output voltage to resistive load in different practical applications.