|
|||||||||
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.domains.fsm.kernel.FSMDirector
ptolemy.domains.fsm.kernel.ModalDirector
ptolemy.domains.tdl.kernel.TDLModuleDirector
public class TDLModuleDirector
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.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private double |
_currentWCET
Current worst case execution time, this is set when the execution of a TDL task is started |
private TDLActionsGraph |
_graph
Current node in the TDL actions graph. |
private java.util.HashMap<Node,Time> |
_nextEventsTimeStamps
Store time stamps from _fireAt() to detect missed executions |
private java.util.HashMap<Node,java.util.List<TDLAction>> |
_nodesDependentoOnPreviousActions
Nodes containing actions that depend on previous actions. |
private Time |
_previousAdditionalScheduleTime
The minimum time to be added to schedule the next action in the _fireAt() method. |
private java.util.LinkedList |
_receivers
All receivers. |
Fields inherited from class ptolemy.domains.fsm.kernel.ModalDirector |
---|
_actorsFired |
Fields inherited from class ptolemy.domains.fsm.kernel.FSMDirector |
---|
_currentLocalReceiverMap, _enabledRefinements, _enabledTransition, _localReceiverMaps, controllerName |
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 | |
---|---|
TDLModuleDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name. |
Method Summary | |
---|---|
private boolean |
_chooseTransition(Transition transition)
Check if transition (=mode switch) should be executed. |
private void |
_fireAt(Node node,
Time additionalTime)
Schedule a refiring of this actor for a TDL action. |
private java.util.Collection |
_getAllTasks()
Get all tasks for a module. |
private java.util.List<Node> |
_getEventsToFire(Time scheduleTime,
Time modePeriod)
Return events that can be fired at current model time. |
private Time |
_getSmallestTimeStampInEventsToFire()
Returns the smallest time stamp of the events that will be fired next. |
private boolean |
_guardIsTrue(NamedObj obj)
Test a guard expression on an actor. |
private boolean |
_hasGuard(NamedObj obj)
Test if an object has a guard expression. |
private void |
_initializeOutputPorts()
Initialize output ports by reading initial value and initializing the receivers. |
private void |
_initializePort(IOPort port)
Initialize a port with an initial token. |
private void |
_resetReceivers()
Reset the TDL Receivers. |
private void |
_transferTaskInputs(Transition transition)
After a mode switch, tasks that exist in the source and the target state must have the same port values. |
private void |
_updateActuator(IOPort port)
Update actuator by transferring the outputs. |
private void |
_updateInputPort(IOPort port)
Update input port, for TDL that means a sensor value is read. |
private void |
_updateInputs()
Read input values and update inputMap the updated inputMap is required when guards are evaluated. |
private void |
_updateOutputPort(IOPort port)
Update output port, for TDL this means an actuator is updated. |
private void |
_updateReceivers(java.util.Collection portList)
Update the TDL receivers. |
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 excecutive 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.fsm.kernel.ModalDirector |
---|
clone, invalidateSchedule, postfire |
Methods inherited from class ptolemy.domains.fsm.kernel.FSMDirector |
---|
_buildLocalReceiverMaps, _checkTransition, _chooseTransition, _currentLocalReceivers, _getLastChosenTransition, _readInputs, _readOutputsFromRefinement, _setCurrentConnectionMap, _setCurrentState, attributeChanged, defaultDependency, fireAt, getContext, getController, getModelNextIterationTime, getModifiedVariables, getParseTreeEvaluator, handleModelError, implementsStrictActorSemantics, isStrict, setContainer, setModelTime |
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.kernel.util.Nameable |
---|
description, getContainer, getDisplayName, getFullName, getName, getName, setName |
Field Detail |
---|
private double _currentWCET
private TDLActionsGraph _graph
private java.util.HashMap<Node,Time> _nextEventsTimeStamps
private java.util.HashMap<Node,java.util.List<TDLAction>> _nodesDependentoOnPreviousActions
private Time _previousAdditionalScheduleTime
private java.util.LinkedList _receivers
Constructor Detail |
---|
public TDLModuleDirector(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- Container of this director.name
- Name of this director.
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 |
---|
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class ModalDirector
IllegalActionException
- If there is more than one
transition enabled, or there is no controller, or thrown by any
choice action.public Time getModePeriod(NamedObj obj)
obj
- The object
public Time getModelTime()
getModelTime
in class Director
Director.setModelTime(Time)
public static double getWCETParameter(Actor actor)
actor
- The actor for which the worst case execution time is
requested.
public double getWCET() throws IllegalActionException
IllegalActionException
public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class ModalDirector
IllegalActionException
- If the superclass throws it.public static boolean isFast(NamedObj obj)
obj
- The object that could be a fast task or actuator.
public CausalityInterface getCausalityInterface()
TDLCausalityInterface
.
getCausalityInterface
in class Director
public static int getFrequency(NamedObj obj)
obj
- The object that could be a fast task or actuator.
public static java.lang.String getSlots(NamedObj obj)
obj
- The object that could be a fast task or actuator.
public Receiver newReceiver()
newReceiver
in class FSMDirector
public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class ModalDirector
IllegalActionException
- Thrown if execution was missed, input ports could not be
transferred or by parent class.public void scheduleEventsAfterAction(Node node) throws IllegalActionException
node
- Given node.
IllegalActionException
- Not thrown here but in the base class.public boolean transferOutputs(IOPort port)
transferOutputs
in class Director
port
- output port.
public boolean transferInputs(IOPort port) throws IllegalActionException
transferInputs
in class FSMDirector
port
- Input port.
IllegalActionException
- Thrown if inputs are about to be transferred for a non opaque
input port.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class Director
IllegalActionException
- If the wrapup() method of
one of the associated actors throws it.private boolean _chooseTransition(Transition transition) throws IllegalActionException
transition
- The mode switch.
IllegalActionException
- If an error occurs during the transition.private void _fireAt(Node node, Time additionalTime) throws IllegalActionException
node
- Node containing a TDL action that is scheduled to execute at
the given time.additionalTime
- Time to be added to the current model time and the schedule
time of the TDL action node.
IllegalActionException
- Thrown if fireAt() returns false.private java.util.Collection _getAllTasks()
private java.util.List<Node> _getEventsToFire(Time scheduleTime, Time modePeriod)
scheduleTime
- Time in the schedule (= between 0 and modePeriod) which ismodePeriod
- Period of the current mode.
private Time _getSmallestTimeStampInEventsToFire()
private boolean _guardIsTrue(NamedObj obj) throws IllegalActionException
obj
- The object containing a guard expression.
IllegalActionException
- Thrown if guard expression could not be read.private boolean _hasGuard(NamedObj obj)
obj
- Object that might have a guard expression.
private void _initializePort(IOPort port) throws IllegalActionException
port
- Port to be initialized.
IllegalActionException
- Thrown if the initial value parameter could not be read.private void _initializeOutputPorts() throws IllegalActionException
IllegalActionException
- Thrown if the ports could not be initialized.private void _resetReceivers()
private void _updateActuator(IOPort port) throws IllegalActionException
port
- Actuator that should be updated.
IllegalActionException
- Thrown if outputs could not be transferred.private void _updateInputPort(IOPort port)
port
- Port to be updated.private void _updateInputs() throws IllegalActionException
IllegalActionException
- Thrown if the controller could not be retrieved or inputs
could not be read.private void _updateOutputPort(IOPort port) throws IllegalActionException
port
- The output port.
IllegalActionException
- Thrown if output ports from refinement could not be read.private void _updateReceivers(java.util.Collection portList) throws InvalidStateException, IllegalActionException
portList
- Ports containing TDL receivers that should be updated.
IllegalActionException
InvalidStateException
private void _transferTaskInputs(Transition transition) throws IllegalActionException
transition
- Mode switch that has been made.
IllegalActionException
- If refinement or Controller could not be retrieved.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |