Professional Documents
Culture Documents
Tuning A PID Controller Using Metaheuristic Algorithms
Tuning A PID Controller Using Metaheuristic Algorithms
d prateek.pgarg@gmail.com
Abstract—This study describes the difficulties that Various methods can be found, with the ZN tuning
arise while fine-tuning the PID controllers. PID formula being the most well-known method. Once tuned
controllers are used in various systems to keep things using the ZN method, a good system response can be
stable but finding the right settings can be tricky, achieved, but not necessarily an optimal one.
especially for complex systems that behave in
On the other hand, Genetic Algorithm (GA) is
unpredictable ways. If the controller has not been set
highly effective at finding solutions to a variety of
up correctly, it can cause the system to become
problems. ACO is a versatile optimization method and
unstable and not perform as intended. Although there
PSO’s ability to work with swarms allows it to explore
are some techniques that have shown promise in the
multiple local minima, increasing the chances of finding
past, they also have their limitations.
the global minima.
To tackle this issue, this study proposes a solution that
A. BACKGROUND
uses metaheuristic algorithms such as Particle Swarm
Optimization (PSO), Genetic Algorithm (GA), and Ant Gas turbines are commonly used in various
Colony Optimization (ACO). These algorithms are industries, such as refineries and chemical plants, to power
designed to find optimal settings for the controller compressors. Centrifugal compressors are typically used
more efficiently than traditional methods. The due to their ability to handle large volumes of data, which
objective of this research is to compare how well these translates to high energy consumption. Turbine-
new methods are compared to the traditional methods. compressor systems are highly reliable and play a critical
The results show that the new algorithms are more role in plant operations.
effective and lead to better performance and stability
In the mentioned setup, the turbine is commonly
in the system. This research provides a promising
powered by high-pressure steam (HPS) which in turn
solution to the challenges of fine-tuning PID
drives the compressor. Hydraulic governor is responsible
controllers, especially for more complex systems that
for regulating the flow of steam to the turbine section.
are difficult to control.
Meanwhile, the electronic governor control panel employs
Keywords— PID Controller, Optimization, Genetic a PID controller to control the opening of the governor.
Algorithm, Ant Colony Optimization, Particle Swarm
Optimization, Rise Time, Maximum Overshoot, Settling
Time
I. INTRODUCTION
∞
As it is widely known, PID controllers are fiae = ∫0 |𝑒(𝑡)|𝑑𝑡
extensively used in various aspects of industrial
automation across different industries, including heavy Derivative action introduces a lead into the
ones like refineries and shipbuilding. However, to system in the action. This eliminates lag in the system
optimize the performance, we need to determine the caused by the Integral action earlier in the process.
optimal tuning method. Should we still rely on traditional
methods like the Ziegler-Nichols technique or move to A. CONTINUOUS PID
advanced methods? The PID controller transfer function:
II. PID CONTROLLER
Fig 2. The PID Controller – Non-Interacting Form PID controllers are widely used in industries
Schematic Diagram [13] such as manufacturing, robotics, and process control to
regulate variables such as temperature, pressure, flow, and
For proportional control,
𝑃 = 𝐾𝑝 × 𝑒(𝑡) position. They are also used in HVAC systems,
automotive control, and flight control systems.
To control the system, it makes use of the
proportion of system errors. Offset is produced into the B. DESIGNING PID
system as a result of this activity.
The PID controller transfer function is given as
In Integral control,
𝑡
𝐺𝑐 (𝑠) = 𝐾𝑝 + ( 𝐾𝑖 /𝑠) + 𝐾𝑑𝑠
𝐼 = 𝐾𝑖 × ∫ 𝑒(𝑡) 𝑑𝑡
0
The PID controller's P, I, and D gains are given
Its magnitude is proportional to the system's by Kp, Ki, and Kd, respectively. As depicted in Figure 1,
level of inaccuracy. Integral action causes a lag in the the ACO algorithm is utilized to generate the PID
system during the action. Offset produced earlier by the controller Gc(t)'s Kp, Ki, and Kd gains for a specific plant
Proportional action will be removed as a result of this. Gp.
𝑡
In Derivative control, 𝑈(𝑡) = 𝐾𝑝 × 𝑒(𝑡) + 𝐾𝑖 ∫ 𝑒(𝜏) 𝑑𝜏 + 𝐾𝑑 × 𝑑{𝑒(𝑡)}/𝑑𝑡
0
𝐷 = 𝐾𝑑 × 𝑑{𝑒(𝑡)}/𝑑𝑡
Fig 4. Open Loop System Step Response [12] In order to utilize Ziegler-Nichols’ calculation
method, the step response of the plant must be graphed, as
Initially, the maximum slope of the response is illustrated in the Figure. Response of the system in the figure
identified, and a tangent is drawn at the point. The L indicates L = 1.69 T = 8.73, and K = 1.
parameter is obtained by determining the intersection
between the tangent and the time axis, while the intersection
between the tangent and the line y(t) = K yields T. Parameters
are then calculated using the values of a = KL / T and L, as
detailed in Table 1.
A. POPULATION SIZE
Determining the number of individuals in a
Table 2. Independent P, I and D effect on the System population is a crucial step in GA.
Response
The population estimation method used in this
B. THEORETICAL CALCULATION OF PID study was arbitrary, but based on previous research, a safe
PARAMETERS range for population size is between 30 and 100 individuals.
However, when a sample population of 20 was used in this
We further elaborate on PID tuning techniques experiment, the results were discouraging, prompting further
discussed; a calculation is necessary. In order to do so, let us testing with populations of 40, 60, 80, and 90 individuals.
consider the response of a 3rd order system with a transfer Ultimately, a population size of 80 was deemed appropriate,
function given by with no additional optimization observed beyond a
population size of 90 or more.
𝟏
𝐆𝐩 (𝐬) =
(𝟑𝒔 + 𝟏)(𝟐𝒔 + 𝟏)(𝒔 + 𝟏) B. REPRODUCTION
The reproduction step in a genetic algorithm is a
To simulate the control system in the s-domain, we
crucial process where the fittest individuals from the current
will be using Simulink models as depicted in Figure 5.
population are selected for producing the next generation of
solutions. The selection process is based on the fitness
function, which evaluates the quality of the solutions. The
goal of the reproduction step is to create a diverse population
that retains the best solutions from the current population
C. CROSSOVER
The crossover operator simulates the genetic
recombination process in biological organisms, where the
genetic material of two parents is combined to produce
offspring with a new set of traits [8].
𝛼 𝛽
behaviour of flocks of birds or schools of fish, where all
[𝜏𝑖𝑗 ] [𝜂𝑖𝑗 ] members of the group can benefit from the experiences of
𝑃𝑖𝑗 =
∑ℎ𝜖𝑆[𝜏𝑖ℎ ]𝛼 [𝜂𝑖ℎ ]𝛽 others.[7] Essentially, if one bird in a flock finds food, the
others can follow and benefit from this discovery.
The likelihood of transitioning between nodes is
determined by finding a balance between the heuristic and In the context of optimization, PSO can be thought
pheromone factors. Nodes that are closer (i.e., with a lower of as a group of particles moving through a high-dimensional
cost path) should be selected more frequently to implement a solution space, each particle representing a potential
greedy constructive heuristic for the heuristic factor. solution. The particles move towards the best solution found
Regarding the pheromone factor, if a particular edge (i, j) has so far by the group, while also exploring new areas of the
been frequently utilized, it is deemed highly desirable, solution space. While it is unlikely that PSO will find the true
leading to an autocatalytic process. When the selection of the global optimal solution, it often produces results that are very
next node yields a value of Pij, the previously mentioned rule close to it.
is applied, and the heuristic factor ij is calculated using the
A. OPTIMIZATION PROBLEM
following formula.
1 The optimization problem involves a vector
𝜂𝑖𝑗 =
𝑓(𝑋𝑗 ) variable X = [x1x2x3…xn], which is used to minimize or
maximize the cost function f(X), depending on the
In the given equation, f(X) denotes the cost optimization formulation. X is also referred to as the position
function of X. [4] The above formula prefers choosing edges vector, representing a variable model with n dimensions
that are shorter (i.e., lower cost) and have a greater quantity where n is the number of variables in the problem. For
of pheromone. When the ant travels from node i to node j, it instance, in the problem of a flock of birds choosing a landing
leaves a substance on the path, defined as follows: point, X can be thought of as the latitude and longitude. The
𝑄 fitness function or objective function, f(X), evaluates how
𝑘 𝑖𝑓 k th 𝑎𝑛𝑡 𝑢𝑠𝑒𝑠 𝑒𝑑𝑔𝑒 (𝑖, 𝑗) 𝑖𝑛 𝑖𝑡𝑠 𝑡𝑜𝑢𝑟 good or bad a position X is based on how well a bird can land
∆𝜏𝑖𝑗 = { 𝐿𝑘
0 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒 there. This evaluation is done using multiple survival criteria.
The amount of pheromone laid by ants is related to
B. PSO ALGORITHM
the quality of the path they take, with more pheromone being
deposited on shorter paths. This value is evaluated after an
The following is the step-by-step procedure for the
ant completes a tour, which consists of n iterations or
algorithm:
generations. The amount of pheromone previously deposited
on the trail is then updated based on certain guidelines. The 1. Generate a ‘population’ of agents (particles) that are
update is done by considering a constant Q and the cost of evenly spread out across the range of X.
the tour performed by the ant, denoted by Lk.
2. Compute the value of the objective function for each
𝜏𝑖𝑗 (𝑡 + 𝑛) = 𝜌. 𝜏𝑖𝑗 + ∆𝜏𝑖𝑗 (𝑡)
particle by considering its position. For instance, consider the
𝑚 following function.
∆𝜏𝑖𝑗 (𝑡) = ∑ 𝜏𝑖𝑗 (𝑡)
𝑘=1 z = f (x, y) = sinx2 + siny2 + sinx siny
where m represents the number of ants, the coefficient (0,1) 3. If a particle's current position is superior to its previous
determines how long the trail persists during a cycle, where best position, then replace it.
(1- ρ) represents the amount of trail that evaporates between
generation ηg and ηg+1. 4. Determine the best particle based on their previous best
The method for modifying pheromone levels aims positions.
to replicate the impact of fresh pheromone deposition by ants
on the edges visited, as well as the dissipation of pheromone. 5. Modify the velocities of the particles.
The process concludes either when an ant finds a solution or
the maximum number of iterations is attained.
6. Update the positions of the particles to their new locations.
VI. PARTICLE SWARM OPTIMIZATION
Particle swarm optimization (PSO) is a bio- 7. Continue with the steps described in 2 until the stopping
inspired technique utilized for finding the best possible conditions are met.[3]
solutions within a provided solution space. It differs from
other optimization algorithms since it solely depends on the VII. RESULTS
objective function and does not rely on the gradient or any
differential form of the objective. In this section, we present the results of our
proposed algorithms using both numerical and graphical
The idea behind the algorithm is based on the
representations. All computations were performed using
MATLAB/Simulink. In order to compare the performance of PSO. The plant used in our experiments is:
our algorithms, we also used a Genetic Algorithm, ACO and
X. REFERENCES
Salles. "Optimal tuning parameters of the dynamic matrix [8] Altinten, A.. "Generalized predictive control applied to a
predictive controller with ant colony optimization", 2014 pH neutralization process”, Computers and Chemical
11th IEEE/IAS International Conference on Industry Engineering, 200710
Applications, 2014 [9] Cheng-Chih Chien. "Ant colony optimization for
[3] Houssam Nahilia, Mohamed Boudour. "Distribution designing of PID controllers”, 2004 IEEE International
power loss minimization using Particle Swarm Conference on Robotics and Automation (IEEE Cat No
Optimization and genetic algorithms: Application on 04CH37508) CACSD04, 2004
Algerian isolated grid", 2016 International Conference on [10] M. V. Subramanyam, K. S. Prasad, and P. G. K. Rao,
Control, Decision and Information Technologies “Robust Control of Steam Turbine System Speed using
(CoDIT), 2016 Improved IMC Tuned PID Controller,” Procedia
[4] Ying-Tung Hsiao, Cheng-Long Chuang, ChengChih Engineering, vol. 38, pp. 1450-1456, 2012.
Chien. "Ant colony optimization for best path planning”, [11] Datta, A & Nandakumar, Soundharyaa. (2017). A survey
IEEE International Symposium on Communications and on bio inspired meta heuristic-based clustering protocols
Information Technology, 2004. ISCIT 2004., 2004 for wireless sensor networks. IOP Conference Series:
[5] Seckiner, S.U. "Ant colony optimization for the job Materials Science and Engineering. 263. 052026.
rotation scheduling problem”, Applied Mathematics and 10.1088/1757-899X/263/5/052026.
Computation, 20080715 [12] Dinakin, Demilade & Oluseyi, Peter. (2019).
[6] D.S. Pereira, J.O.P. Pinto. "Genetic algorithm based Comparative study of meta-heuristic and classical
system identification and PID tuning for optimum techniques for automatic generation control of a multi-
adaptive control”, Proceedings, 2005 IEEE/ASME source single-area hydro-thermal-gas power system. 10.
International Conference on Advanced Intelligent 151-172. 10.30572/2018/kje/100310.
Mechatronics., 2005 [13] Bharadwaj, C. & Thanikanti, Sudhakar Babu &
[7] “Proceedings of the International Conference on Soft Natarajan, Rajasekar. (2018). Tuning PID Controller for
Computing for Problem Solving (SocProS 2011) Inverted Pendulum Using Genetic Algorithm.
December 20-22, 2011”, Springer Science and Business 10.1007/978-981-10-4762-6_38.
Media LLC, 2012 [14] Bansal, Hari. (2009). Tuning of PID Controllers using
Simulink. International Journal of Mathematical
Modeling, Simulation and Applications.