Vous êtes sur la page 1sur 8

International Journal of Advances in Science and Technology, Vol. 3, No.

4, 2011

Optimal Control of Inverted Pendulum using Fuzzy Logic, PID & LQR Controller
Shekhar Yadav, J.P.Tiwari, S.K.Nagar Department of Electrical Engineering, Institute of Technology Banaras Hindu University, Varanasi-221005 (UP), India

Abstract
In this paper a real time control for stabilizing the inverted pendulum-cart system is proposed using fuzzy logic controller. Two fuzzy logic controllers are used here one is for controlling the pendulum angle and another one is for controlling the cart displacement. The output of the stabilized inverted pendulum-cart system controlled by fuzzy logic controller are compared with conventional control technique i.e. PID controller. Linear Quadratic Regulator is designed for optimal control of inverted pendulum. The effectiveness of this proposed technique is validated through experimental results obtained by performing experiments on a simple digital inverted pendulum (33-936IC).

Keywords- Inverted Pendulum, Fuzzy Logic control, PID control, LQR.

1. INTRODUCTION
The inverted pendulum on a cart is a perfect test-bed for the design of a wide range of classical and contemporary control techniques. Inverted pendulum system is widely used in the field of robotics, space rocket guidance system, fast moving ground vehicles and anti-seismic control for buildings etc. Inverted pendulum is a multivariable, nonlinear, fast reaction, unstable and higher order system [1,2]. A double rod inverted pendulum system as shown in Fig.1, is mounted on a cart which is driven using a dc motor. The aim of the control strategy is to oscillate the inverted pendulum from its initial position, until it reaches the upright equilibrium point [3]. Firstly, the inverted pendulum-cart system is controlled using Proportional Integral Derivative (PID) controller and the optimality of the system is checked using Linear Quadratic Regulator (LQR) which requires prior information of the plant, but while using fuzzy logic control complete information of plant is not necessary. The fuzzy logic control technique relies on the human capability to understand the systems behavior and is based on qualitative control rules. Thus control design is simple since it is only based on linguistic rules of the type: If the error is NB and change in error is NB, then the output is NB, and so on. This approach is based on basic physical properties of the systems, not only able to solve linear problems but it can easily solve nonlinear problems smoothly. In this paper we are using PID and fuzzy logic controller to stabilize the highly nonlinear system i.e. inverted pendulum-cart system. The Linear Quadratic Regulator (LQR) optimal feedback is one of many methods to improve the stability performance of any unstable system. Using LQR theory, it has been established that for a controllable linear time-invariant system, a set of optimal feedback gains may be found which minimize a quadratic index and makes a closed-loop system stable [7].

Special Issue

Page 140 of 173

ISSN 2229 5216

International Journal of Advances in Science and Technology, Vol. 3, No.4, 2011

Fig.1 Digital Inverted Pendulum (33-936IC)

2. MODELING OF INVERTED PENDULUM


The inverted pendulum-cart system is usually presented as a pole balancing task. The system to be controlled consists of a cart and a rigid pole hinged to the top of the cart. The movement of the cart is caused by pulling the belt in two directions by the DC motor attached at the end of the rail. By applying a voltage to the motor the force can be controlled with which the cart is to be pulled. The value of the force depends on the value of the control voltage. The cart can move left or right on a one-dimensional bounded track, whereas the pole can swing in the vertical plane determined by the track. The linearized system equations around in the state space are:

(1)

(2)

where, M (mass of cart) m (mass of pendulum) b (friction of cart) I (moment inertia of pendulum) l (length of pendulum) g (acceleration due to gravity) 2.4 kg 0.23 kg 0.05 N/m/sec 0.099 kgm2 0.4 m 9.8 m/sec2

Special Issue

Page 141 of 173

ISSN 2229 5216

International Journal of Advances in Science and Technology, Vol. 3, No.4, 2011 The state of the system is defined by values of four system variables: the cart position, cart velocity, pendulum angle and angular velocity of the pendulum pole respectively. Control force is applied to the system to prevent the pole from falling while keeping the cart within the specified limits. The inverted pendulum-cart system is used here is Digital Pendulum (33-936IC).

3. CONTROLLER DESIGN
In this section, control schemes like PID, LQR and Fuzzy logic controller are proposed. To examine the performance of these controllers following design specification are required: 1. 2. 3. 4. The percent overshoot of cart position, x is to be at most 20%. The Rise time ( ) of cart position, x less than 2 sec. The settling time ( ) of cart position, x and cart angle is to be less than 15 sec. Steady-state error is within 5%.

3.1. PID Control


The PID controller is well known and widely used to improve the dynamic response as well as to reduce or eliminate the steady state error. The derivative controller adds a finite zero to the open loop plant transfer function and improves the transient response. The integral controller adds a pole at the origin, thus increasing system type by one and reducing the steady state error due to a step function to zero.

Fig.2 Schematic of conventional PID controller (3) The parameters of PID controller are updated using Zeigler-Nichols technique.

3.2. LQR Controller


Linear quadratic regulator method uses state-space approach to stabilize an inverted pendulum-cart system. Using state-space methods it is relatively simple to work with a multi-input and multi-output system. The system can be stabilized using full state feedback. The schematic of this type of control system is shown in Figure 3.

G
x

K
Fig.3 The LQR control structure
Special Issue Page 142 of 173 ISSN 2229 5216

International Journal of Advances in Science and Technology, Vol. 3, No.4, 2011 In designing LQR controller, LQR function in MATLAB can be used to determine the value of the vector K which determines the feedback control law. This is done by choosing two parameters, the first one is performance index matrix (R) and the second is state-cost matrix (Q). The weighting factors will be chosen by trial and error method. In order to reduce the steady-state error of the system output, a value of constant gain, G should be added after the reference input. With a full-state feedback controller all the state are feedback. The value of constant gain, G can be found by comparing the reference input with states feedback gain.

3.3. Fuzzy Logic Controller


The fuzzy sets concept was proposed by Zadeh in 1965. The fuzzy algorithm can make human knowledge into the rule base to control a plant with linguistic descriptions. It relies on expert experience instead of mathematical models. The advantages of fuzzy control include good popularization, high faults tolerance, and suitable for nonlinear control systems. A fuzzy logic system (FLS) can be defined as the nonlinear mapping of an input data set to a scalar output data. A FLS consists of four main parts: fuzzifier, rules, inference engine, and defuzzifier [4,5]. These components and the general architecture of a FLS is shown in Figure 4.

Fig.4 A Fuzzy Logic System The fuzzy logic system is processed as: Firstly, crisp set of input data are gathered and converted to a fuzzy set using fuzzy linguistic variables, fuzzy linguistic terms and membership functions. This set is known as fuzzification. Afterwards, an inference is made based on a set of rules. Lastly, the resulting fuzzy output is mapped to a crisp output using the membership functions, in the defuzzification step. The evaluations of the fuzzy rules and the combination of the results of the individual rules are performed using fuzzy set operations. The operations on fuzzy sets are different than the operations on non-fuzzy sets. Let and are the membership functions for fuzzy sets A and B. The mostly- used operations for OR and AND operators are max and min, respectively. For complement (NOT) operation, Eq. 4 is used for fuzzy sets. (4) Fuzzy rules are expressed in the form of fuzzy conditional statements Ri of the type Ri : if x is small THEN y is large Where x and y are fuzzy variables, and small and large are labels of fuzzy set. If there are i =1 to n rules, the rule set is represented by union of these rules R=R1 else R2 else Rn A fuzzy logic controller is based on a collection of R control rules. The execution of these rules is governed by the compositional rule of inference [6]. Here we are using two fuzzy controllers, one for controlling the angle ( ) of

Special Issue

Page 143 of 173

ISSN 2229 5216

International Journal of Advances in Science and Technology, Vol. 3, No.4, 2011 pendulum and another for controlling the displacement (x) of cart system. Each fuzzy controller has two input variables, one is error and another one is change in error. The output of these controller are combined to give net force (F =Fpend Fcart) on the cart. The proposed fuzzy logic controller uses Gaussian membership function for stabilization of an inverted pendulum-cart system. Furthermore, the fuzzy inference engine implements a set of IFAND-THEN rules on the pendulum angle ( ) and cart displacement (x). The membership function of pendulum angle controller is shown in Figure 5. For controlling the displacement of cart similar membership functions are defined for the universe of discourse X: [-1.5 1.5], Xce: [-1 1] and Fcart: [-45 45]. Rules are designed on the basis of heuristic knowledge of the behavior and based on the theoretical criteria. To generate the rules for an inverted pendulum system the basic criteria is considered as, if the pendulum is falling in one direction, then cart is pushed in the same direction to counter the movement of the pendulum. Twenty five rules are defined for each controller. The rule base matrix for pendulum angle controller is shown in Table I. Same rule base is taken for the cart system.

Fig.5 Membership Function for error, change in error (ce) and output variable Fpend

Special Issue

Page 144 of 173

ISSN 2229 5216

International Journal of Advances in Science and Technology, Vol. 3, No.4, 2011

Table 1: Fuzzy Control Rules for Pendulum ce e NB NS ZR PS PB NB NB NB NS PS PM NS NB NM NS PS PM ZR NB NM ZR PM PB PS NM NS PS PB PB PB NM NS PS PB PB

