Inverted Pendulum System

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/341134318

OPTIMAL CONTROLLER DESIGN FOR INVERTED PENDULUM SYSTEM: A


COMPARATIVE STUDY

Conference Paper · February 2020

CITATIONS READS

0 503

2 authors, including:

Kumaresh Pal
ARKA JAIN UNIVERSITY, JAMSHEDPUR
7 PUBLICATIONS   36 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Detection of Sag and Swell Disturbances in a Micro Grid Using Wavelet and Wavelet Packet Transform View project

All content following this page was uploaded by Kumaresh Pal on 04 May 2020.

The user has requested enhancement of the downloaded file.


National Conference on Recent trends in Advanced technology Applications and challenges
[RTATAC - 2020] AJU JHARKHAND, India, 28-29February 2020

OPTIMAL CONTROLLER DESIGN FOR INVERTED


PENDULUM SYSTEM: A COMPARATIVE STUDY
Ms.Manaswita Sharma and Mr.Kumaresh Pal
1 Ms. Manaswita Sharma, Former Assistant Professor, Jorhat Engineering College, Assam, India,
manaswitasharma16@gmail.com
2 Mr. Kumaresh Pal, Assistant Professor, Electrical & Electronics Engineering Department, ARKA JAIN
UNIVERSITY, Jharkhand, India, kumaresh.pal@rediffmail.com

ABSTRACT

Inverted pendulum system is a typical model of multivariable, nonlinear, essentially unsteady


system, which is perfect experiment equipment not only for pedagogy but for research because
many abstract concepts of control theory can be demonstrated by the system-based experiments.
The research on such a complex system involves many important theory problems about system
control, such as nonlinear problems, robustness ability and tracking problems. The simplest case of
this system is the cart- single inverted pendulum system. The main aim is to stabilize the inverted
pendulum such that the position of the cart on the track is controlled quickly and accurately so that
the pendulum is always erected in its inverted position during such movements by designing
optimal controller such as Linear Quadratic Regulator (LQR) controller. In this study, the
modelling and simulation for optimal control design of nonlinear inverted pendulum-cart dynamic
system using PID controller and pole placement method is also performed.
Keywords: Inverted Pendulum (IP), LQR, PID, Pole Placement.

1. INTRODUCTION

Being an inherently unstable system, the inverted pendulum is among the most complex systems,
and is one of the most important classical problems. Due to its importance, this is a choice of
dynamic system to analyse its dynamic model and propose a control law.
The Inverted Pendulum is a classical control problem in dynamics and control theory and is widely
used as a benchmark for testing control algorithm (PID controller, neural network, fuzzy control,
genetic algorithm etc.). The Inverted Pendulum System is Single Input Multiple Output (SIMO)
type of system. Here, there are two number of free component i.e. it has 2 degree of freedom. It has
one input and the two outputs are position and angle.

2. RELATED WORK

As a linear inverted pendulum system, the mathematical model will be established by the method of
mechanical analysis as follows. The Schematic diagram of the inverted pendulum is shown in Fig
2.1.Isolation force analysis of the car as shown in Fig 2.2, and isolation force analysis of the rod as shown in
Figure 2.3.

Fig: 2.1 Fig: 2.2 Fig: 2.3


1
National Conference on Recent trends in Advanced technology Applications and challenges
[RTATAC - 2020] AJU JHARKHAND, India, 28-29February 2020

Control input is the force F. The outputs are the angular position of the pendulum θ (theta) and the
horizontal position of the cart x. M is the mass of the cart (0.7kgs), m is the mass of the pendulum
(0.3kgs) and L is the distance from the pivot to mass centre of the pendulum (0.5m).
By the principles of modern control theory, and then substituted the inverted pendulum system
parameter which is designed into the state space equation is given by:

Here, g is the gravitational constant taken as 9.8kg/m2

3. CONTROLLER DESIGN

3.1 Design of LQR


