A Non Linear PID Fuzzy Approach for Stabilization of Inverted Pendulum Using Particle Swarm Optimisation

DOI : 10.17577/IJERTV2IS80073

Download Full-Text PDF Cite this Publication

Text Only Version

A Non Linear PID Fuzzy Approach for Stabilization of Inverted Pendulum Using Particle Swarm Optimisation

A Non Linear PID Fuzzy Approach for Stabilization of Inverted Pendulum Using Particle Swarm Optimisation

Vishnu D, Feby Merlin Joseph

Department of Electronics and Communication Engineering, Younus College of Engineering and Technology, Vadakkevila.P.O, Kollam-691010,

Kerala, India.

Abstract- The balancing of an inverted pendulum by moving a cart along a horizontal track is a classic control problem. The inverted pendulum is a highly nonlinear and open-loop unstable system. This means that standard linear techniques cannot exactly model and control the nonlinear dynamics of the system. In general, the control parameters are selected by the trial and error approach. However, it is not efficient because the approach is simple sensation. The proportional- integral-derivative (PID) controllers are the most popular controllers used in industry because of their remarkable effectiveness, simplicity of implementation and broad applicability.

The approach proposed in this work is to achieve a non-linear control system using fuzzy modeling and the control system parameters are optimized using Particle Swarm Optimization (PSO). The results show the efficiency of the proposed method in achieving control over non-linear and unstable processes. The simulation results show that compared with genetic algorithms (GA) the proposed algorithm can improve the quality of the solution while speeding up the convergence process.

