Uploaded by asukambajames

Nonlinear Control of the Inverted Pendulum on a Cart

advertisement
FEEDBACK LINEARIZATION, SLIDING MODE AND
SWING UP CONTROL FOR THE INVERTED
PENDULUM ON A CART
A Dissertation Submitted to the University of Manchester
for the Degree of Master of Science (MSc) in the Faculty of
Engineering and Physical Sciences
2015
ASUK AMBA J.
School of Electrical and Electronic Engineering
TABLE OF CONTENTS
LIST OF TABLES ......................................................................................................................... 4
LIST OF FIGURES ....................................................................................................................... 5
LIST OF ABBREVIATIONS ........................................................................................................... 7
DECLARATION .......................................................................................................................... 8
COPYRIGHT .............................................................................................................................. 9
ABSTRACT .............................................................................................................................. 10
CHAPTER 1: INTRODUCTION .................................................................................................. 11
1.1 BACKGROUND ......................................................................................................................... 11
1.2 OBJECTIVES ............................................................................................................................ 13
1.3 ORGANIZATION OF THESIS ...................................................................................................... 13
CHAPTER 2: LITERATURE REVIEW ........................................................................................... 14
CHAPTER 3: MODELLING OF INVERTED PENDULUM ................................................................ 17
3.1 MATHEMATICAL MODEL OF THE IP02 INVERTED PENDULUM(IP) SYSTEM FROM QUANSER
...................................................................................................................................................... 17
3.2 STATE SPACE EQUATION OF NONLINEAR INVERTED PENDULUM (IP) SYSTEM...................... 22
3.3 MODEL VALIDATION AND NATURAL DYNAMICS ................................................................... 22
3.4 JACOBIAN LINEARIZATION OF NONLINEAR INVERTED PENDULUM SYSTEM ........................ 23
3.5 ANALYSIS OF LINEAR SYSTEM IN THE UPRIGHT EQUILIBRIUM ............................................... 24
CHAPTER 4: CONTROLLER DESIGN AND SIMULATION RESULTS ................................................ 25
4.1 FEEDBACK LINEARIZATION ...................................................................................................... 25
4.1.1 INPUT-STATE LINEARIZATION .......................................................................................... 25
4.1.2 INPUT-STATE LINEARIZATION OF THE INVERTED PENDULUM ....................................... 26
4.1.3 APPROXIMATE FEEDBACK LINEARIZATION ...................................................................... 29
4.1.4 APPROXIMATE FEEDBACK LINEARIZATION OF THE INVERTED PENDULUM .................... 29
4.2 SLIDING MODE CONTROL....................................................................................................... 31
4.2.1 SLIDING SURFACE DESIGN ............................................................................................... 32
4.2.2 SLIDING CONTROL DESIGN............................................................................................... 32
4.2.3 DEALING WITH CHATTERING .......................................................................................... 33
4.2.4 SLIDING MODE CONTROL DESIGN FOR THE APPROXIMATELY LINEARIZED INVERTED
PENDULUM(FL/SMC) ................................................................................................................ 33
4.2.5 TUNING AND SIMULATION OF FEEDBACK LINEARISATION WITH SLIDING MODE
CONTROLLER ............................................................................................................................. 34
2
4.3 INPUT-OUTPUT LINEARIZATION.............................................................................................. 36
4.3.1 INPUT-OUTPUT LINEARIZATION OF THE INVERTED PENDULUM..................................... 37
4.3.2 INPUT TO OUTPUT(ANGLE) LINEARIZATION WITH INTERNAL DYNAMICS STABILIZING
CONTROL(FL/ZDC) ..................................................................................................................... 39
4.3.3 TUNING AND SIMULATION OF INPUT-OUTPUT(ANGLE) LINEARIZATION WITH ZERO
DYNAMICS CONTROLLER .......................................................................................................... 41
4.4 LINEAR QUADRATIC REGULATOR(LQR) .................................................................................. 43
4.4.1 DESIGN , TUNING AND SIMULATION OF LQR CONTROLLER FOR THE INVERTED
PENDULUM ............................................................................................................................... 44
4.5 PROPORTIONAL, INTEGRAL AND DERIVATIVE(PID) CONTROL................................................ 46
4.5.1 TUNING AND SIMULATION OF PID CONTROLLER ............................................................ 47
4.6 SWING UP CONTROL OF INVERTED PENDULUM .................................................................... 49
4.6.1 SWING UP BY POSITION VELOCITY(PV) CONTROL ......................................................... 49
4.6.2 TUNING AND SIMULATION OF PV CONTROL SWING UP ................................................. 49
4.6.3 SWING UP BY ENERGY CONTROL USING PASSIVITY OF PENDULUM .............................. 51
4.6.4 TUNING AND SIMULATION OF PASSIVITY BASED ENERGY SWING UP CONTROL ............ 53
4.7 ANALYSIS AND DISCUSSION OF RESULTS ................................................................................ 55
4.7.1 COMPARISON OF PERFORMANCE ................................................................................... 55
4.7.2 COMPARISON OF ROBUSTNESS ....................................................................................... 56
4.7.2 COMPARISON OF SWING UP CONTROLLERS ................................................................... 58
CHAPTER 5: CONCLUSION AND RECOMMENDATION .............................................................. 59
5.1 CONCLUSION ........................................................................................................................... 59
5.2 RECOMMENDATION ............................................................................................................... 59
REFERENCES ........................................................................................................................... 60
APPENDICES........................................................................................................................... 62
APPENDIX A: SIMULINK DIAGRAM .............................................................................................. 62
APPENDIX B: MATLAB CODES ...................................................................................................... 69
TOTAL WORD COUNT: 14,937
3
LIST OF TABLES
Table 3.1: Parameters of the inverted pendulum from Quanser...................................................17
Table 3.2: D.C Motor Parameters...................................................................................................19
Table 4.1: Tuning of sliding mode controller..................................................................................35
Table 4.2: Tuning of LQR control parameters.................................................................................44
Table 4.3: Comparison of performance of stabilizing controllers...................................................55
Table 4.4: Comparison of robustness of stabilizing controllers......................................................57
4
LIST OF FIGURES
Figure 1.1: Quanser IP02 Inverted Pendulum on a Cart...................................................................11
Figure 1.2: Applications of Inverted Pendulum...............................................................................13
Figure 3.1 : Modelling of inverted pendulum...................................................................................17
Figure 3.2: Modelling of the d.c motor.............................................................................................19
Figure 3.3: Impulse response of nonlinear pendulum model...........................................................22
Figure 3.4: Properties of linear IP model at upright equilibrium......................................................24
Figure 4.1: Approximate Feedback linearization with Sliding Mode Control(Power Law)..............35
Figure 4.2: Tracking , noise & disturbance rejection of Approx. Feedback Lin. with SMC................36
Figure 4.3: Input-Output Linearization with pendulum angle as output..........................................38
Figure 4.4: Input-output Linearization with cart as output and stable zero dynamics(pendulum)..39
Figure 4.5:Input-Output(Angle) Linearization and Internal dynamics(cart) stabilizing control
...42
Figure 4.6:Tracking, disturbance and Noise suppression of FL/ZDC.................................................42
Figure 4.7: LQR simulation with
and
................................................................45
Figure 4.8:Tracking. disturbance rejection with noise of LQR control..............................................45
Figure 4.9: Two loop PID controller for inverted pendulum.............................................................46
Figure 4.10: PID controller tracking 0.3m cart distance from initial angle of 0.2rads
............48
Figure 4.11: Tracking and disturbance rejection of PID with noise..................................................48
Figure 4.12: Swing up, tracking and stabilization of pendulum with PV and FL/SMC......................50
Figure 4.13: Swing up, Tracking and stabilization of PV control with noise and disturbance..........50
Figure 4.14: Swing up using Energy and Passivity of pendulum......................................................55
Figure 4.15:Swing up and Tracking with disturbance and noise of Passivity-Energy Control..........55
Figure 4.16: LQR with maximum noise power of 0.7 and disturbance of 0.2...................................57
Figure 4.17: PID maximum noise of 0.1 and disturbance of 0.2.......................................................57
Figure 4.18:FL/SMC with maximum noise of 1.4 and disturbance of 0.2.........................................58
Figure 4.19: FL/ZDC with maximum noise of 0.3 and disturbance of 0.2........................................58
5
Figure A1.1: Simulink Diagram of Non-Linear Natural Dynamics with Actuator............................62
Figure A1.2:Top level diagram of physical model of IP with SimScape..........................................62
Figure A1.3: Physical model of inverted pendulum plant with SimScape.....................................63
Figure A2.1: Top level diagram of system with LQR control..........................................................63
Figure A2.2: LQR control design.....................................................................................................63
Figure A3.1: Top level diagram of approximate linearization with sliding mode control..............64
Figure A3.2: Approximate feedback linearization function block..................................................64
Figure A4.1: Top level diagram of input-output linearization with zero dynamics control...........64
Figure A4.2: Input-Output(angle) linearization with virtual control..............................................65
Figure A4.3: Zero dynamics stabilizing function block...................................................................65
Figure A5: Convert Radians to degree...........................................................................................65
Figure A6.1: Top level diagram of two loop PID............................................................................66
Figure A6.2: PID control.................................................................................................................66
Figure A7.1: Top level diagram of PV swing up control.................................................................67
Figure A7.2: PV control using pendulum angle and pendulum velocity.......................................67
Figure A7.3: State feedback Control of Cart for PV swing up.......................................................67
Figure A8 Passivity based energy swing up function block..........................................................68
Figure A9.1: Switching function for swing up control..................................................................68
Figure A9.2: Integral of Squared Error.........................................................................................68
Figure A9.3: Calculate Mean Absolute Control Action................................................................69
Figure A9.4: State Generator.......................................................................................................69
6
LIST OF ABBREVIATIONS
LQR
Linear Quadratic Regulator
SMC
Sliding Mode Control
IP
Inverted Pendulum
FL/SMC Approximate Feedback Linearization with Sliding Mode Control
FL/ZDC
Input-Output(Angle) Linearization with Zero Dynamics Control
PV
Position Velocity Control
P.O
Percentage Overshoot
PID
Proportional, Integral , Derivative control
SIMO
Single Input Multiple Output
ISE
Integral Squared Error
MACA
Mean Absolute Control Action
SSE
Steady State Error
Modulus of vector
Horizontal Component of vector quantity
Vertical Component of vector quantity
7
DECLARATION
I, AMBA ASUK J., hereby declare that no part of the work referred to in this
dissertation has been submitted in support of an application for another degree or
qualification of this or any other university or other institute of learning.
...........................................................
Signed: AMBA ASUK J.
8
COPYRIGHT
1. The author of this dissertation (including any appendices and/or schedules to this
dissertation) owns certain copyright or related rights in it (the “Copyright”) and he has given
The University of Manchester certain rights to use such Copyright, including for
administrative purposes.
2. Copies of this dissertation, either in full or in extracts and whether in hard or electronic
copy, may be made only in accordance with the Copyright, Designs and Patents Act 1988
(as amended) and regulations issued under it or, where appropriate, in accordance with
licensing agreements which the University has entered into. This page must form part of
any such copies made.
3. The ownership of certain Copyright, patents, designs, trademarks and other intellectual
property (the “Intellectual Property”) and any reproductions of copyright works in the
dissertation, for example graphs and tables (“Reproductions”), which may be described in
this dissertation, may not be owned by the author and may be owned by third parties.
Such Intellectual Property and Reproductions cannot and must not be made available for
use without the prior written permission of the owner(s) of the relevant Intellectual
Property and/or Reproductions.
4. Further information on the conditions under which disclosure, publication and
commercialisation of this dissertation, the Copyright and any Intellectual Property and/or
Reproductions described in it may take place is available in the University IP policy (see
http://documents.manchester.ac.uk/display.aspx?DocID=487), in any relevant Dissertation
restriction declarations deposited in the University Library, The University Library’s
regulations (see http://www.manchester.ac.uk/library/aboutus//regulations) and in the
University’s Guidance for the presentation of Dissertations.
9
ABSTRACT
Under-actuated systems such as the inverted pendulum on a cart have more degrees of freedom
than actuation, such systems find ready applications in modern robotics and technology. The
design and simulation of stabilizing and swing up controllers for an inverted pendulum is the
major objective of this thesis.
Linear control techniques such as the Linear Quadratic Regulator (LQR) that optimizes the control
effort/state, and the error driven Proportional Integral Derivative (PID) control are designed using
a linearized Lagrangian model of the pendulum. Also, transforming the nonlinear state space
equations via feedback linearization enables the design of nonlinear controllers using techniques
such as sliding mode control(SMC), Lyapunov stability theory and singular perturbation theory.
Furthermore, the energy of the pendulum as well as its angle and velocity are used to design
swing up controllers using principles of energy control, passivity and position- velocity (PV)
control.
The results obtained show that all the designed controllers can stabilize the pendulum with LQR
and Approximate Linearization/SMC giving superior performance and robustness. Passivity based
swing up is found superior in performance and robustness to PV control.
The controllers designed have been subject to all the constraints and conditions peculiar to the
real system and found to be satisfactory. However, practical implementation of these controllers
is highly recommended.
10
CHAPTER 1: INTRODUCTION
1.1 BACKGROUND
The inverted pendulum on a cart is a popular benchmark problem for researchers in control
systems and automation[1]. The control of an inverted pendulum is analogous to balancing a
broomstick on the index finger with the control motion constrained to a single dimension of
space. The control of an inverted pendulum is difficult due to certain properties it possesses. It is
a nonlinear system which is unstable in the upright position. Also, it is an underactuated system
due to the lack of direct control over some direction it needs to be steered. The control
techniques for such underactuated systems find ready applications in modern automation,
robotics and fault tolerant control[2].
The IP02 Single Inverted Pendulum(SIP) from Quanser Inc. is the physical pendulum model being
considered in this thesis. The IP02 consists of a linear servo base unit with a pendulum attached
to it as can be seen from Fig. 1.1.
Figure 1.1 Quanser IP02 Inverted Pendulum on a Cart
Technically, the IP02 is the base of the pendulum containing the motor driven cart. The cart
measures about a metre in length while the pendulum measures about two third of a metre
across[3]. Encoders provide measurements of two states of the system which are the cart
distance and the pendulum angle. To obtain the other states therefore would require an observer
being used or a differentiator. Gears in the motor couple the rotation of the motor into linear
motion in the cart. The motor driving the cart is specified to handle a maximum of 15volts[3].
From a control theoretic viewpoint, the inverted pendulum is a non-minimum phase system as it
has unstable zeroes. This implies the system initially steers in an opposite direction relative to the
control sense. More so, the non-minimum phase of the system makes it possess an unstable zero
dynamics and therefore difficult to use input-output feedback linearization techniques.
11
Furthermore, it is stated in [4] that the inverted pendulum is not globally controllable especially
when moving from the downward stable position, to the upright unstable position. This is
because its controllability matrix losses rank when it crosses the horizontal at
. This makes it a
difficult problem to swing up the pendulum using active control from any single controller.
In this project, feedback linearization and techniques from sliding mode, LQR and PID control are
used for the stabilization(about upright equilibrium) and tracking (along the cart) of the inverted
pendulum. Also, swing up controls are designed using position velocity control and passivity
based energy control.
Feedback linearization is a control strategy that changes the state space coordinates of a non
linear system into linear coordinates using transformation functions called a diffeomorphism [5].
Because feedback linearization is model based, the system is modelled precisely to capture
significant details about the systems dynamics. The technique of approximate linearization is then
applied to deal with the lack of involutivity in the system which makes it difficult to perform the
classical input-state linearization. Furthermore, sliding mode control is then used to design a
controller for the approximately linearized system.
Sliding mode control is a nonlinear robust control strategy[6]. The robust nature of sliding mode
control arises due to the invariance a system acquires when "sliding" on a chosen switching
surface[7]. The surface is a dynamic switching condition for the discontinuous control action that
must be applied to any system to make it a variable structure system.
Input -output linearization is also used to control the inverted pendulum. However, to deal with
the unstable internal dynamics, the system is made singularly perturbed. With a high gain
controller used in the input -output linearization, the system becomes singularly perturbed with
respect to the zero dynamics[8]. This implies the dynamics under input -output linearization
control has a fast transient and therefore the zero dynamics can be treated as an independent
system. A Lyapunov function based on the states affected by the zero dynamics is used to derive a
stabilizing controller for the zero(internal) dynamics.
Linear controllers such as LQR and PID, which make use of the linearized model in the control
design are also implemented for the cart -pendulum. The PID is designed using pole placement to
tune its parameters. The LQR controller is designed by solving the quadratic optimization problem
using the solution of the resulting Ricatti equation. A comparison is also made between the
performance of the linear controllers to the nonlinear controllers designed.
12
This project also implements swing up controls using position-velocity(PV) control and energy
based passivity control. PV control uses the angle and the velocity of the pendulum, scaled by
suitable gains to determine the reference to feed to an independent cart controller in order to
swing up the pendulum. Energy based passivity control exploits the dissipative nature of the
pendulum and by virtue of controlling the total energy and the cart , the pendulum is made to
converge in its homoclinic orbit in order to swing it up[4]. Other swing up strategies exist which
use direct pendulum energy control [9].
The motivation for the selection of this project results from the enormous applications of the
techniques involved in controlling this system to other practical systems such as segway robots,
under-actuated systems, fault control and a lot more practical systems as shown in Fig. 1.1 below.
Figure 1.2 Applications of Inverted Pendulum Control
1.2 OBJECTIVES
The objectives of this project includes:

The derivation and validation of a mathematical model for the IP02 inverted pendulum

The design and simulation of controllers for the inverted pendulum based on techniques
such as approximate feedback linearization, input-output feedback linearization, PID
control, LQR control and PV swing up and Passivity based energy control
1.3 ORGANIZATION OF THESIS
This thesis is organized into six chapters. Chapter 1 is the introduction. Chapter 2 is a review of
literature. Modelling and analysis of the dynamics of the inverted pendulum is done in chapter 3.
Chapter 4 contains the controller design, simulation and results . Chapter 5 is conclusion.
13
CHAPTER 2: LITERATURE REVIEW
The objective of control is to make systems behave in a desired way [10]. According to [11],
control is everywhere and remains a vital aspect of modern science and technology. The inverted
pendulum has since the 1950s been an interesting benchmark control problem in both research
and academia[1]. The inverted pendulum control problem is interesting and challenging due to its
unique characteristics as enumerated below:

It is nonlinear [12]

It is unstable in the upright position [13]

It is non-minimum phase with an unstable zero dynamics [4]

Its relative degree and controllability are not well defined [4]

It is underactuated with more degrees of freedom than control inputs [4]

It is a single input multiple output system and therefore has coupled dynamics

It has constraints on the size of the control action and the states [14]

It is highly sensitive to external disturbance [15]
The inverted pendulum on a cart consists of a swinging pole pivoted on a movable cart. The
pendulum swings freely about its point of pivot on the cart with no direct actuation while the cart
is directly actuated to move horizontally [4]. The inverted pendulum has two physical equilibrium
points:- the upright vertical position which is unstable and the downward pendant position which
is stable [13] . The linear inverted pendulum on a cart is one among other forms of inverted
pendulum systems such as:- the acrobot [16,17], the pendubot [16,4,18],the furuta pendulum
[4,19] and the reaction wheel pendulum [4,20]
According to [1], the principal control problem for the inverted pendulum on a cart, involves
swinging up the pendulum from the downward stable position to the unstable upright position,
and then balancing the pendulum at the upright position and further moving the cart to a
specified reference position. The control of the inverted pendulum was first tackled by Roberge
in 1960 , and then by Schaefer and Canon in 1966 [1]. Since then, several control techniques have
been studied with applications to the control of an inverted pendulum [1].
An attempt on the use of feedback linearization was done in [21] and it was proven that the
inverted pendulum is not full state linearizable. According to [4], the relative degree of the cart
pendulum is not constant and the controllability distribution does not have a constant rank since
the system loses controllability as it swings past the horizontal. This makes the application of
14
feedback linearization techniques to the inverted pendulum difficult. In [22], the technique of
approximate feedback linearization was proposed to deal with the difficulties associated with
non-involutive systems like the inverted pendulum. This involved the use of an output function
that gives the maximum relative degree and then ignoring all terms in the diffeomorphism that
makes the system non-involutive within a chosen region. The method was successfully applied in
the control of a ball and beam in [16] and then in the control of an inverted pendulum in [23]. [23]
cascaded sliding mode control with the approximate feedback linearization and implemented the
controller in the physical plant with very satisfactory performance obtained. In [24], similar
approximation techniques as in [25], are used to generate transformations needed to successfully
change the state space coordinates of the nonlinear inverted pendulum and a feedback law is
designed using a constructive backward process to both swing up and stabilize the inverted
pendulum. The performance obtained was satisfactory with a wide domain of attraction. In
[26],various sliding mode control algorithms are compared
in the
control of an inverted
pendulum after transforming the system state space using approximate feedback linearization.
Second order sliding mode control with super twisting reaching law was found to give the best
results with respect to stability, transient performance ,chattering reduction and robustness. In
[8], input-output linearization was used to control the cart inverted pendulum with the pendulum
angle used as output and integrator back-stepping control used to stabilize the unstable internal
dynamics. Stability analysis was done in the above to analyse the stability of the system using
singular perturbation theory and simulations done with good results obtained. [27] designed a
single global controller for both swing up and stabilization of the inverted pendulum using input
output linearization with respect to the pendulum angle and a mechanism to deal with the
singularity that occurs in the control action when the pendulum crosses the horizontal. Also, the
unstable internal dynamics associated with the cart was stabilized using Lyapunov stability
theory. Satisfactory results were obtained using the above methods.
A robust adaptive back stepping controller is designed in [28] for the cart inverted pendulum
using a Lyapunov based approach and a robust adaptive control law defined to deal with
modelling uncertainties. The control algorithm above exhibited a stable performance in the
presence of unknown parameters of the inverted pendulum and had a large domain of attraction
to the equilibrium position.
Linear controllers have been applied with great success in the stabilization and tracking control of
the inverted pendulum as discussed in [1].In [29], a comparison is made between a conventional
PID controller and an LQR controller for the stabilization of a rotary inverted pendulum. LQR is
15
shown to give better performance and robustness than the PID controller. An LQR controller is
designed in [30] for the cart inverted pendulum by first modelling the system and then solving the
quadratic optimization control problem. Good results were obtained both from the simulation
and experiment demonstrating the
robustness of LQR control. Other stabilizing control
techniques such as neural networks and fuzzy control have been implemented for the inverted
pendulum as discussed in [31-33].
The swing up control of the inverted pendulum is a more difficult and interesting control
problem. It is hard to use a single continuous controller to swing up the pendulum as most
controllers generate a singularity when crossing the horizontal [4] and are usually destabilizing
with respect to the pendulum angle .It was discovered in [9], that controlling the energy rather
than the position and velocity of the pendulum can make it easier to swing up the pendulum. An
energy based approached was therefore proposed by [9] where the sum of the kinetic and
potential energy of the pendulum were used to derive the precise acceleration to give the cart
such that the pendulum gains energy corresponding to the upright position. Energy based swing
up was also demonstrated by [18] but this time, the passivity property of the pendulum was
exploited to design the control law by using a Lyapunov function of the energy, cart position and
cart velocity. The major idea used by [18] was to control the cart movements such that the
pendulum converges in its homoclinic orbit where its passivity properties would naturally drive it
to the upright position. Other ideas in the swing up control of an inverted pendulum involve the
use of the angular position and velocity of the pendulum both scaled by suitable gains, to
calculate the reference position to give to an independent cart controller[34].The design of a
reference signal for the cart movement profile that would result in the pendulum swinging up is
also a common approach to swinging up a pendulum[35]. It must be noted that the swing up
strategies discussed above are all hybrid approaches as they involve the use of two different
controllers and suitably switching between both in order to swing up and stabilize the pendulum.
The hybrid solution to swinging up the pendulum is the most common in the literature for reasons
mentioned earlier. The swing-up control of an inverted pendulum using a single continuous
controller is a much harder problem.
The control problem of an inverted pendulum has been widely researched as evident in the
previous paragraphs, not just for its theoretical importance but also because it is under-actuated,
and the control of such systems are readily applied in the design of robots, airplanes, systems
under fault, hovercraft amongst others [16,4,2].
16
CHAPTER 3: MODELLING OF INVERTED PENDULUM
Modelling and simulation of the dynamics of the inverted pendulum is done in this chapter.
3.1 MATHEMATICAL MODEL OF
THE IP02 INVERTED PENDULUM(IP)
SYSTEM FROM QUANSER[16,36]
The inverted pendulum is a Single Input Multiple Output (SIMO) system as it has a one input and
two outputs. The IP02 Linear Inverted Pendulum from Quanser Inc is considered in the modelling
of the system. Table 3.1 shows the parameters of the inverted pendulum to be modelled.
SYMBOL PARAMETER
VALUE
Horizontal displacement of pendulum
Metre(m)
Vertical displacement of pendulum
Metre(m)
Displacement of Cart
Metre(m)
Pendulum Angle
Radians(m)
Length of pendulum from pivot to centre of mass
Mass of cart
Mass of pendulum
Pendulum's Moment of Inertia
Equivalent coefficient of dry friction on cart surface
Viscous damping coefficient of pendulum axis
Cart driving force
Newton(N)
Gravitational acceleration
Table 3.1: Parameters of the inverted pendulum from Quanser
Figure 3.1 Modelling of inverted pendulum
17
The modelling approach used for the inverted pendulum is based on the Euler-Lagrange
equation. The Lagrangian of the system is formed by subtracting the potential energy of the
system from the kinetic energy.
First, the kinematic equations of the system are derived below. From Fig. 3.1.
,
,
,
,
where
,
=Origin,
;
Position Vector of cart, and
,
; Let
Position vector of Pendulum
. Then
Potential Energy of system,
(3.1)
Kinetic Energy of System,
+
+
;
(3.2)
;
=
From [3], the Euler Lagrange equation of motion for mechanical systems is given by:
(3.3)
where
Lagrangian of system
;
Resultant Force/Torque.
But
But
and
(3.4)
From (3.1) & (3.2),
;
;
18
;
and
(3.5)
;
=Resultant force on cart
=Applied force-Frictional force=
= Resultant Torque on Pendulum
The actuator providing
(3.6)
= Applied Torque- Frictional Torque=
(3.7)
is a motor-gear system as shown in Figure 3.2 below
Figure 3.2 Modelling of d.c motor
From Figure 3.2 with reference to the parameters of the D.C motor in Table 3.2 and using
Kirchoff's Voltage Law; Let
Applied Control Input;
(KVL);
0.18
;
(Assumed for simplicity of model)
=
The pinion converts the applied gear torque into a linear force(F) with the torque
But
19
;
Table 3.2: D.C motor parameters[3]
SYMBOL
PARAMETER
VALUES
Armature Current
Amperes(A)
Armature Coil Resistance
Armature Coil Inductance
Back E.M.F
Volts(v)
Back E.M.F Constant
Angular Speed of motor
Rads/s
Planetary Gearbox ratio
Motor Pinion radius
Motor efficiency
Torque Constant of Motor
Motor Torque
Nm
Output torque from gear
Nm
Planetary Gearbox Efficiency
=
(3.8)
With
and
, (3.8) becomes
(3.9)
Substituting (3.9) in (3.6) gives :
Let
;
;
and
;
Therefore,
(3.10)
Substituting (3.4), (3.5) and (3.10) in the Euler-Lagrange equation in (3.3) gives:
(3.11)
20
Collecting like terms in (3.11) gives:
But
(3.12)
Putting (3.12) in (3.11) gives the Equation of motion of the pendulum as:
+
(3.13)
In compact robotic form, the equation of motion can be written as:
(3.14)
Where
However, substituting all variables into (3.14) gives (3.15).
+
(3.15)
Simplifying (3.15) gives the equation of motion of the IP as shown in (3.16) & (3.17) respectively:
(3.16)
(3.17)
Making
the subject in (3.17) gives;
Putting (3.18) in (3.16) and making
(3.18)
the subject yields equation (3.19) below
+
.
Making
(3.19)
the subject in (3.17) gives;
Putting (3.20) in (3.16) and making
(3.20)
the subject yields (3.21) below
.
(3.21)
21
Equations (3.19) and (3.21) are therefore the differential equations for the inverted pendulum
with actuator dynamics.
3.2 STATE SPACE EQUATION OF NONLINEAR INVERTED PENDULUM (IP)
SYSTEM
To express the differential equation of the IP derived in state space, the following state variables
are defined for the system:
Let
,
.
,
=
,
The state space representation of the inverted pendulum with actuator is therefore
,
(3.22) ; where
,
(3.23)
and
(3.24)
3.3 MODEL VALIDATION AND NATURAL DYNAMICS
To validate the model obtained in the previous section, a simulation is done in MATLAB/SIMULINK
with the nonlinear plant as shown in Fig. A1.1-A1.3(Appendix A). The nonlinear system is given an
impulse and allowed to naturally evolve over time. From Fig. 3.3, it is observed that the pendulum
and cart, start from an initial angle of
and
respectively. The cart moves back and
forth within a small displacement from the origin until it comes to rest after about
seconds.
The pendulum falls off from the upright position downwards in an anti-clockwise direction and
keeps swinging back and forth about the downward vertical (
with decreasing
amplitude until it comes to rest in the downward vertical position after 30 seconds. The
pendulum is unstable in the upright position as it moves away from it while it is stable in the
downward position as it converges to it. This behaviour is as expected of a physical inverted
pendulum plant with friction in both the cart and pendulum. This therefore validates the
mathematical model of the system developed.
22
Figure 3.3:Impulse Response of nonlinear Inverted Pendulum
3.4
JACOBIAN LINEARIZATION OF NONLINEAR INVERTED PENDULUM
SYSTEM[12]
A Jacobian linearization of the system about the equilibrium point(s) is required in order to probe
the nature(stability, poles e.t.c) of the system about its equilibrium points. Jacobian linearization
uses the Taylor series expansion to approximate the nonlinear state space equations with linear
ones in the vicinity of the operating/equilibrium point. Let the linearized plant have the state
space equation :
,
states as defined in (3.23)
+
;
,
Equilibrium value of states,
Control action at equilibrium . Where
,
Output at equilibrium
,
(3.26)
The equilibrium points are infinitely many but only two physical equilibrium points are relevant:
The upright vertical position with
and the downward pendant position with
with all angles measured in radians.
Linearization about the upright vertical equilibrium :
The Linearized system about the upright equilibrium is represented in state space in thus
;
(3.28)
23
=
and
.
3.5 ANALYSIS OF LINEAR SYSTEM IN THE UPRIGHT EQUILIBRIUM
The linearized system around the upright equilibrium position
has state-space
equation as shown in 3.28. The transfer matrix of the system is shown in (3.29) below:
(3.29)
The poles of the plant around the upright equilibrium are computed by finding the eigenvalues of
the matrix
. The plant is fourth order, SIMO and is found to have the four poles at
and
. The poles obtained above indicate that the plant is unstable in the
upright equilibrium point. This further reinforces the confidence in the model obtained as the
actual system is expected to be unstable in the upright position. From (3.29), the plant has the
following zeros:
and
for the cart and
for the pendulum. From these zeros,
it is clear that the system is non-minimum phase as it has zeros in the closed right half plane. Also,
the transfer matrix in (3.29) shows that the cart has an integrator. Figure 3.4 shows a plot of the
properties of the linear system around the upright equilibrium.
Figure 3.4: Properties of linear model about upright equilibrium for the inverted pendulum
24
CHAPTER 4: CONTROLLER DESIGN AND SIMULATION RESULTS
This chapter contains details regarding the design and simulation of different control algorithms
for the stabilization, tracking and swing up of the inverted pendulum. The design goals for the
controllers is such that the constraints in the actual system are met and are as listed below:

Steady state error of less than

Rise time of less than 5s for the tracking cart reference

Settling time of less than 10s for both cart and pendulum

Control input constrained to

Cart constrained to move within a distance of

Percent overshoot less than 20%
maximum
from origin
4.1 FEEDBACK LINEARIZATION
Feedback linearization has a very different meaning from Jacobian linearization and seeks as an
objective to algebraically transform a nonlinear system dynamics into a linear dynamics by means
of state feedback and a nonlinear coordinate transformation based on a differential geometric
analysis of the system [5]. Feedback linearization is one of the key tools of nonlinear design
developed during the last few decades [37]. Because feedback linearization is strongly dependent
on a good model of the system, it is not a robust control design method hence the need to
combine it with more robust control techniques to deal with modelling uncertainties or spend a
great deal of effort and time to obtain accurate models of the system. Feedback linearization
usually follows two procedures :-Input-state linearization and input-output linearization.
4.1.1 INPUT-STATE LINEARIZATION [2]
Input -state linearization aims at transforming a nonlinear system of the form
(4.1)
into the system
(4.2)
25
where
and
using a diffeomorphism (a transformation matrix consisting of the output and its derivatives),
. The form of the system in (4.2) is the canonical form of a controllable linear system
also called the Brunovsky form. If the diffeomorphism
can be found, then with the
control law
,
(4.3)
the original nonlinear system (4.1) can be transformed into the linear controllable system of form
(4.2), where
is any stabilizing linear control.
The existence of the diffeomorphism
, that allows a system to be input-state
linearizable depends on the system meeting the conditions of theorem 4.1 below:
Theorem 4.1 [2]: The system (4.1) is input-state linearizable in a domain D if and only if
1. The rank of the controllability matrix
2. The distribution
is equal to n for all
.
is involute in D. where
The first condition of theorem 4.1 is one of controllability which is a relevant requirement for the
control of any system. This is necessary if the input is to have any effect on the states being
controlled. The second condition of theorem 4.1 must be satisfied if a solution of the form
for an output that fully linearizes the system states is to exist in the partial differential
equation (4.4) below
[7] (4.4)
The diffeormorphism
is obtained by repeated differentiation of the output
obtained from the solution of equation (4.4) up to the order of the system and is used for the
nonlinear to linear state space coordinate transformations.
4.1.2 INPUT-STATE LINEARIZATION OF THE INVERTED PENDULUM[14,31]
To simplify and reduce the complexity of design we make the following assumptions:
The moment of inertia of the pendulum

equivalent viscous damping coefficient
, is assumed zero
is assumed zero.
26
Applying the assumptions above in the IP system of (4.5) gives the system in (4.6)
+
(4.5)
(4.6)
Now to further reduce the complexity of the analysis of the system in (4.6) above, according to
the method in [23], a transformation in the system input is done thus :
(4.7)
where
is the transformed input to the system.
Substituting (4.7) in (4.6) yields the simplified state space equation for the system as shown in
(4.8)
(4.8)
Letting
, then the state space equation of the inverted pendulum is represented as in
(4.9) below
(4.9)
where
and
To determine if a diffeormorphism,
can be found to linearize the complete states of the
system around the upright equilibrium position (
to theorem (4.1) for controllability and involutivity.
27
, we test the system according
Controllability test:
,
To check the controllability of the system, we compute the rank of the matrix
To compute the rank of
Because
,we first compute its determinant.
is full rank, the system is controllable.
Involutivity Test:
Testing for involutivity, the span(
If the span
) of the set
is created.
is singular, then its elements are linear combinations of one another thereby
making it involutive.
The span of the system is thus computed:
.
Span
.
28
=Determinant of span matrix
, Hence
is full rank
and therefore the system is not involutive. This implies that the inverted pendulum system fails
to meet the conditions for input-state linearization and therefore cannot be full state linearized.
4.1.3 APPROXIMATE FEEDBACK LINEARIZATION [2]
The relative degree of a system with respect to a given output
the output has to be differentiated for the control input
,is the number of times
to appear in the equation. The
involutivity condition in theorem (4.1) would not be satisfied if the relative degree of the
nonlinear system is less than its order [37]. For the inverted pendulum, this is clearly the case. For
systems of this nature, input-state linearization is usually not possible. However, Kokotovic et. al ,
developed an algorithm of approximate feedback linearization to deal with systems of this nature
in [22]. The idea lies in the fact that certain terms in the diffeomorphism
of the
nonlinear system in (4.1) make the relative degree " " of the system with respect to the output
to be less than the order " " of the system. Neglecting these terms in
would
make the linearized system have a relative degree equal to the order of the nonlinear system and
therefore input-state linearizable. Such a relative degree is called a robust relative degree. The
tasks therefore in approximate linearization is to find the output function
that can
maximize the relative degree of the system such that when approximations are done, the system
would have a robust relative degree equal to its order [37].
4.1.4 APPROXIMATE FEEDBACK LINEARIZATION OF THE INVERTED PENDULUM
To apply the algorithm of approximate feedback linearization to the inverted pendulum,a solution
is attempted to the partial differential equation
where
and a robust relative degree is sought with respect to the output
make the relative degree less than 4 in the diffeomorphism
The partial differential equation to solve is therefore
29
by ignoring the terms that
.
(4.10)
From [38], the solution to first order partial differential equations of the form in (4.11)
(4.11)
is
(4.12)
Comparing (4.10) with (4.11) and making substitutions in (4.12) gives the solution to (4.10) as
.
With the output
(4.13)
as obtained in (4.13), we proceed to find the diffeomorphism
as follows:
(4.14)
(4.15)
(4.16)
(4.17)
(4.18)
The diffeomorphism
is therefore defined as:-
The appearance of the input
in the diffeomorphism
linearization of the system using the obtained output
, makes it impossible to do a full state
. This is not surprising as the
differential equation solved to obtain the output was non-involutive. To do an approximate
feedback linearization, we ignore the coefficient (
) of the input,
in the
diffeomorphism as it is approximately zero when the system is close to the equilibrium point
30
.
Wherever this approximation is valid, a suitable controller can be designed for
nonlinear system and drive the output
to stabilize the
to 0. However, far from the equilibrium
, the
approximation made to obtain the state transformations become invalid and the system losses
relative degree. This implies the diffeomorphism obtained with the defined output is a local
diffeomorphism. Defining the state variables for the approximately linearized system as
,
,
,
, and ignoring the coefficient of
in
(4.17), the approximately linearized system is therefore shown in (4.19)
(4.19)
,
.
Now a controller is then designed for the input
using sliding mode control to introduce
robustness into the feedback linearized system.
4.2 SLIDING MODE CONTROL[2, 7 and 39]
The phenomenon of sliding modes was discovered by researchers like Anosov, Tzypkin and
Emel'yanov studying variable structure systems(VSS) [2]. VSS are systems having a discontinuity in
the right hand side of the differential equations describing their dynamics. That is:
(4.20)
VSS were discovered to have properties independent of the dynamics of the original systems in
the structure when switched at high frequency between the structures following a dynamic
switching condition called the switching surface. When this occurs, the VSS is said to be in a
sliding mode. The basic idea behind sliding mode control is to deliberately introduce sliding
modes into a system by making it variable structure using a discontinuous control action[39]. The
discontinuity in the control action is created by switching the control law
condition of a pre-specified switching surface
based on the
. The control law is designed such that the
system is driven towards the chosen surface and into a sliding mode on the surface in finite time.
In sliding mode, the system inherits the dynamics of the switching surface and becomes invariant
to any external disturbance occurring in the same direction as the control input. The control
design effort in sliding mode control consists therefore in the design of the switching surface so
the system when on the surface has the desired dynamics(i.e. the surface dynamics) and the
31
design of a discontinuous control that will drive the system to the surface and keep it there upon
intersection [7]. The system does not actually slide on the surface when in sliding mode but
switches at high frequency around the vicinity of the surface. This high frequency switching of the
system on the surface leads to the problem of chattering. Chattering is a disadvantage in the
application of sliding mode control as it can lead to damages in the actuator of physical systems if
left unchecked.
4.2.1 SLIDING SURFACE DESIGN
The sliding surface is designed to have a reduced order from the system and a desired dynamics.
The switching surface is linear time invariant and exponentially stable. The switching surface is
defined based on the error between the system states and the reference value of the states if a
tracking control is desired.
state and
where
where
state variable and
reference of
is the order of the original system. Then the switching surface
can be defined according to [6] as:
(4.21)
where
is a tuning parameter that set certain desired properties in the dynamics of the surface
like the time constant of the surface.
4.2.2 SLIDING CONTROL DESIGN
The design of the sliding control action
is based on the stability theory due to Lyapunov. The
sliding mode control action is designed such that the distance from the surface goes to zero in
finite time. A Lyapunov function based on the distance from the surface
is defined thus:
(4.22)
The control action is designed such that the derivative of the Lyapunov function
is negative
definite. This according to the stability theory of Lyapunov is necessary if the distance from the
surface
is to approach zero and therefore drive the system states to the surface,
(4.22),
. For
to be negative definite,
and
.From
must be of opposite signs. This is a
fundamental condition for the system to reach the sliding surface and therefore the existence of a
sliding mode with any designed discontinuous control action
[39]. Various laws exist that meet
this reaching condition and they are called the reaching laws. Common reaching laws include the
following: [40]
32

Constant rate reaching law which has the form
with
and
drives the switching variable towards the switching surface at
a constant rate, .

Exponential rate reaching law with the form
with
or
which drives the switching variable to the
surface exponentially.

Power rate reaching law having the form
with
or
and drives the switching
variable very fast when far from the surface but slower when close to the surface thereby
reducing chattering.
With a chosen reaching law , designing the sliding mode control action involves evaluating
and
equating it to the reaching law. The control action can be obtained by solving the resulting
equation for
This design process follows the method of equivalent control[39].
4.2.3 DEALING WITH CHATTERING [41]
As stated earlier, chattering is a common phenomena that plagues sliding mode control. To
reduce chattering , continuous functions such as saturation and relay functions that approximate
the discontinuous sign function are used, that is,
.
4.2.4 SLIDING MODE CONTROL DESIGN FOR THE APPROXIMATELY LINEARIZED
INVERTED PENDULUM(FL/SMC)
Consider now the approximately linearized inverted pendulum system (4.19) of section 4.1.4.
Let
,
and the surface is defined thus:
(4.24)
Evaluating the error derivatives in (4.24) for a constant reference yields the surface equation as
(4.25)
To design the control action, an exponential reaching law is chosen.
Thus
.
(4.26)
Evaluating from (4.25) we obtain
(4.27)
33
Equating (4.26) and (4.27) and solving for the control action , we obtain the sliding mode control
action as in (4.28)
(4.28)
The control action applied to the plant is therefore according to the transformations done in
section 4.1.3 computed thus:
and
.
(4.29)
To reduce chattering in the control law of (4.29) above, the following modifications are made:(1) A power reaching law,
(2)
is replaced by
The control action
is used instead.
.
is thus computed:
(4.30)
4.2.5 TUNING AND SIMULATION OF FEEDBACK LINEARISATION WITH SLIDING MODE
CONTROLLER
The controller designed above is implemented in MATLAB/Simulink as shown in Figs A3.1A3.2(Appendix A). In tuning the controller, the Integral of Square Error(ISE) and Mean Absolute
Control Action(MACA) are used as indices to judge the relative performance of each parameter
chosen. Knowing that
value of
determines the rate of convergence to zero of the error on the surface, a
is first selected to get a time constant of about
to have a short surface reaching time
and
on the surface.
is first set at
chosen to reduce chattering. Further
changes are then made to the parameters using the performances indices as guide as shown in
Table 4.1
34
Table 4.1: Tuning of sliding mode controller
CONTROL PARAMETERS
PERFORMANCE INDICES
COMMENT
ISE is low but MACA is high
and results in chattering.
ISE and MACA both low. Good
transient
performance
and
control action. Low chattering.
Poorer Control and transient
The tuning parameters
and
are therefore selected . Figure 4.1
shows an output from the approximately linearized system tracking a cart reference of 0.3m and
balancing the pendulum at zero degrees(upper equilibrium) from an initial position of
(0.2rads) using the parameters selected above.
Figure 4.1 Approximate feedback linearization with sliding mode control(Power Law)
From Fig. 4.1 above, it is observed that the controller satisfies the design goals. The cart has a
rise time of about 2s and a settling time of 3s.The pendulum balances in about 3.3secs. No steady
state error or overshoot is observed. The control action is below
less than
and cart displacement is
, both satisfying the physical constraints on the system. It is also observed that
the maximum angular displacement that can be given to the system and still obtain satisfactory
35
performance meeting all constraints is about
. However, ignoring all constraints
the controller maintains satisfactory performance up to about
from the balance
point. Figure 4.2 demonstrates the tracking ability of the controller in the presence of white noise
and disturbance. The noise power is about 0.02units and the a disturbance of 0.2 on both outputs
occurs at 10s, 20s and 35s. It can be observed from figure 4.5 that the controller has good tracking
and good recovery from disturbance even in the presence of noise. The control action and cart
distance remain within the constraints even with noise and disturbance being present.
Figure 4.2: Tracking, Noise and Disturbance Rejection of Approximate feedback linearization
with SMC(Power Law)
4.3 INPUT-OUTPUT LINEARIZATION [7,42]
Given the system (4.31) below
(4.31)
is the desired output from the physical system. The aim of input-output linearization (4.31) is to
obtain a state feedback control law " " , that linearizes the map between the system output " "
and a certain virtual control input " " through the state transformation
constituted of
the output and its derivatives with respect to time up to the order " ", where " " is the relative
degree of the input-output linearized system. If r is less than the order " " of the nonlinear
system, then the nonlinear system is only partially feedback linearized and therefore consists of a
feedback linearized system controllable by the virtual linear control " " and an
36
uncontrollable(with respect to input " ") internal dynamics of order "n-r " as shown in (4.32)
below.
(4.32)
,(Internal dynamics)
Output:
From (4.32), it is seen that the virtual control input " " only affects the feedback linearized
system hence the internal dynamics is uncontrollable by the virtual control. The internal dynamics
must therefore be stable for the nonlinear system to be stabilizable by the feedback linearized
virtual control " ". However, for an unstable internal dynamics, an input-state linearization must
be done if possible or a way to deal with the unstable zero dynamics designed for input output
linearization to be applied. Input-output linearization becomes input- state linearization if the
relative degree is equal to the order of the system.
4.3.1 INPUT-OUTPUT LINEARIZATION OF THE INVERTED PENDULUM
Given the inverted pendulum system
+
(4.33)
To design an input-output(angle) linearization control for the output
differentiate
repeatedly until
in (4.33) above, we
appears as shown below:
. Where
.
37
and
are designed by pole
placement using the characteristic equation
and the linearizing control action
is:-
.
(4.34)
The relative degree of the feedback linearized system is
order
and therefore an internal dynamics of
exists. To analyze the stability of the internal dynamics is computationally intensive and
therefore the zero dynamics would be analyzed instead. The zero dynamics occurs when the
linearized states
,
have been driven to zero by
. The zero dynamics is therefore given as:
.
It can be seen that the zero dynamics has two poles at the origin and is therefore unstable. A
simulation of this controller is shown to confirm the instability of the zero dynamics as shown in
figure 4.2 below.
Figure 4.3: Input-Output Linearization with Pendulum angle as output and unstable zero
dynamics(cart)
As a result of the unstable zero dynamics in the cart above, another input-output linearization will
be attempted with the cart as output.
Let
. Where
Cart reference position, then:
,
. Where
38
and
are designed by placing poles in the characteristic equation,
. The
linearizing control action is therefore:
The relative degree of the feedback linearized system is
and therefore a zero dynamics of order
exists. Analysis of the zero dynamics gives the system:-
(4.35)
From (4.35), it is hard to tell the stability of the zero dynamics, hence a simulation is done with
the cart set to track a reference of 1meter and the results shown below:
Figure 4.4: Input-Output Linearization with Cart as Output and stable zero dynamics (pendulum)
From Figure 4.3, it can be inferred that the zero dynamics with the cart distance as the output of
linearization is stable but oscillatory.
4.3.2 INPUT
TO OUTPUT(ANGLE) LINEARIZATION WITH INTERNAL DYNAMICS
STABILIZING CONTROL(FL/ZDC)
In this section, a controller is proposed to stabilize the unstable internal dynamics associated with
the system obtained after performing an input-output linearisation with respect to the pendulum
angle. The controller is based on the theorem due to Lyapunov and the idea of singularly
perturbed systems as done in [8,27]. Two controllers are therefore designed and combined to
39
control the system. The first controller is the input-output(angle) linearization controller in eqn.
(4.34) designed with angle as output. The second controller is the proposed Lyapunov based
controller. By setting the controller gains such that the system exhibits two -time scale
behaviour(fast dynamics for pendulum and slow dynamics for cart) [27], the system is made
singularly perturbed. The two dynamics of the singularly perturbed system can therefore be
independently stabilized by both controllers based on the principle of singular perturbation
theory .
Theorem 4.2 (Lyapunov theorem for local stability)[37]: Consider the system (43). If in
containing the equilibrium point
, there exists a function
with
continuous first order derivatives such that

is positive definite in

is negative definite in D,
Then the equilibrium point
is stable
According to the theorem of Lyapunov, a stable system has a Lyapunov function that is positive
definite with a derivative that is negative (semi) definite . In order to design a stabilizing control
for the zero dynamics, a new control input
is defined for the feedback linearized system in
(4.34) as below:
(4.33)
where
zero dynamics stabilizing control. Substituting
in the inverted pendulum system in
the following closed loop system is obtained:
(4.36)
To design
, the Lyapunov function
is defined based on the states in the internal dynamics:
such that
with
cart reference position, and
. where
cart reference velocity
The derivative of the Lyapunov function is therefore:
40
and
and
+
+
But
. Therefore,
simplifies as given in (4.37)
+
(4.37)
The control action
is designed to make the internal dynamics asymptotically stable by making
negative definite as shown below:
where
(4.38)
Equating (4.37) to (4.38) and substituting for
from (4.36), the control action
where
The total control action
is derived thus:
(section 4.3.1 )
(4.39)
applied to the nonlinear plant is therefore the sum of the input to
angle linearization control and the zero dynamics control as shown in (4.40) below:
(4.40)
However, it is realized that doing the summation in (4.40) above, eliminates
control for the feedback linearized output
which is the virtual
. Therefore, a difference was taken instead and the
control law (4.41) obtained and found to stabilize the system.
(4.41)
4.3.3 TUNING AND SIMULATION OF INPUT-OUTPUT(ANGLE) LINEARIZATION WITH
ZERO DYNAMICS CONTROLLER
Figures A4.1-A4.3(Appendix A) show the MATLAB/Simulink implementation of the controller.
Tuning the controller above involves selecting the poles
control
which determines the values of
and
for the feedback linearized virtual
. The parameters
determine the rate
of convergence to zero of the states in the internal dynamics. After trying various values, the
parameters for the controller are fixed by placing poles at
and
and
chosen as
and
and
making
respectively. Figure 4.4 presents
a simulation of the system with this control law tracking a cart reference of 0.3m from an initial
angular position of about
stabilizes the pendulum after
. From Figure 4.5, it can be inferred that the controller
and tracks the cart after
41
with a rise time of
without
overshoot. The control action used is within the interval
which meets the
constraint on the input. The cart also stays within the constraints of the cart length i.e.
and both pendulum and cart have zero steady state error. Further investigation revealed that the
maximum angular displacement that can be given to the system and still obtain satisfactory
control meeting all constraints is about
. Also, ignoring the constraints in the
system shows that the controller is almost globally attractive. It can stabilize the pendulum from
any arbitrary initial position except at
and
where
, as
.
Figure 4.6 demonstrates the tracking ability of the controller in the presence of noise and
disturbance. The noise power is about 0.02 and a disturbance of 0.2 on both outputs occurs at
10s, 20s and 35s. It can be observed from figure 4.6 that the controller track the reference
satisfactorily and has good recovery from disturbance even in the presence of noise. The control
action and cart distance remain within the physical constraints even with the addition of noise
and disturbance.
Figure 4.5: Input-Output(angle) Lin. and internal dynamics (cart) stabilizing control
42
added.
Figure 4.6: Tracking, disturbance rejection and noise suppression of FL/ZDC
4.4 LINEAR QUADRATIC REGULATOR(LQR) [44,45,43]
The linear quadratic regulator(LQR) is an optimal control strategy that seeks the best possible
control solution for a system by minimizing a quadratic cost function subject to the constraint of
stabilizing the system being controlled [2]. The cost functional is a quadratic function of the
control input,
and the desired states to be optimized,
as in (4.42) below.
, where
and
.
[44]
(4.42)
The optimization of the cost functional in (4.42) is subject to the constraint of stabilizing the
Linear Time Invariant(LTI) system
;
. Where
is stabilizable and
is observable according to definition (4.2) .
Definition 4.2: The pair
is stabilizable if there exist
and the pair (A,C) is detectable if there exist
such that
such that
is Hurwitz
is Hurwitz.
The design of an LQR controller consists first in checking the linear system for controllability and
observability. It was calculated that the controllability matrix
observability matrix
and the
of the linear inverted pendulum system around the
upright equilibrium position both had full rank, hence the linear system is controllable and
observable. The next step in the design of LQR controller consists in the selection of the weights
and
which place penalties on the states
and control action
respectively as well as the
solution to the optimization problem associated with the cost functional,
43
[45]. The Ricatti
equation resulting from the optimization problem of a linear quadratic regulator is shown in
(4.43) and must be solved to obtain a positive definite solution ,
control action
needed to evaluate the optimal
according to equation (4.44):
(4.43)
,
,
where
.
(4.44)
According to [45], LQR has good stability margin
and
sensitivity properties. If the states of a system are not readily available, LQR is combined with a
state estimator such as a Kalman filter. This is now called an LQG(Linear Quadratic Gaussian)
control. In this thesis, the pendulum states are assumed noiseless and available, hence the choice
of LQR control. Also an integrator is not used with the LQR because the cart has a type 1 transfer
function and therefore has an integrator.
4.4.1 DESIGN , TUNING AND SIMULATION OF LQR CONTROLLER FOR THE INVERTED
PENDULUM
The LQR controller implementation in MATLAB/Simulink is shown in Fig. A2.1-A2.2(Appendix A)
The MATLAB command
is used to design the controller by choosing the
positive definite and symmetric matrices
and
and
as
[45],
. The matrices ,
for the system linearised around the upright equilibrium position as defined in section 3.2
are used . Table 4.2 gives a succession of values tuned before settling at the chosen value of .
Table 4.2: Tuning of LQR control parameters.
CONTROL PARAMETERS
PERFORMANCE INDICES
COMMENT
Poor performance, takes long
to
stabilize
system.
Also
control action not optimized.
Improved
performance(transient)
and
judicious use of control action.
Transient
control
performance
action
and
optimization
poorer.
Figure 4.7 shows a simulation of the nonlinear system with the designed LQR control above
applied with initial angle of
and cart reference of
44
.
Figure 4.7: LQR Simulation with
From Fig. 4.7, the settling time is
for the cart is about
.
for both the cart distance and pendulum angle. The rise time
. The control action is within
and satisfies the input constraint. The
cart displacement is also within the constraints of the system. There is no overshoot observed in
the cart and the steady state error is zero for both the cart and pendulum.
Figure 4.8 shows the tracking ability of the controller in the presence of white noise with a power
of 0.02 and disturbance of 0.2 on both outputs(cart and pendulum). The disturbance occurs at
10s, 20s and 35s. It is observed from figure 4.8 that the controller has good tracking and good
recovery from disturbance even in the presence of noise which is always present in actual
systems. The control action and cart distance remain within the constraints even in the presence
of noise and disturbance.
Figure 4.8: Tracking, disturbance rejection with noise of LQR control
45
4.5 PROPORTIONAL, INTEGRAL AND DERIVATIVE(PID) CONTROL[46]
PID control is one of the most widely used control method today with wide applications in
industrial processes [46]. PID controller consists basically of three parts: The proportional control
which drives the corrective action based on the error, the integral control which removes steady
state error and the derivative control which dampens oscillation and ensures stability of control.
The classic PID controller is the three term controller shown in (4.45) which contains the three PID
components mentioned above.
, where
error,
,
and
are the proportional, integral and
derivative gains respectively.
(4.45)
In this thesis, a PID controller is designed to stabilize the inverted pendulum in the upright
vertical equilibrium .The design of the PID controller for the inverted pendulum uses two PID
control blocks to close the loops from each output
) to the input as shown in Figure 4.9.
Figure 4.9: Two loop PID controller for inverted pendulum
Note:-
Cart PID control,
angle
to system input,
input
,
Pendulum PID control.
transfer
Desired Pendulum angle,
Transfer function from pendulum
function from cart position
to system
Desired cart position.
From Figure 4.9 , it is seen that the control action to the plant , is given as:
(4.46)
But
and
(4.47)
, Collecting terms in , and making
46
the subject we get;
(4.48) Substituting
and
functions
respectively in (4.48) yields the closed loop transfer
and
which clearly shows that the characteristic equation for both the cart and pendulum is ;
(4.49)
But
Plant Transfer Matrix
and
and
.
Substituting
into (4.49) and
simplifying the equation yields the characteristic equation of the closed loop system in (4.50)
(4.50)
Using the method of pole placement, the PID gains are designed by assigning the closed loop
system the desired poles
. The desired characteristic equation is
thus:
(4.51)
Expanding, (4.51), collecting like terms and comparing the coefficients to (4.50), gives the system
of equations needed to solve to design the PID gains.
4.5.1 TUNING AND SIMULATION OF PID CONTROLLER
Figure A6.1-A6.2 (Appendix A) show the MATLAB/Simulink implementation of the PID controller.
The PID gains are calculated by placing the poles of the closed loop system at
. The above poles are chosen to give a settling time of at most 10second
using less aggressive control action. Using faster poles were observed to make the control too
aggressive and therefore violate the constraints within the system. Figure 4.10 shows the
simulation result. A settling time of 9seconds and 4seconds is obtained for the pendulum and
cart respectively which is not optimal and therefore suggest the use of much faster poles. The rise
time was below 2seconds for both cart and pendulum. The cart had no steady state error but an
overshoot of
is present. This high overshoot suggest an increase in the derivative gain of
cart PID controller. The reference of 0.3m in the cart is tracked satisfactorily and the pendulum
can be stabilized from an initial angle of at most
. With all constraints ignored,
the PID can stabilize the system for all initial angles less than or equal to
47
.
Figure 4.10: Plot of the PID controller tracking 0.3m cart distance from an angle of 0.2rads
Figure 4.11: Tracking and disturbance rejection of PID with noise
From figure 4.11, it can be deduced that the tracking of PID in the presence of noise and
disturbance is very poor in the cart. The angle however is well controlled even with noise. This
could be as a result of non optimal tuning of the PID parameters as well as a fundamental
limitation of PID controller with regard to the inverted pendulum system.
48
4.6 SWING UP CONTROL OF INVERTED PENDULUM
The objective in swing up control is to move the pendulum from the downward position to the
unstable upright position by moving the cart horizontally. As noted in chapter two, several
techniques have been applied in the solution of this problem with the most common methods
being the energy control, the passivity based control or the use of the position and velocity of
the pendulum to determine how the cart should be moved such that the pendulum gains enough
momentum to swing up[34]. The position and velocity control (PV) approach as well as the
passivity control methods are both demonstrated in this section.
4.6.1 SWING UP BY POSITION VELOCITY(PV) CONTROL [34]
PV control uses the pendulum angle and angular velocity to generate the reference cart positions
to be used by an independent controller designed to steer the cart to any desired position. A state
feedback control for the cart position is designed which controls the cart using its position and
velocity
. A PV controller is then designed using the pendulum angle and velocity
and the output from PV controller fed as reference to the cart controller as shown in
Fig. A7.1(Appendix A) The state feedback for the cart is designed as
with the gains
and
chosen to give the cart a fast transient response. The
PV controller for the pendulum is designed as
with the gains
and
chosen to drive the pendulum away from the pendant position using the smallest displacement of
the cart as possible.
is the reference distance fed to the cart.
4.6.2 TUNING AND SIMULATION OF PV CONTROL SWING UP
The complete Simulink/MATLAB design for the controller is shown in Appendix A(Figs A7.1-A7.3).
The gains
and
are chosen using a trial and error approach but keeping in mind that larger
values would generate bigger reference values for the cart and therefore violate the constraint on
cart length. Tuning the parameters for almost equal values of the ratios
guarantee swing up as long as
exceeds
and
exceeds
and
was found to
. Also a dynamic saturation is
included in the output of the PV controller to restrict the range of values it calculates to the
maximum and minimum cart distance of
mode controller designed in section 4.2.4 at
. After swing up, control is switched to the sliding
. The wide domain of attraction
of the
sliding mode controller is exploited here as the PV controller can only swing the pendulum to
about
without violating the constraints on the cart length. The feedback linearized controller
with zero dynamics control(FL/ZDC) was also used to stabilize the pendulum successfully. Figure
49
4.12 shows the response of the pendulum using controller with parameters set at
,
and
with a cart reference of 0.3m to track after swing up. From
Figure 4.12, it is observed that swing up occurs after about 40 seconds and the sliding mode
controller stabilizes the pendulum in about 1second. The control voltage and cart variation are
both within the constraints of the system. The peak variation of the cart distance is observed to
lie between
and
while the control action varies between
.
Figure 4.12 :Swing Up, Tracking and Stabilization of pendulum with PV and FL/SMC
Figure 4.13:Swing Up, Tracking and Stabilization of PV control with noise and disturbance
50
Figure 4.13 shows the PV controller can resist disturbance(at 10s,20s,35s,70s,80s,90s) of about
0.2 in both output with small noise also added and all system constraints met. This shows it is
robust. Chattering on the controller due to the discontinuous nature of sliding mode control is
observed but it is small and can be ignored.
4.6.3 SWING UP BY ENERGY CONTROL USING PASSIVITY OF PENDULUM [18,4]
This method of swinging up the pendulum exploits the fact that the pendulum is a dissipative
system. According to [4], this means there is no internal creation of energy within the system and
so the storage energy function
the available storage energy
of the system at any time is less than or equal to the sum of
at the initial time plus the total energy
the system from external sources in the interval
.
supplied to
captures this idea mathematically.
[4] (4.52).
The dissipative nature of the inverted pendulum makes it possess a trajectory where the total
energy of the system is zero. Such a trajectory is a homoclinic orbit that joins the saddle
equilibrium point(upright position) to itself. The swing up control tasks therefore lies in designing
the control action to take the system to this homoclinic orbit by using an appropriate Lyapunov
function candidate[18].
To apply this technique, the system in the form of (3.13) is shown in (4.53) for convenience.
(4.53)
Ignoring the inertia
and rotational friction
of the pendulum since they are small and
negligible, the equation of motion in (4.53) now reads thus:
(4.54)
where
,
To check the passivity of the system, we evaluate the derivative of the total energy of the system
and check if it satisfies the mathematical condition for passivity in (4.52). Note that
symmetric and has a determinant
making
is
which is always positive
a positive definite matrix for all
. Also it can be observed that :
(4.55)
An important result to be used later when establishing the passivity of the pendulum.
51
PASSIVITY OF THE INVERTED PENDULUM(IP): Let =Total Energy of Pendulum, then
(4.56)
where
is the Kinetic Energy and
is the Potential Energy of the pendulum when
starting from the downward pendent position.
(4.57)
But
(4.58)
Hence,
(4.59)
But from (4.54),
(4.60)
Putting (4.60) in (4.59) and simplifying, we obtain
(4.61)
Substituting (4.55) in (4.61) we get
(4.62)
Integrating (4.62) on both sides we get:
(4.63)
Assuming at time
the pendulum swings from an angle of
, then
, and
(4.64)
Equation (4.64) establishes the passivity property of the inverted pendulum. The homoclinic orbit
of the pendulum can therefore be computed as the trajectory corresponding to zero energy and
zero velocity of cart. i.e.
and
; Substituting these values in the energy equation in
(4.57) gives the homoclinic orbit as:
.
(4.65)
Our goal now is to design a controller that is attracted to the homoclinic orbit above. Consider
now, the Lyapunov function candidate
:
(4.66)
52
We defined
in terms of the variables that need to be stabilized(made zero) in order to be in the
homoclinic orbit . The control action
can therefore be designed to make
negative definite.
;
Recall that
Putting
in
;
we obtain
(4.67)
But from (4.54)
(4.68)
Computing (4.68) with substituted values we obtain
(4.69)
Putting (4.69) in (4.67) :
(4.70)
We desire
to be negative definite for asymptotic stability, so we let
(4.71)
Equating (4.70) to (4.71) and making
the subject after relevant computations yields the control
action designed as,
and
(4.72)
From (4.72), it can be seen that for this control law to be valid, the denominator must be non
zero, this means
parameters
,
. This inequality must be considered while tuning for the
,
,
4.6.4 TUNING AND SIMULATION OF PASSIVITY BASED ENERGY SWING UP CONTROL
The controller designed above was implemented in MATLAB/Simulink as shown in Figure A8.1
(Appendix A). The parameters for the controller were selected as
,
.
is chosen to meet the inequality
give a fast convergent rate.
,
while
,
is chosen to
is selected to limit the variation on the cart length needed for
53
swing up to occur. From Fig. 4.14, the pendulum swings constantly at increasing amplitudes from
an original position of
until it reaches
where the switchover to a linear
stabilizing LQR controller is done. It can be observed from Fig. 4.14 that the swing up occurs after
about
seconds and the LQR controller stabilizes the pendulum in less than 1 second. The energy
of the pendulum can be seen from Fig. 4.14 to approach zero from a value of
after
4seconds. The control action used is within the constraints of the system and lies between
The cart distance varies between
.
which satisfies the constraint on cart length. This swing
up strategy was observed to have a wide domain of attraction as it could swing the pendulum up
to about
of the vertical equilibrium position while meeting all system constraints.
This controller can therefore be combined with any stabilizing controller in a hybrid control
structure to swing up the inverted pendulum.
Figure 4.15 shows the performance of the swing up controller in the presence of noise(noise
power: 0.004units) and disturbances. It is evident from the figure that the controller maintains
good swing up and tracking performance while rejecting disturbance and noise. The effect the
noise had on the controller was to delay the swing up time from 4seconds to 6seconds and to
reduce the domain of attraction of the swing up controller from
to about
if all constraints
within the system must be met. The control action lies within the constrained value of
Figure 4.14: Swing Up using Energy and Passivity of Pendulum
54
.
Figure 4.15: Swing Up and tracking with disturbance and noise of Passivity -Energy control
4.7 ANALYSIS AND DISCUSSION OF RESULTS
This section discusses the results obtained above with a focus on how the controllers compare to
each other in terms of performance and robustness.
4.7.1 COMPARISON OF PERFORMANCE
The indices for comparing the performance of the controllers above include:- The Rise Time
The Settling time
,
, Integral Square Error(ISE), Mean Absolute Control Action (MACA), Steady
State Error(SSE) and Percent Overshoot(P.O). Table 4.3 shows a comparison of the performance
of the stabilizing controllers.
Table 4.3: Comparison of Performance of stabilizing controllers
Controller
PID
LQR
FL/SMC
2s
2
2s
FL/ZDC
2s
MACA
0.3563
ISE
0.8953
0.8281
P.O
33.3%
0%
0%
SSE
0
0
0
0.2499
0.0855
0.7854
0%
0
From Table 4.3, we see that LQR ,FL/SMC and FL/ZDC have better performance in all indices while
PID is the poorest. All the designed controllers have no steady state error. PID has P.O of 33.3%.
LQR, FL/ZDC and FL/SMC have no overshoot in their response. In terms of the control action,
FL/ZDC uses the least control action to stabilize the pendulum. LQR and FL/SMC have better
transient speed than FL/ZDC and PID. However, FL/ZDC produced much smoother transient phase
55
and eliminates large error faster and therefore has the best ISE and MACA. It can be observed
that the nonlinear controllers(FL/SMC and FL/ZDC) use less control energy in stabilizing the
system compared to the linear controllers(PID and LQR). The plots showing these properties are
shown in the sections where the simulation for the controllers are presented.
4.7.2 COMPARISON OF ROBUSTNESS
Robustness analysis for the controllers is done based on the following criteria:
Maximum output disturbance rejected by the controller.

Maximum power of white noise the controller can tolerate.

Maximum basin of initial conditions where the controller is attractive to the equilibrium
upright position with and without consideration for system constraints

Maximum variation in model parameter(length) that the controller can tolerate.
Table 4.4 compares the robustness of the controllers. Figures 4.16 to 4.19 show the plots of the
worst case output noise the controllers can tolerate. From table 4.4, it can be deduced that Sliding
Mode Control has the most tolerance for noise as can be seen from figure 4.18. This is due to the
invariance of the controller to disturbance when on the surface. LQR which is also a robust
controller has the next best tolerance for noise as evident in table 4.4 and figure 4.16. All the
controllers can withstand about the same level of disturbance. PID is however found to be the
most robust controller to parametric variation. This is because its design is less heavily dependent
on the model of the system but rather on the error in the measured outputs. The Feedback
Linearized controller with a compensator for the unstable zero dynamics has the largest basin of
attraction because it is based on an almost global linearization of the system. It is however poor in
robustness to noise compared to LQR and FL/SMC. This is because its accuracy depends on the
measured states since it is a completely model based controller.
Conclusively, it can be said that LQR is a fantastic controller especially where the states are
available. However, the use of an estimator like the Kalman filter is known to reduce the
robustness of LQR. Sliding mode control(SMC) on the other hand is a very good controller for
stabilizing a pendulum with good robust properties. However, the use of a feedback linearized
system with the SMC reduces the robustness of SMC. Being a nonlinear controller, it has a wider
domain of attraction to the equilibrium point. Furthermore, stabilizing the zero dynamics of the
input-output linearized system proved to allow the control of the non-minimum phase system
using input-output linearization which would have otherwise been impossible.
56
Figure 4.16: LQR with maximum noise power of 0.7 and disturbance of 0.2
Table 4.4: Comparison of robustness of stabilizing controllers
Controlle
r
PID
LQR
FL/SMC
FL/ZDC
Max. Output
Disturbance
(rad/metres)
Max. Noise
Power
Basin of
Attraction
(Constrained
Unconstrain
ed Basin of
Attraction
0.1
0.7
1.4
0.3
Figure 4.17:PID maximum noise of 0.1 and disturbance of 0.2
57
Max. Parameter
Variation
Tolerated
Figure 4.18: FL/SMC with max noise power of 1.4 and disturbance of 0.2
Figure 4.19:FL/ZDC with maximum noise power of 0.3 and disturbance of 0.2
4.7.2 COMPARISON OF SWING UP CONTROLLERS
It is observed that swing up by passivity based energy control shows superior performance to
swing up by Position Velocity control. The passivity based control swings up the pendulum in just
about 4seconds compared to the PV control which takes about 39seconds to swing . The region
of attraction of the energy based swing up is much wider
to
to
than that of PV control
and therefore can be used with stabilising controllers having a smaller domain of
attraction. Also, the disturbance and noise rejection of the energy based controller is much better
than that of the PV controller. However, the PV controller is easier to design but more difficult to
tune.
58
CHAPTER 5: CONCLUSION AND RECOMMENDATION
5.1 CONCLUSION
The design of stabilizing and swing up controllers for the linear Inverted Pendulum(IP) using
techniques from Feedback Linearization, Sliding Mode Control, Lyapunov stability theory,
Singular Perturbation theory, PID control, LQR control, PV control and Passivity based Energy
control have been undertaken in this thesis. A modelling of the physical pendulum system from
Quanser Inc. have been done and shown to be consistent with the behaviour of the real system.
The controllers designed have been simulated on the computer using Simulink/MATLAB at
conditions set up to be as close to the real plant as possible. All the controllers have been found
to meet the design goals with acceptable performance. Sliding mode control(SMC) and LQR have
been found to be the most robust controllers in terms of disturbance and noise rejection. SMC
and LQR were also found to have the best performance. The non-linear controllers designed are
based on SMC and feedback linearization and have been found to have wider basins of attraction
to the upright equilibrium and better use of control energy when close to the equilibrium point
than their linear counterparts.
A novel way of stabilizing the unstable zero dynamics associated with the feedback linearization
of the non minimum phase inverted pendulum system have been proposed and demonstrated to
be stabilizing. The transient performance of the cart was observed to be a little degraded using
the above approach. This is because a slow cart dynamics is a fundamental requirement for
making the system singularly perturbed.
Swinging up the pendulum using a passivity based energy approach was found to be superior in
performance and robustness compared to the direct use of the pendulum's angle and velocity.
5.2 RECOMMENDATION
To improve on the work done and carry out further investigations, the following
recommendations are suggested:
Implementation of the controllers designed in real time on an actual inverted pendulum.

Improve and extend the techniques used in this thesis to more complicated underactuated systems such as the double inverted pendulum on a cart.

Design linear and nonlinear observers/estimators to generate all the states of the system
rather than assume the availability of all states.
59
REFERENCES
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
[20]
[21]
[22]
Boubaker, O., “The inverted pendulum: A fundamental benchmark in control
theory and robotics”, Education and e-Learning Innovations (ICEELI), 2012 International
Conference on, vol., no., pp.1, 6, 1-3 July 2012
A. Choukchon-Braham, B. Cherki, M. Djemai, K. Busawon, “Analysis and Control of
Underactuated Mechanical Systems ”, Springer, Switzerland, 2014
Quanser Inc. "IP02 Linear Inverted Pendulum and Linear Pendulum Gantry Experiments
User Manual", 2013
Isabelle Fantoni and Rogelio Lozano , “ Nonlinear Control for Underactuated Mechanical
Systems”, Published by Springer, London, 2002.
Freddy Garces, Victor M. Becerra, Kevin Warwick et all, “Strategies for Feedback
Linearization ”, Springer, London, 2003
J. E. Slotine, W. Li “Applied Nonlinear Control” Prentice Hall, 1991
William S. levine, “The Control handbook, Control System Advanced Methods ”, CRC Press,
New York, 2011
J. Khalil, C. Monia "Cascade control for nonlinear non-minimum phase system based on
backstepping approach and input output linearization" , International Journal of Control,
Energy and Electrical Engineering (CEEE), Vol 1, pp 43-49.
K. J. Astrom, K. Furuta, "Swinging Up a pendulum by Energy Control", Automatica, Vol 36,
2000, pp 287-295.
J. Schaefer, R. Canon, “On the control of unstable mechanical systems ”, Proceedings of
the third Automatic and Remote Control, vol 3, pp. 12 -24, 1966.
IEEE Control Systems, “The Impact of Control Technology: Overview, Success Stories, and
Research Challenges ”, 2nd Edition,2011.
K. Ogata, “Modern Control Engineering ”, Prentice Hall, 1997.
Magdi S. Mahmaid, Yuanqing Xia, “Applied Control Systems Design”, Published by
Springer, London, 2012, pp 237-242.
C. Tao, J. S. Taur, T. W. Hsieh and C. Tsai, “ Design of a fuzzy controller with fuzzy swing up
and parallel distributed pole assignment schemes for an inverted pendulum and cart
system”, |Control Systems Technology, IEEE Transactions on, Vol. 16, 2008, pp. 12771288.
S. Brock, “ Practical Approach to Fuzzy Control of Inverted Pendulum”, in Industrial
Technology, 2003, IEEE International Conference on, 2003, pp. 31-35.
Xin Xin, Yannian Liu, “Control Design and Analysis for Underactuated Robotic Systems ”,
Published by Springer, London, 2014.
M. W. Sponge, “The swing up and control problem for the Acrobot ”, IEEE Control Systems
Magazine, vol 15, pp 72-79, 1995.
I. fantoni, R. Lozano, M. W. Sponge, “Energy based Control of the Pendubot ”, IEEE
Transactions on Automatic Control, vol 45, pp. 725-729, 2000.
J. A. Acosta, “Furuta's pendulum; "A conservative nonlinear model for the theory and
practice ”, Mechanical problems in Engineering, 2010.
D. J Block, K. J Astrom, and M. W Sponge, “The Reaction Wheel pendulum ”, Published by
San
Rafael: Morgan and Claypool, 2007.
B. Jakubczyk and W. respondek, “On the linearization of control systems”, Bull. Acad.
Polon. Sc. Math, 28:517-522, 1980.
J. Hauser, S. Sastry, P. Kokotovic, “Nonlinear Control via approximate input-output
Linearization ”, IEEE Trans. Autom. Control 37(3), 1992, pp 392-398.
60
[23]
C. Aguilar, R. Hirschorn, “Stabilization of an inverted pendulum”, Report on Summer
NSERC Research project Queens University at Kingston, Dept of Mathematics and Statics,
Summer 2002.
[24]
D. Ingram, S.S Willson, Ph. Mullhaupt , D. Bovin “Stabilization of the cart pendulum system
through approximate manifold decomposition.”, Research Gate, Jan. 2011.
[25]
J. Hauser, S. Sastry, P. Kokotovic, “Nonlinear Control via approximate input-output
Linearization ”, IEEE Trans. Autom. Control 37(3), 1992, pp 392-398.
[26]
S. Mahjoub, F.Mnif and N. Derbel, “Second Order Sliding Mode Control Applied to an
Inverted Pendulum ”,Sciences and Techniques of Automatic Control and Computer
Engineering(STA), Sousse, 2013.
[27]
B. Srinivasan, P. Huguenin, K. Guemghar, and D. Bonvin “A Global Stabilization Strategy
for
an Inverted Pendulum”, IFAC World Congress , Spain, 2002.
[28]
Shubhobrata Rudra and Ranjit Kumar Barai "Robust Adaptive Backstepping Control of
Inverted Pendulum on Cart System" International Journal of Control and Automation
Vol. 5, No. 1, March, 2012.
[29]
Jose, A. Augustine, C. Shinu, M. M and K. Chacko. “ Performance Study of PID Controller
and LQR Technique for Inverted Pendulum”, World Journal of Engineering and Technology,
Vol. 3, 2015, pp. 76-81.
[30]
Xu Cao, Nian Feng Li, “Robust Controller Design for Inverted pendulum”, Advanced
Material Research vol. 631-632, 2013, pp. 1342-1347.
[31]
H. T. Cho and S. Jung, “ Neural Network position tracking control of an inverted pendulum
and XY table robot”, Intelligent Robots and Systems, 2003.(IROS 2003), Proceedings,
IEEE/RSJ International Conference on, 2003, pp. 1210-1215.
[32]
C. Tao, J. S. Taur, T. W. Hsieh and C. Tsai, “ Design of a fuzzy controller with fuzzy swing up
and parallel distributed pole assignment schemes for an inverted pendulum and cart
system”, |Control Systems Technology, IEEE Transactions on, Vol. 16, 2008, pp. 12771288.
[33]
S. Brock, “ Practical Approach to Fuzzy Control of Inverted Pendulum”, in Industrial
Technology, 2003, IEEE International Conference on, 2003, pp. 31-35.
[34]
Quanser Consulting, “IP02 Self Erecting Inverted Pendulum User's Guide”, Quanser
Consulting Inc, 1996.
[35]
Vinodh K. E, Jovitha J., "Stabilizing Controller Design for Self Erecting Single Inverted
Pendulum using Robust LQR" , Australian Journal of Basic and Applied Sciences, 7(7),2013
494-504.
[36]
Vinodh Kumar E., Jovitha Jerome "Robust LQR Controller Design for Stabilizing and
Trajectory Tracking of Inverted Pendulum", International Conference On DESIGN AND
MANUFACTURING, IConDM 2013, Procedia Engineering, Vol 64, 2013, pp 169-178.
[37]
A. Isidori, “Nonlinear Control Systems: an introduction ”, Springer, Berlin, New York, 2
edition, 1989.
[38]
A.D Polyanin, V.F Zaitsav, A. Moussiaux, “Handbook of first order Differential Equations ,”
Taylor & Francis, 2002.
[39]
Vadim I. Utkin, “Sliding modes in Control and Optimization” ,Springer, 1992.
[40]
J. Liu, X. Wang “Advanced Sliding Mode Control for Mechanical Systems”, Springer , 2012.
[41]
W. Peruquette, J. P. Barbot “Sliding Mode Control in engineering”Marcel Dekker,2002.
[42]
Ding, Z., “Nonlinear and Adaptive Control Systems”,, IET Press, London, 2013.
[43]
James Ron Leigh, “Control Theory: A Guided Tour”, IET Press, 2012.
[44]
B.D.O Anderson and J.B.Moore, “Optimal Control Theory: Linear Quadratic Methods”,
PrenticeHall,1989.
[45]
Raymond T. Stefani et. al, “Design of Feedback Control Systems”, Oxford University Press,
2002.
[46]
Karl. J. Astrom, Tore Hagglund “PID controllers”, Instrument Society of America, 1995
61
APPENDICES
APPENDIX A: SIMULINK DIAGRAM
FIGURE A1.1: SIMULINK DIAGRAM OF NON-LINEAR NATURAL DYNAMICS WITH ACTUATOR
FIGURE A1.2 TOP LEVEL DIAGRAM OF PHYSICAL MODEL OF IP WITH SIMSCAPE
62
FIGURE A1.3: PHYSICAL MODEL OF INVERTED PENDULUM PLANT WITH SIMSCAPE
FIGURE A2.1: TOP LEVEL DIAGRAM OF SYSTEM WITH LQR CONTROL
FIGURE A2.2: LQR CONTROL DESIGN
63
FIG A3.1: TOP LEVEL DIAGRAM OF APPROXIMATE LINEARIZATION WITH SLIDING MODE CONTROL
FIG A3.2 APPROXIMATE FEEDBACK LINEARIZATION FUNCTION BLOCK
FIG A4.1 TOP LEVEL DIAGRAM OF INPUT OUTPUT LINEARIZATION WITH ZERO DYNAMICS
CONTROL
64
FIG 4.2: INPUT-OUTPUT LINEARIZATION(ANGLE) WITH VIRTUAL CONTROL
FIG A 4.3: ZERO DYNAMICS STABILIZING FUCNTION BLOCK
FIGURE A5: CONVERT RADIANS TO DEGREE
65
FIGURE A6.1 TOP LEVEL DIIAGRAM OF TWO LOOP PID CONTROL
FIG A6.2: PID CONTROL
66
FIGURE A7.1: TOP LEVEL DIAGRAM OF PV SWING UP CONTROL
FIG 7.2: PV CONTROL USING PENDULUM ANGLE AND PENDULUM VELOCITY
FIGURE 7.3: STATE FEEDBACK CONTROL OF CART FOR PV SWING UP
67
FIGURE 8: PASSIVITY BASED ENERGY SWING UP FUNCTION BLOCK
FIGURE A9.1: SWITCHING FUNCTION FOR SWING UP CONTROL
FIGURE A9.2: INTEGRAL OF SQUARED ERROR
68
FIGURE A9.3: CALCULATE MEAN ABSOLUTE CONTROL ACTION
FIGURE A9.4: STATE GENERATOR
APPENDIX B: MATLAB CODES
B1: NATURAL DYNAMICS
function [x2dot,x4dot] = fcn(x1,x2,x3,x4,u,n)
%#codegen
%%
%PARAMETERS
%%
L = 0.3302; M = 0.94; m = 0.23; J = 0.00788; Beq = 5.4; Bp = 0.0024;
g = 9.81; Rm = 2.6; Kt = 0.00767; Ng = 1; Kg = 3.71; Nm = 1;
Km = 0.00767; rmp = 0.00635;
a1=J+m*L^2; a2=J*m*L+m^2*L^3; a3=m^2*L^2*g; a4=M*m*L^2+(M+m)*J;
a5=(M+m)*m*g*L;
K1=(Ng*Kg*Nm*Kt)/(rmp*Rm); K2=(Ng*Kg^2*Nm*Kt*Km)/(rmp^2*Rm);
%%
%NONLINEAR DYNAMICS WITH ACTUATOR
%%
D=m^2*L^2*(sin(x3))^2+a4;
69
f2=(-a1*Beq*x2-m*L*Bp*x4*cos(x3)-a2*x4^2*sin(x3)+a3*sin(x3)*cos(x3)a1*K2*x2)/D;
g2=a1*K1/D;
f4=(-(M+m)*Bp*x4-m^2*L^2*x4^2*sin(x3)*cos(x3)m*L*Beq*x2*cos(x3)+a5*sin(x3)-K2*m*L*x2*cos(x3))/D;
g4=K1*m*L*cos(x3)/D;
x2dot=f2+g2*u+n;
x4dot=f4+g4*u+n;
B2: APPROXIMATE LINEARIZATION WITH SLIDING MODE CONTROL
function [U,s] = fcn(x1,x2,x3,x4,ebs,P1,Q1,x1d,lambda)
%%
%APPROXIMATE FEEDBACK LINEARISATION
%%
eqn1=(-6*sin(x3)/(cos(x3))^4+sin(x3)/(cos(x3))^2)*L*x4^4;
eqn2=-6*g*x4^2*sin(x3)/(cos(x3))^3;
eqn3=(-2*g*sin(x3)/(cos(x3))^3+g*sin(x3)/cos(x3))*3*x4^2;
eqn4=(-2*g/(cos(x3))^2+2*g)*g*sin(x3)/L;
fe=eqn1+eqn2+eqn3+eqn4;
ge=-6*x4^2/(cos(x3))^2+3*x4^2-3*g/(L*cos(x3))+2*g*cos(x3)/L;
y1=(x1-x1d)-L*log((1+sin(x3))/cos(x3));
y2=x2-L*x4/cos(x3);
y3=-tan(x3)*(g+L*x4^2/cos(x3));
y4=(-2/(cos(x3))^3+1/cos(x3))*L*x4^3+(-3*g/(cos(x3))^2+2*g)*x4;
%%
%SLIDING MODE CONTROL
%%
s=y4+3*lambda*y3+3*lambda^2*y2+lambda^3*y1;%SURFACE
sgn_s=s/(abs(s)+ebs); %CONTINUOUS APPROXIMATION OF DISCONTINUOUS SIGN
FUNCTION
w_exp=P1*s+Q1*sgn_s-((fe+3*lambda*y4+3*lambda^2*y3+lambda^3*y2)/ge);
%EXPONENETIAL LAW
w_pow=P1*(abs(s)^Q1)*(sgn_s)((fe+3*lambda*y4+3*lambda^2*y3+lambda^3*y2)/ge); %POWER LAW
%w=w_exp; %choose exponential law
w=w_pow; %choose power law
v=w/K1;
U=(M+m*(sin(x3))^2)*v-((m*g*sin(x3)*cos(x3)-m*L*x4^2*sin(x3)(K2+Beq)*x2)/K1);
B3:INPUT-OUTPUT(ANGLE) LINEARIZATION WITH ZERO DYNAMICS CONTROL
%%INPUT-TO-OUTPUT(ANGLE)FEEDBACK LINEARIZATION
function u2 = fcn(x1,x2,x3,x4,v1)
%%
%LINEARIZING EQUATIONS
%%
D=m^2*L^2*(sin(x3))^2+a4;
f2=(-a1*Beq*x2-m*L*Bp*x4*cos(x3)-a2*x4^2*sin(x3)+a3*sin(x3)*cos(x3)a1*K2*x2)/D;
g2=a1*K1/D;
f4=(-(M+m)*Bp*x4-m^2*L^2*x4^2*sin(x3)*cos(x3)m*L*Beq*x2*cos(x3)+a5*sin(x3)-K2*m*L*x2*cos(x3))/D;
g4=K1*m*L*cos(x3)/D;
u2=(v1-f4)/g4;
%%
%ZERO DYNAMICS CONTROL BASED ON LYAPUNOV STABILITY THEORY
function V3 = fcn(x1, x2, x3, xref, x4, v1,c1,c2,c3)
70
%%
a5=(M+m)*m*g*L;
%ZERO DYNAMICS STABILIZING EQUATIONS
K1=(Ng*Kg*Nm*Kt)/(rmp*Rm); K2=(Ng*Kg^2*Nm*Kt*Km)/(rmp^2*Rm);
D=m^2*L^2*(sin(x3))^2+a4;
f2=(-a1*Beq*x2-m*L*Bp*x4*cos(x3)-a2*x4^2*sin(x3)+a3*sin(x3)*cos(x3)a1*K2*x2)/D;
g2=a1*K1/D;
f4=(-(M+m)*Bp*x4-m^2*L^2*x4^2*sin(x3)*cos(x3)m*L*Beq*x2*cos(x3)+a5*sin(x3)-K2*m*L*x2*cos(x3))/D;
g4=K1*m*L*cos(x3)/D;
e=x1-xref;
V3=((-c1*e-c3*x2-c2*f2)*g4-c2*g2*(v1-f4))/(c2*g2*g4); %ZERO DYNAMICS
STABILIZING CONTROL ACTION
B4:PASSIVITY BASED ENERGY SWING UP FUNCTION
function [u,E]= fcn(ke,kx, kd,kv,x1,x2,x3,x4)
%PASSIVITY SWING UP EQUATIONS
c1=Beq+K2;
q=[x1;x3]; %STATES
qdot=[x2;x4];
Mq=[(M+m) -m*L*cos(x3);-m*L*cos(x3) m*L^2];%MASS-INERTIA MATRIX
E=0.5*(qdot)'*Mq*qdot+m*g*L*(cos(x3)-1);% ENERGY OF INVERTED PENDULUM
p1=(kv*c1)/(M+(m*(sin(x3))^2));
p2=(kv*m*sin(x3)*(L*x4^2-g*cos(x3)))/(M+(m*(sin(x3))^2));
p3=kv/(M+(m*(sin(x3))^2));
Num=(-kd+ke*E*c1+p1)*x2-kx*x1+p2;
Den=ke*E+p3;
w=Num/Den;
u=w/K1; %SWING UP CONTROL ACTION
71
Download