You are on page 1of 43

Ball and Beam Control System

Tran Thien Dung


Faculty of Electronics, Thai Nguyen University of Technology
2015

Overview

Introduction

What is ball and beam system

Mathematical Model

Linear Model

LQR Controller

Conclusion

Introduction
The ball and beam is one of the most popular and
important bench systems for studying control
algorithms.

Its a laboratory equipment with interested in its

dynamics: high nonlinearity, open loop unstable.


The system is simple to understand.
Many classical and modern control methods have
been used to stabilize the ball and beam system.

What is the Ball and Beam


The system is simple: a steel ball rolling on the
top of the long beam. The beam is mounted on
the shaft of an electric motor can be tilted by
applying an voltage signal to motor.

What is the Ball and Beam


The other configuration: one end of the beam is
coupled to the motor through a lever arm and gears,
the other end is fixed.

What is the Ball and Beam


Position sensor: the beam consists of a steel rod in
parallel with awire-wound resistor which is
biased and the position along the track is obtained
by measuring the voltage at the steel rod.

What is the Ball and Beam


Angle sensor: the angle of beam is obtained by
measuring the voltage at the output of a rotary
potentiometer which is attached to output gear of
sevo-motor

What is the Ball and Beam


Ball and beam system in Laboratory of Automatic
Control Division

What is the Ball and Beam

It has a very important property: open loop unstable


the ball does not stay in one place on the beam
but move with an acceleration that is proportial to
the tilt of the beam.
Controller has to automatically regulate the position
of the ball on the beam by changing the angle of
the beam. This is a difficult control task.

Mathematical Model
L
r

b
Ra

im
H

2
1

, m

Schematic of Ball and Beam System

Mathematical Model
L

Lengh of the beam (m)

Position of ball on the beam (m).

Torque applied on the beam (Nm)

The angle of beam (rad)

Torque of motor (Nm)

Mathematical Model

Lagrangian Method

Kinetic energy:
o

T TB Tb Tm

1
2
&
+) Tb J b kinetic of the beam.
2
1
2
&
T

m
r
+)
kinetic of the ball.
B
B
2
2
1 K g .L
2
&
J

+) Tm
kinetic of rotor.
m

2 d

Mathematical Model

Potential energy:
L
P mB g .r.sin mb .g .sin mm g .H
2

Lagrange function:
Dynamical equations:

L TP

d L
L

b bf

dt &

d L
L

Bf

dt r&
r

Mathematical Model
We have:

K
L

g
&
J m &
J B J b mb r 2

mB g .r mb g cos 2mB r.r&.& b bf


2

And:

J B
2
&
&
&
mB 2 r mB .r. mB g .sin Bf
R

Mathematical Model

Equations of DC servo motor:

Kt
Kt
L
m K t .im U m K b& U m K b K g &

Ra
Ra
d
and
K g Kt L

L
b Kg m
.U m
d
Ra d

K b K t K g 2 L2
Ra d

.&

Mathematical Model
, we have state space
equations of ball and beam
&
&
x

r
,
x

r
,
x

,
x

2
3
4
system: 1

Set:

x&1 x2

Bf mB x1 x42 mB g .sin x3
x&2
7
mB
5
x&3 x4
K g Kt L

.U m bf

Ra .d

&
x

K b K t K g 2 L2
L

2mB x1 x2
x

m
g
.
r

m
g

B
4
b cos x3
2

Ra d
2

2
K
L

J b J B mB x12 g J m
d

Parameters of System
mB

Ball mass

21,64/ (g)

mb

Beam mass

81,27(g)

Ball radius

0,9cm)

Beam length

43 (cm)

Arm length

2,5(cm)

Kb

Velocity constant of motor

0,1174

Kt

Torque constant of motor

0,1174

Parameters of System

Kg

Gear ratio

5(120/24)

Ra

Resistor of armature

10,4()

Jb

Beam moment of inertia

0.005(kg.m2)

JB

Ball moment of inertia

7,0114.10-7(kg.m2)

Jm

Rotor moment of inertia

5,5136.10-5(kg.m2)

Ku

Amplifier gain

10(V/round)

Linear Model

In order to design controllers such as: LQR, PID,


LQG,for Ball and Beam system, we must have the
linear approximation of the dynamic equations.
Using Jacobian linearization method to give the
linear dynamic equation around operating point,
dynamic equations were rewritten:

Linear Model
x&1 f1 x, u

x&2 f 2 x, u

x&3 f 3 x, u
x& f x, u
4
4

In that:

f1 x, u x2
K g Kt L

f 4 x, u

Ra d

f 3 x, u x4
u

mB x1 x42 mB g sin x3
f 2 x, u
7
mB
5