Keywords: Inverted pendulum, proportional-integral- derivative (PID), Fuzzy controller, particle swarm optimization (PSO).

  1. INTRODUCTION

    classical problems, the control of inverted pendulum has been a research interest in the field of control engineering. Due to its importance this is a choice of dynamic system to analyze its dynamic model and propose a control law. An inverted pendulum is a pendulum which has its mass above its pivot point. Whereas a normal pendulum is stable when hanging downwards, an inverted pendulum is inherently unstable, and must be actively balanced in order to remain upright, either by applying a torque at the pivot point or by moving the pivot point horizontally as part of a feedback system.

    The aim of the study is to stabilize the pendulum such that the position of the carriage on the track is controlled quickly and accurately and that the pendulum is always maintained tightly in its inverted position during such movements. The problem involves a cart, able to move backwards and forwards, and a pendulum, hinged to the cart at the bottom of its length such that the pendulum can move in the same plane as the cart, shown in figure (1). The pendulum mounted on the cart is free to fall along the cart's axis of motion. The system is to be controlled so that the pendulum remains balanced and upright, and is resistant to a step disturbance.

    Fig. 1 Inverted Pendulum on a cart

    The potential benefits of using fuzzy logic controllers to control an inverted pendulum system are given in. The Fuzzy Logic Controller [6] is different from the other controllers due to the fact that it does not require a mathematical model for the system. The controller only needs the output values from sensors along with the bounds on the control signal which can be applied to the system. The controller rules are designed through the analysis of system behavior. An effort to implement and optimize fuzzy logic control algorithms to balance the inverted pendulum and at the same time reducing the computational time of the controller is presented. The inverted pendulum system is modeled and constructed using Simulink and the performance of the proposed fuzzy logic controller is compared to the more commonly used PID controller through simulations using Matlab.

    The Proportional-Integral-Derivative (PID) control gives the simplest and yet the most efficient solution to various real world control problems. Both the transient and steady- state responses are taken care of with its three-term (i.e. P, I, and D) functionality. Since its invention the popularity of PID control has grown tremendously. The advances in digital technology have made the control system automatic. The automatic control system offers a wide spectrum of choices for control schemes, even though, more than 90% of industrial controllers are still implemented around the PID algorithms, particularly at the lowest levels, as no other controllers match with the simplicity, clear functionality, applicability, and ease of use offered by the PID controller.

    Design of a PID controller is considered in this work because of its insensitivity to disturbances and uncertainties of model parameters. The inverted pendulum is composed of a cart and a free moving pendulum. By adjusting the cart position, the pendulum can be maintained at upright position. The position of the cart system is controlled via PID controller, which is a linear control method. The performance of the PID controller depends on its parameters. Thus, in this study, the parameters of the PID algorithm are determined by PSO, which can be used in order to obtain the global optima of any system.

  2. MODEL OF INVERTED PENDULUM

    An inverted pendulum is a pendulum which has its mass

    Fig.2 Mathematical model for inverted pendulum on a cart

    M Mass of the cart

    m Mass of the pendulum

    l Length to centre of mass of pendulum F Force applied to the cart

    x Cart position coordinate

    Pendulum angle from vertical

    1. MATHEMATICAL MODELING OF THE SYSTEM

      The equation describing the center of gravity of the pendulum rod with respect to the origin on the Cartesian axis of reference can be written as

      = + sin

      = cos

      The balance of forces of the rod in the vertical direction with respect to its center of gravity is given by

      2

      2 cos =

      Completing the differentiation above gives

      above its pivot point. It is often implemented with the pivot point mounted on a cart that can move horizontally

      sin + cos

      =

      (1)

      and may be called a cart and pole. Whereas a normal pendulum is stable when hanging downwards, an inverted pendulum is inherently unstable, and must be actively balanced in order to remain upright, either by applying a

      The balance of forces of the rod in the horizontal direction with respect to its center of gravity is given by

      torque at the pivot point or by moving the pivot point horizontally as part of a feedback system.

      2

      2

      2

      ( + sin ) = (2)

      + cos 2 sin = H

      The balance of forces of the cart in the x direction is described by

      2

      2

      2 = (3)

      The balance of rotational motion of the pendulum rod around its center of gravity is given by

      = sin cos (4)

      The nonlinear dynamical equations are found by substituting (2) into (3) and (1) into (4) as follows

      ( + ) + cos 2 sin = (5)

      ( + 2) + cos sin = 0 (6)

  3. CONTROL STRATEGY

    Inverted pendulum is a very complex problem to be solved by conventional control systems. A linear PID feedback controller alone cannot achieve the objective of the system that is to maintain the naturally hanging arm of pendulum upright[6]. So we go for a fuzzified non linear PID control in whic the parameters of the controller is optimized using PSO algorithm.

    In an inverted pendulum system, there are two outputs to be observed to obtain a single control variable. The outputs which have to be monitored are

      • Inverted pendulum angle

      • Cart displacement

    A proposed solution to meet the requirement would be to use two PID controllers, one for generating correcting measure from error in angular position, where as the second one to observe deviation of cart position from constraint limits. Inside fuzzified controller, proportional, integral and derivative of the error are calculated. The results of the PID controllers shall be combined with a weighted approach to generate a single control variable which is the torque on cart as depicted in the figure (3) below.

    Fig.3 Overview of fuzzified PID Control Strategy

    1. Fuzzy Approach

      The Fuzzy Logic Controller [6] is different from the other controllers due to the fact that it does not require a mathematical model for the system. The controller only needs the output values from sensors along with the bounds on the control signal which can be applied to the

      system. The controller rules are designed through the analysis of system behavior. The fuzzy controller has four main components: (1)The rulebase holds the knowledge, in the form of a set of rules, of how best to control the system. (2) The inference mechanism evaluates which control rules are relevant at the current time and then decides what the input to the plant should be. (3) The fuzzification interface simply modifies the inputs so that they can be interpreted and compared to the rules in the rule-base.

      Fig 4 Fuzzy Controller Block Diagram

    2. Fuzzified PID solution

    A PID control system operates based on three measures derived from the continuous observation of errors called

    a) Proportional error b) Integrated error c) Instantaneous derivative of error. Each of this error is classified into large and small based on the membership functions The rules for each of the class are the optimum K parameter for the system in the respective particular scenario. The same is repeated for all the three derivative of error and for the two types of errors, which are angular and linear. In fact there are two control systems, one for the angular error and the second one for the cart position error.

    Fig 5 Fuzzification and Defuzzification Approach

  4. OPTIMIZATION

    In the fuzzy PID solution proposed above, derivation of optimum parameter values of the network is the next important problem in the work. The parameters to be optimized are the three error margins to classify proportional, integral and differential errors in to large, small and m category. Thus a total of nine for each controller. Since there are two controllers a total of eighteen parameters have to be optimized.

    The discontinuity in the membership functions makes the fuzzy system unsuitable for derivative based classical optimization techniques. It has been identified by many

    vk

    vk+1

    sk

    sk+1

    vgbest vpbest

    recent studies that soft computing techniques are the best options for optimizing fuzzy networks

    A.Particle Swarm Optimization

    Particle Swarm Optimization [7-11] optimizes an objective function by undertaking a population based search. The population consists of potential solutions, named particles, which are metaphor of birds in flocks. These particles are randomly initialized and freely fly across the multi- dimensional search space. During flight, each particle updates its own velocity and position based on the best experience of its own and the entire population. The various steps involved in Particle Swarm Optimization Algorithm [13] are as follows:

    At each iteration, the velocities of all particles are updated according to,

    +1 = + 11 + 22( )

    Fig.6 Concept of modification of a searching point according to PSO

    algorithm.

    The current searching point is set to pbest for each agent.The best-evaluated value of pbest is set to gbest and the agent number with the best value is stored. Step 2) Evaluation of searching point of each agent The objective function value is calculated for each agent. If the value is better than the current pbest of the agent, the pbest value is replaced by the current value. If the best value of pbest is better than the current gbest, gbest is replaced by the best value and the agent number with the best value is stored. Step 3)Modification of each searching point The current searching point of each agent is changed using (1)(2)(3). Step 4) Checking the exit condition The current iteration number reaches the predetermined maximum iteration number, then exit. Otherwise, go to step 2. Below figure shows the general flow chart of PSO strategy.

    ( 7)

    Start

    where, vik+1 :velocity of agent i at iteration k, w: weighting function,cj :weighting factor,rand: random number between 0 and 1,sik: current position of agent i at iteration k, pbesti : pbest of agent i,gbest:gbest of the group.The following weighting function is usually utilized

    Generation of initial population

    Generation of initial population

    Step 1

    =

    Evaluation of searching point of each agent

    Evaluation of searching point of each agent

    where, wmax : initial weight,wmin : final weight,itermax: maximum iteration number, iter : current iteration number. Using the above equation, a velocity, which gradually gets close to pbest and gbest can be calculated. The current position (searching point in the solution space) can be modified by the following equation:

    +1 = + +1

    Step 2

    Modification of agents speed

    Modification of agents speed

    Step 3

    no Reach

    max

    Step 4

    Figure 6 shows a concept of modification of a searching point by PSO algorithm. The general flow chart of PSO method can be described as [11],Step 1) Generation of

    initial condition of each agent Initial searching points (si0) and velocities (vi0) of each agent are generated randomly within the allowable range.

    Iteration?

    Result

    yes

    Fig 7. A general PSO algorithm

    B.OPTIMIZATION USING PSO

    Fig 8. Intial PSO state

    Fig.8 shows the initial state of a four-particle PSO algorithm seeking the global maximum in a one- dimensional search space. The search space is composed of all the possible solutions along the x-axis; the curve denotes the objective function. It should be noted that the PSO algorithm has no knowledge of the underlying objective function, and thus has no way of knowing if any of the candidate solutions are near to or far away from a local or global maximum. The PSO algorithm simply uses the objective function to evaluate its candidate solutions, and operates upon the resultant fitness values.

    Each particle maintains its position, composed of the candidate solution and its evaluated fitness, and its velocity. Additionally, it remembers the best fitness value it has achieved thus far during the operation of the algorithm, referred to as the individual best fitness, and the candidate solution that achieved this fitness, referred to as the individual best position or individual best candidate solution.

    Finally, the PSO algorithm maintains the best fitness value achieved among all particles in the swarm, called the global best fitness, and the candidate solution that achieved this fitness, called the global best position or global best candidate solution.

  5. SIMULATION RESULTS

    The inverted pendulum system is simulated using MATLAB SIMULINK. For the simulation the values of M, m, l are chosen as unity. The desired position of cart and angular displacement of endulum are set to be zero. The simulink block diagram for the pendulum control scheme using fuzzified PID controllers is shown in figure (9 & 10) and the results of simulation using PSO for optimization are given in figures (11-14). The angle of the rod is controlled via the PID controller where the aim is to hold the rod at the upright position .It can be clearly seen from the simulation results that the inverted pendulum is operating very well, maintaining the upright position of pendulum and meeting the position constraints. The PSO convergence plot shows the efficiency of the PSO approach in training the fuzzy network.

    Inverted Pendulum with PID Control Model with PSO optimized parameters (which are determined via minimization of the mean square error between the reference signal and the system output), is applied to the system. From the results, it is observed that the controller parameters are adjusted by using PSO. Fast tuning of optimum PID controller parameters yields high-quality solution. Compared with the genetic algorithm (GA), the proposed method was indeed more efficient and robust in improving the step response of inverted pendulum system.

    Fig 9 Simulink block diagram for the control scheme

    Fig 10 Simulink block diagram for PID controller

    Fig 11 Position of pendulum rod with controller

    Fig 12 Displacement of cart with controller

  6. CONCLUSION

