Stateflow    

If-Then-Else Decision Construct Example

This example shows the behavior of an if-then-else decision construct.

Initially the Stateflow diagram is asleep. State A is active. Event E_one occurs and awakens the Stateflow diagram. Condition [C_two] is true. Event E_one is processed from the root of the Stateflow diagram down through the hierarchy of the Stateflow diagram:

  1. The Stateflow diagram root checks to see if there is a valid transition as a result of E_one.
  1. There is a valid transition segment from state A to the connective junction. The transition segments beginning from a twelve o'clock position on the connective junction are evaluated for validity. The first transition segment, labeled with condition [C_one], is not valid. The next transition segment, labeled with the condition [C_two], is valid. The complete transition from state A to state C is valid.

  1. State A exit actions (exitA()) execute and complete.
  2. State A is marked inactive.
  3. State C is marked active.
  4. State C entry actions (entC()) execute and complete.
  5. The Stateflow diagram goes back to sleep, waiting to be awakened by another event.

This sequence completes the execution of this Stateflow diagram associated with event E_one.


  Label Format for Transition Segments Example Self-Loop Transition Example