Stateflow    

Debugging State Inconsistencies

Stateflow notations specify that states are consistent if

A state inconsistency error has occurred if, after a Stateflow diagram completes an update, the diagram violates any of the preceding notation rules.

Causes of State Inconsistency

State inconsistency errors are most commonly caused by the omission of a default transition to a substate in superstates with XOR decomposition.

Design errors in complex Stateflow diagrams can also result in state inconsistency errors. These errors are only detectable using the Debugger at run-time.

Detecting State Inconsistency

To detect the state inconsistency during a simulation:

  1. Build the target with debugging enabled.
  2. Invoke the Debugger and enable State Inconsistency checking.
  3. Start the simulation.

State Inconsistency Example

This Stateflow diagram has a state inconsistency.

In the absence of a default transition indicating which substate is to become active, the simulation encounters a run-time state inconsistency error.

Adding a default transition to one of the substates resolves the state inconsistency.


  Create the Model and Stateflow Diagram Debugging Conflicting Transitions