An event is a Stateflow® object that can trigger actions in one of these objects:
A Simulink® triggered subsystem
A Simulink function-call subsystem
A Stateflow chart
Use events when you want to:
Activate a Simulink triggered subsystem (see Activate a Simulink Block Using Edge Triggers)
Activate a Simulink function-call subsystem (see Activate a Simulink Block Using Function Calls)
Trigger actions in parallel states of a Stateflow chart (see Broadcast Events to Synchronize States)
Although Stateflow software does not limit the number of events you can use in a chart, the underlying C compiler enforces a theoretical limit of (2^31)-1 events for the generated code.
An explicit event is an event that you define and can have one of the following scopes.
|Local||Event that can occur anywhere in a Stateflow machine but is visible only in the parent object (and descendants of the parent). See Directed Event Broadcasting.|
|Input from Simulink||Event that occurs in a Simulink block but is broadcast to a Stateflow chart. See Activate a Stateflow Chart Using Input Events.|
|Output to Simulink||Event that occurs in a Stateflow chart but is broadcast to a Simulink block. See Activate a Simulink Block Using Output Events.|
An implicit event is a built-in event that broadcasts automatically during chart execution (see Control Chart Execution Using Implicit Events).
You can define explicit events at these levels of the Stateflow hierarchy.
|An event you define in a...||Is visible to...|
|Chart||The chart and all states and substates|
|Subchart||The subchart and all states and substates|
|State||The state and all substates|
If you have unused events in your chart, a warning message appears during simulation with a list of events you can remove. By removing objects that have no effect on simulation, you can reduce the size of your model. This diagnostic checks for usage of Stateflow events, except for the following types:
Function-call input events
Edge-triggered input events
After you select an event for removal, a dialog box confirms your choice. In this dialog box, you can specify that other deletions occur without confirmation. If you prevent the confirmation dialog box from appearing, you can reenable it at any time by typing at the command prompt:
You can control the level of diagnostic action for unused events in the Diagnostics > Stateflow pane of the Model Configuration Parameters dialog box. For more information, see the documentation for the Unused data, events, messages, and functions diagnostic.