
FSMActor |
ptolemy.domains.fsm.kernel.FSMActor |
An FSMActor contains a set of states and transitions. A transition has
a guard expression and a trigger expression. 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 a set of actions.
<p> When an FSMActor is fired, the outgoing transitions of the current state
are examined. An IllegalActionException is thrown if there is more than one
enabled transition. If there is exactly one enabled transition then it is
chosen and the choice actions contained by the transition are executed.
An FSMActor does not change state during successive firings in one iteration
in order to support domains that iterate to a fixed point. When the FSMActor
is postfired, the chosen transition of the latest firing of the actor is
committed. The commit actions contained by the transition are executed and
the current state of the actor is set to the destination state of the
transition.
<p> An FSMActor enters its initial state during initialization. The
name of the initial state is specified by the <i>initialStateName</i>
string attribute. When the actor reaches a final state, then the
postfire method will return false, indicating that the actor does not
wish to be fired again. The <i>finalStateNames</i> string attribute
is a comma-separated list of the names of final states.
<p> The guards and actions of FSM transitions are specified using
expressions. These expressions are evaluated in the scope returned by
getPortScope. This scope binds identifiers for FSM ports as defined
in the following paragraph. These identifiers are in the scope of
guard and action expressions prior to any variables, and may shadow
variables with appropriately chosen names. Given appropriately chosen
port names, there may be conflicts between these various identifiers.
These conflicts are detected and an exception is thrown during
execution.
<p> For every input port, the identifier
"<i>portName</i>_<i>channelIndex</i>" refers to the last input
received from the port on the given channel. The type of this
identifier is the same as the type of the port. This token may have
been consumed in the current firing or in a previous firing. The
identifier "<i>portName</i>_<i>channelIndex</i>_isPresent" is true if
the port consumed an input on the given channel in the current firing
of the FSM. The type of this identifier is always boolean. Lastly,
the identifier "<i>portName</i>_<i>channelIndex</i>Array" refers the
array of all tokens consumed from the port in the last firing. This
identifier has an array type whose element type is the type of the
corresponding input port. Additionally, for conciseness when
referencing single ports, the first channel may be referred to without
the channel index, i.e. by the identifiers "<i>portName</i>",
"<i>portName</i>_<i>isPresent</i>", and "<i>portName</i>Array".
<p> An FSMActor can be used in a modal model to represent the mode
control logic. A state can have a TypedActor refinement. A transition
in an FSMActor 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 can only be chosen after the
refinement of its source state is fired.
Author(s): Xiaojun Liu, Haiyang Zheng, Ye Zhou
Version:$Id: FSMActor.doc.html,v 1.1 2006/02/22 18:40:27 mangal Exp $
Pt.Proposed Rating:Yellow (liuxj)
Pt.Accepted Rating:Yellow (kienhuis)