Beruflich Dokumente
Kultur Dokumente
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
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
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
and
................................................................45
............48
LIST OF ABBREVIATIONS
LQR
SMC
IP
Inverted Pendulum
PV
P.O
Percentage Overshoot
PID
SIMO
ISE
MACA
SSE
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.
...........................................................
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 Librarys
regulations (see http://www.manchester.ac.uk/library/aboutus//regulations) and in the
Universitys Guidance for the presentation of Dissertations.
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.
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.
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
13
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]
Its relative degree and controllability are not well defined [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]
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
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
VALUE
Metre(m)
Metre(m)
Displacement of Cart
Metre(m)
Pendulum Angle
Radians(m)
Newton(N)
Gravitational acceleration
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,
; Let
. Then
(3.1)
;
(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)
18
and
(3.5)
;
=Resultant force on cart
(3.6)
(3.7)
(KVL);
0.18
=
The pinion converts the applied gear torque into a linear force(F) with the torque
But
19
PARAMETER
VALUES
Armature Current
Amperes(A)
Volts(v)
Rads/s
Nm
Nm
(3.8)
With
and
, (3.8) becomes
(3.9)
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
But
(3.12)
Putting (3.12) in (3.11) gives the Equation of motion of the pendulum as:
+
(3.13)
(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
(3.18)
the subject yields equation (3.19) below
+
.
Making
(3.19)
the subject in (3.17) gives;
(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.
.
,
The state space representation of the inverted pendulum with actuator is therefore
,
(3.22) ; where
(3.23)
and
(3.24)
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
3.4
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 :
Output at equilibrium
(3.26)
The equilibrium points are infinitely many but only two physical equilibrium points are relevant:
The upright vertical position with
The Linearized system about the upright equilibrium is represented in state space in thus
;
(3.28)
23
and
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
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
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:
Settling time of less than 10s for both cart and pendulum
maximum
from origin
(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
control law
,
(4.3)
the original nonlinear system (4.1) can be transformed into the linear controllable system of form
(4.2), where
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 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
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:
, 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
Substituting (4.7) in (4.6) yields the simplified state space equation for the system as shown in
(4.8)
(4.8)
Letting
(4.9) below
(4.9)
where
and
To determine if a diffeormorphism,
Controllability test:
To check the controllability of the system, we compute the rank of the matrix
Because
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
, 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
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
29
(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)
(4.16)
(4.17)
(4.18)
The diffeomorphism
in the diffeomorphism
) of the input,
in the
diffeomorphism as it is approximately zero when the system is close to the equilibrium point
30
to stabilize the
, 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
,
in
(4.19)
based on 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
reference of
is a tuning parameter that set certain desired properties in the dynamics of the surface
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
fundamental condition for the system to reach the sliding surface and therefore the existence of a
sliding mode with any designed discontinuous control action
this reaching condition and they are called the reaching laws. Common reaching laws include the
following: [40]
32
and
a constant rate, .
or
surface exponentially.
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
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)
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
is used instead.
.
is thus computed:
(4.30)
and
on the surface.
is first set at
changes are then made to the parameters using the performances indices as guide as shown in
Table 4.1
34
PERFORMANCE INDICES
COMMENT
ISE is low but MACA is high
and results in chattering.
ISE and MACA both low. Good
transient
performance
and
and
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
, 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
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)
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)
repeatedly until
in (4.33) above, we
. Where
.
37
and
is:-
(4.34)
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
,
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
,
. Where
38
and
. The
(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
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
with
is positive definite in
is negative definite in D,
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
(4.34) as below:
(4.33)
where
(4.36)
To design
such that
with
. where
cart reference velocity
and
and
But
. Therefore,
(4.37)
(4.38)
where
The total control action
is derived thus:
(section 4.3.1 )
(4.39)
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
and
. The parameters
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
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
without
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
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.
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
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
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
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
where
(4.44)
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
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
and
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
.
for both the cart distance and pendulum angle. The rise time
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.
45
error,
and
(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
angle
to system input,
input
to system
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
(4.48) Substituting
and
functions
and
which clearly shows that the characteristic equation for both the cart and pendulum is ;
(4.49)
But
and
.
Substituting
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
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
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
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
and
and
chosen to drive the pendulum away from the pendant position using the smallest displacement of
the cart as possible.
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
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
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
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
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
supplied to
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
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
An important result to be used later when establishing the passivity of the pendulum.
51
But
(4.58)
Hence,
(4.59)
(4.60)
, 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
(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
negative definite.
;
Recall that
Putting
in
;
we obtain
(4.67)
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
,
while
,
is chosen to
swing up to occur. From Fig. 4.14, the pendulum swings constantly at increasing amplitudes from
an original position of
until it reaches
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
up strategy was observed to have a wide domain of attraction as it could swing the pendulum up
to about
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
54
Figure 4.15: Swing Up and tracking with disturbance and noise of Passivity -Energy control
The indices for comparing the performance of the controllers above include:- The Rise Time
The Settling time
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%
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 basin of initial conditions where the controller is attractive to the equilibrium
upright position with and without consideration for system constraints
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
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
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
5.2 RECOMMENDATION
To improve on the work done and carry out further investigations, the following
recommendations are suggested:
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]
60
[23]
APPENDICES
APPENDIX A: SIMULINK DIAGRAM
62
FIG A3.1: TOP LEVEL DIAGRAM OF APPROXIMATE LINEARIZATION WITH SLIDING MODE CONTROL
FIG A4.1 TOP LEVEL DIAGRAM OF INPUT OUTPUT LINEARIZATION WITH ZERO DYNAMICS
CONTROL
64
66
67
68
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;
%%
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
71