A special case of optimal control problem which is of particular importance arises when the
objective function is a quadratic function of x and u, and the dynamic equations are linear. The
resulting feedback law in this case is known as the linear quadratic regulator (LQR). The
performance index is given by:
1 𝑡
𝐽 = 2 ∫𝑡 𝑓(𝑥 𝑇 𝑄𝑥 + 𝑢𝑇 𝑅𝑢 )𝑑𝑡 ……………. (3.1.1)
0
Where Q is the symmetric, positive semi-definite state weighting matrix, and R is the symmetric,
positive definite control weighting matrix.
𝑢(𝑡) = −𝐾𝑥 (𝑡) …………………… (3.1.2)
Where K is the (m×n) control gain matrix given by
𝐾 = 𝑅 −1 𝐵 𝑇 𝑃 ……………….. (3.1.3)
And P is the unique symmetric, positive semi-definite (n×n) solution of the algebraic Riccati
equation.
𝑃𝐴 + 𝐴𝑇 𝑃 − 𝑃𝐵𝑅 −1 𝐵𝑇 𝑃 + 𝑄 = 0 ……………… (3.1.4)
The design approach used here is the Linear Quadratic Regulator (LQR) method. An LQR
controller is designed considering two outputs of inverted pendulum, i.e., cart position and
pendulum angle. The four available states considered here are cart position, velocity, pendulum
angle and angular velocity. A controller is to be designed such that, when the pendulum is
displaced, it eventually returns to zero angle (i.e. the vertical) and the cart should be moved to a
new desired position according to the controller.

2
National Conference on Recent trends in Advanced technology Applications and challenges
[RTATAC - 2020] AJU JHARKHAND, India, 28-29February 2020
Fig 3.1: Block diagram of LQR controller

For inverted pendulum, firstly, Q and R is chosen as [500 0 0 0; 0 1 0 0; 0 0 500 0; 0 0 0 1] and 1


respectively. Therefore, K [ 22.3607 18.2401 21.9933 -3.8968].Secondly Q and R is chosen as
[1000 0 0 0;0 1 0 0;0 0 1000 0;0 0 0 1] and R=0.01 respectively and K is found to be K= [316.2278
228.0634 239.7219 -80.1712]

3.2 Design of PID Controller


A proportional-integral-derivative controller (PID controller) is a control loop feedback mechanism
(controller) widely used in industrial control systems. A PID controller calculates an error value as
the difference between a measured process variable and a desired set point. The controller attempts
to minimize the error by adjusting the process through use of a manipulated variable. To stabilize
the inverted pendulum in the upright position and to control the cart at the desired position using the
PID control approach, two PID controllers: Angle PID controller and cart PID controller have been
designed for the two control loops of the system. The equations of the PID control are given as:
𝑑𝜃
𝑉𝑝 = 𝐾𝑝𝑝 𝑒𝜃 (𝑡) + 𝐾𝑖𝑝 ∫ 𝑒𝜃 𝑑𝑡 + 𝐾𝑑𝑝 𝑑𝑡𝜃 ……………………….. (3.2.1)
𝑑𝜃𝑥
𝑉𝑐 = 𝐾𝑝𝑐 𝑒𝑥 (𝑡) + 𝐾𝑖𝑐 ∫ 𝑒𝑥 𝑑𝑡 + 𝐾𝑑𝑐 …………………. (3.2.2)
𝑑𝑡
Where eθ(t) and ex(t) are angle error and cart position error, respectively. Since the pendulum
angle dynamics and cart position dynamics are coupled to each other, the change in any controller
parameters affects both the pendulum angle and cart position, which makes the tuning tedious.

3.3 Pole placement method


It is one of the classic control theories and has an advantage in system control for desired
performance. In pole placement method, we assume that state variables are measurable and are
available for feedback. If the considered system is completely state controllable, then we can place
the poles of the closed loop system in any desired locations by means of state feedback through an
appropriate state feedback gain matrix. In the conventional approach to the design of a single-input-
single-output control system, we design a controller (compensator) such that the dominant closed-
loop poles have a desired damping ratio ζ and an undamped natural frequency ωn. The requirement
is that the system be completely state controllable.
Consider a control system
𝑥̇ = Ax + Bu ………………….... (3.3.1)
y = Cx + Du …………………… (3.3.2)
Where, x=state vector (n-vector), y=output signal (scalar), u=control signal (scalar), A=n× n
constant matrix, B=n × 1 constant matrix, C=1 × n constant matrix, D=constant (scalar).We shall
choose the control signal to be
u = −Kx

