Tuning PID Controller Bases on Random Search Algorithms

In this paper, we present two well known random search algorithms which are Genetic algorithm (GA) and Particle Swarm optimization (PSO) to find optimal parameters for PID controller for a model of DC motor is used as a plant. To test performance of GA and PSO algorithms, we compare them with the traditional Ziegler-Nichols method in term of performance indices. The simulation results show that Proportional Integral and Derivative controller (PID) designed by GA and PSO algorithms yields better results than the traditional method in terms of the performance index. Keywords—Tuning PID; GA algorithm; PSO algorithm; Ziegler-Nichols method; performance index; optimization.

INTRODUCTION Proportional Integral and Derivative (PID) controllers have been used in industrial control applications for a long time. This is due to its simplicity, low-cost design and robust performance in a wide range of operating conditions. According to a survey in 1998, nearly 90% of the controllers used in industries are PID controllers [1]. By adding a derivative term into Proportional Integral (PI) controller, it improves the stability of control loop. The combined effect of Proportional and Derivative (D) controllers introduces a predictive capability in the controller since D term is able to react to foreseeable future control errors. The proportional term works as a fast-acting correction which will produce a change in the output as quickly as the error arises. The integral action takes a period of finite time to act but has the capability to make the steady zero state error. Unfortunately, tuning the PID controllers is tedious and it might be difficult to tune the PID gains properly due to the nonlinearity and the high complexity of the system [2]. Therefore, beside traditional tuning method we need heuristic methods for tuning parameters of controller. Recently, random search algorithms are widely chosen to solve nonlinear optimization problems. The categories of these algorithms do not require differentiable and continuous objective functions. Some random search algorithms are used for tuning PID controller such as GA [3][4], PSO [2], CRO [8].
In this paper, we use GA and PSO algorithm to find global optimization for parameters of PID controller and compare result with traditional Ziegler-Nichols tuning method with respect to integral performance indices. This paper is organized as follows: In the next section, PID controller is presented. Section 3 discusses GA and PSO algorithms. Next section presents the tuning PID controller. Section 5 demonstrates the performance of the various methods by experiment. Final section presents the conclusion and future studies.
II. PID CONTROLLER Proportional Integral Derivative (PID) controller is widely used in industry and practice. PID is often used in close loop control system presented in figure 1. PID controller combines three features of P, I and D controllers. P element instantaneously adjusts proportional control variable to the error signal. This is quite logical and it may be compared to the natural reaction of a process operator. The larger the error signal is, the larger the proportional control variable should be adjusted. One drawback of P term is any change in the operating conditions which will result into an offset, which is a steady state deviation of controlled variable from the set point. To overcome this drawback, the I term is added to form PI controller. Meanwhile, D term is added to PI controller to form PID because this element considers change rate of the error. Therefore, using the derivative element in controller allows the control variable to anticipate and counteract the cause of the error signal before it can take significant values. In PID controller, the control variable is related to the error signal by equation (1). The transfer function of PID controller can be written as flowing form: Where KP, KI, KD are proportional gain, integral gain and derivative gain respectively.
By tuning three parameters in the PID controller algorithm, the controller can provide control action designed for specific process requirements. There are some traditional methods to determine KP, KI, KD such as Ziegler -Nichols, CHR modification of the Ziegler -Nichols settings, Cohen-Coon controller settings, Lambda Tuning Technique, Haalman Controller Settings. In addition, there are some optimization methods widely used for tuning controller. In these methods, the controller parameters are determined with a view to the minimization of a given integral performance criteria such as integral of the absolute error (IAE), integral of the square error [5] are listed below: +∞ 0 (7) In case of PID controller, error signal e(t) is function of KP, KI, KD. We can choose one of integrals above as objective function for modern heuristic random search algorithms.

