0% found this document useful (0 votes)
426 views155 pages

Rotary Inverted Pendulum Tan Kok Chye Teo Chun Sang School

This document describes a project on a rotary inverted pendulum system. It includes: - An introduction and objectives to balance the pendulum and control its position. - A description of the system setup, including hardware components and software. - Derivation of the nonlinear and linear mathematical models using Lagrange's equations of motion. - Parameter estimation using system identification to determine unknown physical quantities in the models. - Experimental results and discussion of estimating parameters using least squares methods. - Design of various state feedback and predictive controllers to balance the pendulum.

Uploaded by

diemtrieu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
426 views155 pages

Rotary Inverted Pendulum Tan Kok Chye Teo Chun Sang School

This document describes a project on a rotary inverted pendulum system. It includes: - An introduction and objectives to balance the pendulum and control its position. - A description of the system setup, including hardware components and software. - Derivation of the nonlinear and linear mathematical models using Lagrange's equations of motion. - Parameter estimation using system identification to determine unknown physical quantities in the models. - Experimental results and discussion of estimating parameters using least squares methods. - Design of various state feedback and predictive controllers to balance the pendulum.

Uploaded by

diemtrieu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 155

ROTARY INVERTED PENDULUM

TAN KOK CHYE


TEO CHUN SANG

SCHOOL OF ELECTRICAL AND ELECTRONIC ENGINEERING


NANYANG TECHNOLOGICAL UNIVERSITY
1998/99
ROTARY INVERTED PENDULUM

SUBMITTED
BY

TAN KOK CHYE


TEO CHUN SANG

SCHOOL OF ELECTRICAL AND ELECTRONIC ENIGINEERING

A final year project report


presented to
Nanyang Technological University
in partial fulfillment of the
requirements for the
Degree of Bachelor of Engineering

April 1999
Abstract
The Rotary Inverted Pendulum System is an excellent test-bed for teaching digital
control techniques. The system is excited by a DC motor, and is equipped with
sensors to measure the angular displacement of the pendulum and the angular
velocity and position of the DC motor. A micro-controller is used to implement a
range of real-time digital control techniques. It can be used to demonstrate the
various practical aspects involved in designing a control system. Used as a teaching
tool, it allows students to gain hands-on experience with an actual system, from
collecting, filtering and analyzing data to obtain a dynamic model of the system, to
deciding an appropriate sampling interval and designing a digital controller to
balance the pendulum in the upright position.

Deriving a mathematical model for the inverted pendulum system is the first step in
the design process. The model must be able to describe the response of the actual
system as closely as possible. Lagrange’s equation of motion was used in the
derivation of the dynamic non-linear model. The model gives the exact relationships
among all the variables involved. Using the dynamic non-linear model, we can
derive the linear model. The unknown parameters of this model will be estimated in
the System Identification.

Data is collected from experiments to identify the unknown physical quantities that
are required to complete the model. System Identification using Least Squares
Approximation is used to estimate the parameters. Once the parameters are
identified, the model is used for design of controllers to balance the pendulum.

The controllers are designed using pole placement technique. Besides balancing the
pendulum in the upright position, it is desired to control the position as well as the
movement of the rotating arm. Controllers with proportional and/or integral actions
were designed. Digital controllers such as the Generalised Predictive Controller and
Discrete Incremental controller were also implemented for better performance.

Page I
To complete the project, a Graphical User Interface was developed to provide
courseware to cater to users with different background knowledge. This will enhance
the system so that it will become a good test-bed for control study.

Page II
Acknowledgement

Firstly, we would like to thank our supervisor Dr. Ling Keck Voon for his guidance
throughout the course of the project. His comments and suggestions have contributed
significantly to the success of the project.

We would also like to thank the Laboratory Technicians in Control Engineering Lab,
Ms. Joanne Tham, Ms. Song Lee Sin and Ms. Felicia Lim for their support
throughout the past year. Without their help, many administrative matters would not
have been performed as efficiently. Their friendly disposition have created a pleasant
environment to work in.

Next, we would like to thank our peers in Control Engineering Lab for their opinions
and appraisals. Their companionship have made staying long hours a lesser chore.

Last of all, we would like to thank all those who have, in one way or another,
contributed to the success of this project.

Page III
Contribution
FYP PROJECT

Major Task Teo Chun Sang Tan Kok Chye

Familiarisation with 50% 50%


hardware
Familiarisation with 50% 50%
related software
Research done on 60% 40%
Pendulum
Mathematical Modeling 60% 40%

Parameter Estimation 70% 30%

Matlab Simulation 20% 80%

Controller Design 20% 80%

Graphical User Interface 10% 90%

Final Report 60% 40%

Page IV
Content
Page
Abstract I
Acknowledgments III
Contribution IV
Table of Contents V

Chapter 1 Introduction
1.1 Background and Motivation 1
1.2 Objectives 3

Chapter 2 System Setup


2.1 Introduction 4
2.2 Setup of System 5
2.3 Software System 6
2.4 Personal computer system 6
2.5 Universal controller 7
2.6 Motor driver board 7
2.7 Power supply 8
2.8 Inverted pendulum apparatus 8
2.8.1 Potentiometer 9
2.8.2 Encoder 10

Chapter 3 Mathematical Modelling


3.1 Introduction 11
3.2 Co-ordinate System 11
3.3 Non-Linear Dynamic Model 12
3.4 Linearised Model 13
3.5 Continuous-Time State Space Model 13

Page V
3.6 Discrete-Time State Space Model 14
3.7 Discrete-Time Incremental Model 14

Chapter 4 Parameter Estimation


4.1 Introduction 16
4.2 Mathematical Model Used for Parameter
Estimation 16
4.3 Signal Conditioning 17
4.4 Estimated Data 19
4.4.1 Forward Difference 19
4.4.2 Central Method 19
4.4.3 Backward Difference 20
4.5 Unforced Oscillation Response 20
4.6 Least Squares Estimation Methods 21
4.6.1 Method 1 21
4.6.2 Method 2 23
4.7 Model Verification Techniques 24

Chapter 5 Experimental Results and Discussion, Parameter


Estimation
5.1 Introduction 25
5.2 Test Signals and Data 25
5.3 Results of Parameter Estimation 27
5.4 Discussion on Parameter Estimation Method 1 28
5.4.1 Effects of Difference Approximation
Method 28
5.4.2 Effects of Using Unforced Oscillation
Response for Estimation 32
5.4.3 Results of Estimation of J0 and C0 32
5.4.4 Reference Model 32

Page VI
5.5 Discussion on Parameter Estimation Method 2 35
5.5.1 Reference Values for φ1 to φ8 35
5.5.2 Overview of Estimation Results 36
5.5.3 Effects of Difference Approximation
Method 36
5.5.4 Effects of Using Unforced Oscillation
Response for Estimation 37
5.5.5 Results of Estimation 37

Chapter 6 Controller Design


6.1 Introduction 40
6.2 Controllability 42
6.3 Ackermann’s Formula 43
6.4 State Feedback Controller
(Continuous Time Model) 44
6.5 State Feedback Controller with Proportional Action
(Continuous Time Model) 45
6.6 State Feedback Controller with Integral Action
(Continuous Time Model) 46
6.7 State Feedback Controller with PI Action
(Continuous Time Model) 47
6.8 State Feedback Controller
(Discrete Time Model) 49
6.9 State Feedback Controller
(Discrete Time Incremental Model) 50
6.10 Generalized Predictive Controller 51
6.11 Swing Up Controller 52
6.12 Dead Zone Mapping 56

Page VII
Chapter 7 Experimental Results and Discussion, Controller
Design
7.1 Introduction 57
7.2 State Feedback Controller
(Discrete and Continuous Time Model) 59
7.3 State Feedback Controller with Integral Action
(Continuous Time) 63
7.4 State Feedback Controller with Proportional
Action (Continuous Time) 65
7.5 State Feedback Controller with Proportional
and Integral Action (Continuous Time) 67
7.6 State Feedback Controller
(Discrete Time Incremental Model) 68
7.7 Generalized Predictive Controller 72
7.8 Swing-Up Controller 74
7.9 Effect of Dead Zone Mapping 75

Chapter 8 Graphical User Interface


8.1 Background 76
8.2 Objectives 77
8.3 Features 78
8.4 Graphical User Interface Version 98 Screen Shot 79
8.4.1 Startup Screen 79
8.4.2 Introduction Screen 79
8.4.3 System Configuration Interface 80
8.4.4 Beginner Interface Option 80
8.4.5 Advance Interface Option 81
8.4.6 System Setup Interface 82
8.4.7 Mathematical Modelling 85
8.4.8 Miscellaneous 87
8.4.9 System Identification 88

Page VIII
8.4.10 Controller Design 95
8.4.11 Demonstration 98

Chapter 9 Conclusion 99

Chapter 10 Recommendations
10.1 DC Motor 100
10.2 Swing Up Controller 100
10.3 Parameter Estimation 102
10.4 Simulation with Animation 103

References 104

Appendix A
Appendix B
Appendix C
Appendix D
Appendix E
Appendix F
Appendix G
Appendix H

Page IX
INTRODUCTION

Chapter 1 Introduction

1.1 Background and Motivation

Early studies of the inverted pendulum system was motivated by the need to design
controllers to balance rockets during vertical take-off. At the instance of time during
launch, the rocket is extremely unstable. Similar to the rocket at launch, the inverted
pendulum requires a continuous correction mechanism to stay upright, since the
system is unstable in open loop configuration. This problem can be compared to the
rocket during launch. Here, rocket boosters have to be fired in a controlled manner,
to maintain the rocket upright.

The simple linear pendulum has long proved a useful model for more complicated
physical systems, and its behavior in the small-amplitude limit provides a realistic
yet solvable example for students in introductory classes. While the force-free,
frictionless pendulum can be solved exactly for all amplitudes in terms of elliptic
integrals, the solution is hardly illuminating, rarely found useful, and when damping
and external driving are included, the equations of motion become intractable (except
for small oscillations). With the advent of desktop computers, however, it has
become possible to study in some detail the rich nonlinear dynamics of the damped,
force-driven pendulum and gain significant insight into its sensitivity to initial
conditions for certain values of the system parameters.

Equally interesting, but much less studied in physics texts, is the state in which the
plane pendulum can be stabilized in a small-oscillation mode about the vertical by
means of a sinusoidal driving force. Although the external force can be applied to
the pivot in either the vertical or horizontal direction, or in some linear combination,
a vertically oscillating pivot is the most common scenario as in our case. It appears
that this system was first studied by Stephenson in 1908 and somewhat later by van
der Pol and Strutt.

Page 1
INTRODUCTION

An interesting variation on the inverting pendulum problem is the Rotary Inverted


Pendulum that is being used in this project. (Figure 1)

It consists of an arm, and a pendulum mounted


on a hinge. As the pendulum has a circular
trajectory, this setup overcomes the space
requirement of a conventional cart type
pendulum system. The rotary type system
requires less space and is very suitable for a
project.

Figure 1

Besides classroom theory and various control design methods, it is important to


expose students of digital control to the many practical aspects of implementing a
digital control system. This requires a good foundation in control theory as well as
knowledge in computer interfacing techniques, system modeling, instrumentation
and digital signal processing. Therefore, a computer-based courseware, which aims
to achieve the above objectives, has been developed. It is implemented using
MATLAB, a common software tool for digital control design and analysis. The
Graphical User Interface (GUI) is implemented to aid the learning of the various
elements of a digital control system.

Page 2
INTRODUCTION

1.2 Objectives

The basic objectives of this project are as follows:

1. To verify the mathematical model of the inverted pendulum system and the
control algorithms implemented by the previous FYP group [1].
2. To estimate the system parameters of the inverted pendulum system.
3. To design controllers that can balance the pendulum and to compare the
performance of different controllers.
4. To have an Interactive User Interface for both beginners and advanced users
of this system and to provide courseware that integrates theory with practice.

With addition objectives as follows:

1. To provide a platform suitable for the teaching of digital control courses.


2. To supplement traditional classroom lessons by using an interactive and
interesting teaching approach.
3. To provide hands-on practice to enhance and reinforce student’s learning.

Page 3
SYSTEM SETUP

Chapter 2 System Setup

2.1 Introduction

This chapter will describe the various modules of the system. The system comprises
six major modules, which will be described in the following pages. They are:

System Software
Personal Computer System
Universal Controller UC96 Microcontroller Board
Motor Driver Board
Power Supply
Inverted Pendulum Apparatus Kri PP-300
Potentiometer
Encoder

Page 4
SYSTEM SETUP

2.2 Setup of System

Top view of the inverted pendulum system

Figure 2.1 on the right shows the picture


of the Inverted Pendulum System. It
shows the top view of the KRi PP-300
Inverted Pendulum apparatus with the
power supply unit housed in a casing on
the right beside the pendulum apparatus.
The UC96 Controller and Motor Driver
board have been mounted on the base of
the Inverted Pendulum apparatus. Figure 2.1

Disassembled view of the components

Figure 2.2 on the right shows the


disassembled view consisting of the
Power Supply Unit, Motor Driver Board
and UC96 Microcontroller Board.

From figure 2.2, we can see that the


UC96 Microcontroller Board is mounted
on the Motor Driver Board on the top left Figure 2.2

corner of the picture. The power supply


unit consists of the transformer and the
rectifier circuit.

Page 5
SYSTEM SETUP

2.3 Software System

The Software Interface system (GUIv98) is used to


provide an interface to help users study the system. It
enhances the efficiency of the computer as a
development platform.

It also provides an integrated environment that links all


the various subprograms that are needed, making the
system operations transparent to the user. Figure 2.3

2.4 Personal Computer System

The Personal Computer system is used as a


development platform. It hosts the software interface
system and all other programs that are required to
operate the system. Most importantly, the computer acts
as an interface between the hardware and the user.

Functions and processes for analysis, computation


Figure 2.4
debugging, doshelling, downloading/ uploading of data,
as well as modifications of the internal registers of the
UC96 board during run-time can be performed. The
physical interface used to connect the computer system
with the UC96 system is the serial port.

Page 6
SYSTEM SETUP

2.5 Universal Controller UC96 Microcontroller Board

The Universal Controller UC96 Microcontroller Board


is a single-board microcontroller system suitable for
implementing a wide variety of standalone embedded
systems (Figure 2.5). Applications include
instrumentation, data acquisition, controllers and other
intelligent digital systems.

Figure 2.5
The Universal Controller UC96 Microcontroller Board
is powered by the Intel 80C196KC high performance
microcontroller, complemented by PSD401A2 a field-
programmable peripheral IC. The combination allows
the hardware structure to be programmed with
firmware, which makes the board extremely versatile.

2.6 Motor Driver Board

The Motor Driver Board is designed to drive the motor


connected to it, with a PWM signal (Figure 2.6).

To achieve high reliability and better connectivity


between the microcontroller and driver board, the motor
driver board was designed such that the microcontroller
Figure 2.6
board sits on top of it and turn-pins are used instead of
cables. This also reduces the signal path between the
boards, hence reducing signal propagation.

The board also houses regulators to convert the 17V


supply to 5Vdc and 12Vdc to drive the PWM motor.

Page 7
SYSTEM SETUP

2.7 Power Supply Unit

A peak 17V unregulated DC power supply to the motor


driver board to drive the inverted pendulum system.

Besides that, the power supply unit 250VA 230/12V


transformer steps down the AC from 230V to 12Vrms.
Through a full-bridge rectifier, DC voltage is supplied
Figure 2.7
to the microcontroller.

2.8 Inverted Pendulum Apparatus Kri PP-300

The KRi PP-300 Inverted Pendulum apparatus (Figure


2.8) consists of a short arm that rotates in a horizontal
plane, driven by a motor mounted vertically. A
pendulum rod is fixed at one end of the arm, which
moves in the vertical plane.

At rest, the arm is stationary and the pendulum hangs


downwards. The objective is to balance the pendulum in
Figure 2.8
the upright position.

Page 8
SYSTEM SETUP

2.8.1 Potentiometer

The angular position of the pendulum is measured by a


10KΩ potentiometer (rotary type). A supply of 5V is
applied across the potentiometer. This signal is
presented to an ADC with amplitudes of 0V - +5V
corresponding to 0° - 360°. (Figure 2.9)
Figure 2.9
But due to the non-linearity of the potentiometer, the
potentiometer will only measure accurately from 0° to
340°± 3°. The difference between the potentiometer
reading at upright position and pendant position is not
equal to half the range of the 10-bit ADC (512 counts).

Therefore, to minimize the measurement error in the


pendulum’s angular position, the crossover point (dead
zone) was set half way between the upright and
horizontal position. Hence, while performing system
identification and balancing the pendulum, the cross-
over (dead zone) effect is minimal.

Page 9
SYSTEM SETUP

The interface between the potentiometer and the


microcontroller board is through 3 wires through a
coupling on top of the rotating drum (Figure 2.10). This
will effectively pass the signal of the potentiometer to
the controller board.

Figure 2.10

2.8.2 Encoder
Position of the arm is fed-back by the encoder in the
motor shaft (Figure 2.11). With this 1000 line encoder,
it is able to give a differential output signal, which gives
a total of 4000 counts per revolution.

Figure 2.11

Page 10
MATHEMATICAL MODELLING

Chapter 3 Mathematical Modelling

3.1 Introduction

To be able to analyse the system, we need to derive an accurate mathematical model.


In this chapter, the mathematical models used throughout the project will be
presented. The derivations are shown in the Appendices.

3.2 Co-Ordinate System


m1

z
l1 β

α
L0
θ
y
Figure 3.1
The models presented in this chapter are based on the co-ordinate system shown in
Figure 3.1 above. The standard right-handed Cartesian co-ordinate system is used.
The angular position of the arm, α, is assigned to be increasing when the arm is
rotating about the z-axis in the right-handed sense (when the thumb points in the
direction of the axis, the fingers point in the direction of increasing angle). The
reference of α is taken to be the x-axis.

The angular position of the pendulum, β and θ, are assigned to be increasing when
the pendulum is rotating about an axis passing through the arm section from the

Page 11
MATHEMATICAL MODELLING

origin to the pivot point of the pendulum, in the right-handed sense. The reference of
β is taken from the upward vertical and the reference of θ is taken from the
downward vertical.

Transforming between different co-ordinate systems can be easily performed as


demonstrated in the derivation of the dynamic model in the downward position in
Appendix A.

3.3 Non-Linear Dynamic Model

The non-linear dynamic model describes the system completely. It gives the exact
relationships among all the variables involved. All the linear models used for
controller design are derived from this non-linear model. As shown in Appendix A,
equation (A6), the dynamic model with the pendulum in the upright position is:
 J 0 + m1 L20 + m1l12 sin 2 β − m1 L0 l1 cos β  α&& 
   +
 − m1 L0l1 cos β J 1 + m1l12   β&&
C 0 + KRt K b + 12 m1l12 β& sin 2 β m1 L0 l1 β& sin β + 12 m1l12α& sin 2 β  α&  (3.1)
 a
 &  +
− 2 m1l1 α sin 2 β
&  β 
1 2
 C1
 0   KRt Ka u 
 − m gl sin β  =  u
 1 1   0 

The dynamic model with the pendulum in the downward position, Appendix A
equation (A11), is:
 J 0 + m1 L20 + m1l12 sin 2 θ m1 L0l1 cosθ  α&&
   +
 m1 L0l1 cosθ J 1 + m1l12  θ&&
C 0 + KRt Kb + 12 m1l12θ& sin 2θ − m1 L0l1θ& sin θ + 12 m1l12α& sin 2θ  α& 
 a
 & + (3.2)
− 2 m1l1 α sin 2θ
&  θ 
1 2
 C1
 0   KRt Ka u 
 m gl sin θ  =  u
 1 1   0 

Page 12
MATHEMATICAL MODELLING

3.4 Linearised Model

The linear model is obtained by linearising equation (3.1) about:


α& = 0 β = 0 β& = 0

As shown in Appendix B, equation (B3), the linearised model is:


 J 0 + m1 L20 − m1 L0 l1  α&&  C 0 + KRt K b 0  α& 
 2   &&
+ a
  +
β
 − m1 L0l1 J 1 + m1l1     0 C1   β&  (3.3)
0 0  α   K t Ku

0 − m gl   β  =  u
Ra

 1 1    0 

3.5 Continuous-Time State Space Model

Define:
a = J 0 + m1 L20 c = m1 L0l1 e = KRt Ka u h = m1 gl1
b = m1l12 d = C0 + KRt Ka b f = J 1 + m1l12 (3.4)

Writing equation (3.3) in state space form with 3 state variables, we obtain, as shown
in Appendix B equation (B6):
x&3 = A 3 x3 + B 3u
α&&   − df ch − cC1  α&  ef 
 β&  = 1  0 af − c 2   β  +
1  0 u
  af − c 2  0 af − c 2   (3.5)
 β&&  − cd ah − aC1   β&   ce 

Augmenting the state variables with the arm position α, the following model is
obtained as shown in Appendix B equation (B7):
x& 4 = A 4 x4 + B 4 u
α&  0 af − c 2 0 0  α  0
α&&      
  = 1 0 − df ch − cC1  α&  1 ef 
+ u
 β&  af − c 2 0 0 0 af − c 2   β  af − c 2  0 
 &&      (3.6)
β  0 − cd ah − aC1   β&   ce 

Page 13
MATHEMATICAL MODELLING

Note that for the above models, the output(s) can be defined as any linear
combination(s) of the state variables specified by the following:
y = Cx
where x is the state variables (x3 or x4).

3.6 Discrete-Time State Space Model

The discrete-time model is required when using digital control techniques. When a
system described by state space equations,
x& = Ax + Bu
y = Cx
is discretized with respect to a sampling interval Ts, the corresponding discrete state
space model is obtained:
x(k + 1) = A d x(k ) + Bd u (k )
y (k ) = C d x (k ) (3.7)
where k is the discrete time index,
Ts

Ad = e , B d = ∫ e Aγ Bdγ , C d = C
ATs

0
The discretization technique can be applied to the continuous time models as stated
in equations (3.4) and (3.5) to obtain the discrete models for design or analysis
purposes.

3.7 Discrete-Time Incremental Model

The incremental model [2] is an alternative form of representation and will be used
in the design and implementation of the Generalised Predictive Controller. Define
the state variables to be:
 x (k ) 
xi (k ) =  
u (k − 1)

Page 14
MATHEMATICAL MODELLING

