Ballandbeamdynamics

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/340614801

Derivation of the Dynamics of the Ball and Beam System

Technical Report · September 2007

CITATIONS READS

0 1,957

1 author:

Ben Cazzolato
University of Adelaide
388 PUBLICATIONS 5,068 CITATIONS

SEE PROFILE

All content following this page was uploaded by Ben Cazzolato on 14 April 2020.

The user has requested enhancement of the downloaded file.


Ball and Beam System Dynamics

Derivation of the Dynamics of the Ball and Beam System

Dr Ben Cazzolato

September 2007

The following document presents the derivation of the dynamics of the ball and beam system
shown in Figure 1 below. The derivation is based on a Lagrangian formulation but could just
as easily be formulated using a Newton/Euler formulation.

r Ball
L r=0
Y
Beam
Pivot
θ d Arm
D X
τ
Pivot

R0
R1
Ball
D
Beam
d

Figure 1: Schematic of the ball and beam system

It should be noted that the following material was derived using the Symbolic Toolbox in
Matlab. Although it is expected that the code is correct, as it was vetted against other works
(discussed in the literature review and the end of this document), it is possible that the
reproduction in this document may contain some typographic errors.

Page 1
Ball and Beam System Dynamics

Definitions

Prior to commencing with the derivation of the dynamics we will make a few definitions.

Fixed Parameters
• L (m) is the length of the beam,
• d (m) is the distance from the pivot to the plane of ball contact on the beam,
• D (m) is the distance from the pivot to the centre of mass of the beam,
• R0 (m) is the radius of the ball,
• R1 (m) is the distance between the axis of rotation of the ball (centre of gravity) and
the point of contact of the ball with the beam,
• m (kg ) is the mass of the ball,
• M (kg ) is the mass of the beam (located at d (m) from the pivot),
• C1 ( N/(m/s)) is the viscous friction coefficient between the ball and the beam (and
accounts for ball rotational viscous losses to since these enter at the same dynamic
order),
• J beam (kg.m 2 ) is the moment of inertia of the beam, including all rotational
components such as rotor including beam mass offset (parallel axis theorem),
• g = 9.81m/s 2 is the gravitational acceleration.

Independent Variables
• r (m) is the displacement of the ball along the beam. Positive r is when the ball is
traveling to the right and r = 0 represents the centre of the beam,
• θ (rad) is the angular rotation of the beam, where a counter-clockwise direction is
positive,
• i (A) is the current flowing through the servo-motor,
• V (V) is the voltage applied to the servo-motor.

Dependent Variables
• τ (Nm) is the torque the servo-motor applies to the beam, where a counter-clockwise
direction is positive,
• Fg ( N) is the force due to gravity acting through the centre of mass of the ball,
• F f ( N) is the rolling constraint force on the ball.

Electrical System
• Rm (Ω) is the electrical resistance of the servo-motor,
• K m (Nm/A) is the electromotive torque constant of the servo-motor, and is equal to
the back emf constant for SI units,
• Lm (H) is the electrical inductance of the servo-motor,
• C2 ( Nm/(rad/s)) is the viscous damping constant of the servo-motor rotor,
• J m (kg.m 2 ) is the moment of inertia of the servo-motor rotor.

Page 2
Ball and Beam System Dynamics

Assumptions
Before deriving the dynamics of the system a number of assumptions must be made. These
are:
• The motor shaft and the beam are assumed to be rigidly coupled and infinitely stiff
• There is no skidding between the ball and beam contact
• There is no backlash in the motor/gearbox assembly
• There is no static friction in either the ball/beam contact or in the motor/gearbox
assembly and damping is limited to viscous losses

Position, velocity and acceleration of the ball


From the geometry of the ball and beam we can define the position of the centre of the ball in
Cartesian (x and y) coordinates as
xc = r cos(θ ) − (d + R1 )sin(θ )
y c = r sin(θ ) + (d + R1 )cos(θ )

Differentiating this with respect to time we get the velocity of the ball
x& c = r& cos(θ ) − r sin(θ )θ& − (d + R1 )cos(θ )θ&
y& = r& sin(θ ) + r cos(θ )θ& − (d + R )sin(θ )θ&
c 1

And again to get the acceleration of the ball


&x&c = &r&cos(θ ) − 2r& sin(θ )θ& − r cos(θ )(θ&) 2 − r sin(θ )θ&& + (d + R1 )sin(θ )(θ&) 2 − (d + R1 )cos(θ )θ&&
&y& = &r&sin(θ ) + 2r& cos(θ )θ& − r sin(θ )(θ&) 2 + r cos(θ )θ&& − (d + R )cos(θ )(θ&) 2 − (d + R )sin(θ )θ&&
c 1 1

Angular position, velocity and acceleration of the ball


We can use geometry to also determine the angle that the ball has turned from
r
α =θ −
R1
Therefore the angular velocity and the angular acceleration of the ball is given respectively by
r&
α& = θ& −
R1
&r&
α&& = θ&& −
R1

The moment of inertia of the ball is given by that of a sphere


2
J ball = mR 02
5

Page 3
Ball and Beam System Dynamics

Lagrangian approach to the system dynamics


We now proceed with a Lagrangian formulation of the system dynamics of the mechanical
system.

First define the potential energy of the system


E p = mg (r sin(θ ) + (d + R1 ) cos(θ ) ) + MgD cos(θ )
144444244444 3 14243
Ball Beam

Now define the kinetic energy of the system


1
(
2 4444424424443 1
1
) 1
Ek = m ( x&c ) 2 + ( y& c ) 2 + J ball (α& ) 2 + J beam (θ&) 2
2 4243
1
Ball Beam
Substituting the expressions for the moment of inertia of the ball and the angular velocity of
the ball gives

Ek = m ⎢
(
1 ⎡ r& cos(θ ) − r sin(θ )θ& − (d + R1 ) cos(θ )θ& ⎤ 1
2
) 2⎛ & r& ⎞
2
1
⎥ + mR0 ⎜⎜θ − ⎟⎟ + J beam (θ&) 2
14⎣4444444444424
(
2 ⎢+ r& sin(θ ) + r cos(θ )θ& − (d + R ) sin(θ )θ& ⎥ 5
1
2

4444⎦44444443
)⎝ R1 ⎠ 2 4243
1
Beam
Ball

We may now define the Lagrangian being the difference in kinetic and potential energies,
L = Ek − E p

From this we obtain the Lagrange equation


∂ ⎛ ∂L ⎞ ∂L
⎜⎜ ⎟⎟ + Ci q& i − = Qi
∂t ⎝ ∂q& i ⎠ ∂qi
where qi = r,θ is the generalised coordinate, Ci is a generalised viscous damping coefficient
and Qi = 0,τ is the generalised force.

System differential equations


Evaluating the Lagrange equation for both qi = r &θ , the two fundamental differential
equations of the ball and beam system are:
⎡ ⎛ 2 R2 ⎞ ⎤
&&⎛⎜ − d − R − 2 R0 ⎞⎟ − r θ& 2 + g sin(θ ) ⎥ + C r& = 0
()
2
m ⎢&r&⎜⎜1 + 0