A. Genetic Algorithm
The genetic algorithm is formed based on the concept that natural evolution is the most perfect, the most logical and optimal process in itself. This concept is considered to be a true and unprovable axiom, but it is consistent with objective reality and was discovered by the scientist Darwin in his theory of evolution. The evolutionary process is optimally shown that the next generation is always more developed and perfect than the previous generation. Natural evolution is maintained by two natural processes of reproduction and selection. During natural evolution new individuals are born to supplement the old one. Natural selection will retain more developed and environmentally adaptable individuals, and discard those less adapted to the environment. Thus, genetic algorithms in particular and evolutionary algorithms in general simulate natural evolution through four basic operations: crossover, mutation, reproduction and natural selection.
Genetic algorithms are often used to solve optimization problems and then the solution of the problem is represented by individuals, also known as chromosomes, sets of individuals is called a population. A chromosome is made up of genes, the value of genes can be decimal numbers, binary numbers, symbols or letters depending on the problem to be solved. To evaluate the individuals in a population, the genetic algorithm uses the fitness function, this value is to measure the suitability of each solution to the problem. Some individuals in the population are selected for crossover to create new offspring and these offspring will inherit part of the father's genes and part of the mother's genes. Some individuals are selected to mutate, through mutation that changes their genes in one or more specific locations. The number of individuals to be crossover and mutation was controlled by parameters of the crossover probability (pc) and the mutation probability (pm). Individuals selected for the new population follow the Darwin theory of evolution, those individuals with a larger fitness function value will have more chances of being selected into the new population. After some evolution we choose the individual with the largest fitness function value and it will be the best solution to the given problem to be solved.
Thus, to solve the problem with genetic algorithms, we usually proceed through the following steps: -Step 1: Specify the parameters of algorithm which includes: population size, max iteration (generation), crossover probability and mutation probability.

B. Particle Swarm Optimization
Particle swarm optimization was developed in 1995 by the authors Kennedy and Eberhart, inspired by the behavior of social organisms in groups, such as bird and fish schooling or ant colonies. This algorithm emulates the interaction between members to share information. Particle swarm optimization has been applied to numerous areas in optimization and in combination with other existing algorithms. This method performs the search of the optimal solution through agents, referred to as particles, whose trajectories are adjusted by a stochastic and a deterministic component. Each particle is influenced by its 'best' achieved position and the group 'best' position, but tends to move randomly. A particle is defined by its position vector, Pi, and its velocity vector, Vi. Every iteration, each particle changes its position according to the new velocity. To seek the optimal solution, each particle moves in the direction to its previously best (Pbest) position and the global best (Gbest) position in the swarm [9].
where i denotes particle index, Np is total number of particles, t is the current iteration number, f is the fitness function, P is the position. Velocity V and position P of the particles are updated by the following equations: is the inertia weight used to balance the global exploration and local exploitation, 1 and 2 are uniformly distributed random variables within range [0, 1], and 1 and 2 are positive constant parameters called "acceleration coefficients." In summary, the PSO algorithm is illustrated with pseudocode as follows: Step 1: Initialization -Choose constant parameters c1, c2, population size Np -FOR EACH i th particle in population DO ✓ Initialize the particle's position with a uniform random number in range of the lower bound (LB) and upper bound (UB) of the search space.
Step 2: Iteration until stop criteria is met.
IV. TUNING PID CONTROLLER In this article, we apply oldest traditional Ziegler Nichols (NN) method for tuning PID controller and our proposal method using GA and PSO algorithms for finding optimal parameters of PID controller so that minimum integral performance indices. NN method was proposed by John Ziegler and Nathaniel Nichols in 1942 and is still a simple and fairly effective PID tuning method. Ziegler and Nathaniel Nichols proposed two methods for tuning PID controller. The first method applies for process model type of first order system with transport lag. Which has step response likes figure 2 [6].
To apply PSO and GA for finding optimization of PID controller, we can choose one of integral performance index listed in (4) -(7) as objective function. In our case we choose integral of time absolute error (ITAE) as objective function. We encode KP, KI and KD as chromosome in GA and position of particle (solution) in PSO and then we run PSO and GA algorithm to search global min of ITAE. When stopping criterion is satisfied, we obtain optimal parameters of PID controller.

V. EXPERIMENTAL RESULTS
To test our proposal method, we consider model of DC motor is described by figure 3: We apply PID controller to the system so that get the best step response presented on figure 4. We use ZN method 2 and PSO, GA methods to specify KP, KI and KD of PID controller for the model and we obtain results are described in table 1. To compare performance of tradition and two random search methods, we use unit step change of rotor speed. Figures 5, 6 illustrate the convergence of GA and PSO algorithms. Figures 7 to 9 show unit step response of system with PID controller tuned by traditional and heuristic search methods.    Step response of the system with GA tuning method. Fig. 9.
Step response of the system with PSO tuning method.
VI. CONCLUSION In this paper, we present traditional rules and meta-heuristic random search algorithms PSO, GA for tuning PID controller. PSO and GA use the random search approach to find global optimal solution for given problem. To test performance of applying PSO, GA for tuning PID controller, we perform simulation on DC motor model. The simulated results show that heuristic random search methods are better than traditional rules with respect to performance integral indices. In the future, we will study to solve multi-objective optimization problems using PSO and GA algorithm.
ACKNOWLEDGMENT This work is supported by the Hanoi University of Industry.