Parameter effect analysis of particle swarm optimization algorithm in PID controller design

Article History: Received 02 August 2018 Accepted 18 January 2019 Available 09 April 2019 PID controller has still been widely-used in industrial control applications because of its advantages such as functionality, simplicity, applicability, and easy of use. To obtain desired system response in these industrial control applications, parameters of the PID controller should be well tuned by using conventional tuning methods such as Ziegler-Nichols, Cohen-Coon, and AstromHagglund or by means of meta-heuristic optimization algorithms which consider a fitness function including various parameters such as overshoot, settling time, or steady-state error during the optimization process. Particle swarm optimization (PSO) algorithm is often used to tune parameters of PID controller, and studies explaining the parameter tuning process of the PID controller are available in the literature. In this study, effects of PSO algorithm parameters, i.e. inertia weight, acceleration factors, and population size, on parameter tuning process of a PID controller for a second-order process plus delaytime (SOPDT) model are analyzed. To demonstrate these effects, control of a SOPDT model is performed by the tuned controller and system response, transient response characteristics, steady-state error, and error-based performance metrics obtained from system response are provided.


Introduction
Meta-heuristic optimization algorithms have attracted attention in control system area, especially in controller design process.Because these algorithms have been agreed as an alternative method of solving deterministic optimization problems or stochastic programming whose solution is not feasible in most cases even though optimality is proven.Genetic algorithm (GA) [1,2], ant colony optimization (ACO) [3], cuckoo search algorithm (CSA) [4], flower pollination algorithm (FPA) [5], differential evolution [6], artificial bee colony algorithm (ABC) [8], and particle swarm optimization (PSO) [7,[9][10][11] are some of meta-heuristic optimization algorithms used in controller design process in control system area.
PID controller has been preferred in industrial control applications to obtain desired transient and steady-state response of the closed loop system since 1940s.Either PID controller or its combinations have been included in almost 90% of the industrial control applications [12] because of its functionality, simplicity, applicability, and easy of use [13].A PID controller has three different parameters required to optimally tune in order to obtain desired system response.Even though conventional tuning methods such as Ziegler-Nichols [14], Cohen-Coon, and Astrom-Hagglund [15] methods are available in the literature, metaheuristic optimization algorithms considering a predefined fitness function have become popular in the tuning process.

*Corresponding Author
Although several meta-heuristic optimization algorithms are available, PSO algorithm is commonly used in many control applications [16].PSO algorithm was used to design an optimum PID controller for an automatic voltage regulator (AVR) system [9] by defining a performance criterion W which contains overshoot, rise time, settling time, and steady-state error obtained from system response.In another study, to show the effectiveness of PSO algorithm in control system area, Solihin et.al designed a PID controller for a DC motor model and compared the results with Ziegler-Nichols tuning method [11].The authors used various fitness functions to see the effect of fitness function in the optimization process.Zhao et.al [17] designed PID controllers for both a first-order process plus delay-time (FOPDT) model and a second-order process plus delaytime (SOPDT) model by proposing a novel fitness function which provides less overshoot and control input.Speed control of a DC motor was performed using PID controller whose parameters were tuned by PSO algorithm and the performance of the PID controller were compared to another PID controller tuned by differential evolution (DE) algorithm [18].A comparative study for PID controller design with different algorithms was published in [19] where GA, DE, and PSO algorithms were used to tune the parameters of the PID controller.
Even though other studies related to PID controller design based on PSO algorithm are available in the literature, we have not come across with any study analyzing effects of PSO algorithm parameters, yet.Therefore, variable parameters of PSO algorithm such as inertia weight, acceleration factors, and population size are taken into account and effects of these variables on PID controller parameter optimization process are analyzed in this study.During the optimization process, a SOPDT model is used since most of the high order processes can be modeled by either a FOPDT model or a SOPDT model [20].Both visual and numerical results are provided in the paper to see the effects of each variable on change of fitness value, transient response characteristics, steady-state error, and error-based performance metrics.
The rest of this paper is organized as follows: Section 2 presents a brief background about PID controller and PSO algorithm, and introduces optimization process of the PID controller.Simulation results are given in Section 3 where the effects of inertia weight, acceleration factors, and population size of PSO algorithm are analyzed separately.In addition, the obtained system responses are provided in this section.Concluding remarks are made in Section 4.

PID controller
PID controller and its combinations have been still preferred in many control applications to improve system dynamic response in addition to steady-state error, although being over 100 years old.Because it has critical advantages such as functionality, simplicity, applicability, and easy of use [13].A PID controller has three different terms: proportional, integral, and derivative.Each term has a gain called with the same name.In other words, proportional, integral, and derivative terms have the gains K P , K I , and K D , respectively.In this structure, the integral term increases system type by adding a pole at the origin, whereas the derivative term adds a finite zero to the open loop transfer function.Therefore, both the steady-state error and transient response of the closed-loop system improve thanks to integral and derivative terms, respectively.
Block diagram representation of a parallel form PID controller is demonstrated in Figure 1 where E(s) and U(s) are the error and control signals in Laplace domain, respectively.The general transfer function of a parallel form PID controller in Laplace domain is:

Particle swarm optimization
Particle swarm optimization develop by Kennedy and Eberhart [21] is a stochastic evolutionary optimization algorithm based on simulating the movements of a swarm like fish schooling and bird flocking.In order to model the movements of the swarm, position and velocity update equations of the particles are used.The equations of the velocity and position are given below, respectively.
where k is the iteration number, i is the number of the particle, w is the inertia weight that directly effect the velocity, c 1 and c 2 are the acceleration factors called cognition and social constants, respectively, r 1 and r 2 are the random numbers between 0 and 1, P best is the best local solution, G best is the best global solution, and V i and X i are the velocity and position of the particle i, respectively.
When considered the velocity and position equations, it can be inferred that population size, inertia weight w, and acceleration factors c 1 and c 2 effect the result of the algorithm.In general, c 1 and c 2 are set to 2 and the inertia weight w which balances the global and local search is linearly decreased from about 0.9 to 0.4 [9].
The implementation of the PSO algorithm is described as follows: Step 1. Initialize the particles with random velocities and positions.
Step 2. Evaluate and compare fitness values of the particles in the population and obtain the local best value (P best ) of the population for current iteration, keep the P best value in memory.
Step 3. Compare the P best value to global best (G best ) value, which is initially assigned to P best value, and assign global best (G best ) value to the position of the particle with the best fitness function value.
Step 4. Update the velocities of the particles by using Eq. 2 Step 5. Move each particle to their new position by using Eq. 3 Step 6. Increase iteration number, go to step 2 and repeat the steps until the stopping criterion is met.

Optimization of the controller
Three parameters of the PID controller, i.e.K P , K I , and K D , were tuned by using PSO algorithm to find minimum fitness function value in Matlab/Simulink platform.As the fitness function, integral of time-weighted absolute error (ITAE) which is as error based fitness function was utilized.ITAE fitness function was preferred because it produces smaller overshoot and oscillations than the other error-based fitness function such as integral of absolute error (IAE) and integral of squared error (ISE) [22,23].Although ITAE value was used as the fitness function, both IAE and ISE values were calculated in simulations as error-based performance metrics in addition to ITAE value.The equations of the mentioned metrics are: where e(t) is the error signal between reference and actual signals.
A general schematic representation of the whole system used in the parameter optimization process of the PID controller is shown in Figure 2. In this process, which was performed with a sampling time T s of 0.001s, a classical PID controller without filter was utilized.K P , K I , and K D parameters of the PID controller were optimized by PSO algorithm.The optimization process started with initializing the particles with random velocities and positions.The number of the particles were equal to population size and each particle contains three parameters called KP , KI , and KD representing the parameters of the PID controller.

Simulation results
To analyze effects of PSO algorithm parameters in PID controller design, simulation of a SOPDT model was performed in Matlab/Simulink platform.The transfer function of the SOPDT model used in the study is: Unity step reference input was provided to the closed loop system given in Figure 2, and the best controller parameters, i.e.K P , K I , and K D values, were searched considering minimum ITAE fitness function value during 10 seconds simulation.
First of all, effect of inertia weight w was considered in this section.Then effect of acceleration factors c 1 and c 2 were analyzed.Finally, effect of population size used in the PSO algorithm was investigated.

Effect of inertia weight
The inertia weight w constructs a relation between the past and current velocities of the swarms as seen in Eq. 2. Therefore, it effects the flying abilities of swarms to either in a wide-range or in a narrow-range.Global and local searching abilities are intended by wide and narrow-range flying abilities.Therefore, larger or smaller inertia weight determines the tradeoff between global and local searching abilities.Smaller inertia weight is suggested to fine-tune in a smaller search space, whereas larger inertia weight is asked to global exploration in a larger search space [24].In general, the inertia weight w is linearly decreased from about 0.9 to 0.4 depending on the maximum and current iteration numbers [9].Eq. 8 is used to calculate the inertia weight where iter max and iter current represent the maximum and current iteration numbers, respectively.ω max and ω min are set to 0.9 and 0.4, respectively.
To see the effect of the inertia value on a SOPDT, various w values were used in optimization process.11 different w values from 0.05 to 1.0 in addition to linearly decreased w value calculated by using Eq. 8 were utilized in the parameter optimization process of the PID controller.Since the PSO algorithm starts with random initial positions, the algorithm performed 10 times.All trials were performed with stationary acceleration factors c 1 and c 2 , population size, and maximum iteration number which are set to 2, 2, 10, and 50, respectively.The change of ITAE fitness values during the optimization process with different w values are shown in Figure 3.In order to make a fair comparison and provide a more possible visual figures, both the scales of x-axis and y-axis were set to the same possible values in each subfigures.Therefore, some subfigures may not contain the 10 different trial lines as in Figures 3(a), (b), and (c) which consist of 9 different trial lines.
From the figures, the minimum fitness function can not be observed clearly.Therefore, in addition to visual results, numerical results belonging to optimization process are provided in Table 1, where FV, Mean, SD, Median, Max, Min stand for the best fitness value, the mean of the fitness values, the standard deviation of the fitness values, the median of the fitness values, maximum of the fitness values and minimum of the fitness values, respectively.It can be concluded from the table that reaching to optimal solution, i. e. global best position, is more possible when w = 0.2 than the other inertia weights, when considered the standard deviation of the fitness values.Furthermore, the maximum ITAE fitness value obtained with w = 0.2 is less than the other inertia weights.As a result of the numerical results, the minimum fitness value is 0.4477 and obtained when w = 0.2 for this SOPDT model during 10 seconds.
The best PID controller parameters for each w value are given in Table 2.The obtained system response using these controller parameters are shown in Figure 4, where a zoomed region is also demonstrated to see the In this study, (c 1 , c 2 ) acceleration constant pair were set to (0, 4), (1, 3), (2, 2), (3,1), and (4, 0) by keeping inertia weight w and population size stationary at 0.2 and 10, respectively.w was set to 0.2, since minimum ITAE fitness value had been obtained at that weight in the previous subsection.
The change of ITAE fitness values during the optimization process with different (c 1 , c 2 ) pairs are given in Figure 5 where the scales of each subfigures are set to the same possible values to make a fair comparison and provide a more possible visual figures.Numerical results of the optimization process are also provided in Table 3, where FV, Mean, SD, Median, Max, Min stand for the best fitness value, the mean of the fitness values, the standard deviation of the fitness values, the median of the fitness values, maximum of the fitness values and minimum of the fitness values, respectively.The minimum fitness value is 0.4477 and obtained with (c 1 = 2.0, c 2 = 2.0) for this system during 10 seconds.As a result of the numerical result, c 2 constant, which is related to the global (G best ) best position, has more effect on the fitness value as expected.Because the minimum fitness value is obtained with (c 1 = 2.0, c 2 = 2.0) and the increase of the fitness value becomes more when the weight of c 2 constant is decreased.
The best PID controller parameters for each acceleration constant pair are given in Table 4.The obtained system response using these controller parameters are demonstrated in Figure 6, where a zoomed region is also given to see the transient response characteristics more clearly.When considered the numerical results given in Table 4, it can be concluded that the best controller parameters were obtained with (c 1 = 2.0, c 2 = 2.0) pair according to defined fitness value, although the best transient response obtained with (c 1 = 0, c 2 = 4.0).

Effect of population size
In an optimization process, if the population size is small, the algorithm require less computational effort.On the other hand, the probability of premature convergence increases [25].Therefore, researches have a common idea of that the algorithms provide poor solutions when the population size is small [26] and require more computational effort when it is large [27].
In this section, the effect of population size parameter on the PSO algorithm is considered by keeping inertia weight w and acceleration constant pair stationary at 0.2 and (c 1 = 2.0, c 2 = 2.0), respectively.As in the previous subsection, the PSO algorithm is performed for 10 times for all population sizes and the results are recorded.
Figure 7 shows the change of ITAE fitness values during the optimization process with different population sizes.It can be concluded from the figure that the standard deviation of the obtained fitness value is the smallest with the largest population size.In other words, the probability of converging global best position is higher than the others.This result can be supported by Table 5, where FV, Mean, SD, Median, Max, Min stand for the best fitness value, the mean of the fitness values, the standard deviation of the fitness values, the median of the fitness values, maximum of the fitness values and minimum of the fitness values, respectively.In addition to standard deviation, the maximum value of ITAE value is getting smaller while increasing the population size.On the other hand, the required computation time increases as the population size increase.The obtained best PID controller parameters for each population size are given in Table 6.The obtained system response using these controller parameters are demonstrated in Figure 8, where a zoomed region is also provided.The transient response characteristics obtained from system response is also given in Table 6.That the best controller parameters were obtained with the largest population size is concluded from the numerical results in the table.In addition to ITAE fitness value, all transient response characteristics except maximum overshoot is better when the population size is equal to 50.

Conclusion
In this paper, the effects of inertia weight, acceleration factors, and population size of the PSO algorithm during a PID controller design process for

Figure 2 .
Figure 2. Schematic representation of the parameter optimization process of the PID controller.

Figure 4 .
Figure 4. Obtained system responses with different inertia weights.

Figure 6 .
Figure 6.Obtained system responses with different acceleration parameters.

Figure 8 .
Figure 8. Obtained system responses with different population sizes.

Table 1 .
Effect of inertia weight on fitness value.
e. IAE, ISE, and ITAE.The minimum steady-state error and ITAE performance metric was obtained when w = 0.2.However, less overshoot and settling time occurred when w = 0.6 and w = 0.5, respectively.As a result, since the fitness function of the PSO algorithm is ITAE fitness value, the best controller parameters were obtained when w = 0.2.

.2 0.4477 0.5082 0.1399 0.4593 0.9032 0.4477
values may allow the particle to go around far away from the global best position.Therefore, the acceleration factors c 1 and c 2 are set to 2.0 as a result of trial and error method in most studies.
1 and c 2 constants weight the acceleration ratios of the particles towards the local (P best ) and global (G best ) best positions, respectively.High acceleration constant values may cause inconsistent movement of the particle, i.e. the particles may suddenly converge to the best global position or past it towards other local best positions, whereas low

Table 3 .
Effect of acceleration parameters on fitness value.

Table 2 .
Effect of inertia weight on system dynamic response, steady-state error and performance metrics.

Table 4 .
Effect of acceleration parameters on system dynamic response, steady-state error and performance metrics.

Table 5 .
Effect of population size on fitness value.

Table 6 .
Effect of population size on system dynamic response, steady-state error and performance metrics.Then, the effect of the acceleration factors were analyzed and it is concluded that the importance of social constant c 2 related to global best solution is higher than the cognition constant c 1 .However, the best solution of the optimization process was obtained with (c 1 = 2.0, c 2 = 2.0) for this system.At last, the effect of the population size were considered by keeping the inertia weight w and the acceleration constant pair stationary at 0.2 and (c 1 = 2.0, c 2 = 2.0), respectively.It was observed that the probability of converging the global best solution increases as the population size increases.However, the required computation time increases.