next up previous contents index
Next: 2.3.2 Alternate Algorithm for Up: 2.3 Algorithms Previous: 2.3 Algorithms   Contents   Index


2.3.1 Firing a Transition

Every time an event is received, the transition that becomes enabled with the highest total priority is fired. To fire a transition $T$, the following algorithm is used:

  1. Output actions in $\lambda$ of $T$ are executed.

  2. Here are some definitions:

    Common superstates are the set of common superstates of two or more states ($s_1$,$s_2$,...,$s_n$). They are defined as:

    \begin{displaymath}
Common(s_1,s_2,...,s_n)= \{s\vert s_1\in Substate(s) \wedge s_2\in
Substate(s) \wedge ... \wedge s_n\in Substate(s)\}
\end{displaymath}

    The Closest Common Superstate $CCS$ (David Harel has called it LCA, which is short for Lowest Common Ancestor) of $s_1,s_2,...,s_n$ is defined as:

    \begin{displaymath}
CCS(s_1,s_2,...,s_n)=s\ \cdot\ (s\in Common(s_1,s_2,...,s_n...
...t\ (s'\in Substate(s) \wedge s'\in
Common(s_1,s_2,...,s_n)))
\end{displaymath}

    In this step, $CCS(SRC,DES)$ is decided. The model exits $SRC$ and all the states in the path from $CCS(SRC,DES)$ (not including $CCS(SRC,DES)$ itself). The exit actions of a state at a lower level are executed before the exit actions of a state at a higher level. If $CCS(SRC,DES)$ cannot be found (i.e., $SRC$ and $DES$ have no common superstate, or $Common(SRC,DES)=\o$), all the current states are exited, and all their exit actions are executed in the correct order. (If we imagine there is a top state $\top$ that encloses all the states in a model, the $CCS$ in this case is $\top$.)

    Exit actions of orthogonal components belonging to the same parent are executed in an implementation-dependent order. This is because orthogonal components are logically simultaneous, and the designers should never make the behavior of their models dependent on the execution sequence of the actions among different orthogonal components.

  3. All the states in the path from $CCS(SRC,DES)$ (not inclusive) to $DES$ are entered. The enter actions of a state at a higher level are executed before the enter actions of a state at a lower level. The enter actions (if any) of $DES$ are executed last.

    Enter actions of orthogonal components belonging to the same parent are executed in an implementation-dependent order.

If $SRC=DES$, in which case the transition is a self-loop, the enter/exit actions of the state are executed, because $CCS(SRC,DES)$ is equal to the parent state of $SRC$ (or $DES$).


next up previous contents index
Next: 2.3.2 Alternate Algorithm for Up: 2.3 Algorithms Previous: 2.3 Algorithms   Contents   Index
Thomas Huining Feng 2004-04-28