Fig 3.4: Block diagram of Pole Placement method

This means that the control signal u is determined by an instantaneous state. Such a scheme is
called state feedback. The 1xn matrix K is called the state feedback gain matrix. We assume that all
3
National Conference on Recent trends in Advanced technology Applications and challenges
[RTATAC - 2020] AJU JHARKHAND, India, 28-29February 2020
state variables are available for feedback. In the following analysis we assume that u is
unconstrained. The present work, Ackermann’s formula method has been used to determine the
matrix K. For an arbitrary positive integer n, we have
K = [0 0 ... 0 1] [B: AB: ....: An-1 B]-1 Φ(A) ……………….(3.3.3)
Equation (3.3.3) is known as Ackermann’s formula for the determination of the state feedback gain
matrix K.

3.4. SIMULATION RESULTS

The simulation results using LQR with linear inverted pendulum is shown below:
Fig.3.4.1 and Fig.3.4.2 shows the step response of linear inverted pendulum taking two different
values of Q and R respectively as mentioned above.

Fig 3.4.1: Step response of Inverted pendulum Fig 3.4.2: Step response of Inverted pendulum
Using LQR using LQR

The simulation result for the LQR scheme for the cart position, linear velocity of the Cart, angle of
Pendulum, angular velocity is shown in the table below. The speed of reaching the final value
depends on choice of Q matrix. From the results obtained, it can be concluded that with the high
value of Q matrix, settling time decreases and also the rise time decreases.

Table I. Characteristics of fig. (3.4.1)

Parameters Settling time(in seconds) Rise time (in seconds)


x 3.99 1.69
𝑥̇ 4.66 0
ɵ 4.85 0
ɵ̇ 3.85 0

Table II. Characteristics of fig. (3.4.2)

Parameters Settling time(in seconds) Rise time (in seconds)


x 3.8 1.61
𝑥̇ 2.28 0
ɵ 4.61 0
ɵ̇ 1.18 0

4
National Conference on Recent trends in Advanced technology Applications and challenges
[RTATAC - 2020] AJU JHARKHAND, India, 28-29February 2020

Fig 3.4.3: Force input (u) Fig 3.4.4: Plot of 𝑥 and 𝑥̇ versus time

Fig 3.4.5: Plot of 𝜃 and 𝜃̇ versus time

In the above, fig 3.4.3, fig 3.4.4 and fig 3.4, the simulation of inverted pendulum using LQR
controller in Matlab/Simulink is shown.

Fig 3.4.6: PID control of inverted pendulum system

5
National Conference on Recent trends in Advanced technology Applications and challenges
[RTATAC - 2020] AJU JHARKHAND, India, 28-29February 2020

From the block diagram of PID controller of Inverted Pendulum, it is seen that the pendulum angle
dynamics and cart position dynamics are coupled to each other, the change in any controller
parameters affects both the pendulum angle and cart position, which makes the tuning tedious. The
disturbance input parameters taken in the simulation are: band limited white noise power = 0.0001,
sampling time = 0.1, seed= 23341. The tuned PID controller parameters of this control schemes for
cases of with disturbance input is given below:

Table III: PID controller parameters of control schemes for with disturbance input case

Control Scheme Angle PID Control Cart PID Control

Kpp Kip Kdp Kpc Kic Kdc

(2PID + LQR) 1 1 1 1.6 -8 6

Fig 3.4.7: Input to pendulum Fig 3.4.8: Plot of x versus time

Fig 3.4.9: Plot of θ versus time

Here only pendulum angle θ and cart position x are considered for the measurement. The reference
angle is set to ‘0 radian’, and reference cart position is set to 0.1 m. The simulation results for both
6
National Conference on Recent trends in Advanced technology Applications and challenges
[RTATAC - 2020] AJU JHARKHAND, India, 28-29February 2020
cases are shown in figure. It is observed that the pendulum stabilizes it also stabilizes upright with
minor oscillations for the case of with continuous disturbance input. The Matlab-Simulink models
have been developed for simulation and performance analysis of the control schemes.

