Derivative Control of the Ball and Beam

advertisement
Lab 4 - The Ball and Beam
L
x
d
The figure above shows the ball and beam apparatus - a simple example of an inherently unstable
system. The ball, usually a steel ball bearing, is free to roll up and down a track of length L. A
servomotor, shown in green, is attached to a short link of length d, which can push the track up and
down. Define the distance from pivot to the ball as x, the angle of the track as γ and the angle of
the servomotor as θ. Note that we have chosen an unusual definition for the coordinate x: the
distance from the moving end of the beam to the ball. We do this in order to make the sign for the
transfer function come out positive. A positive angle for the beam (or servo arm) will cause the ball
to roll to the left, which increases the x-coordinate. Thus, a positive input (servo arm angle) results in
a positive output (ball rolls to the left).
Our goal is to devise a control system that will place and hold the ball at a desired coordinate, xs.
Ideally, the ball should reach the setpoint quickly, and with minimal overshoot. As we will see
below, the ball and beam system is marginally stable. That is, the ball will remain in a given position
indefinitely if the beam is held perfectly horizontal. Any disturbance of the beam or the ball will cause
the ball to roll. Of course we cannot guarantee that no disturbances will occur, so the system is
useless without its controller.
Modeling the System
r
fc
To begin, draw a free-body diagram of the ball, as shown above.
There are three forces acting on the ball: the frictional force, f, the f
g
gravitational force, fg, and the centrifugal force fc. The centrifugal
f
force occurs because the ball in on a rotating beam whose center of
rotation is not coincident with the center of the ball. We ignore the forces perpendicular to the
beam (normal force and Coriolis force) since they do not affect the ball’s motion.
The gravitational force is given by
1
𝑓𝑔 = π‘šπ‘” sin 𝛾
and the centrifugal force is
𝑓𝑐 = π‘š(𝐿 − π‘₯)𝛾̇ 2
where 𝛾̇ is the angular velocity of the beam and (L - x) is the distance from the center of rotation
(the pivot). Summing torques on the ball gives
∑ 𝑇 = π½π›½Μˆ = π‘“π‘Ÿ
Note that the rotation angle of the ball, β, is related to the x coordinate as
𝛽=
π‘₯
π‘Ÿ
so that
𝑓=
𝐽
π‘₯̈
π‘Ÿ2
Now sum forces on the ball
∑ 𝐹 = π‘šπ‘₯̈ = −𝑓 − π‘šπ‘₯𝛾̇ 2 + π‘šπ‘” sin 𝛾
π‘šπ‘₯̈ = −
(π‘š +
𝐽
π‘₯̈ − π‘š(𝐿 − π‘₯)𝛾̇ 2 + π‘šπ‘” sin 𝛾
π‘Ÿ2
𝐽
) π‘₯̈ + π‘š(𝐿 − π‘₯)𝛾̇ 2 = π‘šπ‘” sin 𝛾
π‘Ÿ2
Note that the moment of inertia of a sphere is
𝐽=
2
π‘šπ‘Ÿ 2
5
so that the mass term cancels out entirely
7
π‘₯̈ + (𝐿 − π‘₯)𝛾̇ 2 = 𝑔 sin 𝛾
5
This equation is nonlinear and we cannot calculate a transfer function, which will make designing
the control system very difficult. To make the problem tractable, let us linearize the equation about
the angle γ = 0 (when the beam is horizontal). For small angles γ, we have
2
sin 𝛾 ≈ 𝛾
Also, let us assume that the angular velocity of the beam is relatively small, so that
𝛾̇ 2 ≈ 0
The linearized equation of motion is then
7
π‘₯̈ = 𝑔𝛾
5
The input to the system is the angle of the servomotor, given as θ. The servomotor angle and beam
angle are approximately related to each other as
π‘‘πœƒ ≈ 𝐿𝛾
so that the final equation of motion is
7
π‘”π‘‘πœƒ
π‘₯̈ =
5
𝐿
It is simplest to collect all of the constants into one term
𝐴=
5𝑔𝑑
7𝐿
so that
π‘₯̈ = π΄πœƒ
take the Laplace transform
𝑋𝑠 2 = 𝐴Θ
The transfer function for the ball and beam is
𝑋 𝐴
=
Θ π‘ 2
What happens if we apply a step input to the system? Use the final value theorem to find the
steady-state response.
lim π‘₯(𝑑) = lim 𝑠 𝑋(𝑠) =
𝑑→∞
𝑠→0
𝐴𝑠 1
𝐴
( )= 2→∞
2
𝑠 𝑠
𝑠
3
Thus, if we suddenly change the angle of the beam, the ball will roll off to infinity. This is another
way of saying that the system is unstable. To further illustrate this, consider what happens if we
apply a unit impulse to the beam (by tapping one end with a hammer, for instance).
lim π‘₯(𝑑) = lim 𝑠 𝑋(𝑠) =
𝑑→∞
𝑠→0
𝐴𝑠
𝐴
(1)
=
→∞
𝑠2
𝑠
The ball still rolls off to infinity! As we can see, the ball and beam desperately needs a control
system to keep it stable.
Potentiometer
(setpoint)
+_
Controller
System
𝐾𝑝
𝐴
𝑠2
E
X
Position of Ball
(Output)
Position Sensor
Proportional Control of the Ball and Beam
The figure above shows a control diagram for the ball and beam, with proportional control added.
The error coming out of the summation block is
𝐸 = 𝑋𝑠 − 𝑋
and the command sent to the servo is
Θ = 𝐾𝑝 (𝑋𝑠 − 𝑋)
Multiplying this by the transfer function of the ball and beam system gives
𝑋=
𝐴
𝐾 (𝑋 − 𝑋)
𝑠2 𝑝 𝑠
Solving for the transfer function, we have
𝐴𝐾𝑝
𝑋
= 2
𝑋𝑠 𝑠 + 𝐴𝐾𝑝
Using the final value theorem, the steady state value for a unit step input is
4
lim π‘₯(𝑑) = lim 𝑠 𝑋(𝑠) = 𝑠 ⋅
𝑑→∞
𝑠→0
𝑠2
𝐴𝐾𝑝
1
( )=1
+ 𝐴𝐾𝑝 𝑠
Thus, the system is stable, finally! Before we rest on our laurels, however we might want to see what
happens when we give the system a unit step input, by taking the inverse Laplace transform
𝑋=
𝐴𝐾𝑝
1
⋅
𝑠 2 + 𝐴𝐾𝑝 𝑠
Row 25 in the Laplace transform table gives
π‘₯(𝑑) = 1 − cos πœ”π‘‘
where
πœ” = √𝐴𝐾𝑝
Position of Ball vs. Time
2
1.8
1.6
Position of Ball (m)
1.4
1.2
1
0.8
0.6
0.4
0.2
0
0
1
2
3
4
5
Time (s)
6
7
8
9
10
The figure above shows the position of the ball versus time when the ball and beam is given a step
input. The ball does indeed oscillate about the new setpoint (1), but never settles down. We have
reached our initial goal of stability - the ball doesn’t roll off to infinity - but our system is still not
quite satisfactory.
5
Potentiometer
(setpoint)
+_
E
Controller
System
𝐾𝑖
𝑠
𝐴
𝑠2
X
Position of Ball
(Output)
Position Sensor
Integral Control of the Ball and Beam
Now consider the control diagram shown above. The error is the same as before, but the control
action is now
Θ=
𝐾𝑖
(𝑋 − 𝑋)
𝑠 𝑠
The new transfer function is
𝑋
𝐴𝐾𝑖
= 3
𝑋𝑠 (𝑠 + 𝐴𝐾𝑖 )
If we apply a unit step function, then
𝑋=
1
𝐴𝐾𝑖
𝑠 (𝑠 3 + 𝐴𝐾𝑖 )
There is no readily-available Laplace transform pair for this expression, so we’ll use Matlab to plot
the step response for the system. First, choose an arbitrary value for the product AKi. This is
reasonable, since we can choose any value for Ki that we wish while tuning the controller. Then
enter the Matlab commands
num=10
den=[1 0 0 10]
ball=tf(num,den)
Matlab will respond
ball =
10
-------s^3 + 10
Continuous-time transfer function.
Then, type
6
step(ball)
Step Response
10
8
After some judicious adjustment of the axes, the plot
shown at right is given. As you can see, the response
shoots off to infinity rather quickly, which means that
our system is once again unstable!
6
Amplitude
4
2
0
-2
The real problem with the transfer function for the
integral control system is that there is no first-order
term in the denominator. As we have seen earlier,
the first-order term is associated with damping; thus,
the integral-controlled ball and beam has no
damping. Without damping, the system is unstable and quickly shoots the ball off to infinity. We
have one more control scheme to try, before giving up.
-4
-6
-8
-10
0
1
0.5
1.5
2
2.5
3
Time (seconds)
Controller
Potentiometer
(setpoint)
+_
E
System
𝐴
𝑠2
𝐾𝑑 𝑠
X
Position of Ball
(Output)
Position Sensor
Derivative Control of the Ball and Beam
The ball and beam system with a derivative controller is shown above. The new transfer function is
𝑋
𝐴𝐾𝑑
=
𝑋𝑠 𝑠 + 𝐴𝐾𝑑
If we subject this system to a step input, we have
𝑋=
𝐴𝐾𝑑
1
⋅
𝑠 + 𝐴𝐾𝑑 𝑠
This corresponds to Row 14 in the table, or
π‘₯(𝑑) =
1
(1 − 𝑒 −𝐴𝐾𝑑 𝑑 )
𝐴𝐾𝑑
(1)
In other words, the derivative-controlled ball and beam is a first order system with time constant
𝜏=
1
𝐴𝐾𝑑
7
Again, at first glance this appears to be an effective control system. There is one major defect which
prevents us from adopting derivative control alone. Imagine a situation where the setpoint is 0.25m,
but the ball starts at 0.26m. This produces an initial error of -0.1m, which is constant. Because the
error does not change, its derivative is zero and the controller will order no change in beam angle.
Thus, the derivative controller cannot accommodate a constant, steady-state error.
This result seems to contradict the equation (1) above, which predicts the ball settling out to its
setpoint with time constant 1/AKd. In fact, equation (1) is the result of changing the setpoint of the
system, while the second situation is the result of a non-zero initial condition. This is a major defect in
the transfer system method of designing control systems: by definition, the initial conditions are zero
when using the transfer function method. This is normally not a problem - any system with
damping will have its initial conditions fade away after new disturbances are added to the system. In
the case of the ball and beam, however, there is no restorative “spring” force to bring the ball back
to its neutral position if the initial conditions are nonzero.
Potentiometer
(setpoint)
+_
E
Controller
System
𝐾𝑑 𝑠 + 𝐾𝑝
𝐴
𝑠2
X
Position of Ball
(Output)
Position Sensor
PD Control of the Ball and Beam
As a last resort, let us try combining proportional and derivative control to the ball and beam
system, as shown in the figure above. The transfer function for the PD-controlled ball and beam
system is
𝐴(𝐾𝑑 𝑠 + 𝐾𝑝 )
𝑋
= 2
𝑋𝑠 𝑠 + 𝐾𝑑 𝐴𝑠 + 𝐾𝑝 𝐴
The denominator has a first-order term for damping and a zero-order term corresponding to
stiffness (or restoring force). Thus, we have returned to a familiar second-order system, and we can
use the same methods of finding controller gains as we did with the incubator system. Once we
have found the desired damping ratio and natural frequency (by specifying settling time and
maximum percent overshoot, e.g.) we can find proportional and derivative gain by
𝐾𝑝 =
πœ”π‘›2
𝐴
𝐾𝑑 =
2πœπœ”π‘›
𝐴
Modeling with Initial Conditions
As mentioned earlier, the transfer function model is incapable of simulating nonzero initial
conditions. This is unacceptable for the ball and beam, since the usual situation is to place the ball
away from the setpoint let the controller work its magic. This corresponds to a nonzero initial
8
displacement of the ball, but we might also wish to simulate a nonzero initial velocity of the ball by
tapping it to one side at time t=0. To create a more accurate model of the ball and beam system,
then, we must abandon the transfer function method for the more traditional “equation of motion”
method in Simulink.
The figure above shows the modified Simulink diagram with PD control. Note that we are also
sending thetadot back to the workspace. The servo manufacturer specifies the maximum angular
velocity of the servo - this must be compared with the maximum value of thetadot to check the
feasibility of the controller.
The integrator block has the option of taking its initial condition from an external port. This has been
used in the diagram above to make obvious the nonzero initial condition of the ball. We could also
employ a nonzero initial condition on xdot, the velocity of the ball.
9
Download