|
|||||||||
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
public class ModalDirector
An ModalDirector governs the execution of a modal model. A modal model is a TypedCompositeActor with a ModalDirector as local director. The mode control logic is captured by a mode controller, an instance of FSMActor contained by the composite actor. Each state of the mode controller represents a mode of operation and can be refined by an opaque CompositeActor contained by the same composite actor.
This class differs from its base class in that it strictly follows the actor semantics. It does not invoke the postfire() method of any actors under its control until its own postfire() method is called. Thus, if those actors also follow the actor semantics, then no persistent changes are made in the prefire() or fire() methods.
When a modal model is fired, this director first transfers the input tokens from the outside domain to the mode controller and the refinement of its current state. The preemptive transitions from the current state of the mode controller are examined. If there is more than one transition enabled, and any of the enabled transitions is not marked nondeterministic, an exception is thrown. If there is exactly one preemptive transition enabled then it is chosen. The choice actions (outputActions) contained by the transition are executed. Any output token produced by the mode controller is transferred to both the output ports of the modal model and the input ports of the mode controller. Then the refinements associated with the enabled transition are fired. Any output token produced by the refinements is transferred to both the output ports of the modal model and the input ports of the mode controller. The refinements of the current state will not be fired.
If no preemptive transition is enabled, the refinements of the current state are fired. Any output token produced by the refinements is transferred to both the output ports of the modal model and the input ports of the mode controller. After this, the non-preemptive transitions from the current state of the mode controller are examined. If there is more than one transition enabled, and any of the enabled transitions is not marked nondeterministic, an exception is thrown. If there is exactly one non-preemptive transition enabled then it is chosen and the choice actions contained by the transition are executed. Any output token produced by the mode controller is transferred to the output ports of the modal model and the input ports of the mode controller. Then, the refinements of the enabled transition are executed. Any output token produced by the refinements is transferred to both the output ports of the modal model and the input ports of the mode controller.
At the end of one firing, the modal model transfers its outputs to the outside model. The mode controller does not change state during successive firings in one iteration of the top level in order to support upper level domains that iterate to a fixed point.
When the modal model is postfired, the chosen transition of the latest firing is committed. The commit actions contained by the transition are executed and the current state of the mode controller is set to the destination state of the transition.
FSMActor
,
Serialized Form
Red (hyzheng) |
Green (eal) |
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj |
---|
NamedObj.ContainedObjectsIterator |
Field Summary | |
---|---|
protected java.util.Set |
_actorsFired
Actors that were fired in the current iteration. |
private java.util.Set |
_disabledActors
Actors that have returned false in postfire(). |
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 | |
---|---|
ModalDirector(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 |
initialize()
Initialize this director. |
void |
invalidateSchedule()
Indicate that a schedule for the model may no longer be valid. |
boolean |
postfire()
Return true if the mode controller wishes to be scheduled for another iteration. |
boolean |
prefire()
Override the prefire() method of the super class to clear local variables. |
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 |
---|
protected java.util.Set _actorsFired
private java.util.Set _disabledActors
Constructor Detail |
---|
public ModalDirector(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
fire
in interface Executable
fire
in class FSMDirector
IllegalActionException
- If there is more than one
transition enabled, or there is no controller, or thrown by any
choice action.public boolean postfire() throws IllegalActionException
postfire
in interface Executable
postfire
in class FSMDirector
IllegalActionException
- If thrown by any commit action
or there is no controller.public boolean prefire() throws IllegalActionException
prefire
in interface Executable
prefire
in class FSMDirector
IllegalActionException
- If throw by the parent class.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class FSMDirector
IllegalActionException
- If the superclass throws it.public void invalidateSchedule()
invalidateSchedule
in class Director
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |