Aeee 2013

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

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

net/publication/275040194

A Complex Overview of Modeling and Control of the Rotary Single Inverted


Pendulum System

Article  in  Advances in Electrical and Electronic Engineering · April 2013


DOI: 10.15598/aeee.v11i2.773

CITATIONS READS

23 5,847

2 authors:

Slavka Jadlovska Jan Sarnovsky


Technical University of Kosice - Technicka univerzita v Kosiciach Technical University of Kosice - Technicka univerzita v Kosiciach
91 PUBLICATIONS   4,938 CITATIONS    35 PUBLICATIONS   192 CITATIONS   

SEE PROFILE SEE PROFILE

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

Underactuated Systems Laboratory View project

All content following this page was uploaded by Slavka Jadlovska on 17 April 2015.

The user has requested enhancement of the downloaded file.


POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

A Complex Overview of Modeling and Control of


the Rotary Single Inverted Pendulum System
Slavka JADLOVSKA 1 , Jan SARNOVSKY 1

1
Department of Cybernetics and Artificial Intelligence, Faculty of Electrical Engineering and Informatics,
Technical University of Kosice, Letna 9, 042 00 Kosice, Slovak Republic

[email protected], [email protected]

Abstract. The purpose of this paper is to present an developed by the authors of this paper and provides
in-depth survey of the rotary single inverted pendulum complex software support for the analysis and control
system from a control engineer’s point of view. The of both classical and rotary IPS [2]. Strong emphasis
scope of the survey includes modeling and open-loop is placed on the generalized approach to system model-
analysis of the system as well as design and verification ing [3], [4], allowing the library to handle systems which
of balancing and swing up controllers which ensure suc- differ by the number of pendulum links attached to the
cessful stabilization of the pendulum in the unstable up- base, such as single [2], [4], [5] and double [2], [4], [6]
right equilibrium. All relevant tasks and simulation ex- IPS.
periments are conducted using the appropriate function
As an underactuated, unstable and yet controllable
blocks, GUI applications and demonstration schemes
system, the rotary single inverted pendulum has been
from a Simulink block library developed by the authors
regarded as an attractive testbed system for linear and
of the paper. The library is called Inverted Pendula
nonlinear control law verification since Katsuhisa Fu-
Modeling and Control (IPMaC) and offers comprehen-
ruta, Professor at the Tokyo Institute of Technology,
sive program support for modeling, simulation and con-
introduced it to feedback control community in 1992
trol of classical (linear) and rotary inverted pendulum
[7]. The aim of this paper is to present a thorough
systems.
overview of this system that covers all topics signifi-
cant for control engineering. The paper is organized as
follows:
Keywords
• In Section 2, a mathematical model of the system
Automatic model generation, custom Simulink is obtained by automatic model generation, and
block library, energy-based swing-up methods, open-loop responses of the system are evaluated.
linear state-feedback stabilizing control, rotary
single inverted pendulum. • Design and verification of control algorithms that
stabilize the pendulum in the unstable upright
equilibrium is presented in Section 3 for a pair
of model situations which deal with stabilizing the
1. Introduction pendulum from around the upright and downward
position respectively. The latter situation also in-
Inverted pendulum systems (IPS) represent a signifi- volves the design of a swing-up controller.
cant class of nonlinear underactuated mechanical sys-
tems, well-suited for verification and practice of ideas • Finally, Section 4 concludes the paper with an
emerging in control theory and robotics [1]. Stabiliza- evaluation of achieved results and some final re-
tion of a pendulum rod in the unstable upright position marks.
is considered a benchmark control problem which has
been solved by attaching the pendulum to a base that
Suitable function blocks and GUI applications from
moves in a controlled linear manner (classical or lin-
the IPMaC are employed in every described step of the
ear IPS) or in a rotary manner in a horizontal plane
process of modeling and control design. All simulation
(rotary IPS).
experiments mentioned in the paper can be run from
The Inverted Pendula Modeling and Control (IP- the Demo Simulations section of the IPMaC which con-
MaC) is a structured Simulink block library which was tains links to corresponding simulation schemes.


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 73
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

2. Mathematical Modeling model derivation based on the mutual analogy of IPS


with a varying number of pendulum links. Via Sym-
and Simulation of the Ro- bolic Math Toolbox [11], the procedure implements the
tary Single Inverted Pen- derivation of Euler-Lagrange equations of motion for a
generalized system of n classical or rotary inverted pen-
dulum System dula [3], [4], [5]. As it is shown in the preview of the
Derivator window, the generated model of the rotary
The considered rotary single inverted pendulum system single inverted pendulum system is composed of two
(Fig. 1) is composed of a rigid, homogenous pendulum second-order nonlinear differential equations of motion
rod attached to an rigid arm which is free to rotate in which respectively describe the dynamic behavior of
a horizontal plane. Since the number of actuators is the rotary arm and the pendulum. For the purposes
lower than the number of system links, the system is of further model analysis as well as control design, it is
underactuated: convenient to rearrange the obtained nonlinear equa-
tions into the so-called standard minimal ODE (Ordi-
nary Differential Equation) matrix form [12]:

