Nonlinear PD Regulation For Ball and Beam System: Wen Yu
Nonlinear PD Regulation For Ball and Beam System: Wen Yu
beam system
Wen Yu
Departamento de Control Automatico, CINVESTAV-IPN, Mexico D.E, Mexico
E-mail: [email protected]
Abstract The ball and beam system is one of the most popular laboratory experiments for control
education. There are two problems for ball and beam control: (1) many laboratories use simple
controllers such as PD control, but theory analysis is based on linear models, and (2) nonlinear
controllers for the ball and beam system have good theory results, but they are seldom used in
laboratories. Little effort has been made to analyse PD control with nonlinear models. In this paper
we modify the normal PD control in two ways for the ball and beam system: parallel and serial PD
regulations; then we analyse the stability of these types of PD regulations with the complete nonlinear
model. Real experiments are applied to test our theory results. This paper gives a good example of how
to apply nonlinear theory in the laboratory for control education.
Keywords ball and beam system; nonlinear compensation; PD control; stability
The ball and beam system is widely used because many important classical and
modem design methods can be studied based on it. The system (shown in Fig. 1) is
very simple - a steel ball rolling on the top of a long beam. One side of the beam
is fixed, the other side is mounted on the output shaft of an electric motor and so
the beam can be tilted by applying an electrical control signal to the motor amplifier.
The position of the ball can be measured using a special sensor. It has a very important property - open loop unstable, because the system output (the ball position)
increases without limit for a fixed input (beam angle). The control job is to automatically regulate the position of the ball by changing the position of the motor.
This is a difficult control task because the ball does not stay in one place on the
beam when a z 0, but moves with an acceleration that is proportional to the tilt of
the beam.
This standard experiment can be approximated by a linear model, and many universities use it for education of classical control theory. Linear feedback control or
PID control can be applied. The stability analysis is based on a linear state-space
model or transfer function.' Resent results show that the stabilisation problem of
the ball and beam can be solved by nonlinear controllers. Approximate input-output
linearisation used state feedback to linearise the ball and beam system first, then a
tacking controller based on the approximates system can stabilise the ball and beam
~ y s t e m But
. ~ this controller is very complex for real applications. In order to solve
the transient performance problem, an energy shaping method uses a nonlinear
static state feedback that is derived from the interconnection and damping assigment.3But it requires shaping of the kinetic and potential energie~.~
A sliding mode
controller can overcome the problem associated with singular states.' But chattering
in sliding mode is a big problem in application. Observer-based nonlinear control
in Ref. 6 uses the same coordinate transformation as in Ref. 2 to design a nonlinear
International Journal of Electrical Engineering Education 4611
observer for thc velocities of the ball and beam system. The controller is more
complex than that in Ref. 2. Some intelligent controllers for ball and beam can also
be found. such as fuzzy control,' sliding mode fuzzy control, neural control,' fuzzy
neural control,' etc. These intelligent controllers are derived from some prior information or input-output data of the ball and beam system. There are two problen~s
for ball and beam control: ( I ) many laboratories use simple controllers such as PD
control, but theory analysis is based on linear models;' and (2) nonlinear controllers
which are based on Lagrangian and kinetic energy-potential energy"' for ball and
beam system have good theory results,'.' but they are con~plexand seldom used in
real applications.
In this paper we modify the normal PD control in two ways for the ball and beam
system: parallel and serial PD regulations. We analyse the stability of the PD control
with the coniplete nonlinear model. To the best of our knowledge. stability analysis
of PD control based on a nonlinear model of the ball and beam system has not yet
been established in the literature. A real experiment is applied to test our theory
results. We hope we can build a bridge between the nonlinear theory and control
education in laboratories."
61
Modelling the d.c. servomotor can be divided into electrical and mechanical
subsystems. The electrical system is based on Kirchhoff's voltage law
where U is input voltage, I, is armature current, R,, and L,, are thc resistance and
inductance of the armature, K,, is back e.m.f. constant, and 8 is angular velocity.
Compared to R J , and ~ , 8 the
, term LJ,, is very small. In order to simplify the
modelling and as in most d.c. motor modelling methods, we neglected the term
L,"I",.
The mechanical subsystem is
where K, is gear ratio, J,, is the effective moment of inertia, H,,is viscous friction
coefficient, and 5, is the torque produced at the motor shaft. The electrical and
mechanical subsystems are coupled to each other through an algebraic torque
equation
where K , is the torque constant of the motor. Assuming that there is no backlash or
electric deformation in the gears, the work done by the load shaft equals the work
1
7 = -7,"
R",J," ..
K,"Ks
In the absence of friction or other disturbances, the dynamics of the ball and beam
system can be obtained by Lagrangian method. Consider the ball and beam system
with a coordinate reference frame about the A point (see Fig. I). and a sphere with
its centre aligned with the axis of the beam as in the figure below. The kinetic energy
of the system is
where TI and T2are kinctic energies of the beam and the ball; these kinetic cncrgics
include radial and circular motions. Since A is not moving bom the coordinate kame,
the rotational kinctic cncrgy of the beam is simply
where J , is the moment of inertia of the beam and & is the angle velocity of the
frame. The ball has kinetic energy
International Journal of Electrical Engineering Education 4611
where J2 is the moment of inertia of the ball, i and y are radial and rotational
velocities of the ball and m is its mass. Because J 2 = - m ~ ' i, = R y , the rotational
5
kinetic energy of the ball is
The potential energy of the system is exhibited by the rolling ball alone
where M is the mass of the frame, L is the longitude of the frame, and r is the
position of the ball. The Lagrange equation is
Since there is no external force on the ball in the radial direction, Lagrange's
equatjons of motion are formed as
Remark I The second equation of (4)can be derived directly from the force relation. In Fig. I
International Journal of Electrical Engineering Education 4611
63
my =- mg+ N c o s a + F s i n a
mi'=-Nsina+ Fcosa
x
2
where N is friction, F is rotational force, FR = Jh, w = - , J = - m ~ Multiplying
~ .
R
5
with sin a and cos a; and summarising the two equations in (5) with F = 0, gives
d
y=-(isina+r&cosa),
dt
y = -r sin a, z = -r cos a; gives
Using
the
conditions
d
i=-(icosa-rbsina),
dt
j;sina+zcosa = -r+rb2
This expression is similar to the second eq~ationof (4). When the system is near to
a stable point, & = 0, the acceleration of the ball is given by
Since a is a small angle, sin a = a: The approximation linear model for the ball
and beam system becomes
b
G ( s )= s2
(6)
where x, = r, x , = r.
Remark 2 The model (4) differs from the most commonly used ball and beam
system as in Re$ 2, where the motor isjxed in the body centre of the beam. In our
case theJixed point A is to one side of the beam. So the gravity of the beam cannot
be neglected. Also, the beam angle a and motor position 8 are not the same; we use
Fig. 2 to calculate them. The arc distances in the two circles are equal, i.e.,
The control problem is to design a controller which computes the applied voltage
U for the motor to move the ball in such a way that the actual position o f the ball
reaches the desired one. The controllers are constructed by introducing nonlinear
compensation terms into the traditional PD controller. Two types o f PD controller
International Journal of Electrical Engineering Education 4611
Fig. 2
will bc designed for this system. Thc first one is scrial PD control which is shown
in Fig. 3 (a). The bcam anglc a (or motor position 8)can be controlled by PD controller C I . This constirutcs the inncr loop. The outer loop controls the ball position
wrth PD controller C2. rc is a compensator which can assure asymptotic stabilily."'
The scrial PD control has the following form
where k,,,, and kt,,,, are positive constants. which correspond to proportional and
derivative coefficients for motor control; kphand k,/,, are proportional and derivative
gains for the ball control.
The second one is parallel PD control which is shown in Fig. 3 (b). Because the
final position of the motor must be 0, such that the ball does not move, so a* = 0.
The feedback control of motor position becomes - 1. The parallel PD control has the
following form
For regulation problems the control aim is to stabilise the ball in a desired position
I-*.so r* = 0. The two PD controllers (8) and (9) can be rewritten in a unique form
+ k,/,,,)kdb.0 1 = k,ln,k~lb,
a4 = k,,,,,,as = k,,",.
a , = 0, o4 = kt,, a5 = k,,,, a, > O
Nonlinear
65
(a; Ser~alcontrol
In this section, PD regulation for the ball and beam system is proposed. From cqn
(2) we haw
The whole ball and beam system is given by (3), (4) and (7):
(mr'
+ k , ) & + 2mridr+
R J
(1 1)
where k , = z - + J , , k 2 = l + -K",
,
+ K,+- R m B n l ) ,k,=--,
K,"K, d
Rm
K,"K,
kt > 0(i = I . . . 4). We define the system state as x = [a. rIT; the regulation error is
where x* is the desired variable, x* = [a*. r * I T . For the ball and bean1 system,
in the balance position a * = 0. i* = 0. So x* = [0, F I T . r* is the desired ball
position.
International Journal of Electrical Engineering Education 4611
It is difficult to apply the dynamic equation of the ball and beam system (11) and
PD control (10) for the Lyapunov method directly. On the other hand, it is well
known that we can prove the stability of robots with PD control by the Lyapunov
method. In this paper we will transfer (11) and (10) into the form of the robot dynamics, then we will prove that the ball and beam system has similar properties as robots.
The closed-loop system is obtained by substituting the control voltage U from the
control law (10) into ball and beam system ( I 1)
where
M (x) =
B=["
k":],
Lemma I
D=[$],
C (x, i ) =
:)
k2a,+ k,
-rk
1.
k2a2+ 2mra
0
I
From the second equation of (12), we can conclude F = --gsina.
k4
becomes
(13)
So (13)
It can be rewritten as
The only possible solution for a is a = 0, otherwise the ball has to move. For any
a # 0, r" cannot be a constant, so (14) has no solution. When a = 0, form (14) we
know F = 0. Because a * = 0, this allows us to conclude [ a , r] = [a*, r*] is the
unique solution for (12).
The stability of the closed loop system is stated in the following theorem.
International Journal of Electrical Engineering Education 4611
67
Theorem I
can guarantee asymptotic stability of the ball and beam system (11).
Proof: Because M(x) and B are positive definite matrices, we choose the following
positive definite quadratic form as Lyapunov function candidate:
I
1
k4
V ( X i, ) = - i T M ( x ) X + - i T B i + - r
2
2
2
.2
(16)
because
a= 0
International Journal of Electrical Engineering Education 4611
the invariant set is obtained from the closed-loop system ( I I ) when 6 = 0, that
is (12). Furthermore, according to Lemma 1. (12) 1s satisfied for [a. r l = 10, r*l
( a * = 0). Therefore, invoking LaSalle's theorem, we can be assured that the equilibrium [ a , r l = [0, r * ] is asymptotically s ~ a b l c .This
' ~ means that
lim ?. = 0.
I+-=
mgr+-Mg
cosa.
The controllers (8) or ( 9 ) with (19) are wry simple and easy to irnplernent. The
corltrol parameters of PI> control are independent of systern parameters, the cotnpensator uses two motor parameters and the masses ofthe ball and beam. Although
the pure PI) controller ( k i t h lr = O) can also stabilise the system as in maty laborutories' experinrental proofs, the control pet$fi,t-tnance under the pure P1> ~ u n t t ~ l
is very utlsntisfactoq (especially for the cotfutation of our type), due to the gruvities
of bull and beam
Remark 3 To the best of our knowledge, the theoretical u t d y s i s of u P l l controller for the bull and beam systent based on a complete nonlitlear model has not yet
been establislied in the literature. Many stability unalyses ure based on cotnplete
nonlinear controller^,^^ and these controllers have to use the nonlineur model o j
the ball a d beam system. 011the other hand, muny labotntories use tnodeljree
controllers' ' (r.g. tlre P1l controller); the tlzeoretical analyses use the simplified
linear model as it1 (6). Because die P D contt-oll~r1s also a lmear system, tmd~tional
cotltrol tlleoty can be uppliedfor stubility analysl~.
International Journal of Electr~calEngmeering Educat~on 4611
69
'
the other existing nicthods. For the simulation we chose -"-- -0.01 176,
K,,,K,y
R1nB + K,,, = 0 8 8 2 1 .I If we do not consider the energy effect, the whole dynamic
K,,,K,c
equation is
When the kinetic energy of the system is considered. the first equation of (20)
becomes ( I I ) . We use the parameters m = 0.06, g = 9.8, M = 0.12, L = 0.6. The
modified PD control is (21) with con~pensationn= 0.2r + 0.1 cons a. The sin~ulation
results are shown in Fig. I . The normal PD control is suitable for a simplified model,
but i t does not work for the complete nonlinear model. The modified PD control
proposed in this paper can work. The response is similar to that in Ref. 2, but the
transient performance is worse than in Ref. 4. We note that the nonlinear controllers
of Refs 2 and 4 need the complete hall and beam system rnodel. The only give
simulation results. Our modified PD control does not require the nonlinear ball and
beam system rnodel. Its application is easier.
The experiment is carried out on the Quanser ball and beam system' (see Fig. 4).
The beam is 60 ern long. The ball is about 60 g. The input to the system is the motor
control voltage I / ; outputs are the positions of motor (8) and ball ( r ) . The power
module is also Quanser, PA-0 103 with f12 V and 3 A output. The AID-DIA board
is based on a Xilinx FPGA microprocessor, which is a multifunction analogue and
digital timing I/O hoard dedicated to real-time data acquisition and control in the
Windows XP environment. The hoard is mounted in a PC Pentiu~n-Ill500MHz host
computer. Because the Xilinx FPGA chip supports real-time opcrations without
introducing latencies caused by the Windows default timing system, the control
programme is operated in Windows XP with Matlab 6.5lSimulink. The san~pling
time is about 10 ms.
The motor and ball controllers are both of the PD type and require direct velocity
measurements, but they are unavailable. We use the derivative block of Si~nulinkto
calculate them. This requires that the position signals are smooth enough; so tirstorder low-pass filters are applied. For motor position we use the following first-order
10
lilter: G,(s)= -. For ball position wc usc the lollowing first-ordcr fillcr:
s+10
G,(s) = l 7 . For the serial PD control (8) we use k,,, = 2, k,/,,,= 0.1. kIr,= 0.5.
s+17
k,,,, = 0.1. For the parallel PD control (9) wc use k,, = 2, k,,,, = 0.5, k,,, = 0.4,
lntetnational Journal of Electrical Engineering Education 4611
L
kdb = 0.1. The parameters for this experiment are - = 16 , m = 0.06, g =
n
d
9.8,
= 0.3 , M = 0.12, L = 0.6. We only use gravity compensationlg.The
Rm+K m
compensator is
(k,+kh)k(lb+(2m-3)r&
f ) I
i.+ mgr+-Mg
cosa
Fig. 5
7t
Time (ma)
Fig 7
Serial
PI)
Conclusion
The main contributions ol'thc paper are: (1) Two types oC PD controllers with nonlinear compensation have been presented Cor regulation of the ball and beam system.
(2) By using Lyapunov's direct method, we have shown that for a well-defined set
of initial conditions, the ball remains on any point of the bar. (3) Experimental results
are presented to illustrate the control system's stability and performance.
The results of this paper can be easily extended to the other mechanical plants.
A greal benefit to engineering educators is that this paper provides an approach to
transferring complex theory problcms found in textbooks into prototypes in the
laboratory.
References
1 Bull uird B e c ~ ~ r r - E q ) r r i t ~ rund
e ~ ~Solurion,
~
Quanser Consulting. 1991.
2 J. Hauser. S. Sastry and F! Kokotovic, 'Nonlinear control via approximate input-output linearization:
ball and beam example'. IEEE Truns. Automuric Control, 370) (1992). 392-398.
3 F. Gortlillo. F. Go~nez-Estern,R. Ortega and J. Aracil. 'On the ball and beam problem: regulation
with guaranteed transient performance and tracking periodic orbits'. in Proc. Inrerturrionul S~wzposiurrl on Murlrrr~r~rricul
Tl~eoryof Nerworks and Sy~rrms,University of Norre Dame, IN. USA,
August, 2002, pp. 2 15-22 1.
5
6
7
8
9
10
II
12
73
R. Onega. M. W. Spong, F. G61nez-Estemand G. Blankcnstein, 'Stabilization of a class of underactuated mechanical systems via interconnection and damping assignment'. I E E E Truns. Aurornuric.
Control, 47(8) (20021, 12 18-1233.
R. M. Hirschorn. 'Incremental sliding mode control of the ball and &am', I E E E Trurls. Automatic
Control, 47( 101 (2002). I 6 9 6 1700.
N. H. Jo and J. H. Seo, 'A state observer for nonlinear systems and its application to ball and beam
system', I E E E Truns. Autonutic Control. 45(5) (2000). 968-973.
L. X. Wang, 'Stable and optimal fuzzy control of linear systems'. I E E E Truns. Fu;r,v .S,v.~rems,6( 1)
(1998), 137-143.
Y. C. Chu and J. Huang, 'A neural-network method for the nonlinear servomechanism problem',
I E E E Truns. Neurul Nehvorks. lO(6) ( 1999). 14 12-1423.
P. H. Eaton. D. V. Prokhorov and D. C. Wunsch 11, 'Neurocontroller alternatives for "fuzzy"
ball-and-bcam systems with nonuniform nonlinear friction', I E E E Trnns. Neurul Networks, 1112)
(2000). 423-435.
K. M. Murnry. Z.Li and S. S. Sastry, A Muthernuticul Introducriotr to Robotic Marril)ultrtion (CKC
Press, Boca Raton, 1994).
S. Bhat, M. Glavic, M . Pavella, T. S. Bhatti and D. P. Kothari, 'A transient stability tool combining
the SlME method with MATLAR and SIMULINK', Inr. J. E l e c ~ .Enxirig Educ., 43(2) (2006).
119-133.
H. K. Khalil, Nonlineur S)i~rems.3rd edn (Prentice Hall, Englewood Cliffs. NJ. 2002).