Stateflow    

Defining Input Events

An input event occurs outside of a chart and is visible only in that chart. This type of event allows other Simulink blocks, including other Stateflow blocks, to notify a particular chart of events that occur outside it. To define an event as an input event, set its Scope property to Input from Simulink.

You can define multiple input events for a chart. The first time you define an input event for a chart, Stateflow adds a trigger port to the chart's block. External blocks can trigger the chart's input events via a signal or vector of signals connected to the chart's trigger port by associating input events with control signals. When defining input events for a chart, you must specify how control signals connected to the chart trigger the input events (see Specifying Trigger Types).

Associating Input Events with Control Signals

An input event's Index property associates the event with a specific element of a control signal vector connected to the trigger port of the chart that parents the event. The first element of the signal vector triggers the input event whose index is 1; the second, the event whose index is 2, and so on. Stateflow assigns 1 as the index of the first input event that you define for a chart, 2 as the index of the second event, and so on. You can change the default association for an event by setting the event's Index property to the index of the signal that you want to trigger the event.

Input events occur in ascending order of their indexes when more than one such event occurs during update of a chart (see Waking Up Charts). For example, suppose that when defining input events for a chart, you assign the indexes 3, 2, and 1 to events named A, B, and C, respectively. Now, suppose that during simulation of the model containing the chart, that events A and C occur in a particular update. Then, in this case, the order of occurrence of the events is C first followed by A.


 Defining Local Events Defining Output Events