SMC Paper Pendulum

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

3URFHHGLQJVRIWKHWK0HGLWHUUDQHDQ&RQIHUHQFHRQ 7

&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH

Sliding Mode Control of Rotary Inverted


Pendulm
Mojtaba Ahmadieh Khanesar. Member, IEEE, Mohammad Teshnehlab, Mahdi Aliyari Shoorehdeli
K. N. Toosi University of Technology
Electrical Engineering faculty
Control Department
Tehran, Iran
Email: ahmadieh@ieee.org

Abstract—This paper presents sliding mode control of industrial applications and proves its effective
Rotary Inverted Pendulum. Rotary Inverted Pendulum is a performance. In this paper the sliding mode control design
nonlinear, unstable and non-minimum-phase system. technique is applied to the control of the rotary inverted
Designing sliding mode controller for such system is difficult pendulum.
in general. Here, first the desired performance is introduced This paper is organized as the following: section II
and based on this performance two sliding surfaces are introduces some basics of VSC control using sliding mode
designed, then system is controlled by proper definition of a and also its difficulties and restrictions are discussed. In
lyapunov function. The lyapunov function designed puts section III we will derive nonlinear equations of the plant
more emphasis on the control of the inverted pendulum and consider its state space equations and also the unstable
rather than the control of the motor.
nature of the system is considered. In addition, it will be
shown that the system is a non-minimum-phase system. In
Rotary Inverted Pendulum, Non-Minimum-Phase, Sliding
Mode, Nonlinear Control
section IV the sliding mode control of rotary inverted
pendulum is considered and also simulation results are
provided there.
I. INTRODUCTION
The Rotary Inverted Pendulum is a widely investigated II. SLIDING MODE FUNDAMENTALS
nonlinear system due to its static instability. A version of Essentially, VSC utilizes a high-speed switching
this system is used as a simplified model for the control of control law to drive the nonlinear plant’s state trajectory
rider-motorcycle systems in circular motion on paths of onto a specified and user-chosen surface in the state space
different radii [1]. This paper deals with a rotary inverted (called the sliding or switching surface), and to maintain
pendulum system (see Fig. 1), which is composed of the the plant’s state trajectory on this surface for all
following components: a rotating arm, which is driven by subsequent time. This surface is called the switching
a motor with a pendulum mounted on its rim. The surface because if the state trajectory of the plant is
pendulum moves as an inverted pendulum in a plane “above” the surface a control path has one gain and a
perpendicular to the rotating arm. Essentially the control different gain if the trajectory drops ”below” the surface.
of this system is difficult because this system has two The plant dynamics restricted to this surface represent the
degrees of freedom and only one control input. Also this controlled system’s behavior [8]. The sliding mode
system is a non-minimum–phase system. A non- controller design has two fundamental steps [8]. The first
minimum-phase system is a system whose internal or zero step is to select the sliding surface such that the system
dynamics are unstable [2]. Such systems restrict exhibits the desired behavior in the sliding mode and the
application of nonlinear controller design techniques, such second step is to determine control laws to guarantee the
as feedback linearization and sliding mode controller reaching and sliding mode conditions [9]
design [3].
To guarantee the convergence to the sliding mode
In this paper a variable structure controller is developed surface a lyapunov function V (S ) is defined as a positive
to control the Rotary Inverted Pendulum. Variable
structure control (VSC) with sliding mode control was function of sliding surface (S ) and then the control
first proposed and elaborated in the early 1950’s in the signals are calculated in such a way that: V < 0 this would
Soviet Union by Emelyanov and several co researchers [4- guarantee that V → 0 and also by proper definition of
6]. Since then, VSC has developed into a general design lyapunov function as a function of S ,. S → 0 . Then the
method being examined for a wide spectrum of system performance of the system is determined by equation
types including nonlinear systems, multi-input/multi- S = 0 . Design of sliding surface is very important since
output systems, discrete-time models, large-scale and after reaching the sliding surface, this surface determines
infinite-dimensional systems, and stochastic systems. In the performance of the system under control. Using output
addition, the objectives of VSC have been greatly feedback linearization approach, systems can be described
extended from stabilization to other control functions such
in a canonical form consider following dynamical system:
as tracking, model following etc. The most distinguished
feature of VSC is its ability to result in very robust control
systems; in many cases invariant control systems result x ( n ) = F (x ) + G (x )u
[7]. This method is now tested on variety of different (1)
y =x
3URFHHGLQJVRIWKHWK0HGLWHUUDQHDQ&RQIHUHQFHRQ 7
&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH

