Stateflow    

Transition Label Notation

A transition is characterized by its label. The label can consist of an event, a condition, a condition action, and/or a transition action. The ? character is the default transition label. Transition labels have the following general format:

You replace the names for event, condition, condition_action, and transition_action with appropriate contents as shown in the example Transition Label Example. Each part of the label is optional.

The action you specify in transition labels forms a part of Stateflow action language. See Action Language.

Transition Label Example

Use the transition label in the following example to understand the parts of a transition label.

Event.   The specified event is what causes the transition to be taken, provided the condition, if specified, is true. Specifying an event is optional. Absence of an event indicates that the transition is taken upon the occurrence of any event. Multiple events are specified using the OR logical operator (|).

In this example, the broadcast of event E triggers the transition from On to Off provided the condition [off_count==0] is true.

Condition.   A condition is a Boolean expression to specify that a transition occurs given that the specified expression is true. Enclose the condition in square brackets ([]). See Condition Statements for information on the condition notation.

In this example, the condition [off_count==0] must evaluate as true for the condition action to be executed and for the transition from the source to the destination to be valid.

Condition Action.   A condition action follows the condition for a transition and is enclosed in curly braces ({}). It is executed as soon as the condition is evaluated as true and before the transition destination has been determined to be valid. If no condition is specified, an implied condition evaluates to true and the condition action is executed. See Action Language for more information on condition actions in action language.

In this example, if the condition [off_count==0] is true, the condition action off_count++ is immediately executed.

Transition Action.   The transition action is executed after the transition destination has been determined to be valid provided the condition, if specified, is true. If the transition consists of multiple segments, the transition action is only executed when the entire transition path to the final destination is determined to be valid. Precede the transition action with a backslash. See Action Language for more information on the action language.

In this example, if the condition [off_count==0] is true, and the destination state Off is valid, the transition action Light_off is executed.


  Transitions Valid Transitions