public class DTDirector extends SDFDirector
The Discrete Time (DT) domain is a timed extension of the Synchronous Dataflow (SDF) domain. Like SDF, it has static scheduling of the dataflow graph model. Similarly, DT requires that the data rates on the ports of all actors be known beforehand and fixed. DT handles feedback systems in the same way that SDF does, but with additional constraints on initial tokens.
Because of the inherent concurrency occurring within SDF models, there are two notions of time in DT -- global time and local time. Global time increases steadily as execution progresses. Moreover, global time increases by fixed discrete amounts given by the period parameter. On the other hand, each receiver is associated with an independent local time. All the receivers have distinct local times as an iteration proceeds. The local time of a receiver during an iteration depends on the global time, period, firing count, port rates, and the schedule. These local times obey the following constraint:
The exact way that local time increments during an iteration is described in detail in the DTReceiver documentation.
n
The DT director has a period parameter which specifies the amount of time per iteration. For hierarchical DT, this period parameter only makes sense on the top-level. The user cannot explicitly set the period parameter for a DT subsystem inside another DT system. For heterogeneous hierarchies (e.g. DT inside DE or DT inside CT), the period parameter specifies the time interval between firings of the DT subsystem. The DT subsystem will not fire on times that are not integer multiples of the period parameter.
The design of the DT domain is motivated by the following criteria:
DT (Discrete Time) is a timed model of computation. In order to benefit from the internal time-keeping mechanism of DT, one should use actors aware of time. For example, one should use TimedPlotter or TimedScope instead of SequencePlotter or SequenceScope.
Top-level DT Directors have a period parameter that can be set by the user. Setting the period parameter of a non-top-level DT Director under hierarchical DT has no meaning; and hence will be ignored.
Domain-polymorphic actors that want to take advantage of the multi-rate timing capabilities of DT should call getCurrentTime(channel_number) for every get(channel_number). Moreover, the call sequence should be ordered as follows: getCurrentTime(channel_number) before get(channel_number).
Known bugs:
1.) Put more tests on this case: when events come in faster than the period of a DT composite actor (e.g clock feeding DT) 2.) Put more tests on this case: when DT composite actor doesn't fire because there aren't enough tokens. 3.) Domain-polymorphic actors that use getCurrentTime() should be modified to use DT's multirate timing capabilities. CurrentTime - modified TimedPlotter - modified TimedScope - modified SequentialClock - no input ports, gets global time only PoissonClock - under investigation Clock - under investigation Expression - under investigation 4.) This director does not implement fireAt(). Instead, it inherits the implementation from SDF, which isn't quite correct. It does not always return the correct next time of firing. As a workaround, this class does not check the values returned by fireAt(). Thus, if it is embedded in a domain that does not respect the calls to fireAt(), then the user could get odd behavior without any error reported.
DTReceiver
,
SDFDirector
,
SDFReceiver
,
SDFScheduler
NamedObj.ContainedObjectsIterator
_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 |
---|
DTDirector()
Construct a director in the default workspace with an empty string
as its name.
|
DTDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name.
|
DTDirector(Workspace workspace)
Construct a director in the workspace with an empty name.
|
Modifier and Type | Method and Description |
---|---|
protected int |
_getRepetitions(Actor actor)
Get the number of times an actor repeats in the schedule of an
SDF graph.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
void |
fire()
Go through the schedule and iterate every actor with calls to
prefire() , fire() , and postfire().
|
Time |
getModelNextIterationTime()
Return the time value of the next iteration.
|
double |
getPeriod()
Get the global time increment per iteration for this director.
|
void |
initialize()
Initialize all the actors associated with this director by calling
super.initialize().
|
void |
invalidateSchedule()
Process the mutation that occurred.
|
Receiver |
newReceiver()
Return a new receiver consistent with the DT domain.
|
boolean |
postfire()
Request the outside director to fire this director's container
again for the next period.
|
boolean |
prefire()
Check the input ports of the container composite actor (if there
are any) to see whether they have enough tokens.
|
void |
setActorLocalTime(Time newTime,
Actor actor)
Set the local time of an actor in the model under
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.
|
boolean |
transferInputs(IOPort port)
Override the base class method to make sure that enough tokens
are available to complete one iteration.
|
boolean |
transferOutputs(IOPort port)
This is called by the outside director to get tokens
from an opaque composite actor.
|
void |
wrapup()
Reset this director to an uninitialized state.
|
attributeChanged, createSchedule, fireAt, getIterations, periodValue, preinitialize, suggestedModalModelDirectors, supportMultirateFiring
_setScheduler, addDebugListener, getScheduler, isScheduleValid, removeDebugListener, resumeActor
_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
_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
description, getContainer, getDisplayName, getFullName, getName, getName, setName
public DTDirector() 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 DTDirector(Workspace workspace) throws IllegalActionException, NameDuplicationException
workspace
- The workspace of 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 DTDirector(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.NameDuplicationException
- If the container is not a
CompositeActor and the name collides with an entity in the container.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class SDFDirector
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base classNamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class SDFDirector
IllegalActionException
- If an actor executed by this
director returns false in its prefire().public Time getModelNextIterationTime()
getModelNextIterationTime
in class SDFDirector
Director.getModelTime()
public double getPeriod() throws IllegalActionException
IllegalActionException
- If the period parameter is
is not of type DoubleToken or IntToken.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class SDFDirector
IllegalActionException
- If the initialize() method of
one of the associated actors throws it.public void invalidateSchedule()
public Receiver newReceiver()
newReceiver
in class SDFDirector
public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class SDFDirector
IllegalActionException
- If the parent class throws
it.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class SDFDirector
IllegalActionException
- If the parent class throws
it.public void setActorLocalTime(Time newTime, Actor actor)
newTime
- The new current simulation time.actor
- The actor to be assigned a new local timepublic 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()
public boolean transferInputs(IOPort port) throws IllegalActionException
transferInputs
in class SDFDirector
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
input port.public boolean transferOutputs(IOPort port) throws IllegalActionException
transferOutputs
in class SDFDirector
port
- The port to transfer tokens from.IllegalActionException
- If the port is not an opaque
output port.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class Director
IllegalActionException
- If the parent class
throws itprotected int _getRepetitions(Actor actor) throws IllegalActionException
actor
- The actor whose firing count is needed.IllegalActionException
- If actor does not exist.