K b K t K g2 L2
L

2mB x1 x2
x4 mB .gx1 mB g cos x3

2
Ra d
2

2
K
.
L

g
J b J B mB x12
Jm
d

Linear Model

Operating point is selected to be:


x* x* , x* , x* , x*
1 2 3 4

rd ,0,0,0

Ra d
L

u
mB .g .rd mb .g
K g Kt L
2

*
*
f
x
,
u
0 we have:
With:

Linear Model
f1
x
1

f1
x2

f1
x3

f 2
x
1

f 2
x2

f 2
x3

f3
x2

f3
x3

f 4
x2

f 4
x3

dx
f x, u
dt
f3
x
1
f 4
x
1

Or:

f1
x4

f 2
x4

f 3
x4

f 4
x4

( x* , u * )

f1
u

f 2
u
*
x

f
3
u
f 4

u

dx
Ax% Bu% with: x% x x* , u% u u *
dt

u u
*

Linear Model

Summary, after some calculations, we have linearity


model of ball and beam system:
dx%
Ax% Bu%

dt
y% 1 0 0 0 x%

With matrices A, B as following:

Linear Model

0
5
0 g
7
0
0

K g L
J m mB g mB2 .g .rd2
Jb J B

2
2

K g L
J

J m mB .rd2

b
B

B 0 0 0

K g Kt L

Ra d J b J B

K g L
2
J m mB rd
d

K d Kt K L

2 2
g

K g L
2
Ra d J b J B
J m mB rd

Linear Model
Using above parameters, we have matrices:

0
1.0000
0
0
0

0
0
7.0000
0
0
, B

0
0
0
1.0000
0

0.8009
0
0
37.5428
3.7184

1 0 0 0
C

0
0
1
0

Linear Model
Inner structure of linear four states model:

Controller
Controller has to automatically regulate the position
of the ball on the beam.
Based on dynamic model, there are various controllers:

It could be modeled as a fourth order multivariable system and


a state feedback controller could be developed.
A simpler method, it was modeled as two second order
system, and two control loops were designed

Controller
We can design many classical or modern feedback
controller for ball and beam system. Examples:

PID controllers.
LQR, LQG
PID-LQR
Fuzzy, Sliding mode,

Controller
State Feedback Controller:
The idea of feedback in state space control is similar
to that in the classical control system. The control
signal in full state feedback control is defined as
follow:
u K.x

where K is proportional control gains.

Controller
State Feedback Controller:

LQR Controller

LQR Method:
The LQR stands for Linear Quadratic Regulator,
which seeks a gain matrix the minimises performance
index J:

J xT Qx u T Ru dt
0

Where: Q is the state weighting matrix, R is the control


weighting matrix.

LQR Controller

The optimal gain matrix is calculated:


K LQR R 1BT P

with P is determined by solving the algebraic Riccati


Equation:
AT P PA PBR 1BT P Q 0

LQR Controller
Matrices are:
24 0 0 0
0 0.1 0 0
, R 0.03
Q
0 10 0
0

0 0 1
0
Control gains calculated using above Q, R is
presented as follow:
K LQR 28.5005 23.3660 67.1461 2.9950

LQR Controller
Simulation:

LQR Controller
Results from Simulation:

LQR Controller
Experiment:
To implement, we can use PC, or analog circuit. In this
case, an data acquisition card NI USB 6008 and PC
is used to implement LQR controller.

Experimental schematic:

LQR Controller

Real-Time
r

Sync
Real-Time
Synchronization

Subsystem6

r_dot

phi
phi_dot
Subsystem

Gain4
-30

-KGain

Scope
-KGain1

-KGain2

Um Gain5
*1
0.1
-1

U 0.2
m
*

-KGain3

LQR Controller

Interface between the physical system and NI-USB-6008


nidaq Dev1

HWChannel0

1/1.77

USB-6008
Analog Output
(Single
Sample)

1
U

C
2.58

1
-Knidaq Dev1
USB-6008

HWChannel3

1
0.05s+1
Transfer Fcn

du

dt
Derivative
HWChannel7

Analog Input
(Single
Sample)

-K-

1
0.07s+1
Transfer Fcn1

du

1
r
2
r_dot

3
phi

dt
Derivative1

LQR Controller
Experimental Results:

Ball Position - r

LQR Controller
Tilt angle of the beam

LQR Controller
Velocity of ball - r&

LQR Controller
Angle velocity of beam - &

Conclusion

State feedback controller using LQR method can


stabilize ball and beam system a open loop
unstable.
System is robust with noises, and initial
conditions.
Controller can be implemented using analog
circuits, or PC.

You might also like