~ ~ ~ ~ ~
MI (θ(t))θ̈(t) + N(θ(t), θ̇(t))θ̇(t) +
~
+R(θ(t)) =V ~ (t), (1)

~ is the vector of generalized coordinates de-


where θ(t)
~
fined as θ(t) ~
= (θ0 (t)θ1 (t))T , MI (θ(t)) is the inertia
~ ~
matrix, N(θ(t), θ̇(t)) describes the influence of centrifu-
~
gal and Coriolis forces, R(θ(t)) accounts for gravity
~ (t) is the system’s input vector.
forces and V

Fig. 1: Rotary single inverted pendulum - scheme and parame-


ter nomenclature.

The only input (the torque M (t) applied on the arm)


is used to control the two degrees of freedom of the
system: arm angle θ0 (t) [rad] and pendulum angle θ1 (t)
[rad].

2.1. Automatic Derivation and Eval-


uation of the Mathematical
Fig. 2: Automatic derivation of the rotary single inverted pen-
Model dulum motion equations using Inverted Pendula Model
Equation Derivator.
Manual, step-by-step derivation of differential equa-
tions of motion is the traditional approach to modeling After the described rearrangement of the generated
of mechanical systems which appears prevalently in ac- equations of motion, the mathematical model of the
cessible works such as [8], [9], [10] despite the fact that system assumed the form (2), see [5], where m0 and
it often turns out as laborious and error-prone. As op- m1 stand for the masses of the arm and the pendulum,
posed to the traditional approach, the mathematical l0 and l1 are their respective lengths, δ0 and δ1 are the
model of the system analyzed in this paper was gen- damping constants in the joints of the arm and pendu-
erated automatically by the Inverted Pendula Model lum, J0 and J1 are the moments of inertia of the arm
Equation Derivator (Fig. 2) a MATLAB GUI applica- and pendulum with respect to their pivot points, de-
tion which simplified the process of inverted pendula fined in each case as (3), see [13], and M(t) is the input
modeling to such a level that the user is only required torque applied upon the rotary arm. The generated
to select the desired type of system (classical/) and model will hereafter be referred to as a torque model
the number of pendulum links. The application was of a rotary single inverted pendulum system, to distin-
designed as a central component of the IPMaC block guish it from a voltage model of the system, which will
library and uses an original procedure of mathematical be presented in section 2.3.


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 74
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

J0 + m1 l02 + 14 m1 l12 sin2 θ1 (t) 21 m1 l0 l1 cosθ1 (t)


  
θ̈0 (t)
1 +
2 m1 l0 l1 cosθ1 (t) J1 θ̈1 (t)
δ0 + 41 m1 l12 θ̇1 (t)sin2θ1 (t) − 21 m1 l0 l1 θ̇1 (t)sinθ1 (t)
  
θ̇0 (t)
+ +
− 81 m1 l12 θ̇0 (t)sin2θ1 (t) δ1 θ̇1 (t)
   
0 M (t)
+ = , (2)
− 21 m1 gl1 sinθ1 (t) 0

1
Ji = mi li2 , i = 0, 1. (3)
3

A number of differences were observed between the


generated mathematical model and models in refer-
enced works. Most of these can be attributed to the ini-
tial choice of the coordinate system orientation (right-
or left-handed) and the orientation of the angles (clock-
wise/anticlockwise). In the general procedure imple-
mented by the Derivator, it is assumed that all mo-
tion of the system is bound to a standard right-handed
three-dimensional coordinate system, and that the ro-
tary motion of the pendulum takes place in a vertical
plane that is always perpendicular to both the hori-
zontal arm plane and the arm itself. As a result, the Fig. 3: Open-loop dynamical analysis of the rotary single in-
actual plane the pendulum rotates in is different in ev- verted pendulum (torque model) - simulation setup.
ery instant, which brings additional complexity as well
as high accuracy to the generated mathematical model.
In referenced works, the pendulum was often assumed
to be rotating in a constant plane [8], [9] or the rotary
motion of the arm was neglected altogether [10].

2.2. Open-Loop Dynamical Analysis


of the Torque Simulation Model

The IPMaC is designed as an open library structured


into sublibraries. One of the default components of
the Inverted Pendula Models sublibrary of the IPMaC
is the Rotary Single Inverted Pendulum (RSIP) block,
which implements the mathematical model (2) derived
above. The block is equipped with a dynamic block
mask [2] which enables the user to edit the numeric
values of parameters and initial conditions, to enable or
disable the torque input port and to adjust the number
of the block’s output ports, all with great flexibility
(Fig. 3).
The open-loop dynamical behavior of the rotary sin-
gle inverted pendulum system was verified in a simula-
tion experiment [5] in which the RSIP block was actu-
ated from an initial upright position of the pendulum
by a torque impulse of 0,4 Nm lasting 1 s. The numeric Fig. 4: Rotary inverted pendulum (torque model) - open-loop
parameters of the simulated system were selected to be time behavior of the arm and pendulum angles.
m0 = 0, 5 kg, m1 = 0, 275 kg, l0 = 0, 6 m, l1 = 0, 5 m,
δ0 = 0, 3 kgs−1 , δ1 = 0, 011458 kgm2 s−1 . The time be-
havior of the rotary arm and the freefall and stabiliza-


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 75
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

Fig. 5: Open-loop dynamical analysis of the rotary single inverted pendulum (voltage model) - simulation setup.

tion of the pendulum is depicted in Fig. 4. Reasonable


behavior of the open-loop response of the RSIP simula-
tion model (damped oscillatory transient state, system
reaching the stable equilibrium point with the pendu-
lum pointing downward, visible backward impact of the
pendulum on the rotary arm) means that the simula-
tion model based on generated motion equations can
be considered accurate enough to serve as a reliable
testbed system for the verification of linear and non-
linear control algorithms.

2.3. Open-Loop Dynamical Analysis


of the Voltage Simulation Model

As is the case of all IPS, the practical use of the gen-


erated rotary single inverted pendulum torque model
is limited purely to the simulational environment: we
are unable to manually produce a torque which would
stabilize the pendulum in a chosen position. Therefore,
an electric motor needs to be coupled with the system
to act as a controllable source of the torque which ac-
tuates both the rotary arm and the attached pendulum
[2].
To provide the simulation models of IPS with a Fig. 6: Rotary single inverted pendulum (voltage model) -
open-loop time behavior of the arm and pendulum an-
model of the most frequently used actuating mecha- gles.
nism, library block DC Motor for Inverted Pendula
Systems was included into the Inverted Pendula Mo-
tors sublibrary of the IPMaC. The block implements
2 2
the mathematical model of a brushed direct-current km kg km kg
M (t) = Va (t) − θ̇0 (t), (4)
(DC) motor in two alternative forms depending on the Ra Ra
type of system (classical/rotary). For rotary IPS, the
DC motor is modeled as the following voltage-to-torque where Va (t) is the input voltage applied to the motor,
conversion relationship, derived in [3]: km is the motor torque constant, equal in value to the


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 76
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

back EMF constant, kg is the gear ratio, and Ra is State-feedback control was selected as a principal
the armature resistance. If the DC motor model is ap- control technique because simultaneous control of sev-
pended to the model of the rotary inverted pendulum eral degrees of freedom can only be ensured if they are
system (i.e. (4) is substituted into (2)), a voltage model all taken into consideration at once (Fig. 7). When
of the system is obtained (Fig. 5). In Fig. 6, the re- close to a chosen equilibrium point, detailed methods
sponse of the rotary inverted pendulum voltage model and control techniques designed for linear systems can
to an impulse signal of 1 V lasting 1 s is depicted. The be used to compute a linear state-feedback control law
numeric parameters of the DC motor simulation model which is subsequently applied to the original nonlinear
were borrowed from the motor featured in the series of system in the form of a stabilizing input signal uST (t).
popular laboratory models of inverted pendulum sys-
tems issued by Quanser Academic (SRV02-Series) and
are specified in [14].

3. Stabilization of the Rotary


Single Inverted Pendulum
System in the Unstable
Equilibrium
Fig. 7: Basic block diagram of stabilization control of the rotary
inverted pendulum system.
The principal control objective for the considered non-
linear system was defined as stabilization in the unsta-
ble equilibrium, i.e. in the vertical upright (inverted) 1) Automatic Linear Approximation of the
position of the pendulum [5]. Two possible model sit- Rotary Inverted Pendulum System
uations were considered, in which a varying initial po-
sition of the pendulum calls for a corresponding con- To obtain the linear approximation of the original sys-
trol setup. It is sufficient to design a stabilizing feed- tem, which is a necessary prerequisite for linear state-
back controller if the pendulum is kept in the proxim- feedback control design, the rotary single inverted pen-
ity of the upright position (section 3.1). On the other dulum model first had to be expressed by the standard
hand, the pendulum in the natural hanging position re- state-space description of a nonlinear SIMO system [4]:
quires an additional mechanism which swings it up to
the upright position before it can be stabilized (section ~ẋ(t) = f (~x(t), u(t), t),
3.2), as well as a mechanism to switch between the two ~y (t) = g(~x(t), u(t), t). (5)
controllers. The rotary single inverted pendulum can
therefore be considered as a suitable testbed system for ~ ~
With the state vector defined as ~x(t) = (θ(t), θ̇(t)),
illustrating hybrid control approaches [15].
the differential vector state equation f (.) was con-
structed by isolating the 2nd derivative of the vector
of generalized coordinates from the standard minimal
3.1. Design of a Stabilizing Controller
ODE form (1) of the mathematical model of the sys-
via State-Feedback Techniques tem [12]. The algebraic output equation g(.) denotes
the m state variables which are assumed to be available
Let us now suppose that at the beginning of the exper- through measurement.
iment, the pendulum is held close to the unstable up-
right equilibrium. The designed stabilizing controller The general procedure implemented by the Derivator
should ensure that the following particular problems is based on the assumption that the upright position
will be solved [3], [5], [6]: of the pendulum corresponds to the equilibrium point
of ~x(t) = xST = 0T . If the system input is set to
~u(t) = uST = 0, [2], then the continuous-time state-
• balancing the pendulum around the upright posi- space description of the linear, time-invariant system
tion after an initial deflection (i.e. from nonzero which serves as an approximation defined as (5) in the
initial conditions), upright equilibrium becomes:
• compensation of a time-constrained (impulse) or ~ẋ(t) = A~x(t) + bu(t),
permanent (step) disturbance input signal, ~y (t) = C~x(t) + du(t), (6)
• the arm must be able to track a predefined refer- where A ∈ <4×4 is the state (Jacobian) matrix of
ence trajectory at any time. the linearized system, b ∈ <4×1 is the input matrix,


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 77
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

C ∈ <m×4 is the output matrix and d ∈ <m×1 is the and the following discrete-time state equation matri-
direct feedthrough matrix [16]. The linearized state- ces were obtained:
space model (6) was obtained from the Inverted Pen-  
1 −0, 0007 0, 0098 0
dula Model Linearizator & Discretizer (Fig. 8), a MAT-  0 1, 0027 0, 004 0, 01 
LAB GUI application which generates the continuous- F =   0 −0, 1402 0, 9652 0, 0017  ,

time state-space matrices by expanding (5) into the
0 0, 5456 0, 0624 0, 9935
Taylor series around a given equilibrium point with the  
higher-order terms neglected (Fig. 8). In case the sam- 0, 000006
 −0, 000011 
pling period constant TS is provided, the application g =   0, 0013  .

also returns the matrices of the corresponding discrete-
time state-space representation: −0, 0023

~x(i + 1) = F~x(i) + gu(i), In both cases, the matrices of the output equation
~y (i) = C~x(i) + du(i), (7) are problem-dependent and are specified in later sec-
tions.
where F ∈ <4×4 is the discrete state matrix, g ∈ <4×1
is the discrete input matrix; C and d are the same as
in the continuous system. 2) State-Feedback Control with a State Es-
timator

The Inverted Pendula Control sublibrary of the IPMaC


provides complex software support for state-feedback
methods of controller design for inverted pendulum sys-
tems. It contains several dynamic-masked blocks which
were thoroughly described in [2] in terms of their struc-
ture, functionality and user interface.
The State-Feedback Controller with Feed-forward
Gain (SFCFG) library block evaluates a state-feedback
control law which is calculated either from the
continuous-time state-space description:
u(t) = uR (t) + uf f (t) + du (t) =
− ~k~x(t) + ~kf f w(t) + du (t), (8)
Fig. 8: State-space matrices of the rotary single inverted pen-
dulum via the Inverted Pendula Model Linearizator & or from the discrete-time state-space description:
Discretizer.
u(i) = uR (i) + uf f (i) + du (i) =
Using the numeric parameters from the open-loop − ~kD x(i) + ~kf f D w(i) + du (i), (9)
simulations in section 2.2, the following continuous-
time state equation matrices of the linearized rotary
assuming that controller output is equivalent to the
single inverted pendulum voltage model were gener-
system output: uST (t) = u(t). The state-feedback
ated:
control law is in both cases composed of several func-
tional components [2], [3], [4], [5], [6]. The feed-
 
0 0 1 0
 0 0 0 1  back component uR (t)/uR (i) brings the system’s state
A =   0 −14, 3243 −3, 5435 0, 2434  ,

vector ~x(t)/~x(i) into the origin of the state space,
0 55, 2138 6, 3783 −0, 938 i.e. stabilizes the pendulum in the upright equilib-
  rium and returns the arm to the reference position.
0
The method to determine the feedback gain ~k/~kD ap-
 0 
b =   0, 1288  .
 plied on the full and measurable state vector can be
selected from between the pole placement algorithm
−0, 2318
and the linear quadratic (LQ) optimal control method
[5], [16]. The feedforward component uf f (t)/uf f (i)
The system eigenvalues were computed to be makes the system output ~y (t)/~y (i) track the refer-
(0 6, 404 − 9, 096 − 1, 79), which implies that ence command w(t)/w(i) by applying feedforward gain
the linear approximation of rotary single inverted pen- ~k /~k
ff f f D , which is computed in the form:
dulum in the upper equilibrium is an unstable sys-
tem with first-degree astatism. The system was next ~kf f = −1
, (10)
discretized with the sampling period of TS = 0,01 s c1 (A − b~k)−1 b


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 78
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

Fig. 9: State-feedback control of the rotary single inverted pendulum (voltage model) - general simulation setup.