The sliding mode controller design for such system is direction, the velocity of the point mass in the y direction
quite easy and straightforward. The sliding surface and the rotating pendulum about its center of mass:
considered for this system can be [10]:
T = K .E .Hub + K .E .V x + K .E .V y + K .E .Pendulum (6)
n −1
d 
s = +λ e (2)
 dt  The moment of inertia of a rod about its center of mass
is:
The lyapunov function considered here is simply:
1 MR 2
JCM = 12 (7)
1
V = s2 (3)
2 Here R=2L and (L) is the length of the pendulum. So

Using this lyapunov function, the stability condition is as:


JCM = 13 ML2 (8)
V < 0 (4)
Finally, kinetic energy is as follows:
The control signal for the system can be easily
calculated. But in non-minimum-phase system, the system 1 1
can’t be controlled simply by stabilization of error and its T = J eq θ2 + m (rθ − L cos α (α ))2
derivatives as proposed in [10]. 2 2
(9)
1 1
+ m (L sin αα ) 2 + JCM α 2
III. THE MODEL OF ROTARY INVERTED PENDULUM 2 2
SYSTEM
As mentioned earlier the Rotary Inverted Pendulum is Therefore, we have Lagrangian formula as:
an unstable nonlinear system. Also it should be mentioned
that this system is a non-minimum-phase system. 1 2
L = T −V = J eq θ2 + mL2α 2 − mLr cos ααθ

The variables used to define the model of the rotary 2 3
inverted pendulum are as follows: (10)
1
+ mr 2θ2 − mgL cos α
TABLE I. DESCRIPTION OF THE PARAMETERS USED IN THE
2
MODELING OF THE SYSTEM
General coordinates are θ, α. Therefore, we have:
Symbol Description
L Length to Pendulum's Center of mass
h Distance of Pendulum Center of mass from ground δ δL  δL
  − = TOutput − B eq θ
r Rotating Arm Length δt  δθ  δθ
θ Servo load gear angle (radians) (11)
α Pendulum Arm Deflection (radians)
δ δL  δL
  − =0
JCM Pendulum Inertia about its center of mass δt  δα  δα
Vx Velocity of Pendulum Center of mass in the x-direction
And also:
Vy Velocity of Pendulum Center of mass in the y-direction

Kt Motor Torque Constant ηm η g K t K g (V m − K g K m θ )


TOutput = (12)
Km Back EMF Constant Rm
Rm Armature Resistance
Motor Inertia
So we have:
Jm
ηg Gearbox Efficiency
.. .. . . ηm η g K t K g
ηm Motor Efficiency a θ − b cos(α ) α + b sin(α )(α )2 + G θ = Vm
Rm (1
.. ..
Using Euler-Lagrange formulation we obtain potential c α − b cos(α )θ − d sin(α ) = 0
and kinetic energy of the system as follows [11]: 3)
The only potential energy of the system is the gravity:
In which some simplifying assumptions are considered
as follows:
V = P .E .Pendulum = m g h = m g L cos(α ) (5)

The Kinetic Energies in the system arise from the


moving hub, the velocity of the point mass in the x
3URFHHGLQJVRIWKHWK0HGLWHUUDQHDQ&RQIHUHQFHRQ 7
&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH

.
x1 = x 2
.
x 2 = F1 (X ) + G1 (X )u
(15)
.
x3 = x 4
.
x 4 = F2 (X ) + G 2 (X )u

Where:

2
−b sin(2x 1 ) x 22 − G b x 4 cos(x 1 ) + a d sin(x 1 )
F1 (X ) = 2
a c − b 2 cos 2 x 1
Figure 1. Top view of Rotary Inverted Pendulum ηm η g k t k g b
G1 (X ) = cos(x 1 )
(
R m a c − b 2 cos 2 x 1 )
cF1 (X ) − d sin(x 1 )
F2 (X ) = (16)
b cos(x 1 )
ηm η g k t k g c
G 2 (X ) =
(
R m a c − b 2 cos 2 x 1 )
In [1] a feedback linearization method for obtaining the
canonical form of the Rotary Inverted Pendulum is
proposed. Also in [12] another mathematical approach to
approximated feedback linearization using splines is
proposed, where the Rotary Inverted Pendulum is used as
a benchmark to show the procedure used. But the input of
the system considered in both papers is the torque of the
motor or any actuator applied to the rotary arm and those
approaches can’t be applied here. The input of the system
considered here is motor voltage.
Here the feedback linearization of the system is
considered. Consider x 1 as the output of the system, so
we have:
Figure 2. Side View of Rotary Inverted Pendulum

