Documentation

transitions

Define transitions between modes in mode chart

Syntax

transitions from_mode -> to_mode : predicate_condition end     

Description

transitions begins a transitions declaration block in a mode chart. The transitions block, terminated by an end keyword, can contain one or more transition constructs.

Each transition construct has the following syntax:

from_mode -> to_mode : predicate_condition

where:

  • from_mode is the mode active before the transition.

  • to_mode is the mode active after the transition.

  • predicate_condition is the expression that needs to be true for the transition to happen.

For example, if a mode chart declares two modes, m1 and m2, the following syntax specifies that the system transitions from mode m1 to mode m2 when the p1 predicate is true:

transitions
    m1 -> m2 : p1
end

If multiple predicates become true simultaneously, the transition priority is defined by the order they are listed. For example, a mode chart declares three modes, m1, m2, and m3, and defines the following transitions:

transitions
    m1 -> m2 : p1
    m1 -> m3 : p2
end

If predicates p1 and p2 become true simultaneously, the system transitions from mode m1 to mode m2 (the first transition listed).

Introduced in R2017a

Was this topic helpful?