Sie sind auf Seite 1von 6

Bogazici University

ME537 Project I
Control of a Pendulum on a Cart
Kadir Cumali
30 November, 2015

Introduction
The pendulum on a moving cart is a classic problem of the control theory since it is
an illustrative example of linear and nonlinear systems analysis and design. It can be
used to understand some concepts such as stability, controllability, and observability. In
this report, some nonlinear system analyses and control techniques are investigated for
this particular system. The intention is to obtain nonlinear control solutions in order to
regulate the pendulum to the upright position and the cart at its desired position.
The report is organized as follows. 1. Dynamics and linearization, 2. Controllability
of the system, 3. Control of the system 4. Results
1 Dynamics and Linearization
In this section, the dynamic equations of the pendulum on a cart system is described
two equations, where mc is the mass of the cart, m is the pendulum mass, L is distance
from cart to pendulum mass, g is the gravitational acceleration constant, and Td is small
perturbations. The variables x and are the cart displacement and the pendulum angle,
respectively.
(Td + mgLsin()(mc + m) mcos()(F + mLsin()2 )
=
mL2 (mc + m mcos2 ())
x =

(F + mLsin()2 )L cos()(Td + mgLsin())


(mc + m mcos2 ())L

Now to put these equations into state form, we make the following substitution in
order to linearize around = 0.
z1 =

z2 =

z3 = x

z4 = x

We can write the final state space equations for the system given as,

z2


(T + mgLsin()(m + m) mcos()(F + mLsin()2 )
z1

d
c


2
2
z
d
d
d

2
mL (mc + m mcos ())
=
=
z=

dt
dt z3 dt x
z
4

(F + mLsin()2 )L cos()(Td + mgLsin())


x
z4
(mc + m mcos2 ())L

y is a column vector of the output variable. C is an 2 x 4 matrix of the constant


coefficients that weight the state variable.

" #
"
#

1 0 0 0

y = C[z] or y =
z=

x
0 0 1 0
x
x
These equations give a complete state space representation of the nonlinear inverted
pendulum. Linearizing at upward position, the system has,

0
0
1
0
0

F + (mc + m)g (mc + m)g


0 0 0

mc L
+ mc L F
=
=
mc
z =

x

x

0
0 0 1 x 0

mg
1
F mg
x

0 0 0 x
mc
mc
mc

0
0
1 0 0
(m + m)g

1
c
0 0 0

m L
and B =
c
mc
A=

0
0 0 1

1
mg

0 0 0
mc
mc
2 Controllability of the System
The system defined can be controlled so that pendulum on the cart remain vertical
on the top of the cart, that is = 0. The system is: (1) controllable by the input, and
(2) the state z can be measured directly. The linearized control system around (0, 0)
R4 xR is z = Az + BF with, we have equations by taking mc = 4, m = 2, and L = 2.
= 14.715(t) 0.125F (t)
(t)
= 4.905(t) + 0.25F (t)
z(t)
We can easily check that if this linearized control system satisfies the Kalman rank
condition. Let parameter r = (mc , m, L, g) R4 , then the controllability matrix Qc (r)
is:

(mc + m)g
1
0

0
mc L
M 2L

1
(mc + m)g

0
2

M L
Qc (r) = [B AB A2 B A3 B] = mc L

1
mg
0

2
mc
mc L

1
mg
0
0
mc
m2c L

Since determinant of controllability matrix, |Qc (r)|, is 0.1468, Qc (r) has full rank, the
system is completely controllable. Thus, if the angle departs from equilibrium by a
small amount, a control always exists which will drive it back to the zero. This justifies
the assumption that = 0.
3 Control of the System
We normally investigate a feedback control scheme in order to minimize the destabilizing
effects of disturbance forces. The close - loop system is formed by feeding back the state
variables through a real constant matrix K;
u(t) = Kx(t)
The closed loop system is thus described by,
x = (A BK)x(t)
The design objective in this case is to find the gain matrix K such that the close - loop
system is stable.

Figure 1: Responce curves: Left: U = 0.3*step function, Right: U = 0.7*step function


Figure 1 shows different step responses with LQR control. It should be noted that the
simulation is run for a time span of 10 seconds. The plant initial condition vector has two
elements, cart position and angle of pendulum. The initial condition used for the vertical
angle of the stick is 0 radians. When greater force is applied to the cart, it is seen that
the pendulum angle is greater than the case of smaller force. In the figure, when reference
input is 0.3 step function, the pendulum angle becomes 0.707 . However, the reference
input is increased to 0.7 step function, the angle becomes 1.651 . We can observe the
difference of the cart positions with respect to the force applied. The pendulum angle
comes back to the initial value, 0, in nearly 7 seconds.

In previous cases, the positive semidefinite matrix Q = C 0 C. We will analyze the


effect of this term on the state variables. Now, we will choose Q = 100 C 0 C.

Figure 2: Responce curve: U = 0.7*step function, Q = 100 C 0 C


Figure 2 shows the response of the greater Q. It is seen that when we increase the
values of the elements of Q, we can improve the response. The system is successfully
stabilized with a settling time of approximately 5 seconds.
Now, we should simulate the closed loop system for different initial conditions closed to
equilibrium and small perturbations denoted by Td , which are given in the problem. The
controller is applied to the nonlinear equations defined in the dynamics and linearization.
In order to analyze how to change angle of pendulum, angular velocity, acceleration, and
force during the time, we can follow the steps explained below.
which correspond to the
1. We should obtain initial conditions for the two states and ,
angle of pendulum and angular velocity of pendulum, respectively.
" #

if we
2. For the gain matrix, K, we will find the input from the equation F = K

assume that desired angle and angular velocity are 0. Afterwards, is calculated.
and = 0 + dt
are computed in small dt time. We have new
3. Equations = 0 + dt,
and values.
For different Td values, the algoritm is executed.

Figure 3: Change of state variables, input: force, and output: acceleration of cart
Initial values are taken x0 = 2 cm, x0 = 5 cm, 0 = 0.01, 0 = 0.03. The initial
angle value of pendulum is taken 0.01. After 2 seconds, there exists a small perturbation
and angle of pendulum increases. Though, as we expect, it will come into the equilibrium
point, which is 0.
4 Results
The intention of this project is to familiarize with modelling nonlinear systems performing
linearization, designing and evaluating different control laws based on pole placement or
LQR, and finally verifying our design. The pendulum on a cart is used for this control
system design. However, to control a pendulum on a cart is a diffucult problem. The
design specifications are:
(a) The pendulum is balanced at its vertical position;
(b) The cart is asymptotically moved back to the origin and remains there.

Das könnte Ihnen auch gefallen