ptolemy.domains.dde.kernel
Class FeedBackDelay

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.InstantiableNamedObj
          extended by ptolemy.kernel.Entity
              extended by ptolemy.kernel.ComponentEntity
                  extended by ptolemy.actor.AtomicActor
                      extended by ptolemy.actor.TypedAtomicActor
                          extended by ptolemy.domains.dde.kernel.DDEActor
                              extended by ptolemy.domains.dde.kernel.FeedBackDelay
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Actor, Executable, FiringsRecordable, Initializable, TypedActor, Changeable, Debuggable, DebugListener, Derivable, Instantiable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class FeedBackDelay
extends DDEActor

FeedBackDelay actors are used to add delay to feedback topologies. If a FeedBackDelay actor consumes a token (real or Null), it has the option of producing an equivalent token on the output with an incremented time stamp value. Alternatively, the FeedBackDelay actor will simply produce the token without altering the time stamp.

Two parameters - nullDelay and realDelay - are available for determining whether an FeedBackDelay actor increments the time stamp of produced output tokens. The default value of nullDelay (realDelay) is true (false). If the nullDelay (realDelay) parameter is set to true, then the time stamps of NullTokens (real tokens) will be incremented as they pass through this actor.

The delay value that is applied (given that one of the above parameters is true) is determined by the setDelay() and getDelay() methods. More elaborate delay values can be made available by overriding the getDelay() method in derived classes.

FeedBackDelay actors are effective for preventing Zeno conditions involving cycles of null tokens. If a DDE model has a feedback topology, a FeedBackDelay actor should be added into the feedback loop.

The delay value of a FeedBackDelay actor must be wisely chosen. The delay value should be smaller than any other successive time stamp increment found in a given DDE model. This means that if a particular model might have any two time stamps with time difference delta, then the delay value should be smaller than delta.

Since:
Ptolemy II 0.4
Version:
$Id: FeedBackDelay.java 57040 2010-01-27 20:52:32Z cxh $
Author:
John S. Davis II
See Also:
NullToken, Serialized Form
Accepted Rating:
Red (yuhong)
Proposed Rating:
Red (davisj)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
 
Field Summary
 Parameter delay
          The delay for this actor.
 TypedIOPort input
          The input port.
 Parameter nullDelay
          The boolean parameter that indicates whether a delay value will be added to the time stamp of null tokens that are produced by this actor.
 TypedIOPort output
          The output port.
 Parameter realDelay
          The boolean parameter that indicates whether a delay value will be added to the time stamp of real tokens that are produced by this actor.
 
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
FeedBackDelay()
          Construct a FeedBackDelay with no container and a name that is an empty string.
FeedBackDelay(CompositeEntity container, java.lang.String name)
          Construct a FeedBackDelay with the specified container and name.
FeedBackDelay(Workspace workspace)
          Construct a FeedBackDelay with the specified workspace and a name that is an empty string.
 
Method Summary
private  void _sendOutToken(Token token, Time time)
          Syntactic sugar for sending out tokens without depending on IOPort.send().
private  void _setVariables()
          Syntactic sugar for initializing parameters.
 void fire()
          Consume a single input token and produce an identical output token.
 double getDelay()
          Return the delay value of this actor.
 void initialize()
          Initialize this actor by setting all receivers so that they do not hide NullTokens.
 
Methods inherited from class ptolemy.domains.dde.kernel.DDEActor
_getNextInput, getNextToken
 
Methods inherited from class ptolemy.actor.TypedAtomicActor
_addPort, _fireAt, _fireAt, attributeTypeChanged, clone, newPort, typeConstraintList, typeConstraints
 
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, addActorFiringListener, addInitializable, clone, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
 
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 ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, 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, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
 
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, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
 
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, 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

delay

public Parameter delay
The delay for this actor. The initial default value is a double with value 1.0.


input

public TypedIOPort input
The input port.


nullDelay

public Parameter nullDelay
The boolean parameter that indicates whether a delay value will be added to the time stamp of null tokens that are produced by this actor. This parameter defaults to true.


output

public TypedIOPort output
The output port.


realDelay

public Parameter realDelay
The boolean parameter that indicates whether a delay value will be added to the time stamp of real tokens that are produced by this actor. This parameter defaults to false.

Constructor Detail

FeedBackDelay

public FeedBackDelay()
              throws IllegalActionException,
                     NameDuplicationException
Construct a FeedBackDelay with no container and a name that is an empty string.

Throws:
IllegalActionException - If the constructor of the superclass throws an IllegalActionException.
NameDuplicationException - If the constructor of the superclass throws a NameDuplicationException .

FeedBackDelay

public FeedBackDelay(Workspace workspace)
              throws IllegalActionException,
                     NameDuplicationException
Construct a FeedBackDelay with the specified workspace and a name that is an empty string.

Parameters:
workspace - The workspace for this FeedBackDelay.
Throws:
IllegalActionException - If the constructor of the superclass throws an IllegalActionException.
NameDuplicationException - If the constructor of the superclass throws a NameDuplicationException .

FeedBackDelay

public FeedBackDelay(CompositeEntity container,
                     java.lang.String name)
              throws IllegalActionException,
                     NameDuplicationException
Construct a FeedBackDelay with the specified container and name.

Parameters:
container - The container of this FeedBackDelay.
name - The name of this FeedBackDelay.
Throws:
IllegalActionException - If the constructor of the superclass throws an IllegalActionException.
NameDuplicationException - If the constructor of the superclass throws a NameDuplicationException .
Method Detail

fire

public void fire()
          throws IllegalActionException
Consume a single input token and produce an identical output token. If the input token is a NullToken and the nullDelay parameter is set to true, then produce an output NullToken to have a time stamp with a delay specified by getDelay(). Otherwise produce a NullToken that does not have a delayed time stamp value. If the input token is a real token and the realDelay parameter is set to true, then produce an output real token to have a time stamp with a delay specified by getDelay(). Otherwise produce a real token that does not have a delayed time stamp value.

Specified by:
fire in interface Executable
Overrides:
fire in class AtomicActor
Throws:
IllegalActionException - If there is an error when sending the output token or setting the current time.

getDelay

public double getDelay()
                throws IllegalActionException
Return the delay value of this actor.

Returns:
The delay value of this actor.
Throws:
IllegalActionException - If there is a problem reading the delay token.

initialize

public void initialize()
                throws IllegalActionException
Initialize this actor by setting all receivers so that they do not hide NullTokens.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class AtomicActor
Throws:
IllegalActionException - If there is an error when when attempting to access the receivers of this actor.
See Also:
NullToken, DDEReceiver

_sendOutToken

private void _sendOutToken(Token token,
                           Time time)
                    throws IllegalActionException
Syntactic sugar for sending out tokens without depending on IOPort.send().

Throws:
IllegalActionException

_setVariables

private void _setVariables()
                    throws IllegalActionException,
                           NameDuplicationException
Syntactic sugar for initializing parameters.

Throws:
IllegalActionException
NameDuplicationException