Generate PID output for a given input. The output is the sum of a proportional
gain (P), discrete integration (I), and discrete derivative (D).
<p>
The proportional component of the output is immediately available, such that
yp[n]=Kp*x[n], where <i>yp</i> is the proportional component of the output,
<i>Kp</i> is the proportional gain, and <i>x</i> is the input value.
<p>
For integral gain, the output is available after two input symbols have been
received, such that yi[n]=Ki*(yi[n-1]+(x[n] + x[n-1])*dt[n]/2), where <i>yi</i>
is the integral component of the output, <i>Ki</i> is the integral gain, and
<i>dt[n]</i> is the time differential between input events x[n] and x[n-1].
<p>
For derivative gain, the output is available after two input symbols have been
received, such that yd[n] = Kd*(x[n]-x[n-1])/dt, where <i>yd</i> is the
derivative component of the output, <i>Kd</i> is the derivative gain, and
<i>dt</i> is the time differential between input events events x[n] and x[n-1].
<p>
The output of this actor is constrained to be a double, and input must be castable
to a double. If the input signal is not left-continuous and the derivative constant
is nonzero, then this actor will throw an exception as the derivative will be either infinite
or undefined. If the derivative constant is zero, then this actor may receive
discontinuous input.
<p>
y[0]=Kp*x[0]
<br>y[n] = yp[n] + yi[n] + yd[n]
<br>y[n] = Kp*x[n] + Ki*sum{x=1}{n}{(x[n]+x[n-1])/2*dt[n]} + Kd*(x[n]-x[n-1]/dt[n])
<p>
In postfire(), if an event is present on the <i>reset</i> port, this
actor resets to its initial state, where integral and derivative components
of output will not be present until two subsequent inputs have been consumed.
This is useful if the input signal is switched on and off, in which case the
time gap between events becomes large and would otherwise effect the value of
the derivative (for one sample) and the integral.
<p>
Jeff C. Jensen
$Id: PID.java 70398 2014-10-22 23:44:32Z cxh $
Ptolemy II 8.0
The reset port, which has undeclared type. If this port
receives a token, this actor resets to its initial state,
and no output is generated until two inputs have been received.
Proportional gain of the controller. Default value is 1.0.
Integral gain of the controller. Default value is 0.0,
which disables integral control.
Derivative gain of the controller. Default value is 0.0, which disables
derivative control. If Kd=0.0, this actor can receive discontinuous
signals as input; otherwise, if Kd is nonzero and a discontinuous signal
is received, an exception will be thrown.