|
|||||||||
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
public class SDFDirector
Director for the synchronous dataflow (SDF) model of computation.
Actors are assumed to consume and produce exactly one token per channel on
each firing. Actors that do not follow this convention should set
the appropriate parameters on input and output ports to declare the number
of tokens they produce or consume. See the
SDFScheduler
for more information.
The SampleDelay
actor is usually used
in a model to specify the delay across a relation.
The allowDisconnectedGraphs parameter of this director determines whether disconnected graphs are permitted. A model may have two or more graphs of actors that are not connected. The schedule can jump from one graph to another among the disconnected graphs. There is nothing to force the scheduler to finish executing all actors on one graph before firing actors on another graph. However, the order of execution within an graph should be correct. Usually, disconnected graphs in an SDF model indicates an error. The default value of the allowDisconnectedGraphs parameter is a BooleanToken with the value false.
The iterations parameter of this director corresponds to a limit on the number of times the director will fire its hierarchy before it returns false in postfire. If this number is not greater than zero, then no limit is set and postfire will always return true. The default value of the iterations parameter is an IntToken with value zero.
The vectorizationFactor parameter of this director sets the number of times that the basic schedule is executed during each firing of this director. This might allow the director to execute the model more efficiently, by combining multiple firings of each actor. The default value of the vectorizationFactor parameter is an IntToken with value one.
The SDF director has a period parameter which specifies the amount of model time that elapses per iteration. If the value of period is 0.0 (the default), then it has no effect, and this director never increments time nor calls fireAt() on the enclosing director. If the period is greater than 0.0, then if this director is at the top level, it increments time by this amount in each invocation of postfire(). If it is not at the top level, then it calls fireAt(currentTime + period) in postfire().
This behavior gives an interesting use of SDF within DE: You can "kick start" an SDF submodel with a single event, and then if the director of that SDF submodel has a period greater than 0.0, then it will continue to fire periodically with the specified period.
If period is greater than 0.0 and the parameter
synchronizeToRealTime is set to true
,
then the prefire() method stalls until the real time elapsed
since the model started matches the period multiplied by
the iteration count.
This ensures that the director does not get ahead of real time. However,
of course, this does not ensure that the director keeps up with real time.
SDFScheduler
,
SDFReceiver
,
Serialized Form
Green (neuendor) |
Green (neuendor) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
(package private) boolean |
_allowDisconnectedGraphs
Cache of the value of allowDisconnectedGraphs. |
protected int |
_iterationCount
The iteration count. |
protected PeriodicDirectorHelper |
_periodicDirectorHelper
Helper class supporting the period parameter. |
private long |
_realStartTime
The real time at which the model begins executing. |
private int |
_vectorizationFactor
Cache of the most recent value of vectorizationFactor. |
Parameter |
allowDisconnectedGraphs
A parameter representing whether disconnected graphs are permitted. |
Parameter |
allowRateChanges
A parameter representing whether dynamic rate changes are permitted. |
Parameter |
constrainBufferSizes
If true, then buffer sizes are fixed according to the schedule, and attempts to write to the buffer that cause the buffer to exceed the schedule size result in an exception. |
Parameter |
iterations
A Parameter representing the number of times that postfire may be called before it returns false. |
Parameter |
period
The time period of each iteration. |
Parameter |
synchronizeToRealTime
Specify whether the execution should synchronize to the real time. |
Parameter |
vectorizationFactor
A Parameter representing the requested vectorization factor. |
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 | |
---|---|
SDFDirector()
Construct a director in the default workspace with an empty string as its name. |
|
SDFDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name. |
|
SDFDirector(Workspace workspace)
Construct a director in the workspace with an empty name. |
Method Summary | |
---|---|
private void |
_init()
Initialize the object. |
void |
attributeChanged(Attribute attribute)
React to a change in an attribute. |
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace. |
void |
createSchedule()
Create the SDF schedule for this director. |
Time |
fireAt(Actor actor,
Time time)
Request a firing of the given actor at the given absolute time, and return the time at which the specified will be fired. |
Time |
getModelNextIterationTime()
Return the time value of the next iteration. |
void |
initialize()
Initialize the actors associated with this director and then set the iteration count to zero. |
Receiver |
newReceiver()
Return a new receiver consistent with the SDF domain. |
double |
periodValue()
Return the value of the period as a double. |
boolean |
postfire()
Return false if the system has finished executing, either by reaching the iteration limit, or having an actor in the system return false in postfire. |
boolean |
prefire()
Check the input ports of the container composite actor (if there are any) to see whether they have enough tokens, and return true if they do. |
void |
preinitialize()
Preinitialize the actors associated with this director and compute the schedule. |
java.lang.String[] |
suggestedModalModelDirectors()
Return an array of suggested ModalModel directors to use with SDFDirector. |
boolean |
supportMultirateFiring()
Return true to indicate that a ModalModel under control of this director supports multirate firing. |
boolean |
transferInputs(IOPort port)
Override the base class method to transfer enough tokens to complete an internal iteration. |
boolean |
transferOutputs(IOPort port)
Override the base class method to transfer enough tokens to fulfill the output production rate. |
Methods inherited from class ptolemy.actor.sched.StaticSchedulingDirector |
---|
_setScheduler, addDebugListener, fire, getScheduler, invalidateSchedule, isScheduleValid, removeDebugListener, setScheduler |
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.Executable |
---|
fire, 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 |
Field Detail |
---|
public Parameter allowDisconnectedGraphs
public Parameter allowRateChanges
public Parameter constrainBufferSizes
public Parameter iterations
public Parameter period
public Parameter synchronizeToRealTime
public Parameter vectorizationFactor
protected int _iterationCount
protected PeriodicDirectorHelper _periodicDirectorHelper
boolean _allowDisconnectedGraphs
private long _realStartTime
private int _vectorizationFactor
Constructor Detail |
---|
public SDFDirector() 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 SDFDirector(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 SDFDirector(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.Method Detail |
---|
public void attributeChanged(Attribute attribute) throws IllegalActionException
attributeChanged
in class Director
attribute
- The changed parameter.
IllegalActionException
- If the parameter set is not valid.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class StaticSchedulingDirector
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 createSchedule() throws IllegalActionException
createSchedule
in class Director
IllegalActionException
- If the schedule can't be created.public Time getModelNextIterationTime()
getModelNextIterationTime
in class Director
Director.getModelTime()
public Time fireAt(Actor actor, Time time) throws IllegalActionException
fireAt
in class Director
actor
- The actor scheduled to be fired.time
- The requested time.
IllegalActionException
- If the operation is not
permissible (e.g. the given time is in the past).Director.fireAtCurrentTime(Actor)
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class Director
IllegalActionException
- If the initialize() method of
one of the associated actors throws it, or if there is no
scheduler.public Receiver newReceiver()
newReceiver
in class Director
public double periodValue() throws IllegalActionException
periodValue
in interface PeriodicDirector
IllegalActionException
- If the period parameter
cannot be evaluatedpublic boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class StaticSchedulingDirector
IllegalActionException
- If port methods throw it.public void preinitialize() throws IllegalActionException
preinitialize
in interface Initializable
preinitialize
in class Director
IllegalActionException
- If the preinitialize() method of
one of the associated actors throws it.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class StaticSchedulingDirector
IllegalActionException
- If the iterations parameter
does not contain a legal value.public java.lang.String[] suggestedModalModelDirectors()
suggestedModalModelDirectors
in class Director
Director.suggestedModalModelDirectors()
public boolean supportMultirateFiring()
supportMultirateFiring
in class Director
public boolean transferInputs(IOPort port) throws IllegalActionException
transferInputs
in class Director
port
- The port to transfer tokens from.
IllegalActionException
- If the port is not an opaque
input port, or if there are not enough input tokens available.public boolean transferOutputs(IOPort port) throws IllegalActionException
transferOutputs
in class Director
port
- The port to transfer tokens from.
IllegalActionException
- If the port is not an opaque
output port.private void _init() throws IllegalActionException, NameDuplicationException
IllegalActionException
NameDuplicationException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |