Class HDFDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.Director
-
- ptolemy.actor.sched.StaticSchedulingDirector
-
- ptolemy.domains.sdf.kernel.SDFDirector
-
- ptolemy.domains.hdf.kernel.HDFDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,PeriodicDirector
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class HDFDirector extends SDFDirector
The Heterochronous Dataflow (HDF) domain is an extension of the Synchronous Dataflow (SDF) domain and implements the HDF model of computation [1]. In SDF, the set of port rates (called rate signatures) of an actor are constant. In HDF, however, rate signatures are allowed to change between iterations of the HDF schedule.This director is often used with HDFFSMDirector. The HDFFSMDirector governs the execution of a modal model. The change of rate signatures can be modeled by state transitions of the modal model, in which each state refinement infers a set of rate signatures. Within each state, the HDF model behaves like an SDF model.
This director recomputes the schedules dynamically. To improve efficiency, this director uses a CachedSDFScheduler. A CachedSDFScheduler caches schedules labeled by their corresponding rate signatures, with the most recently used at the beginning of the queue. Therefore, when a state in HDF is revisited, the schedule identified by its rate signatures in the cache is used. We do not need to recompute the schedule.
The size of the cache in the CachedSDFScheduler is set by the scheduleCacheSize parameter of HDFDirector. The default value of this parameter is 100. If the cache is full, the least recently used schedule (at the end of the cache) is discarded.
References
- 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$
- Author:
- Ye Zhou. Contributor: Brian K. Vogel
- See Also:
HDFFSMDirector
,CachedSDFScheduler
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (zhouye)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description Parameter
scheduleCacheSize
A parameter representing the size of the schedule cache to use.-
Fields inherited from class ptolemy.domains.sdf.kernel.SDFDirector
_iterationCount, _periodicDirectorHelper, allowDisconnectedGraphs, allowRateChanges, AUTO_INTTOKEN, AUTO_NAME, constrainBufferSizes, iterations, ITERATIONS_NAME, period, synchronizeToRealTime, UNBOUNDED_INTTOKEN, UNBOUNDED_NAME, vectorizationFactor
-
Fields inherited from class ptolemy.actor.sched.StaticSchedulingDirector
_postfireReturns, _prefire
-
Fields inherited from class ptolemy.actor.Director
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _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
Constructors Constructor Description HDFDirector()
Construct a director in the default workspace with an empty string as its name.HDFDirector(CompositeEntity container, java.lang.String name)
Construct a director in the given container with the given name.HDFDirector(Workspace workspace)
Construct a director in the workspace with an empty name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attributeChanged(Attribute attribute)
If the attribute changed is the scheduleCacheSize parameter, construct the cache in the associated CachedSDFScheduler with the given cache size.boolean
postfire()
Send a request to the manager to get the HDF schedule if the schedule is not valid or this director is not at the top level.void
preinitialize()
Preinitialize the actors associated with this director.void
setScheduler(Scheduler scheduler)
Override the base class to ensure that the scheduler is an SDFScheduler and that its constrainBufferSizes parameter is set to false.-
Methods inherited from class ptolemy.domains.sdf.kernel.SDFDirector
clone, createSchedule, fire, fireAt, getIterations, getModelNextIterationTime, initialize, newReceiver, periodValue, prefire, suggestedModalModelDirectors, supportMultirateFiring, transferInputs, transferOutputs
-
Methods inherited from class ptolemy.actor.sched.StaticSchedulingDirector
_setScheduler, addDebugListener, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, resumeActor
-
Methods inherited from class ptolemy.actor.Director
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, addInitializable, defaultDependency, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, getModelTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, implementsStrictActorSemantics, initialize, invalidateResolvedTypes, isEmbedded, isFireFunctional, isStopRequested, isStrict, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, scheduleContainedActors, setContainer, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, suspend, terminate, transferOutputs, 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, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, 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, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeHierarchyListener, 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.actor.Executable
isFireFunctional, isStrict, iterate, 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.actor.util.PeriodicDirector
isEmbedded
-
-
-
-
Field Detail
-
scheduleCacheSize
public Parameter scheduleCacheSize
A parameter representing the size of the schedule cache to use. If the value is less than or equal to zero, then schedules will never be discarded from the cache. The default value is 100.Note that the number of schedules in an HDF model can be exponential in the number of actors. Setting the cache size to a very large value is therefore not recommended if the model contains a large number of HDF actors.
-
-
Constructor Detail
-
HDFDirector
public HDFDirector() throws IllegalActionException, NameDuplicationException
Construct a director in the default workspace with an empty string as its name. The director is added to the list of objects in the workspace. Increment the version number of the workspace.- Throws:
IllegalActionException
- If the name has a period in it, or the director is not compatible with the specified container.NameDuplicationException
- If the container already contains an entity with the specified name.
-
HDFDirector
public HDFDirector(Workspace workspace) throws IllegalActionException, NameDuplicationException
Construct a director in the workspace with an empty name. The director is added to the list of objects in the workspace. Increment the version number of the workspace.- Parameters:
workspace
- The workspace for this object.- Throws:
IllegalActionException
- If the name has a period in it, or the director is not compatible with the specified container.NameDuplicationException
- If the container already contains an entity with the specified name.
-
HDFDirector
public HDFDirector(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. The HDFDirector will have a default scheduler of type SDFScheduler.- Parameters:
container
- Container of the director.name
- Name of this director.- Throws:
IllegalActionException
- If the director is not compatible with the specified container. May be thrown in a derived class.NameDuplicationException
- If the container is not a CompositeActor and the name collides with an entity in the container.
-
-
Method Detail
-
attributeChanged
public void attributeChanged(Attribute attribute) throws IllegalActionException
If the attribute changed is the scheduleCacheSize parameter, construct the cache in the associated CachedSDFScheduler with the given cache size.- Overrides:
attributeChanged
in classSDFDirector
- Parameters:
attribute
- The attribute that changed.- Throws:
IllegalActionException
- If the super class throws it.
-
postfire
public boolean postfire() throws IllegalActionException
Send a request to the manager to get the HDF schedule if the schedule is not valid or this director is not at the top level.- Specified by:
postfire
in interfaceExecutable
- Overrides:
postfire
in classSDFDirector
- Returns:
- True if the Director wants to be fired again in the future.
- Throws:
IllegalActionException
- If no schedule can be found, or if the super class method throws it.
-
preinitialize
public void preinitialize() throws IllegalActionException
Preinitialize the actors associated with this director. The super class method will compute the schedule.- Specified by:
preinitialize
in interfaceInitializable
- Overrides:
preinitialize
in classSDFDirector
- Throws:
IllegalActionException
- If the super class preinitialize throws it.
-
setScheduler
public void setScheduler(Scheduler scheduler) throws IllegalActionException, NameDuplicationException
Override the base class to ensure that the scheduler is an SDFScheduler and that its constrainBufferSizes parameter is set to false.- Overrides:
setScheduler
in classStaticSchedulingDirector
- Parameters:
scheduler
- The scheduler that this director will use.- Throws:
IllegalActionException
- If the scheduler is not an instance of SDFScheduler.NameDuplicationException
- Not thrown in this base class, but derived classes may throw it if the scheduler is not compatible.- See Also:
StaticSchedulingDirector.getScheduler()
-
-