for the continuous-time control law (8), or in the form: and the estimator gain matrix L has to be selected in
1 such a way that the approximated state vector ~x̂(i)
~kf f D = , (11) quickly converges to the actual system state ~x(i).
c1 (I − (F − g~kD ))−1 g
Figure 10 illustrates the results of applying the state-
for the discrete-time control law (9), given that feedback control law based on both the continuous-time
I = diag(1 1 1 1). The artificial output matrix and discrete-time LQR algorithms on the rotary single
c1 = (1 0 0 0) denotes the arm angle as the only inverted pendulum voltage model. RSIP, SFCFG and
state variable for which it makes sense to consider a LE blocks were employed in the corresponding simula-
nonzero reference command. Finally, the unmeasured tion scheme (Fig. 9). With the initial conditions set
disturbance input du (t)/du (i). is considered in both to θ (0) = θ (0) = 0, the control objective was to keep
0 1
the continuous-time and the discrete-time form of the the pendulum upright all the time while making the
control law. The dynamic block mask of the SFCFG arm rotate for a total of half a circle and stop every
block allows the user to select a preferred control law, quarter-turn to stabilize before returning to its initial
method to compute the feedback gain, and optional position. The weight matrices which occur in both the
constraints. To match a particular control requirement standard continuous-time LQ functional:
(initial pendulum deflection, compensation of distur-
bance signal, tracking a reference position of the arm
or a combination of the three), the block’s appearance Z∞
1
may be adjusted by optional enabling or disabling of JLQR (t) = (~xT (t)Q~x(t) + uTR (t)ruR (t))dt, (14)
2
the reference command input w(t)/w(i) and/or the dis- 0
turbance input du (t)/du (i).
and the discrete-time LQ functional:
Because of measurement limitations, it is often im-
N −1
possible to retrieve the full state-space vector at ev- X
JLQR (i) = ~xT (i)Q~x(i) + uTR (i)ruR (i), (15)
ery time instant [17]. The Luenberger Estimator (LE)
i=0
block implements a discrete-time linear state observer
that provides the controller block with a complete, re- were set to Q = diag(100 20 20 0) and r = 1. It
constructed state vector by evaluating a model of the was next assumed that the arm and pendulum angles
original discrete-time system in the structure: would be directly measurable while the velocities would
~x̂(i + 1) = F~x̂(i) + gu(i) need to be estimated. The state-space matrices of the
output equation therefore became
+ L(~y (i) − C~x̂(i)), (12)    
1 0 0 0 0
which ensures that the time behavior of estimation er- C = , d = ,
0 1 0 0 0
~ ~
ror x̃(i) = ~x(i) − x̂(i) is independent of input/output
signals: while the vector of estimator poles was set to
~x̃(i + 1) = (F − LC)~x̃(i), (13) (0, 1 0, 2 + 0, 1i 0, 2 − 0, 1i 0, 3).


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 79
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

Fig. 11: Rotary single inverted pendulum - evaluation of the


influence of the Q weight matrix on the performance
of the system.
Fig. 10: Rotary single inverted pendulum - simulation results
for LQR control with feedforward gain, compared to
pole-placement. 3) State-Feedback Control with Perma-
nent Disturbance Compensation

It is obvious that the response of the discrete-time Applying state-feedback control with feedforward gain
LQR algorithm closely follows that of the continuous- on a system is insufficient if the steady-state effect of
time algorithm, and there is no steady-state error in a permanent disturbance input needs to be compen-
either case. The simulation results were also compared sated. The structure of the State-Feedback Controller
with those of the continuous-time pole-placement con- with Summator (SFCS) block implements a summator
term v(i) which sums up all past error values. This
troller: for this case, the vector of desired closed-loop
poles was set to (−2 − 3 + i − 3 − i − 10). ensures that the system output will track all changes
in the reference command and the influence of perma-
To enhance the performance of the designed LQR nent disturbances will be eliminated. The evaluated
controller, optimal weight matrices were sought. Af- control law, presented and derived by Modrlak in [17],
ter setting r = 1, the positive real diagonal elements is specified as:
of the Q weight matrix were modified and the influ-
ence of each candidate matrix on the overall perfor- u(i) = uR (i) + uf f (i) + uS (i) =
mance of the system was verified in the discrete-time − ~k1 ~x(i) + ~k2 w(i) + v(i), (16)
LQR simulation setup for the rotary inverted pen-
dulum voltage model. The results of two extreme where w(i) is the reference command and ~k1 , ~k2 are
cases of selecting Q : Q1 = diag(500 0 20 0) and gain matrices which are computed from the matrix
Q2 = diag(10 120 20 0), are depicted in Fig. 11. structure:
For Q1 , the arm quickly reaches the reference position
 
−~k1 −~k2 =
but the pendulum overshoot is quite far from desired.
If Q2 is selected, the pendulum swings are well within    F − I g −1
the limits, however the rise time of the arm is unac- − ~kF −1 − ~
kg , (17)
c1 0
ceptably slow. It has therefore been concluded that
the optimal time behavior of the arm and the pen- assuming that ~k (alternatively ~kD )is a standard feed-
dulum are two conflicting requirements which cannot back gain vector equivalent to the one in Section 3.1.2.
be satisfied simultaneously. Any successful tuning of The layout of the block mask once again allows the user
weight matrices must therefore result in a reasonable to adjust the number of block input ports to match a
compromise between the quick rise time of the base specified control requirement and to compute ~k/~kD us-
and the low overshoot of the pendulum. ing a preferred method and state-space description [2].


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 80
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

• a swing-up controller, which actuates the arm with


an input signal uSW (t) of appropriate direction
and magnitude, making the pendulum swing with
an increasing amplitude and angular speed until
it enters the stabilization zone (balancing region)
around the upright position [7],
• a stabilizing (balancing) controller, which main-
tains the pendulum in the upright position with a
stabilizing control signal uST (t) designed by avail-
able feedback control techniques, such as the state-
feedback control law based on Jacobian lineariza-
tion described in section 3.1, or a variety of non-
linear control design approaches [18],
• a transition (switching) mechanism, which inter-
cepts the pendulum when it nears the upright po-
sition (i.e. crosses the borderline of the balancing
region) and switches to stabilizing control.