As shown in Appendix C equation (C3), the incremental model used for this project
is:
xi (k + 1) = A di xi (k ) + B di ∆u (k )
y (k ) = C di xi (k ) (3.8)
where
A Bd  B 
A di =  d  , B di =  d  , C di = [C d 0]
0 1 1

Page 15
PARAMETER ESTIMATION

Chapter 4 Parameter Estimation

4.1 Introduction

In the mathematical models derived in Chapter 3, the parameters of the models need
to be determined for the model to be useful. In this chapter, two techniques used for
parameter estimation are presented. Both the techniques involve the same principles,
except that the equations used for estimation are slightly different. To be able to
estimate the parameters, we excite the system with a known test signal and collect
the data of the response of the system. With the mathematical model derived in
Chapter 3, we then try to find the best values of the parameters that will produce
theoretical results that are as close as possible to the experimental results. The
process is illustrated in Figure 4.1 below.
Test Signal System Response
Physical
System

Comparison
Parameter
Estimation

Model Response
Mathematical
Model

Figure 4.1

4.2 Mathematical Model used for Parameter Estimation

For parameter estimation, the system will be excited with a known test signal from
its downward hanging position. The response of the system to the test signal will
adhere to the dynamics described by the non-linear downward model. Hence it will
be more convenient to use the downward model to estimate the parameters. The

Page 16
PARAMETER ESTIMATION

downward model presented in equation (3.2) is reproduced here for convenience of


reference:
 J 0 + m1 L20 + m1l12 sin 2 θ m1 L0l1 cosθ  α&&
   +
 m1 L0l1 cosθ J 1 + m1l12  θ&&
C 0 + KRt Kb + 12 m1l12θ& sin 2θ − m1 L0l1θ& sin θ + 12 m1l12α& sin 2θ  α& 
 a
 & +
− 2 m1l1 α sin 2θ
&  θ 
1 2
 C1
 0   KRt Ka u 
 m gl sin θ  =  u
 1 1   0 

4.3 Signal Conditioning

The data collected for parameter estimation are:


α& Arm Velocity
θ Pendulum Position
u Motor Driving Command
The raw data collected are not in Standard Units and are usually very noisy.
Furthermore, sampling and digital storage of data introduces quantization and
truncation errors. After converting to Standard Units, the data are filtered before
being used for parameter estimation. The filter used is an Infinite Impulse Response
(IIR) digital filter of transfer function:

H (z ) =
0.15
1 − 0.85 z −1
The frequency response of the filter is shown in Figure 4.2 (a) below.

(a) (b)
Figure 4.2

Page 17
PARAMETER ESTIMATION

The magnitude response |H(ejω)| of the filter is:

( )
H e jω =
0.15
1 − 0.85e − jω
0.15
=
1 − 0.85 cos ω + j 0.85 sin ω

( )
H e jω =
0.15
(1 − 0.85 cosω )2 + (0.85 sin ω )2
0.15
=
1 − 1.7 cos ω + 0.85 2
Since the filter is of IIR type, it will introduce some phase distortion to the filtered
signal. To perform IIR filtering without phase distortion, the filtered signal is
reversed in sequence and passed through the filter again. By this action, all the
frequency components of the signal pass through the filter twice, once in each
direction. Their individual delays will be the same and hence there will be no phase
distortion. This is implemented by the MATLAB command “filtfilt()”. The
equivalent filter by this action is double the original filter order. The effective
frequency magnitude response, shown in Figure 4.2 (b), is |H(ejω)|2. Hence the cut-off
frequency can be found as follows:

( )
H e jω
21
=
2
2
0.15 1
=
1 − 1.7 cosω + 0.85 2
2
cos ω =
1
1.7
(
1 + 0.852 − 0.15 2 2 )
ω = 0.1048 rad / sample
2πf = 0.1048 rad / sample
f = 0.01667 cycle / sample
For a sampling frequency Fs of 100Hz, the analogue cut-off frequency fc, is Fs×f
=1.6673Hz.

Page 18
PARAMETER ESTIMATION

4.4 Estimated Data

From the raw data collected, the arm acceleration, pendulum velocity and pendulum
acceleration can be estimated. For sampling interval Ts and sample index k, there are
3 possible ways to estimate these.

4.4.1 Forward Difference

Taking the forward difference, the arm acceleration, pendulum velocity and
pendulum acceleration can be estimated as:
α& (k + 1) − α& (k )
α&&(k ) =
Ts
θ (k + 1) − θ (k )
θ&(k ) =
Ts
θ&(k + 1) − θ&(k )
θ&&(k ) =
Ts
θ (k + 2) − θ (k + 1) − [θ (k + 1) − θ (k )]
=
Ts2
θ (k + 2) − 2θ (k + 1) + θ (k )
=
Ts2

4.4.2 Central Difference

Taking the central difference, the arm acceleration, pendulum velocity and
pendulum acceleration can be estimated as:
α& (k + 1) − α& (k − 1)
α&&(k ) =
2Ts
θ (k + 1) − θ (k − 1)
θ&(k ) =
2Ts
θ&(k + 1) − θ&(k − 1)
θ&&(k ) =
2Ts
θ (k + 2 ) − θ (k ) − [θ (k ) − θ (k − 2 )]
=
4Ts2
θ (k + 2 ) − 2θ (k ) + θ (k − 2)
=
4Ts2

Page 19
PARAMETER ESTIMATION

4.4.3 Backward Difference

Taking the backward difference, the arm acceleration, pendulum velocity and
pendulum acceleration can be estimated as:
α& (k ) − α& (k − 1)
α&&(k ) =
Ts
θ (k ) − θ (k − 1)
θ&(k ) =
Ts
θ&(k ) − θ&(k − 1)
θ&&(k ) =
Ts
θ (k ) − θ (k − 1) − [θ (k − 1) − θ (k − 2 )]
=
Ts2
θ (k ) − 2θ (k − 1) + θ (k − 2)
=
Ts2

4.5 Unforced Oscillation Response

A typical set of raw data is shown in Figure 4.3 below.

(a)

Unforced Oscillation (b)

(c)

Figure 4.3
From Figure 4.3, observe that we can segment the data into forced response and
unforced oscillatory response where the unforced response is characterised by:
u = 0 α& = 0 α&& = 0

Page 20
PARAMETER ESTIMATION

The response of this section corresponds to the dynamics of a free oscillating


pendulum. The dynamic equation for this response can be found by setting the
corresponding terms in equation (A9), Appendix A, to zero. The result is:
(J )
+ m1l12 θ&& + C1θ& + m1 gl1 sin θ = 0
1
This will be used as an alternative form for estimation, where appropriate.

4.6 Least Squares Estimation Methods

All the estimation methods presented here are based on the Least Squares Technique
[7]. Stated simply, for a system of linear equations described by
y = Ax (4.1)
where A is an n × m matrix and n > m,
y is a column vector of n elements,
x is a column vector of m unknowns,
the Least Squares solution of the system of equations is given by:
x = (ATA)-1ATy (4.2)
The raw data and the estimated data will be used in the estimation of the unknown
parameters. Method 1 was used by the previous FYP group and has been a proven
technique. It will be used as the reference method for comparison purposes.

4.6.1 Method 1

Here, we categorise the parameters into “determinable” and “indeterminable”.


By “determinable”, we refer to those quantities that can be determined from
some reliable sources or through performing some simple experiments. The
determinable quantities are presented in Appendix F. With these values, we
use the Least Squares Technique to estimate the indeterminable parameters
which are J0, C0, J1 and C1.

Page 21
PARAMETER ESTIMATION

From equation (3.2), separating the known quantities and unknown


quantities, the following can be written:
J 0α&& + C0α& = − m1L20α&& − m1l12α&& sin 2 θ − m1L0l1θ&&cosθ − α& − m1l12α&θ& sin 2θ
Kt Kb
Ra

+ m1L0l1θ& 2 sin θ + Kt Ku
Ra
u
J1θ&& + C1θ& = − m1L0l1α&& cosθ − m1l12θ&& + 12 m1l12α& 2 sin 2θ − m1gl1 sin θ
In matrix form, the above can be written as:
 − m1 L20α&& − m1l12α&& sin 2 θ − m1 L0 l1θ&&cosθ − KRt Kb α&  J 
 a
 = [α&& α& ] 0 
 − m1l12α&θ& sin 2θ + m1 L0l1θ& 2 sin θ + Rt a u u  (4.3)
C0 
K K

[ ] [
− m1 L0l1α&& cosθ − m1l12θ&& + 12 m1l12α& 2 sin 2θ − m1 gl1 sin θ = θ&& θ&  
 J1 
] (4.4)
C1 

The left-hand side of equations (4.3) and (4.4) are known quantities. The
terms contain the determinable parameters and data which are obtainable
from the response of the system. When the data from each sampling instance
are formed into equations (4.3) and (4.4), we get an equation similar to (4.1)
which is then used for estimation. Mathematically, for N samples of the
response of the system, we can form N equations from (4.3) as:
y = Ax
 y k (k )   α&&(k ) α& (k ) 
 y (k + 1)   α&&(k + 1) α& (k + 1) 
   J 
y= A= x= 0
k

 M   M M  C0 
   
 y k (k + N − 1) α&&(k + N − 1) α& (k + N − 1)
where k is the sample index,
y k (k ) = − m1 L20α&&(k ) − m1l12α&&(k )sin 2 [θ (k )] − m1 L0 l1θ&&(k )cos[θ (k )] − KRt Ka b α& (k )

[ ]
− m1l12α& (k )θ&(k )sin [2θ (k )] + m1 L0l1 θ&(k ) sin [θ (k )] +
2 Kt K u
Ra u (k )

The parameters J0 and C0 can be estimated from equation (4.2). The same
technique is used for all the estimation methods and will not be stated again.

Using the unforced oscillation response, J1 and C1 can be estimated from:

[− m l θ&& − m gl sin θ ] = [θ&& θ&]CJ 


11
2
1 1
1

 1  (4.5)
The linear model can then be constructed from equation (B8) in Appendix B.

Page 22
PARAMETER ESTIMATION

4.6.2 Method 2

Method 1 requires prior knowledge of the determinable parameters for


estimation. The advantage of Method 2 is that all the parameters can be
estimated without any such knowledge. The variables defined in (3.4) are
reproduced here:

a = J 0 + m1 L20 c = m1 L0l1 e= Kt Ku
Ra h = m1 gl1
b=ml 2
1 1 d = C0 + Kt Kb
Ra f = J1 + m l 11
2

With reference to the variables above, the downward model can be written as:
(4.6)
aα&& + bα&& sin 2 θ + cθ&&cosθ + dα& + bα&θ& sin 2θ − cθ& 2 sin θ − eu = 0
cα&& cosθ + fθ&& − 1 bα& 2 sin 2θ + C θ& + h sin θ = 0 (4.7)
2 1

Define:
b d b C1
φ1 = φ3 = φ5 = φ7 =
a a f f
c e c h
φ2 = φ4 = φ6 = φ8 = (4.8)
a a f f

After some manipulation, the following can be obtained:

φ1 
φ 
[α&&] = [(− α&& sin 2 θ − α&θ& sin 2θ ) (θ& 2
sin θ − θ&&cosθ ) − α& ]
u  2
φ 3  (4.9)
 
φ 4 
φ 5 
φ 
[θ&&] = [ α&
1
2
2
sin 2θ − α&& cosθ − θ& ]
− sin θ  6 
φ 7 
(4.10)
 
φ8 

Using the unforced oscillation response, φ7 and φ8 can be estimated by:

φ 
[θ&&] = [− θ& ]
− sin θ  7 
φ8  (4.11)

Page 23
PARAMETER ESTIMATION

From these results, φ5 and φ6 can be estimated, using the full response, by:

φ 
[θ&& + φ θ& + φ ] [
sin θ = 12 α& 2 sin 2θ
− α&& cosθ  5  ]
φ 6 
7 8
(4.12)
Note that the linear model can be constructed from equation (B9) in
Appendix B.

4.7 Model Verification Techniques

After parameter estimation, some form of verification is needed to check if the


results of the estimation are accurate and reasonable. One way is to compare the
response of the physical system with the simulated response. For this purpose, the
downward model is constructed using MATLAB’s Simulink Toolbox. Simulink is an
interactive tool for modelling, simulating and analysing dynamic systems. The
Simulink model, which is based on equations (4.9) and (4.10) is shown in Figure 4.4
below.

Figure 4.4
The results from parameter estimation are used to modify the Simulink model’s
parameters. The simulated response to the same test signal will give an indication of
the accuracy of the estimated parameters.

Page 24
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

Chapter 5 Experimental Results and


Discussion for Parameter
Estimation

5.1 Introduction

This chapter presents the results of the parameter estimation techniques as described
in Chapter 4. Previous work has shown that certain patterns of test signals produce
consistently good results. Figure 4.3 (a) shows one such test signal. It is a step signal
that drops to zero after a finite duration. This type of test signals provides good
excitation for the transient response and allows the system to exhibit the unforced
oscillation response. The discussion will be limited to parameter estimation using
this particular type of test signals. As there are 2 methods and a few options available
for estimation, a comprehensive treatment is not possible. Selected cases will be
highlighted where appropriate. All discussions are based on data collected on System
II as mentioned in Appendix F.

5.2 Test Signals and Data

Assuming that noise affecting the signals has a mean value of zero, it would be ideal
to use as many samples as possible for estimation such that its effects will be
minimised. However, there is a physical limitation on the memory of the micro-
controller and this in turn limits the number of samples of data that can be collected.
Each set of data used is 1800 samples wide. For a sampling period of 10ms, this
corresponds to the first 18 seconds of excitation.

Page 25
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

Ten sets of data are collected for analysis. The test signals for these are as described
above in increasing duration of 1-second steps. The data collected for analysis are
presented here in Figure 1 to Figure 10. These will be referred to as “data set 1”,
“data set 2”, to “data set 10” respectively.

Figure 5.1 Figure 5.2

Figure 5.3 Figure 5.4

Figure 5.5 Figure 5.6

Page 26
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

Figure 5.7 Figure 5.8

Figure 5.9 Figure 5.10

5.3 Results of Parameter Estimation

The results obtained from parameter estimation are tabulated in Appendix H for ease
of reference. For each method, there is an alternative to use the unforced oscillation
response to estimate some of the parameters. This has been described in Chapter 3.
Furthermore, there are 3 ways to estimate the arm acceleration, pendulum velocity,
and pendulum acceleration. The total combinations produce a substantial amount of
data not suitable to be presented in this chapter.

The results are verified using the Simulink model. If we take the results from the
simulation as the reference, we can have an indication of the accuracy of the
estimation by defining the following error constants.

Page 27
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

Let
α& S be the arm velocity obtained from simulation ,
θ S be the pendulum position obtained from simulation ,
α& E be the arm velocity obtained from experiment ,
θ E be the pendulum position obtained from experiment .
Define:
N N

∑ [α& S (k ) − α& E (k )] ∑ [θ (k ) − θ (k )]
2 2
S E
Error A = k =1
Error B = k =1

N N
The error constants defined above are normalised with respect to the total number of
samples N so that the errors for different sample size would not differ by too much.
These error constants are also tabulated in Appendix H.

5.4 Discussion on Parameter Estimation Method 1

5.4.1 Effect of Difference Approximation Method

This section discusses the effects of the difference approximation methods on


the results of estimation using Method 1. On examination, the forward and
backward difference sequence of a signal x differs only in phase by one
sample, whereas the central difference sequence is the average of the two
sequences. This can be expressed mathematically as:
x(k + 1) − x(k − 1)
x& F (k ) = x (k + 1) − x(k ) x& B (k ) = x(k ) − x(k − 1) x&C (k ) =
2
x& F (k ) = x& B (k + 1)
(5.1)
x& (k ) + x& B (k )
x&C (k ) = F
2
where

x& F is the forward difference sequence,


x& B is the backward difference sequence,
x&C is the central difference sequence.

Page 28
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

When applied to the approximation of the arm acceleration, pendulum


velocity, and pendulum acceleration (these three quantities will be
collectively referred to as the “derived quantities”), they produce results
which have very different implications. Examination of Tables H1, H2, H5
and H6 shows that all the estimated results are positive values. This is
intuitively correct as the moment of inertia of a body and the viscous friction
coefficient of an axis cannot be negative. However, examining Tables H3 and
H4 shows that C1 is consistently a negative value as estimated by Method 1.
Using the backward difference approximation, the estimated value of C1 is
negative.

For data set 1, using the full response for estimation, the results are shown in
Figure 5.11, 5.12 and 5.13 for forward, backward, and central difference
approximation respectively.

Figure 5.11 Figure 5.12

Figure 5.13
The bold line represents the simulated results whereas the thin line represents
the experimental results. Observing the results visually, it can be said that the

Page 29
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

use of the central difference method produces more accurate results than
using the forward or backward difference methods. This is true for the 10
data sets even though the numerical error constants defined in section 5.3
may indicate otherwise for certain data sets.

To explain this phenomenon, more studies will be required. However, we can


establish some facts that can lead us to some starting point of study. When
performing the difference approximation, the higher frequency components
are amplified while the lower frequency components are attenuated, similar to
the action of a high-pass filter. Averaging a sequence has an effect similar to
low-pass filtering. Therefore, the central difference technique essentially acts
as a band-pass filter while the forward and backward difference acts as a
high-pass filter.

The transfer functions for these approximation methods are shown below.

x (k + 1) − x (k ) x(k ) − x(k − 1) x(k + 1) − x(k − 1)


y F (k ) = y B (k ) = yC (k ) =
TS TS 2TS
zX (z ) − X (z ) X (z ) − z −1 X (z ) zX (z ) − z −1 X (z )
YF (z ) = YB (z ) = YC (z ) =
TS TS 2TS
YF (z ) 1 YB (z ) 1 YC (z )
= (z − 1)
X (z ) TS
=
X (z ) TS
(
1 − z −1 ) =
X (z ) 2TS
1
(
z − z −1 )
1 − z −1 1 − z −1 1 − z −2
= = =
TS z −1 TS 2TS z −1

To plot the frequency response for comparison purposes, we shift the output
by one sample into the past and plot its response defined by:

z −1YF (z ) z −1YB (z ) z −1YC (z )


H FS (z ) = H BS (z ) = H CS (z ) =
X (z ) X (z ) X (z )
1 − z −1 z −1 − z −2 1 − z −2
= = =
TS TS 2TS

Page 30
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

The frequency response for the shifted Forward HFS(z), Backward HBS(z) and
Centre HCS(z) Difference Approximation Methods are shown in Figure 5.14,
5.15 and 5.16 respectively, for Ts of 10ms.

Figure 5.14 Figure 5.15

Figure 5.16

Since the transfer functions are Finite Impulse Response (FIR) type, all the
phase responses are linear, which implies that there will not be any phase
distortion of the output signal. However, since the input and output sequences
are used in the estimation process, the delays on the individual frequency
components from the different sequences could have some effects on the
results.

Page 31
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

5.4.2 Effect of Using Unforced Oscillation Response for Estimation

The unforced oscillation response of the data segment can be used to estimate
J1 and C1. Tables H1, H3 and H5 are the results using the full response for
estimation. Tables H2, H4 and H6 are the results obtained using the unforced
oscillation response. Examining the individual tables, we see that the
distribution of values for J1 and C1 within each table is quite small.
Comparing among Table H1 and H2, H3 and H4, H5 and H6, we observe that
the results of estimation using the unforced response generally produces
slightly lower values. Since the distribution of the results is small for these
data sets, we can conclude that results using the full response and the
unforced oscillation response are both valid.

5.4.3 Results of Estimation of J0 and C0

Examining Tables H1 to H6 shows that the distribution of values of J0 is


small. However, for C0, the results for data sets 1 and 2 are somewhat higher
than the rest of the data sets. Observation of the error constants Error A and
Error B within each table, we see that for data set 1, the simulated results are
closest to the experimental data compared to the other data sets. This is
despite the fact that C0 estimated using this data set is not consistent with the
rest of the data sets.

5.4.4 Reference Model

From 5.4.1, we have shown that using the central difference approximation
produces more accurate results than using the forward or backward difference
approximation. From 5.4.2, we observed that using the full response or the
unforced oscillation response would produce quite reasonable results. From
5.4.3, we see that even though data sets 1 and 2 produce values of C1 that are
inconsistent with the rest of the data sets, we cannot discard these results
because their simulated results are the closest to the experimental results.

Page 32
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

Hence a logical way to determine an acceptable value would be to average


the results from all the data sets. Using the full response for parameter
estimation, central difference approximation for estimation of the derivatives,
the average of the results (Table H5) can be found as:
Data Set J0 C0 J1 C1
Average(1 to 10) 0.008591 0.006408 0.000217 0.000158
Table 5.1

The linear model (Appendix B, equation (B8)) formed from these results is:
x&3 = A 3 x3 + B3u
α&&   − 1.3705 3.8557 − 0.01242 α&   0.5721
 β&  =  0 0 1   β  +  0 u
       (5.2)
 β&&  − 0.9367 51.5747 − 0.1661   β&  0.3910

The corresponding open loop poles are located at:


s = -1.2982, s = 7.0698, s = -7.3083

The simulated responses from all the data sets are shown below for the results
shown in Table 5.1 above. The bold line is the simulated response and the
thin line is the experimental data.

Figure 5.17 Figure 5.18

Page 33
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

Figure 5.19 Figure 5.20

Figure 5.21 Figure 5.22

Figure 5.23 Figure 5.24

Page 34
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

Figure 5.25 Figure 5.26

The bode plot of the linear model can then be obtained. For the output being
defined as the arm velocity, the bode plot is shown in Figure 5.27. Figure
5.28 shows the case when the pendulum position is defined as the output.

Figure 5.27 Figure 5.28

5.5 Discussion on Parameter Estimation Method 2

5.5.1 Reference Values for φ1 to φ8

From the reference model obtained in Section 5.4.4, we can establish some
reference values that are expected of φ1 to φ8 for comparison purposes. The
reference values can be calculated from (4.8) and (3.4) to be:
φ1 = 0.08578 φ2 = 0.07476 φ3 = 1.30050 φ1 φ 5
= = 1.1474
φ4 = 0.54290 φ5 = 0.78415 φ6 = 0.68338 φ2 φ6
φ7 = 0.15717 φ8 = 48.93428

Page 35
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

5.5.2 Overview of Estimation Results

Intuitively, the values φ1 to φ8 should not be negative quantities as these are


derived from all positive quantities. Looking through Tables H7 to H12, we
notice that for all the results obtained, at least one of the parameters is a
negative quantity. Furthermore, from (4.8), observe that if the estimation is
error-free, the following relationship should hold:
φ1 φ5
=
φ2 φ6
However, this relationship does not hold for most, if not all, of the results
obtained. This implies that visible estimation errors exist for all the results.
Hence in this discussion, the main objective is to study if an accurate linear
model can be obtained despite these errors.

5.5.3 Effect of Difference Approximation Method

Similar effects where using the central difference approximation gives a more
accurate model can be demonstrated with some of the data sets obtained. For
data set 1, using the unforced oscillation response for estimation, the results
are shown in Figure 5.29, 5.30 and 5.31 for forward, backward, and central
difference approximation respectively.

Figure 5.29 Figure 5.30

Page 36
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

Figure 5.31
Comparing with the reference values against Tables H8, H10 and H12, we
see that H12 has the average values of φ3, φ7, φ8 closest to the reference.

5.5.4 Effect of Using Unforced Oscillation Response for Estimation

The parameters φ7 and φ8 can be estimated from the unforced oscillation


response using equation (4.11). Using these results, φ5 and φ6 can then be
estimated from equation (4.12). Tables H7, H9 and H11 are the results using
the full response for estimation. Tables H8, H10 and H12 are the results
obtained using the unforced oscillation response. Comparing Tables H7 and
H8, we see that using the full response for estimation, the results for φ5, φ6, φ7
and φ8 has a relatively large distribution and their values are further from the
reference compared with results estimated using the unforced oscillation
response. The same can be said for Tables H9 and H10 as well as Tables H11
and H12. From these, we can conclude that using the unforced oscillation
response for estimation using Method 2 produces more reliable results.
Moreover, we can establish that Method 1 is a more reliable method
compared to Method 2 because Method 1 is relatively insensitive to the
effects of using the unforced oscillation response for estimation.

5.5.5 Results of Estimation

Since it has been found that using the central difference for approximation of
the derived quantities produce better results, and using the unforced

Page 37
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

oscillation response to estimate the parameters is more reliable, we shall limit


the discussion to the results in Table H12. Compare the estimated results with
the reference values established in Section 5.5.1. First, note that the results of
φ1, φ2, and φ5 are unreliable. They are negative for most of the estimation
results. The results that are more agreeable with the reference values are φ6,
φ7 and φ8. Values of φ3 and φ4 are fairly close to the reference. When forming
the linear model with equation (B9), the values of φ1 and φ5 are not required,
therefore we can still have an accurate linear model if the errors present in φ2
are not too prominent.

Taking the average values so as to minimise the overall errors, the final
results are tabulated below.
Data Set φ1 φ2 φ3 φ4
Average(1 to 10) -0.124165 -0.000866 0.933609 0.380896
Data Set φ8 φ7 φ6 φ5
Average(1 to 10) -0.062969 0.637546 0.134671 49.548102
Table 5.2

The linear model (Appendix B, equation (B9)) formed from these results is:
x&3 = A 3 x3 + B3u
α&&   − 0.9331 − 0.04288 0.0001166 α&  0.3807 
 β&  =  0 0 1   β  +  0 u
      
 β&&  − 0.5949 49.5208 − 0.1346   β&  0.2427 

The corresponding open loop poles are located at:


s = -0.9336, s = 6.9703, s = -7.1044
Comparing these with the open loop poles of the reference model, we observe
that they are fairly close.

Page 38
EXPERIMENTAL RESULTS AND DISCUSSION FOR PARAMETER ESTIMATION

The bode plot of the linear model can then be obtained. The bode plot of this
model is plotted against that of the reference model for comparison purposes.
For the output being defined as the arm velocity, the bode plot is shown in
Figure 5.32. Figure 5.33 shows the case when the pendulum position is
defined as the output.

Figure 5.32 Figure 5.33

From the above results, we see that despite the errors present in the
estimation process, Method 2 still produces a fairly accurate linear model
when compared to Method 1.

Page 39
CONTROLLER DESIGN

Chapter 6 Controller Design

6.1 Introduction

In a regulatory type control system, the controller regulates the output and maintains
it at a desired level as specified by some reference. When the reference is time
varying, the controller will attempt to excite the system in such a way that the output
will track the reference as closely as possible. Usually, the control signal applied to
the plant or system is a function of the difference between the reference input and the
actual output, commonly referred to as the error signal. For a real system,
disturbances will act on the plant. An effective control system should be insensitive
to external disturbances and responsive to changing inputs.

For this project, the primary objective is to balance the pendulum in its upright
position. The secondary objective is to maintain the arm at a fixed position. Various
controllers were implemented to achieve these. To bring the pendulum from its
downward stable position to its upright position, a swing-up controller was
implemented. This chapter presents the controllers used in this project and the
theoretical background associated with them.

The controllers used for balancing are linear state feedback controllers. They are
designed based on a known model of the system. In Chapter 5, the parameters of the
linear model were estimated. For presentation of this report, the model used is as
described by (5.2). It is reproduced here for ease of reference.
x&3 = A 3 x3 + B3u
α&&   − 1.3705 3.8557 − 0.01242 α&   0.5721
 β&  =  0 0 1   β  +  0 u
      
 β&&  − 0.9367 51.5747 − 0.1661   β&  0.3910

Page 40
CONTROLLER DESIGN

The block diagram of the open loop system is shown below.


x& = Ax + Bu x&
y = Cx
u B +
∫ x C y
+

Figure 6.1

The following are the thirteen controllers being implemented based on different
models used:
3 State Feedback Controller (Continuous Time Model)
4 State Feedback Controller (Continuous Time Model)
3 State Feedback Controller with Integral (I) Action (Continuous Time Model)
4 State Feedback Controller with Integral (I) Action (Continuous Time Model)
3 State Feedback Controller with Proportional (P) Action (Continuous Time Model)
4 State Feedback Controller with Proportional (P) Action (Continuous Time Model)
3 State Feedback Controller with PI Action (Continuous Time Model)
4 State Feedback Controller with PI Action (Continuous Time Model)
3 State Feedback Controller (Discrete Time Model)
4 State Feedback Controller (Discrete Time Model)
4 State Feedback Controller (Incremental Model)
5 State Feedback Controller (Incremental Model)
Generalised Predictive Controller

Page 41
CONTROLLER DESIGN

6.2 Controllability

To be able to use the Pole Placement Technique for controller design, the system
must be completely state controllable. Therefore, before designing any controller, the
controllability of the system must be checked first.

Consider the system:


x& = Ax + Bu

The above system is said to be state controllable at t = t0 if it is possible to construct


an unconstrained control signal that will transfer an initial state to any final state in a
finite time interval t0 ≤ t ≤ t1. If every state is controllable, then the system is said to
be completely state controllable.

The system is completely state controllable if the rank of the n × n matrix, Sct, is n.

[
Sct = B AB A 2 B L A n -1B ]
Similarly, for a system described by:
x(k + 1) = A d x(k ) + B d u (k )

The system is completely state controllable if the rank of the n × n matrix, Sdt, is n.
[
Sdt = B d A d Bd A d2 B d L A nd-1B d ]

Page 42
CONTROLLER DESIGN

6.3 Ackermann’s Formula

u x& x y u x& x y
B ∫ C B ∫ C

A A

-K

Figure 6.2 Figure 6.3

Given an open loop control system (figure 6.2)


x& = Ax + Bu
The control signal using pole placement technique is (figure 6.3):
u = − Kx

To use Ackermann’s formula, the system must be completely state controllable. It is


important to note that the state feedback gain matrix (K) is not unique for a given
system, but depends on the desired closed-loop pole location selected. This will also
determine the speed and damping of the response.

The selection of the desired closed loop poles is a compromise between the speed of
the response of the error vector and its sensitivity to disturbances and measurement
noise. That is, if we increase the speed of response, then the adverse effects of
disturbances and measurement noise will generally increase.

For a second order system, the system dynamics (response characteristics) can be
precisely correlated to the location of the desired closed loop poles and zeros of the
plant. But for higher order systems, the location of the closed loop poles and the
system dynamics (response characteristics) are not easily correlated.

Hence, in our system, in determining the state feedback gain matrix (K) for the
system, we need to examine the response characteristics of the system for several
sets of controller gains (K) and choose the one that gives the best overall system
performance.

Page 43
CONTROLLER DESIGN

6.4 3 and 4 State Pole Placement


(Continuous Time Model)

r u x& x y


B C
+
A

Figure 6.4

Figure 6.4 shows the block diagram of the inverted pendulum system with state
feedback. The derivation of the closed loop control system with state feedback is as
shown

x& = Ax + Bu
y = Cx
u = r − Kx
x& = Ax + B(r − Kx )
Below is the final state space model, where A can be 4x4 matrix for 4 state or 3x3 for
3 state.

x& = ( A − BK ) x + Br
y = Cx

Ackermann's formula is used to calculate the feedback gain matrix (K). Using Matlab
‘acker (A,B, poles)’ the values of the feedback gain matrix (K) can be easily
calculated.

Page 44
CONTROLLER DESIGN

6.5 3 and 4 State Pole Placement with Proportional Controller


(Continuous Time Model)

r u x& x y

− −
Kp B C
+
A

Figure 6.5

Figure 6.5 shows the block diagram of the inverted pendulum system with state
feedback and proportional controller. The derivation of the closed loop control
system with state feedback and proportional control is as shown

x& = Ax + Bu
y = Cx
u = − Kx + Kp (r − Cx )
x& = Ax + B(− K − KpC ) x + BKpr

and below is the final state space model.


x& = ( A − BK − BKpC )x + BKpr
y = Cx

Where A can be a 4x4 matrix for 4 state or 3x3 for 3 state. Matrix C will be
dependent on what is being defined as the output. If the user chose the proportional
gain to act on the pendulum position for 4 state, matrix C will be [0 0 1 0].

Ackermann's formula is used to calculate the feedback gain matrix (K). Using Matlab
‘acker(A,B, poles)’ the values of the feedback gain matrix (K) can be easily found.
The user will design a value for proportional gain (Kp). The system will then check
the locations of the poles with Kp included. This can be done using Matlab ‘eig(A-
BK-KpBC)’.

Page 45
CONTROLLER DESIGN

6.6 3 and 4 State Pole Placement with Integral Controller


(Continuous Time Model)
r e& e u x& x y
∫ ∫
− −
Ki B C
+
A

Figure 6.6

Figure 6.6 shows the block diagram of the inverted pendulum system with state
feedback and integral controller. The derivation of the closed loop control system
with state feedback and integral control is as shown

x& = Ax + Bu x& = Ax + B(e − Kx )


y = Cx e& = Kir − KiCx
e& = (r − y ) Ki
u = e − Kx
and below is the final state space model.

 x&  ( A − BK ) B   x   0 
 e&  =  − KiC +
0   e   Ki 
r
  
 x
y = [C 0] 
e 

Where A can be a 4x4 matrix for 4 state or 3x3 for 3 state. Matrix C will be
dependent on what is being defined as the output. If the user chose the integral gain
to act on the pendulum position for 3 state, matrix C will be [0 1 0].

Ackermann's formula is used to calculate the feedback gain matrix (K). Using Matlab
‘acker(A,B, poles)’ the values of the feedback gain matrix (K) can be easily
calculated. The user will design a value for integral gain (Ki). The system will then
check the locations of the poles with Ki included. This can be done using Matlab
( A − BK ) B
‘ eig  ’.
 − KiC 0 

Page 46
CONTROLLER DESIGN

6.7 3 and 4 State Pole Placement with Proportional and Integral Controller
(Continuous Time Model)

r z e& e w u x& x y
∫ ∫ C
− −
Ki B A
+ +
Kp A

Figure 6.7

Figure 6.7 shows the block diagram of the inverted pendulum system with state
feedback and both proportional and integral controller. The derivation of the closed
loop control system with state feedback and proportional and integral control is as
shown

x& = Ax + Bu
y = Cx
z=r − y
u = − Kx + w
w = e + Kpz
e& = zKi

x& = Ax + B( w − Kx ) e& = zKi


= ( A − BK ) x + Bw = Ki (r − y )
= ( A − BK ) x + B(e + Kpz ) = Kir − KiCx
= ( A − BK ) x + Be + BKpz
= ( A − BK ) x + Be + BKp (r − y )
= ( A − BK ) x + Be + BKpr − BKpCx

and below is the final state space model.

 x&  ( A − BK − KpBC ) B   x   KpB 


 e&  =  − KiC
+
0   e   Ki 
r
  
 x
y = [C 0] 
e 

Page 47
CONTROLLER DESIGN

Where A can be a 4x4 matrix for 4 state or 3x3 for 3 state. Matrix C will be
dependent on what is being defined as the output. If the user chose the proportional
and Integral control to act on the pendulum velocity for 4 state, matrix C will be
[0 0 0 1].

Ackermann's formula is used to calculate the feedback gain matrix (K). Using Matlab
‘acker(A,B, poles)’ the values of the feedback gain matrix (K) can be easily
calculated. The user will design a value for proportional gain (Kp) and integral gain
(Ki). The system will then check the locations of the poles with Kp and Ki included.
( A − BK − KpBC) B ’.
This can be done using Matlab ‘ eig
 − KiC 0 

Page 48
CONTROLLER DESIGN

6.8 State Feedback Controller (Discrete Time Model)

The discrete-time model as described by equation (3.7) is reproduced here.


x(k + 1) = A d x(k ) + Bd u (k )
y (k ) = C d x (k )

The block diagram of the closed loop system is shown below.

r(k) + u(k) x(k+1) x(k) y(k)


Bd + z-1I Cd
- +

Ad

Figure 6.8
Using Ackermann’s formula, the controller gains defined by K can be determined for
a given set of closed loop poles. The controller can then be found by:
u (k ) = r (k ) − Kx(k )
For r(k) = 0,
u (k ) = −Kx (k )

When the 3 states continuous time model is discretized to obtain Ad, the resulting
controller is the 3 states feedback controller (designed using the discrete time model).
Similarly, if the 4 states continuous time model is discretized instead, the resulting
controller is the 4 states feedback controller (discrete time model). Functionally, the
state feedback controller designed using the continuous or discrete time model is
identical if the controller gains K are the same. Since the system is essentially a
digital system, it would be more appropriate to use digital control techniques for
design and analysis.

Page 49
CONTROLLER DESIGN

6.9 State Feedback Controller (Discrete-Time Incremental Model)

The discrete-time incremental model as described by equation (3.8) is reproduced


here.
xi (k + 1) = A di xi (k ) + B di ∆u (k )
y (k ) = C di xi (k )
where
 x (k ) 
xi (k ) =  
u (k − 1)

The block diagram of the closed loop system is shown below.

r(k) + ∆u(k) xi (k + 1) xi(k) y(k)


Bdi + z-1I Cdi
- +

Adi

Figure 6.9
Using Ackermann’s formula, the controller gains defined by K can be determined for
a given set of closed loop poles. The controller can then be found by:
∆u (k ) = r (k ) − Kxi (k )
u (k ) = u (k − 1) + ∆u (k )
= u (k − 1) + r (k ) − Kxi (k )
 x (k ) 
= u (k − 1) + r (k ) − [K1 K 2 ] 
u (k − 1)
= u (k − 1) + r (k ) − K1 x (k ) − K 2 u (k − 1)
= r (k ) + (1 − K 2 )u (k − 1) − K 1 x(k )
For r(k) = 0,
u (k ) = (1 − K 2 )u (k − 1) − K 1 x(k )

Note that the controller gains K1 acts on the state variables whereas K2 acts on the
previous controller output. This technique can be applied to the 3 states discrete
model or the 4 states discrete model to obtain the 4 states incremental model or 5
states incremental model respectively.

Page 50
CONTROLLER DESIGN

6.10 Generalised Predictive Controller

Predictive Control belongs to the class of model based controller design concepts.
The concept of Predictive Control [2] is presented in Appendix D. For this project,
the 5 states incremental model is used for design of the Generalised Predictive
Controller. The derivation of the GPC control law is presented in Appendix E. The
controller can be written as
u (k ) = u (k − 1) + k1w1 (k ) + k 3 w3 (k ) + K 2 xi (k )
where
1

k1 = [1 0 L 0 ] ( T −1
σ 1G1 G1 + σ 3 G3 G3 + λI σ 1G1
T T 1

M
)

1
1

( −1
k 3 = [1 0 L 0] σ 1G1 G1 + σ 3 G3 G3 + λI σ 3G3
T T T 1

M
)

1
( )(
−1
K 2 = −[1 0 L 0] σ 1G1 G1 + σ 3 G3 G3 + λI σ 1G1 Φ1 + σ 3G3 Φ 3
T T T T
)
For the details on the actual calculation of the controller gains k1, k3 and K2, refer to
Appendix E. This particular controller is actually a special case of the 5 states
feedback controller described in Section 6.9 above. However, the concept behind the
controller is more complex. For a comprehensive treatment of this subject, refer to
“State Space Predictive Control of Inverted Pendulum” [2] by Yong Tet Leong.

Page 51
CONTROLLER DESIGN

6.11 Swing Up Controller

The swing up controller is required to swing the pendulum from its downward or
pendant position to its upright position. The swing up controller used for this project
is an adaptation of the controller proposed by K Furuta and M Yamakita in “Swing-
up control of inverted pendulum using pseudo-state feedback” [3]. The swing-up
control is based on the subspace projected from the state space. The partitioned state
composed of the pendulum’s angular position and velocity, which are selected as
pseudo-state, are assigned different accelerations of the arm. Based on the vector
fields in the partitions of the subspace, the trajectories connecting the pendant state to
the upright state in the pseudo-state space is determined. Each vector field
corresponds to a control law giving the prescribed acceleration. In the trajectory
determination, the angular velocity of the motor is neglected, and it is assumed that
the acceleration is of the bang-bang type.

Consider equation (A9) as stated in Appendix A.

( )
m1 L0 l1α&& cosθ + J 1 + m1l12 θ&& − 12 m1l12α& 2 sin 2θ + C1θ& + m1 gl1 sin θ = 0
( 1 1 1 )
J + m l 2 θ&& + C θ& + m gl sin θ = − m L l α&& cosθ + 1 m l 2α& 2 sin 2θ
1 1 1 1 0 1 2 1 1
(6.1)

Now, suppose that the last term of the right-hand side equation (6.1) can be
neglected, that is,
1
2 m1l12α& 2 sin 2θ = 0

This assumption is valid provided that the pendulum is light enough to be swung up
with small arm velocity. Consequently, equation (6.1) is reduced to:
(J 1 )
+ m1l12 θ&& + C1θ& + m1 gl1 sin θ = −m1 L0 l1α&& cosθ (6.2)

When the arm acceleration is considered as an input to equation (6.2), the pendulum
acceleration can be determined as:

θ&& =
1
J 1 + m1l12
(− C1θ& − m1 gl1 sin θ − m1 L0 l1α&& cosθ )

Page 52
CONTROLLER DESIGN

For a given state of the pendulum’s angular position and velocity, the incremental
position and velocity can be calculated as:

∆θ = θ&Ts
∆θ& = θ&&T
s
where Ts is the sampling interval.

The projected vector fields onto the subspace can then be found for a given arm
acceleration. The projected vector fields are shown in Figures 6.10, 6.11 and 6.12 for
arm acceleration of 0rad/s, 60rad/s and –60rad/s respectively.

Figure 6.10 Figure 6.11

Figure 6.12
In the above vector fields, the downward pendant state is marked by the symbol ‘O’.
The desired state for the upright position where the pendulum position is ±π and
velocity is 0, is marked by the symbol ‘X’. The horizontal axis specifies the
pendulum’s angular position and the vertical axis specifies the angular velocity.

Page 53
CONTROLLER DESIGN

Observe from Figure 6.10 that the subspace will converge at the origin where the
angular position and velocity are both zero.

The next step combines these projected vector fields to construct a bang-bang state
feedback. For simplicity, it is assumed here that there is a direct proportional
relationship between the motor’s driving command, u, and the arm acceleration.

It can be observed that there are many switching patterns of the arm acceleration that
can swing the pendulum from the pendant position to the upright position. The
switching pattern implemented in this project is shown in Figure 6.13 below:

Region A, u = -u0
Region B, u = u0

Figure 6.13
This switching pattern is chosen because it is simple, easy to adapt for different
systems, and it is intuitively clear as to how the control action acts to swing up the
pendulum. The control action is applied only in regions A and B. Region A can be
specified as:
π
0 <θ ≤ , θ& ≥ 0
2
Region B can be specified as:
π
− ≤ θ ≤ 0, θ& ≤ 0
2
There are no control actions when the pendulum is above the horizontal. In this
region above the horizontal, we use the force of gravity to retard the pendulum
before it reaches its desired state. Note that the subspace trajectories, upon leaving
regions A and B, will have a higher velocity magnitude or larger absolute angular
position when compared to the unforced system. Over a few cycles of swinging, the

Page 54
CONTROLLER DESIGN

angular position will reach ±π with a low velocity. To allow adjustments for the
speed of swing-up action and the number of swings, let:
u0 = K S × uM
where Ks is a user supplied constant between 0 and 1,
uM is the maximum allowable motor driving command.

Page 55
CONTROLLER DESIGN

6.12 Dead Zone Mapping

When the motor’s torque cannot overcome the effective moment of inertia of the
load and the friction on the axis of rotation, the arm will be stationary. This is called
the dead zone effect of the motor. The ideal and actual torque-input relationship is
illustrated in Figures 6.14 and 6.15 respectively. Here, a simplistic linear model is
assumed.
τ τ
τM τM

u -dz u
-uM uM -uM dz uM

-τM -τM

Figure 6.14 Figure 6.15

Dead zone mapping may be used to compensate for this effect. It is a simple
mapping function that maps all driving signals that are within the dead zone to the
boundary of the dead zone. The resulting torque-input relationship is shown in Figure
6.16 below.
τ
τM

-dz u
-uM dz uM

-τM

Figure 6.16
Note that the dead zone boundary for positive and negative commands need not be
the same. It is illustrated as such for simplicity of presentation only.

Page 56
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

Chapter 7 Experimental Results and


Discussion for Controller
Design

7.1 Introduction

This chapter presents the results obtained from the different controllers. It has to be
stated that because of the dead zone of the motor, the experimental results have
deviated too far from the simulated results that there cannot be any meaningful
comparisons. As such, in this report, no attempts have been made to compare the
results with the simulated results. Furthermore, there are no apparatus available to be
able to introduce a consistent disturbance to the different controllers. However, the
performance of the different controllers can be compared with respect to other
controllers. All the results are obtained from System II as stated in Appendix F.

The controllers were designed based on models derived from (5.2) of Chapter 5.
Except for the GPC controller, all the other controllers were designed using Pole
Placement technique. The measurable quantities are the pendulum position and the
incremental arm position. As no state observers were implemented, the unmeasurable
state variables are approximated by:

α (k ) = α (k − 1) + ∆α (k )
∆α (k )
α& (k ) =
Ts
β (k ) − β (k − 1)
β& (k ) =
Ts
where ∆α(k) is the incremental arm position,
k is the sample index.

Page 57
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

The design process is mostly through trial and error as there are no particular
specifications to meet. The best responses are then adopted for presentation in this
chapter. The results for the controllers are obtained with dead zone mapping turned
off. The effects of dead zone mapping will be discussed separately.

Page 58
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

7.2 State Feedback Controller


(Discrete and Continuous Time Model)

The 3 state and 4 state feedback controllers are designed using pole placement
technique. The discrete and continuous time models are shown below, based on the
reference model obtained in Chapter 5.
x&3 = A 3 x3 + B3 u
α&&   − 1.3705 3.8557 − 0.01242 α&   0.5721
 β&  =  0 0 1   β  +  0 u
      
 β&& − 0.9367 51.5747 − 0.1661   β&  0.3910
x3 (k + 1) = A 3d x3 (k ) + B3d u (k )
α& (k + 1)  0.9864 0.0383 0.0001 α& (k ) 0.0057
 β (k + 1) =  0 1.0026 0.0100  β (k ) +  0 u (k )
      
 β& (k + 1) - 0.0093 0.5156 1.0009   β& (k ) 0.0039
x& 4 = A 4 x4 + B 4 u
α&  0 1 0 0  α   0 
α&&  0 − 1.3705 3.8557 − 0.01242 α&   0.5721
 =   +  u
 β&  0 0 0 1  β   0 
 &&   &   
 β  0 − 0.9367 51.5747 − 0.1661   β  0.3910
x4 (k + 1) = A 4d x 4 (k ) + B 4d u (k )
α (k + 1) 1 0.0099 0.0002 0  α (k )  0 
α& (k + 1) 0 0.9864 0.0383 0.0001 α& (k ) 0.0057 
 = + u (k )
 β (k + 1) 0 0 1.0026 0.01   β (k )  0 
&      
 β (k + 1) 0 − 0.0093 0.5156 1.0009  β& (k ) 0.0039

The controllability matrices for the 3 state models are:


0.5721 − 0.7890 2.5965
S3c = 0 0.3910 − 0.6009 Rank (S3c ) = 3
0.3910 − 0.6009 21.0063
0.0057 0.0056 0.0055
S3d = 0 0.0001 0.0001 Rank (S3d ) = 3
0.0039 0.0038 0.0038

Page 59
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

The controllability matrices for the 4 state models are:


 0 0.5721 − 0.7890 2.5965 
 0.5721 − 0.7890 2.5965 − 6.1364 
S4c =  Rank (S 4c ) = 4
 0 0.3910 − 0.6009 21.0063 
 
0.3910 − 0.6009 21.0063 − 36.9126
 0 0.0001 0.0001 0.0002
0.0057 0.0056 0.0055 0.0055
S4d =  Rank (S 4d ) = 4
 0 0.0001 0.0001 0.0001
 
0.0039 0.0038 0.0038 0.0038

Since all the controllability matrices have full rank, the pole placement technique can
then be used to design the state feedback controllers.

The closed loop poles for the 3 state feedback system are chosen to be at:
0.9881 + 0.0591i
0.9881 - 0.0591i
0.9572 (3 State Discrete Time Model)
and:
-1.1547 + 5.8415i
-1.1547 - 5.8415i
-4.4259 (3 State Continuous Time Model)

The feedback controller’s gains (K3) that correspond to the above poles are shown
below. This set of gains will be used throughout this chapter for comparison and
discussion.
K3 = [-8 250 25]

Page 60
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

The controller response is shown below:

Figure 7.1
From Figure 7.1, we can see that the system was able to balance itself upright. Note
that the arm position information is wrapped around such that it will always be
within the range of ±π. There is no control over the arm position. Furthermore, the
arm velocity has a non-zero steady state error and the arm can be seen to be rotating
in the clockwise direction at a fairly constant speed. The arm position is not a state
variable in the model and hence the controller output will be independent of the arm
position.

The arm position can be better controlled using the 4 states feedback controller as the
arm position is a state variable of the 4 states linear model. The closed loop poles for
the 4 state feedback system are chosen to be at:
0.9964 + 0.0437i
0.9964 - 0.0437i
0.9840
0.9100 (4 state Discrete Time Model)

-0.2802 + 4.3139i
-0.2802 - 4.3139i
-1.6142
-9.2821 (4 State Continuous Time Model)

Page 61
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

The feedback controller’s gains (K4) that correspond to the above poles are shown
below.
K4 = [-10 -10 250 40]

The controller response is shown below:

Figure 7.2
From Figure 7.2, we can see that the arm position is now restricted within some finite
bounds. There is an improvement on the control of the arm position using the 4 states
feedback controller as compared to the 3 states feedback controller as expected.

For the 3 state feedback controller, the output can be defined as the arm velocity,
pendulum position, and pendulum velocity. For the 4 state feedback controller, the
output can also be defined as the arm position. The integral controller (I), or
proportional controller (P), and the proportional and integral controller (PI) can be
configured to act on each of these outputs. As such, the number of possible
combinations is very large and a treatment of every controller would be very
intensive. The discussion on the I controller, P controller and PI controller will be
limited to its effect on the system with 3 state feedback, taken as a plant to be
controlled.

Page 62
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

7.3 State Feedback Controller with Integral Action


(Continuous Time)

When an integrator is added to a system and the loop closed, the steady state error
due to step inputs will reduce to zero. This increases the system type by 1. The
integral controller is used primarily to improve the steady state response of control
systems. This section explores the effects of using the integral controller to improve
the steady state response of the 3 state feedback system taken as a whole.

Taking the system with 3 state feedback as the plant to be controlled, the poles are
reproduced below:
-1.1547 + 5.8415i
-1.1547 - 5.8415i
-4.4259

With an integral gain of –8 which acts on the arm velocity, the closed loop poles are:
-1.2606 + 5.4840i
-1.2606 - 5.4840i
-1.9809 + 1.7837i
-1.9809 - 1.7837i
The system’s response is shown below:

Figure 7.3
By having the integral action on the arm velocity, the arm velocity should reduce to
zero theoretically. From the results above, we see that the arm position is fluctuating

Page 63
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

about zero. Even though the arm velocity cannot reduce to zero, as it should, the
mean of the arm velocity over a period of time can be said to be near zero. The
reason for this disparity is due to the prominent effect of the dead zone. When the
correcting error signal falls within the dead zone of the motor, it will not be able to
drive the motor and hence the error will increase until a level that is outside the dead
zone before the controller can take effective action.

This particular controller combination is effectively a 4 state feedback controller with


controller gains at:
K4 = [-8 -8 250 25]

Comparing this controller’s response to that of the 4 state feedback controller, we


can see that the responses are quite similar in terms of the magnitude of fluctuation
of the arm and pendulum position.

Page 64
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

7.4 State Feedback with Proportional Control


(Continuous Time)

A proportional controller is essentially an amplifier with an adjustable gain. A


proportional controller increases the speed of the response and improves the transient
characteristics.

The gain values (K matrix) that correspond to the poles are as below which is similar
to the one use in the 3 state controller.
-8
250
25

With a proportional gain of 1000 (Kp = 1000) acting on the pendulum position. The
closed loop poles shifted from

-1.1547 + 5.8415I

-1.1547 - 5.8415I
-4.4259
to
-0.3241
-3.0794 +20.8685i
-3.0794 -20.8685i

Page 65
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

Figure 7.4

From figure 7.4 above, we can see that the driving input had increased. This verified
the proportional controller action, which acts like an amplifier to the input error
signal. From the figure, we can see that the system response is faster. The velocity is
about three or four times that of the 3 state feedback controller.

Page 66
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

7.5 3 State and 4 State Feedback Controller with Proportional and Integral
Control (Continuous Time)

The Proportional and Integral is basically a lag compensator. This controller can
improve the steady state characteristics. By properly designing the PI controller, it is
possible to make the transient response relatively small, but may cause the speed of
response to slow down. This is because the PI controller, being a low pass filter, will
attenuate the high frequency components of the signal.

With Kp = 50 and Ki=8 set

The closed loop poles shifted from


-1.1547 + 5.8415I

-1.1547 - 5.8415I
-4.4259 for the 3 state feedback to

-2.0947 + 7.7369i
-2.0947 - 7.7369i
-2.2935
-9.6101e-018 With PI control action on pendulum position.

Figure 7.5

With PI action, the system performance compared to the 3 state feedback controller
is just slightly better. This is due to the additional parameters (P gain and I gain) that
made it difficult to fine tune.

Page 67
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

7.6 State Feedback Controller (Incremental Model)


(Discrete Time)

The incremental models used have included an extra state variable u(k-1).
Examination of this state variable reveals that it is effectively performing an integral
action over all the other state variables. Assuming that all the initial states of the state
variables are all zero, then the following can be written:
u (0 ) = 0
u (1) = − K 1 xi (1) + (1 − K 2 )u (0 )
= − K 1 xi (1)
u (2 ) = − K 1 xi (2 ) + (1 − K 2 )u (1)
= − K 1 xi (2 ) + (1 − K 2 )[− K 1 xi (1)]
= − K 1 xi (2 ) − K1 (1 − K 2 )xi (1)
u (3) = − K 1 xi (3) + (1 − K 2 )u (2 )
= − K 1 xi (3) + (1 − K 2 )[− K 1 xi (2 ) − K 1 (1 − K 2 )xi (1)]
= − K 1 xi (3) − K 1 (1 − K 2 )xi (2 ) − K 1 (1 − K 2 ) xi (1)
2

Observe that the controller output is performing an integral action, that is, summing
up all the previous state variables over a period of time. As such, we would expect
good steady state response from the controllers designed using this incremental
model.

The 4 state and 5 state incremental model are shown below:


x4i (k + 1) = A 4di x4i (k ) + B 4di ∆u (k )
α& (k + 1)  0.9864 0.0383 0.0001 0.0057  α& (k )   0.057 
 β (k + 1)  0 1.0026 0.0100 0   β (k )   0 
 = + ∆u (k )
 β& (k + 1) − 0.0093 0.5156 1.0009 0.0039  β& (k )  0.0039
      
 u (k )   0 0 0 1  u (k − 1)  1 
x5i (k + 1) = A 5di x5i (k ) + B 5di ∆u (k )
α (k + 1) 1 0.0099 0.0002 0 0   α (k )   0 
α& (k + 1) 0 0.9864 0.0383 0.0001 0.0057  α& (k )  0.0057
  
 β (k + 1) = 0 0 1.0026 0.0100 0   β (k )  +  0  ∆u (k )
&      
 β (k + 1) 0 − 0.0093 0.5156 1.0009 0.0039  β& (k )  0.0039
 u (k )  0 0 0 0 1  u (k − 1)  1 

Page 68
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

For the 4 state incremental model, the poles are located at:
z1 = 0.9295, z2 = 0.9871, z3 = 1, z4 = 1.0733
For the 5 state incremental model, the poles are located at:
z1 = 0.9295, z2 = 0.9871, z3 = 1, z4 = 1, z5 = 1.0733

The controllability matrices are:


0.0057 0.0113 0.0168 0.0223
 0 0.0001 0.0002 0.0003
S4i =   Rank (S 4i ) = 4
0.0039 0.0077 0.0116 0.0154
 
 1 1 1 1 
 0 0.0001 0.0003 0.0004 0.0007 
0.0057 0.0113 0.0168 0.0223 0.0277 
 
S5i =  0 0.0001 0.0002 0.0003 0.0005 Rank (S5i ) = 5
 
0.0039 0.0077 0.0116 0.0154 0.0192 
 1 1 1 1 1 

Since all the controllability matrices have full rank, the pole placement technique can
then be used to design the state feedback controllers.

The closed loop poles for the 4 state (incremental model) feedback system are chosen
to be at:
0.9207 + 0.0539i
0.9207 - 0.0539i
0.9101
0.7633

The feedback controller’s gains (K4i) that correspond to the above poles are shown
below.
K4i = [-8 210 30 0.4]

Page 69
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

The controller response is shown below:

Figure 7.6
From Figure 7.6, we see that its response is much more superior compared to the 3
states feedback controller. The arm velocity, in this case, is very low. The pendulum
position is fluctuating very closely about zero. However, the motor driving command
is quite large.

The closed loop poles for the 5 state (incremental model) feedback system are chosen
to be at:
0.9728 + 0.0676i
0.9728 - 0.0676i
0.9747
0.8907
0.7156

The feedback controller’s gains (K4i) that correspond to the above poles are shown
below.
K5i = [-15 -10 200 30 0.4]

Page 70
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

The controller response is shown below:

Figure 7.7
From Figure 7.7, we can observe that among all the controllers, the 5 state feedback
controller gives the best response. The arm position can be constrained within a very
small region of approximately ±10 degrees while the pendulum is kept upright.

Page 71
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

7.7 Generalized Predictive Controller

The model used for implementation of the GPC controller is the 5 state incremental
model as stated in Section 7.6 above. In “State Space Predictive Control of Inverted
Pendulum” [2] by Yong Tet Leong, the author gave a comprehensive treatment of
the subject and a systematic way of tuning the controller. The controller designed for
this report has the following parameters:
Ny1 = 120, Ny3 = 10, Nu = 10, σ1 = 1, σ3 = 0, λ = 0.01

The corresponding controller gains are:


K2 = [9.9073 8.1895 -216.7099 -30.2705 -0.3456]

The closed loop poles can then be found to be:


0.9720 + 0.0157i
0.9720 - 0.0157i
0.9294
0.8480 + 0.1211i
0.8480 - 0.1211i

The controller response is shown below:

Figure 7.8
It can be seen that the GPC response is very similar to the 5 state feedback controller
response designed using pole placement technique. The GPC controller and the 5
state feedback controller are both based on the incremental model which has the

Page 72
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

effect of integrating all the state variables. This effectively reduces the steady state
errors even though the dead zone of the motor had shown to overwhelm other forms
of steady state compensation. Therefore we can conclude that using the 5 state
incremental model for design of controllers will give the best response among all the
controllers presented here.

Page 73
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

7.8 Swing-Up Controller

The swing-up controller can be fine tuned such that the pendulum is swung up to its
upright position in 2 motions, one swing in either direction to gain momentum, and
the second swing in the opposite direction to reach the upright position. This fine-
tuning is done by adjusting the amplitude of the driving signal. The amplitude where
the swing-up can be achieved in 2 motions will be referred to as the “critical
amplitude”.

For a swing-up gain of 0.514, corresponding to a driving amplitude of 131 counts,


the following response is achieved.

Figure 7.9
We see that the pendulum is swung up with 2 clean motions, after which the
balancing controller took over control. Note that the glitch appearing at around the
30th to 40th sample of the pendulum position is caused by an instrumentation error.

The critical amplitude can be easily found for a particular set by the trial and error
approach. It should be noted that it will give consistently good results only if the
same initial conditions are met every time, that is, the pendulum’s starting position is
at the downward position and the velocity is zero. However, this initial condition will
not be met if the balancing controller was to fail and the swing-up controller was to
take over control. It would start off from some non-zero pendulum position and
velocity and subject to that, the swing-up may fail because the final velocity may be
too high for the balancing controller to catch on.

Page 74
EXPERIMENTAL RESULTS AND DISCUSSION FOR CONTROLLER DESIGN

7.9 Effect of Dead Zone Mapping

The effects of dead zone mapping can only be observed if the controller driving
output signals are small. To demonstrate the effects, a 5 state feedback controller was
designed using the pole placement technique which will produce small driving
signals. The controller gains are:
K5i = [-2.7007 -2.8342 91.4134 12.7323 0.2548]

The controller response without dead zone mapping is shown in Figure 7.10 below.

Figure 7.10

The controller response with dead zone mapping is shown in Figure 7.11 below.

Figure 7.11
Comparing the above 2 responses, it can be seen that the arm position, as well as the
pendulum position, is regulated better with the dead zone mapping turned on. This
can only be said for controllers that produce small control signals which lie within
the dead zone. Otherwise, there are no noticeable effects

Page 75
GRAPHICAL USER INTERFACE

Chapter 8 Graphical User Interface


8.1 Background

The operations for various processes are often interconnected and rather complicated
and tedious to perform. Even the operation of getting the pendulum running, various
shelling processes that to be done. This can prove to be repelling to the user, cause
not only does he need to waste precious time. He also needs to understand and
perform the messy, tedious and unfriendly operations. In process, careless mistaken
will also arise.

This is due to the fact that most of the pendulum control software e.g. ECM, LIB96
etc are Dos environment programs. While all the computation and calculation are
done in Matlab environment. Constant shelling between Dos, ECM, Windows and
Matlab environment has to be performed.

Frustration and confusion always hinder the user in many instances, as we have
experienced. Taking to retrieve data from the pendulum as an example, user will
have to shell out of Matlab, out to Windows and then into ECM (Dos) environment.
Then he will have to wait for the data to be downloaded, after that he will have to
toggle back to Windows and run Raw2mat (Dos) to convert the data into Matlab data
file. After this he will have to shellback to Matlab environment which is anchor in
Window environment. To do this, without the help of an integrated GUI, can prove
to be very repelling and error prone.

Page 76
GRAPHICAL USER INTERFACE

8.2 Objectives

Most engineering courses contain abstract concepts that are important for the
understanding of material especially in control study. The main objective for
implementing a GUI is make complicated and tedious operations transparent to the
user. The idea is to let the user have all the time and concentration to design and
implement their design.

In that aspect, the transparent operations of the GUI have been designed in such a
thought in mind. It must be user-friendly, captivating, easy to operated and aid user
understanding. Yet it must not limit the freedom of design and must also be
stimulating to the user. In this 98 version of the GUI, we have maximized Matlab ver
4.2 graphical ability to it’s fullest to create a beautiful front-end interface for the
user.

With an integrated GUI, the problem of data storage will also be solved at the same
time. As the number controllers and design increases, files and programs handling
will be more complicated. With a standard database system that comes with the GUI,
user will have no problems figuring out where are the files and program. It will also
allow different users to quickly carry on research and study on any computer system
that have been installed with this GUI interface.

Section 8.4 will serve as guide and an instruction set to operate the GUI.

Page 77
GRAPHICAL USER INTERFACE

8.3 Features

The GUI is built fully in Matlab environment. User with different knowledge in
control engineering has been considered while designing the GUI. The GUI is
designed to provide a common platform for both advance user and beginner user.

The whole interface will integrate all the operations and make it transparent to the
user. This enables the user to be fully concentrate in the learning process. The
program also divides the process into various modules, which allow user to perform
the desire process at any time he wants.

The Interface is user-friendly, captivating, easy to operated and aid user


understanding. It have user with variety and does not limit the freedom of design and
must also be stimulating to the user.

A common database system will inter-link each part of the process. This solve messy
file storage problem. Thus allowing data to be common in all part of the program.

A Pentium 200 system with 64MB of ram is recommended to run this program. This
is because the GUI Interface program is built will intensive graphical enhancement
and error checking.

Page 78
GRAPHICAL USER INTERFACE

8.4 Graphical User Interface Version 98 (Screen Shots and Introduction)

8.4.1 Startup Screen


To begin, start Matlab and change directory
to Run directory. On Matlab prompt, type
<Go>.

Figure 8.1 on the right will appear after the


go command. The welcome screen will
notify the user the starting of the program.
This act as a welcome menu, and show the
current version of the GUI. To proceed with
the program, the user will have to click
<Continue > to enter to the GUI. Figure 8.1

8.4.2 Introduction Screen

The introduction screen (Figure 8.2). It


shows the objectives of this GUI interface
program.

This screen allows the user to access the


Beginner and Advance. Depending on the
user control knowledge, he has the freedom
to go into either of them by clicking on Figure 8.2
<Beginner> or <Advance> button.

System Configuration can be access by


clicking on the <System Config> button.

Page 79
GRAPHICAL USER INTERFACE

8.4.3 System Configuration Interface

The System Configuration Interface option


(Figure 8.3) display the system parameters
used by the software in all its calculation.
Example like armature rotation counts which
refers to the encoder resolution in count/rev.
In case the encoder has to be change, we
only need edit the parameter here. The whole
program will still function with the new Figure 8.3
encoder.

The user can also edit the system parameters


used for Method 1 of System Identification.

8.4.4 Beginner Interface Option

The Beginner Interface option (Figure 8.4d)


will act as a teaching aid. It will explain for
the whole system. It is design to offer step
by step guide to the new user to this system.
System modeling, identification, design,
implementation and the testing of controller
are being guided step by step. With this 98
version of the GUI, we have maximized Figure 8.4
Matlab graphical ability to it’s fullest to
create a beautiful front-end interface for the
user.

System Setup and Mathematical Model


Interface can only be invoked in this
interface.

Page 80
GRAPHICAL USER INTERFACE

8.4.5 Advance Interface Option

As for the ‘Advance’ Interface Option


(Figure 8.5), the user will have less wordily
description and notes. Advance option
interface, the user will directly go into the
various processes he desire to perform. He
will not encounter detail guide and
explanation screens as it is assumed the user
is familiar with the system. This difference Figure 8.5
is to let the advance user do what he need,
faster without all those detail explanation.

Extra features like multiple System


Identification can only be access from this
option.

Page 81
GRAPHICAL USER INTERFACE

8.4.6 System Setup Interface

System Setup Main Interface screen shot


(Figure 8.6) can be invokes only from the
Beginner Interface Option. The interface
consists of 5 screen. These 5 screen will
describe the basically the system setup, the
apparatus and equipment used. This
interface will also offer a detail explanation
of each of the functions of each of the Figure 8.6
components. (See Chapter 2 for full details)

