[From Bill Powers (970605.2209 MDT)]
Rupert Young 970605.1900 BST --
(Bill Powers (970528.0720 MDT))
>> y := y + f(x)*dt
Yes, x would be the error signal if y is the output. Suppose f(x) >>is
0.5*x, and dt is 0.01 seconds. Then the value of f(x) for x = 90 >>is 0.45,
and the new value of y is 50 + 0.45 or 50.45. In the next >>hundredth of a
second, y will change from 50 to 50.45, so it's >>changing at the rate of
45 units per second (0.45/0.01).
So the output is the 0.45 ? Or is it the 50.45 ? Is the 0.45 the >_change_
in output ?
The output is the 50.45, and the 0.45 is the amount by which the output
changes in the interval dt (0.01 sec).The output function, which lies
between the error signal and the output, continually carries on the process
of time integration, always producing an output equal to the result.
Is a proportional controller then, y := y + f(x) ? ie. some >proportion of
the error signal, irrespective of time. Could a >proportional controller
be called an integrator (but not a time->integrator)?
No, a proportional controller would be one in which the output is
proportional to the error signal: y = k*x, where k is the proportionality
factor. In other words, y := f(x) (not y := y + f(x)), where f(x) is simply
k*x. In a proportional controller, a change in the input (error signal) is
reflected immediately as a proportional change in the output.
Maybe it would help if we used a more appropriate notation -- the "x" in
the equations above really means time, so we ought to be saying y := y +
f(t)*dt. The error signal is f(t), a function of time. This function gives
us the value of the error signal at any time t. Since the output is
accumulating the values of the error signal, the output will change during
the time interval between t and t + dt. If we assume that the error signal
doesn't change appreciably during that short interval, we can say that the
output is changing at a rate f(t) for a time dt, so multiplying the rate
times the time gives us the total change during that time. In other words,
f(t)*dt is simply the amount by which the output changes during the
interval dt. So if we add f(t)*dt to the old value of y, we will get the
new value of y.
At the end of that interval, the error signal will be different: it will
have changed by some amount, so now we have a new f(t) where t has advanced
by one interval dt. This is the new value of the error signal, which we
again assume to be constant during the interval. We multiply this new value
by dt, add the result to y, and get the new value of y, and so on.
Obviously this is not quite right, because the error signal is (in the
general case) changing during the interval dt; it's not really constant.
That's why we use as small a value of dt as possible; the smaller it is,
the less error is introduced by assuming that f(t) is constant during the
interval dt. There are more complex integration methods that can eliminate
some of this error even for rather large values of dt, but this simple
method works quite well, especially if we can make dt very small (if we can
live with the slowness brought on by having to do many computations to
cover each second of elapsed time).
An example of a physical process that involves time integration would be a
pump that runs at variable speeds to fill a tank with water. The input
variable (corresponding to the error signal) would be the rate at which
water is pumped in. The output variable would be the height of the water in
the (cylindrical) tank. Suppose we say that the speed of the pump (the
intake flow rate) is a function of time, f(t). We measure the height of the
water in the tank at intervals dt, say every tenth of a second (dt = 0.1).
We also measure the rate of inflow, f(t), every tenth of a second. We can
then see that the height of the water, y, will increase by an amount f(t),
the flow rate, times the interval before we measure it again, dt. We need a
proportionality factor k to account for the diameter of the tank (a
large-diameter tank will fill more slowly than a small-diameter tank, at
the same rate of inflow). So we would say that
y = y + k*f(t)*dt
Now suppose that the inflow rate is constant (f(t) = c). This will lead to
y increasing by the same amount, k*c*dt, in every interval. The tank will
keep getting fuller and fuller at a constant rate, as long as the inflow
remains constant. If we stop the inflow (c = 0), the height of the water
will just remain constant. If we _reverse_ the inflow, making the inflow
rate -c instead of c, the tank will empty -- the height of the water will
fall -- at the same constant rate.
What would happen if we made the inflow increase linearly from zero with
time? This is like saying the inflow rate is c*t -- at t = 0 the inflow
rate is zero, and it increases at the rate of c gallons per minute every
second. How will the height of the water vary with time?
The function f(t) is now c*t, so this gives us the program step
y := y + k*(c*t)*dt.
The calculus shows that we will have
y = (1/2)*k*c(t^2).
In other words, the height of the water will increase as a parabolic
function of time. Notice that the form of the output variation is NOT the
same as the form of the input variation. The input rises linearly with
time; the output rises as the square of the time.
What if we make the inflow vary as a sine function of time, going equally
positive and negative? The height of the water will then vary as a cosine
function of time. And so on, through all the forms of integrals you learn
in the calculus. For every way in which the input (the error signal) varies
with time, there is a corresponding way in which the output varies with
time, and if we can represent the variations in the input by some simple
analytical function, we can predict, by integrating that function with
respect to time, how the output will be varying.
When we're analyzing a real system, we may not be able to find the integral
of the actual time function according to which the input varies -- there
may be no analytical form that's close enough, or we may not know in
advance how the input is going to vary (some other unknown process is
varying the speed of the water pump). But using simulations, we can still
compute the value of the integral numerically, step by step, by computing
y := y + k*f(t)*dt.
That's what we're doing in our simulations. We say the output function is
an integrator, which means that the output y is related to the error signal
input f(t) by the above incremental relationship. By making dt small
enough, we can compute the value of y, very nearly, that would result from
ANY error waveform f(t). Of course the error signal depends on the
perceptual signal and reference signal, and the perceptual signal depends
on the output and the disturbance, all of which are time-varying functions.
What our simulation does is tell us HOW those variable will change with
time, given only the variations in the disturbance and (if any) the
I hope this isn't overkill --