You are on page 1of 5

The Ninth International Conference on Electronic Measurement & Instruments ICEMI2009

Application of Sliding Mode Control to Design of the Inverted Pendulum


Control System
Zhiping Liu Fan Yu Zhi Wang
College of Computer, Xian Technological University
Xian, 710032, P.R.China
E-mail: lzp_leopard@sina.com

Abstract- Inverted pendulum is one of the most important
plants to be researched to investigate the validity of various
control strategies, its a highly nonlinear, unstable system. In
this paper, the friction force and viscous moment are
considered in the modeling of the plant, the sliding mode
control method is applied to the design of the control system of
inverted pendulum, both traditional sliding mode control law
and integral sliding mode control law are proposed, the
comparison of the performance of two kinds control laws are
presented based on simulation results under the
Matlab/Simulink environment.
Key words- Sliding Mode Control (SMC), Nonlinear System,
Inverted Pendulum, Simulation
I. INTRODUCTION
Inverted pendulum is one of the most important plants
in the science and industrial technologies. Such as rocket,
robotics can be considered as inverted pendulum, it has
many common typical features of the nonlinear systems.
The design of the control system of inverted pendulum
has been the hot issue in the control field, there are many
control laws have been proposed, such as PID control
law, adaptive control law, fuzzy law and even neural
network law
[1~4]
. Sliding mode control has been
proposed for more than fifty years, it has many
advantages over traditional method. It can be used to
linear systems and nonlinear systems, it also could be
applied to continuous system and discrete systems, in the
sliding mode, its robust to outer interferences, its this
unique characteristic that this control method has been
used to design control system in the fields of motor,
robotics, aeronautic and astronautic.
[5~6]

This paper is organized as follows: in the section 2, the
model of inverted pendulum is proposed, the friction
force of the wheels and viscous moment of the hinge are
considered. The traditional SMC law is proposed in the
section 3, then the simulation is performed under the
MATLAB/SIMULINK. In the section 4, the integral
SMC law is proposed and then its verified also by
simulation under the same environment as in the section
3. Finally, the comparison of the SMC and integral SMC
is concluded and some issues need to be researched
deeply are presented.




II. MODEL OF THE INVERTED PENDULUM
u
u
t
M
m

Figure 1. Model of pendulum

In the figure 1, the whole inverted pendulum system is
depicted, it consists of a free vertical rotating pendulum
and a moving horizontally cart. The mass of the cart is M,
the cart can move forward and backward on the ground,
the friction force acts on the wheels of the cart, one of the
control inputs is also acts on the cart, its denoted as u.
the length of the pendulum is l, the mass of the pendulum
is m, another control input ist , control moment, it acts
on the pendulum. If the control moment t doesnt exist,
then this system is an interesting example of
under-actuated system.
In this paper, we firstly considered the fully actuated
system. According to the dynamics of the pendulum
system, the model of the inverted pendulum can be
derived by Lagrange equations and described as
following.

2
2
( ) cos sin
4
cos sin
3
m M x cx ml ml u
ml mlx d mgl
u u u u
u u u u t
+ + + =
+ + =


(1)

In equation (1), x is the displacement of the cart, u
is the angular displacement of the pendulum relative to
the vertical line. For the convenience of the control
system design, the equation (1) should be modified.
3-801
_____________________________
978-1-4244-3864-8/09/$25.00 2009 IEEE
The Ninth International Conference on Electronic Measurement & Instruments ICEMI2009
Let
1 2 3 4
x x x x x x u u = = = =

(2)

Substituting the equation (2) into equation (1), we
can obtain

1 2
2 2 2
4 1 2 1 1
2 2 2 2 2
1
1 2
2 2 2 2
1
1
2 2 2 2
1
3 4
2 2 1
4 2 1
4
3 cos 3 sin cos
4 ( ) 3 cos
3 ( ) sin 3 ( )

4 ( ) 3 cos
3( ) 3 cos

4 ( ) 3 cos
3 cos
4 4 sin
4(
x x
mclx x m l x x x
x
ml m M m l x
mgl m M x d m M x
ml m M m l x
m M mlu x
ml m M m l x
x x
dx x
cx mlx x
l
x
m M
t
=

=
+
+ + +

+
+
+
+
=
+ +
=
+

2
1
1 1
2
1
1
2
1
) 3 cos
3 sin cos

