Using Implicit Events

What Are Implicit Events?

Implicit events are built-in events that occur when a chart executes:

These events are implicit because you do not define or trigger them explicitly. Implicit events are children of the chart in which they occur and are visible only in the parent chart.

Referencing Implicit Events

To reference implicit events, action statements use this syntax:

event(object)

where event is the name of the implicit event and object is the state or data in which the event occurs.

Each keyword below generates implicit events in the action language notation for states and transitions.

Implicit Event

Meaning

change(data_name) or chg(data_name)

Specifies and implicitly generates a local event when Stateflow® software writes a value to the variable data_name.

enter (state_name) or en(state_name)

Specifies and implicitly generates a local event when the specified state_name is entered.

exit (state_name) or ex(state_name)

Specifies and implicitly generates a local event when the specified state_name is exited.

tick

Specifies and implicitly generates a local event when the chart of the action being evaluated awakens.

wakeup

Same as the tick keyword.

If more than one object has the same name, the event reference must qualify the name of the object with the name of its ancestor. These examples are valid references to implicit events:

enter(switch_on)
en(switch_on)
change(engine.rpm)

Example of an Implicit Event

This example illustrates use of implicit tick events.

Fan and Heater are parallel (AND) superstates. The first time that an event awakens the Stateflow chart, the states Fan.Off and Heater.Off become active.

Assume that you are running a discrete-time simulation. Each time that the chart awakens, a tick event broadcast occurs. After four broadcasts, the transition from Fan.Off to Fan.On occurs. Similarly, after three broadcasts, the transition from Heater.Off to Heater.On occurs.

For information about the after operator, see Using Temporal Logic in State Actions and Transitions.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS