Stateflow | ![]() ![]() |
Implicit Events
Stateflow defines and triggers the following events that typically occur whenever a chart executes:
These events are called implicit events because you do not have to define or trigger them explicitly. Implicit events are children of the chart in which they occur. Thus, they are visible only in the charts in which they occur.
Referencing Implicit Events
Action expressions can use the following syntax to reference implicit events.
where event
is the name of the implicit event and object
is the state or data in which the event occurred. Valid implicit event names (and their shortcuts) are wakeup
(also referred to as tick
), enter
(en
), exit
(ex
), and change
(chg
).
If more than one object has the same name, the event reference must qualify the object's name with that of its ancestor. The following are some examples of valid implicit event references.
Note
The wakeup ( or tick ) event always refers to the chart of the action being evaluated. It cannot reference a different chart by argument.
|
This example illustrates use of an implicit enter
event.
Fan
and Heater
are parallel (AND) superstates. By default, the first time the Stateflow diagram is awakened by an event, the states Fan.Off
and Heater.Off
become active. The first time event Fan_switch
occurs, the transition from Fan.Off
to Fan.On
occurs. When Fan.On
's entry action executes, an implicit local event is broadcast (i.e., en(Fan
.On) == 1
). This event broadcast triggers the transition from Heater.Off
to Heater.On
(triggered by the condition en(Fan.On)
. Similarly, when the system transitions from Fan.On
to Fan.Off
and the implicit local event Fan.Off
is broadcast, the transition from Heater.On
to Heater.Off
is triggered.
![]() | Specifying Trigger Types | Defining Data | ![]() |