There are a total of 5 screen shots that make


up the System Setup Interface. The objective
for this interface is to let the user know the
apparatus and components of the Inverted
Pendulum System.

Software description screen shot (Figure


8.7) describes the function of this GUI. How
this GUI will integrate the entire
environment and software. Providing a
transparent, easy to use, friendly, fast,
interesting, captivating etc. learning
platform for the user.

Figure 8.7

Page 82
GRAPHICAL USER INTERFACE

Personal computer system screen shot


(Figure 8.8) state the function and roles of
the personal computer in this setup. How it
being use as a used as a development
platform.

Figure 8.8

KRI PP-300 Inverted Pendulum Apparatus


screen shot (Figure 8.9) provide a detail
description of the devices and equipment of
the pendulum system and the encoder and
potentiometer is used.

Figure 8.9

Universal Controller UC96 Microcontroller


screen shot (Figure 8.10) describe the single-
board microcontroller system used for the
pendulum system. How this controller can
be suitable for implementing a wide variety
of standalone embedded systems.

Figure 8.10

Page 83
GRAPHICAL USER INTERFACE

Motor Driver Board & Power Supply Unit


screen shot (Figure 8.11) present the design
of the motor drive board. How to give rise to
high reliability and better connectivity
between the mircocontroller and driver
board and to drive the motor directly from
the board.
Figure 8.11

This screen also described the power supply


system

Page 84
GRAPHICAL USER INTERFACE

8.4.7 Mathematical Modeling

The Mathematical Modeling Interface can only be access under the Beginner Interface
Option. This set of interface consists of 10 screen. Just like the System Setup Interface, it is
design to provide new user to this system to provide them with some basic background
knowledge of control theory using those that used here.

This set of interfacing screen wills describes the derivations of the mathematical model use
by the system. It will cover the whole mathematical derivation process. How we use the
Lagrange’s Equation of Motion of formulate the dynamic model. How we finally get the
incremental model for 5 state incremental controller and General Predictive controller.

The Mathematical Modelling option main


interface screen shot (figure 8.12), welcome the
user to the Mathematical Modelling series of
interface.

Figure 8.12

Figure 8.13, shows the coordinate system which


is used in the derivation process.

Figure 8.13

Page 85
GRAPHICAL USER INTERFACE

Figure 8.14, shows how the Lagrange’s


Equation of Motion and the motor equation is
used.

Figure 8.14

Figure 8.15, show how the linearized model is


obtained.

Figure 8.15

Figure 8.16, show the discrete model and it’s


derivation.

Figure 8.16

Page 86
GRAPHICAL USER INTERFACE

8.4.8 Miscellaneous
This interface (figure 8.17) can be access both under the Beginner or Advance
Interface Option. This interface is design to find out (measure) two sets of parameters
of the system. The dead zone and swing-up reference parameters are important,
because they are need in balancing the system. (Refer to chapter 6.51 )

The user should access this interface from time to time or when the pendulum set is
change. This is because of the different pendulum have different characteristic due to
wear and tear.

Figure 8.17, show the Miscellaneous


screen. The instructions to follow are
fully documented in the interface. As the
two processes take some time to perform
and the system might seem not to be
working. Users are advice to follow the
instructions carefully.

Figure 8.17

Page 87
GRAPHICAL USER INTERFACE

8.4.9 System Identification

This set of interfaces can be access both under the Beginner or Advance
Interface Option. But user may experience some differences when access this
interface from the different two option. This is due to the design of the system
catering for different user knowledge level in the system. This interface is
design to collect the data from the system and perform the estimation process
to complete the process of system modelling.

The objectives of this interface are to provide a platform for user to collected
data in an easy and hassle free matter. The interface is also equipped with
verification facility so that the user can check if the data collected are correct.
Beside that this interface will serve as a guide to the user to guide him along
step by step in the process of System Identification.

System Identification consists of two main module, which are Parameter


Estimation and Test Signal Design. Test Signal Design Interface is the same
for both Beginner and Advance Interface Option. But for Parameter
Estimation, Beginner Interface Option can only access the Single Parameter
Estimation, where else user from the Advance Interface Option can access
both single parameter estimation and multi-parameter estimation interface.

This set of interface is one of the most graphical intense of the whole GUI. It
pushes Matlab Ver4.2 graphical capability to it’s fullest especially in the
single parameter estimation Interface. Where the data have to be process,
display and graphically enhance while keeping track of the user control
changes.

Page 88
GRAPHICAL USER INTERFACE

Figure 8.16 will appear only accessible


from the Beginner Interface Option. For
this option the user is restricted only to
single parameter estimation method
interface. After this he will be bring to a
few more screens of explanation and
guide.

Figure 8.18

The screen shot example on your left


(figure 8.19), is an example of an
explanation screen that will only appear
if the user access System Identification
from the Beginner Interface Option.

Figure 8.19

Figure 8.20 show interface will only be


shown when access from the Advance
Interface Option. For this option the user
is not restricted only to single parameter
estimation method, he also allow into the
multi-parameter estimation interface.

Figure 8.20

Page 89
GRAPHICAL USER INTERFACE

The single parameter estimation interface


(figure 8.21). This option allows the user
to perform experiment to collect data for
parameter estimation to complete System
Identification.

As single parameter estimation interface


is design especially for new user to the Figure 8.21
system. The interface is design to guide
the user along in the progress.

The screen shots on the left (figure 8.22


and figure 8.23) shows process as it is
being performed. The interface will show
the user how the data (waveforms) are
being filtered and processed step by step.

This allows the user to know what is


actually happening and give him the Figure 8.22
control to learn rather than just following
instruction. This set of interface also act
as an verification tool to allow the user to
check whether the data or system is
being model correctly.

Figure 8.23

Page 90
GRAPHICAL USER INTERFACE

Multi-parameter estimation interface


(figure 8.24). User can only access this
interface form the Advance Interface
Option. User can allow make the system
to collect multiple set of data form the
system and have it analyzed and
processed. This will average the result
and reduce the error. Therefore have a
better estimation.

Figure 8.24

Physical Parameter screen (figure 8.25)


will appear when the user click on
<Physical Parameter>. This screen is to
let user save some of the values for
method 1 of Parameter Estimation in
System Identification.

Figure 8.25

Page 91
GRAPHICAL USER INTERFACE

The result screens (figure 8.26). The output


of System Identification is to get a model
that can model the system. Both the multi
parameter estimation interface and single
parameter estimation interface of the System
Identification will produce this result screen
at the end of the estimation process.
Figure 8.26
This screen wills self invoke in the multi
parameter estimation interface. Where in the
single parameter estimation interface the
user have to click to the <Result> button to
see this screen.

Finally the screen (figure 8.27) will allow the


user to save the model for Control Design.
The save file will be in the format of :
filename.lm in the datam subdirectory. Figure 8.27

The result screen can also invoke Matlab


Simulink (Figure 2.28) where we have design
an animation to simulate the pendulum
system with the estimated parameters. From
the simulation the user can verify and check
the result enjoy the graphicals.

Note that the user while in Simulink, have to Figure 2.28


pull down Simulation toolbar and click on
<Start> to begin.

Page 92
GRAPHICAL USER INTERFACE

Design of a test signal for System Identification is not only to let the user have some
variety and fun. The main objective is to make System Identification of the Modelling
Process more accurate and versatile.

Letting the user design a test signal, he can compare the system response and see the
different in the data obtain. Due to wear and tear due to prolong use, shafts and joints will
may exhibit different friction constant. Other factor such as dead zone of the motor etc
can be better map and thus data obtain will be more accurate.

The welcome screen (figure 8.29) will


explain what the user choice in designing the
test signal. By default a test signal with a
count of 60 and 1sec period is defaulted into
the system.

The user can revert to the default test signal


Figure 8.29
anytime by pressing the <Default> button
form this screen.

The user can also choose to load a


previously saved test signal by clicking on
the load button. The save file will be in the
format of: filename.ts in the datam
subdirectory. (figure 8.30)

Figure 8.30

Page 93
GRAPHICAL USER INTERFACE

Form the main Test Signal Interface screen,


the system also allow the user to modify the
standard waveform period or magnitude by
pressing on the <Standard> button (figure
8.31).

Figure 8.31

By pressing on the <Design> button on the


main page, user can access the waveform
design interface. This interface allows the
user design the time for each of period and
designs the magnitude of each period. After
the satisfactory design is obtain, he can save
the test signal for future use. (figure 8.32)
Figure 8.32

This set of interfaces also provides the user


to view the test signal anytime he need
(figure 8.33). He just has to click on <View
Test Signal> and the signal waveform will
be plotted for the user to see. This feature is
available on every one of the test signal
interface screens.
Figure 8.33

Page 94
GRAPHICAL USER INTERFACE

8.4.10 Controller Design

The most interesting part of the program. This is the finale in the whole courseware.
The user will design a controller to balance the Pendulum System here. The
controller design will make use of the linear model estimated form the System
Identification Interface.

Using the model estimated in System Identification. The controller design will base
on that model to design the controller using Pole Placement Method (Refer to chapter
3). There are a total of 12 controllers implemented for the user to choose from.

If the user end the Controller Design


Interface without performing or going
through System Identification. A screen
prompt will ask him to perform System
Identification or to load a previously saved
model. (Figure 8.34)

Figure 8.34

Loading a saved model will cause the


system to let the user go into the main page
of Controller Design Interface. Another way
is to perform System Identification.(figure
8.35)

Figure 8.35

Page 95
GRAPHICAL USER INTERFACE

Controller Design Main Interface will let the


user have a chance to select from twelve
kind of controller design. (figure 8.36) Once
the type is selected, the gain and variables
will automatically loaded into the system.

Figure 8.36

The following screen shots, shows samples


of screen shots controller design (Figure
8.37, 8.38 , 8.39, 8.40). Depending on the
type on controller the user selects, the design
procedure varies.

All controller are design are using pole


Figure 8.37
placement method. The basic designs
procedures are as follow.

First enter the values of the poles, and click


on the find gain button. Depending on the
Continuous Time or Discrete Time option
the user have choosen. The system will warn
the user whether his design is stable or not.

The user can also vary the computed gains


Figure 8.38
to see the changes in the pole positions to
design the system.

Page 96
GRAPHICAL USER INTERFACE

Another feature is a <Root Locus> button.


This button will plot the system show the
user the root locus plots. From there, the
user can see and verify his design. If the user
choose design option with either integral or
proportional control or both, he can use the
plot to verify his design and this is very
useful. He will see what will happen to the Figure 8.39
system when he varies the PI gain.

Another implementation is we allow the user


to choose the state variable that the
controller (P, I or PI
) act on. A stable set of gain design which is
stable and acting on arm velocity may not be
stable if it act on the pendulum position.
Figure 8.40
Finally, once he satisfied he could invoke
the system to run the pendulum to verify his
designed controller. He can also save the
designed controller for demonstration in the
Demonstration Interface Option.

The system will also prompt the user if his


design is not stable.

Page 97
GRAPHICAL USER INTERFACE

8.4.11 Demonstration

User can access this interface (figure 8.39)


either from the Advance or Beginner
Option. This interface is design to let the
user show off the controllers he have
designed.

User need just to select from the list of


twelve controller similarly to the one found Figure 8.39
in Controller Design Main Interface. By
click on <Demo> the system will run the
save design by itself.

This function creates versatile for the user.


Not only allow the user to save his best
design for demonstration. It also provide a
place for the user to keep a reference set
perfect controller design for reference.

Note : Maltlab only accept raw format graphic file type. You have to visit
http://:www.alchemy.com to convert your graphic file into 8 bit HIS raw format. Matlab

command like ‘imread’ will produce great image compare to reading in directly as
bmp or jpg format.

Page 98
CONCLUSION

Chapter 9 Conclusion

In conclusion, we have fulfilled all the objectives given to us. We have verified the
mathematical model of the inverted pendulum system and the control algorithms by
the previous FYP group [1].

With the mathematical model, we have implemented two methods of estimation thus
allowing the user to compare the results. We have estimated the system parameters
of the inverted pendulum system and verified our results.

We had designed thirteen types of controllers that can balance the pendulum and
comparisons between the different controllers were made. We have implemented the
controllers that were designed by the previous FYP group [1] and made
improvements on it. Further, we introduced and implemented a few digital
controllers of which the 5 state incremental model based controllers were shown to
have superior performance.

In the front-end courseware development, we have totally changed the functionality


and outlook of the user interface. The new interface was developed with the intention
to optimize and enhance learning so that it can provide the platform needed for the
teaching of digital control courses. With an interactive and interesting teaching
approach, it is designed to provide hands-on practice to enhance and reinforce
learning for the user.

Page 99
RECOMMENDATIONS

Chapter 10 Recommendations

10.1 DC Motor

It was observed that a major limitation of this system is the low sensitivity of the
motor, caused by the motor’s dead zone. Because of this dead zone effect, the system
will be very inaccurate when the driving signal is low in amplitude, which is usually
the case when the pendulum is near its upright position. The dead zone mapping
function was implemented to try to compensate for it. This is a non-linear function
and as such, even if there are any effects, the system behavior could not be compared
against that of the linear controllers used. From the experimental results, we
observed that the dead zone mapping function would only produce noticeable
differences in performance when the controller used has a small gain, that is, if the
driving signals are small in amplitude.

Another aspect is related to safety. When the motor is driven to its maximum speed,
it is very powerful and it becomes a safety hazard. We noticed that for this system,
the mechanical parts are relatively light and not much power would be required for
proper control.

We recommend a change of motor to one that is high in precision and sensitivity, and
low in power. With such a motor, it would be more appropriate for this system in
terms of performance and safety.

10.2 Swing Up Controller

The swing up controller used was not tested fully due to time constraints. Notice that
for the active regions where the control action is applied, there is no upper bound set
for the pendulum velocity. When the swing up controller was tuned to its critical

Page 100
RECOMMENDATIONS

amplitude such that the upright position can be reached in two motions, the initial
conditions must be satisfied for the controller to function properly.

The swing up controller can be improved by setting an upper bound for the
pendulum position in the active regions. This upper bound should be the velocity on
exit of Regions A and B such that the force of gravity will decelerate the pendulum
to zero velocity on reaching the upright position. This velocity may be found
analytically or through testing of the real system. However, since the equation
describing the motion of the pendulum is non-linear, and the system parameters are
not known exactly, it may be easier to adopt the second approach to determine this
quantity.

Once determined, Regions A and B can be easily programmed to account for the
upper bound such that there will not be any control action when the upper bound
velocity is reached. This effectively limits the velocity on exit of the active regions to
this maximum value, which will bring the pendulum to upright position at zero
velocity. This will improve the reliability of the swing up controller under all
possible initial conditions. The final active regions (shaded) are illustrated in Figure
10.1 below:

Figure 10.1

Page 101
RECOMMENDATIONS

10.3 Parameter Estimation

Notice from (4.8) that if the parameter estimation is error free, then the following
relationship should hold:
φ1 φ5
=
φ2 φ6
From the experimental results, it was shown that this relationship does not exist most
of the time. We can then conclude that Method 2 of parameter estimation will
produce some estimation errors. The advantage of using Method 2 is that no prior
knowledge of any system parameters is required. The observation that it will produce
conflicting results prompted the search for a mathematically non-conflicting way of
estimation that does not require much knowledge of the system parameters. Below is
one such method of estimation which is a direct extension of Method 2.

Equations (4.6) and (4.7) are reproduced here for convenience of reference.
aα&& + bα&& sin 2 θ + cθ&&cosθ + dα& + bα&θ& sin 2θ − cθ& 2 sin θ − eu = 0 (4.6)
cα&& cosθ + fθ&& − 1 bα& 2 sin 2θ + C θ& + h sin θ = 0
2 1
(4.7)

Adding (4.6) and (4.7),


( ) (
aα&& + b α&& sin 2 θ + α&θ& sin 2θ − 12 α& 2 sin 2θ + c θ&&cosθ − θ& 2 sin θ + α&& cosθ )
+ dα& − eu + fθ&& + C1θ& + h sin θ = 0 (10.1)

Define:
a c e h
µ1 = µ3 = µ5 = µ7 =
f f f f
b d C
µ2 = µ4 = µ6 = 1
f f f

After some manipulation, the following equation can be obtained:


 µ1 
µ 
 2
µ3 
[θ&&] = −[α&& (α&& sin 2
θ + α&θ& sin 2θ − 12 α& 2 sin 2θ ) (θ&& cos θ − θ& 2
sin θ + α&& cos θ ) α& & ]
 
− u θ sin θ  µ 4 
µ 5  (10.2)
 
µ 6 
µ 
 7

Page 102
RECOMMENDATIONS

Using the unforced oscillation response, µ3, µ6 and µ7 can be estimated by:

µ3 
[ ] [(
θ&& = − θ&&cosθ − θ& 2 sin θ ) ]
θ sin θ  µ 6 
& (10.3)
 µ 7 

From these results, the rest of the parameters can be estimated by:
 µ1 
µ 
[θ&& + µ (θ&&cosθ − θ&
3
2
) ] [ (α&&sin
sin θ + α&& cosθ + µ 6θ& + µ 7 sin θ = − α&& 2
θ + α&θ& sin 2θ − 12 α& 2 sin 2θ ) α& ]
−u  
2

µ4  (10.4)
 
µ5 

Preliminary results have shown that this method is very unreliable. More studies
could be conducted to investigate if this method is a good alternative for parameter
estimation.

10.4 Simulation with Animation

The Simulink model is shown in Figure 4.4. An animation of the system has been
developed (‘sim_ani.m’). However, it had not been integrated with the final version
of the GUI due to time constraints. Improvements to the Simulink model can be
made by modelling the effects of the dead zone as well as the different controllers
used. The user can then simulate the response of the controllers and see how the
controllers would perform.

Page 103
REFERENCES

References

[1] S.H. Ang and M.B. Tan, Final Year Project 4029 Report, 1997.

[2] T.L. Yong, “State Space Predictive Control of Inverted Pendulum”, 1998.

[3] K. Furuta and M. Yamakita, “Swing up control of inverted pendulum using


pseudo-state feedback”, Proc Instn Mech Engrs Vol 206, 1992.

[4] H.L. Langhaar, “Energy Methods in Applied Mechanics”, John Wiley and
Sons Inc, pp 233-249, 1962.

[5] K. Ogata, “Electromechanical Systems”, ‘Modern Control Engineering’,


Prentice Hall, pp 118-121, 1995.

[6] K. Ogata, “Linearization of Nonlinear Mathematical Models”, ‘Modern


Control Engineering’, Prentice Hall, pp 143-149, 1995.

[7] K. Ogata, “Pseudoinverses”, ‘Modern Control Engineering’, Prentice Hall, pp


926-929, 1995.

[8] K.V. Ling, “Parameter Estimation of the KRI-PP300 Inverted Pendulum”,


1998.

[9] S.C. Tan and K.V. Ling, “Parameters Identification of a Rotary Inverted
Pendulum”, 1998.

Page 104
APPENDIX A

Definition of Symbols

The symbols used in the derivations are defined as follows:


Symbol Units Definition
α rad Arm angle about the z-axis, taken from the positive x-axis.
β rad Pendulum angle, taken from the upward vertical axis.
θ rad Pendulum angle, taken from the downward vertical axis.
J0 kg-m2 Moment of inertia of Arm section.
2
J1 kg-m Moment of inertia of Pendulum section.
C0 kg-m2/s Viscous friction co-efficient of Arm section.
C1 kg-m2/s Viscous friction co-efficient of Pendulum section.
m1 kg Effective mass of Pendulum section.
l1 m Effective length of Pendulum section.
L0 m Physical distance between pivot of Pendulum section and axis
of rotation of Arm section.
Kt N-m/A Motor torque constant.
Kb V-s/rad Motor back EMF constant.
Ku V/count Motor driver amplifier gain.
Ra Ω Motor armature coil resistance.
g m/s2 Acceleration due to gravity.
u counts Motor driving command.

Page A-1
APPENDIX A

Co-ordinate System
m1

z
l1 β

α
L0
θ
y
Figure A1
Figure A1 above shows the co-ordinate system used for the derivation of the
dynamic model. The inverted pendulum system consists of two sections, namely the
arm and the pendulum bob section. The standard right-handed Cartesian co-ordinate
system is used. The angular position of the arm, α, is assigned to be increasing when
the arm is rotating about the z-axis in the right-handed sense (when the thumb points
in the direction of the axis, the fingers point in the direction of increasing angle). The
reference of α is taken to be the x-axis.

The angular position of the pendulum, β and θ, are assigned to be increasing when
the pendulum is rotating about an axis passing through the arm section from the
origin to the pivot point of the pendulum, in the right-handed sense. The reference of
β is taken from the upward vertical and the reference of θ is taken from the
downward vertical.

Transforming between different co-ordinate systems can be easily performed as will


be shown in the derivation of the dynamic model in the downward position.

Page A-2
APPENDIX A

Lagrange’s Equation of Motion (Rotary Systems)

d  ∂L  ∂L
 − = Qi
& i  ∂Θ i
dt  ∂Θ 
L = T −V

T = Total kinetic energy of rotating body Qi = Total torque applied at axis i


V = Total potential energy of rotating body Θ i = Angular position of body about axis i

The above is Lagrange’s equation of motion [4]. It will be used in the derivation of
the dynamic model.

DC Motor Characteristics

The DC motor used in the Rotary Inverted Pendulum System exerts a torque on the
system. The motor torque can be derived [5] as follows:

Ra La
+ + +
PWM
U Amplifier Vm Eb
Ku τ, α
- - Ia -

Figure A2
The terminal voltage, Vm, after amplification, is:
Vm = K u u
where Ku is the gain of the PWM amplifier.
Applying Kirchoff’s Voltage Law,

dI a
Vm = I a Ra + La + Eb
dt
where Ia is the armature coil current,
Ra is the armature coil resistance,
La is the armature coil inductance,
Eb is the motor’s back EMF.

Page A-3
APPENDIX A

The motor’s back EMF, Eb, is proportional to the rate of change of magnetic flux and
hence proportional to the angular velocity of the motor.

Eb = K b
dt
= K bα&
For a constant field current, the torque exerted by the motor, τ, is proportional to the
armature current. Assuming that the effects of the coil inductance, La, are negligible,
the torque can be written as:

τ = Kt Ia
K t (Vm − Eb )
=
Ra
Kt Ku KK
τ= u − t b α& (A1)
Ra Ra

