0% found this document useful (0 votes)
11 views

15 - Performances Comparison of The Bees Algorithm and Genetic Algorithm For PID Controller Tuning

This document compares the performance of the Bees Algorithm and Genetic Algorithm for tuning PID controllers for an inverted pendulum system. It describes using these evolutionary algorithms to find optimal PID gains to balance the pendulum in an upright position while moving the cart to a desired input. The algorithms aim to minimize an objective function of time domain responses. The Bees Algorithm and Genetic Algorithm are run on a nonlinear model of the system in MATLAB/Simulink/SimMechanics. The effectiveness of the algorithms is compared using responses of the system controlled by PID controllers with tuned gains. Results show the algorithms have similar performance, both outperforming traditional tuning methods.

Uploaded by

ahmed.almohammed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

15 - Performances Comparison of The Bees Algorithm and Genetic Algorithm For PID Controller Tuning

This document compares the performance of the Bees Algorithm and Genetic Algorithm for tuning PID controllers for an inverted pendulum system. It describes using these evolutionary algorithms to find optimal PID gains to balance the pendulum in an upright position while moving the cart to a desired input. The algorithms aim to minimize an objective function of time domain responses. The Bees Algorithm and Genetic Algorithm are run on a nonlinear model of the system in MATLAB/Simulink/SimMechanics. The effectiveness of the algorithms is compared using responses of the system controlled by PID controllers with tuned gains. Results show the algorithms have similar performance, both outperforming traditional tuning methods.

Uploaded by

ahmed.almohammed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Performances Comparison of The Bees Algorithm and

Genetic Algorithm for PID Controller Tuning


Muhammed Arif Şen Veli Bakırcıoğlu Mete Kalyoncu
Department of Technical Science Vocational Department of
Mechanical Engineering Education and Training School Mechanical Engineering
Selçuk University, Konya/Turkey Aksaray University, Aksaray/Turkey Selçuk University, Konya/Turkey
[email protected] [email protected] [email protected]

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. INTRODUCTION Table 1. Parameters of the IP system


The stabilizing of Inverted Pendulum (IP) system is noteworthy
an issue in the field of control engineering. It is used as Symbol Parameter Value Unit
benchmark for testing control algorithms due to its high degree of
M Mass of the cart 0.5 [kg]
instability and nonlinearity. PID and LQR controller is a typical
method used for position and stability control of this system [1]. m Mass of the pendulum 0.2 [kg]
Because of its highly nonlinear, the performances of PID
b Friction of the cart 0.1 [N/m/s]
controller rely on selection technique of controller gains.
Therefore, tuning of PID gains using a search algorithm is provide l Length of the pendulum 0.3 [m]
better response from the system more than classical methods such
I Inertia of the pendulum 0.006 [kgm2]
as trial and error. A lot of work has been carried out on IP system
in terms of its stabilization with Genetic Algorithm optimization g Gravity 9.81 [m/s2 ]
Permission to make digital or hard copies of all or part of this work for
personal or classroom use is granted without fee provided that copies are
not made or distributed for profit or commercial advantage and that
copies bear this notice and the full citation on the first page. Copyrights
3. DESIGN OF PID CONTROLLER FOR
for components of this work owned by others than ACM must be THE IP SYSTEM
honored. Abstracting with credit is permitted. To copy otherwise, or
republish, to post on servers or to redistribute to lists, requires prior
specific permission and/or a fee. Request permissions from
[email protected].
ICMCE '16, December 14-17, 2016, Venice, Italy
© 2016 ACM. ISBN 978-1-4503-5215-4/16/12…$15.00.
DOI: http://dx.doi.org/10.1145/3036932.3036951
126
Objective Function

The Bees Algorithm / Genetic Algorithm


IP System

1 +_ PID 1 x(t)
Ref. x(t) _ u(t)
+ (t)
0 +_ PID 2
Ref. (t)

Figure 2. The block diagram of PID controller tuning system


The PID is an acronym of Proportional (P) – Integral (I)- in Table 2. Also, optimization rages of PID controller’s
Derivative (D). It is a sort of the feedback controller whose output, parameters are given Table 3.
control variable, is the error (e) between the user-defined set point
and the measured process variable. Each component of the PID 1. Initialise a Population of n Scout Bees
controller contributes a particular action to the error. The
controller design criteria: The maximum per cent overshoot (%OS)
is less than 22.5%, the settling time (ts) is less than 5 second, the 2. Evaluate the Fitness of the Population
steady-state error (ess) is less than 2% for the cart’s position (x)
and the pendulum’s angle (ϕ). Figure 2. shows a block diagram of
the system having two PID controllers. ‘PID 1’ controls the cart’s
Neighbourhood Search

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

𝐽𝑒 = [15𝑋𝑡𝑟 + 10𝑋𝑡𝑠 + 10𝑋𝑡𝑝 + 30𝑋𝑚𝑎𝑥 + 2.103 𝑋𝑒𝑠𝑠 ]


6. Abandon Sites without New Information
+ [75𝜙𝑛𝑜𝑟𝑚 + 10𝜙𝑡𝑠 + 100𝜙𝑡𝑝
+ 500𝜙𝑚𝑎𝑥 + 15.102 𝜙𝑒𝑠𝑠 ] (1)
7. Assign the (n–m) Remaining Bees to
Random Search
Where tr is the rise time, ts is the settling time, tp is the peak time,
max is the maximum overshoot, ess is the steady state error, norm 8. New Population of Scout Bees
is angle of matrix norm. The constant values are weight factors.

3.1 The Bees Algorithm


This section summarizes the main steps of The Bees Algorithm.
Figure 3. shows the pseudo-code for the algorithm in its simplest Figure 3. The pseudo-code for The Bees Algorithm
form. Reference [11-13] describes The Bees Algorithm in detail.
The algorithm requires a number of parameters to be set, namely:
number of scout bees (n), number of sites selected for exploitation Table 2. The Bees Algorithm parameters
out of n visited sites (m), number of top-rated (elite) sites among n m e nep nsp ngh itr
the m selected sites (e), number of bees recruited for the best e
sites (nep), number of bees recruited for the other (m-e) selected 20 10 5 10 5 1 100
sites (nsp), initial size of each patch (a patch is a region in search .
space that includes a visited site and its neighbourhood and
stopping criterion). Table 3. Optimization ranges of parameters
PID 1 PID 2
To find the best value of the BA parameters, the other parameters
are held constant and the algorithm is run with different values of Kp Ki Kd Kp Ki Kd
the considered parameter. The best parameters of BA are shown

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

Figure 4. Objective Function Convergence Performance of both BA and GA

128
Table 5. Optimized PID Gains and System Time Domain Responses

The Bees Algorithm Genetic Algorithm

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

You might also like