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).

At initialization time, the solver sets the initial mode first, and then checks the transitions. If a transition predicate is true at initialization time, the system might start in a different mode than that listed first (or specified by the initial construct). For example, consider a mode chart that declares two modes, m1 and m2, and defines the following transition:

transitions
    m1 -> m2 : p1
end

If predicate p1 is true at initialization time, the system immediately transitions from mode m1 (the first mode listed) to mode m2, and simulation starts in mode m2.

Introduced in R2017a