Stateflow User's Guide Previous page   Next Page

Associating Input Events with Control Signals

You can define multiple input events for a chart. When you define one or more input events for a chart, Stateflow adds a single trigger port to the chart block. External Simulink blocks can trigger the chart's input events via a signal or vector of signals connected to the chart's single 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. 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 Setting the Stateflow Block Update Method). 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.


Previous page  Defining Input Events Defining Output Events Next page

© 1994-2005 The MathWorks, Inc.