@Deprecated public class TimedDelay extends DETransformer
This actor keeps a local FIFO queue to store all received but not processed inputs. The behavior of this actor on each firing is to read a token from the input, if there is one, store it into the local queue, and output the previously received token that is scheduled to be produced at the current time.
During the postfire() method, 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.
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 discrete-event 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 fire() method of this actor always produces on its output port the event consumed in the \textit{previous iteration} with the same time stamp, if there was one. If there wasn't such a previous iteration, then it produces no output. Its postfire() method consumes and records the input for use in the next iteration, if there is such an input, and also requests a refiring at the current time. This refire request triggers the next iteration (at the same time stamp), on which the output is produced.
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 DE director will leverage this when determining the precedences of the actors. It is sometimes useful to think of this zero-valued delay as an infinitesimal delay.
VariableDelay
,
Server
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
protected Token |
_currentInput
Deprecated.
Current input.
|
protected Token |
_currentOutput
Deprecated.
Current output.
|
protected double |
_delay
Deprecated.
The amount of delay.
|
protected CalendarQueue |
_delayedOutputTokens
Deprecated.
A local event queue to store the delayed output tokens.
|
Parameter |
delay
Deprecated.
The amount of delay.
|
input, output
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
TimedDelay(CompositeEntity container,
java.lang.String name)
Deprecated.
Construct an actor with the specified container and name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_fireAt(Time time)
Deprecated.
Request a firing of this actor at the specified time
and throw an exception if the director does not agree to
do it at the requested time.
|
protected void |
_init()
Deprecated.
Initialize the delay parameter.
|
void |
attributeChanged(Attribute attribute)
Deprecated.
If the attribute is delay, then ensure that the value
is non-negative.
|
java.lang.Object |
clone(Workspace workspace)
Deprecated.
Clone the actor into the specified workspace.
|
void |
declareDelayDependency()
Deprecated.
Declare that the output
does not depend on the input in a firing.
|
void |
fire()
Deprecated.
Read one token from the input.
|
void |
initialize()
Deprecated.
Initialize the states of this actor.
|
boolean |
postfire()
Deprecated.
Process the current input if it has not been processed.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, prefire, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public Parameter delay
protected Token _currentInput
protected Token _currentOutput
protected double _delay
protected CalendarQueue _delayedOutputTokens
public TimedDelay(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The composite entity to contain this one.name
- The name of this actor.IllegalActionException
- If the entity cannot be contained
by the proposed container.NameDuplicationException
- If the container already has an
actor with this name.public void attributeChanged(Attribute attribute) throws IllegalActionException
NOTE: the newDelay may be 0.0, which may change the causality property of the model. We leave the model designers to decide whether the zero delay is really what they want.
attributeChanged
in class NamedObj
attribute
- The attribute that changed.IllegalActionException
- If the delay is negative.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class TypedAtomicActor
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class has
has an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void declareDelayDependency() throws IllegalActionException
declareDelayDependency
in class AtomicActor<TypedIOPort>
IllegalActionException
- If the causality interface
cannot be computed.AtomicActor.getCausalityInterface()
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If there is no director, or the
input can not be read, or the output can not be sent.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- If a derived class throws it.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class AtomicActor<TypedIOPort>
IllegalActionException
- If scheduling to refire cannot
be performed or the superclass throws it.protected void _init() throws IllegalActionException, NameDuplicationException
IllegalActionException
- If delay parameter cannot be set.NameDuplicationException
- If there already is a parameter
named "delay".protected void _fireAt(Time time) throws IllegalActionException
If the executive director is a Ptides director, use fireAt(Actor, Time, IOPort) method because the pure event this actor generates is always safe to process.
_fireAt
in class TypedAtomicActor
time
- The requested time.IllegalActionException
- If the director does not
agree to fire the actor at the specified time, or if there
is no director.