|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Transformer
ptolemy.domains.continuous.lib.ContinuousTimeDelay
public class ContinuousTimeDelay
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.
Red (eal) |
Yellow (eal) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.Entity |
---|
Entity.ContainedObjectsIterator |
Field Summary | |
---|---|
protected CausalityMarker |
_causalityMarker
A causality marker to store information about how pure events are causally related to trigger events. |
protected Token |
_currentOutput
Current output. |
protected double |
_delay
The amount of delay. |
protected TimedEvent |
_discarded
Holds the most recently discarded event from the input buffer. |
protected CalendarQueue |
_inputBuffer
A local event queue to store input tokens, sorted by input time. |
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. |
Parameter |
delay
The amount of delay. |
Parameter |
initialOutput
Initial output of the delay actor. |
Fields inherited from class ptolemy.actor.lib.Transformer |
---|
input, output |
Fields inherited from class ptolemy.actor.AtomicActor |
---|
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested |
Fields inherited from class ptolemy.kernel.util.NamedObj |
---|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
Fields inherited from interface ptolemy.actor.Executable |
---|
COMPLETED, NOT_READY, STOP_ITERATING |
Constructor Summary | |
---|---|
ContinuousTimeDelay(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 ensure that the value is non-negative. |
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
fire()
Do nothing. |
void |
initialize()
Initialize the states of this actor. |
boolean |
isStrict()
Override the base class to declare that the actor is nonstrict if it has an initial value token. |
protected Token |
linearInterpolate(TimedEvent leftEvent,
TimedEvent rightEvent)
Linear interpolate between previous and current input. |
boolean |
postfire()
Schedule the next output event. |
void |
preinitialize()
Override the base class to declare that the output does not depend on the input in a firing. |
Methods inherited from class ptolemy.actor.TypedAtomicActor |
---|
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints |
Methods inherited from class ptolemy.kernel.ComponentEntity |
---|
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName |
Methods inherited from class ptolemy.kernel.Entity |
---|
_description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName |
Methods inherited from class ptolemy.kernel.InstantiableNamedObj |
---|
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.actor.Actor |
---|
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList |
Methods inherited from interface ptolemy.actor.Executable |
---|
isFireFunctional, iterate, prefire, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, removeInitializable, wrapup |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getDisplayName, getFullName, getName, getName, setName |
Methods inherited from interface ptolemy.kernel.util.Derivable |
---|
getDerivedLevel, getDerivedList, propagateValue |
Field Detail |
---|
public Parameter delay
public Parameter initialOutput
protected Token _currentOutput
protected double _delay
protected CalendarQueue _inputBuffer
protected TimedEvent _discarded
protected Time _nextFireAt
protected CausalityMarker _causalityMarker
Constructor Detail |
---|
public ContinuousTimeDelay(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.Method Detail |
---|
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 AtomicActor
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 initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor
IllegalActionException
- If a derived class throws it.public void fire() throws IllegalActionException
AtomicActor
fire
in interface Executable
fire
in class AtomicActor
IllegalActionException
- Not thrown in this base class.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class AtomicActor
IllegalActionException
public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class AtomicActor
IllegalActionException
- If the superclass throws it.public boolean isStrict()
isStrict
in interface Executable
isStrict
in class AtomicActor
IllegalActionException
- If the superclass throws it.protected Token linearInterpolate(TimedEvent leftEvent, TimedEvent rightEvent) throws IllegalActionException
To interpolate, we determine the slope between the left and right interpolation points, and multiply this by time gap between the left point and the current time. This estimates the amount by which the input signal has changed between the left and center points. We add this change to the value of the left point to estimate the value of the center point.
leftEvent
- The left event.rightEvent
- the right event.
IllegalActionException
- If thrown by arithmetic operations
on the events
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |