Intelligent Controlling of an Inverted Pendulum Using PSO-PID Controller

DOI : 10.17577/IJERTV2IS121106

Download Full-Text PDF Cite this Publication

Text Only Version

Intelligent Controlling of an Inverted Pendulum Using PSO-PID Controller

Neeraj Jain

Rajeev Gupta

GirishParmar

Department of Electronics Engg.

Department of Electronics Engg.

Department of ElectronicsEngg.

Rajasthan Technical University

Rajasthan Technical University

Rajasthan Technical University

Kota, India

Kota , India

Kota, India

Abstract Stabilizing the inverted pendulum is a standard problem in the field of control system. When force is applied to cart its position and pendulum angle deviate from its position .Many researchers have been applying different control algorithm and design techniques such as Neural

technique.

  1. Modeling an Inverted Pendulum

    Network, Genetic Algorithm (GA),Fuzzy logic, Particle swarm optimization on to a PID controller for stabilization of cart position and pendulum angle. The particle swarm optimization is a new evolutionary computation technique and has been introduced to solve several industrial problems [1-6]. Particle swarm optimization has better computational efficiency and it requires less number of parameter to adjust [13]. In this paper Particle Swarm Optimization (PSO) technique has been discussed to control the inverted pendulum problem and result is compared with conventional PID controller.

    Keywords: Inverted pendulum; PID controller; PSO; System stability

    1. Introduction

      For control engineers inverted pendulum is a very good platform to verify different problems in the field of control theory. It is an excellent test benchmark for testing various complicated control problems.Normally inverted pendulum is stable when put on a cart, if a force is applied to the cart pendulum becomes unbalance until a suitable control strategy is applied. It is a Single input multiple output problembecause the system has one input the force applied to the cart, and two outputsposition of the cart and the angle of the pendulum.

      The standard linear techniques cannot solve thesuch type of non-linear dynamics of the system. This system is challenging for analysis. Due to the good features of particle swarm optimization (PSO) algorithm, presently it has been used as a new optimizer and applied to various types of research problems.PSO was developed through simulation of simplified social systems, and is robust in solving nonlinear optimization problems[8]. Objective of this paper is to design simulink model of inverted pendulum system, stabilize it with PID controller using particle swarm optimization technique (PSO) and compare the results with conventional PID

      The inverted pendulum model is shown in Fig.1. Its modeling is done for analysis the pendulum position when force is applied to cart and pendulum is stabilize using PSO-PID controller.

      2.1 Inverted Pendulum on a Cart

      The cart with an inverted pendulum, is shownin Fig. 1. An impulse force F Newton is applied to the cartSomeassumptions are madefor modeling of an inverted pendulum which is given below in table 1.

      Table I.Assumption for Inverted Pendulum

      Symbol

      Parameter

      Value

      M

      Mass of the cart

      0.5 Kg

      m

      Mass of Pendulum

      0.2 Kg

      b

      Friction of the cart

      0.1/N/m/sec

      l

      Length to pendulum centre of mass

      0.3 m

      I

      Inertia of pendulum

      0.006Kg*m^2

      F

      Force applied to the cart

      1 Newton

      Pendulum angle from vertical

      radian

      Below are the two Free Body Diagrams of the system. Summing the forces in the Free Body Diagram of the cart in the horizontal direction, we get the following equation of motion:

      + + = (1)

      Since we will be looking at the angle, as the output of interest, solve the equation (9) for X(s),

      = + 2 ()(11)

      2

      Substitute value of X(s) from equation (11) to (10) and re-arrange. The transfer function is:

      2

      () =

      ()

      4

      + 2 3

      + 2

      (12)

      +

      where,

      = + + 2 ()2 (13)

      Fig.1.Free Body Diagram of Inverted Pendulum

      From the transfer function above it can be seen that there is both a pole and a zero at the origins. These can be canceled and the transfer function becomes:

      Note that the forces can be sum in the vertical direction,

      () =

      ()

      3

      + 2 2

      +

      (14) From

      but no useful information would be gained. Summing

      the forces in the Free BodyDiagram of thependulumin the horizontal direction, we can get an equation for N

      +

      table I by putting the values of M, m, b, l, I in equation

      (14) and get the transfer function of Fig. I

      () = 4.545

      (15)

      = + 2 (2)

      By substituting (2) equation into the (1) equation, we get the equation of motion for this system

      ()

      3+0.1818 231.184.455

  2. Particle Swarm Optimization

    + + + 2 = (3) To get the second equation of motion, sum the forces perpendicular to the pendulum

    + = + (4)

    To get rid of the P and N terms in the equation above, sum the moments around the centroid of the pendulum to get the following equation

    = (5) Combining equation (4) & (5), we get the second dynamic equation:

    + 2 + = (6)

    These set of equations (3) & (6) should be linearized about = ,Assume that theta = + (represents a small angle from the vertical upward direction). Therefore, cos = -1, sin = -1 and (d /dt) 2 = 0. After linearization the two equations of motion become (where u represents the input):

    + 2 = (7) + +

    = (8)

    The PSO was originally designed by Kennedy and Eberhart and is one of the modern heuristic algorithm[10]. This technique involves simulating social behavior among individuals (particles) flying through a multidimensional search space, each particle representing a single intersection of all search dimensions. The particles evaluate their positions relative to a goal (fitness) at every iteration, and particles in local neighborhood share memories to adjust their own velocities and thus subsequent positions.

    The various steps involved in Particle Swarm Optimization Algorithm are as follows:

    Step 1: The velocity and position of all particles are randomly set to within pre-defined ranges.

    Step 2: Velocity updating At each iteration, the velocities of all particles are updated according to,

    vi = vi + c1R1 (pi,best pi ) + c2 R2 (gi,best pi ) where,

    2.2. Transfer Function of Pendulum Model

    piand vi – are the position and velocity of particle i, respectively;

    To obtain the transfer function of the linearized sypsit,ebmestand gi,best – is the position with the best objective value

    equations analytically, we must first take the Laplace transform of the system equations (7)& (8). The Laplace transforms are:

    + 2 2 = 2 (9)

    + 2 + 2 = ()(10)

    found so far by Particle i and the entire population respectively;

    w – is a parameter controlling the dynamics of flying;

    R1 and R2 – are random variables in the range [0, 1];

    c1and c2 – are factors controlling the related weighting of corresponding terms. The random variables help the PSO with the ability of stochastic searching.

    Step 3: Position updating The positions of all particles are updated according to,

    pi = pi + vi

    After updating, pishould be checked and limited to the allowed range.

    Step 4: Memory updating Update pi,bestand gi,bestwhen condition is met,

    pi,best = pi if f(pi ) > f(pi,best )

    gi,best = giif f(gi ) > f(gi,best )

    where ,f(x)is the objective function to be optimized. Step 5: Stopping Condition The algorithm repeats steps 2 to 4 until certain stopping conditions are met, such as a pre-defined number iterations. Once stopped, the algorithm reports the values of gbestand f (gbest)as

  3. Simulation and Results

    Simulink model has been developed in MATLAB. It is tried to tune inverted pendulum system using particle swarm optimization by nonlinear equations. Simulink model with impulse disturbance has been shown in Fig.3.

    Fig.4 depicted the response of inverted pendulum with conventional (Zeigler Nichols) PID controller and with impulse disturbance .It is observed from Fig 4.that response is not stable before 20 sec.

    The PID values for this PID controller are Kp = 2, Ki = 5 and Kd = 2

    its solution

    Start

    Impulse Input

    PID

    PID Controller

    u y

    Pendulum

    Output

    simout 2

    simout 2

    1 To Workspace 2 Out 1

    Impulse Disturbance

    Initialize Particles with Random Position andVelocity

    Fig.3. PSO-PID Model in Simulink

    Evaluate Particles

    Evaluate Particles

    10

    Compare and update, Pbest

    Compare and update, Pbest

    Theta (Degree)

    Theta (Degree)

    8

    6

    Compare and update, gbest

    Compare and update, gbest

    4

    2

    0

    0 10 20 30 40 50

    Time (Sec)

    Meet stoppingcriteria

    End

    Fig.4 Impulse response of Pendulum with Conventional PID Controller

    Update velocity andPosition

    Update velocity andPosition

    When PSO PID controller is applied with following settings

    Initial population size (N) = 200 Step size = 40

    c1 = c2 = 2.0 w = 0.8

    The response is shown in Fig.5

    Fig 2: Flowchart of PSO Algorithm

    10

    Theta (Degree)

    Theta (Degree)

    8 VI. References

    6

    4

    2

    0

    0 10 20 30 40 50

    Time (Sec)

    Fig.5 Impulse response of pendulum with PSO- PID controller

    It is observed from Fig.5that by using PSO technique to tune PID controller system is stable and response is less oscillatory.

    The value of integral error performance indices is also obtained. The integral of the absolute value of the error (IAE) is an appropriate measure of control performance when the effect on control performance is linear with the deviation. The integral of square of the error (ISE) is appropriate when large deviations cause greater performance degradation than small deviation.

    Table1. Comparison of PID Techniques

    S.No.

    Type of Controller

    IAE

    ISE

    1

    Conventional (Zeigler- Nichols)

    4.58

    7.14

    2

    PSO PID

    1.61

    2.37

    It is observed from table 1 that on IAE & ISE error performance indices the result is much better with PSO- PID Controller.

  4. Conclusion

The results of the simulation have been shown. The proposed PSO improves the performance of inverted pendulum and can be easily introduced to any other nonlinear control problem. It is observed that the inverted pendulum position is stable very soon using PSO-PID controller compare to conventional PID controller.Future work can be done on tuning PID controller with Genetic algorithm and type- two fuzzy cascade controller.

[1]. K.J. Astrom and T.Hagglund, The Future of PID Control, Control Engineering Practice, pp.1163- 1175, 2001.

[2]. B.Nagraj, S.Subha, B.Rampriya, Tuning Algorithms for PID Controller using Soft Computing Techniques, IJCSNS, pp.278-281, 2008.

[3]. Tushar Jain and M.J. Nigam, Optimization of PD-PI Controller Using Swarm Intelligence, International Journal of Computational Cognition, Vol.6, No.4, pp.55- 59, 2008.

[4]. H.M. Asifa and S.R.Vaishnav, Particle Swarm Optimization Algorithm based PID Controller, IEEE, pp.628-631, 2010.

[5]. S.M. Giriraj Kumar, Deepak Jayraj and AnoopR.Krishan, PSO Based Tuning of a PID Controller for a High Performance Drilling Machine, International Journal of Computer Applications, vol. 1, No.19, pp.12-18, 2010.

[6].Wei-Der Chang,Shun-Peng Shih, PID Controller Design of Nonlinear Systems Using an Improved Particle Swarm Optimization Approach, Elsevier, pp.3632-3639,2010.

