Class ContinuousTimeDelay

  • All Implemented Interfaces:
    java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class ContinuousTimeDelay
    extends Transformer
    Delay the input by a specified amount of time.

    This actor is designed to be used in timed domains such as DE and Continuous. 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 amount of the delay is required to be non-negative and has a default value 1.0. The input and output types are unconstrained, except that the output type must be the same as that of the input.

    This actor keeps a local FIFO queue of all input events that may be requested by the director; an event expires and is removed from this queue if its timestamp is older than the current time less the delay. The behavior of this actor on each firing is to read a token from the input port (if present) and generates an output that is either equal to or an approximation of the delayed input signal. Output is absent if and only if no initial value is given and the actor is fired before input is received, or before the transient delay period has passed (i.e. model time is less than delay time).

    Output is generated by the fire() method, and inputs are processed in postFire().

    Occasionally, this actor is useful with the delay parameter set to 0.0. The time stamp of the output will equal that of the input, but there is a "microstep" delay. The continuous domain in Ptolemy II has a "super dense" model of time, meaning that a signal from one actor to another can contain multiple events with the same time stamp. These events are "simultaneous," but nonetheless have a well-defined sequential ordering determined by the order in which they are produced. If \textit{delay} is 0.0, then the actor does not generate output in the current time microstep, but rather on a refiring at the the same physical time but incremented timestep.

    A consequence of this strategy is that this actor is able to produce an output (or assert that there is no output) before the input with the same time is known. Hence, it can be used to break causality loops in feedback systems. The Continuous director will leverage this when determining the fixed point behavior. It is sometimes useful to think of this zero-valued delay as an infinitesimal delay.

    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Edward A. Lee, Jeff C. Jensen
    Pt.AcceptedRating:
    Red (eal)
    Pt.ProposedRating:
    Yellow (eal)
    • Field Detail

      • delay

        public Parameter delay
        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.
      • initialOutput

        public Parameter initialOutput
        Initial output of the delay actor. The default for this parameter is null, indicating no output will be generated until after input has been received.
      • _currentOutput

        protected Token _currentOutput
        Current output.
      • _delay

        protected double _delay
        The amount of delay.
      • _inputBuffer

        protected CalendarQueue _inputBuffer
        A local event queue to store input tokens, sorted by input time.
      • _discarded

        protected TimedEvent _discarded
        Holds the most recently discarded event from the input buffer.
      • _nextFireAt

        protected Time _nextFireAt
        Records the next scheduled fireAt() call, so that we do not request more than one fireAt() call for a given input event.
    • Constructor Detail

      • ContinuousTimeDelay

        public ContinuousTimeDelay​(CompositeEntity container,
                                   java.lang.String name)
                            throws NameDuplicationException,
                                   IllegalActionException
        Construct an actor with the specified container and name. Constrain that the output type to be the same as the input type.
        Parameters:
        container - The composite entity to contain this one.
        name - The name of this actor.
        Throws:
        IllegalActionException - If the entity cannot be contained by the proposed container.
        NameDuplicationException - If the container already has an actor with this name.