Model Reference Function-Call
This example shows how to use a Model block that is explicitly triggered by means of its function-call trigger port.
Examine Example Model
Open and compile the example model. To compile the model, on the Modeling tab of the Simulink® Toolstrip, click Update Model. Compiling the model updates the line styles.
mdl = "FunctionCallCounterSystem"; open_system(mdl) set_param(mdl,SimulationCommand="Update");
This model contains Model blocks named 500ms Counter
, 1 sec Counter
, and Asynchronous Counter
. These blocks each reference the model named FunctionCallCounterAlgorithm
. The Model blocks represent saturating counters that increment their output values by one each time they are explicitly triggered through their function-call trigger ports. The Stateflow® chart calls each Model block at its specified rate.
Simulate Model and Examine Results
Simulate the model, and verify the behavior of the counters by examining the results displayed by the scope.
sim(mdl);
See Also
Model | Function-Call Generator | Function-Call Feedback Latch | Function-Call Split | Function-Call Subsystem