2 ⎟
+ θ ⎜ (1)
5 R1 ⎟⎠ Centrifuga
{ 1 424 3⎥ {
1 1
⎢⎣ ⎝ 5 R1 ⎠ ⎝ l Gravitational ⎦ Ball
Damping

and
⎛ ⎞
⎛ ⎞ ⎜ ⎟
⎛ ⎞
2
2 R0 2
− m&r&⎜⎜ d + R1 + ⎟⎟ + θ&&⎜ J beam + m⎜ R12 + R02 + r 2 + d 2 + 2 R1d ⎟ ⎟
{
⎜ Beam ⎝ ⎠⎟
14 ⎝ 442454R4 1 ⎠
3
5
⎜ Rotation 1444442444443 ⎟
Ball Translation ⎝ Ball Rotation ⎠
+ 21mr
23 r&θ& − gMD sin(θ ) − gm(sin(θ )( R1 + d ) + r cos(θ ) ) + C2θ& = τ ( 2)
14243 144444244444 3 {
Coriolis Beam Gravitational Ball Gravitational Beam
Damping

Page 4
Ball and Beam System Dynamics

These two equations can be solved in terms of the acceleration of the ball and angular
acceleration of the beam, as given by
⎡− 5 R 2 mgr cos(θ ) − 5 gR sin(θ ) J
⎢ 1 1 beam − 2 R0 mgr cos(θ ) + 5 R1 mr θ
2 3 &2 () ⎤


()
⎢+ 5 R1 mr 3 θ& 2 − 5 R12C2θ& − 2 R02C2θ& − 5 R1C1r&J beam / m + 2 R02 mgd sin(θ ) ⎥

⎢+ 5 R12 MDg sin(θ ) + 2 R02 MDg sin(θ ) − 5 R1dmgr cos(θ ) − 5 R1mgr 2 sin(θ )⎥
⎢ &
2
[
⎥ + 5 R1 τ + 5 R1dτ + 2 R0 τ
2
]
⎢+ 5 R1dMDg sin(θ ) − 5 R1C1rd − 2 R1 R0 C1r − 5 R1C1rr − 4 R0 mrrθ
& 2 2
& & 2 2
& ⎥
⎢ 2 & 2 & ()
2 2 & 2
⎢− 10 R1 C1dr& − 10 R1 mrr&θ + 2 R0 R1mr θ + 5 R1rmd θ − 5 R1 C1r&
2
() 3 ⎥

&r& = R1

⎣ ()2 2
()
+ 5 R1r θ& J beam − 5 R1C2 dθ& + 10 R1 dmr θ& − 10 R1dmrr&θ&
2 ⎥

[
2 R02 md 2 + 2 R02 mr 2 + 5 R12 mr 2 + 5 R12 J beam + 2 R02 J beam ]
(3)

and

⎢ 1
()
⎡5 R 3 mr θ& 2 − 5 R 3C r& − 4 R 2 mrr&θ& − 5 R 2 C θ& + 5 R 2 MDg sin(θ ) − 5 R 2 mgr cos(θ )⎤
1 1 0 1 2 1 1


2 2 & 2 2
()
⎢+ 2 R0 MDg sin(θ ) − 2 R0 C 2θ − 5 R1 C1dr& + 5 R1 dmr θ − 10 R1 mrr&θ
& 2 2 &

[
⎥ + 5 R12τ + 2 R02τ ]
&& ⎣
()
⎢− 2 R1 R02 C1r& + 2 R02 R1mr θ& + 2 R02 mgd sin(θ ) − 2 R02 mgr cos(θ )
2


θ=
[ ]
2 R02 md 2 + 2 R02 mr 2 + 5 R12 mr 2 + 5 R12 J beam + 2 R02 J beam
(4)

Page 5
Ball and Beam System Dynamics

Linearised state equations for mechanical system


If we linearise the expressions about the equilibrium positions:
re = 0
r&e = 0
θe = 0
θ&e = 0 (5)

using a Jacobian linearization we obtain the following linearised state equations,

⎡ r& ⎤ ⎡ 0 1 0 0 ⎤⎡ r ⎤ ⎡ 0 ⎤
⎢ &r&⎥ ⎢ A A22 A23 A24 ⎥ ⎢ r& ⎥ ⎢ B21 ⎥
⎢ ⎥ = ⎢ 21 ⎥ ⎢ ⎥ + ⎢ ⎥τ ( 6)
⎢θ&⎥ ⎢ 0 0 0 1 ⎥ ⎢θ ⎥ ⎢ 0 ⎥
⎢ &&⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎣θ ⎦ ⎣ A41 A42 A43 A44 ⎦ ⎣θ&⎦ ⎣ B41 ⎦

where
A21 = − mgR1 (5R1d + 2 R02 + 5R12 ) /(2 R02 md 2 + 5R12 J beam + 2 R02 J beam )
A22 = − R12C1 (2 R02 + 5d 2 + 10 R1d + 5R12 + 5 J beam / m) /(2 R02 md 2 + 5R12 J beam + 2 R02 J beam )
A23 = gR1 ( 2 R02 MD − 5 R1 J beam + 2 R02 md + 5 R12 MD + 5 R1dMD ) /( 2 R02 md 2 + 5 R12 J beam + 2 R02 J beam )
A24 = −C2 R1 (5 R1d + 5 R12 + 2 R02 ) /( 2 R02 md 2 + 5 R12 J beam + 2 R02 J beam )

A41 = − mg (5 R12 + 2 R02 ) /( 2 R02 md 2 + 5 R12 J beam + 2 R02 J beam )


A42 = −C1 R1 (5 R1d + 5 R12 + 2 R02 ) /( 2 R02 md 2 + 5 R12 J beam + 2 R02 J beam )
A43 = g ( 2 R02 md + 5 R12 MD + 2 R02 MD ) /( 2 R02 md 2 + 5 R12 J beam + 2 R02 J beam )
A44 = −C2 (5 R12 + 2 R02 ) /( 2 R02 md 2 + 5 R12 J beam + 2 R02 J beam )

B21 = R1 (5 R1d + 5 R12 + 2 R02 ) /( 2 R02 md 2 + 5 R12 J beam + 2 R02 J beam )


B41 = (5 R12 + 2 R02 ) /( 2 R02 md 2 + 5 R12 J beam + 2 R02 J beam )

Page 6
Ball and Beam System Dynamics

Linearised state equations for coupled mechanical and electrical system

The differential equation describing the electrical subsystem for a DC motor may be found
using Kirchhoff’s law:
Lm i& + Rm i + K mθ& = V (7)
which may be arranged in terms of the derivative of the current i&
V − Rm i − K mθ&
i& = (8)
Lm

The torque produced by the dc motor is


τ = K mi

We can now merge the two state equations (and knowing that the torque produced by the
motor is τ = K m i ) to give the fully coupled state equation:
⎡ 0 1 0 0 0 ⎤ r ⎡ 0 ⎤
⎡ r& ⎤ ⎢ ⎡ ⎤
⎢ &r&⎥ ⎢ A21 A22 A23 A24 B21 K m ⎥ ⎢ ⎥ ⎢ 0 ⎥
⎥ r& ⎢ ⎥
⎢ ⎥ ⎢ 0 0 0 1 0 ⎥⎢ ⎥ ⎢ 0 ⎥
⎢θ&⎥ = ⎢ ⎥ ⎢θ ⎥ + V (9)
⎢ &&⎥ ⎢ A41 A42 A43 A44 B41 K m ⎥ ⎢ &⎥ ⎢ 0 ⎥
⎢θ ⎥ ⎢ − Km
θ ⎢ ⎥
− Rm ⎥ ⎢ ⎥ ⎢ 1 ⎥
⎢⎣ i& ⎥⎦ ⎢ 0 0 0 ⎢i ⎥
⎣ Lm Lm ⎥⎦ ⎣ ⎦ ⎢⎣ Lm ⎥⎦

Page 7
Ball and Beam System Dynamics

Literature review
There are numerous papers addressing the ball and beam system. Some of these are reported
here and are grouped according to simplifications/assumptions. Given the relatively simple
dynamics there is a surprising lack of published works presenting the full dynamics.

Sobhani et al: C1 = C 2 = 0
Sobhani et al1 appear to be the only authors that have attempted to completely describe the
non-linear dynamics of the ball and beam system. Their results do not agree with Equations
(1) and (2) above. The only apparent assumption they make is that the system is lossless, ie
C1 = C 2 = 0 . They only consider the mechanical system and do not calculate the coupled
electro-mechanical system.

They use a slightly different notation where R1 = r * , d = −h* , D = − s0 ,θ = φ , r = x .

It should be noted that there are many errors in their paper. There is a small dimensionality
error in their equation for the beam response (Equation 10); the term mgr cos(θ ) is missing
the r . There also seems to be terms missing − g sin(θ )(mR1 + md ) for the fact that the centre
of mass of the ball does not pass through the pivot point. There is an unusual velocity term
− m(d + R1 )(θ&) 2 which seems to be some sort of Coriolis force? Finally the coefficients of
the θ&& do not match at all.

White and Patenaude: R1 = R0 & M = D = d = 0


One of the most comprehensive and accurate models of the ball and beam system is that of
White and Patenaude2. The only simplifying assumptions they make are that the ball rolls
along its outer radius R1 = R0 and that there is no offset for the beam rotation d = 0 . The
authors present both a Lagrangian formulation and a Classical formulation employing
Newton’s and Euler’s laws. Their results closely match the Equations (1) and (2) above. Only
the mechanical subsystem is considered and no electrical subsystem is presented.

Hauser et al: C1 = C2 = 0, M = D = 0, R1 = R0 & d = − R1


Hauser et al3,4 inspired a flood of nonlinear control papers5,6,7,8 with application to the ball
and beam system. In their work they assume that there are no losses C1 = C 2 = 0 , that the ball

1
Sobhani, M., Neisius, B., Jayasuriya, S., Rumler, E. and Rabins, M.J. (1992) “Some new insights on the
classical beam and ball balancing experiment”, Proceedings of the American Control Conference, 450-454
2
White,W. and Patenaude, J. “Ball and beam dynamics”, Kansas State University:
http://www.mne.ksu.edu/research/laboratories/non-linear-controls-lab/main-pages/problemtypes/ball-and-beam
3
Hauser, J., Sastry, S., & Kokotovic, P. (1989) “Nonlinear control via approximate input–output linearization:
The ball and beam example”, 28th control and decision conference, Tampa, FL (pp. 1987–1993).
4
Hauser, J., Sastry, S. and Kokotovic, P. (1992) “Nonlinear control via approximate input-output linearization:
The ball and beam example”, IEEE Transactions on Automatic Control, 37(3), 392-398.
5
Li, J., Wang, H.O., Niemann, D. and Bushnell, L. (1998) “Nonlocal control of the ball and beam system:
Regulation and tracking”, IEEE World Congress on Computational Intelligence.
6
Guo, Y., Hill, D. and Jiang Z.-P. (1996) “Global nonlinear control of the ball and beam system” 1996.,
Proceedings of the 35th IEEE Conference on Decision and Control, 3, 2818-2823.

Page 8
Ball and Beam System Dynamics

rolls along its radius (not very practical) R1 = R0 and that the centre of mass of the ball passes
through the axis of rotation of the beam d = − R1 which drastically simplifies the resulting
equations.

There is a small error in their work: they failed to include the dynamic forces that occur on the
ball due to the rotational acceleration of the beam, namely
1 r& 1 r&
J ball ( − ) 2 ≠ J ball (θ& − ) 2 .
2 R1 2 R1
14 4244 3 144244 3
Hauser Correct
In doing so, there are two terms that have been neglected in the nonlinear DE:
⎛ J ⎞ ⎛J ⎞
&r&⎜⎜ m + ball
2 ⎟
()
⎟ − mθ&&⎜⎜ ball ⎟⎟ − mr θ& + mg sin(θ ) = 0
2

14⎝24
⎝ R0 ⎠ R1 ⎠
3
missing term

and
− ball + θ&&(J ball + J beam + mr 2 ) + 2mrr&θ& + mgr cos(θ ) = τ
J &r&
R0
123
missing term

Jonsonn et al: C1 = C2 = 0, R1 = R0 & D = M = 0


Jonsonn9 and others at the University of Lund have derived the dynamics of the ball and beam
system. Their analysis includes the offset from the plane in which the ball rolls and the
rotation axis of the beam. However, they neglect the coupling from the ball position back into
the dynamics of the beam angle, and simply model the angle of the beam as a simple servo
system,
θ ( s) K
= .
V ( s ) s ( sT1 + 1)

Wellstead: C1 = C2 = 0, R1 = R0 = 0, J ball = 0 & M = D = d = 0


Wellstead10 only considers the ball as a point mass and hence neglects all rotational inertial of
the ball. He also includes an unusual translational (rather than rotational) spring-damper
attached the beam.

Rosales: C1 = C2 = 0, D = M = 0,θ& = 0 & d = R1 − R0


Rosales11 assumes that the pivot of the beam lies in the plane of the ball contact, ie
d + R0 − R1 = 0 or d = R1 − R0 . Rosales neglects to include the centrifugal forces. When
calculating the torque balance on the beam, any inertial effects from the ball are neglected as
in damping, so the equation for the beam response is simply a double integrator.
7
Zhang, F. () “Chapter 1 Feedback linearization control of systems with singularities: A ball-beam revisit”,
Mathworks.
8
Lai, M.C., Chien, C.C., Cheng, C.Y., Xu, C.Z. and Zhang, Y. (1994) “Nonlinear tracking control via
approximate backstepping”, Proceedings of the American Control Conference, Baltimore, 1339-1343.
9
Jonsonn, O. (1990) “Modelling and control of the ball and beam process”.
10
Wellstead, P. (2000) “Introduction to physical system modelling”, Control Systems Principles,
http://www.control-systems-principles.co.uk/ebooks/Introduction-to-Physical-System-Modelling.pdf
11
Rosales, E.A. (2004) “A ball-on-beam project kit”, Undergraduate Thesis, Department of Mechanical
Engineering, MIT.

Page 9

View publication stats

You might also like