The Dynamic Model (Upright Position)

The dynamic model describes the system completely. It gives the exact relationships
among the variables involved. For the Rotary Inverted Pendulum System, the
dynamic model is highly non-linear. The dynamic model with the pendulum in the
upright position [3] can be derived as shown below.

Using the co-ordinate system shown in Figure A1, the kinetic energy of the arm, T0,
and the potential energy, Vo, can be written as:

T0 = 12 J 0α& 2
V0 = 0
The top view of the system is shown in Figure A3. For the pendulum section, the
L0cosα
following can be written: x

x1 = L0 cosα + l1 sin α sin β α

y1 = L0 sin α − l1 cosα sin β L0 L0sinα


z1 = l1 cos β α

x&1 = − L0α& sin α + l1α& cosα sin β + l1 β& sin α cos β l1sinβ

y& = L α& cosα + l α& sin α sin β − l β& cosα cos β


1 0 1 1
y
z&1 = −l1 β& sin β Figure A3.

Page A-4
APPENDIX A

(
x&12 = L20α& 2 sin 2 α + l1α& cosα sin β + l1 β& sin α cos β )
2

0 (
− 2 L α& sin α l α& cosα sin β + l β& sin α cos β
1 1 )
= L α& sin α + l α& cos α sin β + l12 β& 2 sin 2 α cos 2 β
2
0
2 2 2
1
2 2 2

+ 2l12α&β& sin α cosα sin β cos β − 2 L0l1α& 2 sin α cosα sin β − 2 L0l1α&β& sin 2 α cos β
(
y&12 = L20α& 2 cos 2 α + l1α& sin α sin β − l1 β& cosα cos β ) 2

0 (
+ 2 L α& cosα l α& sin α sin β − l β& cosα cos β
1 1 )
= L α& cos α + l α& sin α sin β + l12 β& 2 cos 2 α cos 2 β
2
0
2 2 2
1
2 2 2

− 2l12α&β& sin α cosα sin β cos β + 2 L0l1α& 2 sin α cosα sin β − 2 L0l1α&β& cos 2 α cos β
z&12 = l12 β& 2 sin 2 β

The squared magnitude of the velocity of the pendulum bob can be written as:

x&12 + y&12 + z&12 = L20α& 2 + l12α& 2 sin 2 β + l12 β& 2 cos 2 β − 2 L0 l1α&β& cos β + l12 β& 2 sin 2 β
= L2α& 2 + l 2α& 2 sin 2 β + l 2 β& 2 − 2 L l α&β& cos β
0 1 1 0 1

The kinetic energy of the pendulum bob, T1, and the potential energy, V1, can be
written as:
(
T1 = 12 J 1 β& 2 + 12 m1 x&12 + y&12 + z&12 )
= 12 J 1 β& 2 + 12 m1 L20α& 2 + 12 m1l12α& 2 sin 2 β + 12 m1l12 β& 2 − m1 L0 l1α&β& cos β
2 1 0 2 ( 1 1 1 )
= 1 m L2α& 2 + 1 J + m l 2 β& 2 + 1 m l 2α& 2 sin 2 β − m L l α&β& cos β
2 11 1 0 1

V1 = m1 gz1
= m1 gl1 cos β

The energy equation used in Lagrange’s Equation, L, can then be formulated as:
L0 = T0 − V0
L1 = T1 − V1
L = L0 + L1
= T0 + T1 − V0 − V1
( )
= 12 J 0α& 2 + 12 m1 L20α& 2 + 12 J 1 + m1l12 β& 2 + 12 m1l12α& 2 sin 2 β − m1 L0 l1α&β& cos β
− m1 gl1 cos β
= 1
2 (J 0 ) ( )
+ m1 L20 α& 2 + 12 J 1 + m1l12 β& 2 + 12 m1l12α& 2 sin 2 β − m1 L0l1α&β& cos β − m1 gl1 cos β

Page A-5
APPENDIX A

For the axis of rotation for α, the following can be written:


∂L
=0
∂α
∂L
∂α&
( )
= J 0 + m1 L20 α& + m1l12α& sin 2 β − m1 L0 l1 β& cos β
d  ∂L 

dt  ∂α& 
( 2
)
 = J 0 + m1 L0 α&& + m1l1 α&& sin β + 2m1l1 α&β& sin β cos β − m1 L0 l1 β&& cos β
2 2 2

+ m1 L0 l1 β& 2 sin β
( )
= J 0 + m1 L20 α&& + m1l12α&& sin 2 β − m1 L0 l1 β&& cos β + m1l12α&β& sin 2 β
+ m1 L0 l1 β& 2 sin β
d  ∂L  ∂L
 − = τα
dt  ∂α&  ∂α
(J 0 )
+ m1 L20 α&& + m1l12α&& sin 2 β − m1 L0 l1 β&& cos β + m1l12α&β& sin 2 β + m1 L0 l1 β& 2 sin β = τ α

The total torque acting on the axis of rotation in a direction that increases α is τα. It
comprises of the torque supplied by the motor and the counteracting frictional torque.
τ α = τ m − C 0α&
where τm is the torque exerted by the DC motor,
C0 is the viscous friction co-efficient of the axis of rotation of α.

(J )
+ m1 L20 α&& + m1l12α&& sin 2 β − m1 L0 l1 β&& cos β + m1l12α&β& sin 2 β + m1 L0l1 β& 2 sin β
0

= τ m − C 0α&
( )
J 0 + m1 L20 α&& + m1l12α&& sin 2 β − m1 L0 l1 β&& cos β + C0α& + m1l12α&β& sin 2 β
+ m L l β& 2 sin β = τ
1 0 1 m (A2)
( 1 0 )
J 0 + m L α&& + m l α&& sin β − m1 L0 l1 β&& cos β + C0α& + m1l12α&β& sin 2 β
2 2
11
2

+ m L l β& 2 sin β = u − KRt Ka b α&


Kt Ku
1 0 1 Ra

(J 0 ) ( )
+ m1 L20 α&& + m1l12α&& sin 2 β − m1 L0 l1 β&& cos β + C 0 + KRt Ka b α& + m1l12α&β& sin 2 β
+ m1 L0 l1 β& 2 sin β − KRt Ka u u = 0 (A3)

Similarly, the following can be written for axis of rotation for β:

∂L
= m1l12α& 2 sin β cos β + m1 L0 l1α&β& sin β + m1 gl1 sin β
∂β
= 1 m l 2α& 2 sin 2 β + m L l α&β& sin β + m gl sin β
2 1 1 1 0 1 1 1

∂L
&
( )
= J 1 + m1l12 β& − m1 L0 l1α& cos β
∂β

Page A-6
APPENDIX A

d  ∂L 

&
dt  ∂β 
( )
 = J 1 + m1l12 β&& − m1 L0 l1α&& cos β + m1 L0 l1α&β& sin β

d  ∂L  ∂L
 − =τβ
dt  ∂β&  ∂β
( )
J 1 + m1l12 β&& − m1 L0 l1α&& cos β + m1 L0 l1α&β& sin β − 12 m1l12α& 2 sin 2 β − m1 L0 l1α&β& sin β
− m1 gl1 sin β = τ β
( )
− m1 L0l1α&& cos β + J 1 + m1l12 β&& − 12 m1l12α& 2 sin 2 β − m1 gl1 sin β = τ β

The total torque acting on the axis of rotation in a direction that increases β is τβ. For
this axis, this torque comprises solely of the counteracting frictional torque.

τ β = −C1 β&
where C1 is the viscous friction co-efficient of the axis of rotation of β.

( )
− m1 L0l1α&& cos β + J 1 + m1l12 β&& − 12 m1l12α& 2 sin 2 β − m1 gl1 sin β = −C1 β&
1 0 1 ( 1 11 )
− m L l α&& cos β + J + m l 2 β&& − 1 m l 2α& 2 sin 2 β + C β& − m gl sin β = 0
2 11 1 1 1 (A4)

In matrix form, equations (A2) and (A4) can be written compactly as follows:

 J 0 + m1 L20 + m1l12 sin 2 β − m1 L0 l1 cos β  α&&


   +
 − m1 L0 l1 cos β J 1 + m1l12   β&&
C 0 + 12 m1l12 β& sin 2 β m1 L0 l1 β& sin β + 12 m1l12α& sin 2 β  α& 
 1  &  +
 − 2 m1l1 α& sin 2 β  β 
2
C1
 0  τ m 
 − m gl sin β  =  0  (A5)
 1 1   

With the motor torque characteristics described by equation (A1), the dynamic model
in the upright position described by equations (A3) and (A4) can then be written as:

 J 0 + m1 L20 + m1l12 sin 2 β − m1 L0 l1 cos β  α&& 


   +
 − m1 L0l1 cos β J 1 + m1l12   β&&
C 0 + KRt K b + 12 m1l12 β& sin 2 β m1 L0 l1 β& sin β + 12 m1l12α& sin 2 β  α& 
 a
 &  +
− 2 m1l1 α sin 2 β
&  β 
1 2
 C1
 0   KRt Ka u 
 − m gl sin β  =  u (A6)
 1 1   0 

Page A-7
APPENDIX A

The Dynamic Model (Downward Position)

Define θ to be the angular position of the pendulum taken from the downward
vertical. The following relationship between terms involving β and θ can be
established:
β =θ −π cos β = cos(θ − π ) sin β = sin (θ − π ) sin 2 β = sin 2(θ − π )
β& = θ& = − cosθ = − sin θ = sin (2θ − 2π )
β&& = θ&& = sin 2θ

By substituting these into equation (A2) yields:

(J 0 )
+ m1 L20 α&& + m1l12α&&(− sin θ ) − m1 L0 l1θ&&(− cosθ ) + C0α& + m1l12α&θ& sin 2θ
2

+ m L l θ& 2 (− sin θ ) = τ
1 0 1 m

(J 0 1 0 )
+ m L α&& + m l α&& sin θ + m1 L0 l1θ&&cosθ + C 0α& + m l α&θ& sin 2θ
2 2
1 1
2 2
1 1

− m L l θ& 2 sin θ = τ
1 0 1 m (A7)

Substituting parameters into equation (A3) yields:


(J 0 ) ( )
+ m1 L20 α&& + m1l12α&&(− sin θ ) − m1 L0 l1θ&&(− cosθ ) + C 0 + KRt Ka b α& + m1l12α&θ& sin 2θ
2

+ m1 L0 l1θ& 2 (− sin θ ) − KRt Ka u u = 0


(J 0 ) ( )
+ m1 L20 α&& + m1l12α&& sin 2 θ + m1 L0l1θ&&cosθ + C0 + KRt Ka b α& + m1l12α&θ& sin 2θ
− m1 L0 l1θ& 2 sin θ − KRt Ka u u = 0 (A8)

Substituting parameters into equation (A4) yields:

( )
− m1 L0l1α&&(− cosθ ) + J 1 + m1l12 θ&& − 12 m1l12α& 2 sin 2θ + C1θ& − m1 gl1 (− sin θ ) = 0
1 0 1 ( 1 11 )
m L l α&& cosθ + J + m l 2 θ&& − 1 m l 2α& 2 sin 2θ + C θ& + m gl sin θ = 0
2 11 1 1 1
(A9)

In matrix form, equations (A7) and (A9) can be written compactly as follows:

 J 0 + m1 L20 + m1l12 sin 2 θ m1 L0 l1 cosθ  α&&


   +
 m1 L0l1 cosθ J 1 + m1l12  θ&&
C 0 + 12 m1l12θ& sin 2θ − m1 L0l1θ& sin θ + 12 m1l12α& sin 2θ  α& 
 1  & +
 − 2 m1l1 α& sin 2θ  θ 
2
C1
 0  τ m 
 m gl sin θ  =  0  (A10)
 1 1   

Page A-8
APPENDIX A

With the motor torque characteristics described by equation (A1), the dynamic model
in the downward position described by equations (A8) and (A9) can then be written
as:
 J 0 + m1 L20 + m1l12 sin 2 θ m1 L0l1 cosθ  α&&
   +
 m1 L0l1 cosθ J 1 + m1l12  θ&&
C 0 + KRt Kb + 12 m1l12θ& sin 2θ − m1 L0l1θ& sin θ + 12 m1l12α& sin 2θ  α& 
 a
 & +
− 2 m1l12α& sin 2θ  θ 
1
 C1
 0   KRt Ka u 
 m gl sin θ  =  u (A11)
 1 1   0 

Page A-9
APPENDIX B

Linearisation of Non-Linear Mathematical Models

The linear approximation method [6] is based on the expansion of the non-linear
function into a Taylor series about the operating point and the retention of only the
linear terms. For n variables, x1, x2, …, xn, it can be briefly stated as:

y = f (x1 , x 2 ,..., xn )
y = f (x1 , x2 ,..., x n )
∂f ∂f ∂f
y − y ≈ (x1 − x1 ) x1 = x1 + ( x2 − x2 ) x1 = x1 + ... + (x n − xn ) x1 = x1
∂x1 x2 = x2 ∂x 2 x2 = x2 ∂x n x2 = x2
... ... ...
xn = xn xn = xn xn = xn

Linear Model (Upright Position)

Using the technique mentioned above, the model is linearised about:


α& = 0 β = 0 β& = 0
Let
x1 = α& x2 = β x3 = β&
x1 = 0 x2 = 0 x3 = 0

For equation (A3), let


( ) ( )
y = J 0 + m1 L20 α&& + m1l12α&& sin 2 β − m1 L0 l1 β&& cos β + C0 + KRt Ka b α& + m1l12α&β& sin 2 β
+ m1 L0 l1 β& 2 sin β − KRt Ka u u
(
= f α& , β , β& )
( )
y = J 0 + m L α&& − m1 L0 l1 β&& − KRt Ka u u
2
1 0

= f (0,0,0 )
∂f ∂f
= = C0 + KRt Ka b + m1l12 β& sin 2 β
∂x1 ∂α&
∂f
α& = 0 = C 0 + KRt Ka b
∂α& β =0
β& = 0

∂f ∂f
= = 2m1l12α&& sin β cos β + m1 L0l1 β&& sin β + 2m1l12α&β& cos 2 β + m1 L0 l1 β& 2 cos β
∂x 2 ∂β

Page B-1
APPENDIX B

∂f
α& = 0 =0
∂β β =0
β& = 0

∂f ∂f
= & = m1l12α& sin 2 β + 2m1 L0 l1 β& sin β
∂x3 ∂β
∂f
α& = 0 =0
∂β& β =0
β& = 0

y − y ≈ (α& − 0 )
∂f
∂α&
α& = 0 + (β − 0 )
∂f
∂β
(
∂f
+ β& − 0 &
α& = 0
∂β
) α& = 0
β =0 β =0 β =0
β& = 0 β& = 0 β& = 0

y ≈ y + (α& − 0)
∂f
∂α&
α& =0 + (β − 0 )
∂f
∂β
α& = 0 ( ∂f
+ β& − 0 &
∂β
) α& =0
β =0 β =0 β =0
β& = 0 β& = 0 β& =0

( )
= J 0 + m1 L20 α&& − m1 L0 l1 β&& − KRt Ka u u + C 0 + KRt Ka b α& ( )
Therefore, linearising equation (A3) yields:
(J 0 ) ( )
+ m1 L20 α&& − m1 L0 l1 β&& + C0 + KRt Ka b α& − KRt Ka u u = 0 (B1)

For equation (A4), let


( )
y = − m1 L0 l1α&& cos β + J 1 + m1l12 β&& − 12 m1l12α& 2 sin 2 β + C1 β& − m1 gl1 sin β
(
= f α& , β , β& )
(
y = − m1 L0 l1α&& + J 1 + m1l12 β&& )
= f (0,0,0 )
∂f ∂f
= = −m1l12α& sin 2 β
∂x1 ∂α &
∂f
α& = 0 =0
∂α& β =0
β& = 0

∂f ∂f
= = m1 L0 l1α&& sin β − m1l12α& 2 cos 2 β − m1 gl1 cos β
∂x 2 ∂β
∂f
α& = 0 = − m1 gl1
∂β β =0
β& = 0

∂f ∂f
= = C1
∂x3 ∂β&

Page B-2
APPENDIX B

∂f
α& = 0 = C1
∂β& β =0
β& = 0

y − y ≈ (α& − 0 )
∂f
∂α&
α& = 0 + (β − 0 )
∂f
∂β
α& = 0 (
+ β& − 0
∂f
∂β&
) α& = 0
β =0 β =0 β =0
β& = 0 β& = 0 β& = 0

y ≈ y + (α& − 0)
∂f
∂α&
α& =0 + (β − 0 )
∂f
∂β
(
+ β& − 0
α& = 0
∂f
∂β&
) α& =0
β =0 β =0 β =0
β& = 0 β& = 0 β& =0

( )
= −m1 L0 l1α&& + J 1 + m1l12 β&& − m1 gl1 β + C1 β&

Therefore, linearising equation (A4) yields:


( )
− m1 L0l1α&& + J 1 + m1l12 β&& + C1 β& − m1 gl1 β = 0 (B2)

In matrix form [3], equations (B1) and (B2) can be written as:
 J 0 + m1 L20 − m1 L0l1  α&&  C0 + KRt Ka b 0  α&  0 0  α   KRt K u 
   +  +
 &   β  = 
a
u (B3)
 − m1 L0l1 J 1 + m1l12   β&&  0 β
C1     0 − m1 1  
gl  0 

Define:

a = J 0 + m1 L20 c = m1 L0l1 e = KRt Ka u h = m1 gl1


b = m1l12 d = C0 + KRt Ka b f = J 1 + m1l12

The linearised equations, (B1) and (B2) can then be written as:
aα&& − cβ&& + dα& − eu = 0 (B1a)

− cα&& + fβ&& + C1 β& − hβ = 0 (B2a)


(B1a) × c, (B2a) × a,
acα&& − c 2 β&& + cdα& − ceu = 0 (B1b)

− acα&& + afβ&& + aC1 β& − ahβ = 0 (B2b)


(B1b) + (B2b),
(af − c )β&& + cdα& + aC β& − ahβ − ceu = 0
2
1

β&& =
af − c 2
1
(− cdα& − aC β& + ahβ + ceu ) 1 (B4)

(B1a) × f, (B2a) × c,
afα&& − cfβ&& + dfα& − efu = 0 (B1c)
− c 2α&& + cfβ&& + cC1 β& − chβ = 0 (B2c)

Page B-3
APPENDIX B

(B1c) + (B2c),

(af − c )α&& + dfα& + cC β& − chβ − efu = 0


2
1

α&& =
1
af − c 2
(− dfα& − cC β& + chβ + efu )
1
(B5)

To formulate the 3 states linear model, we define the state variables to be:
α& 
x3 =  β 
 β& 
From equations (B4) and (B5), the 3 states linear model can then be written as:
x&3 = A 3 x3 + B 3u
α&&   − df ch − cC1  α&  ef 
 β&  = 1  0 2  
0 af − c   β  +
1  
0 u (B6)
  af − c 2  af − c 2 
&& ah − aC1   β& 
 β   − cd  ce 

To formulate the 4 states linear model, we define the state variables to be:
α 
α& 
x4 =  
β 
 &
β 
The 4 states linear model can then be written as:
x& 4 = A 4 x4 + B 4 u
α&  0 af − c 2 0 0  α  0
α&&    &   
  = 1 0 − df ch − cC1  α  1 ef 
+ u (B7)
 β&  af − c 2 0 0 0 af − c 2   β  af − c 2  0 
 &&     
β  0 − cd ah − aC1   β&   ce 

The relationship between A3 and A4, B3 and B4 can be established as:


0 1 0 0 0
0   
A4 =   B4 =  
B
0 A3   3
0   

Page B-4
APPENDIX B

To express in terms of physical parameters,

( )( )
af − c 2 = J 0 + m1 L20 J 1 + m1l12 − (m1 L0 l1 )
2

= J 0 J 1 + J 0 m1l12 + J 1m1 L20 + m12 L20 l12 − m12 L20l12


= J 0 J 1 + J 0 m1l12 + J 1m1 L20
1 1
A3 = A ′3 B3 = B′3
J 0 J 1 + J 0 m1l12 + J 1m1 L20 J 0 J 1 + J 0 m1l12 + J 1m1 L20
( )(
− C0 + KRt K b J 1 + m1l12 ) m12 gL0 l12 − m1 L0l1C1 
 a

A′3 =  0 0 J 0 J 1 + J 0 m1l12 + J 1m1 L20  (B8)
(
 − m1 L0 l1 C 0 + KRt Kb
 a
) (
m1 gl1 J 0 + m1 L20 ) (
− C1 J 0 + m1 L20 ) 

(
 R J 1 + m1l1 
Kt Ku 2
)
 a 
B′3 =  0 
 K t K u (m1 L0 l1 ) 
 Ra 

Define:

d C 0 + Ra
Kt Kb
b m1l12 b m1l12 C1 C1
φ1 = = φ3 = = φ5 = = φ7 = =
a J 0 + m1 L20 a J 0 + m1 L20 f J 1 + m1l12 f J 1 + m1l12
Kt Ku
c m1 L0 l1 e c mLl h m1 gl1
φ2 = = φ4 = = φ6 = = 1 0 12 φ8 = =
Ra

a J 0 + m1 L20 a J 0 + m1 L20 f J 1 + m1l1 f J 1 + m1l12

The individual elements of A3 in terms of φ can be written as:

c 2 af − c 2
1 − φ 2φ 6 = 1 −=
af af
− df − df af ch ch af − cC1 − cC1 af
= × = × = ×
af − c 2
af af − c 2 af − c 2
af af − c 2
af − c 2
af af − c 2
−d af c h af − c C1 af
= × = × × = × ×
a af − c 2 a f af − c 2
a f af − c 2
− φ3 φ 2φ 8 − φ 2φ 7
= = =
1 − φ 2φ 6 1 − φ 2φ 6 1 − φ 2φ 6
− cd − cd af ah ah af − aC1 − aC1 af
= × = × = ×
af − c 2
af af − c 2 af − c 2
af af − c 2 af − c 2
af af − c 2
−c d af h af − C1 af
= × × = × = ×
f a af − c 2 f af − c 2 f af − c 2
− φ 3φ 6 φ8 − φ7
= = =
1 − φ 2φ 6 1 − φ 2φ 6 1 − φ 2φ 6

Page B-5
APPENDIX B

Similarly, the individual elements of B3 in terms of φ can be written as:


