Defining transition specifications

A transition specification can contain triggers, a guard, and a behavior expression in the following general format:

trigger(s) [guard] / behavior

      trigger: one or more optional events that cause the transition to occur, provided that the guard, if specified, is TRUE. Separate multiple triggers with commas. For multiple triggers, as long as at least one trigger is active the transition, and the guard, if specified, is TRUE, the transition occurs. For more information on triggers, see Working with triggers.

      [guard]: an optional Boolean condition that, when TRUE, allows the transition to occur for the specified triggers. Enclose the guard in square brackets [].

      / behavior: one or more optional C statements that are executed after the source state is exited and before the target state is entered. The forward slash (/) is mandatory, even if there are no triggers or guards.

The full BNF notation for the transition specification is:

[<trigger> [‘,’ <trigger>] * [‘[‘ <guard>’]’] [‘/’ <behavior>]]

In the following example, a pump switches from a draining mode to idle mode based on the transition specification:

trigger guard behavior transition spefication

The trigger not-running causes the transition of the pump from ON to IDLE as long as the condition [level <=0] is TRUE.

To create a transition specification

1.    Do one of the following:

      Double-click the transition.

      Click the transition to highlight it in purple; then right-click and select Properties from the pop-up menu.

2.    Right-click to access the Properties dialog box.

3.    Under Edit Action, enter the transition specification, as described above.

You specify a C expression guard in the Edit Action area of the Transition Properties dialog box. You must surround the expression with square brackets. Click the OK button to complete the transition behavior.

After you specify a behavior, it will appear over the transition in the state chart. You can move the rule by clicking on it and dragging to a new location. If you move the state or transition, the rule will maintain its relative location on the transition.