|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.domains.tdl.kernel.TDLActionsGraph
public class TDLActionsGraph
A representation of the schedule of all actions in a TDL module in a graph. Nodes in this graph describe TDLActions (@see #TDLAction), edges describe the causal dependencies between those actions. The weight of nodes are the TDLAction objects, the weight of edges are the time that passes between two actions.
Field Summary | |
---|---|
private FSMActor |
_controller
Controller of the TDL module. |
private DirectedGraph |
_graph
Graph containing all TDL actions. |
private java.util.HashMap<State,java.util.List> |
_modeSwitches
store all mode switch entry and exit points for all modes in the form: mode1: modeSwitch1 : Object[](entry, exit) modeSwtich2 : Object[]entry, exit) mode2: ... |
private TDLModule |
_module
The TDL module. |
private java.util.HashMap |
_tmpConnectedTaskPorts
Store the connection between output ports of one task with input ports of another task. |
private java.util.HashMap<Time,Node> |
_tmpModeSwitchEnds
Store end of mode switch subgraphs. |
private java.util.HashMap<Time,Node> |
_tmpModeSwitchStarts
Store starts of mode switch subgraphs. |
private java.util.HashMap<Time,java.util.List> |
_tmpReadSensors
Store the times sensors are read. |
private java.util.HashMap<IOPort,java.util.List<Time>> |
_tmpReadTaskInputPorts
Store the times task input ports are read. |
Constructor Summary | |
---|---|
TDLActionsGraph(TDLModule module,
FSMActor controller)
Create a new TDLActionsGraph for a TDL module. |
Method Summary | |
---|---|
private void |
_addConnectionsBetweenTaskPorts()
Add the connections between task output ports and other tasks input ports. |
private LetTask |
_analyzeSlotSelection(TDLTask actor,
Time modePeriodTime)
Analyze the slot selection string. |
private void |
_connectModes()
Connect partial graphs for modes. |
private void |
_connectToIntermediateModeSwitch(Node prev,
Time actorInvocationTime,
Time actorInvocationPeriod)
Connect a node for a TDL action to the next mode switch in time. |
private void |
_connectToOtherTasksOutputPorts(IOPort taskInputPort)
Connect an input port to the output port of another task that this input port reads from. |
private Node |
_createNode(Time invocationTime,
int actionType,
java.lang.Object actor)
Create TDL action and a new node. |
private Node |
_createNode(Time invocationTime,
int actionType,
java.lang.Object actor,
Node previous)
Create a TDL action and a new node with an edge to the previous node |
private void |
_getActuators(Refinement refinement,
Time modePeriod)
Add actuator updates to the graph. |
private java.util.List<Node> |
_getForwardReachableIndependentNodes(Node node,
java.util.List<Node> visited)
Recursively compute the list of forward reachable nodes that only depend on one previous node and are scheduled for the same time as the current node. |
private java.util.ArrayList |
_getInvocations(java.lang.String slots,
int frequency)
Analyze the slot selection string. |
private Node |
_getLastNodeBeforeTime(IOPort port,
Time upper)
Return invocation of node for a port closest to a given time. |
private void |
_getTasks(State mode,
Refinement refinement,
Time modePeriod)
Create subgraphs for all tasks, interconnect them with mode switches and other tasks. |
private void |
_getTransitions(State mode,
Refinement refinement,
Time modePeriod)
First read transitions and build subgraphs for the transitions. |
private boolean |
_nextCharIsANumber(java.lang.String slotSelection,
int i)
Return true if the character at position i in the string slotSeleciton is a number. |
private void |
_registerModeSwitch(State state,
Node transition,
Node transitionNotTaken)
Store mode switches. |
private void |
_registerSensorReading(Time invocationTime,
IOPort sensor)
Save that a sensor value was read at a certain point in time. |
private void |
_registerTaskInputPortReading(Time invocationTime,
IOPort port)
Save the times a task input port was written. |
private void |
_resetsTempVars()
Reset temporary variables used to create the graph for one mode. |
void |
buildGraph(State startmode)
Build the graph by iterating through all the modes of the TDL module. |
java.util.List<Node> |
getEventsFollowingAction(Node node)
Returns all forward reachable nodes in the graph that are connected to the given node. |
java.util.HashMap<Node,java.util.List<TDLAction>> |
getNextJoinNodes(Node justExecuted,
Node node,
java.util.List<Node> visited)
Recursively compute the set of nodes reachable from a given node that depend on more than one node or are scheduled to happen at a future time. |
Node |
getNode(java.lang.Object actor,
Time lower,
Time upper)
Get a node which executes a given actor. |
Node |
getNode(TDLAction action)
Get node for a given TDLAction. |
Node |
getNode(Time invocationTime,
java.lang.Object actor)
Return the node that is used for the execution of an actor at a certain time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private FSMActor _controller
private DirectedGraph _graph
private java.util.HashMap<State,java.util.List> _modeSwitches
private TDLModule _module
private java.util.HashMap _tmpConnectedTaskPorts
private java.util.HashMap<Time,Node> _tmpModeSwitchEnds
private java.util.HashMap<Time,Node> _tmpModeSwitchStarts
private java.util.HashMap<Time,java.util.List> _tmpReadSensors
private java.util.HashMap<IOPort,java.util.List<Time>> _tmpReadTaskInputPorts
Constructor Detail |
---|
public TDLActionsGraph(TDLModule module, FSMActor controller)
module
- The TDL module.controller
- The controller of the TDL module.Method Detail |
---|
public void buildGraph(State startmode) throws IllegalActionException
startmode
- This is the initial mode of the TDL module.
IllegalActionException
- Thrown if TDL parameters in the module cannot be read.public java.util.List<Node> getEventsFollowingAction(Node node)
node
- Given node.
public java.util.HashMap<Node,java.util.List<TDLAction>> getNextJoinNodes(Node justExecuted, Node node, java.util.List<Node> visited)
justExecuted
- Node that was just executed.node
- Node from which the reachable Nodes are computed.visited
- Already visited nodes, used to avoid loops.
public Node getNode(Time invocationTime, java.lang.Object actor)
invocationTime
- Time the actor is being invoked.actor
- Actor that is scheduled for that time.
public Node getNode(TDLAction action)
action
- Given TDLAction.
public Node getNode(java.lang.Object actor, Time lower, Time upper)
actor
- Actor that is executed.lower
- Lower time bound.upper
- Upper time bound.
private void _addConnectionsBetweenTaskPorts()
private LetTask _analyzeSlotSelection(TDLTask actor, Time modePeriodTime) throws IllegalActionException
actor
- modePeriodTime
-
IllegalActionException
TDLModeSchedulerException
private void _connectModes() throws IllegalActionException
IllegalActionException
- If new Time cannot be created.private void _connectToIntermediateModeSwitch(Node prev, Time actorInvocationTime, Time actorInvocationPeriod)
prev
- Previous node to connect to.actorInvocationTime
- Invocation time of that actor.actorInvocationPeriod
- Invocation period of that actor.private void _connectToOtherTasksOutputPorts(IOPort taskInputPort)
taskInputPort
- private Node _createNode(Time invocationTime, int actionType, java.lang.Object actor, Node previous)
invocationTime
- Invocation time of the node.actionType
- Action type of the TDL action in the node.actor
- Actor of the TDL action.previous
- Previous node.
private Node _createNode(Time invocationTime, int actionType, java.lang.Object actor)
invocationTime
- Invocation time of the node.actionType
- Action type of the TDL action in the node.actor
- Actor of the TDL action.
private void _getActuators(Refinement refinement, Time modePeriod)
refinement
- Refinement containing the actuator ports.modePeriod
- Period of the mode defined by the refinement.private java.util.List<Node> _getForwardReachableIndependentNodes(Node node, java.util.List<Node> visited)
node
- Node from which the reachable nodes are computed from.visited
- Already visited nodes to avoid loops.
private java.util.ArrayList _getInvocations(java.lang.String slots, int frequency) throws IllegalActionException
slots
- frequency
-
IllegalActionException
private Node _getLastNodeBeforeTime(IOPort port, Time upper)
port
- upper
-
private void _getTasks(State mode, Refinement refinement, Time modePeriod) throws IllegalActionException
refinement
- modePeriod
-
TDLModeSchedulerException
IllegalActionException
private void _getTransitions(State mode, Refinement refinement, Time modePeriod)
mode
- refinement
- modePeriod
-
IllegalActionException
TDLModeSchedulerException
private boolean _nextCharIsANumber(java.lang.String slotSelection, int i)
slotSelection
- i
-
private void _registerModeSwitch(State state, Node transition, Node transitionNotTaken)
state
- transition
- transitionNotTaken
- private void _registerSensorReading(Time invocationTime, IOPort sensor)
invocationTime
- Time the sensor is read.sensor
- Sensor that is read.private void _registerTaskInputPortReading(Time invocationTime, IOPort port)
invocationTime
- Time the port is read.port
- Port that is read.private void _resetsTempVars()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |