0% found this document useful (0 votes)
29 views4 pages

LQR Inv Pend

This paper presents the design and simulation of a Linear Quadratic Regulator (LQR) controller for a linear inverted pendulum system, focusing on its mathematical modeling and performance analysis. The study highlights the importance of the inverted pendulum as a control theory experiment and demonstrates the effectiveness of the LQR controller through simulations. Results indicate that while the system is unstable, it is controllable and observable, leading to successful implementation of the LQR control strategy.

Uploaded by

Ali Loubany
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views4 pages

LQR Inv Pend

This paper presents the design and simulation of a Linear Quadratic Regulator (LQR) controller for a linear inverted pendulum system, focusing on its mathematical modeling and performance analysis. The study highlights the importance of the inverted pendulum as a control theory experiment and demonstrates the effectiveness of the LQR controller through simulations. Results indicate that while the system is unstable, it is controllable and observable, leading to successful implementation of the LQR control strategy.

Uploaded by

Ali Loubany
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

2010 International Conference on Electrical and Control Engineering

Design and Simulation of LQR Controller with the


Linear Inverted Pendulum
Hongliang Wang Haobin Dong*,Lianghua He,Yongle Shi,YuanZhang
Institute of Geophysics and Geomatics Faculty of Mechanical and Electronic Information
China University of Geosciences China University of Geosciences
WuHan ,China WuHan ,China
e-mail:[email protected] e-mail:[email protected]

Abstract—This paper focused on modeling and performance


analysis of linear inverted pendulum and design and simulation
of LQR controller. Main to introduce how to built the
mathematic model and the analysis of it’s system performance,
then design a LQR controller in order to get the much better
control. Simulation is done to show the efficiency and feasibility
of proposed approach.

Keywords-inverted pendulum; system performance; LQR


controller; simulation

I. INTRODUCTION
Inverted pendulum system is a typical model of multi- Figure 1. Schematic diagram of linear inverted pendulum
variable, nonlinear, essentially unsteady system, which is
perfect experiment equipment not only for pedagogy but for Isolation force analysis of the car as shown in Figue 2, and
research because many abstract concepts of control theory can isolation force analysis of the rod as shown in Figure 3.
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. Therefore,
as an ideal example of the study, the inverted pendulum system
in the control system has been universal attention. And it has
been recognized as control theory, especially the typical
modern control theory research and test equipment. So it is not
only the best experimental tool but also an ideal experimental
platform. The research of inverted pendulum has profound
meaning in theory and methodology, and has valued by various
countries' scientists [1].
Linear quadratic optimal control theory( LQR) is the most Figure 2. Isolation force analysis Figure 3. Isolation force
important and the most comprehensive of a class of of the car analysis of the rod
optimization-based synthesis problem, obtain the performance
index function for the quadratic function of the points system, Analysis the horizontal direction force of the car via the
not only taking into account both performance requirements, Newton's law, we can get the following equation:
but also taking into account the control energy requirements. Mx = F − bx − N
Similarly, from the analysis of the pendulum which
II. MATHEMATICAL MODEL suffered the horizontal force ,we can get the following
First, confirm that you have the correct template for your equation:
paper size. This template has been tailored for output on the A4
As a linear inverted pendulum system, the mathematical mode d2
N′ = m ( x + l sin Φ )
will be established by the method of mechanical analysis as dt 2
follows. The Schematic diagram of the inverted pendulum is Because:
shown in Figure 1.
Φ = θ − π , N ′ = −N
So:
2008 experimental teaching technology research projects of CUG
Item Number: SJ-200804
*Corresponding author, e-mail:[email protected]

978-0-7695-4031-3/10 $26.00 © 2010 IEEE 699


DOI 10.1109/iCECE.2010.178
d2 d2 ⎡ x ⎤ ⎡0 1 0 0⎤ ⎡ x ⎤ ⎡ 0 ⎤
N′ = m ( x + l sin(θ − π )) = m ( x − l sin θ ) ⎢x ⎥ ⎢ ⎢ ⎥
dt 2 dt 2
⎢ ⎥ = ⎢0 −0.098 0.629 0 ⎥ ⎢ x ⎥ ⎢ 0.883 ⎥
That is: ⎥ +⎢ ⎥u
⎢Φ ⎥ ⎢0 0 0 1 ⎥ ⎢Φ ⎥ ⎢ 0 ⎥
N ′ = mx − mlθ cos θ + mlθ 2 sin θ (1) ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎣⎢Φ ⎦⎥ ⎣0 −0.237 26.853 0 ⎦ ⎣Φ ⎦ ⎣ 2.356 ⎦
Substituting this equation into the equation, we can get the ⎡ x ⎤ ⎡1 0 0 0⎤ ⎡ x ⎤ ⎡0 ⎤
⎢x ⎥ ⎢ ⎢ ⎥
system equations of motion. 0 0 0 0⎥⎥ ⎢ x ⎥ ⎢⎢0 ⎥⎥
y=⎢ ⎥=⎢ + u
( M + m) x + bx − mlθ cos θ + mlθ 2 sin θ = F (2) ⎢Φ ⎥ ⎢0 0 0 0⎥ ⎢Φ ⎥ ⎢0 ⎥
Similarly, from the analysis of the pendulum which ⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
suffered the vertical force ,we can get the following equation: ⎣Φ ⎦ ⎣0 0 0 0⎦ ⎣Φ ⎦ ⎣0 ⎦

