Stateflow    

Exported Events

Consider a real-world example to clarify when to define an Exported event. You have purchased a communications pager. There are a few people you want to be able to page you, so you give those people your personal pager number. These people now know your pager number and can call that number and page you at any time. You do not usually page yourself, but you can do so. Telling someone the pager number does not mean they have heard and recorded the number. It is the other person's responsibility to retain the number.

Similarly, you might want an external source (outside the Stateflow diagram, its Stateflow machine, and its Simulink model) to be able to broadcast an event. By defining an event's scope to be Exported, you make that event available to external sources for broadcast purposes. Exported events must be parented by the Stateflow machine, because the machine has the highest level in the Stateflow hierarchy and can interface to external sources. The Stateflow machine also retains the ability to broadcast the exported event. Exporting the event does not imply anything about what the external source does with the information. It is the responsibility of the external source to include the Exported event (in the manner appropriate to the source) to make use of the right to broadcast the event.

If the external source for the event is another Stateflow machine, then that machine must define the event as an Exported event and the other machine must define the same event as Imported. Stateflow generates the appropriate export and import event code for both machines.

Exported Event Example

This example shows the format required in the external code source (custom code) to take advantage of an Exported event generated in Stateflow.


  Interface to External Sources Imported Events