public class HDFDirector extends SDFDirector
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
HDFFSMDirector
,
CachedSDFScheduler
Red (cxh) |
Red (zhouye) |
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
Parameter |
scheduleCacheSize
A parameter representing the size of the schedule cache to use.
|
_iterationCount, _periodicDirectorHelper, allowDisconnectedGraphs, allowRateChanges, AUTO_INTTOKEN, AUTO_NAME, constrainBufferSizes, iterations, ITERATIONS_NAME, period, synchronizeToRealTime, UNBOUNDED_INTTOKEN, UNBOUNDED_NAME, vectorizationFactor
_postfireReturns, _prefire
_actorsFinishedExecution, _aspectForActor, _aspectsPresent, _defaultMicrostep, _executionAspects, _finishRequested, _initializables, _nextScheduleTime, _stopRequested, _tokenSentToCommunicationAspect, _zeroTime, localClock, startTime, stopTime
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and 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.
|
Modifier and Type | Method and 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.
|
clone, createSchedule, fire, fireAt, getIterations, getModelNextIterationTime, initialize, newReceiver, periodValue, prefire, suggestedModalModelDirectors, supportMultirateFiring, transferInputs, transferOutputs
_setScheduler, addDebugListener, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, resumeActor
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, _transferOutputs, addInitializable, defaultDependency, delayDependency, finish, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCausalityInterface, getCurrentTime, getDeadline, getEnvironmentTime, getErrorTolerance, 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
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isEmbedded
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
addInitializable, removeInitializable, wrapup
description, getContainer, getDisplayName, getFullName, getName, getName, setName
public Parameter scheduleCacheSize
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.
public HDFDirector() throws IllegalActionException, NameDuplicationException
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.public HDFDirector(Workspace workspace) throws IllegalActionException, NameDuplicationException
workspace
- The workspace for this object.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.public HDFDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- Container of the director.name
- Name of this director.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.public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class SDFDirector
attribute
- The attribute that changed.IllegalActionException
- If the super class throws it.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class SDFDirector
IllegalActionException
- If no schedule can be found,
or if the super class method throws it.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class SDFDirector
IllegalActionException
- If the super class
preinitialize throws it.public void setScheduler(Scheduler scheduler) throws IllegalActionException, NameDuplicationException
setScheduler
in class StaticSchedulingDirector
scheduler
- The scheduler that this director will use.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.StaticSchedulingDirector.getScheduler()