Tuning of PID Controller Using Particle Swarm Optimization (PSO)

— The aim of this research is to design a PID Controller using PSO algorithm. The model of a DC motor is used as a plant in this paper. The conventional gain tuning of PID controller (such as Ziegler-Nichols (ZN) method) usually produces a big overshoot, and therefore modern heuristics approach such as genetic algorithm (GA) and particle swarm optimization (PSO) are employed to enhance the capability of traditional techniques. However, due to the computational efficiency, only PSO will be used in this paper. The comparison between PSO-based PID (PSO-PID) performance and the ZN-PID is presented. The results show the advantage of the PID tuning using PSO-based optimization approach.

Proportional-Integral Derivative (PID) controllers have been widely used for speed and position control of various applications. Among the conventional PID tuning methods, the Ziegler-Nichols method [1] may be the most well known technique. For a wide range of practical processes, this tuning approach works quite well. However, sometimes it does not provide good tuning and tends to produce a big overshoot. Therefore, this method usually needs retuning before applied to control industrial processes. To enhance the capabilities of traditional PID parameter tuning techniques, several intelligent approaches have been suggested to improve the PID tuning, such as those using genetic algorithms (GA) [2][3][4][5] and the particle swarm optimization (PSO) [6][7]. With the advance of computational methods in the recent times, optimization algorithms are often proposed to tune the control parameters in order to find an optimal performance [6][7].
This paper attempts to develop a PID tuning method using PSO algorithm. The result is expected to show the effectiveness of the modern optimization such as PSO in control engineering applications especially for university student's level.
PSO algorithm is a stochastic algorithm based on principles of natural selection and search algorithm. There are many evidences of intelligence for the posed domains in animals, plants, and generally living systems. For example, ants foraging, birds flocking, fish schooling, bacterial chemotaxis are some of the well-known examples in category.

II. PROBLEM FORMULATION
PID controller consists of Proportional, Integral and Derivative gains. The feedback control system is illustrated in Fig. 1 where r, e, y are respectively the reference, error and controlled variables. In the diagram of Fig.1, G(s) is the plant transfer function and C(s) is the PID controller transfer function that is given as: Where K p ,K i , K d are respectively the proportional, integral, derivative gains/parameters of the PID controllers that are going to be tuned. The plant used here is a DC motor model which is a third order system written as: Furthermore, performance index is defined as a quantitative measure to depict the system performance of the designed PID controller. Using this technique an 'optimum system' can often be designed and a set of PID parameters in the system can be adjusted to meet the required specification. For a PID-controlled system, there are often four indices to depict the system performance: ISE, IAE, ITAE and ITSE. They are defined as follows: Therefore, for the PSO-based PID tuning, these performance indexes (Eqs. 3-6) will be used as the objective function. In other word, the objective in the PSO-based optimization is to seek a set of PID parameters such that the feedback control system has minimum performance index.

III. TUNING OF PID USING Z-N METHOD
The first method of Z-N tuning is based on the open-loop step response of the system. The open-loop system's Sshaped response is characterized by the parameters, namely the process time constant T and L. These parameters are used to determine the controller's tuning parameters (see Table 1).
The second method of Z-N tuning is closed-loop tuning method that requires the determination of the ultimate gain and ultimate period. The method can be interpreted as a technique of positioning one point on the Nyquist curve [8]. This can be achieved by adjusting the controller gain (Ku) till the system undergoes sustained oscillations (at the ultimate gain or critical gain), whilst maintaining the integral time constant ( Ti ) at infinity and the derivative time constant ( Td) at zero (see table 2).

A. Overview of PSO Algorithm
PSO is optimization algorithm based on evolutionary computation technique. The basic PSO is developed from research on swarm such as fish schooling and bird flocking [9]. After it was firstly introduced in 1995 [10], a modified PSO was then introduced in 1998 to improve the performance of the original PSO. A new parameter called inertia weight is added [11]. This is a commonly used PSO where inertia weight is linearly decreasing during iteration in addition to another common type of PSO which is reported by Clerc [12][13]. The later is the one used in this paper.
In PSO, instead of using genetic operators, individuals called as particles are "evolved" by cooperation and competition among themselves through generations. A particle represents a potential solution to a problem. Each particle adjusts its flying according to its own flying experience and its companion flying experience. Each particle is treated as a point in a D-dimensional space. The i th particle is represented as X I =(x i1 ,x i2 ,…,x iD ). The best previous position (giving the minimum fitness value) of any particle is recorded and represented as P I =(p i1 ,p i2 ,…,p iD ), this is called pbest. The index of the best particle among all particles in the population is represented by the symbol g, called as gbest. The velocity for the particle i is represented as V I =(v i1 ,v i2 ,…,v iD ). The particles are updated according to the following equations: where c 1 and c 2 are two positive constant. As recommended in Clerc's PSO, the constants are c 1 =c 2 =1.494. While rand() is random function between 0 and 1, and n represents iteration. Eq.7 is used to calculate particle's new velocity according to its previous velocity and the distances of its current position from its own best experience (position) and the group's best experience. Then the particle flies toward a new position according to Eq.8. The performance of each particle is measured according to a pre-defined fitness function (performance index), which is related to the problem to be solved. Inertia weight, w is brought into the equation to balance between the global search and local search capability [11]. It can be a positive constant or even positive linear or nonlinear function of time. A guaranteed convergence of PSO proposed by Clerc set w=0.729. It has been also shown that PSO with different number of particles (swarm size) has reasonably similar performance [14]. Swarm size of 10-50 is usually selected. Here, we set 40.

B. Implementation of PSO-Based PID Tuning
Stochastic Algorithm can be applied to the tuning of PID controller gains to ensure optimal control performance at nominal operating conditions. PSO is employed to tune PID gains/parameters (Kp, Ki, Kd) in offline using the model in Eq.2. PSO firstly produces initial swarm of particles in search space represented by matrix. Each particle represents a candidate solution for PID parameters where their values are set in the range of 0 to 100. For this 3-dimentional problem, position and velocity are represented by matrices with dimension of 3xSwarm size. The swarm size is the number of particle where 40 are considered a lot enough. A good set of PID controller parameters can yield a good system response and result in minimization of performance index in Eqs.3-6 above.

V. SIMULATION RESULTS
In the conventionally Z-N tuned PID controller, the plant response produces high overshoot, but a better performance obtained with the implementation of PSO-based PID controller tuning. In the PSO-based PID controllers (PSO-PID), different performance index gives different results. These are shown in Table 3.
Furthermore, Fig. 2 shows a sample of the trajectory of the PID parameters during optimization to see the convergence of the optimized solution. The PID parameters are obtained for 50 iterations.  Comparative results for the PID controllers are given below in Table 4 where the step response performance is evaluated based on the overshoot, settling time and SSE (sum of squared error). The corresponding plot for the step responses are shown in Fig. 3.
Finally, this result is only preliminary research. To further investigate the effectiveness of the proposed method, some work may be done such as: -Comparison of the PSO-PID with other tuning method other than Z-N method. -Instead of PSO, others optimizer such as Differential Optimization can be used. -Different objective functions other than error performances that are already used.

VI. CONCLUSIONS
From the results, the designed PID controllers using PSObased optimization have less overshoot compared to that of the classical method (Z-N). Furthermore, the PSO-based PID controllers which are optimized with different performance index have similar performances, except that is optimized by ITSE where long settling time is seen. However, the classical method is good for giving us as the starting point of what are the PID values. Therefore the benefit of using a modern optimization approach is observed as a complement solution to improve the performance of the PID controller designed by conventional method. Of course there are many techniques can be used as the optimization tools and PSO is one of the recent and efficient optimization tools.