For Pole Placement given the single-input inverted pendulum system and a vector ’ecl’ of desired
self-conjugate closed-loop pole locations, MATLAB command ‘place’ computes a gain matrix ’G’
such that the state feedback u = −Gx places the closed-loop poles at the locations of ’ecl’. In other
words, the Eigen values of A − BG match the entries of ’ecl’. Table IV shows the settling time and
rise time of the system. The G matrix is found to be:

G= [0.2565 0.5822 2.0808 0.7701]

Table IV: Characteristics table

Parameters Settling Time (in seconds) Rise time (in seconds)

Position 6.5 2.73

Angle 7.9 0

Fig 3.4.10: Pole placement method in Inverted Pendulum

Thus, the study presents a number of control approaches such as LQR, PID and Pole Placement for
inverted pendulum system. These design method have been successful in meeting the stabilization
goals of the IPS. The results show that LQR method give the better performance compared to PID
controller and Pole Placement by reducing overshoot, settling time and minimize the rising time.

ACKNOWLEDGEMENTS

Manaswita Sharma: I take this opportunity to thank my entire family for their love and support. I
would take this opportunity to thank specially my husband Mr.Pankaj Saxena for his immense
moral support and encouragement.

Kumaresh Pal: I would like to thank my family & friends for their love, support & encouragement.

7
National Conference on Recent trends in Advanced technology Applications and challenges
[RTATAC - 2020] AJU JHARKHAND, India, 28-29February 2020
REFERENCES

[1] Vural aksakalli and daniel ursu. control of nonlinear stochastic systems: model free controllers
versus linear quadratic regulators. in decision and control, 2006 45th IEEE conference on, pages
4145–4150. IEEE, 2006.

[2] nekoui mohammad ali and valipourearkhloo amin. an lqr/pole placement controller design for
statcom. in control conference, 2007. ccc 2007. chinese, pages 189–193. IEEE, 2007.

[3] Charles w anderson. learning to control an inverted pendulum using neural networks. control
systems magazine, IEEE.

[4] Asad azemi and edwin engin yaz. using matlab in a graduate electrical engineering optimal
control course. in frontiers in education conference, 1997. 27th annual conference. teaching and
learning in an era of change. proceedings.,volume 1, pages 13–17. IEEE, 1997.

[5] Taylor wallis barton. stabilizing the dual inverted pendulum: a practical approach. phd thesis,
massachusetts institute of technology, 2008.

[6] Narinder singh bhangal. design and performance of lqr and lqr based fuzzy controller for double
inverted pendulum system. journal of image and graphics,1(3), 2013.

[7] Felix grasser, aldo d’arrigo, silvio colombi, and alfred c rufer. joe: a mobile, inverted pendulum.
industrial electronics, IEEE transactions on, 49(1):107–114, 2002.

[8] H Hashemipour. nonlinear optimal control of vehicle active suspension considering actuator
dynamics. international journal of machine learning and computing, 2(4):355, 2012.

[9] M.sharma,M.buragohain,“optimal controller design for linear inverted pendulum and double
inverted pendulum system,”International journal of innovative research in computer and
communication engineering,volume:03, issue: 07 , July-2015, pp.6976-6984.

[10] Jiˇr´i vondˇrich. modelling of lqr control with matlab.

[11] Hongliang Wang, Haobin Dong, Lianghua He, Yongle Shi, and Yuan Zhang.Design and
simulation of lqr controller with the linear inverted pendulum. In 2010 international conference on
electrical and control engineering, pages 699–702. IEEE, 2010

[12] Hari Vasudevan, Aaron M Dollar, and John B Morrell. Design for control of wheeled inverted
pendulum platforms. Journal of Mechanisms and Robotics, 7(4).

[13] Yingjun Sang, Yuanyuan Fan, and Bin Liu. Double inverted pendulum control based on three-
loop pid and improved bp neural network. In Digital Manufacturing and Automation (ICDMA),
2011 Second International Conference on, pages456–459. IEEE, 2011.

[14] Prasanna Priyadarshi. Optimal Controller Design for Inverted Pendulum System: An
Experimental Study. PhD thesis, 2013.

[15] Kevin M Passino and Nicanor Quijan. Linear quadratic regulator and observer design for a
flexible joint. Department of Electrical Engineering, The Ohio State University, 2002

[16] Katsuhiko Ogata. State space analysis of control systems. Prentice-Hall, 1967.

View publication stats

You might also like