Fig. 12: Rotary single inverted pendulum - simulation results


for LQR control with a summator.

The control law (16) was verified for the rotary single
inverted pendulum voltage model and the weight ma-
trices of the standard discrete-time LQ functional (15) Fig. 13: Block diagram of swing-up and stabilizing control of
were set to Q = diag(500 0 20 0), r = 1. The ob- IPS.
tained results were compared to those of a conventional
discrete-time LQR controller using the same values of
weight matrices as in Section 3.1.2. A constant dis- 1) Energy-based Methods for Swing-up
turbance input (5 V for the first controller, 1 V for Control
the second) was present in both simulations. To com-
pensate for measurement limitations, the LE block was One of the earliest and most effective approaches to
included in both schemes, with the estimator poles set pendulum swing-up is the method based on energy con-
to the same values as before. As it can be seen in Fig. siderations, proposed and explained by Aström, Furuta
12, the conventional LQR controller fails to track the and Iwase in [19], [20]. The goal is to bring the total
reference trajectory without producing steady-state er- mechanical energy W of the pendulum to zero, which
ror, but the permanent disturbances are successfully corresponds to the upright position. The first deriva-
compensated by a LQR algorithm with a summator tive of W for the uncontrolled pendulum (2) in the
included in the control structure. simplified form is given as:
d 1 2 2 1
Ẇ = ( ml θ̇1 (t) + m1 gl1 (cosθ1 (t) − 1)) =
dt 2 2
1
3.2. Design of a Control Strategy = J1 θ̇1 (t)θ̈1 (t) − m1 gl1 θ̇1 (t)sinθ(t) =
2
for Swing-up and Stabilization of 1
= − m1 l0 l1 θ̈0 (t)θ̇1 (t)cosθ(t). (18)
the System 2

Whether the expression in (18) is greater or


If the initial position of the pendulum is equivalent to lower than zero depends directly on the sign of
the natural hanging position, then the additional con- θ̇ (t)(cosθ (t)). The basic energy-based control law
1 1
trol problem of swinging it upwards leads to a hybrid (cosine value controller) therefore becomes:
control setup which consists of three basic components,
schematically depicted in the block diagram in Fig. 13: uSW (t) = −um sgn(θ̇1 (t)(cosθ1 (t))). (19)


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 81
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

This control law can be simplified into a law which


will be referred to as a zero speed controller [21]:

uSW (t) = um sgn(θ̇1 (t)), (20)

or modified into an absolute value control law:

uSW (t) = um sgn(θ̇1 (t) |θ1 (t)|). (21)

The control laws (19), (20), (21), were encapsulated


into the structure of Swing-up Controller block which
is part of the Inverted Pendula Swing-up sublibrary
and allows the user to select a swing-up method, the
constraints of the balancing region, and the input mag-
nitude um .
The following swing-up / stabilizing control strat-
egy was proposed and verified for the both the torque
model and voltage model of the system. As the con-
trol objective, the freely hanging pendulum had to
be brought into the upright equilibrium and the arm
needed to be stabilized at the origin. Initial conditions
of the system were therefore set to θ0 (0) = −1 rad
(−57, 3 degrees) and θ1 (0) = −π rad (−180 degrees).
All three swing-up control laws were tried out and for Fig. 14: Swing-up and stabilization of the rotary single inverted
each control law, the input magnitude was tuned to pendulum torque model - comparison of methods.
the highest value which still allows successful swing-
up with no oscillations or destabilization. Once the
pendulum was approaching the the upright position,
control was switched to a balancing controller. State-
feedback controller based on discrete-time state-space
description was selected and the weight matrices of
the discrete-time LQ functional (15), were specified as
Q = diag(100 20 20 0), r = 1 for each simulation
experiment. Switching between the controllers took
place when the pendulum was 0,6 rad (34,4 degrees)
away from the upright position.
Figure 14 depicts the comparison of the swing-up
control laws (19), (20), (21) applied on the torque
model of the system. It turned out that although all
control laws met the control objective, the rotary in-
verted pendulum performed at its best for the cosine-
value controller - the system’s performance was dimin-
ished for other controllers, which is caused by long in-
tervals during which energy is taken from the pendu-
lum.
When tuning the input magnitude um , the time
needed to swing the pendulum to the upright posi-
tion was discovered to be indirectly proportional to
um . However, feasible input values could only be se-
Fig. 15: Swing-up and stabilization of the rotary single inverted
lected from a bounded interval. An unlimited increase pendulum voltage model, comparison of the effect of
in magnitude leads to the increase of the pendulum an- varying input magnitude.
gular velocity, and a too low magnitude may either be
entirely unable to bring the pendulum upright, or it
needs numerous swings to do so, which results in a dis- to stabilize the system, proving that the balancing con-
placement of the rotary arm away from the equilibrium troller is only effective if the full state of the system is
point. In both cases, the control mechanism would fail close to the equilibrium point in the moment of inter-


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 82
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

