Transition Priorities are an extension of concepts found in STATEMATE statecharts, UML statecharts and DEVS (the select function). They are used to solve run-time conflicts between multiple transitions enabled by the same event at a given time. This case would make the model non-deterministic. [26]
Two possible kinds of transition conflicts are described in [5].
(Note that if those transitions have source states in different orthogonal components, no conflict occurs and all those transitions are triggered by the same event. In that case, the order of the firing of those transitions is random or implementation-dependent.)
Solutions to the first kind of conflicts are found in both the STATEMATE semantics [5] and the UML [27]. Unfortunately, the solutions from the two sources are opposite: in UML, if the source state of a transition is a substate of the source state of the others, it gets higher priority; however, in the STATEMATE semantics, it gets lower priority.
In DCharts, it is possible to customize the priority of transitions by
setting the attribute of states (1st-round decision) and the
attribute of transitions (2nd-round decision). The semantics
of the different values of
is formalized below (function
is the total priority number of transition
;
and
are transitions;
is the
of
;
is
the
of
):
If is set to be inner-transition-first (ITF), and
is a substate of
, then the total priority of
is
lower than that of
, or the total priority number of
is
larger than that of
.
If is set to be outer-transition-first (OTF), and
is a substate of
, then the total priority of
is
higher than that of
, or the total priority number of
is smaller than that of
.
Suppose there are three transitions t1, t2 and t3 as
illustrated in Figure 2.3. When event e occurs,
they are all enabled, so there is a conflict of the first kind. To
understand the priority of these transitions, one must first consider
the outermost state and step inward from there. Because S1 is
specified to be , the priority of t1 must be lower than
both t2 and t3. Since S2 is
, t2 has a
higher priority than t3. So the ordering by priority is t2, t3, t1. Detailed explanation of the graphical
representation of DCharts models is in section 4.1.
The above scheme cannot solve the second type of conflicts. In case of
such a conflict, the transition with the smallest number is
fired. It is the designer's responsibility to ensure that this
situation does not occur, or even if it occurs, there is a unique
decision among the conflicting transitions according to their
numbers. If the choice is not unique (more than one transition has the
smallest
number), the transition that is fired is
random or implementation-dependent.