|
|||||||||
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.NonStrictFSMDirector
public class NonStrictFSMDirector
This director extends FSMDirector by consuming only input tokens that are needed in the current state. An input port will consume at most one token if:
1. The port is referred by any guard expression of the preemptive transitions leaving the current state, the output actions and/or set actions of the enabled transition.
2. No preemptive transition is enabled and the port is referred by the refinements of the current state, any guard expression of the nonpreemptive transitions leaving the current state, the output actions and/or set actions of the enabled transition.
A port is said to be referred by a guard/output action/set action expression of a transition if the port name appears in that expression. A port is said to be referred by a state refinement if the it is not a dangling port and has a consumption rate greater than zero in the refinement.
FIXME: This is highly preliminary. Missing capabilities: FIXME: Currently this director uses the default receiver of FSMDirector, which is a mailbox, so there is no way to consume more than one token. This director could use a different receiver and support a syntax in the guard expression language to support consumption of more than one token.
Red (cxh) |
Red (zhouye) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
private java.util.Set |
_nonpreemptiveTransitionsInputs
|
private java.util.Set |
_outputActionReferredInputPorts
|
private java.util.Set |
_preemptiveTransitionsInputs
|
private java.util.Set |
_referredInputPorts
|
private java.util.Set |
_refinementReferredInputPorts
|
private java.util.Set |
_setActionReferredInputPorts
|
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 | |
---|---|
NonStrictFSMDirector(CompositeEntity container,
java.lang.String name)
Construct a director in the given container with the given name. |
Method Summary | |
---|---|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace. |
void |
fire()
Fire the modal model. |
void |
getNonpreemptiveTransitionsReferredInputPorts(State state)
Given a state, get a set of input ports referred in the guards of the preemptive transitions leaving that state. |
void |
getOutputActionsReferredInputPorts(Transition transition)
Given a transition, get a set of input ports referred in the outputActions of that transition. |
void |
getPreemptiveTransitionsReferredInputPorts(State state)
Given a state, get a set of input ports referred in the guards of the nonpreemptive transitions leaving that state. |
void |
getReferredInputPorts(java.util.Set portSet,
java.util.Set referredInputPorts)
Given a set of ports, get those are input ports and put them in the indicated referred set. |
void |
getRefinementReferredInputPorts(State state)
Given a state, get a set of input ports referred by the refinements of that state. |
void |
getSetActionsReferredInputPorts(Transition transition)
Given a transition, get a set of input ports referred in the set actions of that transition. |
java.util.Set |
getTransitionReferredInputPorts(java.util.List transitionList)
Given a list of transitions, get a set of referred input ports in the guard expressions of all the transitions leaving this state. |
void |
initialize()
Initialize the director. |
boolean |
postfire()
Call the postfire() method of the super class. |
boolean |
transferInputs(IOPort port)
Override the super class by only transferring inputs for those input ports that are referred by the guard expressions of the preemptive transitions leaving the current state. |
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 java.util.Set _nonpreemptiveTransitionsInputs
private java.util.Set _outputActionReferredInputPorts
private java.util.Set _preemptiveTransitionsInputs
private java.util.Set _referredInputPorts
private java.util.Set _refinementReferredInputPorts
private java.util.Set _setActionReferredInputPorts
Constructor Detail |
---|
public NonStrictFSMDirector(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 java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class FSMDirector
workspace
- The workspace for the new actor.
java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
If no preemptive transition is enabled, get additional input ports referred by the refinements of the current state and transfer at most one token from these input ports. Fire the refinements. After this, get additional input ports referred by the nonpreemptive transitions from the current state and transfer at most one token from these input ports. Then examine the nonpreemptive transitions. If there is more than one transition enabled, an exception is thrown. If there is exactly one nonpreemptive transition enabled, then it is chosen. Get additional input ports referred by the output actions and set actions of the enabled transition and executed the output actions.
fire
in interface Executable
fire
in class FSMDirector
IllegalActionException
- If the super class throws it.public void getNonpreemptiveTransitionsReferredInputPorts(State state) throws IllegalActionException
state
- The given state.
IllegalActionException
- If there is no controller or
if any guard expression is illegal.public void getOutputActionsReferredInputPorts(Transition transition) throws IllegalActionException
transition
- The transition.
IllegalActionException
- If there is no controller or if
the outputActions is illegal.public void getPreemptiveTransitionsReferredInputPorts(State state) throws IllegalActionException
state
- The given state.
IllegalActionException
- If there is no controller or
if any guard expression is illegal.public void getReferredInputPorts(java.util.Set portSet, java.util.Set referredInputPorts)
portSet
- The given set of portsreferredInputPorts
- The referred set.public void getRefinementReferredInputPorts(State state) throws IllegalActionException
state
- The given state.
IllegalActionException
- If refinement with given name is not
found, or if the port rate does not contain a valid expression.public void getSetActionsReferredInputPorts(Transition transition) throws IllegalActionException
transition
- The given transition.
IllegalActionException
- If there is no controller or
if any set action expression is illegal.public java.util.Set getTransitionReferredInputPorts(java.util.List transitionList) throws IllegalActionException
transitionList
- The list of Transitions.
IllegalActionException
- If there is no controller or if
the guard expression is illegal.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class FSMDirector
IllegalActionException
- If the super class throws it.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class FSMDirector
IllegalActionException
- If the super class throws it.public boolean transferInputs(IOPort port) throws IllegalActionException
transferInputs
in class FSMDirector
port
- The input port to transfer tokens from.
IllegalActionException
- If the port is not an opaque
input port.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |