|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.util.Attribute
ptolemy.actor.Director
ptolemy.actor.sched.StaticSchedulingDirector
ptolemy.domains.sdf.kernel.SDFDirector
ptolemy.domains.dt.kernel.DTDirector
public class DTDirector
The Discrete Time (DT) domain director.
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.
.
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
,
Serialized Form
Yellow (vogel) |
Yellow (chf) |
Nested Class Summary | |
---|---|
private static class |
DTDirector.DTActor
Inner class to cache important variables for contained actors |
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private java.util.ArrayList |
_actorTable
|
private java.util.Hashtable |
_allActorsTable
|
private Time |
_formerTimeFired
|
private Time |
_formerValidTimeFired
|
private boolean |
_inputTokensAvailable
|
private boolean |
_isFiringAllowed
|
private java.util.ArrayList |
_receiverTable
|
private boolean |
_shouldDoInternalTransferOutputs
|
private java.util.Map |
_shouldTransferOutputs
|
private static double |
_TOLERANCE
|
Fields inherited from class ptolemy.domains.sdf.kernel.SDFDirector |
---|
_iterationCount, _periodicDirectorHelper, allowDisconnectedGraphs, allowRateChanges, constrainBufferSizes, iterations, period, synchronizeToRealTime, vectorizationFactor |
Fields inherited from class ptolemy.actor.sched.StaticSchedulingDirector |
---|
_postfireReturns |
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 | |
---|---|
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. |
Method Summary | |
---|---|
private void |
_buildActorTable()
Create an actor table that caches all the actors directed by this director. |
private void |
_buildOutputPortTable()
Build the internal cache of all the ports directed by this director |
private void |
_buildReceiverTable()
Build the internal cache of all the receivers directed by this director. |
private void |
_checkValidTimeIntervals()
Check if the current time is a valid time for execution. |
private void |
_debugViewActorTable()
For debugging purposes. |
private void |
_debugViewReceiverTable()
For debugging purposes. |
private Director |
_getOutsideDirector()
Convenience method for getting the director of the container that holds this director. |
protected int |
_getRepetitions(Actor actor)
Get the number of times an actor repeats in the schedule of an SDF graph. |
private void |
_init()
Most of the constructor initialization is relegated to this method. |
private void |
_issuePseudoFire(Time currentTime)
Request the outside non-DT director to fire this TypedCompositeActor at time intervals equal to when the output tokens should be produced. |
private void |
_makeTokensAvailable()
Enable the hasToken() method in the output ports of the TypedCompositeActor directed by this director. |
private void |
_makeTokensUnavailable()
Disable the hasToken() method in the output ports of the TypedCompositeActor directed by this director. |
private void |
_requestRefireAt(Time time)
Convenience method for asking the executive director to fire this director's container again at a specific time in the future. |
private void |
_reset()
|
Dependency |
delayDependency(double delay)
Return a boolean dependency representing a model-time delay of the specified amount. |
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 |
setModelTime(Time newTime)
Set a new value to the current time of the model, where the new time may be earlier than the current time. |
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. |
Methods inherited from class ptolemy.domains.sdf.kernel.SDFDirector |
---|
attributeChanged, clone, createSchedule, fireAt, periodValue, preinitialize, suggestedModalModelDirectors, supportMultirateFiring |
Methods inherited from class ptolemy.actor.sched.StaticSchedulingDirector |
---|
_setScheduler, addDebugListener, getScheduler, isScheduleValid, removeDebugListener |
Methods inherited from class ptolemy.kernel.util.Attribute |
---|
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ptolemy.actor.TimedDirector |
---|
getModelTime, getTimeResolution |
Methods inherited from interface ptolemy.actor.Executable |
---|
isFireFunctional, isStrict, iterate, stop, stopFire, terminate |
Methods inherited from interface ptolemy.actor.Initializable |
---|
addInitializable, removeInitializable |
Methods inherited from interface ptolemy.kernel.util.Nameable |
---|
description, getContainer, getDisplayName, getFullName, getName, getName, setName |
Field Detail |
---|
private java.util.ArrayList _actorTable
private java.util.ArrayList _receiverTable
private java.util.Hashtable _allActorsTable
private Time _formerValidTimeFired
private Time _formerTimeFired
private boolean _isFiringAllowed
private boolean _shouldDoInternalTransferOutputs
private boolean _inputTokensAvailable
private java.util.Map _shouldTransferOutputs
private static final double _TOLERANCE
Constructor Detail |
---|
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.Method Detail |
---|
public Dependency delayDependency(double delay)
delayDependency
in interface TimedDirector
delay
- A non-negative delay.
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class StaticSchedulingDirector
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()
invalidateSchedule
in class StaticSchedulingDirector
NamedObj.attributeChanged(ptolemy.kernel.util.Attribute)
,
NamedObj.attributeTypeChanged(ptolemy.kernel.util.Attribute)
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 setModelTime(Time newTime)
setModelTime
in class Director
newTime
- The new current simulation time.Director.getModelTime()
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()
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.private void _buildActorTable() throws IllegalActionException
IllegalActionException
- If the scheduler is nullprivate void _buildReceiverTable() throws IllegalActionException
IllegalActionException
- If methods called throw it.private void _buildOutputPortTable() throws IllegalActionException
IllegalActionException
- If methods called throw it.private final void _checkValidTimeIntervals() throws IllegalActionException
IllegalActionException
- If methods called throw it.private void _debugViewActorTable() throws IllegalActionException
IllegalActionException
- If there is a problem in
obtaining the number of initial token for delay actorsprivate void _debugViewReceiverTable()
private Director _getOutsideDirector()
private void _issuePseudoFire(Time currentTime) throws IllegalActionException
IllegalActionException
private void _makeTokensAvailable() throws IllegalActionException
IllegalActionException
private void _makeTokensUnavailable() throws IllegalActionException
IllegalActionException
private void _requestRefireAt(Time time) throws IllegalActionException
time
- The time when this director's container should be fired
IllegalActionException
- If getting the container or
executive director failsprivate void _init()
private void _reset()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |