Use these guidelines to efficiently model charts with events, states, and transitions.
When you use multiple input events to trigger a chart, verify that all input signals use the same data type. Otherwise, simulation stops and an error message appears. For more information, see Data Types Allowed for Input Events.
This guideline prevents state inconsistency errors during chart execution.
Condition actions execute as soon as the condition evaluates to true. Transition actions do not execute until after the transition path is complete, to a terminating junction or a state.
Unless an execution delay is necessary, use condition actions instead of transition actions.
You can specify explicit or implicit ordering of transitions. By default, a chart uses explicit ordering. If you switch to implicit ordering, the transition testing order can change when graphical objects move.
If your chart contains unintended backtracking behavior, a warning message appears with instructions on how to avoid that problem. For more information, see Best Practices for Creating Flow Charts.
When you have multiple exclusive (OR) states that perform the same state actions, group these states in a superstate and define state actions at that level.
This guideline enables reuse of state actions that apply to multiple substates. You write the state actions only once, instead of writing them separately in each substate.
You cannot use boxes for this purpose because boxes do not support state actions.
MATLAB® functions are better at handling numerical computations than graphical functions, truth tables, or Simulink® functions.
Descriptive function names enhance readability of chart objects.
If reentry to a state with exclusive (OR) decomposition depends on the previously active substate, use a history junction. This type of junction records the active substate when the chart exits the state. If you do not record the previously active substate, the default transition occurs and the wrong substate can become active upon state reentry.
This guideline prevents compile-time errors. Since all parallel states at a level of hierarchy are active at the same time, history junctions have no meaning.
You can specify explicit or implicit ordering of parallel states. By default, a chart uses explicit ordering. If you switch to implicit ordering, the execution order can change when parallel states move.