P − mg = −mlθ sin θ − mlθ 2 cos θ (3)


Suppose θ = π + Φ ,and make u to represent the controlled III. CHARACTERISTIC ANALYSIS OF SYSTEM
object with the input force F, the latter two linear equations of After obtaining the mathematical model of the system
motion are as follows: features, we need to analyze the stability, controllability and
observability of system's in order to further understand the
⎧⎪( l + ml 2 ) Φ − mgl Φ = mlx characteristics of the system [5~7].
⎨ (4)
⎪⎩( M + m) x + bx − ml Φ = u A. Stability Analysis
Take the equations(4)with Laplace transform, to be: If the closed-loop poles are all located in the left “s” plane,
the system must be stable, otherwise the system instability. In
⎧⎪( l + ml 2 ) Φ ( s ) s 2 − mgl Φ ( s ) = mlX ( s ) s 2 MATLAB, to strike a linear time-invariant system, the
⎨ characteristic roots can be run by eig (a,b) function. According
⎪⎩( M + m) X ( s ) s + bX ( s ) s − ml Φ ( s ) s = U ( s )
2 2
to the sufficient and necessary conditions for stability of the
Note: the transfer function is derived assuming the initial system, we can see the inverted pendulum system is unstable.
condition is 0,as the output angle is Φ ,solving the equations
,we can get: B. Controllability Analysis
Linear time-invariant controllablility systems necessary and
Φ (s) mls 2 sufficient condition is:
=
X ( s ) ( I + ml 2 ) s 2 − mgl rank ⎡⎣ B AB An −1 B ⎤⎦ = n
.
⎡ ( I + ml 2 ) g ⎤ ⎡ ( I + ml 2 ) g ⎤ The dimension of the matrix A is n.
( M + m) ⎢ − ⎥ Φ ( s) s2 + b ⎢ − 2 ⎥ Φ(s) s
⎢⎣ ml s⎥
⎦ ⎢⎣ ml s ⎥
⎦ In MATLAB, the function ctrb (a,b) is used to test the
−ml Φ ( s ) s 2 = U ( s ) controllability of matrix ,through the calculation we can see
that the system is status controllable.
After finishing, obtain the transfer function:
ml 2 C. Observability Analysis
s Linear time-invariant observability systems necessary and
Φ (s) q
= sufficient condition is:
U (s) b ( I + ml 2 ) ( M + m ) mgl s 2 − bmgl s
s4 + s3 − rank ⎡⎣C CA
T
CA n −1 ⎤⎦ = n
q q q .
Meanwhile: In MATLAB, the function obsv(a,b) is used to test the
observability of matrix ,through the calculation we can see that
q = ⎡⎣( M + m ) ( I + ml 2 ) − ( ml 2 ) ⎤⎦ the system is status considerable.
By the principles of modern control theory, and then
substituted the inverted pendulum system parameters which is IV. DESIGN AND SIMULATION OF LQR CONTROLLER
designed by ourselves into the state space equation[2 ~ 4]:
A. LQR optimal control strategy
LQR control theory, is an important tool in modern control
theory. It provides an effective analysis method multi-variable
for feedback system design, adapt to time-varying systems

700
,handle the perturbation signal and measurement noise Assuming the whole state feedback can be achieved (four
problems and deals with finite and infinite time horizon. state variables can be measured), so the feedback control law
can be found to determine the vector K. In MATLAB, the
The basic principles of LQR linear quadratic optimal function Lqr allows you to select two parameters——R & Q,
control, by the system equation: These two parameters are used to balance the input and the
weight of state, the simplest situation is assume R =
⎧⎪ Xi = AX + Bu
Q = C × C′
⎨ 1, Of course, you can also change the Q matrix
⎪⎩ y = CX + Du nonzero elements to adjust the controller to get the desired
response. Here the pursuit of matrix K, In MATLAB, statement
And the quadratic performance index function:
is K = lqr(A, B,Q, R) [10] [11].

1
J=
2 ∫0
( X T QX + uT Ru ) dt (5)
The following is the analysis according to Q and R which
are selected based on actual.

Q is a positive semi-definite matrix, R is positive definite • when Q=[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1],R=1,part
matrix. of the MATLAB procedure is as follows
If the inverted pendulum deviates from the zero state >> A=[];B=[];
*
system due to the outside interference, then u can make the >> Q=[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];R=1;
system back to zero state’s vicinity ,at the same time satisfy >> K=lqr(A,B,Q,R)
type (5) and obtain the minimum value, from optimal control
theory, we can see that if(5) type obtain the minimum, the K=
optimal control law is : -1.0000 -2.3738 -37.9020 -6.6154
*
u = v − KX (6) >> C=[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];D=0;
Type (6), K is linear optimal feedback gain matrix, v is >> sys=ss(A-B*K,B*K(1),C,D);
the reference signal input. >> step(sys,5)
In MATLAB, utility function lqr,can get the corresponding
feedback gain matrix K = lqr (A, B, Q, R), thus completing the Get the system step response curves shown in Figure 4.
LQR control strategy design.
On the face of the inverted pendulum system modeling,
parameter determination and the analysis of characteristics of
the system, because the system is unstable, anti-jamming
ability is poor, but it is status controllable and status
considerable so it is necessary to design a corresponding
controller in order to ensure that the system can be controlled
by stable manner. As we have got the system state equation, so
it is using to accept the linear quadratic optimal control and
other control methods to control it [8][9].

B. Setting and simulation of LQR control parameter


Using the LQR method, the effect of optimal control
depends on the selection of weighting matrices Q and R,if Q
and R selected not properly, it make the solution can not meet
the actual system performance requirements. In general, Q and
R are taken the diagonal matrix, the current approach for
selecting weighting matrices Q and R is simulation of trial,after Figure 4. LQR system step response
finding a suitable Q and R, it allows the use of computers to
find the optimal gain matrix K easily. We can see from the figure 4, the system response
According to the state equation which we had got according overshoot is small, but the settling time and rise time is too
to straight line of the inverted pendulum system,the four state large.

variables
x, x , Φ , Φ
representing the cart displacement, car
That increase the displacement of the car pendulum and the
swinging angle of the rod, MATLAB procedure is as follows:
speed, the pendulum angle and pendulum angular velocity, the
y = ⎡⎣ x x Φ Φ ⎤⎦
T
• when Q=[100 0 0 0;0 1 0 0;0 0 100 0;0 0 0 1],R=1
output including the trolley position and
pendulum angle. >> A=[];B=[]';
>> Q=[100 0 0 0;0 1 0 0;0 0 100 0;0 0 0 1];R=1;

701
>> K=lqr(A,B,Q,R) variables and the control variable's response curve of straight
line inverted pendulum. The simulation shows the designed
K= controller. is effective and feasible.
-10.0000 -9.3840 -57.8514 -10.1083
>> C=[1 0 0 0;0 1 0 0;0 0 1 0;0 0 0 1];D=0; ACKNOWLEDGMENT
This paper got the help of my dear teachers Haobin Dong,
>> sys=ss(A-B*K,B*K(1),C,D);
Lianghua He and also got the advised by professional Yuqing
>>step(sys,5) Li and Zhihua Li. Thanks a lot for them.
Get the system step response curves shown in Figure 5:
REFERENCES
[1] Yuqing Li, Huajing Fang, Modeling and Analysis of Networked Control
Systems with Network-Induced Delay and Multiple-Packet
Transmission, ICARCV 2008, p 494-498, 2008.
[2] Shousong Hu. Principles of Automatic Control. Fourth edition. Beijing:
National Defense Industry Press.2001.2:20~21
[3] Solid high-pendulum system and automatic control
experiments.Solidhigh-tech(Shenzhen)Co.,Ltd.,2002.8
[4] J Yi, N Yubazaki. Stabilization Fuzzy Control of Inverted Pendulum
Systems .Artificial Intelligence in Engineering, 2000, 14 :153-163.
[5] R.R.Humphris, R.D.Kelm, D.W.Lewis, P.E.Allaire. Effect of Control
Algorithms on Magnetic Journal Bearing Properties[J].Journal of
Engineering for Gas Turbines and Power. Transactions of the ASME.
1986,108(10):624—632.
[6] Jinghu Xing, workers Chen, Ming Jiang. linear The study of inverted
pendulum optimal control system based on LQR. Industrial
Instrumentation and Automation.2007.6.
[7] Jian Pan, Jun Wang. The study of two kinds control strategy based on
inverted pendulum. Modern electronic technology.2008.1
Figure 5 . Q11, Q33 increased after the LQR system step response [8] HaoBin Dong, ChuanLei Wang. Distributed intelligent measurement
systems of high-density electrical profile. Journal of Engineering
Geophysics. 2004.4,1(2)
Comparing Figure 4 with Figure 5 we can see that with
[9] Hongliang Wang,Yangming Ou.National Patent of The People's
Q11, Q33 increase, R constant ,then the system feedback gain Republic of China. The automatic washing machine can be controlled by
matrix K is larger, through the corresponding results of the indexs which will be independent tested by itself..2010..Patent Number:
system ,we will find the time rise and reduced overshoot. the ZL2009200848640.
system can stabilize in the 3s after the Q increase. [10] Dan Huang, Shaowu Zhou. Inverted pendulum control system based on
the LQR optimal regulator. Micro Computer Information,2004,20(2):37-
39.
V. CONCLUSION [11] Inverted pendulum with the Automatic Control Principle Experiment
This paper introduces the modeling and performance V2.0. Solid high-tech (Shenzhen) Co., Ltd..2005:10~70.
analysis of a linear inverted pendulum, designs LOR controller
based on its performance index .Then use MATLAB language
to implement the control system simulation, get all the state

702

You might also like