Package ptolemy.domains.tdl.kernel
Class TDLModuleDirector
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.kernel.util.Attribute
-
- ptolemy.actor.Director
-
- ptolemy.domains.modal.kernel.FSMDirector
-
- ptolemy.domains.modal.kernel.ModalDirector
-
- ptolemy.domains.tdl.kernel.TDLModuleDirector
-
- All Implemented Interfaces:
java.lang.Cloneable
,Executable
,Initializable
,QuasiTransparentDirector
,SuperdenseTimeDirector
,ExplicitChangeContext
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class TDLModuleDirector extends ModalDirector
Director for a TDL (= Timing Definition Language) module. A TDL module consists of modes, modes consist of TDL tasks and TDL tasks are SDF actors. All actions inside a TDL module are executed periodically and the timing information is specified in parameters. This director parses the parameters and builds a schedule for all the TDL actions. The schedule is represented in a graph showing the dependencies between the TDL actions (see TDLActionsGraph).In the initialization, output ports and actuators are initialized with values specified in the parameters of the ports. The schedule is generated and events are scheduled. Events that are safe to process at current model time are executed, then the fireAt(time) of the enclosing director is called with the time stamp of the next event. Events are processed in the order specified in the graph.
- Since:
- Ptolemy II 8.0
- Version:
- $Id$
- Author:
- Patricia Derler
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.domains.modal.kernel.FSMDirector
_currentLocalReceiverMap, _indexOffset, _localReceiverMaps, controllerName
-
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 TDLModuleDirector(CompositeEntity container, java.lang.String name)
Construct a director in the given container with the given name.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
fire()
Select all actions that can be fired at the current model time.CausalityInterface
getCausalityInterface()
Return a causality interface for the composite actor that contains this director.static int
getFrequency(NamedObj obj)
Get frequency of the task.Time
getModelTime()
Return the current model time which is the model time of the executive director.Time
getModePeriod(NamedObj obj)
Get mode period from state parameter "period".static java.lang.String
getSlots(NamedObj obj)
Get frequency of the task.double
getWCET()
Return the worst case execution time of the actor or 0 if no worst case execution time was specified.static double
getWCETParameter(Actor actor)
Return the worst case execution time of the actor or 0 if no worst case execution time was specified.void
initialize()
Initialize the director, calculate schedule and schedule first firing.static boolean
isFast(NamedObj obj)
Find out if task (=actor) or actuator (=output port) is fast task.Receiver
newReceiver()
Return a new TDLReceiver.boolean
prefire()
Check if at the current time there is something to do.void
scheduleEventsAfterAction(Node node)
Schedules actions which depend on the action specified in the given node.boolean
transferInputs(IOPort port)
Don't read inputs as this is specifically scheduled by a TDLModule.boolean
transferOutputs(IOPort port)
Outputs are only transferred when scheduled, therefore do nothing if transfer outputs is called by another actor.void
wrapup()
Clear private variables and lists.-
Methods inherited from class ptolemy.domains.modal.kernel.FSMDirector
_buildLocalReceiverMaps, _currentLocalReceivers, _getLastChosenTransition, _getStateRefinementsToPostfire, _getTransitionRefinementsToPostfire, _readInputs, _readOutputsFromRefinement, _setCurrentConnectionMap, _setCurrentState, _transferOutputs, attributeChanged, clone, defaultDependency, fireAt, getContext, getController, getIndex, getModelNextIterationTime, getModifiedVariables, getParseTreeEvaluator, handleModelError, implementsStrictActorSemantics, invalidateSchedule, isStrict, postfire, preinitialize, resetOutputReceivers, setContainer, setIndex
-
Methods inherited from class ptolemy.actor.Director
_actorFinished, _consultTimeRegulators, _description, _isEmbedded, _isTopLevel, _schedule, _transferInputs, addInitializable, createSchedule, delayDependency, elapsedTimeSinceStart, finish, fireAt, fireAt, fireAtCurrentTime, fireContainerAt, fireContainerAt, getCurrentTime, getDeadline, getEnvironmentTime, getExecutionAspect, getGlobalTime, getModelStartTime, getModelStopTime, getNextIterationTime, getStartTime, getStopTime, getTimeResolution, initialize, invalidateResolvedTypes, isEmbedded, isFireFunctional, isStopRequested, iterate, mutexLockObject, notifyTokenSentToCommunicationAspect, preinitialize, removeInitializable, requestInitialization, resume, resumeActor, scheduleContainedActors, setCurrentTime, setEmbedded, setModelTime, setTimeResolution, stop, stopFire, suggestedModalModelDirectors, supportMultirateFiring, suspend, terminate, transferOutputs
-
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, addDebugListener, 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, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, 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.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Constructor Detail
-
TDLModuleDirector
public TDLModuleDirector(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.- Parameters:
container
- Container of this director.name
- Name of this director.- Throws:
IllegalActionException
- If the name has a period in it, or the director is not compatible with the specified container.NameDuplicationException
- If the container not a CompositeActor and the name collides with an entity in the container.
-
-
Method Detail
-
fire
public void fire() throws IllegalActionException
Select all actions that can be fired at the current model time. After executing an action, schedule actions that are executed next according to the schedule. If an action with a WCET > 0 was started, schedule a refiring and return.- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classFSMDirector
- Throws:
IllegalActionException
- If there is more than one transition enabled and nondeterminism is not permitted, or there is no controller, or it is thrown by any choice action.
-
getModePeriod
public Time getModePeriod(NamedObj obj)
Get mode period from state parameter "period".- Parameters:
obj
- The object- Returns:
- The value of the "period" parameter. If there is no period parameter or it cannot be converted to a double, then return 1.0.
-
getModelTime
public Time getModelTime()
Return the current model time which is the model time of the executive director.- Overrides:
getModelTime
in classDirector
- Returns:
- the model time of the executive directory
- See Also:
Director.setModelTime(Time)
-
getWCETParameter
public static double getWCETParameter(Actor actor)
Return the worst case execution time of the actor or 0 if no worst case execution time was specified.- Parameters:
actor
- The actor for which the worst case execution time is requested.- Returns:
- The worst case execution time.
-
getWCET
public double getWCET() throws IllegalActionException
Return the worst case execution time of the actor or 0 if no worst case execution time was specified.- Returns:
- The worst case execution time.
- Throws:
IllegalActionException
-
initialize
public void initialize() throws IllegalActionException
Initialize the director, calculate schedule and schedule first firing.- Specified by:
initialize
in interfaceInitializable
- Overrides:
initialize
in classFSMDirector
- Throws:
IllegalActionException
- If thrown by the initialize() method of the super class, or can not find mode controller, or can not find refinement of the current state.
-
isFast
public static boolean isFast(NamedObj obj)
Find out if task (=actor) or actuator (=output port) is fast task.- Parameters:
obj
- The object that could be a fast task or actuator.- Returns:
- True if it is a fast task.
-
getCausalityInterface
public CausalityInterface getCausalityInterface()
Return a causality interface for the composite actor that contains this director. This class returns an instance ofTDLCausalityInterface
.- Overrides:
getCausalityInterface
in classDirector
- Returns:
- A representation of the dependencies between input ports and output ports of the container.
-
getFrequency
public static int getFrequency(NamedObj obj)
Get frequency of the task.- Parameters:
obj
- The object that could be a fast task or actuator.- Returns:
- True if it is a fast task.
-
getSlots
public static java.lang.String getSlots(NamedObj obj)
Get frequency of the task.- Parameters:
obj
- The object that could be a fast task or actuator.- Returns:
- True if it is a fast task.
-
newReceiver
public Receiver newReceiver()
Return a new TDLReceiver.- Overrides:
newReceiver
in classFSMDirector
- Returns:
- A new TDL receiver.
-
prefire
public boolean prefire() throws IllegalActionException
Check if at the current time there is something to do.- Specified by:
prefire
in interfaceExecutable
- Overrides:
prefire
in classFSMDirector
- Returns:
- True if there is something to do now.
- Throws:
IllegalActionException
- Thrown if execution was missed, input ports could not be transferred or by parent class.
-
scheduleEventsAfterAction
public void scheduleEventsAfterAction(Node node) throws IllegalActionException
Schedules actions which depend on the action specified in the given node.- Parameters:
node
- Given node.- Throws:
IllegalActionException
- Not thrown here but in the base class.
-
transferOutputs
public boolean transferOutputs(IOPort port)
Outputs are only transferred when scheduled, therefore do nothing if transfer outputs is called by another actor.- Overrides:
transferOutputs
in classDirector
- Parameters:
port
- output port.- Returns:
- True.
-
transferInputs
public boolean transferInputs(IOPort port) throws IllegalActionException
Don't read inputs as this is specifically scheduled by a TDLModule.- Overrides:
transferInputs
in classFSMDirector
- Parameters:
port
- Input port.- Returns:
- True if ports transferred inputs.
- Throws:
IllegalActionException
- Thrown if inputs are about to be transferred for a non opaque input port.
-
wrapup
public void wrapup() throws IllegalActionException
Clear private variables and lists.- Specified by:
wrapup
in interfaceInitializable
- Overrides:
wrapup
in classDirector
- Throws:
IllegalActionException
- If the wrapup() method of one of the associated actors throws it.
-
-