The approach proposed in this work is to achieve a non- linear control system using fuzzy modeling and the control system parameters are optimized using PSO algorithm. The proposed control strategy is evaluated for the inverted pendulum on a cart problem which is a benchmark for non linear control system. The result shows the efficiency of the proposed method in achieving control over non-linear and unstable processes. Compared to GAs, the advantages of PSO are that PSO is easy to implement and there are few parameters to adjust. In terms of computational time, the PSO approach is faster than GA. Additionally for both approaches the major issue in implementation is based on the selection of an appropriate objective function. The fuzzy modeling of the system offers better interpretability of the system making the approach extensible to solve a large variety of engineering problems.

ACKNOWLEDGMENT

The authors would like to thank the management, and Faculty Member, of Department of Electronics and Communication Engineering,Younus College of Engineering and Technology, Kollam for many insightful discussions and the facilities extended for completing the task.

  1. developments, applications and resources, Proceedings Congress on Evolutionary Computation, IEEE Service Centre, Piscataway, NJ, Seoul,Korea.

  2. Shi.Y and Eberhart.R.C (1998), A modified particle swarm optimizer Proc. IEEE International Conference on Evolutionary Computation, IEEE Press, Piscataway, NJ, pp. 69-73.

  3. P.J.Angeline (1998), Using selection to improve particle swarm optimisation, Proc. IEEE Intl. Conf.Evolutionary Computation, pp: 84-89.

  4. Xiao-Feng, et al. (2002), A dissipative particle swarm optimisation, Congress on Evolutionary Computation, Hawaii,USA, pp: 1456-1461.

  5. J.Kennedy (2000), Stereotyping: Improving particle swarm performance with cluster analysis, Proc. Intl. Conf.on Evolutionary Computation, pp: 1507-1512.

  6. A.M.Abdelbar and S. Abdelshahid (2003), Swarm optimization with instinct driven particles, Proc. IEEE Congress on Evolutionary Compuatation, pp: 777-782.

