ptolemy.domains.hdf.kernel
Class HDFFSMDirector

java.lang.Object
  extended by ptolemy.kernel.util.NamedObj
      extended by ptolemy.kernel.util.Attribute
          extended by ptolemy.actor.Director
              extended by ptolemy.domains.fsm.kernel.FSMDirector
                  extended by ptolemy.domains.fsm.kernel.MultirateFSMDirector
                      extended by ptolemy.domains.hdf.kernel.HDFFSMDirector
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Executable, Initializable, QuasiTransparentDirector, ExplicitChangeContext, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

public class HDFFSMDirector
extends MultirateFSMDirector

This director extends MultirateFSMDirector by restricting that state transitions could only occur between global iterations. The choice and commitment of the transition is deferred by sending a change request to the manager.

An HDFFSMDirector is often used in heterochronous dataflow (HDF) models. The HDF model of computation is a generalization of synchronous dataflow (SDF). In SDF, the set of port rates of an actor (called the rate signatures) are constant. In HDF, however, rate signatures are allowed to change between iterations of the HDF schedule. The change of rate signatures can be modeled by state transitions of a modal model, in which each state refinement infers a set of rate signatures.

References

  1. A. Girault, B. Lee, and E. A. Lee, `` Hierarchical Finite State Machines with Multiple Concurrency Models, '' April 13, 1998.

Since:
Ptolemy II 5.0
Version:
$Id: HDFFSMDirector.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Ye Zhou. Contributor: Brian K. Vogel
See Also:
MultirateFSMDirector, HDFDirector, Serialized Form
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (zhouye)

Nested Class Summary
 
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
 
Field Summary
private  boolean _sendRequest
          A flag indicating whether the FSM can send a change request.
 
Fields inherited from class ptolemy.domains.fsm.kernel.MultirateFSMDirector
_refinementPostfire, _reinitialize
 
Fields inherited from class ptolemy.domains.fsm.kernel.FSMDirector
_currentLocalReceiverMap, _enabledRefinements, _enabledTransition, _localReceiverMaps, controllerName
 
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _currentTime, _finishRequested, _initializables, _stopRequested, timeResolution
 
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
HDFFSMDirector(CompositeEntity container, java.lang.String name)
          Construct a director in the given container with the given name.
 
Method Summary
 void fire()
          Fire the modal model.
 Entity getContext()
          Return the change context being made explicit.
 void initialize()
          Initialize the modal model.
 boolean postfire()
          Request a change of state transition to the manager.
 void preinitialize()
          Preinitialize the modal model.
 
Methods inherited from class ptolemy.domains.fsm.kernel.MultirateFSMDirector
_declareDependency, _declareReconfigurationDependencyForRefinementRateVariables, _getEnclosingDomainActor, _getRefinementRateVariables, _updateInputTokenConsumptionRates, _updateOutputTokenProductionRates, chooseNextNonTransientState, chooseTransition, getNonTransientState, makeStateTransition, newReceiver, transferInputs, transferOutputs
 
Methods inherited from class ptolemy.domains.fsm.kernel.FSMDirector
_buildLocalReceiverMaps, _checkTransition, _chooseTransition, _currentLocalReceivers, _getLastChosenTransition, _readInputs, _readOutputsFromRefinement, _setCurrentConnectionMap, _setCurrentState, attributeChanged, clone, defaultDependency, fireAt, getController, getModelNextIterationTime, getModifiedVariables, getParseTreeEvaluator, handleModelError, implementsStrictActorSemantics, isStrict, prefire, setContainer, setModelTime
 
Methods inherited from class ptolemy.actor.Director
_description, _fireContainerAt, _isEmbedded, _isTopLevel, _transferInputs, _transferOutputs, addInitializable, createSchedule, finish, fireAt, fireAtCurrentTime, getCausalityInterface, getCurrentTime, getErrorTolerance, getGlobalTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, initialize, invalidateResolvedTypes, invalidateSchedule, isFireFunctional, isStopRequested, iterate, preinitialize, removeInitializable, requestInitialization, setCurrentTime, stop, stopFire, suggestedModalModelDirectors, supportMultirateFiring, terminate, wrapup
 
Methods inherited from class ptolemy.kernel.util.Attribute
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
 
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _recordDecoratedAttributes, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, propagateExistence, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
 

Field Detail

_sendRequest

private boolean _sendRequest
A flag indicating whether the FSM can send a change request. The controller in HDFFSMDirector can only send one request per global iteration.

Constructor Detail

HDFFSMDirector

public HDFFSMDirector(CompositeEntity container,
                      java.lang.String name)
               throws IllegalActionException,
                      NameDuplicationException
Construct a director in the given container with the given name. The container argument must not be null, or a NullPointerException will be thrown. If the name argument is null, then the name is set to the empty string. Increment the version number of the workspace.

Parameters:
container - Container of the director.
name - Name of this director.
Throws:
IllegalActionException - If the name has a period in it, or the director is not compatible with the specified container.
NameDuplicationException - If the container is not a CompositeActor and the name collides with an entity in the container.
Method Detail

fire

public void fire()
          throws IllegalActionException
Fire the modal model. If the refinement of the current state of the mode controller is ready to fire, then fire the current refinement. Overrides the base class method by sending a request to choose a transition to the manager.

Specified by:
fire in interface Executable
Overrides:
fire in class MultirateFSMDirector
Throws:
IllegalActionException - If there is no controller, or if the current state has no or more than one refinement.

getContext

public Entity getContext()
Return the change context being made explicit. This class overrides the implementation in the FSMDirector base class to report that modal models using HDFFSMDirector only make state transitions between toplevel iterations.

Specified by:
getContext in interface ExplicitChangeContext
Overrides:
getContext in class FSMDirector
Returns:
The explicit change context.

initialize

public void initialize()
                throws IllegalActionException
Initialize the modal model. Set the _sendRequest flag to be true to indicate the modal model can send a change request to the manager. Set the controller flag to indicate a new iteration begins.

Specified by:
initialize in interface Initializable
Overrides:
initialize in class MultirateFSMDirector
Throws:
IllegalActionException - If the base class throws it.

postfire

public boolean postfire()
                 throws IllegalActionException
Request a change of state transition to the manager.

Specified by:
postfire in interface Executable
Overrides:
postfire in class MultirateFSMDirector
Returns:
True if the postfire of the current state refinement returns true.
Throws:
IllegalActionException - If a refinement throws it, if there is no controller.

preinitialize

public void preinitialize()
                   throws IllegalActionException
Preinitialize the modal model. Set the _sendRequest flag to be true to indicate the modal model can send a change request to the manager.

Specified by:
preinitialize in interface Initializable
Overrides:
preinitialize in class MultirateFSMDirector
Throws:
IllegalActionException - If there is no controller, or if the non-transient initial state has no or more than one refinement, or if the preinitialize() method of one of the associated actors throws it.