# Control of an Inverted Pendulum: Swing up & Stabilization

A Seminar Presentation By: Mohammad Umar Rehman M. Tech. (Inst. & Control) Faculty No. 10-EEM-165

Outline
§ Introduction § The Problem § System Modeling & Stability § Swinging up the pendulum § Balancing & Stabilization § Simplified FLC § Simulation & Results § Conclusion
Control of an IP_Umar 22

Introduction
The inverted pendulum system consists of a vertical rod pivoted at one end on a moving cart It represents a multivariable, inherently unstable, fast reacting, high order system Often used as a benchmark for verifying the performance of a new control method due to its simplicity Many engg. systems can be approximately modeled as pendula Standard part of the Control Engineering Curriculum

Control of an IP_Umar

33

The Good Old Days!

Control of an IP_Umar

44

System Schematic

x
Control of an IP_Umar 55

A Real Apparatus
Moving Cart

DC Motor

Pendulum

Control of an IP_Umar

66

The Problem
To bring the pendulum from its stable equilibrium (pending) position to the upward unstable equilibrium position and to balance it Hence, there are two tasks to be solved: and stabilization swinging up

There are various methods proposed in the literature but the energy control strategy proposed by Åström [4] is a popular one A Fuzzy swinging algorithm is discussed and compared with the energy control strategy
Control of an IP_Umar 77

System Modeling
The system follows Lagrangian Mechanics Modeling is done by writing dynamical force (moment) equations for the cart(pendulum) The variables of interest (state variables) are: 1. Cart position, x, 2. Cart velocity, ẋ , 3. Pendulum position, & 4. Pendulum velocity, Other system parameters are described as follows
Control of an IP_Umar 88

System Parameters
S. No. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Parameter/Symbol Acceleration due to gravity, g Cart mass, M Bob mass, mB Pole mass, mT Distance from pivot to the centre of bob, L Distance from pivot to the centre of pole, LT Moment of Inertia of the pole w. r. t. pivot, IT Radius of the dc motor shaft, R Moment of inertia of the belt wheel, Jpx Moment of inertia of the DC motor shaft, Jp
Control of an IP_Umar

Value/Units 9.81 m/s2 0.128 kg 0.063 kg 0.043 kg 0.33 m 0.17 m 4.14 × 10−4 kg·m2 0.003 m 1.22 ×10−6 kg·m2 3.33 ×10−7 kg·m2
99

Free Body Diagrams
 Lθ 2

N M

P

bẋ (friction) F x, ẍ

θ L ẍ mg N

 Iθ

P Cart
Control of an IP_Umar

Pendulum
1010

Modeling…Contd
Dynamic equations are written for both the and the pendulum cart

Interactive forces (N & P have been eliminated) Force Balance Equation (for cart + pendulum in horizontal direction):    F = ( M + m )  + bx + mLθ cos θ− mLθ 2 sin θ x Torque Balance Equation (for pendulum in vertical direction) 2  ( I + mL ) θ + mgL sin θ = −mLx cosθ
Control of an IP_Umar 1111

Transfer Function
The linearized equations about θ = π αρε:    + bx − mLθ = u ανδ ( I + mL2 ) θ − mgLθ = mL ( M + m) x  x
mL Τηε τρανσφερ φυνχτιονσ αρε οβταινεδ ασ: Θ( s ) = U (s ) q b( I + mL2 ) 2 ( M + m)mgL bmgL s3 + s − s− q q q s

( I + mL2 ) s 2 − mgL X (s ) = 4 U (s ) q s + b( I + mL2 ) s 3 − ( M + m)mgL s 2 − bmgL s
where , q = ( M + m) I + mL - ( mL )
2

[

(

)

2

]
1212

Control of an IP_Umar

State Space Model
The linear state model after incorporating actual numerical values is: 1 0 0  0  0 0 − 33.746 − 2.1107 1  5.3725  +  u(t)  x(t) =  0 0 0 0  0      39.327 0 − 17.724 0 111.33 1 0 0 0 T T C=  , D = [ 0 0] 0 0 1 0    xT = x x θ θ and y T = [ x θ ]

[

]

Control of an IP_Umar

1313

System Stability
Inputting the A matrix in MATLAB and typing (A) gives the eigen values as: 0,−33.9570, −5.5677, 5.7777 Again typing rank(ctrb(A,B))gives ans = 4 The system is completely controllable! A suitable state feedback strategy can be now designed eig
UNSTABLE