4. RESULTS AND DISCUSSION In this section, the simulation results of the proposed controller, which is performed on an inverted pendulumcart system, are presented. Comparison assessment of all the control strategies to the system performance is also discussed in this section. For PID controller, two PID controllers are required to control the pendulum angle and cart position. The parameters for PID controller are tuned using Zeigler-Nichols technique and the values of these parameters are shown in Table II. Table 2 For Pendulum Angle 40 13 25

Gain Kp Kd Ki

For Cart Position 7 0.1 2

Fig.6 Response of PID controller for pendulum angle, cart position and control signal For LQR controller, the value of vector K which determines the feedback control law can be obtained using MATLAB. The controller can be tuned by changing the nonzero x and y elements in Q matrix which is done in mfile code. Consequently, by tuning the values of x=4500 and y=100, the following value of matrix K is obtained,
Special Issue Page 145 of 173 ISSN 2229 5216

International Journal of Advances in Science and Technology, Vol. 3, No.4, 2011

(5) and the value of constant gain, G is -65.75.

Fig.7 Response of LQR controller for pendulum angle, cart position and control signal

The response of fuzzy controller is shown in Figure 8. Fuzzy logic controller stabilizes the pendulum angle within the desired control specification and the position of the cart also reaches the equilibrium point.

Fig.8 Response of Fuzzy logic controller for pendulum angle, cart position and control signal

6. CONCLUSION In this paper, the control strategies like PID controller, LQR and Fuzzy logic controller are successfully designed. Based on the result the conclusion has been made that all control strategy discussed here are capable of controlling the highly nonlinear inverted pendulum-cart system. Simulation results show that fuzzy logic controller has better performance as compared to PID and LQR controller. PID and LQR controller should be improved so that the cart

Special Issue

Page 146 of 173

ISSN 2229 5216

International Journal of Advances in Science and Technology, Vol. 3, No.4, 2011 position reaches the equilibrium point and the percentage overshoot of the pendulums angle in case of LQR controller can also be improved so that if follows the design criteria. REFERENCES
[1] C. C. Chung and J. Hauser, Nonlinear control of a swinging pendulum, Automatica, vol. 31, no. 6, pp. 851862, Jun. 1995. [2] Q. Wei, W. P. Dayawansa, and W. S. Levine, Nonlinear controller for an inverted pendulum having restricted travel, Automatica, vol. 31, no. 6, pp. 841-850, 1995. [3] Hamid R. P., M. R. Jaheh-Motlagh, Ali-Akbar J., Optimal feedback control design using genetic algorithm applied to inverted pendulum, IEEE International Symposium on Industrial Electronics, pp. 263-268, June,2007 [4] T.J. ROSS, Fuzzy Logic with Engineering Applications, McGraw-Hill, Inc., 1991 [5] A. Asgarie-Raad, Intelligent control of two dimensional inverted pendulum, M.S. thesis, Sharif University of Technology, Iran, 1998. [6] Selcuk Kizir, Zafer Bingul, and Cuneyt Oysu, Fuzzy Control of a Real Time Inverted Pendulum System, Springer-Verlag Berlin Heidelberg, vol. 5177, pp.674-681, 2008. [7] Katsuhiko Ogata, Modern Control Engineering, Prentice Hall, New Jersey, 3rd edition-1997 [8] J. Zhao and M. W. Spong, Hybrid control for global stabilization of the cart-pendulum system, Automatica, vol. 37, no. 12, pp. 19411951, Dec. 2001.

AUTHORS PROFILE

Shekhar Yadav was born in Bareilly, U.P, India in 1984. He received the degree of B.Tech from I.E.T.M.J.P.Rohilkhand University in 2007 and received the degree of M.Tech in Electrical Engineering from IT-BHU, Varanasi in 2010 and presently pursuing Ph.D in Electrical Engineering at IT-BHU, Varanasi, India. His research interests include control system, fuzzy logic system and optimization techniques.

J.P. Tewari was born in Deoria, U.P., India in 1947. He received the degrees of B.E. and M.E. from University of Roorkee, India in 1968 and 1971; and Ph.D in Electrical Engineering from Banaras Hindu University, India in 1992. He is currently Professor in Department of Electrical Engineering at IT-BHU, Varanasi, India. His main research includes Control systems, Robotics, Instrumentation, Control Systems, Adaptive control. He has published many papers in National & International conferences and journals.

S.K.Nagar was born in Varanasi, India in 1955. He received the degrees of B.Tech and M.Tech from the Institute of Technology, Banaras Hindu University (IT-BHU), Varanasi, India in 1976 and 1978; and Ph.D in Electrical Engineering from University of Roorkee (IIT Roorkee), India in 1991. He is currently Professor in Department of Electrical Engineering at IT-BHU, Varanasi, India. His main research includes digital control, discrete event systems and model order reduction. He has published many papers in National & International conferences and journals.

Special Issue

Page 147 of 173

ISSN 2229 5216