Function-Call Subsystems with Multiple Initiators
This example shows a function-call subsystem that is called by multiple different function-call initiators that are grouped by a Mux block.
Open the example model
The model contains a function-call subsystem,
f, that receives a mux signal at its function-call input port. The Mux block groups function-call signals from the Stateflow charts
Chart2 into the mux signal.
The data connection between port out1 of
Chart1 and port d1 of
Chart2 guarantees that
Chart1 executes before
When you create function-call subsystems with multiple callers, clearly define the relative execution order of each chart that calls f(). For example, if you remove the data connection between
Chart2, add priorities to
Chart2 to specify the relative execution order of these charts.
Ambiguity does not cause an error because it may be valid for specific cases. For example, if you remove all states from subsystem
f and delete the line from out1 of
Chart1 to d1 of
Chart2, then the order in which
Chart2 execute does not matter.