Professional Documents
Culture Documents
A Thesis Presented
By
Yizhu Li
to
Master of Science
in the field of
Mechanical Engineering
Northeastern University
Boston, Massachusetts
April 2018
I
ABSTRACT
This research undertakes the design and development of a series of control strategies,
including Proportional-Integral-Derivative (PID), Linear-Quadratic-Regulator (LQR),
robust and adaptive control approaches, for an inverted pendulum appended to a
single-mass and inverted pendulum added to a double-mass system. The control
objective is to keep the pendulum in the upright position while the base mass moves
to a desired position. For this, the governing coupled equations of motion are first
derived using Newtonian technique. Then PID controllers are developed for each
system using and optimally tuned to arrive at the best gains for best control
performance. Moreover, LQR controllers are designed for these systems and
compared with PID controllers. Then, a hierarchical sliding mode control approach is
proposed as the third controller. The two coupled systems, i.e., inverted pendulum
appended to a single-mass and inverted pendulum added to a double-mass, can be
divided into two subsystems and three subsystems respectively, and the sliding
surface for each subsystem is then designed. According to the hierarchical structure,
the final control law is derived from a Lyapunov-based approach and stability
viewpoint. Lastly, an adaptive control strategy is presented to improve the
performance of the systems. Extensive simulation and experimental results are
provided to justify the comparative advantage of robust control and adaptive control
methods over traditional linear controllers such as PID and LQR techniques.
II
TABLE OF CONTENTS
1. INTRODUCTION...................................................................................................1
2. OVERVIWE............................................................................................................7
3. DYNAMIC MOLDING AND CONTROL OF INVERTED PENDULUM
SINGLE-MASS SYSTEM......................................................................................8
3.1. Dynamic Modeling of Inverted Pendulum Single-Mass System.....................9
3.2. Controllers Design..........................................................................................16
3.2.1. PID Control………….........................................................................16
3.2.2. Optimal Control……….......................................................................17
3.2.3. Robust Control……………................................................................22
3.2.4. Adaptive Control………….................................................................28
3.3. Experiment.....................................................................................................30
4. DYNAMIC MOLDING AND CONTROL OF INVERTED PENDULUM
DOUBLE-MASS SYSTEM..................................................................................37
4.1. Dynamic Modeling of Inverted Pendulum Double-Mass System..................38
4.2. Controllers Design..........................................................................................44
4.2.1. PID Control….……............................................................................44
4.2.2. Optimal Control…………...................................................................45
4.2.3. Robust Control…………....................................................................48
4.2.4. Adaptive Control………….................................................................55
4.3. Summary........................................................................................................56
5. DISCUSSIONS AND RESULTS.........................................................................57
6. FUTRUE WORK..................................................................................................59
7. REFERENCES......................................................................................................60
III
LIST OF TABLES
LIST OF FIGURES
Figure 3.3 Linearized External and Inertial Forces and Moments Affecting the Cart
and Pendulum.............................................................................................10
Figure 3.4 Linearized External Forces and Moments Affecting the Pendulum...........11
Figure 3.5 Simulink Model of Inverted Pendulum Single-Mass System ....................14
Figure 3.6 PID Control of Inverted Pendulum Single-Mass System...........................17
Figure 3.7 MATLAB/PID Tuner to Find the Value of 𝐾𝑝 , 𝐾𝑖 and 𝐾𝑑 for Inverted
Chapter 1 Introduction
Inverted pendulum is an under-actuated and nonlinear system with lesser control
inputs than the degrees of freedom. Designing controllers for such a system resembles
the control of many applications such as robots, Segway, and space rockets [1].
There are two equilibrium points in a pendulum system. The first one is the gantry
system when the pendulum is vertically down shown in Figure 1.1. It is stable point,
because the system will return to this point automatically without outside intervention.
The second one is the inverted pendulum system when the pendulum is vertically up
shown in Figure 1.2. It is an unstable point, because even small perturbations will
cause its downfall. Studying stabilization of an inverted pendulum system seems more
meaningful, and an understanding of how to control such a system will allow us to
easily solve the other related control problems [2]. In this research, several controllers
have been designed not only for the inverted pendulum single-mass system, but also
for the inverted pendulum double-mass system (shown in Figure 1.3), which is more
difficult because it adds one more degree of freedom. The aim of this case study is to
keep the pendulum in the upright position while the base mass moving to a desired
position.
In general, the control problem consists of obtaining dynamic models of systems, and
designing controllers based on these models to achieve the desired system response
and performance. In this research the first step is giving dynamic molding and then
several controllers are designed for each system (inverted pendulum single-mass
system and inverted pendulum double-mass system).
controllers, it can still give us a satisfactory result. For instance, an adaptive PID
controller was designed by Vikram Chopra, Sunil K. Singla and Lillie Dewan for an
X-Y inverted pendulum in 2015[1]. Li Ming used self-adaptive fuzzy PID digital
control method for linear inverted pendulum in 2012[3]. Lal Bahadur Prasad, Barjeev
Tyagi, and Hari Om Gupta developed a PID & LQR controller for nonlinear Inverted
Pendulum dynamical system with disturbance input in 2011[4]. S. Omatu, T. Fujinaka,
and M. Yoshioka presented a Neuro-PID controller for inverted single and double
pendulums in 2000[5]. T. Fujinaka, Y. Kishida, and M. Yoshioka studied the
stabilization of double inverted pendulum with self-tuning neuro-PID in 2000[6]. An
interval type-2 fuzzy PID controller was proposed by Mohammad El-Bardini and
Ahmad M. El-Nagar for controlling an inverted pendulum on a cart system with an
uncertain model in 2014[7]. In this research, PID control theory has been applied to
hierarchical sliding mode and adaptive control.
Optimal control has been a field of study since its formulation in the mid-20th century,
and has been much aided by the increase of computing power and development of
efficient algorithms [8]. Optimal control deals with the problem of finding a control
law for a given system such that a certain optimality criterion is achieved [9]. The
optimal control includes several cases, such linear quadratic regulator (LQR),
state-dependent Riccati equation, optimal neural network control, and so on.
Alexander Bogdanov used them for a double inverted pendulum on a cart in 2004[10].
Oskar Stattin developed optimal control for Inverted Pendulum in 2015[8]. Khaled
Gamal Eltohamy and Chen-Yuan Kuo designed a single-input feedback controller for
a triple link inverted pendulum using a nonlinear optimization technique in 1998[11].
Viroch Sukontanakarn and Manukid Parnichkun proposed a real-time optimal
controller for rotary inverted pendulum in 2009[12]. In this research LQR controller
has been designed for both inverted pendulum single-mass system and inverted
pendulum double-mass system.
uncertainty [13]. Since the model used in the design always differs from the actual
plant, and to make sure the controller designed using a model could work
satisfactorily with the actual plant, robust control theory has been developed since
around 1980. A special case of it is sliding mode control (SMC). It is a variable
structure control method, which can switch from one continuous structure to another
based on the current position in the state space [14]. Sliding mode control can work
effectively for single-input and single-output (SISO) system, but it should be
improved to control single-input and multi-output (SIMO) under-actuated system. For
example, Mun-Soo Park and Dongkyoung Chwa used coupled sliding-mode control
method to control inverted-pendulum systems in 2009[15]. Or we can use hierarchical
sliding mode control, which is proposed for a class of SIMO under-actuated systems
[16]. Dianwei Qian, Jianqiang Yi, Dongbin Zhao, and Yinxing Hao developed a
hierarchical sliding mode controller for series double inverted pendulums system in
2006[17]. Dianwei Qian, Jianqiang Yi, and Dongbin Zhao designed hierarchical
sliding mode controller for SIMO under-actuated systems [16]. This research
improved their theory for inverted pendulum single-mass system and inverted
pendulum double-mass system to make to the controllers work better.
Adaptive control has its roots in the mid-fifties [18]. Adaptive control is the control
method used by a controller which must adapt to a controlled system with parameters
which vary, or are initially uncertain [19]. Designing an adaptive controller always
follows two steps. At first, we must use classical control theory to design a controller
that meets the specifications by assuming the gains were known. Secondly, identified
the unknown gains and design function of time instead of unknown gains. Designing
an adaptive controller should be careful, because a bad function of gain would
become disturbance to the system and make performance of system even worse.
However, many people succeeded in developing an adaptive controller for inverted
pendulum. For example, T. C. Kuo, Y. J. Huang and B. W. Hong designed an adaptive
PID with sliding mode control for the rotary inverted pendulum system in 2009[20].
Ming Li developed a self-adaptive fuzzy PID digital control method for linear
5
for linear systems [29]. The direct method is not restricted to local motion, and
determines the stability properties of a nonlinear system by constructing a scalar
''energy-like'' function for the system and examining the function's time variation [27].
When designing a controller, Lyapunov theorem is often used to derive the control
law to make sure the system can be guaranteed to be asymptotically stable. For
instance, Carlos Aguilar Ibañez, O. Gutiérrez Frias, and M. Suárez Castañón
investigated a Lyapunov-based controller for the inverted pendulum cart system in
2005[30]. M. J. Anderson and W. J. Grantham used Lyapunov optimal feedback
control method for a nonlinear inverted pendulum in 1989[31]. In this research, the
final robust control law was derived from a Lyapunov-based approach and stability
viewpoint.
7
Chapter 2 Overview
Stabilization of an inverted pendulum system is a complex and nonlinear problem. It
has been extensively studied by numerous researchers [2]. Most researchers just
studied one control strategy for an inverted pendulum appended to a single-mass. This
research undertakes the design and development of a series of control strategies for an
inverted pendulum appended to a single-mass and an inverted pendulum added to a
double-mass system.
The fourth chapter studies the stabilization of the inverted pendulum double-mass
system, which consists of two carts moving along a rail: (i) a passive cart with a
free-swinging pendulum attached through a spring and a damper to (ii) an active cart
with a DC motor and gearbox. PID controller, LQR controller, robust controller and
adaptive controller have been designed for this system to keep the inverted pendulum
added to a double-mass system always up while the base mass moving to a desired
position.
In this research, several control architectures are proposed for operation of inverted
pendulum mechanical systems. Extensive simulation and experimental results are
provided to justify that the comparative advantage of robust control and adaptive
control methods over PID and LQR techniques.
8
Chapter 3
Dynamic Modeling and Control of Inverted Pendulum
Single-Mass System
In this chapter, a series of controllers were developed and implemented for the
inverted pendulum single-mass system as shown in Figure 3.1, which consists of a
cart moving along a rail, a drive mechanism (coreless DC motor, planetary gearbox,
power amplifier), and a pendulum which is free to rotate about a pivot attached to the
cart. The system includes two sensors for measuring the pendulum angle and the cart
position. All the parameter values required to perform controller design and system
simulations are provided in Appendix A.1. Designing controllers for such a system
resembles the control of many applications, such as robots and space rockets [1].
Section 3.1 shows how to derive the complete system dynamics by determining the
equations of motion for the electrical, mechanical and combined systems. Following
this, in Section 3.2, PID, LQR, robust, and adaptive controllers have been designed to
bring the experimental gantry system to the desired position while simultaneously
minimizing the vibration of the pendulum. To this end, the closed-loop system would
be subjected to performance requirement which would keep the pendulum always up
while the base mass moving a desired distance (0.05m). In Section 3.3, the controllers
designed offline would be implemented in the real-time control system, and their
performance will be evaluated for comparison to the anticipated/simulated results.
9
Figure 3.2: DC Motor Schematic Diagram Relating Applied Voltage to Position of the
Motor Pinion Gear, 𝜃𝑝 [32]
i. DC Motor Current
By using Kirchhoff's Voltage Law on the circuit diagram in Figure 3.2, we could get
d
𝑅𝑎 𝑖𝑎 (𝑡) + 𝐿𝑎 (dt 𝑖𝑎 (𝑡)) + 𝑣𝐵𝐸𝑀𝐹 (𝑡) = 𝑣𝐴 (𝑡) (3.1)
where N is the gear ratio of the planetary gearbox, 𝐾𝐵 is the motor speed coefficient,
where 𝐵𝑚 represents the damping acting on the rotor, 𝜏𝑚 and 𝜏𝐿 are the torques on
the motor provided by the magnetic field and the external load applied via the
interactions of the rack and motor pinion gear respectively, and can be identified as
𝜏𝑚 = 𝐾𝑡 𝑖𝑎 (𝑡) (3.4a)
𝑓𝑐 𝑟𝑔
𝜏𝐿 = − (3.4b)
𝑁
where 𝐾𝑡 is the motor torque constant, 𝑓𝑐 is the reaction force applied to the motor
pinion gear by the rack, and 𝑟𝑔 is the radius of the motor pinion gear.
Figure 3.3: Linearized External and Inertial Forces and Moments Affecting the Cart
11
Figure 3.4: Linearized External Forces and Moments Affecting the Pendulum
By considering the velocity of the center of gravity of the pendulum with respect to an
inertial reference frame, we could have
𝐿𝑃 𝐿𝑃
𝒗 ̂ ∗ (−
⃗ 𝑝 = 𝑥̇ 𝑐 𝐢̂ + 𝜃̇𝑝 𝐤 sin(𝜃𝑝 ) 𝐢̂ + cos(𝜃𝒑 ) 𝐣̂)
2 2
𝐿𝑃 𝐿
= (𝑥̇ 𝑐 − 𝜃̇𝑝 cos(𝜃𝑝 )) 𝐢̂ − 2𝑃 𝜃̇𝑝 sin(𝜃𝑝 ) 𝐣̂ (3.5)
2
(3.6)
Considering the sum of the forces in the x-direction as,
∑ 𝐹𝑥 = 𝑀𝑐 𝑥̈ 𝑐 + 𝑀𝑝 𝑎𝑝𝑥 (3.7)
The free body diagram given in Figure 3.3 can be expanded as,
𝐿𝑃 𝐿
(𝑀𝑐 + 𝑀𝑝 ) 𝑥̈ 𝑐 − 𝑀𝑝 𝜃̈𝑝 cos(𝜃𝑝 ) + 𝐵𝑐 𝑥̇ 𝑐 + 𝑀𝑝 2𝑃 𝜃̇𝑝2 sin(𝜃𝑝 ) + 𝑓𝑘 = 𝑓𝑐 (3.8)
2
where 𝑓𝑘 = 𝑏 sign(𝑥̇ 𝑐 )
Here, 𝑀𝑐 and 𝑀𝑝 represent the masses of the cart and pendulum respectively, 𝐵𝑐 is
the damping coefficient observed by the cart, 𝐿𝑃 is the full length of the pendulum,
𝑥𝑐 is the position of the cart in the x direction, 𝜃𝑝 is the counterclockwise angle of
the pendulum with respect to the initial vertical line, 𝑓𝑘 respects coulomb observed by
the cart, and b is coulomb friction coefficient.
⃗ 𝐶𝐺 × 𝐯⃗̇ 𝐩
∑ 𝜏𝑝 = 𝐼𝑝 𝜃̈𝑝 + 𝑚𝒓 (3.9)
1 𝐿
where 𝐼𝑝 = 12 𝑀𝑝 𝐿2𝑝 + 𝑀𝑝 ( 2𝑃 )2 (3.10)
𝐿𝑃 𝐿𝑃
𝐫CG = − 𝑠𝑖𝑛(𝜃𝑝 ) 𝐢̂ + 𝑐𝑜𝑠(𝜃𝑝 ) 𝐣̂ (3.11)
2 2
𝐯⃗̇ 𝑝 = 𝑥̈ 𝑐 𝐢̂ (3.12)
Here, 𝐼𝑝 respects the pendulum inertia about point P, 𝐫CG is the position of the
pendulum center of gravity with respect to point P, and 𝐯⃗̇ p is the velocity of the point
P. Submitting Eqs. (3.10), (3.11), (3.12) into Eq. (3.9), we can get
1 𝐿𝑃 2 𝐿 𝐿
̂ + 𝑀𝑝 ( 𝑃 𝑠𝑖𝑛(𝜃𝑝 ) 𝐢̂ − 𝑃 cos(𝜃𝑝 ) 𝐣̂) × 𝑥̈ 𝑐 𝐢̂
∑ 𝜏𝑝 = [ 𝑀𝑝 𝐿2𝑝 + 𝑀𝑝 ( ) ] 𝜃̈𝑝 𝐤
12 2 2 2
1 𝐿
̂
= [3 𝑀𝑝 𝐿2𝑝 𝜃̈𝑝 + 𝑀𝑝 2𝑃 𝑥̈ 𝑐 cos(𝜃𝑝 )] 𝐤 (3.13)
Considering this equation and the free body diagram given in Figure 3.4, the last
equation of motion can be written as,
1 𝐿𝑃 𝐿𝑃
𝑀𝑝 𝐿2𝑝 𝜃̈𝑝 − 𝑀𝑝 𝑥̈ 𝑐 + 𝐵𝑝 𝜃̇𝑝 − 𝑀𝑝 𝑔 sin(𝜃𝑝 ) = 0 (3.14)
3 2 2
sin(𝜃𝑝 ) = 𝜃𝑝 (3.15a)
cos(𝜃𝑝 ) = 1 (3.15b)
Submitting Eqs. (3.15a) and (3.15b) into Eqs. (3.8) and (3.14), and removed the
higher order terms, the equations can be expressed as
𝐿𝑃
(𝑀𝑐 + 𝑀𝑝 ) 𝑥̈ 𝑐 − 𝑀𝑝 𝜃̈𝑝 + 𝐵𝑐 𝑥̇ 𝑐 + 𝑏 sign(𝑥̇ 𝑐 ) = 𝑓𝑐 (3.16)
2
1 𝐿𝑃 𝐿𝑃
𝑀𝑝 𝐿2𝑝 𝜃̈𝑝 − 𝑀𝑝 𝑥̈ 𝑐 + 𝐵𝑝 𝜃̇𝑝 − 𝑀𝑝 𝑔 𝜃𝑝 = 0 (3.17)
3 2 2
Submitting Eqs. (3.4a) and (3.4b) into Eq. (3.3). we could get
𝑟𝑔
𝐽𝑚 𝑁𝜃̈𝑝 + 𝐵𝑚 𝑁𝜃̇𝑝 = 𝐾𝑡 𝑖𝑎 − 𝑓𝑐 (3.18a)
𝑁
𝑁2 𝑁 2
𝑁
𝑓𝑐 = −𝐽𝑚 𝜃̈𝑝 − 𝐵𝑚 𝑟 𝜃̇𝑝 + 𝑟 𝐾𝑡 𝑖𝑎 (3.18b)
𝑟𝑔 𝑔 𝑔
By substituting Eq. (3.18b) into Eq. (3.16), and realizing that the angle of the motor
𝑥𝑐
pinion gear may be written as 𝜃𝑝 = , Eq. (3.16) may be rewritten as,
𝑟𝑔
𝑁2 𝑁2 𝐿𝑃 𝑁
(𝑀𝐶 + 𝑀𝑝 + 𝐽𝑚 ) 𝑥̈ 𝑐 + (𝐵𝑐 + 𝐵𝑚 ) 𝑥̇ 𝑐 − 𝑀𝑝 𝜃̈𝑝 − 𝑟 𝐾𝑡 𝑖𝑎 (𝑡) = 0 (3.19)
𝑟𝑔 𝑟𝑔 2 𝑔
𝑁2 𝑁2 𝐿𝑃 𝑁
(𝑀𝐶 + 𝑀𝑝 + 𝐽𝑚 ) 𝑥̈ 𝑐 + (𝐵𝑐 + 𝐵𝑚 ) 𝑥̇ 𝑐 + 𝑏 sign(𝑥̇ 𝑐 ) − 𝑀𝑝 𝜃̈𝑝 − 𝑟 𝐾𝑡 𝑖𝑎 (𝑡) = 0
𝑟𝑔 𝑟𝑔 2 𝑔
(3.21)
1 𝐿 𝐿
𝑀𝑝 𝐿2𝑝 𝜃̈𝑝 − 𝑀𝑝 2𝑃 𝑥̈ 𝑐 + 𝐵𝑝 𝜃̇𝑝 − 𝑀𝑝 𝑔 2𝑃 𝜃𝑝 = 0 (3.22)
3
friction and apply the value of each symbol, the results can be shown as below (see
Appendix A.2. for the process of calculating):
𝑥𝑐 ’s open-loop transfer function is:
3.36 ∗ 1018 ∗ (2.9 ∗ 109 ∙ s 2 + 8 ∗ 108 ∙ s − 1.267 ∗ 1011 )
𝐗c =
s(4.5 ∗ 1023 ∙ s 4 + 6.52 ∗ 1027 ∙ s 3 + 1.11 ∗ 1029 ∙ s 2 − 2.97 ∗ 1029 ∙ s − 4.76 ∗ 1030 )
(3.23a)
𝜃𝑝 's open-loop transfer function is:
4.34 ∗ 1028 ∙ s
𝛉𝑝 =
4.5 ∗ 1023 ∙ s 4 + 6.52 ∗ 1027 ∙ s 3 + 1.11 ∗ 1029 ∙ s 2 − 2.97 ∗ 1029 ∙ s − 4.76 ∗ 1030
(3.23b)
4. Stability
The stability of a system can be determined from its poles [33]:
(1) Stable systems have poles only in the left-hand plane.
(2) Unstable systems have at least one pole in the right-hand plane and/or poles of
multiplicity greater than 1 on the imaginary axis.
(3) Marginally stable systems have one pole on the imaginary axis and the other poles
in the left-hand plane.
For this system based on 𝑥𝑐 ’s and 𝜃𝑝 's transfer function, the poles and zeros can be
found simply by using Maple (see Appendix A.2. for the process of calculating):
𝑥𝑐 :
Zeros: 6.471542452, -6.747184114
Poles: 0., 6.604454017, -6.418833021, -17.25594561, -14437.72415
𝜃𝑝 :
Zeros: 0
Poles: 6.604454017, -6.418833021, -17.25594561, -14437.72415
It shows that there is one pole at right-hand plane for 𝑥𝑐 and 𝜃𝑝 , so the system is
unstable.
16
5. State-Space Representation
Using the differential equations, the state-space representation of the open loop
dynamics can be developed as following (see Appendix A.2. for the process of
calculating). The input is voltage (𝑣𝐴 (𝑡)), the output are cart position (𝑥𝑐 (𝑡)) and
pendulum angle (𝜃𝑝 (𝑡)).
𝜃̇𝑝 (𝑡) 0
0 1 0 0 0 𝜃𝑝 (𝑡)
𝜃̈𝑝 (𝑡) 0
50.21 −0.317 0 −44.6575 17.3349 𝜃̇𝑝 (𝑡)
𝑥̇ 𝑐 (𝑡) 0
= 0 0 0 1 0 𝑥𝑐 (𝑡) + 𝑣𝑎 (𝑡)
𝑥̈ 𝑐 (𝑡) 0
1.47 −0.0093 0 −10.033 3.8946 𝑥̇ 𝑐 (𝑡) 50000
d [ 0 0 0 −24895.63 −14444.44] [ 𝑖𝑎 (𝑡)] [
[d𝑡 𝑖𝑎 ](𝑡) 9 ]
(3.24)
𝜃𝑝 (𝑡)
where 𝑢(𝑡) is the control sign, e(t) is the control error, 𝐾𝑝 , 𝐾𝑖 and 𝐾𝑑 are the
proportional, the integral and the derivative gains of the controller respectively.
Increasing 𝐾𝑝 will decrease the steady-state error, but too much 𝐾𝑝 will make
system unstable. Integral controller could remove the steady-state error completely
regardless of the values of other gains, but it may lead to oscillatory response.
Derivative controller could improve damping and stability of system, but it leads to a
permanent steady-state error. Increasing 𝐾𝑑 could amplify noise.
To make the performance of the system meet the criterion, a PID controller has been
added to the closed loop between cart position error and motor voltage under negative
unity feedback. The block diagram is shown in Figure 3.6. MATLAB/PID Tuner were
17
used to get the value of 𝐾𝑝 , 𝐾𝑖 and 𝐾𝑑 shown in Figure 3.7 (see the code in
Appendix A.3.). To meet criteria, 𝐾𝑝 should be about 2.009 × 106 , 𝐾𝑖 should be
about 1.512 × 108 and 𝐾𝑑 should be about 6676, which is too expensive for most
physical systems to offer it. The settling time is too small for most physical systems to
realize it. Thus, unfortunately PID control does not work for this system.
Figure 3.7: MATLAB/PID Tuner to Find the Values of 𝐾𝑝 , 𝐾𝑖 and 𝐾𝑑 for Inverted
Pendulum Single-Mass System
system dynamics are described by a set of linear differential equations and the cost is
described by a quadratic function is called the LQ problem. One of the main results in
the theory is that the solution is provided by the linear–quadratic regulator (LQR), a
feedback controller [34]. The performance index shown as,
t
PI = ∫0 f (𝑥 T 𝑄𝑥 + 𝑢T 𝑅𝑢) d𝑡 (3.27)
1. Observer Design
Considering a system as Eq. (3.28), when some states (𝑥) are not available or not
physical, the estimate of states can be used in the controller design. The error state is
defined as
𝑒 = 𝑥̃ = 𝑥 − 𝑥̂ (3.32)
where 𝑥 is actual state, 𝑥̂ is estimate of 𝑥, and error output as
𝑦̃ = 𝑦 − 𝑦̂ = 𝑦 − 𝐶𝑥̂ (3.33)
where 𝑦̂ is estimate of y.
Then the estimated system can be expressed as
If a system is observable, it is possible to fully reconstruct the system state from its
output measurements using the state observer [35]. A system must be observable if
the rank of its observability matrix
𝑀𝑜 = [𝐶 𝐶𝐴 𝐶𝐴2 … 𝐶𝐴𝑛−1 ]𝑛×𝑛 (3.40)
equals the number of states in the system,
rank(𝑀𝑜 ) = 𝑛 (3.41a)
or det(𝑀𝑜 ) ≠ 0 (3.41b)
det(𝑀𝑜 ) = −1 ≠ 0 (3.43)
Thus, the matrices are of full rank and the system is controllable and observable.
system shown in Figure 3.9. It meets the criterion, but has a lot of oscillations.
Figure 3.8: Simulink Model of LQR Control for Inverted Pendulum Single-Mass System
21
22
Figure 3.9: Simulation Result of LQR Control for Inverted Pendulum Single-Mass
System
Stability theory plays a central role in systems theory and engineering [37]. The most
useful and general approach for studying the stability of nonlinear control system is
23
the theory introduced in the late 19th century by the Russian mathematician Alexandr
Mikhailovich Lyapunov [27]. Lyapunov, in his original 1892 work, proposed two
methods for demonstrating stability [38]. The first method developed the solution in a
series which was then proved convergent within limits. The second method, which is
now referred to as the Lyapunov stability criterion, makes use of a Lyapunov function
V(x) which has an analogy to the potential function of classical dynamics [39]. In this
section the second method has been used to make sure the system can be guaranteed
to be asymptotically stable. It is introduced as follows for a system 𝑥̇ = 𝑓(𝑥) having
a point of equilibrium at 𝑥 = 0. Consider a function 𝑉(𝑥): R𝑛 → R such that [39]
(1) 𝑉(𝑥) = 0 if and only if 𝑥 = 0,
(2) 𝑉(𝑥) > 0 if and only if 𝑥 ≠ 0,
(3) V̇(x) < 0 for all values of 𝑥 ≠ 0
then 𝑉(𝑥) is called a Lyapunov function candidate and the system is asymptotically
stable in the sense of Lyapunov.
′ ′
where 𝑢𝑒𝑞1 = −(𝑐1 𝑥2 + 𝑓1 ), 𝑢𝑒𝑞2 =−(𝑐2 𝑥4 + 𝑓2 ).
Figure 3.10: Simulink Model of Hierarchical Sliding Mode Control for Inverted Pendulum Single-Mass System
26
′
Figure 3.10a: Simulink Model of 𝑢𝑒𝑞1 in Hierarchical Sliding Mode Control for
Inverted Pendulum Single-Mass System
′
Figure 3.10b: Simulink model of 𝑢𝑒𝑞2 in Hierarchical Sliding Mode Control for
Figure 3.10d: Simulink Model of SMC in Hierarchical Sliding Mode Control for
Inverted Pendulum Single-Mass System
27
2. Stability Analysis
i. Asymptotic stability
Differentiating 𝑉𝑖 with respect to time t in Eq. (3.52), then
𝑉̇𝑖 = 𝑆𝑖̇ 𝑆𝑖 (3.56)
Because
𝑆𝑖̇ = −𝑘𝑖 𝑆𝑖 − 𝜂𝑖 tanh(10 ∙ 𝑆𝑖 ) − 𝐾𝑖 ∫ 𝑆𝑖 𝑑𝑡 (3.57)
where 𝑘𝑖 , 𝜂𝑖 and 𝐾𝑖 are positive constants, we could have
𝑉̇𝑖 < 0 in D- {0} (3.58)
Because of Eq. (3.52), we could have
𝑉𝑖 > 0 in D- {0} (3.59)
According to Eqs. (3.46), (3.49), (3.50), and (3.52), we obtained
𝑉𝑖 (0) = 0 (3.60)
According to Asymptotic Stability Theorem, X=0 is asymptotically stable.
They said that when the states of the subsystem keep sliding on its own sliding
surface and converge to a certain neighborhood of the origin, the subsystem can be
treated as an autonomous system [16]. Hence,
𝑐1 < |𝑓1 /𝑥2 |
𝑐2 < |𝑓2 /𝑥4 | (3.62)
Besides, from Eq. (3.47), there exists
𝑠̇1 = 𝑐1 𝑥̇ 1 + 𝑥̇ 2 = 0
𝑠̇2 = 𝑐2 𝑥̇ 3 + 𝑥̇ 4 = 0 (3.63)
The eigenvalue of Eq. (3.63) should be negative for guaranteeing the stability of the
28
Figure 3.11: Simulation Result of Robust Control for Inverted Pendulum Single-Mass
System
follows [1]:
should be high during the initial part of the system response to reduce the rise time of
the system and low during the later stages to overcome overshoot and the settling time
[1]. 𝐾𝑖 should be large as time approaches infinity and small during the initial stage
to remove the offset. Thus, the constants 𝑘2 and 𝐾2 in Eq. (3.55) become as
𝑘2 = 𝐾2 + ∆𝐾𝑝2 e−𝐾𝑝2 𝑡
0.1 , 𝑐20 = 0.1766 , ∆𝑐2 = 10 , and 𝑘𝑐2 = 150 , the performance of the system
response could be shown in Figure 3.12 (see code as Appendix A.6.). Compared with
Figure 3.12, the settling time has been reduced.
3.3 Experiment
1. Laboratory Equipment
The list of major components in the experimental inverted pendulum single-mass
system is provided in Table 1.
ID Description ID Description
1 IP02 Cart 11 IP02 Pendulum Encoder Connector
2 Stainless Steel Shaft 12 Motor Connector
3 Rack 13 Coreless DC Motor
4 Cart Position Pinion 14 Planetary Gearbox
5 Cart Motor Pinion 15 Linear Bearing
6 Cart Motor Pinion Shaft 16 IP02 Weight
7 Pendulum 17 Power Amplifier
8 IP02 Cart Encoder 18 Terminal Board
9 IP02 Pendulum Encoder 19 PCI Data Acquisition Card
10 IP02 Cart Encoder Connector
Table1: Major components in the experimental inverted pendulum single-mass
system
31
i. IP02 Cart
The IP02 consists of a cart driven by a coreless DC motor equipped with a planetary
gearbox. The cart slides along a stainless steel shaft using linear bearings[41]. There is
a rotary joint to which a free-swinging pendulum can be attached and suspended in
front of the cart.
ii. DC Motor
The IP02 utilizes a coreless DC motor, as shown in Figure 3.14b and its nominal
properties shown in Table 2.
32
Property Value
Nominal Voltage 6 [V]
Property Value
Gear Ratio, N 3.71
Mass 2.12 [oz]
iv. Encoders
Both cart and pendulum positions are measured with two ball bearing guided
incremental optical encoders in this system. The encoder model used in the IP02 is a
US Digital S1 single-ended optical shaft encoder with 4096 counts per revolution.
The properties are shown in Table 4.
33
others) sampled
simultaneously
Counters 2 32-bit max (varies PWM from
(PWM) with frequency) 0.008Hz to
16.7 MHz
Digital I/O 16
Table 5: Quanser Q4 Data acquisition PCI card I/O [32]
2. Experimental result
Figure 3.18 shows the experimental result of LQR control. We can see there is more
oscillations than the simulation result, because there are many disturbance inputs in
real-time environment, such as noises. But fortunately, the pendulum could always up,
even though the results are not perfect. It proves that even though LQR control is a
linear controller, it can work for nonlinear system. Figure 3.19 shows the
experimental result of hierarchical sliding mode control. Compared with Figure 3.18,
we can see it has decreased oscillations greatly. Figure 3.20 shows the experimental
result of adaptive control after changed some gain values. Compared to Figure 3.19,
the settling time has been decreased but it has more oscillations.
Chapter 4
Dynamic Modeling and Control of Inverted Pendulum
Double-Mass System
In this chapter, PID, LQR, robust and adaptive controllers have been presented for
inverted pendulum double-mass system. The inverted pendulum double-mass system
may be represented schematically as depicted by Figure 4.1 and consists of two carts
moving along a rail: (i) a passive cart with a free-swinging pendulum attached
through a spring and a damper to (ii) an active cart with a DC motor and gearbox as
used in the Chapter 3. The system includes three sensors for measuring the pendulum
angle, the active cart position and passive cart position. All the parameter values
required to perform controller design and system simulations are provided in
Appendix B.1.
Section 4.1 presents how to derive the complete system dynamics by determining the
equations of motion for the electrical, mechanical and combined systems. Following
this, in Section 4.2 PID, LQR, robust, and adaptive controllers have been designed to
make sure the pendulum could keep inverted position while the base mass moving to
the desired position. Section 4.3 discusses the simulation results.
𝑓𝑐 𝑟𝑔
𝐽𝑚 𝑁𝜃𝑔̈ (𝑡) + 𝐵𝑚 𝑁𝜃𝑔̇ (𝑡) = 𝐾𝑡 𝑖𝑎 (𝑡) − 𝑁 (4.2)
N is the gear ratio of the planetary gearbox, 𝐾𝐵 is the motor speed coefficient, 𝜃̇g is
the rotational velocity of the motor pinion gear, constants 𝐽𝑚 and 𝐵𝑚 represent the
rotor inertia and the damping acting on the rotor, 𝐾𝑡 is the motor torque constant, 𝑓𝑐
is the reaction force applied to the motor pinion gear by the rack, and 𝑟𝑔 is the radius
As we discussed in Section 3.1, the velocity and acceleration of the center of gravity
of the pendulum can be found with respect to an inertial reference frame as,
𝐿𝑃 𝐿
𝐯⃗p = (𝑥̇ 𝑐 − 𝜃̇𝑝 cos(𝜃𝑝 )) 𝐢̂ − 2𝑃 𝜃̇𝑝 sin(𝜃𝑝 ) 𝐣̂ (4.3)
2
𝐿𝑃 𝐿𝑃 𝐿𝑃 𝐿𝑃
𝐚⃗𝐩 = (𝑥̈ 𝑐 − 𝜃̈𝑝 cos(𝜃𝑝 ) + 𝜃̇𝑝2 sin(𝜃𝑝 )) 𝐢̂ − ( 𝜃̈𝑝 sin(𝜃𝑝 ) + 𝜃̇𝑝2 cos(𝜃𝑝 )) 𝐣̂
2 2 2 2
(4.4)
Considering the sum of the forces of passive cart in the x-direction as,
∑ 𝐹𝑥 = 𝑀𝑐 𝑥̈ 𝑐 + 𝑀𝑝 𝑎𝑝𝑥 (4.5)
The free body diagram given in Figure 4.1 can be expanded as,
𝐿𝑃 𝐿
(𝑀𝑐 + 𝑀𝑝 ) 𝑥̈ 𝑐 − 𝑀𝑝 𝜃̈𝑝 cos(𝜃𝑝 ) − 𝐵𝑓 𝑥̇ 𝑎 + (𝐵𝑓 + 𝐵𝑐 ) 𝑥̇ 𝑐 + 𝑀𝑝 2𝑃 𝜃̇𝑝2 sin(𝜃𝑝 ) + 𝑓𝑘
2
= 𝐾 (𝑥𝑎 − 𝑥𝑐 ) (4.6)
where 𝑓𝑘 = 𝑏2 sign(𝑥̇ 𝑐 )
Here, 𝑀𝑐 and 𝑀𝑝 represent the masses of passive cart and pendulum respectively,
𝐵𝑐 is the damping coefficient observed by the cart, 𝐿𝑃 is the full length of the
pendulum, 𝑥𝑐 and 𝑥𝑎 is the position of passive and active cart in the x direction, 𝜃𝑝
is the counterclockwise angle of the pendulum with respect to the initial vertical line,
𝑓𝑘 respects coulomb observed by the passive cart, 𝑏2 is coulomb friction coefficient
affecting passive cart, K is the stiffness of the flexible joint, and 𝐵𝑓 is the viscous
Since we could have the sum of the forces of active cart in the x-direction as,
∑ 𝐹𝑥 = 𝑀𝑎 𝑥̈ 𝑎 (4.7)
Considering this equation and the free body diagram given in Figure 4.4, this may be
expanded as,
where 𝑓𝑘 = 𝑏1 sign(𝑥̇ 𝑎 )
Here, 𝑀𝑎 and 𝑀𝑝 represent the masses of active cart and pendulum respectively, 𝐵𝑐
is the damping coefficient observed by the cart, 𝐿𝑃 is the full length of the
pendulum, 𝑥𝑎 and 𝑥𝑐 is the position of active and passive cart in the x direction, 𝜃𝑝
is the counterclockwise angle of the pendulum with respect to the initial vertical line,
𝑓𝑘 respects coulomb observed by the active cart, 𝑏1 is coulomb friction coefficient
affecting active cart, K is the stiffness of the flexible joint, and 𝐵𝑓 is the viscous
sin(𝜃𝑝 ) = 𝜃𝑝 (4.10a)
cos(𝜃𝑝 ) = 1 (4.10b)
Submitting Eqs. (4.10a) and (4.10b) into Eqs. (4.6) and (4.9), and removed the higher
order terms, the equations can be expressed as
𝐿𝑃
(𝑀𝑐 + 𝑀𝑝 ) 𝑥̈ 𝑐 − 𝑀𝑝 𝜃̈𝑝 − 𝐵𝑓 𝑥̇ 𝑎 + (𝐵𝑓 + 𝐵𝑐 ) 𝑥̇ 𝑐 − 𝐾 𝑥𝑎 + 𝐾 𝑥𝑐 + 𝑏 sign(𝑥̇ 𝑐 ) = 0
2
(4.12)
1 𝐿𝑃 𝐿𝑃
𝑀 𝐿2 𝜃̈ + 𝐵𝑝 𝜃̇𝑝 − 𝑀𝑝 𝑥̈ 𝑐 − 𝑀𝑝 𝑔 𝜃𝑝 = 0 (4.13)
3 𝑝 𝑝 𝑝 2 2
By substituting Eq. (4.14) into Eq. (4.11), and realizing that the angle of the motor
𝑥𝑐
pinion gear may be written as 𝜃𝑝 = , Eq. (4.11) may be rewritten as,
𝑟𝑔
𝑁2 𝑁2
(𝑀𝑐 + 𝐽𝑚 ) 𝑥̈ + (𝐵 + 𝐵 + 𝐵𝑚 2 ) 𝑥̇ 𝑎 − 𝐵𝑓 𝑥̇ 𝑐 + 𝐾 𝑥𝑎 − 𝐾 𝑥𝑐 + 𝑏1 sign(𝑥̇ 𝑎 )
𝑟𝑔 2 𝑎 𝑐 𝑓
𝑟𝑔
𝑁
− 𝑟 𝐾𝑡 𝑖𝑎 (𝑡) = 0 (4.15)
𝑔
1 𝐿𝑃 𝐿𝑃
𝑀 𝐿2 𝜃̈ − 𝑀𝑝 𝑥̈ 𝑐 + 𝐵𝑝 𝜃̇𝑝 − 𝑀𝑝 𝑔 𝜃𝑝 = 0 (4.17)
3 𝑝 𝑝 𝑝 2 2
𝐿𝑃
(𝑀𝑐 + 𝑀𝑝 ) 𝑥̈ 𝑐 − 𝑀𝑝 𝜃̈𝑝 − 𝐵𝑓 𝑥̇ 𝑎 + (𝐵𝑓 + 𝐵𝑐 ) 𝑥̇ 𝑐 − 𝐾 𝑥𝑎 + 𝐾 𝑥𝑐 + 𝑏2 sign(𝑥̇ 𝑐 ) = 0
2
(4.18)
𝑁2 𝑁2
(𝑀𝑐 + 𝐽𝑚 ) 𝑥̈ 𝑎 + (𝐵𝑐 + 𝐵𝑓 + 𝐵𝑚 ) 𝑥̇ 𝑎 − 𝐵𝑓 𝑥̇ 𝑐 + 𝐾 𝑥𝑎 − 𝐾 𝑥𝑐 + 𝑏1 sign(𝑥̇ 𝑎 )
𝑟𝑔 𝑟𝑔
𝑁
− 𝑟 𝐾𝑡 𝑖𝑎 (𝑡) = 0 (4.19)
𝑔
42
cart 𝑥𝑎 , 𝑥c and pendulum angle 𝜃p to the applied motor voltage 𝑣𝐴 can be found.
The results can be shown as below (see Appendix B.2. for the process of calculating):
𝑥𝑎 ’s open-loop transfer function can be expressed as:
𝑿𝒂
1.12 ∗ 1018 ∗ (4.77 ∗ 1018 ∙ s 4 + 1.32 ∗ 1013 ∙ s 3 + 4.6 ∗ 1014 ∙ s 2 − 1.21 ∗ 1014 ∙ s − 2.98 ∗ 1016 )
=
2.35 ∗ 1026 ∙ s 7 + 3.39 ∗ 1030 ∙ s 6 + 5.92 ∗ 1031 ∙ s 5 + 8.9 ∗ 1032 ∙ s 4 + 3.97 ∗ 1033 ∙ s 3 − 4.34 ∗ 1034 ∙ s 2 − 2.68 ∗ 1035 ∙ s
(4.20)
𝑥𝑐 ’s open-loop transfer function can be expressed as:
𝑿𝒄
2.24 ∗ 1020 ∗ (4.81 ∗ 109 ∙ s 2 + 2.4 ∗ 109 ∙ s − 2.1 ∗ 1011 ) ∙ (11 ∙ s + 710)
=
2.35 ∗ 1026 ∙ s 7 + 3.39 ∗ 1030 ∙ s 6 + 5.92 ∗ 1031 ∙ s 5 + 8.9 ∗ 1032 ∙ s 4 + 3.97 ∗ 1033 ∙ s 3 − 4.34 ∗ 1034 ∙ s 2 − 2.68 ∗ 1035 ∙ s
(4.21)
𝜃𝑝 's open-loop transfer function can be expressed as:
𝛉𝐩
30
4.79 ∗ 10 ∙ s ∙ (11 ∙ s + 710)
=
26 6 30 5 31
2.35 ∗ 10 ∙ s + 3.39 ∗ 10 ∙ s + 5.92 ∗ 10 ∙ s + 8.9 ∗ 1032 ∙ s3 + 3.97 ∗ 1033 ∙ s2 − 4.34 ∗ 1034 ∙ s − 2.68 ∗ 1035
4
(4.22)
4. Stability
For 𝑥𝑎 ’s, 𝑥𝑐 ’s and 𝜃𝑝 's transfer function, the poles and zeros can be found simply by
𝜃p :
44
Zeros: 0, −64.54545455
Poles: 6.469034991, −4.568631367+14.4109187i, −6.342778315,
−8.464477867, −14437.37167, −4.568631367−14.410901871i
It shows that there is one pole at right-hand plane for 𝑥𝑎 , 𝑥𝑐 and 𝜃p , so the system
is unstable.
5. State-Space Representation
Using the differential equations, the state-space representation of the open loop
dynamics can be developed as Eqs. (4.23) and (4.24) (see Appendix B.2. for the
process of calculating). The input is voltage (𝑣𝐴 (t)), the outputs are carts' position
( 𝑥𝑎 (t), 𝑥𝑐 (t)) and the pendulum angle (𝜃𝑝 (t)).
𝑑𝑖𝑎 (𝑡)
𝑖𝑎 (𝑡) 50000
𝑑𝑡 −14444.44 0 −24895.63 0 0 0 0
0 0 1 0 0 0 0 𝑥𝑎 (𝑡) 9
𝑥̇ 𝑎 (𝑡)
𝑥̇ 𝑎 (𝑡) 0
𝑥̈ 𝑎 (𝑡) 4.099 −129.90 −7.635 129.90 2.01 0 0
= 𝑥𝑐 (𝑡) + 0 𝑣𝑎 (𝑡)
𝑥̇ 𝑐 (𝑡) 0 0 0 0 1 0 0
𝑥̇ (𝑡) 0
𝑥̈ 𝑐 (𝑡) 0 143.18 2.218 −143.18 −2.22 0.94 −0.01 𝑐
𝜃𝑝 (𝑡) 0
0 0 0 0 0 0 1
𝜃̇𝑝 (𝑡) [ ] 0
0 637.31 9.874 −637.31 −9.88 47.86 −0.55 [𝜃̇𝑝 (𝑡) ] [
[ 𝜃̈𝑝 (𝑡) ] 0 ]
(4.23)
𝑖𝑎 (𝑡)
𝑥𝑎 (𝑡)
𝑥𝑎 (𝑡) 0 1 0 0 0 0 0 𝑥̇ 𝑎 (𝑡)
𝑥 (𝑡)
[ 𝑐 ]= [0 0 0 1 0 0 0] 𝑥𝑐 (𝑡) + [0]𝑣𝐴 (t) (4.24)
𝜃𝑝 (𝑡) 0 0 0 0 0 1 0 𝑥̇ 𝑐 (𝑡)
𝜃𝑝 (𝑡)
[𝜃̇𝑝 (𝑡)]
Figure 4.7: Using MATLAB/PID Tuner to design a PID Controller for Inverted
Pendulum Double-Mass System
32 0 0 0 0 0
0 0.5 0 0 0 0
0 0 19 0 0 0
𝑄=
0 0 0 2 0 0
0 0 0 0 1700 0
[0 0 0 0 0 0.4]
the LQR gain vector can be obtained as following:
𝑘 = [1182.2 38.6 −1292.9 −181.7 885.9 87.8]
and
231 158 8
1717 30913 −15293
−126 220 30
𝐿=
3983 43544 −24194
−91 −26 315
[−5718 −51761 29729 ]
1
To decrease oscillations, three filters are designed as . The response of the
(0.0008s+1)2
system shows in Figure 4.9. There are a lot of oscillations. When the cart stops
moving, the pendulum would fall. Here, the order of current has been reduced by
omitting inductance, because the observer needs to be very fast to make the system
stable with inductance, and it is hard to be realized in the experiment.
Figure 4.8: Simulink Model of LQR Control for Inverted Pendulum Double-Mass System
47
48
𝑥1 =𝜃𝑝
𝑥2 =𝜃̇𝑝
𝑥3 =𝑥𝑐 (4.28)
𝑥4 =𝑥̇ 𝑐
𝑥5 =𝑥𝑎
{𝑥6 =𝑥̇ 𝑎
Where 𝜃𝑝 is pendulum angle, 𝑥𝑐 is passive cart position, and 𝑥𝑎 is active cart
position.
Define the sliding surface as [16]
𝑠1 = 𝑐1 𝑥1 + 𝑥2
𝑠2 = 𝑐2 𝑥3 + 𝑥4
𝑠3 = 𝑐3 𝑥5 + 𝑥6 (4.29)
where 𝑐1, 𝑐2 and 𝑐3 are positive constant.
Differentiate 𝑠1 , 𝑠2 and 𝑠3 with respect to time t, then [16],
ṡ 1 = c1 ẋ 1 + ẋ 2 =c1 x2 + f1 + b1 u
ṡ 2 = c2 ẋ 3 + ẋ 4 =c2 x4 + f2 + b2 u
ṡ 3 = c3 ẋ 5 + ẋ 6 =c3 x6 + f3 + b3 u (4.30)
Lets 𝑠̇𝑖 = 0 in Eqs. (4.30), the equivalent control of the 1th, 2nd and 3rd subsystem
are obtained as [16]
𝑢𝑒𝑞1 = −(𝑐1 𝑥2 + 𝑓1 )/ 𝑏1
𝑢𝑒𝑞2 = −(𝑐2 𝑥4 + 𝑓2 )/ 𝑏2
𝑢𝑒𝑞3 = −(𝑐3 𝑥6 + 𝑓3 )/ 𝑏3 (4.31)
𝑆1̇ = 𝑠̇1 = 𝑐1 𝑥̇ 1 + 𝑥̇ 2
50
′ ′ ′
where 𝑢𝑒𝑞1 = −(𝑐1 𝑥2 + 𝑓1 ), 𝑢𝑒𝑞2 =−(𝑐2 𝑥4 + 𝑓2 ), 𝑢𝑒𝑞3 =−(𝑐3 𝑥6 + 𝑓3 ).
′
Figure 4.10a: Simulink Model of 𝑢𝑒𝑞1 in Hierarchical Sliding Mode Control for
Inverted Pendulum Double-Mass System
′
Figure 4.10b: Simulink Model of 𝑢𝑒𝑞2 in Hierarchical Sliding Mode Control for
′
Figure 4.10c: Simulink Model of 𝑢𝑒𝑞3 in Hierarchical Sliding Mode Control for
Figure 4.10e: Simulink Model of SMC in Hierarchical Sliding Mode Control for
Inverted Pendulum Double-Mass System
53
2. Stability Analysis
i. Asymptotic stability
Differentiating 𝑉𝑖 with respect to time t in Eq. (4.36), then
𝑉̇𝑖 = 𝑆𝑖̇ 𝑆𝑖 (4.40)
Because
They said that when the states of the subsystem keep sliding on its own sliding
surface and converge to a certain neighborhood of the origin, the subsystem can be
treated as an autonomous system [16]. Hence, we have
𝑐1 < |𝑓1 /𝑥2 |
𝑐2 < |𝑓2 /𝑥4 |
𝑐3 < |𝑓3 /𝑥6 | (4.46)
Besides, from Eq. (4.30), there exists
54
𝑠̇1 = 𝑐1 𝑥̇ 1 + 𝑥̇ 2 = 0
𝑠̇2 = 𝑐2 𝑥̇ 3 + 𝑥̇ 4 = 0
𝑠̇3 = 𝑐3 𝑥̇ 5 + 𝑥̇ 6 = 0 (4.47)
The eigenvalue of Eq. (4.29) should be negative for guaranteeing the stability of the
1th, 2nd and 3rd subsystem sliding surfaces [16]. Thus,
𝑐1 > 0
𝑐2 > 0
𝑐3 > 0 (4.48)
3. Simulation results
With the MATLAB code as shown in Appendix B.5., setting initial state vector 𝐗 𝟎 as
[0, 0, −0.044425, 0, −0.044425,0]T , and selecting 𝑐1 = 4.7302 , 𝑐2 = 0.4506 ,
𝑐3 = 2.5377, 𝜆1 = −1, 𝜆2 = −50, 𝑘3 = 8 and 𝜂3 = 17, we could get the result as
shown in Figure 4.11. It shows that the active cart moves 0.05m distance and the
pendulum always up. Wherever initial position of carts has been set, it always has a
steady-state error of 0.005575m, so initial state vector 𝐗 𝟎 can be set as
[0, 0, −0.044425, 0, −0.044425,0]T to make sure the active cart could move 0.05m.
Figure 4.11 shows that the two carts cannot move same distance, because of
deformation of the spring. The 2nd and the 3rd sliding surface cannot reach to zero at
the same time, so the 3rd layer sliding surface cannot reach to asymptotically stable
equilibrium point. It is possible to eliminate the steady state error of the 2nd layer
sliding surface. However, adding an integral controller to the sliding surface function
does not work this time, and even worse it could bring oscillations. Because from Eq.
(4.39) we can see the Integral controller cannot only affect the 2nd layer sliding
surface.
55
be a function of time as
∆𝐾𝑝3 = 11.5 , 𝐾𝑝3 = 1 , 𝜂30 = 17 , ∆𝜂3 = 1.1 , 𝑘𝜂3 = 2 , 𝑐20 = 0.6506 , ∆𝑐2 =
−0.5, and 𝑘𝑐2 = 3, the results are shown in Figure 4.12 (see code as Appendix B.6.).
Compare with Figure 4.11, the steady-state error and settling time have been
decreased.
56
4.3 Summary
In this chapter, PID, LQR, robust and adaptive control methods are applied to the
inverted pendulum double-mass system. Figure 4.7 shows that PID control cannot
work for this system. In Figure 4.9, the performance of LQR controller has a lot of
oscillations and that would cause the pendulum fall when the carts stop moving.
Figure 4.11 presents that hierarchical sliding mode technique can meet our
requirements but it exists steady-state error. By designing an adaptive controller, the
performance of the system can be improved, such as the steady-state error and settling
time have been decreased (as shown in Figure 4.12).
57
LQR controller can work for simple nonlinear system, such as inverted pendulum
double-mass system, but when the nonlinear system become complex, it cannot give a
satisfactory result, such as the inverted pendulum double-mass system. Figure 3.9,
Figure 3.18 and Figure 4.9 show that it has oscillations using LQR approach for the
two systems.
Hierarchical sliding mode control could give a better result than PID and LQR control
for nonlinear system. But there still exist some weak points, such as how to eliminate
steady-state error and select the controller parameters. An integral controller can be
helpful to eliminate steady-state error when the system does not include an elastic
object that could stores mechanical energy, such as spring. For example, Figure 3.11
and Figure 3.19 show that an integral controller can eliminate the steady-state error
for the inverted pendulum single-mass system. However, it cannot work for the
inverted pendulum double-mass system. Moreover, the more complex a system
becomes, the more difficult to select the controller parameters, especially for the
real-time experimental environment.
Adaptive control can improve the performance of the system response. Figure 4.12
shows that compared with the robust control was designed, adaptive control has
decreased the steady state error and settling time. Figure 3.12 and Figure 3.20 show
58
that the inverted pendulum single-mass system can reach the desired position quickly
by using adaptive control.
REFERENCES
[1] Vikram Chopra, Sunil K. Singla and Lillie Dewan, ''Stabilization of an X-Y
inverted pendulum using adaptive gain scheduling PID controllers,'' Engineering
Research, vol. 3, no. 2, pp. 59-78, July 2015.
[2] Chaio-Shiung Chen and Wen-Liang Chen, ''Robust adaptive sliding-mode control
using fuzzy modeling for an inverted-pendulum system,'' IEEE transactions on
industrial electronics, vol. 45, no. 2, pp.297-306, April 1998.
[3] LI Ming, ''Self-adaptive Fuzzy PID Digital Control Method for Linear Inverted
Pendulum,'' Proceedings of the 31st Chinese Control Conference, Hefei, China, 2012,
pp. 3563-3567.
[4] Lal Bahadur Prasad, Barjeev Tyagi, and Hari Om Gupta. (2011, Nov). Optimal
control of nonlinear inverted pendulum dynamical system with disturbance input
using PID controller & LQR. Presented at 2011 IEEE International Conference on
Control System, Computing and Engineering. Available:
https://ieeexplore.ieee.org/document/6190585/.
[5] S. Omatu, T. Fujinaka, and M. Yoshioka. (2000, Oct.). Neuro-PID control for
inverted single and double pendulums. Presented at 2000 IEEE International
Conference on Systems, Man, and Cybernetics. Available:
https://ieeexplore.ieee.org/abstract/document/884401/
[6] T. Fujinaka, Y. Kishida, and M. Yoshioka, ''Stabilization of double inverted
pendulum with self-tuning neuro-PID,'' in IEEE-INNS-ENNS International Joint
Conference on Neural Networks, Como, Italy, 2000, pp. 245-248.
[7] Mohammad El-Bardini and Ahmad M. El-Nagar. (2014, May). Interval type-2
fuzzy PID controller for uncertain nonlinear inverted pendulum system. ISA
Transactions. vol. 53(3), pp. 732-743. Available:
https://www.sciencedirect.com/science/article/pii/S0019057814000391
61
[8] Oskar Stattin, ''Optimal Control of Inverted Pendulum,'' B.S. thesis, Dept. Math.,
Royal Institute of Technology Univ., Stockholm, Sweden, 2015.
[9] Optimal control. (n.d.). Retrieved April 09, 2018 from the Optimal control Wiki:
https://en.wikipedia.org/wiki/Optimal_control.
[10] Alexander Bogdanov, ''Optimal Control of a Double Inverted Pendulum on a
Cart'', OGI School of Science & Engineering, Hillsboro, OR, Tech. Rep.
CSE-04-006, Dec. 2004
[11] Khaled Gamal Eltohamy and Chen-Yuan Kuo. (2010, Nov.). Nonlinear optimal
control of a triple link inverted pendulum with single control input. International
Journal of Control. [Online]. vol. 69(2), pp. 239-256. Available:
https://www.tandfonline.com/doi/pdf/10.1080/002071798222811?needAccess=true.
[12] Viroch Sukontanakarn and Manukid Parnichkun. (2009). Real-Time Optimal
Control for Rotary Inverted Pendulum. American Journal of Applied Sciences. vol. 6
(6), pp. 1106-1115. Available:
https://www.researchgate.net/profile/Viroch_Sukontanakarn2/publication/263091218_
PDF_ajassp200911061115_2/links/00b49539e7557e78a6000000/PDF-ajassp2009110
61115-2.pdf.
[13] Robust control. (n.d.). Retrieved April 01, 2018 from the Robust control Wiki:
https://en.wikipedia.org/wiki/Robust_control.
[14] Sliding mode control. (n.d.). Retrieved April 01, 2018 from the Sliding mode
control Wiki: https://en.wikipedia.org/wiki/Sliding_mode_control.
[15] Mun-Soo Park and Dongkyoung Chwa, ''Swing-Up and Stabilization Control of
Inverted-Pendulum Systems via Coupled Sliding-Mode Control Method,'' IEEE
Transactions on Industrial Electronics, vol. 56, Issue 9, pp. 3541 - 3555, Sept. 2009.
[16] Dianwei Qian, Jianqiang Yi and Dongbin Zhao, ''Hierarchical sliding mode
control for a class of SIMO under-actuated systems,'' Control and Cybernetics, vol. 37,
no.1, pp.159-175, March 2008.
62
[17] Dianwei Qian, Jianqiang Yi, and Dongbin Zhao, ''Hierarchical Sliding Mode
Control for Series Double Inverted Pendulums System,'' in Proc. the 2006 IEEE/RSJ
International Conference on Intelligent Robots and Systems, Beijing, China, 2006,
pp. 4977- 4982.
[18] Iven Mareels and Jan Willem Polderman, ''Introduction,'' in Adaptive Systems An
Introduction, Boston : Birkhäuser, 1996, pp. 1.
[19] Adaptive control. (n.d.). Retrieved April 01, 2018 from the Adaptive control Wiki:
https://en.wikipedia.org/wiki/Adaptive_control.
[20] T. C. Kuo, Y. J. Huang, and B. W. Hong. (2009, July). Adaptive PID with
sliding mode control for the rotary inverted pendulum system. Presented at 2009
IEEE/ASME International Conference on Advanced Intelligent Mechatronics.
Available: https://ieeexplore.ieee.org/document/5229784/
[21] Chih-Min Lin, Chung-Li, and Tao-Yuan. (2005, Oct.). Adaptive Hierarchical
Fuzzy Sliding-Mode Control for a Class of Coupling Nonlinear
Systems. Contemporary Mathematical Sciences. vol.1, no.4, pp. 177-204. Available:
https://pdfs.semanticscholar.org/a2ee/064330f71354d7567a1bae91640fdb33b930.pdf.
[22] Rong-Jong Wai, Meng-An Kuo, and Jeng-Dao Lee, ''design of cascade adaptive
fuzzy sliding-mode control for nonlinear two-axis inverted-pendulum
servomechanism,'' IEEE Transactions on Fuzzy Systems, vol. 16, issue 5, pp.
1232-1244, Oct., 2008.
[23] Chih-Min Lin and Yi-Jen Mon, ''Decoupling control by hierarchical fuzzy
sliding-mode controller,'' IEEE Transactions on Control Systems Technology, vol. 13,
no. 4, pp. 593-598, July, 2005.
[24] Chin Wang Tao, Jinshiuh Taur, Chien Ming Wang, and U.S.Chen, ''Fuzzy
hierarchical swing-up and sliding position controller for the inverted pendulum–cart
system,'' Fuzzy Sets and Systems, vol. 159, issue 20, pp. 2763-2784, Oct., 2008.
63
[25] Rong-Jong Wai, Meng-An Kuo, and Jeng-Dao Lee, ''Design of Cascade
Adaptive Fuzzy Sliding-Mode Control for Nonlinear Two-Axis Inverted-Pendulum
Servomechanism,'' IEEE Transactions on Fuzzy Systems, vol. 16, issue 5, pp.
1232-1244, Oct., 2008.
[26] Stability theory. (n.d.). Retrieved April 09, 2018 from the Stability theory Wiki:
https://en.wikipedia.org/wiki/Stability_theory.
[27] Jean-Jacques E.Slotine, Weiping Li, ''Fundamentals of Lyapunov Theroy'', in
Applied Nonlinear Control, New Jersey: Prentice Hall, 1991, pp. 40-41.
[28] David R. Merkin, ''Introduction,'' in Introduction to the Theory of Stability, New
York: Springer-Verlag, Inc, 1997, pp.2-3
[29] Anthony N. Michel, Ling Hou, and Derong Liu, ''Introduction,'' in Stability of
Dynamical Systems, 2nd ed., AG Switzerland : Springer International, 2015, pp. 4-5.
[30] Carlos Aguilar Ibañez, O. Gutiérrez Frias, and M. Suárez Castañón,
''Lyapunov-based controller for the inverted pendulum cart system,'' Nonlinear
Dynamics, vol. 40, issue 4, pp 367–374, June, 2005.
[31] M. J. Anderson and W. J. Grantham. (1989, Dec.). Lyapunov Optimal Feedback
Control of a Nonlinear Inverted Pendulum. Dynamic Systems, Measurement, and
Control. vol. 111 (4), pp. 554-558. Available:
http://dynamicsystems.asmedigitalcollection.asme.org/article.aspx?articleid=1404587
[32] Nader Jalili, '' Final Term Project: Classical Controller Design and
Implementation for A Gantry System,'' unpublished.
[33] Norman S. Nise, ''Stability'' in Control Systems Engineering, 3rd ed., New York:
John Wiley & Sons, Inc., 2000, pp. 326-327.
[34] Linear-quadratic regulator. (n.d.). Retrieved April 09, 2018 from the
Linear-quadratic regulator Wiki:
https://en.wikipedia.org/wiki/Linear%E2%80%93quadratic_regulator.
64
[35] State observer. (n.d.). Retrieved April 09, 2018 from the State observer Wiki:
https://en.wikipedia.org/wiki/State_observer.
[36] Katsuhiko Ogata, ''Control systems design in state space,'' in Modern Control
Engineering, 5th ed. 2009, New Jersey: Prentice Hall, 2009, pp. 806-808.
[37] Hassan K. Khalil, ''Lyapunov Stability ,'' in Nonlinear Systems, 3rd ed., New
Jersey: Prentice Hall, 2002, pp. 111.
[38] Bhatia, Nam Parshad; Szegő, Giorgio P, ''Stability Theory'', in Stability theory of
dynamical systems, New York: Springer-Verlag Berlin Heidelberg, 1970, pp. 56-79.
[39] Lyapunov stability. (n.d.). Retrieved April 09, 2018 from the Lyapunov stability
Wiki: https://en.wikipedia.org/wiki/Lyapunov_stability#cite_note-lyapunov-1.
[40] Karl Johan Astrom, Bjorn Witternmark, ''Introduction,'' in Adaptive Control, 2nd
ed., Reading, Mass. : Addison-Wesley, 1995, pp. 1.
[41] User Manual IP02 Base Unit Experiment, Quanser Inc, Ontario, Canada, 2012,
pp. 4-9.
[42] Quanser Inc (2017, Aug 29). Quanser Q4. Retrieved April 10, 2018 from
http://quanser-update.azurewebsites.net/quarc/documentation/q4.html.
[43] Universal Power Module 1503,1506,2405,2405-PWM User Manual, Quanser Inc,
Ontario, Canada, Available: http://www2.hawaii.edu/~gurdal/EE351L/upm.pdf.
65
System
clear all;
num_xc=[2.717197871*10^18 2.068251968*10^17
-6.234767921*10^19];
den_xc=[1.813984163*10^18 3.053492910*10^19
-4.555081036*10^19 -6.969984478*10^20 0];
xcsystem=tf(num_xc,den_xc)
num_theta=[6.355522856*10^18 0];
den_theta=[1.813984163*10^18 3.053492910*10^19
-4.555081036*10^19 -6.969984478*10^20];
theta_system=tf(num_theta,den_theta)
72
System
1.Controllability and Observability
A=[0, 1, 0, 0;0, -16.74554526, 1.470698607,
-0.4878730576e-2;0, 0, 0, 1;0, -39.16781208, 26.38554173,
-0.8752843618e-1];
B=[0;1.497917086;0;3.50362642];
C=[1, 0, 0, 0;0, 0, 1, 0];
Mc=[B A*B A*A*B A*A*A*B]
det_Mc=det(Mc)
Mo=[C;C*A;C*A^2;C*A^3]
det_Mo=det(Mo(1:4,1:4))
2. LQR Controller
clear all;
A=[0, 1, 0, 0;0, -16.74554526, 1.470698607,
-0.4878730576e-2;0, 0, 0, 1;0, -39.16781208, 26.38554173,
-0.8752843618e-1];
B=[0;1.497917086;0;3.50362642];
C1=[1 0 0 0;0 0 1 0];
q1=200/(2.534*0.1^2);
q2=50/(2*0.09211^2);
q3=100/(3.2*0.016^2);
q4=0.008/(1.1*0.0072^2);
R=1/36;
Q=[q1 0 0 0;0 q2 0 0;0 0 q3 0;0 0 0 q4]
73
k=lqr(A,B,Q,R)
N=-1/(C1(1,:)/(A-B*k)*B)
AA=A';
CC=C1';
P=[-4.0000 + 0.5000i; -4.0000 - 0.5000i;-3.000 +
0.2000i;-3.000 - 0.2000i]
LL=place(AA,CC,40*P);
L=LL'
74
System
1. Robust Control
a1=47.8583476;
a2=-0.8976130226e-2;
b1=4.48806511;
a3=.9421754475;
a4=-0.2016637257e-2;
b2=1.00831862;
a5=-.5471372821;
a6=-0.1077135627e-1;
%Control Parameters
lamda1=-0.35;
lamda2=1;
c1=0.93*abs(a1+a2+a5)
c2=0.19*abs(a3+a4+a6)
K2=0.4;
eta2=0.0005;
KI=240;
75
System
a1=47.8583476;
a2=-0.8976130226e-2;
b1=4.48806511;
a3=.9421754475;
a4=-0.2016637257e-2;
b2=1.00831862;
a5=-.5471372821;
a6=-0.1077135627e-1;
lamda1=-0.35;
lamda2=1;
c1=43.9911;
c2=0.1766;
deltac2=10;
kc2=150;
deltac1=3;
kc1=0.1;
KI1=4;
deltaKI=1;
KP1=0.1;
deltaKP=14;
KI2=0.3;
deltaKI2=1;
KP2=0.1;
deltaKP2=15;
76
K2=0.5;
eta2=0.0005;
KI=320;
77
System
clear all;
num_xa=[5.341706650*10^30 1.478293225*10^31
5.151075339*10^32 -1.360763530*10^32 -3.339616015*10^34];
den_xa=[2.345456972*10^26 3.390322204*10^30
+5.923749250*10^31 +8.896148844*10^32 +3.971333590*10^33
-4.334657905*10^34 -2.687876812*10^35 0 0];
num_xc=[+1.184951311*10^31 7.707474102*10^32
-1.356059845*10^32 -3.339616012*10^34];
den_xc=[2.345456972*10^26 3.390322204*10^30
5.923749250*10^31 8.896148844*10^32 3.971333590*10^33
-4.334657905*10^34 -2.687876812*10^35 0];
num_theta=[4.057126150*10^22 2.618690515*10^24 0];
den_theta=[2.345456972*10^26 3.390322204*10^30
5.923749250*10^31 8.896148844*10^32 3.971333590*10^33
-4.334657905*10^34 -2.687876812*10^35];
xcsystem=tf(num_xc,den_xc)
theta_system=tf(num_theta,den_theta)
xasystem=tf(num_xa,den_xa)
88
System
1. State-Space Representation of the System by Omitting Inductance
89
90
3. LQR Controller
A=[0, 1, 0, 0, 0, 0;-129.9026065, -14.70083144, 129.902606,
2.012575593, 0, 0;0, 0, 0, 1, 0, 0;143.1812453, 2.218300983,
-143.1812453, -2.220317620, .942175447, -0.1077135627e-1;0,
0, 0, 0, 0, 1;637.3052461, 9.873743249, -637.3052461,
-9.882719379, 47.85834769, -.5471372821];
B=[0;1.576709633;0;0;0;0];
C=[1 0 0 0 0 0;0 0 1 0 0 0;0 0 0 0 1 0];
R=.15/36;
Q=[32 0 0 0 0 0;0 0.5 0 0 0 0;0 0 19 0 0 0;0 0 0 2 0 0;0 0
0 0 1700 0;0 0 0 0 0 0.4]
k=lqr(A,B,Q,R)
N=-1/(C(1,:)/(A-B*k)*B)
AA=A';
CC=C';
P=5*eig((A-B*k));
LL=place(AA,CC,2*P);
L=LL'
eig([A-B*k,B*k;0*A,A-L*C])
92
System
a1 = 47.85834769;
a2 = -.5471372821;
a3 = -637.3052461;
a4 = -9.882719379;
a5 = 637.305246;
a6 = 9.873743249;
b1 = 0;
a7 = .942175447;
a8 = -0.107713562e-1;
a9 = -143.1812453;
a10 = -2.220317620;
a11 = 143.1812453;
a12 = 2.21830098;
b2 = 0;
a13 = 129.9026065;
a14 = 2.012575593;
a15 = -129.9026065;
a16 = -14.70083144;
b3 = 1.57670963;
%Control Parameters
lamda1=-1;
lamda2=-50;
c1=0.1*abs(a1+a2+a3+a4+a5+a6)
c2=0.7*abs(a7+a8+a9+a10+a11+a12)-0.2
93
c3=0.2*abs(a13+a14+a15+a16)
K3=8;
eta3=17;
94
System
clear all;
a1 = 47.85834769;
a2 = -.5471372821;
a3 = -637.3052461;
a4 = -9.882719379;
a5 = 637.305246;
a6 = 9.873743249;
b1 = 0;
a7 = .942175447;
a8 = -0.107713562e-1;
a9 = -143.1812453;
a10 = -2.220317620;
a11 = 143.1812453;
a12 = 2.21830098;
b2 = 0;
a13 = 129.9026065;
a14 = 2.012575593;
a15 = -129.9026065;
a16 = -14.70083144;
b3 = 1.57670963;
%Control Parameters
lamda1=-1;
lamda2=-50;
c1=0.1*abs(a1+a2+a3+a4+a5+a6)
95
c2=0.7*abs(a7+a8+a9+a10+a11+a12)
c3=0.2*abs(a13+a14+a15+a16)
K3=9;
eta3=17;
KI=0.01*0;
KK=0;
deltac2=-0.5;
kc2=3;
deltaKP3=11.5;
KP3=1;
deltaeta3=1.1;
eta31=2;