15 - Performances Comparison of The Bees Algorithm and Genetic Algorithm For PID Controller Tuning
15 - Performances Comparison of The Bees Algorithm and Genetic Algorithm For PID Controller Tuning
ABSTRACT method [2-3]. In this paper, the PID controller for IP system tuned
The inverted pendulum system is a classical benchmarking with The Bees Algorithm (BA) and Genetic Algorithm (GA).
problem which is used to compare of optimization algorithms in Also, the algorithms performances compared according to the
the design of the controller. This paper presents the design of PID effects on the system response in time domain.
controllers for Inverted Pendulum (IP) system using The Bees Following a definition of the system and PID controller in
Algorithm (BA) and Genetic Algorithm (GA) both of which are sections 2, BA and GA is briefly described in section 3. In section
two evolutionary heuristics are population-based search methods. 4, the paper gives the simulation results of the system.
The main goal of the study is get optimal gains for PID controllers
based on the two different tuning algorithm to balance the 2. MODEL DESCRIPTION OF IP SYSTEM
pendulum in upright stable position while moving the cart to a The physical model and MATLAB/SimMechanics model [4] of
desired input. The optimization aim is to minimize of the the IP system shows in Figure 1. The model consists of a free
objective function which includes the time domain responses of moving pendulum with the mass m and length l located in the
the cart’s position and the pendulum’s angle. To comparison the vertical direction to the cart with mass M, which is free to move in
performances of the BA and GA, algorithms are run on the the x direction when a force F is applied to the system. θ=ϕ+π, ϕ
nonlinear model of the system which is designed in represents a small angle from the vertical upward direction. The
MATLAB/Simulink/SimMechanics. The effectiveness parameters of the IP system are shown in Table 1.
comparison of the BA and GA is implemented using the responses
of system controlled by PID controllers with tuned gains. The
obtained simulation results indicate that the BA and GA
approaches have similar performances in this study and both of
them had better performance compared to traditional methods.
CCS Concepts
• Computing methodologies ➝ Optimization
algorithms • Computing methodologies ➝ Computational
control theory
Keywords
The Bees Algorithm, Genetic Algorithm, PID controller tuning,
optimal controller, inverted pendulum. Figure 1. The physical and SimMechanics model of system
1 +_ PID 1 x(t)
Ref. x(t) _ u(t)
+ (t)
0 +_ PID 2
Ref. (t)
position whereas ‘PID 2’ controls the Pendulum’s angle. The 3. Select m Sites for Neighbourhood Search
output of both PID controllers are summed and applied as a force
input to the IP system.
4. Recruit Bees for Selected Sites
The idea is to search for the optimal gains of the PID controllers (More bees for the elite Sites)
with respect to a determined objective function. The objective
function (Je) is created according to existed studies [5-10]. It is
defined in Equation (1). 5. Select the Fittest Bees from Each Site
127
Max. 30 5 10 150 350 60 toolbox. GA parameters is given in Table.4. As a comparative
study, the parameters set similar to BA parameters.
Min. 0 0 0 0 0 0
Table 4. Genetic Algorithm parameters
3.2 Genetic Algorithm
The Genetic Algorithm (GA) is a widely used optimization Population Size 80
technique based on the process that mimics natural selection and Generations 100
genetics. GA repeatedly generates population of individual points
Elite Count 10
in search space which are possible solutions. Every generation,
the population is evolved toward better solutions. In the GA, Crossover Fraction 0.8
variables are defined as binary strings and this representations
corresponding to natural genetics. Other representations can be
used. [14] 4. SIMULATION RESULTS
There are three main steps of GA. The first step is reproduction This section summarizes comparison of proposed optimization
for selecting individuals from the population without changes to techniques performance in the context of objective function
make part of the new population. Second step is the crossover for convergence speed, and comparison of the optimized PID
creating new individuals by selecting one or more points from the controller performance and time domain responses of the system.
present individuals. In this step, created individuals are Optimization algorithms and simulation of the system were
interchanged between present individuals. Last step is mutation performed on a workstation with INTEL® XEON® E5-2630 v3
for modifying selected one or more individual values in the binary CPU and 32GB Ram. CPU time and usage of the Bees Algorithm
representation. In order to find the optimal results, the population is 559.9 sec and % 9. CPU time and usage of the Genetic
must be evaluated. This evaluation means calculating and Algorithm is 503.5 sec and % 8.
selecting best fitness value of each individual. Fitness value is Objective function convergence performances of the BA and GA
calculating by an objective function. Objective function is defined are graphically illustrated in Fig. 4. As seen obviously, GA is
by the optimization problem to search for global optimum converged better at the end; nevertheless GA is converged slower
solutions. Fitness value is used to find the best individuals in the than BA. In other terms, BA gives better solutions at finding
population. Thus, in each generation the best individuals selected global search, however worse at finding local search.
by fitness value to find optimum solutions. Generation is the cycle
of evaluation of the population. This is an iterative cycle and To obtain the best solution using trial-error method, the proposed
finishes after the stop criterion is met. algorithms run many times without changing optimization
parameters. The optimized controller parameters and system time
MATLAB Global Optimization Toolbox is a powerful tool to domain responses to unit step input are given in Table 5.
solve optimization problems. [15] GA is a one of the built-in
method in Global Optimization Toolbox. In this study, Global As seen in Table.5, BA has better rise time for the Cart of system,
Optimization Toolbox used to determine GA optimization. but worse Overshoot value for the swing angle of the Pendulum.
Parameters those are used to build GA optimization with the
128
Table 5. Optimized PID Gains and System Time Domain Responses
PID Controller Gains Time Domain Responses PID Controller Gains Time Domain Responses
Cart Pendulum Cart Pendulum
PID1 PID2 PID1 PID2
(Cart) (Pendulum) (Cart) (Pendulum) Rise Time
1.5616 2.4398e-05 1.9938 3.3358e-06
(sec)
Settling.
P 16.6 149 2.6011 3.5736 10.6 142 3.3060 4.4795
Time (sec)
Max.
I 0 213 0.1438 0.0973 0 172 0.0178 0.0583
Overshoot
Peak Time
D 2.96 41.7 1.0014 0.0300 1.94 50.4 4.0541 0.0200
(sec)
5. CONCLUSIONS Moreover, system time domain responses to unit step input for
The design of PID controllers for Inverted Pendulum (IP) system both optimized controller parameters are demonstrated graphically
using The Bees Algorithm (BA) and Genetic Algorithm (GA) in Fig.5. The results show that the response of tuned PID
both of which are two evolutionary heuristics are population- controllers with BA is more robust and faster with acceptable Max.
based search methods is reported in this paper. Tuning methods Overshoot than GA within controller design criteria of system.
such as BA and GA are inspired by nature, and have proved Consequently, both BA and GA algorithms can be used in tuning
themselves to be effective solutions to optimization problems. GA the parameters of PID controllers successfully for the Inverted
is a commonly used algorithm with many versions and Pendulum system.
applications. However, The BA is a diversity method to provide
efficient solution for tuning of a controller. The aim of this paper
6. ACKNOWLEDGMENTS
is to compare the performance of these two optimization This paper was arisen from M. Arif Sen’s MSc thesis named
techniques for PID controllers design for an IP system. To “Design and Optimization of a Fuzzy Logic Based Controller for
compare the performance, gains of PID controllers are tuned using A Two-Wheeled Robot by Using The Bees Algorithm”. This
both BA and GA to minimize the angle of the pendulum and the work was supported by the Coordinator ship of Selçuk University
positioning errors of the cart. The control responses of system in Scientific Research Projects.
time specification are given in Table. 5.
Figure 5. System Time Domain Responses of The Optimized PID Controllers of both BA and GA
129
7. REFERENCES of Mechanical Engineers, Part I, Journal of Systems and
[1] Prasad L. B., Tyagi B. and Gupta H. O. 2012. Modelling and Control Engineering, pp. 497-508, 226(4).
Simulation for Optimal Control of Nonlinear Inverted DOI= http://dx.doi.org/10.1177/0959651811425312
Pendulum Dynamical System Using PID Controller and
[9] Şen, M.A. and Kalyoncu, M. 2016. Optimal Tuning of a
LQR. In Proceedings of the 6th Asia Modelling Symposium,
LQR Controller for an Inverted Pendulum Using The Bees
(Bali, Indonesia, May 29 – 31, 2012). AMS '12. DOI=
Algorithm. Jounal of Automation and Control Engineering,
http://doi.ieeecomputersociety.org/10.1109/AMS.2012.21
pp. 384-387, Vol. 4(5). DOI=
[2] Deris S., Omatu S. and Kitagawa K. 1995. Stabilization of http://dx.doi.org/10.18178/joace.4.5.384-387
inverted pendulum by the genetic algorithm. In Proceedings
[10] Bakırcıoğlu, V., Şen, M.A. and Kalyoncu, M. 2016.
of the Intelligent Systems for the 21st Century, IEEE
Optimization of PID Controller Based on The Bees
International Conference on, Systems, Man and Cybernetics. Algorithm for One Leg of a Quadruped Robot. In
(Vancouver, British Columbia, Canada). DOI=
Proceedings of the 3th International Conference on Control,
https://doi.org/10.1109/ICSMC.1995.538481
Mechatronics and Automation (Barcelona, Spain, December
[3] Moghaddas M., RezaDastranj M., Changizi N. and Khoori N. 21 – 22, 2015). ICCMA'12. MATEC Web of Conferences,
2012. Design of Optimal PID Controller for Inverted pp. 1-4, Vol. 42 (03004). DOI=
Pendulum Using Genetic Algorithm. International Journal of http://dx.doi.org/10.1051/matecconf/20164203004
Innovation, Management and Technology, Vol. 3, No. 4.
[11] D. T. Pham et al. 2006. The Bees Algorithm – A Novel Tool
DOI= http://doi.org/10.7763/IJIMT.2012.V3.271 for Complex Optimization Problems. In Proceedings of the
[4] Information on Available: 2th Virtual International Conference on Intelligent
http://ctms.engin.umich.edu/CTMS Production Machines and Systems,(3-14 July 2006), ISBN-
[5] Şen M.A. and Kalyoncu M. 2015. Optimization of a PID 10:08-045157-8, pp. 454-459. PROMS '06. DOI=
Controller for an Inverted Pendulum Using The Bees https://dx.doi.org/10.1016/b978-008045157-2/50081-x
Algorithm. Applied Mechanics and Material Journal, [12] Pham D. T., Ghanbarzadeh A., Koc E., Otri S., Rahim S. and
pp.1039-1044, Vol. 789-790. DOI= Zaidi M. 2005. In: The Bees Algorithm Technical Note.
www.scientific.net/AMM.789-790.1039 Manufacturing Engineering Centre, Cardiff University, pp.
[6] Pham D. T., Koc E., Kalyoncu M., and Tınkır M. 2008. 1-57.
Hierarchical PID Controller Design for a Flexible Link [13] Pham D. T. and Castellani M. 2013. Benchmarking and
Robot Manipulator Using the Bees Algorithm. In Comparison of Nature-Inspired Population-Based
Proceedings of 6th International Symposium on Intelligent Continuous Optimization Algorithms. Soft Computing - A
Manufacturing Systems, (Sakarya, Turkey) Fusion of Foundations, Methodologies and Applications. pp.
[7] Pham D. T. and Kalyoncu M. 2009. Optimization of a Fuzzy 871-903, Vol. 18. DOI= https://doi.org/10.1007/s00500-013-
Logic Controller for a Flexible Single-Link Robot Arm 1104-9
Using the Bees Algorithm, Cardiff University, UK, IEEE. [14] Rao, S. S. 2009. Engineering Optimization Theory and
DOI= https://doi.org/10.1109/INDIN.2009.5195850 Practice, 4th Edition, John Wiley & Sons Inc.
[8] Fahmy A. A., Kalyoncu M. and Castellani M. 2012. [15] MATLAB Global Optimization Toolbox User’s Guide
Automatic design of control systems for robot manipulators (Release 2015b),
using The Bees Algorithm. In Proceedings of the Institution http://www.mathworks.com/help/gads/index.html
130