next up previous contents
Next: 2.5.13 An example of Up: 2.5 More Examples Previous: 2.5.11 An example of   Contents

2.5.12 An example of priority numbers

Priority numbers of transitions are arbitrary integer numbers used to solve conflicts that cannot be solved with the ITF and OTF mechanism. An example (prio2.des) is shown below:

STATECHART:
    A [DS]
      A1 [DS] [CS]
      A2 [DS] [CS]

TRANSITION:
    S: A.A1
    N: A.A1
    E: e
    O: [DUMP("transition from A.A1")]

TRANSITION:
    S: A.A2
    N: A.A2
    E: e
    O: [DUMP("transition from A.A2")]

TRANSITION: [0]
    S: A
    N: A
    E: f
    O: [DUMP("transition 1 from A")]

TRANSITION: [-1]
    S: A
    N: A
    E: f
    O: [DUMP("transition 2 from A")]

The simulation result is as following:

['A.A1', 'A.A2'] > e
transition from A.A1
transition from A.A2
['A.A1', 'A.A2'] > f
transition 2 from A
['A.A1', 'A.A2'] > exit

When event e is received in this model, two transitions are able to handle it. However, there is no conflict, because the two transitions are from two different orthogonal components A.A1 and A.A2. Because of this, both of the transitions are triggered, and two messages are printed to the console. (The sequence of the triggering of those transitions is implementation-dependent.) When event f is received, two transitions are able to handle it, but they are from the same state. A conflict occurs at this time, and only one of those transitions is triggered. The ITF and OTF scheme can not be applied to this situation, because there is no superstate-substate relation between their source state. In this case, the transition with a smaller priority number has higher total priority. As a result, the last transition is triggered.

By default, each transition has a priority number of 0. If the conflict still cannot be solved with priority numbers, the final decision is implementation dependent.


next up previous contents
Next: 2.5.13 An example of Up: 2.5 More Examples Previous: 2.5.11 An example of   Contents
Thomas Huining Feng
2004-04-05