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.
2
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 ... 13CHAPTER 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
3
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
4
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
5
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
6
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
7
LIST OF ABBREVIATIONS
LQR Linear Quadratic Regulator SMC Sliding Mode Control IP Inverted PendulumFL/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
8
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.
...
9
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.
10
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.
11
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.
12
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.
13
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.
14
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
15
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
16
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].
17
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
18
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 Position vector of Pendulum
,
; Let . 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), ; ; ;
19 and (3.5) ;
=Resultant force on cart =Applied force-Frictional force= (3.6)
= Resultant Torque on Pendulum = Applied Torque- Frictional Torque= (3.7) The actuator providing 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
20 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:
21
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;
(3.18)
Putting (3.18) in (3.16) and making the subject yields equation (3.19) below + . (3.19) Making the subject in (3.17) gives; (3.20)
Putting (3.20) in (3.16) and making the subject yields (3.21) below
22
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.
23
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, Output at equilibrium Control action at equilibrium . Where , ,
(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
24 = 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.
25
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 maximum
Cart constrained to move within a distance of from origin
Percent overshoot less than 20%
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)
26
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 is equal to n for all .
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 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 , is assumed zero
27
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 ( , we test the system according to theorem (4.1) for controllability and involutivity.
28 Controllability test: ,
To check the controllability of the system, we compute the rank of the matrix
To compute the rank of ,we first compute its determinant.
Because is full rank, the system is controllable.
Involutivity Test:
Testing for involutivity, the span( ) of the set is created.
If the span is singular, then its elements are linear combinations of one another thereby
making it involutive.
The span of the system is thus computed:
. Span .
29
=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 ,is the number of times the output has to be differentiated for the control input 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 by ignoring the terms that make the relative degree less than 4 in the diffeomorphism .
30
(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
. (4.13)
With the output 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 , makes it impossible to do a full state linearization of the system using the obtained output . 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 .
31
Wherever this approximation is valid, a suitable controller can be designed for to stabilize the nonlinear system and drive the output 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 based on the condition of a pre-specified switching surface . 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
32
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. where state variable and reference of state and where 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, .From (4.22), . For to be negative definite, and 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]
33
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 or with which drives the switching variable to the surface exponentially.
Power rate reaching law having the form or
with 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)
34
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, is used instead. (2) is replaced by .
The control action 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.1-A3.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 determines the rate of convergence to zero of the error on the surface, a value of is first selected to get a time constant of about on the surface. is first set at to have a short surface reaching time and chosen to reduce chattering. Further changes are then made to the parameters using the performances indices as guide as shown in Table 4.1
35 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 and cart displacement is 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
36
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
37
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 in (4.33) above, we differentiate repeatedly until appears as shown below:
. Where . and are designed by pole
38
placement using the characteristic equation and the linearizing control action is:-
. (4.34) The relative degree of the feedback linearized system is and therefore an internal dynamics of
order 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:
,
39
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
40
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 . where and
with cart reference position, and cart reference velocity and
41
+ + 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 is derived thus:
where (section 4.3.1 ) (4.39) The total control action 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 which is the virtual control for the feedback linearized output . 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 for the feedback linearized virtual control which determines the values of and . 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 making and and chosen as and 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 . From Figure 4.5, it can be inferred that the controller stabilizes the pendulum after and tracks the cart after with a rise time of without
42
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.
43
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 such that is Hurwitz
and the pair (A,C) is detectable if there exist such that 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 and the observability matrix 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, [45]. The Ricatti
44
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 , needed to evaluate the optimal control action 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 as [45], . The matrices , and 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 performance and control action 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 .
45 Figure 4.7: LQR Simulation with .
From Fig. 4.7, the settling time is for both the cart distance and pendulum angle. The rise time for the cart is about . 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.