y = h (X ) = x 1 (17)

a = J eq + mr 2 Then we have:
b = mLr
4 L g h (X ) = 0 (18)
c = mL2
3
d = mgL (14)
L g Lf h (X ) = G1 (X ) (19)
E = ac − b 2
ηm η g K t K m K g2 + B eq R m In which L g h (X ) represents Lie derivative of h (X )
G =
Rm with respect to g . So the relative degree of the system is
So that the state equations of the system would be: r = 2 and 2 modes of the system are unobservable. Also:

Lf h (X ) = y = x 2 (20)

Then:

L2f h (X ) = y = F1 (x ) (21)


3URFHHGLQJVRIWKHWK0HGLWHUUDQHDQ&RQIHUHQFHRQ 7
&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH

In addition, the feedback input to linearize the system IV. SLIDING MODE CONTROL OF THE ROTARY
is: INVERTED PENDULUM

A. designing a proper sliding surface for the system


u =−
1
L g L f h (X )
(
L2f h (X ) −V (x 1 , x 2 ) =) As mentioned earlier, the Rotary Inverted Pendulum is
(22) a non-minimum-phase system. Finding a proper sliding
1 surface for such a system is not a routine task. The
− ( F1 (X ) −V (x 1, x 2 ) ) mathematical model of the system can be seen as a
G1 (X )
combination of two systems in a canonical form. Consider
desired dynamics for these two canonical forms are as:
Where V (x 1 , x 2 ) is the controller applied to the
linearized system, which can be a linear combination of x1 + λ1x 1 = 0 (30)
x 1 , x 2 in feedback linearization control approach or can
be the gain calculated using sliding mode. In either case:
x3 + λ3 x 3 = 0 (31)
V (0, 0) = 0 (23)
These two equations guarantee the stability of both the
Observable modes of the system can be stabilized, motor position and the inverted pendulum on the sliding
choosing proper function for the V (x 1 , x 2 ) . To analyze surface.
the zero dynamics of the system we consider: Here we can use two sliding surfaces s1 and s 2 as
following:
X *
= [0 0 x 3 x4] (24)
s1 = x 2 + λ1x 1 (32)
Then:

−Gb s 2 = x 4 + λ1x 3 (33)


F1 (X * ) = x4 (25)
ac − b 2
To have a stable system with guarantee of stability here
the lyapunov function is considered as follows:
Gc
F2 (X * ) = − x4 (26) V =| s1 | +λ2 | s 2 | (34)
ac −b 2
Here λ2 is a positive variable. The effect of λ2 is to
put more stress on the control of the inverted pendulum
ηm η g k t k g b rather than the control and stability of the motor, so λ2
G1 (X * ) = (27)
R m ac − b 2( ) assumes to be a user defined real number between 0 and 1.
To guarantee the stability of the feedback system, we
drive the control signal u such that:

ηm η g k t k g c V
G 2 (X * ) = (28) V = −α sat ( ) (35)
(
R m ac − b 2 ) Φ

Using equations (16) the zero dynamics of the system Where sat (V ) is the saturation function, which is
will be obtained as follows: defined as in (36). This function reduces chattering very
much.

d 2x 3 Gc Gc
=− x4 − (29) V
dt 2
ac − b 2
a c −b 2 V  if Φ <|V |
sat ( ) =  Φ (36)
Φ  sgn(V ) otherwise
The obtained zero dynamic of the system are unstable.
So, the analysis above shows that if α is considered as the
plant output, feedback linearization approach can’t Also in (35) α is a positive number, which determines
stabilize the system and the θ and its derivative which are the rate at which V approaches zero. Using the proposed
two unobservable state variables show unstable response. lyapunov function, we need the control signal to be as
As θ represents angle of the motor, the motor will not stop follows:
rotating. Finding a sliding surface for the system is not
straightforward [2].
3URFHHGLQJVRIWKHWK0HGLWHUUDQHDQ&RQIHUHQFHRQ 7
&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH

u = [ −α sat (V / Φ ) − (λ1x 2 + F1 (X ))sgn(s1 ) would be unstable and the motor would keep on rotating.
Better performance with less chattering in voltage input
− λ2 (λ3 x 4 + F2 ( X ))sgn(s 2 )] (37) could be designed but the voltage of the motor would be
[G1 ( X )sgn(s1 ) + λ2G 2 ( X )sgn(s 2 )]−1 much more than the applicable voltage.

VI. CONCLUSION
V. SIMULATION RESULTS In this study, sliding mode control of the Rotary
The values of plant parameters are as follows [11]: Inverted Pendulum was considered. It was shown that:
this system is a non-minimum-phase system and finding a
TABLE II. VALUES OF THE PARAMETER USED IN SIMULATION
sliding surface for the system is not so easy. Two sliding
surfaces were defined. By proper definition of the
Parameter Value Parameter value lyapunov function as a combination of two sliding
Kt 0.00767 N .m m 0.125 Kg surfaces, the system was controlled and satisfactory
Km 0.00767V /(rad / s ) ηm 0.69 results obtained.

Rm 2.6Ω ηg 0.85 REFRENCES


Jm 3.87 e-7 Kg m 2 [1] Chih-Keng Chen, Chih-Jer Lin, and Liang-Chun Yao, “Input-State
Linearization of A Rotary Inverted Pendulum”, Asian Journal of
Control, Volume: 6, Issue Number: 1, pp 130-135
the maximum voltage which can apply to the motor is [2] A. Isidori, Nonlinear Control Systems: An introduction, 1st and 2nd
eds., New York: Springer-Verlag, 1985, 1989.
±6 volts. The parameters of the controller are to be:
[3] Xiao-Yun Lu and S. K. Spurgeo, “Control of nonlinear non-
minimum phase systems using dynamic sliding mode”,
TABLE III. VALUES OF THE CONTROLLER USED IN SIMULATION International Journal of Systems Science, 1999, vol. 30, no. 2, pp
183-198
Parameter Value Parameter Value
[4] S. V. Emelyanov, Variable Structure Control Systems. Moscow:
α 0.3 λ2 0.7 Nauka (in Russian), 1967.
λ1 0.2 λ3 3 [5] Y. Itkis, Control Systems of Variable Structure. New York:
Wiley,1976.
Φ 0.5 [6] V. A. Utkin, Sliding Modes and Their Application in Variable
Structure Systems. Moscow: Nauka (in Russian) (also Moscow:
Using MATLAB software simulation results, are Mir, 1978, in English).
obtained as in figures (3, 4). As it is shown in figure (5), [7] John Y. Hung, Weibing Gao, James C. Hung, “Variable Structure
the voltage applied to the plant is in the applicable range Control: A Survey”, IEEE Trans. On Industrial Electronics, vol.
40, no. 1, FEB. 1993
and can be applied to the motor. In addition, the position
[8] R. DeCarlo, S. H. Zak, G. P. Matthews, “Variable Structure
of the inverted pendulum is regulated to its zero position, Control of Nonlinear Multivariable Systems: A Tutorial”, Proc. of
which is assumed to be on the top. As it was suggested in the IEEE, vol. 76, no. 3, 1988
previous sections, control of the inverted pendulum is [9] Yon-Ping Chen and Jeang-Lin Chang, “A new method for
much more important than the control of the position of constructing sliding surfaces of linear time-invariant systems“, Int.
the motor. The gain λ2 helps to have more emphasis on J. of Systems Science, 2000, vol. 31, number 4, pp 417-420
the control of the inverted pendulum than the control of [10] J. J. E. Slotine, W. Li, “Applied Nonlinear Control”, Prentice Hall,
1991.
the motor. As it is shown in figure (3) the inverted
[11] Quanser Inc. “Rotary Inverted Pendulum Student Handout”,
pendulum approaches its zero position and then the
[12] Scott A. Bortoff Approximate state-feedback linearization using
position of the motor is controlled easily. Figure (4) shows spline functions “ Automatica, Vol. 33, Issue 8, Aug. 1997, pp
that using this controller the angle of the motor is also 1449-1458
controlled, while using feedback linearization this mode

Figure 3. The angle of the inverted pendulum ( α ) Figure 4. The angle of the motor ( θ )
3URFHHGLQJVRIWKHWK0HGLWHUUDQHDQ&RQIHUHQFHRQ 7
&RQWURO $XWRPDWLRQ-XO\$WKHQV*UHHFH

Figure 5. The voltage input applied to the motor

You might also like