Professional Documents
Culture Documents
Contents
1 Introduction
2 System Identification
Lab Setup . . . . . . . . . . . . . . . . . . . .
Description . . . . . . . . . . . . . . . . . . .
Lagrangian Dynamic Analysis . . . . . . . . .
Generalized Coordinate System . . . . .
Kinetic and Potential Energy Functions
Lagrangian . . . . . . . . . . . . . . . .
Modelling of DC Motor . . . . . . . . . . . .
Algebraic Loops . . . . . . . . . . . . . .
Nonlinear Simulation Model . . . . . . . . . .
Parameter Estimation . . . . . . . . . . . . .
Model Validation . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
4
4
5
5
6
6
7
7
8
8
3 LQR Control
Linearised Model . . . . . . . . . . . . . . . . . . . . .
Pendulum Up ( = 0) . . . . . . . . . . . . . . .
State Space Representation . . . . . . . . . . . . . . .
LQG Control . . . . . . . . . . . . . . . . . . . . . . .
Implementation . . . . . . . . . . . . . . . . . .
Observer Design . . . . . . . . . . . . . . . . . .
Continious Time Simulation Results . . . . . . .
Converting the continuous time model to discrete
Challenges . . . . . . . . . . . . . . . . . . . . . .
Comparison of LQG controller performance . . .
. . .
. . .
. . .
. . .
. . .
. . .
. . .
time
. . .
. . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
10
10
10
11
11
11
12
13
13
15
16
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
19
19
19
20
20
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5 Conclusion
24
Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
LQR control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Model Predictive control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Chapter 1
Introduction
The Cart-Inverted Pendulum System (CIPS) is a classical benchmark control problem. Its dynamics resembles with that of many real world systems of interest like missile launchers, pendubots, human walking and
Segway and many more. The control of this system is challenging as it is highly unstable, highly non-linear,
non-minimum phase system and under actuated. Further, the physical constraints on the track position
control voltage etc. also pose complexity in its control design.
For this course our task is to design two controllers that can control the motion of the cart such that the
pendulum is balanced in its upright position with the following requirements.
keeping the pendulum inverted and track the reference signal for the cart position.
The controlled system should have zero steady state error and recover from a small tick against the
pendulum.
To obtain these objective we are going to follow systematic procedure that are required to obtain controllers
which fulfils these objectives. The first step to do this is by modelling the system. It is very important to have
some information about the plant so that its output can be controlled. Hence most of the control algorithm
rely on the model of the plants that needs to be controlled. We first create a first principle mathematical
model of the Pendulum Cart system and the DC motor. Modelling and Dynamics analysis of Cart pendulum
system is done by writing the Lagrange equations. Then we carry out parametric system identification for
the inverted pendulum using a nonlinear simulation model as we didnt have exact measurement of the input
to force gain km and the damping coefficient b (including viscous friction and the back-emf of the motor).
Once we have the model of the system we are going to design two linear controller for the system. In order
to do that we need to linearize the model which can be done by linearizing the system equation obtained
by Langrange equation at the equilibrium position. After we linearize the system we can derive the state
space model of the system. This continuous time the state space model will be converted into discrete time
state space model. Once we have the discrete time state space model, we can proceed with the designing of
the controller. First we will design a Full State Feedback Controller i.e. Linear Quadratic Gaussian (LQG)
compensator. The compensator aims at providing a proper control input that provides a desired output in
terms of the Pendulum Angle and Cart Position. Once we design the controller first we want to test the
controller in a simulation model and tune the weights, then follow the same procedure on the real setup to
get optimum results.
We then design Model Predictive Control (MPC) using the MATLAB MPC toolbox and simulate the
output by tuning the weights of the controller and then implement the controller on the real-time setup and
further tune the weights.
Chapter 2
System Identification
There are two basic approaches to modeling : the First principle modeling and the black box modeling.
Both the approaches have their own advantages and disadvantages. In black box modeling we can use same
algorithm to identify different plants which are complex in nature and are not easy to identify using first
principle due to its complicated mathematical equations. But since the black box modeling is done by
analysing the input and the output data of the plant, the model is generally valid only for the signal it was
calculated from. For example if a step signal was used to identify the plant, this plant should not be used
for the analysis of high frequency signals.
Plants obtained by using first principle are more robust as whole range of input signals can be used to
analyse it. But the drawback of first principle is that there are lot of unknown constants and relations in
the model description. Hence these constants need to obtained by performing real-time experiments on the
plant. In our case we are going to use first principle method to obtain the system model.
Lab Setup
Figure 2.1: The lab setup of The Cart-Inverted Pendulum System (CIPS)
The lab setup is the Linear Servo Base Unit of Quansers consulting. It consists of a cart driven by a DC
motor, via a rack and pinion mechanism, to ensure consistent and continuous traction. The cart is equipped
with a rotary metal shaft to which a free turning pendulum is attached. The Linear Servo Base Unit system
has two encoders: one encoder is used to measure the carts position and the other encoder is used to sense
the position of the pendulum shaft. The Linear Inverted Pendulum is mounted on the cart and is free to fall
along the carts axis of motion.
Integration Project
SC4050
Description
Page 4 of 26
Integration Project
SC4050
Figure 2.3: Schematic of Pendulum Cart Model includes cart mass M , pendulum of mass m and inertia I
about its center of mass, which is a distance l from the pendulum pivot.
M v1 2
2
(2.1)
(2.2)
M v2 2
I 2
+
2
2
(2.3)
(2.4)
(x l sin )
x
v2 (y) =
(l cos ) =
x
x l cos
l sin
v2 2 = v2 2 (x) + v2 2 () = x 2 + l2 2 2xl
cos
(2.5)
(2.6)
(2.7)
Page 5 of 26
Integration Project
SC4050
Substituting Equation 2.7 into Equation 2.3 and upon simplifying equation 2.1 and 2.3. The total kinetic
co-energy is
(M + m)x2
ml2 2
I 2
T =
+
+
mxl
cos
(2.8)
2
2
2
Since the cart moves only in the horizontal direction, the potential energy of the system is determined entirely
by the angle of the pendulum, given by
V = mgl cos
(2.9)
Lagrangian
From the kinetic co-energy and potential energy functions, the Lagrangian is given by
L
T V
(2.10)
ml2 2
I 2
(M + m)x2
+
+
ml cos (g + x )
2
2
2
(2.11)
d( L
L
x )
dt
x
(2.12)
d( L
)
= 0
(2.13)
dt
Substituting equation 2.11 in equations 2.12 and 2.13 and evaluating the partial derivatives and simplifying
and rearranging, the system state equations are
F
= (M + m)
x + bx + ml cos ml2 sin
(2.14)
(I + ml2 ) + ml
x cos + mgl sin =
(2.15)
Modelling of DC Motor
di
+ Ri
dt
V Vb
(2.16)
Page 6 of 26
Integration Project
Vb =
d
dt
SC4050
(2.17)
d
d2
b
= T
(2.18)
dt2
dt
In general, the torque generated by a DC motor is proportional to the armature current and the strength
of the magnetic field. In this example we will assume that the magnetic field is constant and, therefore,
that the motor torque is proportional to only the armature current i by a constant factor k as shown in the
equation below. This is referred to as an armature-controlled motor.
J
T = Ki
(2.19)
T = Fr
(2.20)
F = km u
where km is equal to
K
rR
(2.21)
(2.22)
(2.23)
and V = u
Algebraic Loops
When analysing or simulating a system described by a block diagram, it is necessary to form the differential
equations that describe the complete system. In many cases the equations can be obtained by combining
the differential equations that describe each subsystem and substituting variables. This simple procedure
cannot be used when there are closed loops of subsystems that all have a direct connection between inputs
and outputs, known as an algebraic loop. When algebraic loops are present, it is necessary to solve algebraic
equations to obtain the differential equations for the complete system.
Hence for our simulation model well further simplify these equation so that we can incorporate these
equation in Matlab simulink. Equation 2.14 and 2.15 can be written as
1
(km u N bx)
M
1
=
(N l cos + P l sin )
I
(2.24)
(2.25)
x
=
where
P =
Page 7 of 26
Integration Project
SC4050
Parameter Estimation
As discussed before the drawback of first principle modelling is that there are lot of unknown constants and
relations in the model description. Since we modelled our system using first principles we have to obtain
these unknown parameters of the model by performing real-time experiments on the Cart inverted pendulum
system. We are neglecting rotational viscous friction, and translational Coulomb friction in our model. Hence
there will be always some difference between the model and the real setup. For example the non-presence of
oscillations in real setup is caused by presence of dry (Coulomb) friction but in our model simulation we can
find oscillation. Hence the only constants that we have to determine are the input to force gain km and the
damping coefficient b (including viscous friction and the back-emf of the motor). The advantage of modelling
by first principle is the model is valid for all sets of input output data and not just on the data set that was
used for parameter estimation. Due to this we do not need to worry about which kind of input signal to
take. A signal as simple as impulse should be enough in our case. Since our model is highly non-linear due
the presence of various trigonometric term as well as due the presence of friction, to have better estimate
of the parameters, we want to use Non-linear least square approach. The non-linear simulink model (refer
to Fig 2.5) that was derived earlier is used for this estimation. We used Matlab function lsqnonlin for our
identification. To do this identification we had to provide the initial values to the parameters. We used
various input signal for this estimation with each data we got different values for km and b. Even for same
data set if we chose different initial values for the parameters we got different values. When we used input to
be a multi-input sine wave we got curve fitting with VAF (variance accounted for) of 96%. Figure 2.6 shows
the curve fitting with the identification data. The values obtained for the input to force gain was km = 4.45
and the value for damping coefficient b was found out to be 11.54.
Model Validation
Once we had obtained the parameter values, we validated these values against different set of input output
data. We took a different set of input data and compared the output of our model with the calculated
parameters against the actual setups output. The VAF value for the data validation was found to be 86%.
Figure 2.7 shows the graph of validation data.
Page 8 of 26
Integration Project
SC4050
Figure 2.7: Model output comparison with actual setup output for validation data
Page 9 of 26
Chapter 3
LQR Control
Linearised Model
Before proceeding with further analysis, we must linearize the state equations. The mathematical model of
the system is nonlinear, it has to be linearized around some appropriate working point. Since the analysis
and control design techniques we will be employing apply only to linear systems, this set of equations needs
to be linearized. In case of availability of mathematical model of the system, linearization is performed by
calculating first two members of corresponding Tylor series (function value and first derivation). Specifically,
we will linearize the equations about the vertically upward equilibrium position, = 0, and will assume that
the system stays within a small neighbourhood of this equilibrium. Focusing on small variations of about
the equilibrium point 0 :
= 0 +
(3.1)
=
From a Taylor Series expansion, a first order approximation of any function of is
df
f () f ( ) +
d
(3.2)
(3.3)
(3.4)
2 0
(3.5)
Hence
Pendulum Up ( = 0)
For = 0, Equation 2.26 yields to first order
cos cos (0) + ( sin 0) = 1
sin sin (0) + (cos (0)) = 0
10
(3.6)
Integration Project
SC4050
0
x
x
0
=
0
(I+ml2 )b
I(M +m)+M ml2
m2 gl2
I(M +m)+M ml2
0
x
0
0
mlb
I(M +m)+M ml2
mgl(M +m)
I(M +m)+M ml2
0
(I+ml2 )km
I(M +m)+M ml2
0
mlkm
I(M +m)+M ml2
(3.7)
x
0
x + 0 u
0
0
y=
1
0
0
0
0
1
LQG Control
The linear quadratic regulator (LQR) is a well-known design technique that provides practical feedback
gains. A synthesis problem is formulated to minimize a criterion, which is a quadratic function of the states
and the control signals. The problem is called the Linear Quadratic (LQ) control problem. The resulting
optimal controller is linear. The LQ-controller can also be interpreted as a pole-placement controller.
The solution of the LQ-control problem, if all the states are available, is the result of an algebraic Riccati
equation, where the properties of LQ-controllers are also discussed. But since we cannot estimate all the
states, we use a observer based LQR controller.
Implementation
We first linearise the system and then find out a state feedback gain that stabilizes the pendulum in the
equilibrium point. In order to do this we check the rank of Controllability matrix.
C = [B
AB
A2 B
A3 B]
(3.8)
Rank of C should be 4 for the system to be controllable.This can be checked with matlab command ctrb.
LQ- Controller can be implemented in matlab using lqr command.
The LQ-Controller needs as input the weighted matrices: Q for the states and R for the inputs. Changing
the relative magnitude between the elements in the weighting matrices means a compromise between the
speed of the recovery and the magnitudes of the control signals.
Looking at the function to minimize:
J
N
X
(3.9)
k=1
Q and R are symmetric weighting matrices that are positive semi-definite and positive definite respectively.
Page 11 of 26
Integration Project
SC4050
By increasing the weighting matrices relative to one another we can put emphasis on the state and control
trajectories. We can obtain the value of K by using matlab function lqr giving different values of Q and
R. The R matrix influences the control action. Keeping Q equals to the identical matrix, and amounting R
unit by unit, the step response will become slower, less effort will be put in the control action. Leaving the
R matrix equals to the unit, the control action increases if the Q is increased. The Q matrix acts on the
states of the system. Q(1, 1) amounts to the cart displacement, Q(2, 2) corresponds to the cart displacement,
Q(3, 3) to the pendulum angle and Q(4, 4) to the pendulum angular displacement. Since we are not bothered
about the cart velocity and angular velocity of the cart we can keep Q(2, 2) and Q(4, 4) as zero. Since the
constraint on cart position is difficult to meet, we choose Q(1, 1) Q(3, 3).
We start the tuning with the value of Q = C T C and R = [1] and check the response. We will increase the
weight matrix Q such that Q(1, 1) is always greater then Q(3, 3). The final value of Q and R after tuning
for which the system was stable and was able to track the reference signal is given below:
450 0 0
0 0 0
Q=
0 0 150
0 0 0
0
0
, R = [5]
0
0
(3.10)
Observer Design
To design the observer, we first check the rank of observability matrix.
C
CA
CA2
(3.11)
CA3
We observe that the rank of W is 4 and therefore we can design an observer to measure the states which are
not currently measurable. i.e. the speed of the cart displacement and the angular velocity of the pendulum.
We calculate the eigenvalues of the closed loop system and place the observer pole at 10 times the slowest
pole. We found that the slowest closed loop pole was at -4.09 [before tuning], so we places the observer poles
at
P = [40, 41, 42, 43]
(3.12)
We implement the placement of observer using the matlab command place. The final state space matrix of
the closed loop plant is
Ac = [A BK]
Bc = B
Cc = C
(3.13)
Dc = D
Page 12 of 26
Integration Project
SC4050
Figure 3.1: Simulink Model of LQR continuous time Observer based Model
Observer state space matrix is
Ahat = [A LC]
Bhat = [B L]
1 0 0
0 1 0
Chat =
0 0 1
0 0 0
0 0 0
0 0 0
Dhat =
0 0 0
0 0 0
0
0
0
1
(3.14)
Where K is the solution of the riccati equation and L is the output of matlab command place used for
observer pole placement.
Now we implement the linearised closed loop plant with observer on the simulation using the above matrices,
as shown in Figure 3.1
Page 13 of 26
Integration Project
SC4050
(3.15)
(3.16)
We repeat the same procedure as continuous time by using the place command to place the observer and
create the discrete time LQcontroller with observer The discrete time closed loop state space model is given
Page 14 of 26
Integration Project
SC4050
(3.17)
Ddc = Dd
The observed state space model is given by
P hihat = [P hi LCd]
Gammahat = [Gamma, L]
1 0 0 0
0 1 0 0
Cdhat =
0 0 1 0
0 0 0 1
0 0 0
0 0 0
Ddhat =
0 0 0
0 0 0
(3.18)
Challenges
The discrete time controller with the same Q and R values gave good response on the simulation model
where as when tested on the pendulum setup didnt stabilise the system. This happened because of high
dynamics of the observer pole placed at 0.4. It created turbulent oscillation and destabilised the system.
When we placed the observer poles near 0.7, the system oscillation reduced and it gave a smooth response.
Page 15 of 26
Integration Project
SC4050
Figure 3.4: Comparison of Disturbance rejection in the Simulation Model to Pendulum setup
Page 16 of 26
Integration Project
SC4050
Page 17 of 26
Integration Project
SC4050
Figure 3.7: Control Output LQR Reference tracking on the cart pendulum setup
Figure 3.8: Observer Output LQR Reference tracking on the cart pendulum setup
Page 18 of 26
Chapter 4
Sample time:
As discussed before the selection of sample time is decided based on the cut-off frequency or rise time of
the system. If we decrease the value of sampling time rejection of unknown disturbance usually improves.
Usually very low value of sampling time increases the computational power significantly. In our case when we
tried using sampling time of 0.01 second we did not encounter any computation problem and we continued
with 0.01 sampling time.
Prediction Horizon:
The prediction horizon, Np , is the number of future control intervals the MPC controller must evaluate by
prediction when optimizing its manipulated variables at control interval Ts. Generally value of Np is selected
based on how fast you want your controller to respond that is we want our response time to be equal to the
prediction horizon times the sampling time. As we have already designed LQG controller we have seen that
achieving 2 seconds of settling time is possible. Hence we want our closed loop system to have a settling
time similar to LQG, in range of 2 seconds. To achieve this we select our prediction horizon to be 200 as
our sampling time is 0.01s. By going through various literature we realise that a prediction interval of 2 to 3
second is good enough for a good controller. It is also know that low value of prediction interval can create
an internally unstable controller hence we do not decrease this value.
19
Integration Project
SC4050
Control horizon:
Control horizon is interval after which a controller forces the control signal to become constant. In general Nc
should be very small compared to prediction horizon. An important effect of control horizon is the smoothing
of the control signal and the control signal is forced towards steady state value which is important for steady
state property. Another effect of decreasing Nc is, it decreases the computational effort drastically. The
control horizon value should be more if there is dead time in the process. Since in our setup we do not find
any dead time we chose Control horizon to be 30 (30*0.01=0.3s).
Weight tuning:
Model predictive controller (MPC) is based on minimization of quadratic criterion.
J(k) = eT Q(k)e + uT Ru
(4.1)
where e is a vector of predicted control errors, u is a vector of future control signal samples and square matrices
Q and R allows to set weighting of individual vector elements. MPC uses receding horizon principle: only
a finite number of future values is used in the criterion and only the first element of the obtained control
sequence is applied to the controlled system. Future outputs of the controlled system, and consequently
control errors, are computed on base of the linear model. Since the system is described by state space model,
future system outputs depend only on current states of the system and future control signals:
y(k) = Cx(k) + Du
(4.2)
As the matrices Q and R are diagonal the predictive control criterion can be rewritten into the following
form:
Nc
N
N
X
X
X
2
2
2
J(k) = 1
[e1 (k + j)] + 2
[e2 (k + j)] + 3
[u(k + j 1)]
(4.3)
j=1
j=1
j=1
where
e1 (i) = wr (i) r(i)
e2 (i) = 0 (i) = (i)
Matlab control toolbox optimizes this objective function by converting it into Quadratic programming
problem and gives the optimized control signal that is used to track the output signal. Since we had already
designed the LQR controller we started tuning weights here by giving the values we had obtained in LQR
controller i.e. weight on x as 450, weight on as 150 and weight on input as 1. When we simulated this
scenario we were able to track the signal, but the control signal was very high. Hence we scaled all the
weights and tuned it till control input reduced to value in between -1 and 1 which corresponded to value
when all weights were scaled by 10. Hence the new weights were 4500 weight on x, 1500 weight on and
150 weight on input u. The simulation result with these parameters are shown in the figure 4.1
Page 20 of 26
Integration Project
SC4050
Figure 4.1: Reference tracking in simulation after weight tuning of input signal
It can be seen from the above figure that when the weight on input was low the control input was very
high. Once we increased the weight on input the control input is well within the limit. Even though now the
controller was able to do reference tracking, even for a small disturbance we were not able to do disturbance
rejection and the system was becoming unstable. To overcome this we tried increasing the weight on and
decreasing the weight on x. Hence with the weight of 1500 on x and 4500 on the model was able to do
disturbance rejection.
When we apply the controller with these parameter values in the real time setup we found out that it had
lot of oscillation and the cart never became stationary, even the pendulum had oscillation. We realised that
this was this was due to fact that there was high weight on the error in , because of which even for small
error in the control input was very high and it was making the cart move rapidly. To overcome this we
increased the weight on x till the oscillation stopped and the cart was able to track the reference. Hence the
final weight that we obtained was 2500 on x, 4500 on and 150 on input u. Figure 4.3 shows the reference
tracking for the setup and figure 4.2 shows the reference tracking in the simulation model. We observe that
there is a very small steady state error in the reference tracking of the real-time setup and this is because
the error is so small that the control signal generated by it cannot overcome static friction.
Figure 4.4 shows the comparison between the disturbance rejection in the simulation to the pendulum setup.
The simulation is given an initial disturbance of 0.01 radians whereas the pendulum setup is given disturbance throughout the experiment.
We observe that the disturbance in the pendulum setup takes more time to settle in comparison with the
simulation. This same behaviour was observed in the LQG controller and is due to the model mismatch for
the unaccounted viscosity of the pendulum and static friction of the cart.
Page 21 of 26
Integration Project
SC4050
Figure 4.3: Shows reference tracking in real setup, after tunning the MPC controller
Page 22 of 26
Integration Project
SC4050
Figure 4.4: Disturbance rejection in simulation and in real-time setup with MPC controller
Page 23 of 26
Chapter 5
Conclusion
Modeling
As discussed before there are two approaches to model a system: The First principle model and the black
box model. We use the first principle modelling instead of the black box model this is because it is usually
more reliable in comparison with the black box modelling and also the pendulum cart system can be easily
modelled mathematically. The drawback of black box modelling is that it is generally valid only for the signal
it was calculated from, which could be avoided by taking an input which persistently excites the system,
but finding such a input is difficult. When modelling the system we neglect the rotational viscous friction,
translational Coulomb friction and stiction for easy calculation. We observe that this approach gives us a
good model with VAF of 96% for identification data and a VAF of 86% for validation data. This establishes
that the model is reliable. For further improvement in the accuracy of the model we can model the coulomb
friction as:
Fxc = Fc .sign(x, )
where Fc is coulomb friction constant. The negative sign is because friction acts against the movement of
cart.
LQR control
Even though the implementation of a state feedback controller was simple in comparison with the MPC
controller, the LQR controller yields really good results. The downside of this controller is that it requires
really good model of the system. Hence system modelling should be reliable for this to work but if the system
is really complex then modelling is not easy and it can become tedious. The model we used was accurate, so
once we had the controller working in simulation, the same controller worked well on the real setup without
much tuning. One problem we encountered in the real setup was the rigorous oscillations of the cart. This
was because of an aggressive observer pole used for the state estimation was responding to noise. Once we
made this observer poles less aggressive it was able to estimate the state and worked smoothly.
Integration Project
SC4050
SIMO system with constraint on the input signal to be between -1 and 1. This resulted in a feasible solution
which was able to track the reference but was unstable for even small disturbance. Finally we removed this
constraint and we increased the weight till the input signal was under the recommended limit of -1 to 1
and then used a saturation block to be on safer side. Another problem we faced was that even though the
controller was working in simulation it was not able to control the real setup. We re-tuned the controller to
stabilise the system.
Page 25 of 26
Bibliography
[1] Karl Johan Astrom and Richard M. Murray. Feedback Systems : An Introduction for Scientists and
Engineers.
[2] Aarshita Joshi and Nimmy Paulose Discrete Time Model Predictive Control Approach for Inverted Pendulum System with Input Constraints
[3] Petr Chalupa and Vladimir Bobal
Modelling and Predictive Control of Inverted Pendulum
[4] Control Tutorials for Matlab and Simulink
http://ctms.engin.umich.edu/CTMS/index.php?aux=Home
[5] Mathworks Tutorial for MPC Toolbox
http://uk.mathworks.com/products/mpc/
26