
Transition |
ptolemy.domains.fsm.kernel.Transition |
A Transition has a source state and a destination state. A
transition has a guard expression, which is evaluated to a boolean value.
Whenever a transition is enabled, it must be taken immediately.
<p> A transition can contain actions. The way to specify actions is
to give value to the <i>outputActions</i> parameter and the
<i>setActions</i> parameter.
The value of these parameters is a string of the form:
<pre>
<i>command</i>; <i>command</i>; ...
</pre>
where each <i>command</i> has the form:
<pre>
<i>destination</i> = <i>expression</i>
</pre>
For the <i>outputActions</i> parameter, <i>destination</i> is either
<pre>
<i>portName</i>
</pre>
or
<pre>
<i>portName</i>(<i>channelNumber</i>)
</pre>
Here, <i>portName</i> is the name of a port of the FSM actor,
If no <i>channelNumber</i> is given, then the value
is broadcasted to all channels of the port.
<p>
For the <i>setActions</i> parameter, <i>destination</i> is
<pre>
<i>variableName</i>
</pre>
<i>variableName</i> 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:
<pre>
<i>refinementName</i>.<i>variableName</i>
</pre>
The <i>expression</i> 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.
<p>
The <i>outputActions</i> and <i>setActions</i> 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).
<p>
An action is either a ChoiceAction or a CommitAction. The <i>setActions</i>
parameter is a CommitAction, whereas the <i>outputActions</i> 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.
<p>
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.
<p>
The <i>reset</i> 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.
<p>
The <i>nondeterministic</i> parameter specifies whether this transition is
nondeterministic. Here nondeterministic means that this transition may not
be the only enabled transition at a time. The default value is a boolean
token with value as false, meaning that if this transition is enabled, it
must be the only enabled transition.
<p>
The <i>defaultTransition</i> parameter, if given a value true, specifies
that this transition is enabled if and only if no other non-default
transition is enabled.
Author(s): Xiaojun Liu, Edward A. Lee, Haiyang Zheng
Version:$Id: Transition.doc.html,v 1.1 2006/02/22 18:42:26 mangal Exp $
Pt.Proposed Rating:Yellow (hyzheng)
Pt.Accepted Rating:Red (hyzheng)
defaultTransition
Indicator that this transition is a default transition. A
default transition is enabled only if no other non-default
transition is enabled. This is a boolean with default value
false. If the value is true, then the guard expression is
ignored.
exitAngle
Attribute the exit angle of a visual rendition.
This parameter contains a DoubleToken, initially with value PI/5.
It must lie between -PI and PI. Otherwise, it will be truncated
to lie within this range.
gamma
Attribute giving the orientation of a self-loop. This is equal to
the tangent at the midpoint (more or less).
This parameter contains a DoubleToken, initially with value 0.0.
nondeterministic
Parameter specifying whether this transition is nondeterministic.
Here nondeterministic means that this transition may not be the only
enabled transition at a time. The default value is a boolean token
with value as false, meaning that if this transition is enabled, it
must be the only enabled transition.
preemptive
Parameter specifying whether this transition is preemptive.
reset
Parameter specifying whether the refinement of the destination
state is reset when the transition is taken.