|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.kernel.util.NamedObj
ptolemy.kernel.Relation
ptolemy.kernel.ComponentRelation
ptolemy.domains.fsm.kernel.Transition
A Transition has a source state and a destination state. A transition has a guard expression and a trigger expression. Both expressions should evaluate to a boolean value. The trigger of a transition must be true whenever the guard is true. A transition is enabled and can be taken when its guard is true. A transition is triggered and must be taken when its trigger is true.
A transition can contain actions. The way to specify actions is to give value to the outputActions parameter and the setActions parameter. The value of these parameters is a string of the form:
command; command; ...where each command has the form:
destination = expressionFor the outputActions parameter, destination is either
portNameor
portName(channelNumber)Here, portName is the name of a port of the FSM actor, If no channelNumber is given, then the value is broadcast to all channels of the port.
For the setActions parameter, destination is
variableNamevariableName identifies either a variable or parameter of the FSM actor, or a variable or parameter of the refinement of the destination state of the transition. To give a variable of the refinement, use a dotted name, as follows:
refinementName.variableNameThe expression is a string giving an expression in the usual Ptolemy II expression language. The expression may include references to variables and parameters contained by the FSM actor.
The outputActions and setActions parameters are not the only ways to specify actions. In fact, you can add action attributes that are instances of anything that inherits from Action. (Use the Add button in the Edit Parameters dialog).
An action is either a ChoiceAction or a CommitAction. The setActions parameter is a CommitAction, whereas the outputActions parameter is a ChoiceAction. A commit action is executed when the transition is taken to change the state of the FSM, in the postfire() method of FSMActor. A choice action, by contrast, is executed in the fire() method of the FSMActor when the transition is chosen, but not yet taken. The difference is subtle, and for most domains, irrelevant. A few domains, however, such as CT, which have fixed point semantics, where the fire() method may be invoked several times before the transition is taken (committed). For such domains, it is useful to have actions that fulfill the ChoiceAction interface. Such actions participate in the search for a fixed point, but do not change the state of the FSM.
A transition can be preemptive or non-preemptive. When a preemptive transition is chosen, the refinement of its source state is not fired. A non-preemptive transition is only chosen after the refinement of its source state is fired.
The reset parameter specifies whether the refinement of the destination state is reset when the transition is taken. There is no reset() method in the Actor interface, so the initialize() method of the refinement is called. Please note that this feature is still under development.
State,
Action,
ChoiceAction,
CommitAction,
CommitActionsAttribute,
FSMActor,
OutputActionsAttribute,
Serialized Form
| Yellow (liuxj) |
| Yellow (liuxj) |
| Nested Class Summary |
| Nested classes inherited from class ptolemy.kernel.util.NamedObj |
NamedObj.ContainedObjectsIterator |
| Field Summary | |
Parameter |
exitAngle
Attribute the exit angle of a visual rendition. |
Parameter |
gamma
Attribute giving the orientation of a self-loop. |
StringAttribute |
guardExpression
Attribute specifying the guard expression. |
OutputActionsAttribute |
outputActions
The action commands that produce outputs when the transition is taken. |
Parameter |
preemptive
Parameter specifying whether this transition is preemptive. |
StringAttribute |
refinementName
Attribute specifying one or more names of refinements. |
Parameter |
reset
Parameter specifying whether the refinement of the destination state is reset when the transition is taken. |
CommitActionsAttribute |
setActions
The action commands that set parameters when the transition is taken. |
StringAttribute |
triggerExpression
Attribute specifying the trigger expression. |
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
| Constructor Summary | |
Transition(FSMActor container,
java.lang.String name)
Construct a transition with the given name contained by the specified entity. |
|
Transition(Workspace workspace)
Construct a transition in the given workspace with an empty string as a name. |
|
| Method Summary | |
protected void |
_checkPort(Port port)
Throw an IllegalActionException if the port cannot be linked to this transition. |
void |
attributeChanged(Attribute attribute)
React to a change in an attribute. |
java.util.List |
choiceActionList()
Return the list of choice actions contained by this transition. |
java.lang.Object |
clone(Workspace workspace)
Clone the transition into the specified workspace. |
java.util.List |
commitActionList()
Return the list of commit actions contained by this transition. |
State |
destinationState()
Return the destination state of this transition. |
java.lang.String |
getGuardExpression()
Return the guard expression. |
java.lang.String |
getLabel()
Return a string describing this transition. |
TypedActor[] |
getRefinement()
Return the refinements of this transition. |
RelationList |
getRelationList()
Return the trigger expression. |
java.lang.String |
getTriggerExpression()
Return the trigger expression. |
boolean |
isEnabled()
Return true if the transition is enabled, that is the guard is true, or some event has been detected due to crossing some level. |
boolean |
isPreemptive()
Return true if this transition is preemptive. |
boolean |
isTriggered()
Return true if the transition is triggered. |
void |
setContainer(CompositeEntity container)
Override the base class to ensure that the proposed container is an instance of FSMActor or null; if it is null, then remove it from the container, and also remove any refinement(s) that it references that are not referenced by some other transition or state. |
void |
setGuardExpression(java.lang.String expression)
Set the guard expression. |
void |
setTriggerExpression(java.lang.String expression)
Set the trigger expression. |
State |
sourceState()
Return the source state of this transition. |
| Methods inherited from class ptolemy.kernel.ComponentRelation |
_checkContainer, _propagateExistence, deepLinkedPortList, deepLinkedPorts, getContainer, setName, unlinkAll |
| Methods inherited from class ptolemy.kernel.Relation |
_description, _getContainedObject, _getPortList, linkedPortList, linkedPortList, linkedPorts, linkedPorts, numLinks |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public Parameter exitAngle
public Parameter gamma
public StringAttribute guardExpression
public OutputActionsAttribute outputActions
public Parameter preemptive
public Parameter reset
public CommitActionsAttribute setActions
public StringAttribute triggerExpression
public StringAttribute refinementName
| Constructor Detail |
public Transition(Workspace workspace)
throws IllegalActionException,
NameDuplicationException
workspace - The workspace for synchronization and version
tracking.
public Transition(FSMActor container,
java.lang.String name)
throws IllegalActionException,
NameDuplicationException
container - The container.name - The name of the transition.
IllegalActionException - If the container is incompatible
with this transition.
NameDuplicationException - If the name coincides with
any relation already in the container.| Method Detail |
public void attributeChanged(Attribute attribute)
throws IllegalActionException
attributeChanged in class NamedObjattribute - The attribute that changed.
IllegalActionException - If thrown by the superclass
attributeChanged() method, or the changed attribute is the
preemptive parameter and is given an expression that
does not evaluate to a boolean value.public java.util.List choiceActionList()
public java.lang.Object clone(Workspace workspace)
throws java.lang.CloneNotSupportedException
clone in class ComponentRelationworkspace - The workspace for the new transition.
java.lang.CloneNotSupportedException - If a derived class contains
an attribute that cannot be cloned.public java.util.List commitActionList()
public State destinationState()
public java.lang.String getGuardExpression()
public java.lang.String getLabel()
public TypedActor[] getRefinement()
throws IllegalActionException
IllegalActionException - If the specified refinement
cannot be found, or if a comma-separated list is malformed.public RelationList getRelationList()
public java.lang.String getTriggerExpression()
public boolean isEnabled()
throws IllegalActionException
IllegalActionException - If thrown when evaluating the guard.public boolean isPreemptive()
public boolean isTriggered()
throws IllegalActionException
IllegalActionException - If thrown when evaluating the
trigger, or the trigger is true but the guard is false.
public void setContainer(CompositeEntity container)
throws IllegalActionException,
NameDuplicationException
setContainer in class ComponentRelationcontainer - The proposed container.
IllegalActionException - If the transition would result
in a recursive containment structure, or if
this transition and container are not in the same workspace, or
if the argument is not a FSMActor or null.
NameDuplicationException - If the container already has
an relation with the name of this transition.ComponentRelation.getContainer()public void setGuardExpression(java.lang.String expression)
expression - The guard expression.public void setTriggerExpression(java.lang.String expression)
expression - The trigger expression.public State sourceState()
protected void _checkPort(Port port)
throws IllegalActionException
_checkPort in class ComponentRelationport - The port to link to.
IllegalActionException - If the port cannot be linked
to this transition.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||