| Stateflow User's Guide | ![]() |
Adding Multiple Trigger Events to a Stateflow Chart
In Adding Event Triggers to Transitions, you use the names of the events to specify event triggers for transitions that execute only with the occurrence of one of these events. To use these event triggers, you must also define the events that enable them for the Controller Stateflow diagram.
Define the two events on_switch and off_switch for the Controller Stateflow diagram with the following steps:
off_switch.
on_switch with a scope of Input from Simulink, and a Rising trigger.
on_switch and off_switch in the Controller Stateflow diagram. The event off_switch has a Falling trigger and the event on_switch has a Rising trigger. The event off_switch occurs only when the control signal attached to the Stateflow block trigger port falls in value as it passes through zero. The event on_switch occurs only when that control signal rises as it passes through zero.
Model Explorer is a tool that lists nongraphical objects for all Simulink objects, including Stateflow objects. Events are nongraphical objects. Model Explorer is the only place to change or delete events.
The left Model Hierarchy pane lists the Stateflow objects for the model SFcontrol2, which includes the model itself. To see some of these objects, you need to expand the Controller diagram that contains them. The right Contents pane lists the nongraphical objects owned by the highlighted object in the Model Hierarchy pane.
The Controller diagram is highlighted in the Model Hierarchy pane and the Contents pane shows the events that you have added to it. These include the off_switch and on_switch events and the event event you added in the previous section. Notice that these events are indexed in the Port column in the order that they were added: (1) event, (2) off_switch, and (3) on_switch.
event disappears and the event is deleted. Notice that the indexing for the remaining events is automatically adjusted from three to two elements: (1) off_switch, and (2) on_switch.
| Adding Event Triggers to Transitions | Sending Multiple Trigger Events to a Stateflow Chart | ![]() |
© 1994-2005 The MathWorks, Inc.