Book a Demo

Author Topic: State machine simulation not UML conformant  (Read 3077 times)

astradss

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
State machine simulation not UML conformant
« on: November 03, 2013, 08:03:00 am »
Hi,
with my understanding and interpretation of UML standard the state machine simulation does not follow the standard when it comes to choice points.

Example (textual, since pictures can not be uploaded?):
InitialState -> State1 (transition from initial to State1 set testVar=0)
State1 -> ChoicePoint1 (transition increments testVar with one, it is fired by event1)
ChoicePoint1 -> State2 (transition have guard: testVar ==1)
ChoicePoint1 -> State3 (transition have guard: testVar != 1)

So when State1 is active, after coming from InitalState, testVar = 0.
When event1 fires compound transition from State1 to ChoicePoint1, testVar is incremented to 1 before the ChoicePoint is reached. But the simulation transitions to State3, hence it takes the transition where the guard is testVar != 1, but testVar = 1 when ChoicePoint1 is reached. Hence the transition to State2 should have been taken.

Why do I think this? A choice point in UML is a dynamic decision point, and guards after it should be evaluated at the choice point, and not as usual, before the compound transition is taken (so the choice point is semantically implemented as a junction / static branch in the EA state machine semantic) =>

From UML standard:
---
Guards
In a simple transition with a guard, the guard is evaluated before the transition is triggered.
In compound transitions involving multiple guards, all guards are evaluated before a transition is triggered, unless there are choice points along one or more of the paths. The order in which the guards are evaluated is not defined.
If there are choice points in a compound transition, only guards that precede the choice point are evaluated according to the above rule. Guards downstream of a choice point are evaluated if and when the choice point is reached (using the same rule as above). In other words, for guard evaluation, a choice point has the same effect as a state.
Guards should not include expressions causing side effects. Models that violate this are considered ill-formed.
---
Question: Do you agree with my interpretation and understanding of choice points - and hence the EA state machine semantic is non-conformant with UML?