Optimal PID Control of Magnetic Levitation System Using Genetic Algorithm
Optimal PID Control of Magnetic Levitation System Using Genetic Algorithm
net/publication/263747891
CITATIONS READS
37 1,772
3 authors:
Peter Palensky
Delft University of Technology
348 PUBLICATIONS 6,759 CITATIONS
SEE PROFILE
All content following this page was uploaded by Mohsin Shahzad on 15 April 2016.
Abstract—Due to its inherent nonlinearities and highly for enhancing the performance capabilities of PID controllers
unstable nature with many practical applications i.e. high speed is highly desired [7]. Thus the interest in different random
train, frictionless bearings, levitated wind tunnel etc., the search methods is increased tremendously during recent past
Magnetic Levitation System (MLS) is considered as a good test- because of their very good capabilities in finding the global
bench for design and analysis of control systems. This paper
optimum solution in problem space [8].
presents the design of PID controller for MLS based on an
efficient method of tuning controller parameters using Genetic In literature, a lot of studies are available on designing a
Algorithm (GA). PID controller was designed for MLS. In order PID controller for not only Magnetic Levitation System (MLS)
to achieve the optimal performance indices, controller but also other systems. In [9] Matlab based genetic algorithm
parameters were tuned using GA. Performance of the proposed for determination of the optimal PID parameters of the
controller was analysed and results are presented in comparison Automatic Voltage Regulator systems was used. The authors
to the conventional PID tuning method i.e., Ziegler Nichols (Z- analyzed the impact of the mutation and the population
N). Simulation results showed that performance of PID number on the value of PID parameters. Differences between
controller tuned using GA were better than the conventionally actual MLS based system and its conventional model has been
tuned PID controller.
discussed in [11]. This study of the system experiencing the
Keywords: Genetic Algorithm, Magnetic Levitation System,
Mutation, PID Controller, Ziegler Nichols method. un-modeled dynamics and their impact on stability of
simulated system were also given. In the end, PID controllers
I. INTRODUCTION are proved efficacious in regulating the set point and hence
PID controllers are extensively used in many control tracking the changing output. System linearization principle
systems due to their simplicity and robustness. PID controllers for nonlinear model of MLS is proposed in [12] which
take the name from its subparts naming, the proportional gain primarily take the advantage of expanding the Fourier series
KP, the integral gain KI and the derivative gain KD. These and preserving the first order term. For maintaining the better
gains need to be accurately and carefully found in order to stability in a levitated ball assembly, the controller for
make PID controllers perform desirably, i.e., reducing the unstable nonlinear system is designed by employing system
steady state errors, reasonable overshoot and settling time. linearization and phase-lead compensation with cancellation
Number of methods are available for tuning PID controller of virtual pole, is explained in [13]. Such MLS with small
parameters. Few examples of these well-known methods are; operating ranges have been proposed and studied in the
the Ziegler-Nichols (Z-N) method [1], the Cohen-Coon literature.
method [2], Integral of Squared time weighted Error (ISE) Classical optimization methods are based on assumptions
rule [3], Integral of Absolute Error rule (IAE) [4], Internal such as differentiability, convexity of the cost function and
Model Control (IMC) based method [5], and gain-phase constraints that must be satisfied. As these assumptions are
margin method [6]. Based on the transient response, which hard to satisfy by the constrained optimization and to reduce
actually include the overshoot, setting time and steady state complexity of tuning controller parameters, several new
error, Ziegler and Nichols designed rules for tuning of PID heuristic methods such as Ant Colony Optimization [14],
controllers [1]. Minimizing the appropriate performance Particle Swarm Optimization [15], fuzzy logic [8] have been
criterion were the base of method presented by Zhuang and developed. Due to its high potential for global optimization,
Atherton for automatic tuning of PID controllers [3]. Genetic Algorithm (GA) has attracted great attention of
Main disadvantage of Z-N method is that it requires prior researchers in control systems in order to figure out the
knowledge of plant model and dynamics. Once tuned optimal values for PID controller parameters. Although GA
controller using Z-N method gives good performance but has extensively been applied to many control systems, its
optimum system performance is not achieved. If plant natural genetic operations would still result in massive
dynamics change then transient response of the system can be computational efforts [10]. In this paper, the basic GA has
worse. As many plants have time varying dynamics due to been applied to the MLS as a plant for tuning the PID
external/environmental disturbances, addition of new features controller parameters. The results for settling time, overshoot
and steady state error are validated by comparing with the Z-N Where, ݒis the velocity of the suspended ball, ݔis the
rule. position of the ball, ݉ is the mass of ball, ܥis the magnetic
The paper is structured as follows; the section II briefs force constant, ݃ is gravitational constant, ܮand ܴ are the
about the description of MLS, while system dynamics and coil’s inductance and resistance, ݅ is the current in
modeling has been given in section III. Design of PID electromagnetic coil and ݑis the applied voltage to the system.
controller for the MLS plant is detailed in section IV, Taking ݔൌ ݔଵ ǡ ݒൌ ݔଶ and ݅ ൌ ݔଷ Equations (1), (2) and
followed by the overview of GA in section V and simulation (3) can be written as matrix format while considering position
results for the test system in comparison to Z-N method of as output;
PID tuning in section VI.
ݔଶ
ݔଵሶ ۍ ௫య ଶ ې Ͳ
II. DESCRIPTION OF MAGNETIC LEVITATION SYSTEM ێ ݃ െ ቄ ቅ ۑ
ݔଶሶ ൩ ൌ ێ Ͳ
Ferromagnetic ball suspended in a voltage-controlled ௫భ ۑ ଵ (4)
magnetic field compose the MLS being considered in this ݔଷሶ ێെ ݔ ቄ
ோ ଶ ௫ మ ௫య
ቅۑ
ۏ ଷ ௫భమ ے
paper and is schematically shown in Fig. 1 [16].
ݕൌ ሾ ͵ݔ ʹݔ ͳݔሿܶ ൌ ሾͳ Ͳ Ͳሿ (5)
ݔሶ ൌ ݂ሺݔሻ ݃ሺݔሻݑ (6)
B. Linear Model
Nonlinear model was linearized around a point ݔൌ ݔଵ ,
with vector as under;
ܺ ൌ ሾݔଵ ݔଶ ݔଷ ሿ் (7)
At equilibrium, rate of ݔwith respect to time must be equal
to zero i.e. ݔଶ ൌ Ͳ . Also, Equation (3) provides the
equilibrium current which must satisfy the following
condition;
Fig. 1. Schematic Diagram of Magnetic Levitation System
ݔଷ ൌ ݔଵ ට (8)
The electromagnet actuator, which takes the controlled
current I, specifies the position of the ball being sensed by an Using equations (1)-(8), the linearized model in state space
optoelectronic sensor and fed back to the controller as Vsensor form can be given as;
signal. The output of main controller is the set point for Ͳ ͳ Ͳ
ۍଶ ௫బయ ې Ͳ
current control block and is represented as U in the Fig. 1. ݔܥ Ͳ െʹ
ܣൌ ێ ଷ ௫బభ ܤൌ Ͳ
మ ۑ (9)
Electromagnetic force on steel ball, in upward direction, is ێ ௫బయ ோ ۑ
ଵ
adjusted to be equal to the weight of the ball by controlling the ۏ Ͳ ʹ െ
మ
௫బభ ے
input electric current to the coil. In this way the ball is ሾ
ܥൌ ͳ Ͳ Ͳ ሿ (10)
levitated in equilibrium state. In open loop, it is highly
unstable and nonlinear system so a challenging effort for
designing a controller with optimum performance is needed. IV. PID CONTROL DESIGN
Physical parameters of MLS are presented in Table 1 [16].
III. SYSTEM DYNAMICS AND MODELLING
This section explains the dynamics and modeling of the TABLE I
PARAMETERS OF MAGNETIC LEVITATION SYSTEM
plant under study. Dynamic behavior of MLS can be modeled
by the study of electromagnetic and mechanical sub systems. Parameter Unit Value
Here, the mathematical modeling of this nonlinear Mass of ball, m kg 0.5
electromechanical system is presented, followed by a linear Gravitational acceleration, g m/s2 9.8
model. Inductance of coil, L H 0.01
Resistance of coil, R Ohms 1
A. Nonlinear Model Constant, C 0.0001
The nonlinear model of MLA can be represented by below Ball position, X01 m 0.012
mentioned differential equation. This model is based on the Velocity, X02 m/s 0
electro-mechanical modeling and is explained in [16]. Current, X03 A 0.84
ௗ௫
ݒൌ (1) On the basis of parameter values presented in table 1, state
ௗ௧
(also called offspring) for being the final solution is checked Fig. 4. It was observed that settling time of system tuned with
and highest in fitness are selected for proceeding while the GA was 1.257 s and settling time with ZN Rule tuned PID is
others are rejected. Roulette-wheel selection, ranking methods, 4.1237 s and is given in Table III. However there was not
tournament selection, and normalized geometric selection are much difference between rise time, overshoot and peak
few among the methods for selecting the fittest offspring. response.
As the overall run time of GA is usual issue, the normalized
TABLE II
geometric selection was chosen as selection process in this PARAMETERS OF GENETIC ALGORITHM
paper due to longer compilation time for tournament selection
than the rest. Ref [22] states the roulette wheel option as Parameter Value
inappropriate. Selection Method Normalized
Like normal genetics, in crossover some portions from each Geometric Selection
of the parents’ chromosomes are interchanged to produce Population size 120
offspring. By extracting the common features from different Generation Size 40
chromosomes, this operator tries to achieve even better Cross Over Method Arithmetic Crossover
solutions. In this study, being simplistic for working with Mutation Method Uniform Mutation
chromosomes, arithmetic crossover procedure was preferred Selection Probability 0.08
over single point crossover. At the cost of increased Number of Crossover 4
points
compilation time, which is highly undesirable, heuristic
crossover performs the crossover procedure a number of times TABLE III
to finally picks the best one. PERFORMANCE COMPARISON
To ensure that the entire search space is being explored and
reducing the chances for missing the best solution, mutation is Item GA Tuned ZN
a key operator. In this study, mutation process is used Rise Time (sec) 0.0065 0.0028
occasionally with the small probability to introduce variations Settling Time (sec) 1.25 4.12
into the chromosome. Overshoot (%) 78.69 72.06
To avoid losing the best offspring in any population, these Peak Amplitude 1.78 1.72
are saved before crossover and mutation operators. This is Final Value 1 1
often called as preserving the elitist models. After saving, the
operators are applied and new population is examined if the Kp Value
previous best structure has been regained. If it does not -800
Gain
happen, the saved copy is reinserted into the population and -900
-800
parameter that results in reasonably small overshoot, fastest
rise time or quickest settling time. For this purpose four -1000
0 10 20 30 40 50 60 70 80
objective functions were tested and these are Mean Square Kd Value
Error (MSE), Integral of Absolute Error (IAE), Integral of 0
-500
(ITAE). -1000
ଵ ௧ ௧
ܧܵܯൌ ሺ݁ሺݐሻሻଶ ݀ ܧܣܶܫݐൌ ݐȁ݁ሺݐሻȁ ݀ݐ
0 10 20 30 40 50 60 70 80
Generations
௧
௧ ௧ ൡ (15)
ܧܵܫൌ ሺ݁ሺݐሻሻଶ ݀ ܧܣܫݐൌ ȁ݁ሺݐሻȁ ݀ݐ Fig. 3. Genetic Algorithms converging through generations
In the end an objective function was chosen with which the
error of the controlled system would be minimized and MSE
was used.
Overall objective of PID controller was to minimize the
error signals, thus fitness value of corresponding chromosomes
was measured using the error. Fitness value was defined as
ଵ
݁ݑ݈ܽݒݏݏ݁݊ݐ݅ܨൌ (16)
ெௌா
Fig. 3 illustrates the convergence of Genetic algorithm
through generations.
System was simulated using MATLAB and step response
was observed. Various settings of GA parameters were tested
and final values used are presented in Table II. Comparisons of
PID tuned using ZN Rule and PID tuned using GA is made in
Step Response [6] W. K. Ho, C. C. Hang, and L. S. Cao, “Tuning of PID controllers based
1.8 on gain and phase margin specifications,” Automatica, Vol. 31, 1995,
pp. 497-502.
1.6 [7] K. J. Astrom and B. Wittenmark, Adaptive Control. Addison Wesley,
2nd ed., 1995.
1.4 PID Tuned using GA [8] A. Visioli, “Tuning of PID controllers with fuzzy logic,” Proc. Inst.
PID Tuned using ZN Rule Elect. Eng. Contr. Theory Applicat., Jan. 2001. vol. 148, no. 1, pp. 1–8,
1.2
[9] M. P. ûalasan, T. M. Dlabaþ, M. M. Ostojiü, “PID parameters
determination of synchronous machine AVR system”, International
1
Review of Automatic Control - IREACO, Vol. 6, No. 4, pp.425-430,
Amplitude
July 2013.
0.8
[10] R. A. Krohling and J. P. Rey, “Design of optimal disturbance rejection
0.6
PID controllers using genetic algorithm,” IEEE Trans. Evol. Comput.,
Feb. 2001, vol. 5, pp. 78–82.
0.4
[11] Trent M. Guess and David G. Alciatore. Model development and
control Implementation for a magnetic levitation apparatus,
0.2
Proceedings of ASME Computers in Engineering Conference, Boston
September 1995, U.S.A.
0 [12] Valer Dolga, Lia Dolga. “Modeling and Simulation of a Magnetic
0 2 4 6 8 10 12 Levitation System”,ANNALS of the ORADEA UNIVERSITY.
Time (sec) Fascicle of Management and Technological Engineering, 2007,
Volume VI (XVI).
Fig. 4. Unit step response of the system using GA tuned PID Vs Z-N tuned [13] Ying-Shing Shiao. “Design and Implementation of a Controller for a
PID Magnetic Levitation System”, Proc. Natl. Sci. Counc. ROC(D) Vol. 11,
No. 2, 2001. pp. 88-94
VII. CONCLUSION [14] Hsiao, Y. and C. Chuang. “Ant colony optimization for designing of
PID controllers” Proceeding of IEEE International Symposium on
On the basis of results obtained from simulation following Computer Aided Control Systems Design, September 4-5, 2004, Taipei,
can be concluded; Taiwan, pp: 321-326.
[15] Gaing, Z.L.,. A particle swarm optimization approach for optimum
• Selection of objective function that is used for fitness design of PID controller in AVR system. IEEE Trans, 2004. Energy
value is very critical while applying GA and should be Conver., 19: 384-391.
chosen according to the desired performance. [16] Ishtiaq Ahmad, Muhammad Akram Javaid "Nonlinear Model &
• As it was simple to find PID controller parameters using Controller Design for Magnetic Levitation System" Proceedings of the
9th WSEAS International Conference on Signal Processing, Robotics
GA, the other soft computing techniques should also be and Automation (ISPRA '10) 20-22 February 2010, pp:324-328.
considered while optimally tuning the controller [17] Dong Hwa Kim, and Jae Hoon Cho “Robust Tuning of PID Controller
parameters. Using Bacterial-Foraging-Based Optimization” Journal of Advanced
• Settings of GA parameters play an important role in Computational Intelligence and Intelligent Informatics Vol.9 No.6,
2005.
finding the gain values, and selection of parameters [18] AYTEKIN BAGIS "Determination of the PID Controller Parameters
should be made carefully. by Modified Genetic Algorithm for Improved Performance" Journal of
• Thus GA with some modifications can speed up the Information Science and Engineering 23, 1469-1480 (2007).
process of optimization and should be studied [19] Neenu Thomas, Dr. P. Poongodi, "Position Control of DC Motor Using
Genetic Algorithm Based PID Controller", Proceedings of the World
Congress on Engineering 2009 Vol II WCE 2009, July 1 - 3, 2009,
REFERENCES London, U.K.
[1] J. G. Ziegler and N. B. Nichols, “Optimum settings for automatic [20] D. T. Pham and D. Karaboga, Intelligent Optimisation Techniques:
controllers”, Transactions of American Society of Mechanical Genetic Algorithms, Tabu Search, Simulated Annealing and Neural
Engineers, Vol. 64, 1942, pp. 759-768. Networks. ISBN-13: 978-1447111863
[2] G. H. Cohen and G. A. Coon, “Theoretical investigation of retarded [21] Dionisio S. Pereira, “Genetic Algorithm Based System identification
control”, Transactions of American Society of Mechanical Engineers, and PID Tuning for Optimum Adaptive Control,” International
Vol. 75, 1953, pp. 827-834. Conference on Advanced Intelligent Mechatronics, Monterey,
[3] M. Zhuang and D. P. Atherton, “Automatic tuning of optimum PID California, USA, 24-28 July 2005, pp.801-806
controllers”, IEEE Proceedings on Control and Applications, Vol. 140, [22] Ian Griffin, “On-line PID Controller Tuning using Genetic Algorithms”
1993, pp. 216-224. Thesis M. Eng. in Electronics systems Dublin City University, Ireland,
[4] D. W. Pessen, “A new look at PID-controller tuning,” Journal of 2003.
Dynamical Systems Measures and Control, Vol. 116, 1994, pp. 553- [23] D. E. Goldberg, Genetic Algorithms in Search, optimization, and
557. Machine Learning, Addison-Wesley Publishing Co., Inc., 1989.
[5] M. Morari and E. Zafiriou, Robust Process Control, Prentice-Hall,
Englewood Cliffs, New Jersey, 1989.