Advanced Materials Research Vol. 903 (2014) pp 321-326 Online: 2014-02-27 (2014) Trans Tech Publications, Switzerland doi:10.4028/www.scientific.net/amr.903.321 Modeling and Simulation of Swarm Intelligence Algorithms for Parameters Tuning Of PID Controller in Industrial Couple Tank System Ismail Mohd Khairuddin 1,a,Amira Sarayati Ahmad Dahalan 2, Amar Faiz Zainal Abidin 2,8,b,Yee Yang Lai 2,Nur Anis Nordin 3, Siti Fatimah Sulaiman 2,7, Hazriq Izzuan Jaafar 2,4,c, Syahrul Hisham Mohamad 2,5 and Noor Hafizah Amer 7 1 Faculty of Manufacturing Engineering, Universiti Malaysia Pahang, 26600 Pekan, MALAYSIA 2 Faculty of Electrical Engineering, Universiti Teknologi Malaysia, 81310 Johor Bahru, Johor, MALAYSIA 3 Faculty of Computing, UniversitiTeknologi Malaysia, 81310 Johor Bahru, Johor, MALAYSIA 4 Faculty of Electrical Engineering, UniversitiTeknikal Malaysia Melaka, 76100 Durian Tunggal, Hang Tuah Jaya, Melaka, MALAYSIA 5 Faculty of Engineering Technology, UniversitiTeknikal Malaysia Melaka, 76100 Durian Tunggal, Hang Tuah Jaya, Melaka, MALAYSIA 6 Faculty of Electronic & Computer Engineering, UniversitiTeknikal Malaysia Melaka, 76100 Durian Tunggal, Hang Tuah Jaya, Melaka, MALAYSIA 7 Department of Mechanical Engineering, Faculty of Engineering, National Defense University of Malaysia, Sungai Besi Camp, 57000, Kuala Lumpur, MALAYSIA 8 School of Science and Technology, Wawasan Open University, 10050 Pulau Pinang, MALAYSIA a ismailkhai@ump.edu.my, b amarfaiz@fke.utm.my, c hazriq@utem.edu.my Keywords: PID Controller; Optimization; Particle Swarm Optimization; Firefly Algorithm; Computational Intelligence. Abstract. Industrial tank system is widely used in consumer liquid processing and chemical processing industry. In liquid-based product manufacturing system, one of the main components consists of an industrial tank. This paper explores the applications of two swarm intelligence algorithms in optimizing the PID controller parameters. These swarm intelligence algorithms are Particle Swarm Optimization (PSO) and Firefly Algorithm (FA). Each agent of the swarm intelligence will represent a possible solution of the problem where each dimension corresponds to the PID controller s parameters. Result obtained shows that there are potential in improving these algorithms to replace the conventional way of obtaining PID controller s parameters Introduction Numerous liquid based applications such as liquid purification system, beverage productions, food preparations and pharmaceutical processing are done using industrial tank system. One of the simplest and most commonly used industrial tank systems is the couple tank system. A couple tank system consists of two liquid tanks, where the first tank is used to accept incoming liquid while keeping the liquid variation at a desired need. The second tank is usually used as an output medium, to supply the liquid at a constant speed. Previous literatures show that there are several attempts in controlling the liquid flow in industrial tank system using different control strategies such as in [1] where A.Visioli proposed the use of Proportional Integral Derivative (PID) plus feed forward controller. In year 2002, K. K. Tan et al. proposed the use of robust self-tuning PID controller [2]. M. S. Ramli et al. proposed an All rights reserved. No part of contents of this paper may be reproduced or transmitted in any form or by any means without the written permission of Trans Tech Publications, www.ttp.net. (ID: 175.136.13.137-29/10/15,05:43:14)
322 Manufacturing Engineering improved swarm adaptive tuning of hybrid PI neural network controller for industrial coupled tanks [3]. In [4], Wahyudi et. al implemented a robust anti-windup PID controller for couple tank system. Introduction to Coupled Tank System A couple tank system consists of two tanks; each with an orifice and sensor to observe the liquid level, and an electrical motor to pump the water into the tank. The system is taken from [4].The difference is the error, E(s) which is being fed into a PID controller, Gc(s). Then, the output from the controller is fed to the plant. According to [4], the plant, in this case the coupled tank system, can be modeled based on [5]. Mathematical modeling of the coupled tank system is shown in Eq. 1 [4]. ( )= ( ) =. (1) ( ) where V(s) is the input voltage of the electrical motor and H2(s) is the level of the second tank. Modeling Swarm Intelligence for parameters tuning in PID controller for industrial tank system Swarm Intelligence is an emerging field in computational intelligence where all the algorithms are inspired by the cooperative knowledge of nature especially the fauna. All swarm intelligence algorithms consists of 3 main components: initial random position in the search space, fitness comparison between the agents, and the process of improving each agent by learning from other agents. PSO is one of the earliest SI introduced by J. Kennedy and R. Russell in 1995 [6]. The algorithm is inspired by the movement of the flocking birds. FA was introduced in 2007 by X.-S. Yang [7] which fundamentally based on the mating behavior of fireflies. For this experiment, both algorithms can be modeled using the same model. The proposed model suggests that the relationship of agent s position with PID parameters can be generalized as Eq. 2. =,, For example, =[2.00,3.00,1.00] means that the 2 nd agent suggests that the parameters of the PID controller should be tuned as follows: = 2, = 3, =1. While = [1.23,2.78,0.192] means that the 10 th agent suggests that the parameters of the PID controller should be tuned: = 1.23, =2.78, = 0.192. The fitness function is the function that the agents use to evaluate their proposed solution. For this study, a 3-stage fitness function method similar to [8] was used to evaluate the fitness of each agent. This algorithm is presented in Algorithm 1 below where OS is overshoot, is settling time, is rise time and is steady state error. Algorithm 1: Fitness Function Evaluation for the PID Parameters Tuning 01 if ( )> 0 02 Reject solution by assigning a really large value of ( ), ( ), and ( ). 03 else 04 if ( ) ( ) 05 if ( )< ( ) 06 Accept new solution as best found solution, = 07 else 08 if ( ) ( ) 09 if ( )< ( ) 10 Accept new solution as best found solution, = 11 else 12 if ( )< ( ) 13 Accept new solution as best found solution, = 14 end (2)
Advanced Materials Research Vol. 903 323 15 end 16 end 17 end 18 end 19 end Modeling PID Controller in FA.The algorithm starts by generating initial population of agent, randomly. Here, the agent is the firefly. The fireflies positions are evaluated using the fitness function in Algorithm 1. Light intensity, is formulated to be equal to the inverse value of the firefly s fitness function as shown in Eq. 3. = ( ) From here on the algorithm will start looping until stopping criteria are fulfilled. For this study, maximum iteration, is chosen as stopping criteria where the algorithm will stop when the iteration, reached maximum iteration,.for each iteration, each agent will move toward to other agent with greater light intensity. The movement of this agent is bounded by Eq. 4. = + ( )+ (4) Here, is the distance between two agents in Euclidean distance. Given agent and agent, the Euclidean distance can be calculated using Eq. 5. is the agent s attractiveness at =0. is absorption coefficient. is randomization parameter which in range [0,1]. is a vector random number taken from uniform distribution. = (5) The fitness of the new agent s position is evaluated and the light intensity is updated. If the fitness obtained smaller than the global best record, the new fitness will become the new global best and the agent s position is kept as the best solution found so far. The algorithm is shown in Algorithm 2. Algorithm 2: Firefly Algorithm for tuning PID parameters 01 Set fitness function, ( )according to Eq. 2 where =[,,.., ] 02 Generate randomly initial population of agent, where = 1,2,.., 03 Find agent s light intensity, at using Eq. 3 04 Define light absorption coefficient, 05 while < 06 for = 1 to 07 for = 1 to 08 if < 09 Move agent towards using Eq. 4 10 Evaluate new solution using Algorithm 1, update using Eq. 3 and if necessary 11 end if 12 end for 13 end for 14 end while 15 Post process results and visualization Modeling PID Controller in PSO. Similar to FA, algorithm for PSO starts by randomly assigning the particle position based on (2). Then, the particle fitness is calculated using Algorithm 1.Thepbest and gbest will be updated if the particle has a better fitness value compared to the current pbest and gbest values. Then, the particle velocity, is updated using Eq. 6. = + ( )+ ( ) (6) Here, and are random values in range [0,1], is cognitive component and is social component. With this, the particle position is updated using Eq. 7. (3)
324 Manufacturing Engineering = + (7) The process is repeated until the iteration counts reach the maximum. The final gbest is taken as the best found solution. This algorithm is shown in Algorithm 3. Algorithm 3: Particle Swarm Optimization for PID parameters 01 Initialize all particle by randomizing position based on (2) 02 while < 03 for = 1 to 04 Calculate fitness for particle using Algorithm 1 05 if the particle fitness is better than previous pbest then 06 Set the particle fitness value as new pbest 07 if the pbest is better than previous gbest 08 Set pbest as new gbest 09 end if 10 end if 11 end for 12 for = 1 to do 13 Calculate particle velocity according to Eq. 6 14 Update the particle position according to Eq. 7 15 end for 16 end while 17 Post process results and visualization Implementation and Simulation result To compare the performance between the algorithms, the algorithms are tested on 2 conditions where the desired liquid level is 5 cm and 10 cm. Table 1 shows the parameters values used throughout this simulation. The Simulink block diagram used in the simulation is presented in Fig 1. For each case, the best results out of 5 simulations are listed in Table 2.Fig 2 to Fig 3 shows steady state error graph in percentage (top left), settling time in second (top right), rise time in second (bottom left), and input/output in centimeter (bottom right, blue colour for input, and red colour for output). It can be seen that the performance of PSO is better than FA. In 5 cm case study, PSO shown a better settling time compared to FA. For the 10 cm case study, the superior performance by PSO can be seen clearly as PSO managed to find optimized values of PID parameters which provide satisfactory steady state error. This is due to the fact that PSO has a really good convergence property. Table 1: Comparison of the PSO and FA parameters PSO FA Common Parameters Number of agents, q 10 10 Max Number of iterations, 50 50 Number of computations 5 5 Individual Parameters Inertia weight, 0.9 1.0 Cognitive component, 1.42 1.0 Social component, 1.42 Not applicable
Advanced Materials Research Vol. 903 325 Figure 1:Block diagram of the system for simulation Table 2: Comparison of the result obtained by PSO and FA PSO FA PSO FA 5 cm (Fig 2 & 3) 10 cm 213.4157 0.2559 19.2582 30.9845 0.0582 0.0018 0.0122 0.0000 945.2475 0.0000 384.2005 428.3399 Overshoot (%) 0.0000 0.0000 Overshoot (%) 0.0000 0.0000 Steady state 0.000 0.0000 Steady state 0.0000 0.8935 error (%) error (%) Settling time (s) 13.8728 425.7121 Settling time (s) 78.9246 50.8769 Rise time (s) 7.9516 270.6956 Rise time (s) 43.3435 28.0490 Fig. 2: Graphs for PSO-tuned PID Controller for 5 cm case study
326 Manufacturing Engineering Conclusion Fig. 3:Graphs for FA-tuned PID Controller for 10 cm case study. In this paper, a preliminary study of the application of swarm intelligence in tuning PID controller parameters for coupled tank application was presented, namely: PSO and FA. It can be seen that PSO performed better than FA in terms of its control performance indicator. However, this might not be the best case for a generic application of PID tuning. Further analysis is required especially in selecting the parameters for FA which by itself can be an optimization problem. References [1] L. Consolini, G. Lini, A. Plazzi, A. Visioli, Minimum-time rest-to-rest feedforward action for PID feedback MIMO systems, in Proceeding of IFAC Conference in PID Control, 2012. [2] K. K. Tan, R. Ferdous, S. Huang, Closed-loop automatic tuning of PID controller for nonlinear systems, in Chemical Engineering Sciences, 2002, vol. 57, pp. 3005-3011.. [3] M. S. Ramli, R. M. T. R. Ismail, M. A. Ahmad, S. M. Nawi, M. A. M. Hussin, Improved Coupled Tank Liquid Levels System Based on Swarm Adaptive Tuning of Hybrid Proportional- Integral Neural Network Controller, in American Journal of Engineering and Applied Sciences, 2009, vol. 2, no. 4, pp. 670-675. [4]Wahyudi, M. Fadhil, M. Shazri, Robust Anti-Windup PID Control of a Couple Industrial Tank System, in Proceeding of the International Conference on Mechnical Engineering, 2007, no. 62, pp. 1-4. [5] Wahyudi, M. Fadhil, Shazari, Modeling and Parameters Identification of a Coupled Industrial Tank System, in Proceeding of National Conference on Software Engineering and Computer System, 2007. [6] J. Kennedy, R. Eberhart, Particle Swarm Optimization, in Proceeding of IEEE Conference on Neural Network, 1995, vol. 4, pp. 1942-1948. [7] S. X. Yang, Firefly Algorithm, Stochastic Test Functions and Design Optimisation, in International Journal of Bio-Inspired Computation, 2010, vol. 2, no. 2, pp.78 84 [8] H. I. Jaafar, Z. Mohamed, A. F. Z. Abidin, Z. A. Ghani, PSO-Tuned PID Controller for a Nonlinear Gantry Crane System, in Proceeding of IEEE International Conference on Control System, Computing and Engineering, 2012.
Manufacturing Engineering 10.4028/www.scientific.net/AMR.903 Modeling and Simulation of Swarm Intelligence Algorithms for Parameters Tuning of PID Controller in Industrial Couple Tank System 10.4028/www.scientific.net/AMR.903.321