Control of an IP_Umar

1414

Swinging up the pendulum
Two strategies: Energy Control & Fuzzy rule based control are discussed It is required to determine the no. of swings “k” needed to swing up the pendulum from its pending position to the upright position k critically depends on the ratio of effective acceleration of the cart to the gravity acceleration i.e. n = ẍeff/g When max. voltage of 10 V is applied on the dc motor the effective accn. is 3.5318 m/s2

Control of an IP_Umar

1515

Contd…

Time response of the accn on applying a max. voltage

Control of an IP_Umar

1616

Swinging Zones

Control of an IP_Umar

1717

Contd…
Åström’s [4] approach gives the value of k = 4 but cannot be implemented practically due to limited length of track/cart movement (0.5 m) Another approach by Chatterjee [5] considers limited movement and gives k = 6 but the control law proposed is complicated and requires exact measurement of the system variables Fuzzy Control [1] comes in to play at this point. The input variables are x, ẋ, θ and output variable is voltage
Control of an IP_Umar 1818

Contd…
Rule base consists of 34 rules. The rules are so constructed to increase the pendulum energy Simulation results show that k = 5 (for real time implementation k = 7) The main advantage of FLC is that accurate measurements are not needed and is not affected by parameter changes & disturbances Stability depends on proper design of the rule base

Control of an IP_Umar

1919

Control of an IP_Umar

2020

Simulation Results (Angle)

Control of an IP_Umar

2121

Simulation Results (Position)

Control of an IP_Umar

2222

Balancing the Pendulum
Pendulum is balanced (stabilized) using state feedback law u = −Kx Gain matrix K is calculated using LQR such that cost T T function J = x Qx + u is minimized Ru dt

∫(

)

For Q = diag[0.25 0 4 0] & R = 0.0003 K = [−28.867 −35.198 −137.6 −13.027] LQR design guarantees stability of the state controller
Control of an IP_Umar 2323

Real Time Implementation Results

Control of an IP_Umar

2424

Real Time Implementation Results

Control of an IP_Umar

2525

Simplification in the FRB
34 is a large no. for the rules Another approach by Nigam [2] combines errors/change in errors in position and angle into a single error “e” and change in error “de” There are only 9 rules in the rule base. Strategy is similar to the previous one
de e N Z P N N N Z Z N Z P P Z P P
2626

Control of an IP_Umar

Simulation Results (Angle)

Control of an IP_Umar

2727

Simulation Results (Position)

Control of an IP_Umar

2828

Conclusion
Inverted pendulum system represents an important control problem and will continue to serve control engg. as new theories evolve Energy control is a convenient strategy for swing up of the pendulum But Fuzzy control approach performs even better than that Pendulum must be stabilized in the upright position using an appropriate strategy

Control of an IP_Umar

2929

Video
Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level

Control of an IP_Umar

3030

References to edit Master text styles Click
1.

Second level ● Third level ● Fourth level Tovornik, Boris & Nenad Muškinja “Swinging Up and Stabilization of ● Fifth level a Real Inverted Pendulum”, IEEE Transactions on Industrial

2.

3.

4.

5.

Electronics, Vol. 53, No. 2, pp. 631-639, April 2006. (doi: 0.1109/TIE.2006.870667) Nigam, M. J. et. al. , “Fuzzy Swing-up and Stabilization of Real Inverted Pendulum using Single Rulebase”, Journal of Theoretical & Applied Information Technology, Vol. 6, No. 14, pp. 43-50, 2011. Nasir, Ahmad Bin, Mohd. Fua’ad, “Modeling And Controller Design For An Inverted Pendulum System”, M. E. Thesis, University Teknologi Malaysia, Johor Baru, Malaysia, April 2007. Åström, K. J. & K. Furuta, “Swinging up a pendulum by energy control,”Automatica, vol. 36, no. 2, pp. 287–295, Feb. 2000. D. Chatterjee et. al., “Swing-up and stabilization of a cart-pendulum system under restricted cart track length,” Syst. Control.Lett., vol. 47, no. 11, pp. 355–364, 2002.
Control of an IP_Umar 3131

Thank You!!

Control of an IP_Umar

3232

Queries
Click to edit Master text styles Second level ● Third level ● Fourth level ● Fifth level

Control of an IP_Umar

3333