Example 1: Transition Between States

This simple state machine models a light switch. At the beginning, the lamp is off, the state dark is active. The trigger event trigger occurs and initiates the evaluation of the state machine. The light switch is pressed, so that the condition switch_on is true.

The following steps are executed:

  1. The state diagram checks to see if there is a valid transition.
  2. The dark state is active so that only the transition from dark to bright has to be evaluated. The condition [switch_on] is fulfilled, the transition is valid.
  3. The dark state has no exit action that could be executed. It is deactivated.
  4. The transition action is executed, the counter switch_count is increased by 1.
  5. The bright state is activated.
  6. The lamp_on entry action is executed and completed. The lamp is switched on.

    With that, the evaluation of the state machine initiated by this trigger event is finished.