4( ) 3 cos
3 cos
4

4( ) 3 cos
m x
mg x x
m M m x
x
u
l
m M m x
t

+
+
(3)

Furthermore, let

1 2 3 4
[ ] w [ ]
T T
z x x x x u t = = (4)

The equation (3) can be formed as

( ) ( ) z f z g z w = + (5)

Where

2
2 2 2
4 1 2 1 1
2 2 2 2
1
2 1
2 2 2 2
1
4
2
2 1
4 2 1
2
1
1 1
2
1
3 cos 3 sin cos
(
4 ( ) 3 cos
3 ( ) 3 ( )sin
)
4 ( ) 3 cos
( )

3 cos
4 4 sin
(
4( ) 3 cos
3 sin cos
)
4( ) 3 s

co
x
mclx x ml x x x
ml m M ml x
d m M x mgl m M x
ml m M ml x
f z
x
dx x
cx mlx x
l
m M m x
mg x x
m M m x

+
+ + +

+
=
+ +
+

+
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(
(


1
2 2 2 2 2 2 2 2
1 1
( )
0 0
3 cos 3( )

4 ( ) 3 cos 4 ( ) 3 cos
0
g z
ml x m M
ml m M ml x ml m M ml x
=
+
+ +
1
2 2
1 1
0
3cos
4

4( ) 3 cos 4( ) 3 cos
x
l
m M m x m M m x
(
(
(
(
(
(
(

(
(
+ + (



Before we present the control strategies, the detailed
nominal values of the system physical parameters are
given below.

2
2.0 0.6 0.4
9.8 / =5.0N s/m 0.005
M kg m kg l m
g m s c d N m s
= = =
= =

TRADITIONAL SMC CONTROL LAW
According to the procedure of the SMC design
method, we chose sliding surface as below
1 4 4 3 3
1 2 2 1 1
( ) ( ) ( ) ( )
( ) ( ) ( ) ( )
x c px c c px c
c p c c p c
S x x k x x x x k x x
S k x x k x x
u u u
u u u u
= + = +
= + = +


(6)
Choosing the following control law
1 1 1 1
1 1 1
1
0 sgn( )
0 sgn( )
x sx x x x
s
S k S S
k S S
S
u u u u
u
c
c
(
( ( (
=
(
( ( (
(

(7)
Where
sx
k ,
px
k ,
s
k
u
and
p
k
u
are control parameters
respectively. sgn() is the signum function.
As to the existence of the control laws, the system
parameters should meet some requirements as below.
2
1
2 2 2 2
1
2
1
9 cos 12( ) 0
4 ( ) 3 cos 0
4( ) 3 cos 0
m x m M
ml m M m l x
m M m x
+ =
+ =
+ =
(8)
Its easy to verify the correctness of the equation (8).
Then combining the above equations, we can obtain

1 1
1
2 2 2
4 4 4
2 2 1 1
4 4 3 3
1 1 2
1 1 4
( )
0
0
( ) ( )
0
0 ( ) ( )
sgn( )
sgn( )
p
c c
c px c
c p c
s
sx c px c
x x
u
B x
k
x x x
x k x x
x x k x x
k
k x x k x x
S f
S f
u
u
u
u u
t
c
c

(
=
(

( ( (
+ (
( (

+ (
(

+
(`
(
+
(

( (

+
( (

)

(9)

3-802
The Ninth International Conference on Electronic Measurement & Instruments ICEMI2009
Where

1
2 2 2 2 2 2 2 2
1 1
1
2 2
1 1
1
4 ( ) 3 cos 4 ( ) 3 cos
3 cos 3( )
3cos
4

4( ) 3 cos 4( ) 3 cos
( )


ml m M ml x ml m M ml x
ml x m M
x
l
m M m x m M m x
B x
+ +
+

+ +
=
(
(
(
(
(
(



Based on the above equations, simulations can be
performed to verify the presented control law. In the
simulation, the control parameters are given detailed
values as below.

1 1
1 1
10 1
30
px p x
sx s
k k
k k
u u
u
c c = = = =
= =

Meanwhile the initial conditions are also given as
following.

1 2
3 4
(0) 1.3 (0) 0.5
(0) 3.1 (0) 2
x x
x x
= =
= =


Following are some simulation results.
0 5 10
-0.5
0
0.5
1
1.5
time(sec)
a
n
g
u
l
a
r
(
r
a
d
)
angular position
0 5 10
-10
-5
0
5
time(sec)
r
a
d
/
s
angular rate
0 5 10
-2
0
2
4
time(sec)
p
o
s
i
t
i
o
n
(
m
)
position of car
0 5 10
-20
-10
0
10
time(sec)
v
e
l
o
c
i
t
y
(
m
/
s
)
velocity of car

Figure 2. Results of SMC

It should be noted that in the above simulation figures,
in the control vectors, we added band-limited white noise,
the seed number and power of noise are selected from the
block parameter dialog window. Additionally, we added
an incident control input, its amplitude is 4N and 4 Nm.
In order to verify the validity of the proposed control law,
different control parameters are selected, we found that if
we reduce the value of
px
k and
p
k
u
,the angle position
residual error become large, if we amplifier the
1 x
c and
1 u
c , the chatter will occur immediately.
Robustness is another important issue should be
researched in this presentation, compared with nominal
values of the system parameters, we changed the chosen
nominal value as below.
2
5.0 2.6 0.4
9.8 / =5.0N s/m 0.005
M kg m kg l m
g m s c d N m s
= = =
= =

The chosen control parameters and state initial values
keep unchanged. Then the simulation results can be
found as following.
0 5 10
-0.5
0
0.5
1
1.5
time(sec)
a
n
g
u
l
a
r
(
r
a
d
)
angular position
0 5 10
-10
-5
0
5
time(sec)
r
a
d
/
s
angular rate
0 5 10
-2
0
2
4
time(sec)
p
o
s
i
t
i
o
n
(
m
)
position of car
0 5 10
-4
-2
0
2
time(sec)
v
e
l
o
c
i
t
y
(
m
/
s
)
velocity of car

Figure 3. SMC with changed parameters

From the figure 3, we can find that performance of
control system degrades, but we could endure it, the control
force and control moment will also change as below.
0 5 10
-400
-300
-200
-100
0
100
200
time(sec)
c
o
n
t
r
o
l
f
o
r
c
e
(
N
)
control force
0 5 10
-300
-250
-200
-150
-100
-50
0
50
time(sec)
c
o
n
t
r
o
l
m
o
m
e
n
t
(
N
m
)
control moment

Figure 4. Control inputs
3-803
The Ninth International Conference on Electronic Measurement & Instruments ICEMI2009
Compared with nominal parameters, the control force
enlarged near four times, the control moment almost
unchanged.
Although we enlarged the control gains to reduce the
residual errors, we also try to deal this problem with
traditional ideas, meanly adding integral of errors into the
control inputs. So the integral sliding mode control law
will be discussed below.
.INTEGRAL SMC CONTROL LAW
If we chose the following sliding surfaces, compared
with the sliding surfaces in the section 3, in order to
reduce the residual errors in the angular position and the
linear position of the pendulum system, integral SMC is
chosen here.
2
4 4 3 3
2
2 2 1 1
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
( ) ( ) ( )
x c px c ix c
c px c ix c
c p c i c
c p c i c
S x x k x x k x x dt
x x k x x k x x dt
S k k dt
x x k x x k dt
u u u
u u
u u u u u u
u u
= + +
= + +
= + +
= + +
)
)
)
)



(10)

Where
ix
k and
i
k
u
are integral parameters.
The control law is chosen the same as before.

2 2 2 2
2 2 2
2
0 sgn( )
0 sgn( )
x sx x x x
s
S k S S
k S S
S
u u u u
u
c
c
(
( ( (
=
(
( ( (
(

(11)

Then we get

1 1
1
2 2
2 1 1
4 4 4 3 3
2
2
2 2 2
2 2 4
( )
( )
( )
( ) ( )
0
0
sgn( )
sgn( )
p c
c i c
c px c ix c
s
sx x
x x
u
B x
k x x
x k x x
x k x x k x x
k S
k S
S f
S f
u
u
u u
u u
t
c
c

(
=
(

( ( (
+ + (
( (

(


( (

+
` ( (



( (

+
( (


)


(12)

Based on above result, we choose integral control
parameters as below.
10
ix i
k k
u
= =
If initial conditions of each state and other control
parameters are unchanged, Related simulation results are
given below.
0 5 10
-0.5
0
0.5
1
1.5
time(sec)
a
n
g
u
l
a
r
(
r
a
d
)
angular position
0 5 10
-10
-5
0
5
time(sec)
r
a
d
/
s
angular rate
0 5 10
-2
0
2
4
time(sec)
p
o
s
i
t
i
o
n
(
m
)
position of car
0 5 10
-20
-10
0
10
time(sec)
v
e
l
o
c
i
t
y
(
m
/
s
)
velocity of car

Figure 5. Integral SMC

In order to verify the robustness of the control system, as
done before, we chosen changed system parameters as in
section 3, but with much bias relative to the nominal values.
2
5.0 3.6 0.4
9.8 / =6.0N s/m 0.05
M kg m kg l m
g m s c d N m s
= = =
= =

Simulation results are depicted as figure 6.
0 5 10
-0.5
0
0.5
1
1.5
time(sec)
a
n
g
u
l
a
r
(
r
a
d
)
angular position
0 5 10
-10
-5
0
5
time(sec)
r
a
d
/
s
angular rate
0 5 10
-2
0
2
4
time(sec)
p
o
s
i
t
i
o
n
(
m
)
position of car
0 5 10
-20
-10
0
10
time(sec)
v
e
l
o
c
i
t
y
(
m
/
s
)
velocity of car

Figure 6. Traditional SMC
0 5 10
-1000
-800
-600
-400
-200
0
200
400
600
800
time(sec)
c
o
n
t
r
o
l
f
o
r
c
e
(
N
)
control force
0 5 10
-800
-700
-600
-500
-400
-300
-200
-100
0
100
200
time(sec)
c
o
n
t
r
o
l
m
o
m
e
n
t
(
N
m
)
control moment

Figure 7. Integral SMC control inputs
3-804
The Ninth International Conference on Electronic Measurement & Instruments ICEMI2009
From the simulation results, we found that integral
SMC is superior over the traditional SMC in the less
residual errors, when encountered outer perturbation, the
integral SMC is also more robust than traditional SMC.
It should be noted that in figure 7, we can find the
control force and control moment obviously great than
that in the figure 4, because the system parameters
changed much more, it means that control system must
cope with much more severe environment.
.CONCLUSIONS
In this paper, as to the inverted pendulum control
problem, we present two sliding mode control laws, one
is traditional SMC, and another one is integral SMC.
Comparison of the traditional SMC and integral SMC
under the same simulation environment shows that
integral SMC is superior over the traditional SMC in the
static errors and robustness when perturbations is applied
to systems.







































REFERENCES
[1] J. J. E. Slotine and W. Li, Applied nonlinear control, China
mechanical press, 2005.
[2] S.N. Danielle, M. Hannah and A. Joger, Controllability and
Posture Control of a Wheeled Pendulum Moving on an Inclined
Plane. IEEE Transactions on Robotics, 2007, Vol .23, No.3.
[3] L.Sun and Q.Chang, Design of inverted pendulum control system
based on DSP, control engineering of china [J], 2008, Vol. 15,
No.2.
[4] X.Zhang and N.N.Zhang,Swing-up and stabilization of nonlinear
inverted pendulum, Control engineering of china, 2006, Vol. 13,
No.S1.
[5] R.Olfati-Saber,Global stabilization of a flat underactuated system:
the inertia wheel pendulum. Proc. the 40th Conf. on Decision and
Control, Orlando, Fl, Dec. 2001.
[6] S.Y. Yang and L.P. Xu, Study on PID control of a single inverted
pendulum system, control engineering of china, 2007, Vol. 14,
No.S0.


3-805

You might also like