ef ef af ce ce af
= × = ×
af − c 2
af af − c 2 af − c 2
af af − c 2
e af c e af
= × = × ×
a af − c 2 f a af − c 2
φ4 φφ
= = 4 6
1 − φ 2φ 6 1 − φ 2φ 6

Finally, the 3 states linear model in terms of φ can be written as:


x&3 = A 3 x3 + B3u
α&&   − φ3 φ 2φ8 − φ 2φ 7  α&   φ4 
 β&  = 1  0 0 1 − φ 2φ 6   β  +
1  0 u (B9)
  1−φ φ  1 − φ 2φ 6  
 β&& 2 6
− φ 3φ 6 φ8 − φ 7   β&  φ 4φ 6 

Page B-6
APPENDIX C

Discrete Time Model

The discrete time model [2] of the system is required when using digital control
techniques. When a system described by state space equations,
x& = Ax + Bu
y = Cx
is discretized with respect to a sampling interval Ts, the corresponding discrete state
space model is obtained:
x(k + 1) = A d x(k ) + Bd u (k )
y (k ) = C d x (k )
(C1)

where k is the discrete time index,


Ts

Ad = e , B d = ∫ e Aγ Bdγ , C d = C
ATs

Incremental Model

The incremental model [2] is an alternative form of representation and will be used
in the design and implementation of the Generalised Predictive Controller.

Since u(k) = u(k-1) + ∆u(k), from equation (C1),

x(k + 1) = A d x(k ) + B d [u (k − 1) + ∆u (k )]
= A d x(k ) + B d u (k − 1) + B d ∆u (k )

Define the state variable for the incremental model to be xi:

 x (k ) 
xi (k ) =  
u (k − 1)
The incremental model can be written as:

 x(k + 1) A d B d   x (k )  B d 
 u (k )  =  0 + ∆u (k )
   1  u (k − 1)  1 
(C2)
 x(k ) 
y (k ) = [C d 0] 
u (k − 1)

Page C-1
APPENDIX C

xi (k + 1) = A di xi (k ) + B di ∆u (k )
y (k ) = C di xi (k )
(C3)

where

A Bd  B 
A di =  d  , B di =  d  , C di = [C d 0]
0 1 1

Page C-2
APPENDIX D

Concept of Predictive Control

Predictive control [2] belongs to the class of model-based controller design concepts.
That is, a model of the process is explicitly used to design the controller. The concept
of predictive control for a single-input, single-output digital system where the
sampling period is Ts, can be illustrated by Figure D1.

N2 N2
(a) (b)
w w
y^ y^

samples samples
k k+N2 k k+N2
k-1 k+1 k-1 k+1

From Previous
(c) (d) Prediction Result
u
u
From Present
Prediction Result

k samples k samples
past k-1 k+1 future past k-1 k+1 future

t time t time
t-Ts t+Ts t-Ts t+Ts
Figure D1
In Figure D1, the time scales in parts (a), (b), (c) and (d) are time scales relative to
the sample k, which denotes the present. The time scales with axes labelled as “time”
are absolute time scales. First, consider Figure D1 (a) and (c), and suppose that the
current time is denoted by sample k which corresponds to the absolute time t.
Further, u(k), y(k) and w(k) represents the controller output, the process output, and
the desired output at sample k respectively. Now, define:

u = [u (k ), u (k + 1), L, u (k + N 2 − 1)]
T

yˆ = [ yˆ (k + 1), yˆ (k + 2 ), L, yˆ (k + N 2 )]
T

w = [w(k + 1), w(k + 2 ), L, w(k + N 2 )]


T

where N2 is the prediction horizon and the symbol ^ denotes prediction. Then, a
predictive controller calculates a future controller output sequence u so as to make
the predicted output of the process ŷ close to the desired process output w. The

Page D-1
APPENDIX D

process output is predicted using a model of the process that describes the
relationship between the input and the output of the process. The controller output
sequence u is shown in Figure D1 (c). Desired process output w, together with
predicted output ŷ is shown in Figure D1 (a). This desired process output is often
called the set point or reference trajectory and it can be an arbitrary sequence of
points.

Rather than using the controller output sequence determined in the above way to
control the process in the next N2 samples, only the first element of this controller
output sequence (that is, u(k)) is used to control the process. At the next sample, the
whole procedure is repeated using the latest measured information. This is called the
receding horizon principle and is illustrated by Figure D1 (b) and (d), which show
what happens at time t+Ts.

Again, a future controller output sequence is calculated such that the predicted
process output is close to the reference trajectory. In general, this controller output
sequence will be different from the one obtained at the previous sample, as is
illustrated by Figure D1 (d). The reason for using the receding horizon approach is
that this provides compensation for future disturbances or modelling errors. For
example, due to a disturbance or modelling error, the predicted process output
yˆ (k + 1) predicted at time t is not equal to the process output y(k) measured at t+Ts.
Then, it is intuitively clear that at time t+Ts, it is better to start the predictions from
the measured process output rather than from the process output predicted at the
previous sample. The predicted process output is now corrected for disturbances and
modelling errors. A feedback mechanism is thus activated. As a result of the receding
horizon approach, the horizon over which the process output is predicted shifts one
sample into the future at every sample instant.

Page D-2
APPENDIX E

Generalised Predictive Control Law

The Generalised Predictive Control (GPC) law [2] can be derived by minimising a
criterion function. Generally, the controlled variables can be any linear combinations
of the state variables. For the inverted pendulum system, we define the controlled
variables to be the pendulum position and the arm position to simplify the problem.

The criterion function must be such that it is at a minimum when the controlled
variables follow the reference trajectory exactly. The criterion function used for this
system is:
Ny1 Ny3
J c = σ 1 ∑ [w1 (k + n ) − α (k + n )] + σ 3 ∑ [w3 (k + m ) − β (k + m )] +
2 2

n =1 m =1
Nu
λ ∑ [∆u (k + j − 1)]2 (E1)
j =1

where
Jc is the criterion function to be minimised at sample k,
Ny1 is the prediction horizon for the arm position,
Ny3 is the prediction horizon for the pendulum position,
Nu is the control horizon,
σ1 is the arm position weight,
σ3 is the pendulum position weight,
λ is the incremental control command weight,
α is the arm position,
β is the pendulum position,
∆u is the incremental control command,
w1 is the reference for the arm position,
w3 is the reference for the pendulum position,
k is the sample index.
subject to

∆u (k + j − 1) = 0 ∀j > Nu

Page E-1
APPENDIX E

The parameters Ny1 and Ny3 are known as the prediction horizon for the arm and
pendulum position respectively. They are defined as the intervals over which the
tracking errors are to be minimised. w1 is the reference for the arm-position and w3 is
the reference for the pendulum position. The control horizon Nu defines the degrees
of freedom available for the minimisation. The incremental control command weight
λ can be used to penalise excessive control activity.

Examination of the above criterion shows that Jc is minimal when:


1. The arm position tracking error (w1-α) is minimal over the prediction horizon
Ny1,
2. The pendulum position tracking error (w3-β) is minimal over the prediction
horizon Ny3,
3. The total change of control input ∆u, is smallest over the control horizon Nu.

Consider the system described by equation (C3):


xi (k + 1) = A di xi (k ) + B di ∆u (k )
y (k ) = C di xi (k )
where

 α (k ) 
 α& (k ) 
 
xi (k ) =  β (k ) 
 & 
 β (k ) 
u (k − 1)

The controlled variables can be specified by:

 α (k ) 
 α& (k ) 
1 0 0 0 0  
y (k ) =    β (k ) 
0 0 1 0 0  β& (k ) 
 
u (k − 1)
c 
=  1  xi (k )
c 3 

Page E-2
APPENDIX E

where
c1 = [1 0 0 0 0]
c 3 = [0 0 1 0 0]

To derive the controller, we first write a set of prediction equations for the plant
output. For the arm position, we have:
α (k + 1) = c1 xi (k + 1)
= c1 [A di xi (k ) + B di ∆u (k )]
= c1A di xi (k ) + c1B di ∆u (k )
α (k + 2 ) = c1 xi (k + 2 )
= c1 [A di xi (k + 1) + B di ∆u (k + 1)]
= c1A di xi (k + 1) + c1B di ∆u (k + 1)
= c1A di [A di xi (k ) + B di ∆u (k )] + c1B di ∆u (k + 1)
= c1A di2 xi (k ) + c1A di B di ∆u (k ) + c1B di ∆u (k + 1)
α (k + 3) = c1 xi (k + 3)
= c1 [A di xi (k + 2 ) + B di ∆u (k + 2 )]
= c1A di xi (k + 2 ) + c1B di ∆u (k + 2 )
[ ]
= c1A di A 2di xi (k ) + A di B di ∆u (k ) + B di ∆u (k + 1) + c1B di ∆u (k + 2 )
= c1A 3di xi (k ) + c1A 2di B di ∆u (k ) + c1A di B di ∆u (k + 1) + c1B di ∆u (k + 2 )
M
α (k + Ny1) = c1A diNy1 xi (k ) + c1A diNy1-1B di ∆u (k ) + c1A diNy1-2 B di ∆u (k + 1) + L
+ c1A 2di B di ∆u (k + Ny1 − 3) + c1A di B di ∆u (k + Ny1 − 2 ) + c1 B di ∆u (k + Ny1 − 1)

Expressing in vector form,


 α (k + 1)   c1A di 
 α (k + 2 )   c A 2 
   1 di 
 M  =  M  xi (k )
   Ny1-1 
α (k + Ny1 − 1) c1A di 
 α (k + Ny1)   c1A diNy1 
 c1 B di L  ∆u (k ) 
 cA B c1 B di L   ∆u (k + 1) 
 1 di di  
+ M M M M M  M 
  
 ∆u (k + Ny1 − 2 )
Ny1-2 Ny1-3
c1 A di B di c1A di B di L c1B di
 c1 A diNy1-1 Bdi c1 A diNy1-2 B di L c1A di B di c1 B di   ∆u (k + Ny1 − 1)

Page E-3
APPENDIX E

For a control horizon Nu where


Nu ≤ Ny1, Nu ≤ Ny3, {∆u (k + j − 1) = 0 ∀j > Nu}
let

 α (k + 1)   c1A di   ∆u (k ) 
 α (k + 2 )   c A2   ∆u (k + 1) 
   1 di   
Y1 =  M  Φ 1 =  M  ∆U =  M 
   Ny1-1   
α (k + Ny1 − 1) c1A di  ∆u (k + Nu − 2 )
 α (k + Ny1)   c1A diNy1   ∆u (k + Nu − 1)
 c1B di L 
 cA B c1B di L 
 1 di di 
G1 =  M M M M M 
 Ny1-2 Ny1-3 Ny1- Nu Ny1- Nu -1 
c1A di B di c1A di B di L c1A di B di c1A di B di 
 c1A diNy1-1B di c1 A diNy1-2 B di L c1 A diNy1- Nu +1 B di c1A diNy1-Nu B di 

Y1 = Φ1 xi (k ) + G1 ∆U
Thus, for the arm position,

Similarly, for the pendulum position,


 β (k + 1)   c 3 A di   ∆u (k ) 
 β (k + 2 )   c A2   ∆u (k + 1) 
   3 di   
Y3 =  M  Φ 3 =  M  ∆U =  M 
   Ny3-1   
 β (k + Ny3 − 1) c 3 A di  ∆u (k + Nu − 2 )
 β (k + Ny3)   c 3 A diNy3   ∆u (k + Nu − 1)
 c 3 B di L 
 cA B c 3 B di L  (E2)
 3 di di 
G3 =  M M M M M 
 Ny3- 2 Ny3-3 Ny3- Nu Ny3- Nu -1 
c 3 A di B di c 3 A di B di L c 3 A di B di c 3 A di B di 
 c 3 A diNy3-1 B di c 3 A diNy3-2 B di L c 3 A diNy3-Nu +1B di c 3 A diNy3- Nu B di 
For the pendulum position,

Y3 = Φ 3 xi (k ) + G3 ∆U (E3)

Define

W1 = [w1 (k + 1), w1 (k + 2 ), L, w1 (k + Ny1)]


T

W3 = [w3 (k + 1), w3 (k + 2), L, w3 (k + Ny 3)]T (E4)

Page E-4
APPENDIX E

Substitute (E2), (E3) and (E4) into the criterion function (E1),
2 2 2
J c = σ 1 W1 − Y1 + σ 3 W3 − Y3 + λ ∆U
= σ 1 W1 − Φ 1 xi − G1 ∆U + σ 3 W3 − Φ 3 xi − G3 ∆U + λ ∆U
2 2 2

Let

W1 = W1 − Φ1 xi W3 = W3 − Φ 3 xi

Then
2 2
J c = σ 1 W1 − G1∆U + σ 3 W3 − G3 ∆U + λ ∆U
2

= σ 1 [W1 − G1∆U ] [W1 − G1∆U ]+ σ 3 [W3 − G3 ∆U ] [W3 − G3 ∆U ]+ λ∆U T ∆U


T T

[
= σ 1 W1 W1 − W1 G1∆U − ∆U T G1 W1 + ∆U T G1 G1∆U
T T T T
]
[
+ σ 3 W3 W3 − W3 G3 ∆U − ∆U T G3 W3 + ∆U T G3 G3 ∆U + λ∆U T ∆U
T T T T
]
Minimising of Jc with respect to ∆U,
dJ c
=0
d∆U
[(
σ 1 − W1 G1) − G W + G G ∆U + (∆U G G ) ]
T T T T T T T

+ σ [− (W G ) − G W + G G ∆U + (∆U G G ) ]+ λ∆U + λ (∆U )


1 1 1 1 1 1
T T T T
=0
T T T T T
3 3 3 3 3 3 3 3 3

σ [− G W − G W + G G ∆U + G G ∆U ]
T T T T
1 1 1 1 1 1 1 1 1

+ σ [− G W − G W + G G ∆U + G G ∆U ]+ λ∆U + λ∆U = 0
T T T T
3 3 3 3 3 3 3 3 3

σ [− 2G W + 2G G ∆U ]+ σ [− 2G W + 2G G ∆U ]+ 2λ∆U = 0
T T T T
1 1 1 1 1 3 3 3 3 3

− σ 1G1 W1 + σ 1G1 G1 ∆U − σ 3G3 W3 + σ 3G3 G3 ∆U + λ∆U = 0


T T T T

(σ G
1 1
T
G1 + σ 3G3 G3 + λI ∆U = σ 1G1 W1 + σ 3G3 W3
T
) T T

(
∆U = σ 1G1 G1 + σ 3G3 G3 + λI
T T
) −1
[σ G T
W1 + σ 3G3 W3
T
]
= (σ G + λI ) [σ G (W1 − Φ1 xi ) + σ 3G3 T (W3 − Φ 3 xi )]
1 1
−1
G1 + σ 3G3 G3
T T T

= (σ G + λI ) [σ G ]
1 1 1 1
−1
G1 + σ 3G3 G3 W1 − σ 1G1 Φ1 xi + σ 3G3 W3 − σ 3G3 Φ 3 xi
T T T T T T

= (σ G + λI ) [σ G W −σ G Φ x −σ G Φ x ]
1 1 1 1
−1
G1 + σ 3G3 G3 W1 + σ 3G3
T T T T T T

= (σ G + λI ) [σ G W − (σ G Φ + σ G Φ )x ]
1 1 1 1 3 1 1 1 i 3 3 3 i
−1
G1 + σ 3G3 G3 W1 + σ 3G3
T T T T T T
1 1 1 1 3 1 1 1 3 3 3 i

Page E-5
APPENDIX E

Using the receding horizon strategy, at each control-updating instant, only the first
element of the control vector in the above equation is applied to the plant. The
control calculation is then repeated at the next control-updating instant. For constant
reference vectors W1 and W3, the controller is given by:
u (k ) = u (k − 1) + ∆u (k )
∆u (k ) = [1 0 L 0]∆U
= k1w1 (k ) + k 3 w3 (k ) + K 2 xi (k )
u (k ) = u (k − 1) + k1w1 (k ) + k3 w3 (k ) + K 2 xi (k )
where
1

( −1 T 1
k1 = [1 0 L 0] σ 1G1 G1 + σ 3 G3 G3 + λI σ 1G1  
T T

M
)

1
1

( −1
k 3 = [1 0 L 0] σ 1G1 G1 + σ 3 G3 G3 + λI σ 3G3
T T
)
T 1

M

1
(
K 2 = −[1 0 L 0] σ 1G1 G1 + σ 3 G3 G3 + λI
T T
) (σ G
−1
1 1
T
Φ1 + σ 3G3 Φ 3
T
)

Page E-6
APPENDIX F

Estimation of Determinable Parameters

The parameters in the dynamic model need to be determined before the model can be
used. These parameters can be broadly classified into 2 categories, the
“determinable” and the “undeterminable”. By “determinable”, we refer to those
quantities that can be determined from some reliable sources or through performing
some simple experiments. The determinable quantities are presented in Table F1
below, after which the method of estimation of these quantities will follow.
Quantity Units System I System II Source
m1 kg 0.0319 Measured and Estimated
l1 m 0.1572 Measured and Estimated
L0 m 0.1370 Measured
g m/s2 9.8100 Universal Constant
Ku V/count 0.0523 0.0636 Experiment
Kt N-m/A 0.1144 0.0706 Specifications
Kb V-s/rad 0.1146 0.0707 Specifications
Ra Ω 2.3 0.9 Specifications
Table F1

Effective Mass m1, and Effective Length l1, of Pendulum Section

The physical dimensions of the pendulum section are illustrated in Figure F1 below.

270mm

17mm 224mm 25mm


Figure F1

The mass of the pendulum rod and pendulum bob are measured and tabulated below.
Description Units Value
Mass of pendulum rod g 24.5
Mass of pendulum bob g 8.9
Table F2

Page F-1
APPENDIX F

Figure F2 below shows the effective mass m1 acting at effective length l1 about the
pivot point.
lbob
l1 lrod

m1 mrod mbob
Figure F2

Assuming that the mass is equally distributed along the pendulum rod,
270 − 17
mrod = × 24.5g
270
= 22.9574g

Ignoring the effects of the mass at the smaller end of the pendulum section,

m1 = mrod + mbob
= 22.9574g + 8.9g
= 31.8574g
= 0.0319kg

The law of moment is used to find the effective length l1:


m1l1 = mrod lrod + mbob lbob

l1 =
1
(mrod l rod + mbob lbob )
m1
1   270mm − 17 mm   25mm 
=  22.9574g ×   + 8.9g ×  224mm + 
31.8574g   2   2 
= 157.2307mm
= 0.1572m

Page F-2
APPENDIX F

Motor Driver Amplifier Gain, Ku

By performing simple experiments where the motor is excited by known driving


commands u, the motor driver amplifier gain, Ku can be determined when the
terminal voltage of the motor, Vm is measured. The results of such an experiment are
tabulated in Table F3 below.
System I System II
u (count) Vm (V) Ku (V/count) Vm (V) Ku (V/count)
60 3.20 0.0533 3.85 0.0642
70 3.73 0.0533 4.45 0.0636
80 4.02 0.0503 5.05 0.0631
Average 0.0523 Average 0.0636
Table F3

Motor Characteristics Kt, Kb, Ra

The motor characteristics can be found from the specifications. These are tabulated
below.
Quantity Units System I System II
Kt Oz-In/A 16.2 10
N-m/A 0.1144 0.0706
Kb V/Krpm 12 7.4
V-s/rad 0.1146 0.0707
Ra Ω 2.3 0.9
Table F4
Note: 1 Ounce Force (Oz) = 0.2780139 Newton (N)

Page F-3
APPENDIX G

Directory Allocation

The courseware directory structure is as below. The program operating directory will be
Run. The directory consist of twelve subdirectories which are

Sub Directory Name Description


Apps Contain all the files (dos based ) that is need to communicate
and process data form the pendulum system.
Data Contain all the raw data file (*.dat) collected from Parameter
Estimation.
Datam Contain the test signal (*.ts) and linear model files (*.lm) the
user saved. Also the gain files needed for Controller Design.
Demo Contain the gain files needed for user saved for demonstration.
Graphics Contain all the graphics file or the GUI .
Intro Contain m-files needed for System Setup and Mathematical
Modelling interface.
M-files Contain function type m-files that is needed to interface with
other program and computation of results.
Misc Contain miscellaneous m-files that used for GUI.
Scd Contain m-files that needed for Controller Design.
Sid Contain m-files that needed for System Identification.
Source Control the c, h files and batch files. The final parameters
needed to run the pendulum are also stored here.
Utilities Contain the cosine table and other development file. (Directory
for storing development files)

Page G-1
APPENDIX G

M-Files Description

This section will provide a description for the m-files used and created for the
courseware.

Filename Directory Description


Go Run Main running file, startup screen.
Impvar Run Initialize all variables needed by the system.
Pathinit Run Set path for program..
Pathvar Run Initialize variables to access directory.
Beginner Intro Beginner Interface screen.
Demoss Intro Demonstration screen.
Expert Intro Advance Interface screen.
Main2 Intro Introduction screen.
Smm Intro Mathematical Modelling Main Interface screen.
Smm1 Intro Mathematical Modelling Sub Interface screen.
Smm2 Intro Mathematical Modelling Sub Interface screen.
Smm3 Intro Mathematical Modelling Sub Interface screen.
Smm4 Intro Mathematical Modelling Sub Interface screen.
Smm5 Intro Mathematical Modelling Sub Interface screen.
Smm6 Intro Mathematical Modelling Sub Interface screen.
Smm7 Intro Mathematical Modelling Sub Interface screen.
Smm8 Intro Mathematical Modelling Sub Interface screen.
Smm9 Intro Mathematical Modelling Sub Interface screen.
Ssetupm Intro System Setup Main Interface screen.
Ssetup1 Intro System Setup Sub Interface screen.
Ssetup2 Intro System Setup Sub Interface screen.
Ssetup3 Intro System Setup Sub Interface screen.
Ssetup4 Intro System Setup Sub Interface screen.
Ssetup5 Intro System Setup Sub Interface screen.
Acting Scd Display state variable to be chosen.

Page G-2
APPENDIX G

DisA3 Scd Display Linear A3 B4 Matrix. (Continuous Time)