REFERENCES

  1. Y. Liu, Z. Chen, D. Xue, and X. Xu, Real-Time Controlling of Inverted Pendulum by Fuzzy Logic, Proceedings of the IEEE International Conference on Automation and Logistics, pp. 1180- 1183, 2009.

  2. B. Xiao, C. Xu and L. Xu, System Model and Controller Design of an Inverted Pendulum, International Conference on Industrial and Information Systems, pp. 356-359, 2009.

  3. J. Khan, K. Munawar, R. A. Azeem, M. Salman, Inverted Pendulum with Moving Reference for Benchmarking Control Systems Performance, American Control Conference, pp. 3764- 3768, 2009.

  4. F. Chetouane, S. Darenfed, and P. K. Singh, Fuzzy Control of a Gyroscopic Inverted Pendulum, Engineering Letters, 18:1, EL_18_1_02,Advance Online Publication, Feb 2011.

  5. Kevin M. Passino and Stephen Yurkovich, Fuzzy Control, Addison-Wesley.

  6. C. W. Ji F. Lei, and L. K. Kin, Fuzzy Logic Controller for An Inverted Pendulum System, 7 IEEE International Conference on Intelligent Processing Systems, pp. 185-189, 1997.

  7. R.C.Eberhart and Y.Shi (2001),Particle Swarm Optimization:

Leave a Reply