Ballandbeamdynamics
Ballandbeamdynamics
Ballandbeamdynamics
net/publication/340614801
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.
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
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
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
Page 3
Ball and Beam System Dynamics
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
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
⎡ 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 )
Page 6
Ball and Beam System Dynamics
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
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.
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.
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
Page 9