[7]. Ali T. Al-Awami et al., A New Modified Particle Swarm Optimization Algorithm for Adaptive Equalization, Elsevier, pp.195-207, 2011.

[8]. KavehRazzaghi and Ali Akbar Jalali, A New Approach on Stabilization Control of an Inverted Pendulum, Using PID Controller, IEEE, pp.81-85, 2011.

[9]. R.Matousek et al., HC12: Efficient Method in Optimal PID Tuning, Proceedings of the World Congress on Engineering and Computer Science, vol.1, online, 2011.

[10]. ZaferBingul et al., A Fuzzy Logic Controller Tuned with PSO for 2 DOF Robot Trajectory Control, Elsevier, pp.1017-1031, 2011.

[11]. P. Kumar, O.N. Mehrotra, J. Mahto, Tuning of PID Controller of Inverted Pendulum Using Genetic Algorithm, vol.1, Issue 3, pp.359-363, 2012.

[12]. Joshi S.S. and Kakatkar M. N., Real Time Control of Inverted Pendulum using FPGA, IJETAE,vol. 2, Issue 9, pp.229-234, September 2012. [13]. MahbubehMoghaddas et al., Design of Optimal PID Controller for Inverted Pendulum using Genetic Algorithm, International Journal of Innovation, Management and Technology, vol. 3, no. 4, pp. 440-

442, August 2012.

[14]. AnulaKhare, SarojRangnekar, A Review of Particle Swarm Optimization and its Applications in Solar Photovoltaic System,Elsevier,pp.2997- 3006,2013.

Neeraj Jain has received B.E. degree in Electronic Instrumentation and Control Engineering from the Engineering College, Kota, and the M.E. (2009) control & Instrumentation from NITTTR, Chandigarh. Presently he is pursuing Ph.D. from Electronics department in Rajasthan

Technical University, Kota. He has 15 years of experience in process industry and teaching. He is a life member of Institution of Engineers (IE), Kolkata. He has presented 23 research papers in conferences and journals. His research areas are transducers, process control, modern control system, Industrial automation, artificial intelligence.

Rajeev Gupta received the

B.E. (1986) degree in Electrical Engineering from the Engineering College, Kota, and the M.Tech. (1995) Control & Instrumentation Engg and Ph.D. (2004) degrees in System & Control

Engg.from the Indian Institute of Technology, Bombay, Powai, Mumbai India. His current research interests include: Multirate Periodic output feedback control, Robust control, Sliding mode control, Fuzzy logic control, Genetic Algorithms and Artificial Neural network based control. Heis the author/co-author of 34 Research Papers; Seven Books of Electrical & Electronics Engineering.Heis a consultant to several Government organizations and private industries in India and abroad.Dr. Guptahasguided 8 M.Tech. Thesis and is guiding 13 Ph.D. students on various areas. He s life member of ISTE, New Delhi, Institution of Engineers, India, and IEEE, USA.

Dr. GirishParmar was born in Bikaner (Rajasthan), India, in 1975.He received B.Tech. in Instrumentation and Control Engineering from National Institute of Technology, Jalandhar (Punjab), India in 1997 and M.E. Electrical (Gold Medalist)

withspecialization inMeasurement and Instrumentation from Indian Institute of Technology, Roorkee, India in 1999. He obtained his Ph.D. in Electrical Engineering. in 2007 under Quality Improvement Programme from Indian Institute of Technology, Roorkee, India. He is life member of Systems Society of India (LMSSI) and Associate member of Institution of Engineers, India (AMIE). He has published 59 research papers in various International/National Journals and Conferences. He is author of several technical books. He has worked as aAssistant Professor in Department of Electronics Engineering at Rajasthan Technical University, from 1999 to 2011.He has worked as a Principal of Modi Institute of Technology, Kota from December, 2011 to 2013. Presently he is working as an Associate professor in Rajasthan Technical University,Kota. His research interests are in the area of Process Instrumentation & Control, Optimization, Signal Processing, System Engineering and Model Order Reduction of Large scale systems.

Leave a Reply