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 these 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 may only be detectable using the Debugger at runtime.

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

Example: State Inconsistency

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 runtime 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