ception. An illustrative experiment which compares The IPMaC block library enhances the capabilities of
the effect of a varying um on the rotary single inverted the MATLAB/Simulink program environment by pro-
pendulum voltage model, is depicted in Fig. 15. viding effective means for analysis and control of an im-
portant class of nonlinear mechanical systems. More-
over, the readily available collection of mathematical
and simulation models of inverted pendulum systems
4. Conclusion can be viewed as a testbed model basis for explor-
ing the properties of underactuated nonlinear systems,
mechatronic systems, hybrid systems and other con-
The purpose of this paper was to present a compre- cepts. As a meaningful contribution to modeling and
hensive approach to the problem of modeling and con- control education, the library has been included into
trol of the rotary single inverted pendulum system. A the research and teaching activities of the Center of
custom-designed Simulink block library developed by Modern Control Techniques and Industrial Informatics
the authors of the paper, Inverted Pendula Modeling (http://kyb.fei.tuke.sk/laben/) at the Faculty of Elec-
and Control (IPMaC), was used as a software frame- trical Engineering and Informatics, Technical Univer-
work for all covered issues which included mathemati- sity of Kosice.
cal model derivation, open-loop analysis and linear ap-
proximation of the system, as well as followed by design
and verification of stabilizing state-feedback control al-
gorithms as well as energy-based swing-up control laws. Acknowledgment
The IPMaC block library provided suitable function
This contribution is the result of the Vega project im-
blocks to support every step of the process of analysis
plementation - Dynamic Hybrid Architectures of the
and control design (such as a pre-prepared simulation
Multiagent Network Control Systems (No. 1/0286/11),
model of the rotary single inverted pendulum system
supported by the Scientific Grant Agency of Slovak
or a detailed state-feedback controller block), together
Republic - 70 %, and of the KEGA project im-
with several original applications with graphical user
plementation - CyberLabTrainSystem - Demonstra-
interface. One such application was used to derive the
tor and Trainer of Information-Control Systems (No.
mathematical model for the selected inverted pendu-
021TUKE-4/2012) - 30 %.
lum system in the form of symbolic equations of mo-
tion; the other performed the automatic linear approx-
imation of the system in a chosen equilibrium point. In
these applications, great practical potential of symbolic References
mathematical software was demonstrated.
With the aid of developed program tools, the pa- [1] BAKER, G. J. and J. A. BLACKBURN. The
per has presented a set of coherent results together Pendulum: a Case Study in Physics. New
with thorough evaluations. The validity of the nonlin- York: Oxford University Press, 2005. ISBN 978-
ear model generated by the above application was ver- 0199557684.
ified by comparing the obtained results to those listed
[2] JADLOVSKA, S. and J. SARNOVSKY. An Ex-
in the resources, and by evaluating the open-loop re-
tended Simulink Library for Modeling and Con-
sponses of the simulation model. The outcome of both
trol of Inverted Pendula Systems. In: 19th Annual
approaches was highly acceptable: all deviations were
Conference Proceedings of the International Sci-
justified by the laws of mechanics and it was shown
entific Conference - Technical Computing Prague
that the dynamic behavior of both the torque and the
2011. Prague: 2011. ISBN 978-80-7080-794-1.
voltage model is in agreement with the empirically ob-
served facts on pendulum movement. The ability to [3] JADLOVSKA, S. Modeling and Optimal Con-
control the rotary inverted pendulum system with re- trol of Inverted Pendula Systems. Kosice, 2011.
spect to the principal control objective (stabilization in pp. 93. Diploma Thesis. Supervisor: prof. Ing. Jan
the inverted position) and a variety of secondary issues Sarnovsky, CSc. Faculty of Electrical Engineering
was demonstrated for all implemented state-feedback a Informatics, Technical University of Kosice.
control techniques which included pole-placement and
the LQR optimal control method; the simulation re- [4] JADLOVSKA, S. and A. JADLOVSKA. Inverted
sults also justified the use of the techniques based on a Pendula Simulation and Modeling-a Generalized
linearized model to control nonlinear systems. To deal Approach. In: Proceedings of the 9th Interna-
with the problem of swinging the pendulum upwards tional Scientific Technical Conference on Process
from the natural hanging position, several heuristic Control - RIP 2010. Kouty nad Desnou: Tribun
swing-up methods based on energy considerations were EU, 2010, pp. C134a-1–11. ISBN 978-80-7399-951-
proposed and compared from multiple viewpoints. 3.


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 83
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

[5] JADLOVSKA, S. and J. SARNOVSKY. A [16] SARNOVSKY, J., A. JADLOVSKA and P.


Complex Overview of the Rotary Single KICA. Optimal and Adaptive Systems Theory.
Inverted Pendulum System. In: Proceed- Kosice: ELFA s r.o., 2005. ISBN 80-8086-020-3.
ings of the 9th International Conference -
ELEKTRO 2012. Rajecke Teplice: IEEE, [17] MODRLAK, O. Automatic Control Theory, vol.
2012, pp. 305–310. ISBN 978-1-4673-1178-6. 1 - Basic State-Space Analysis and Synthesis
DOI:10.1109/ELEKTRO.2012.6225609. (Study Materials). Liberec: Technical University
of Liberec, 2002.
[6] JADLOVSKA, S. and J. SARNOVSKY. Classical
Double Inverted Pendulum - a Complex Overview [18] KHALIL, H.K. Nonlinear Systems, 3nd ed. New
of a System. In: Proceedings of the IEEE 10th York: Macmillan, 2001. ISBN 978-0130673893.
Jubilee International Symposium on Applied Ma-
chine Intelligence and Informatics (SAMI 2012). [19] ASTROM, K.J. and K. Furuta. Swinging up a
Helany: IEEE, 2012, pp. 103–108. ISBN 978-1- pendulum by energy control. In: Proceeding of the
4577-0195-5. 13th IFAC World Congress. San Francisco: Ox-
ford, 1996, pp. 1–6. ISBN 9780080429243.
[7] FURUTA, K., M. YAMAKITA and S.
KOBAYASHI. Swing Up Control of Inverted [20] FURUTA, K. and M. IWASE. Swing-up time
Pendulum. In: Proceeding of the International analysis of pendulum. Bulletin of the Polish
Conference on Industrial Electronics, Control Acknowledgement of Sciences-Technical Sciences.
and Instrumentation (IECON’91). Kobe: IEEE, 2004, vol. 52, no. 3, pp. 153–163. ISSN 0239-7528.
1991, vol. 3, pp. 2193–2198. ISBN 0-87942-688-8.
DOI: 10.1109/IECON.1991.239008. [21] BUGEJA, M. Non-linear Swing-up and Stabiliz-
ing Control of an Inverted Pendulum System.
[8] ERNEST, P. and P. HORACEK. Algorithms for In: The IEEE Region 8 EUROCON 2003 Com-
Control of a Rotating Pendulum. In: Proceed- puter as a tool (EUROCON’03). Ljubljana: IEEE,
ing of the 19th IEEE Mediterranean Conference 2003, vol. 2, pp. 437–441. ISBN 0-7803-7763-X.
on Control and Automation (MED ’11). Athens: DOI: 10.1109/EURCON.2003.1248235.
National Technical University, 2011. ISBN 960-
87706-0-2.
[9] Kats, C. J. A. Nonlinear control of a Fu- About Authors
ruta Rotary Inverted Pendulum. DCT Report,
no. 2004:69. Slavka JADLOVSKA was born on June 25th, 1988
[10] REX Controls s. r. o.: Rotary Inverted Pendulum in Kosice, Slovak Republic. In 2011, she graduated
FPM-210/211. User Manual, 2010. (M.Sc.) with distinction at the Department of Cy-
bernetics and Artificial Intelligence of the Faculty of
[11] Symbolic Math Toolbox User’s Electrical Engineering and Informatics at Technical
Guide [online]. 2013. Available at: University in Kosice. She is currently pursuing her
http://www.mathworks.com/help/pdf doc/ Ph.D. degree at the same department. Her disserta-
symbolic/symbolic tb.pdf. tion research is focused on hybrid methods of control
[12] BOGDANOV, A. Optimal Control of a Double In- for nonlinear dynamic systems. In addition, she
verted Pendulum on the Cart, Technical Report has been researching issues related with modeling
CSE-04-006, OGI School of Science and Engineer- of underactuated mechatronic systems, optimal and
ing, OHSU, 2004. predictive control design for hybrid systems, and
the advanced application of MATLAB toolboxes in
[13] HAJKO, V. and J. DANIEL-SZABO. Funda- modeling and control. So far, she has authored several
mentals of Physics. Bratislava: VEDA - Slovak scientific articles published in international conference
Academy of Sciences, 1980. proceedings and in a SCOPUS-cited journal.
[14] Quanser Academic, Rotary Motion Servo Plant:
Jan SARNOVSKY was born on March 28th,
SRV02, User Manual, no. 700, Rev. 2.3.
1945. He obtained his M.Sc. degree in Technical
[15] JADLOVSKA, S. and J. SARNOVSKY. Swing- Cybernetics on the Faculty of Electrical Engineering
up and Stabilizing Control of Classical and Rotary of the Slovak Technical University Bratislava in 1968.
Inverted Pendulum Systems. In: Proceeding of the He defended his dissertation thesis in the field of
12th Scientific Conference of Young Researchers Automation and Control in 1980 at the same Uni-
(SCYR 2012). Herlany: The Technical University versity; his thesis title was ”Control of Large Scale
of Kosice 2012, pp. 38–41, ISBN 978-80-553-0943- Systems Using Hybrid Computer Systems”. Since
9. 1969 he has been working at Faculty of Electrical


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 84
POWER ENGINEERING AND ELECTRICAL ENGINEERING VOLUME: 11 | NUMBER: 2 | 2013 | SPECIAL ISSUE

Engineering and Informatics Technical University scale systems and multiagent systems in control of
in Kosice as a Associate Assistant, since 1980 as the large scale systems. He has authored a number of
Associate Professor and since 1993 as a Professor. scientific articles and contributions published in the
Since 1985 he has been working as a tutor at the journals and international conference proceedings. He
Department of Cybernetics and Artificial Intelli- is also an author of several monographs.
gence. His scientific research focuses on the large


c 2013 ADVANCES IN ELECTRICAL AND ELECTRONIC ENGINEERING 85

View publication stats

You might also like