ptolemy.domains.de.lib
Class TimedDelay
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.domains.de.kernel.DEActor
ptolemy.domains.de.lib.DETransformer
ptolemy.domains.de.lib.TimedDelay
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, SequenceActor, java.io.Serializable, TimedActor, TypedActor
- public class TimedDelay
- extends DETransformer
This actor delays the input by a specified amount of time.
The time delay is required to be non-negative and has default value 1.0.
The input and output types are unconstrained, except that the
output type must be at least that of the input.
The behavior on each firing is to read a token from the input,
if there is one, and to produce the token on the corresponding output
channel with the appropriate time delay. The output is produced
in the postfire() method, consistent with the notion that persistent
state is only updated in postfire(). Notice that it produces
the output immediately, in the same iteration that it reads the
input, so that even if the actor no longer exists
after the time delay elapses, the destination actor will still see
the token. If there is no input token, then no output token is
produced.
Occasionally, it is useful to set the time
delay to zero. This causes the input tokens to be produced on
the output immediately. However, since the actor declares that
there is a delay between the input and the output, the DE director
will assume there is a delay when determining the precedences of the
actors. Moreover, the event is queued to be processed in the next
microstep, after all events at the current time with the current
microstep. Thus, it is sometimes useful to think of this zero-valued
delay as an infinitesimal delay.
- Since:
- Ptolemy II 1.0
- Version:
- $Id: TimedDelay.java,v 1.20.2.2 2004/06/20 03:10:44 cxh Exp $
- Author:
- Edward A. Lee, Lukito Muliadi, Haiyang Zheng
- See Also:
FunctionDependencyOfAtomicActor,
VariableDelay,
Server,
SampleDelay,
Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Constructor Summary |
TimedDelay(CompositeEntity container,
java.lang.String name)
Construct an actor with the specified container and name. |
|
Method Summary |
void |
attributeChanged(Attribute attribute)
If the attribute is delay, then check that the value
is non-negative. |
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
fire()
Read one token from the input and save it so that the
postfire method can produce it to the output. |
boolean |
postfire()
Produce token that was read in the fire() method, if there
was one.
|
void |
pruneDependencies()
Override the base class to declare that the output
does not depend on the input in a firing. |
| Methods inherited from class ptolemy.domains.de.kernel.DEActor |
newPort |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, initialize, inputPortList, iterate, newReceiver, outputPortList, prefire, preinitialize, removeDependency, setContainer, stop, stopFire, terminate, wrapup |
| Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
delay
public Parameter delay
- The amount of delay. This parameter must contain a DoubleToken
with a non-negative value, or an exception will be thrown when
it is set.
TimedDelay
public TimedDelay(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the specified container and name.
- Parameters:
container - The composite actor 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.
attributeChanged
public void attributeChanged(Attribute attribute)
throws IllegalActionException
- If the attribute is delay, then check that the value
is non-negative.
- Overrides:
attributeChanged in class NamedObj
- Parameters:
attribute - The attribute that changed.
- Throws:
IllegalActionException - If the delay is negative.
clone
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
- Clone the actor into the specified workspace. This calls the
base class and then sets the delayTo relation between the input
and the output of the new actor.
- Overrides:
clone in class AtomicActor
- Parameters:
workspace - The workspace for the new object.
- Returns:
- A new actor.
- Throws:
java.lang.CloneNotSupportedException - If a derived class has
has an attribute that cannot be cloned.
fire
public void fire()
throws IllegalActionException
- Read one token from the input and save it so that the
postfire method can produce it to the output.
- Specified by:
fire in interface Executable- Overrides:
fire in class AtomicActor
- Throws:
IllegalActionException - If there is no director.
postfire
public boolean postfire()
throws IllegalActionException
- Produce token that was read in the fire() method, if there
was one.
The output is produced with a time offset equal to the value
of the delay parameter.
- Specified by:
postfire in interface Executable- Overrides:
postfire in class AtomicActor
- Returns:
- True if execution can continue into the next iteration.
- Throws:
IllegalActionException - If there is no director.
pruneDependencies
public void pruneDependencies()
- Override the base class to declare that the output
does not depend on the input in a firing.
- Overrides:
pruneDependencies in class AtomicActor
- See Also:
TimedDelay,
AtomicActor.removeDependency(IOPort, IOPort),
FunctionDependencyOfAtomicActor