DisA4 Scd Display Linear A4 B4 Matrix. (Continuous Time)
DisGPC Scd Display Linear GPC Matrix.
DisGPCin Scd Display & Load GPC weight values.
DisGPCm Scd Display GPC poles.
Diss Scd Display & Load Poles and Gain. (Discrete Time)
Dissftb Scd Display & Load Poles and Gain. (Continuous Time)
Dissi Scd Display & Load Poles and Gain for I and PI. (Continuous
Time)
Dissp Scd Display Linear A3, B4 Matrix. (Discrete Time)
Find_gpc Scd Find GPC poles placement.
InputI Scd Display Input Box for Integral Controller.
InputP Scd Display Input Box for Proportional Controller.
InputPI Scd Display Input Box for Proportional & Integral Controller.
Nyplot Scd Plot Root Locus. (Single Plot)
Nyplot2 Scd Plot Root Locus. (2 plot)
Preout Scd Display control option for pendulum eg swing up, dead zone etc
Savc Scd Save Gain matrix (K) and setting for system.
Savk Scd Save Gain matrix (K) and setting for Demonstration.
Scd Scd Main calling for Controller Design Interface. Check whether the
user perform System ID.
Scdbl Scd Stop user from entering Controller Design Interface, unless he
load a previous saved model or perform System ID.
Scdi Scd Main Interface page for Controller Design with Integral
Control.
Scdm Scd Main Interface page for Controller Design. Allow user to choose
controller design option.
Scds Scd Main Interface page for Controller Design. (Discrete Time)
ScdGPC Scd Main Interface page for Controller Design. (GPC)
Scdsfb Scd Main Interface page for Controller Design. (Continuous Time)
Wrte_h1 Scd Write control option to file. eg swing up, dead zone etc.
Collect1 Sid For ‘Collect data’ button. Run pendulum to collect data for
System ID.

Page G-3
APPENDIX G

Collect2 Sid For ‘View raw data’ button. Process collected data, tracking
system processes and display for System ID Parameter
Estimation.
Collect3 Sid For ‘View filtered data’ button. Filter collected data, tracking
system processes and display for System ID Parameter
Estimation.
Collect4 Sid For ‘View estimated data’ button. Estimate collected data, ,
tracking system processes and display for System ID Parameter
Estimation.
Collect5 Sid For ‘Estimate’ button. Estimate collected data, , tracking system
processes and display for System ID with comparison with
simulated using our model.
Collect6 Sid For ‘View Results’ button. Display linear model, poles for
System ID and tracking system processes for Parameter
Estimation.
Display Sid Plot Test wave for System ID Test Signal.
Idm Sid Combine what Collect1 to Collect6 does.
Phyp Sid Show parameters that is use by Methods 1 of System ID.
Phyp1 Sid Allow use to change the parameters and save them. (Link with
Phyp)
Result Sid Display linear model, poles for System ID Parameter Estimation
(Single).
Result1 Sid Display linear model, poles for System ID Parameter Estimation
(Multiple).
Sid Sid System ID introduction screen (access from Beginner Interface
option)
Sid1 Sid Test Signal Interface main option screen.
Sid2 Sid Test Signal Interface (Modify Standard Waveform)
Sid3 Sid Test Signal Interface (Design test waveform)
Sidin Sid System ID introduction screen (access from Advance Interface
option)
Sidintro Sid System ID introduction screen (access from Advance Interface
option)
Sidm Sid System ID main screen (Single Parameter Estimation)
Sidvar1 Sid Load default test signal.
Sms Sid System ID main screen (Multi Parameter Estimation)

Page G-4
APPENDIX G

Can Misc For System Configuration Interface variable initialisation during


refresh action.
Cdir Misc Function for changing directory.
checker Misc Function for checking input, to see if user entry is correct.
Defat Misc For System Configuration Interface variable initialisation during
default action.
Delay Misc Function for delaying process.
discon Misc Function to convert number to desired string.
File_dat Misc Function for getting filenames from data sub-directory.
Message Misc Function for displaying system message.
Messager Misc Function for displaying system message.
Misc Misc Miscellaneous Interface screen.
Misce Misc Miscellaneous Interface, for checking and displaying experiment
results.
Savelm Misc Saving Estimated Linear Model for System ID.
Savets Misc Saving Designed Test Signal for System ID.
Sort_str Misc Function for sorting filenames from data sub-directory. (use
with File_dat )
Scon Misc System Configuration Interface screen.
Writelm Misc Retrieving Estimated Linear Model for System ID.
Writets Misc Retrieving Designed Test Signal for System ID.
Filt_ch M-files Function for plotting the filter magnitude and phase
characteristics using 64 points around the unit circle.
Filt_med M-files Function for implements median filtering of signal x. Filter order
is (2n-1).
Filt_sig M-files Function for implements linear phase filter.
Form_ss M-files Function for forming form the 3 States and 4 States State-Space
Linear Model.
Gen_p M-files Function for generating and retrieving parameters use for
Method 1 of System ID
Get_s M-files Function for generating the default system data file.
Get_dz M-files Function for performing experiment to determine dead zone
region.
Get_est M-files Function for producing the Pendulum velocity and acceleration,
as well as the Arm acceleration, from the raw data.

Page G-5
APPENDIX G

Get_fit M-files Function for obtaining the "fit curves" for dda, ddb, & da.
Get_raw M-files Function for reading the raw data, where filename is specified by
input argument x.
Get_upr M-files Function for performing experiment to determine reference
value for pendulum in upright position.
Getpara M-files Function for obtaining system parameters as specified by
method in System ID.
Read_dat M-files Function for reading and return in vector A the data in file
specified by pathname 'x'.
Read_dz M-files Function for reading in dead zone data from 'data/dz.sdt'.
Read_p M-files Function for reading in physical data from 'data/physical.sdt'.
Read_s M-files Function for reading in system data from 'data/system.sdt'.
Refval M-files File for storing system parameters.
Sig_ch M-files Function for displaying the signal characteristics using N point
FFT.
Sim_exp M-files Simulink function for estimating results.
Startexp M-files Function for running the command in 'source' directory.
View_dat M-files Function for plotting the signal from index x to index y.
View_dat2 M-files Function for plotting two signals, A and B on the same graph
from index x to index y.
Write_h M-files Function for saving gain to H file
Write_h1 M-files Function for control option to H file
Write_p M-files Function for generating the physical data file, 'data\physical.sdt'.
Write_s M-files Function for generating the system data file, 'data\system.sdt'.
Write_t M-files Function for generating the header file 'source\sys_id\input.h'

Page G-6
APPENDIX G

Other files related to courseware

Bal.c Source\bal Main C file for pendulum.


Gain.h Source\bal Gain file.
Config.h Source Control option eg. Swing up, dead zone mapping etc.
Dz.h Source Dead Zone value.
Upref.h Source Pendulum at upright value.
Swing.h Source Swing Constant Value.
System.h Source System parameter eg. Encoder resolution, sampling
period, Decoder resolution.
Build.bat Source Batch file for compiling C file.
Capture.bat Source Batch file for retrieving data from Pendulum
System..
Execute.bat Source Batch file for uploading data onto Pendulum System.

Page G-7
Results of Estimation Using Method 1

Forward Difference, Full Data Set


Data Set J0 C0 J1 C1 Error A Error B
1 0.009537 0.014263 0.000201 0.000607 0.145148 0.101968
2 0.009757 0.009025 0.000204 0.000619 0.575166 0.134849
3 0.009048 0.006563 0.000206 0.000628 1.005951 0.131606
4 0.008032 0.005362 0.000218 0.000617 1.526294 0.188511
5 0.008607 0.005698 0.000228 0.000595 1.657915 0.154507
6 0.008161 0.005014 0.000200 0.000634 1.865837 0.141348
7 0.008333 0.004860 0.000210 0.000645 2.196364 0.123742
8 0.008242 0.004767 0.000209 0.000628 2.237133 0.149375
9 0.008333 0.004624 0.000224 0.000618 2.757629 0.161537
10 0.008032 0.004510 0.000230 0.000614 2.653747 0.181855
Average 0.008608 0.006469 0.000213 0.000621
Table H1

Forward Difference, Unforced Response for J1 and C1


Data Set J0 C0 J1 C1 Error A Error B
1 0.009537 0.014263 0.000185 0.000602 0.145114 0.114325
2 0.009757 0.009025 0.000186 0.000598 0.575168 0.147055
3 0.009048 0.006563 0.000185 0.000647 1.006444 0.137146
4 0.008032 0.005362 0.000200 0.000597 1.525691 0.192317
5 0.008607 0.005698 0.000200 0.000544 1.661039 0.153097
6 0.008161 0.005014 0.000191 0.000618 1.865572 0.143287
7 0.008333 0.004860 0.000195 0.000605 2.195887 0.122349
8 0.008242 0.004767 0.000193 0.000575 2.238409 0.143243
9 0.008333 0.004624 0.000189 0.000615 2.756703 0.151727
10 0.008032 0.004510 0.000194 0.000636 2.653998 0.167323
Average 0.008608 0.006469 0.000192 0.000604
Table H2

Backward Difference, Full Data Set


Data Set J0 C0 J1 C1 Error A Error B
1 0.009435 0.013671 0.000200 -0.000301 4.512139 33822.08
2 0.009708 0.008807 0.000204 -0.000306 2.841882 11072.43
3 0.009027 0.006451 0.000206 -0.000302 1.170688 68.37424
4 0.008012 0.005291 0.000218 -0.000297 3.984179 8710.968
5 0.008591 0.005642 0.000228 -0.000323 4.027542 8250.065
6 0.008151 0.004973 0.000200 -0.000313 4.050290 6834.350
7 0.008325 0.004826 0.000211 -0.000292 2.588939 757.5543
8 0.008237 0.004739 0.000210 -0.000302 3.313168 3214.773
9 0.008331 0.004599 0.000225 -0.000304 3.855542 3320.678
10 0.008030 0.004489 0.000231 -0.000296 3.628569 2760.096
Average 0.008585 0.006349 0.000213 -0.000304
Table H3
Backward Difference, Unforced Response for J1 and C1
Data Set J0 C0 J1 C1 Error A Error B
1 0.009435 0.013671 0.000184 -0.000354 8.707456 91748.57
2 0.009708 0.008807 0.000185 -0.000360 6.273494 38222.85
3 0.009027 0.006451 0.000183 -0.000298 1.729775 1785.717
4 0.008012 0.005291 0.000199 -0.000335 6.401318 20142.88
5 0.008591 0.005642 0.000199 -0.000386 8.285763 32558.26
6 0.008151 0.004973 0.000190 -0.000323 3.810898 5281.472
7 0.008325 0.004826 0.000194 -0.000332 4.412416 6631.691
8 0.008237 0.004739 0.000192 -0.000363 7.439572 20249.94
9 0.008331 0.004599 0.000187 -0.000328 4.081874 3723.822
10 0.008030 0.004489 0.000192 -0.000291 3.694251 2794.996
Average 0.008585 0.006349 0.000191 -0.000337
Table H4

Central Difference, Full Data Set


Data Set J0 C0 J1 C1 Error A Error B
1 0.009463 0.013962 0.000204 0.000153 0.166427 0.028580
2 0.009721 0.008915 0.000207 0.000156 0.605448 0.106518
3 0.009030 0.006507 0.000209 0.000163 1.026764 0.092607
4 0.008011 0.005326 0.000221 0.000160 1.548803 0.171187
5 0.008592 0.005670 0.000230 0.000136 1.675782 0.109071
6 0.008154 0.004993 0.000205 0.000160 1.894717 0.078605
7 0.008327 0.004843 0.000215 0.000177 2.217968 0.068478
8 0.008239 0.004753 0.000214 0.000164 2.249391 0.124734
9 0.008339 0.004611 0.000229 0.000157 2.775719 0.167592
10 0.008032 0.004499 0.000235 0.000159 2.669464 0.182745
Average 0.008591 0.006408 0.000217 0.000158
Table H5

Central Difference, Unforced Response for J1 and C1


Data Set J0 C0 J1 C1 Error A Error B
1 0.009463 0.013962 0.000187 0.000124 0.169812 0.060434
2 0.009721 0.008915 0.000188 0.000118 0.607838 0.178712
3 0.009030 0.006507 0.000186 0.000174 1.031021 0.117709
4 0.008011 0.005326 0.000201 0.000131 1.548454 0.184771
5 0.008592 0.005670 0.000201 0.000079 1.697638 0.072046
6 0.008154 0.004993 0.000192 0.000149 1.892855 0.116517
7 0.008327 0.004843 0.000196 0.000138 2.211861 0.103842
8 0.008239 0.004753 0.000195 0.000107 2.262989 0.072108
9 0.008339 0.004611 0.000190 0.000139 2.768970 0.160844
10 0.008032 0.004499 0.000195 0.000175 2.672096 0.122488
Average 0.008591 0.006408 0.000193 0.000133
Table H6
Results of Estimation Using Method 2
Forward Difference, Full Data Set
Data Set φ1 φ2 φ3 φ4 φ5 φ6 φ7 φ8 Error A Error B
1 0.172499 -0.002811 1.933004 0.480951 1.103152 0.749604 0.614823 49.794175 0.130252 0.064535
2 -0.073217 -0.001163 1.061942 0.362366 0.842062 0.515416 0.508588 34.368162 0.663405 0.277080
3 -0.124124 0.001708 0.896609 0.369014 -0.182182 0.477071 0.480456 21.147193 1.792462 0.661654
4 -0.157587 -0.000144 0.855217 0.390691 -0.215130 0.479963 0.457342 24.475987 2.999933 0.907095
5 -0.173026 -0.003963 0.808161 0.358499 -0.180846 0.324301 0.427384 23.788665 3.472856 1.040200
6 -0.158694 0.001501 0.812602 0.383773 -0.162772 0.456105 0.490510 21.804285 3.625719 1.194110
7 -0.160851 -0.001171 0.779312 0.373577 -0.150095 0.388971 0.454887 17.542341 4.139906 1.269442
8 -0.190327 -0.000181 0.748165 0.361876 -0.156487 0.453995 0.459151 20.336937 5.118303 1.502915
9 -0.215256 -0.002678 0.708194 0.347456 -0.115359 0.378605 0.432935 19.138507 6.133227 1.686853
10 -0.253848 0.001718 0.692708 0.343693 -0.114933 0.428266 0.468318 20.793840 7.413408 1.901502
Average -0.133443 -0.000718 0.929591 0.37719 0.066741 0.46523 0.479439 25.319009
Table H7
Forward Difference, Unforced Response for φ7 and φ8
Data Set φ1 φ2 φ3 φ4 φ5 φ6 φ7 φ8 Error A Error B
1 0.172499 -0.002811 1.933004 0.480951 1.116025 0.754829 0.616550 50.301774 0.129989 0.064181
2 -0.073217 -0.001163 1.061942 0.362366 1.231806 0.674180 0.609574 49.943248 0.660933 0.184492
3 -0.124124 0.001708 0.896609 0.369014 -0.421976 0.772189 0.649600 48.578277 1.794974 0.652098
4 -0.157587 -0.000144 0.855217 0.390691 -0.427497 0.692641 0.596570 48.650998 3.009788 0.907726
5 -0.173026 -0.003963 0.808161 0.358499 -0.374174 0.546464 0.548392 49.336374 3.472042 1.052482
6 -0.158694 0.001501 0.812602 0.383773 -0.376778 0.688918 0.628992 49.828424 3.626427 1.194365
7 -0.160851 -0.001171 0.779312 0.373577 -0.426045 0.704969 0.612452 49.574404 4.140326 1.273173
8 -0.190327 -0.000181 0.748165 0.361876 -0.383860 0.700513 0.582251 49.593025 5.120494 1.494208
9 -0.215256 -0.002678 0.708194 0.347456 -0.302325 0.704694 0.629073 50.116221 6.135972 1.688479
10 -0.253848 0.001718 0.692708 0.343693 -0.275515 0.654850 0.645850 49.818068 7.413823 1.903977
Average -0.133443 -0.000718 0.929591 0.37719 -0.064034 0.689425 0.61193 49.574081
Table H8
Backward Difference, Full Data Set
Data Set φ1 φ2 φ3 φ4 φ5 φ6 φ7 φ8 Error A Error B
1 0.180093 -0.002877 1.885218 0.484471 1.112074 0.665895 -0.327545 49.765171 885.37145 247507.95
2 -0.060565 -0.000805 1.055334 0.366103 0.846645 0.433383 -0.304549 34.354447 0.741127 49152.055
3 -0.109679 0.001820 0.899703 0.374108 -0.180145 0.390314 -0.201677 21.070707 1.730257 1.318256
4 -0.152100 -0.000640 0.851450 0.391806 -0.213886 0.394936 -0.239132 24.400197 2.949687 75.976333
5 -0.162061 -0.004349 0.811619 0.362002 -0.180103 0.239663 -0.265858 23.715246 3.359255 1.602852
6 -0.149515 0.000754 0.816056 0.387193 -0.161861 0.371504 -0.205752 21.717021 3.380421 2.706164
7 -0.150434 -0.001597 0.784455 0.377459 -0.149055 0.308613 -0.195658 17.453573 3.881960 1.901608
8 -0.179285 -0.001006 0.755110 0.366418 -0.155570 0.370079 -0.215177 20.243972 4.627853 6.386608
9 -0.204811 -0.002953 0.714103 0.351343 -0.114770 0.297572 -0.223929 19.049409 5.614453 4.894629
10 -0.238411 0.001655 0.703536 0.349925 -0.114480 0.346176 -0.192003 20.718131 6.425586 2.480933
Average -0.122677 -0.001 0.927658 0.381083 0.068885 0.381814 -0.237128 25.248787
Table H9
Backward Difference, Unforced Response for φ7 and φ8
Data Set φ1 φ2 φ3 φ4 φ5 φ6 φ7 φ8 Error A Error B
1 0.180093 -0.002877 1.885218 0.484471 1.127580 0.666790 -0.363466 50.357443 NaN NaN
2 -0.060565 -0.000805 1.055334 0.366103 1.238860 0.580796 -0.368286 49.997451 63.921465 285693.77
3 -0.109679 0.001820 0.899703 0.374108 -0.420986 0.655629 -0.303445 48.646409 1.733413 322.46626
4 -0.152100 -0.000640 0.851450 0.391806 -0.427268 0.587516 -0.336827 48.705155 2.983694 1973.6598
5 -0.162061 -0.004349 0.811619 0.362002 -0.374165 0.444015 -0.389001 49.370405 3.366183 2587.3269
6 -0.149515 0.000754 0.816056 0.387193 -0.377027 0.587304 -0.328859 49.898745 3.407498 838.29823
7 -0.150434 -0.001597 0.784455 0.377459 -0.426215 0.601070 -0.337042 49.635770 3.832034 2274.3943
8 -0.179285 -0.001006 0.755110 0.366418 -0.383947 0.598460 -0.369274 49.635382 4.375043 6224.0060
9 -0.204811 -0.002953 0.714103 0.351343 -0.302695 0.594452 -0.334574 50.188580 5.161962 1577.9326
10 -0.238411 0.001655 0.703536 0.349925 -0.275957 0.542944 -0.295410 49.906173 6.394118 150.36420
Average -0.122677 -0.001 0.927658 0.381083 -0.062182 0.585898 -0.342618 49.634151
Table H10
Central Difference, Full Data Set
Data Set φ1 φ2 φ3 φ4 φ5 φ6 φ7 φ8 Error A Error B
1 0.185003 -0.002634 1.932088 0.488532 1.106575 0.703291 0.142537 49.719498 0.129990 0.195129
2 -0.063241 -0.000923 1.063586 0.365922 0.844576 0.473451 0.102508 34.343450 0.690158 0.499868
3 -0.115535 0.001705 0.898866 0.371832 -0.180914 0.428121 0.137355 21.098460 1.756733 0.681164
4 -0.150301 -0.000352 0.858425 0.393580 -0.214351 0.431771 0.106295 24.424746 2.916488 0.945328
5 -0.161740 -0.004134 0.815987 0.362950 -0.180435 0.277774 0.078238 23.746120 3.325417 1.046176
6 -0.151543 0.001064 0.816074 0.386301 -0.162187 0.410935 0.142520 21.750870 3.521193 1.214298
7 -0.150349 -0.001368 0.786987 0.377961 -0.149499 0.345451 0.131001 17.492303 3.953466 1.278937
8 -0.182010 -0.000654 0.753446 0.365016 -0.155909 0.408933 0.119307 20.278506 4.908524 1.538559
9 -0.206881 -0.002918 0.712883 0.350244 -0.115007 0.332217 0.100124 19.085037 5.910660 1.711605
10 -0.245053 0.001554 0.697751 0.346617 -0.114725 0.382388 0.135940 20.759993 7.115421 1.926482
Average -0.124165 -0.000866 0.933609 0.380896 0.067812 0.419433 0.119583 25.269898
Table H11
Central Difference, Unforced Response for φ7 and φ8
Data Set φ1 φ2 φ3 φ4 φ5 φ6 φ7 φ8 Error A Error B
1 0.185003 -0.002634 1.932088 0.488532 1.120839 0.706694 0.127008 50.273253 0.129540 0.170566
2 -0.063241 -0.000923 1.063586 0.365922 1.234203 0.628710 0.120072 49.898959 0.685399 0.456752
3 -0.115535 0.001705 0.898866 0.371832 -0.420961 0.714297 0.172899 48.566246 1.760750 0.631441
4 -0.150301 -0.000352 0.858425 0.393580 -0.427020 0.637955 0.130047 48.639877 2.934551 0.969793
5 -0.161740 -0.004134 0.815987 0.362950 -0.373749 0.494078 0.079767 49.296702 3.322550 1.120074
6 -0.151543 0.001064 0.816074 0.386301 -0.376453 0.639658 0.151062 49.811040 3.538581 1.218541
7 -0.150349 -0.001368 0.786987 0.377961 -0.425711 0.654568 0.139169 49.558822 3.965685 1.306662
8 -0.182010 -0.000654 0.753446 0.365016 -0.383228 0.650785 0.106811 49.530025 4.940131 1.489572
9 -0.206881 -0.002918 0.712883 0.350244 -0.302153 0.649983 0.142363 50.093672 5.949101 1.716627
10 -0.245053 0.001554 0.697751 0.346617 -0.275459 0.598733 0.177508 49.812423 7.180642 1.922508
Average -0.124165 -0.000866 0.933609 0.380896 -0.062969 0.637546 0.134671 49.548102
Table H12

You might also like