This actor delays the input by a specified amount of time given by
the <i>delay</i> port or parameter, which defaults to 1.0. It is designed
to be used in timed domains, particularly DE. It can also be used
in other domains, such as SR and SDF, but this will only be useful if the
delay value is a multiple of the period of those directors. The value
of <i>delay</i> is required to be nonnegative. In addition, if the
<i>delay</i> port is connected (and hence the delay will be variable
at run time), then the values provided at the port are required to be
greater than or equal <i>minimumDelay</i>,
which defaults to the initial value of <i>delay</i>.
If the <i>delay</i> is to be changed dynamically during execution, consider
setting <i>minimumDelay</i> to 0.0.
The input and output types are unconstrained, except that the output type
must be the same as that of the input.
<p>
Note that in Ptides the SuperdenseDependency is used for computing
offsets and deadlines. The dependency between the input and the output
of this actor is the <i>minimumDelay</i>. A <i>minimumDelay</i> of
values greater than 0.0 allows for more efficient execution of Ptides models. If
this actor is used as a fixed delay actor, i.e. the delay value is not
changed during the execution, the <i>minimumDelay</i> should be set to
the actual delay, which is the default.
<p>
For directors that implement <a href="../../../ptolemy/actor/SuperdenseTimeDirector.xml">ptolemy.actor.SuperdenseTimeDirector</a>, such as
DE, the output microstep of an event will match the input microstep,
unless the time delay is 0.0, in which case, the output microstep will
be one greater than the input microstep.
A time delay of 0.0 is sometimes useful to break
causality loops in feedback systems. It is sometimes useful to think
of this zero-valued delay as an infinitesimal delay.
<p>
This actor keeps a local FIFO queue to store all received but not produced
inputs. The behavior of this actor on each firing is to
output any previously received token that is scheduled to be produced
at the current time (and microstep).
If there is no previously received token scheduled
to be produced, then the output will be absent.
<p>
Inputs are read only during the postfire() method.
If an input is present, then this actor schedules itself to fire again
to produce the just received token on the corresponding output channel after
the appropriate time delay. Note that if the value of delay is 0.0, the
actor schedules itself to fire at the current model time, resulting in
an output with an incremented microstep.
<p>
This actor can also be used in the Continuous
domain, but it is only useful to delay purely discrete signals.
As a consequence, for directors that implement <a href="../../../ptolemy/actor/SuperdenseTimeDirector.xml">ptolemy.actor.SuperdenseTimeDirector</a>,
this actor insists that input events have microstep 1 or greater.
It will throw an exception if it receives an input with microstep 0,
which in the Continuous domain, implies a continuous signal.
There are two reasons for rejecting continuous inputs.
First, because of the way variable-step-size ODE solvers work, the TimeDelay
actor has the side effect of forcing the solver to use very small step
sizes, which slows down a simulation.
Second, and more important, some odd artifacts will
appear if a variable step-size solver is being used. In particular, the
output will be absent on any firing where there was no input at exactly
time <i>t</i> - <i>d</i>, where <i>t</i> is the time of the firing
and <i>d</i> is the value of the delay parameter. Thus, a continuous
signal input will have gaps on the output, and will fail to be
bR piecewise continuous.
Edward A. Lee
$Id: TimeDelay.java 69607 2014-07-30 17:07:26Z cxh $
Ptolemy II 8.0
Yellow (eal)
Red (eal)
The amount of delay. The default for this parameter is 1.0.
This parameter must contain a DoubleToken
with a non-negative value, or an exception will be thrown when
it is set.
Minimum delay to impose if the <i>delay</i>
port is connected. This is a double that defaults to the value of the delay.