I've done some more testing with this, and have found that I can use subsystem references instead of model references to achieve my desired behavior. This will work, but I would prefer to continue using model references for the expanded capability of SIL/PIL.
Using model references within Stateflow simulink function blocks.
8 views (last 30 days)
Show older comments
I'm trying to use Stateflow to organize the conditional execution of Simulink model references, I'm doing this as an alternative to using If blocks and If Action Subsystems because these blocks become difficult to organize when large amounts of signals are used.
I'm attempting to use existing model references in Simulink Function blocks in Stateflow, but I'm running into an issue where a default base rate of 0.2 is being used for execution when the 'Periodic sample time constraint' configuration parameter is set to 'Ensure sample time independent'. For any other settings of 'Periodic sample time constraint' the model will not build due to sample time inheritance issues.
I've tested the function blocks without model references, and have found that removing the model references allows for the 'Periodic sample time constraint' to be set to 'Unconstrained' and the stateflow chart will use the step size specified in the 'Fixed-step size' configuration parameter.
Is it possible to use model references in Stateflow Simulink Function blocks while also using a step size dictated by configuration parameters? Ideally I want to keep using my model references and want to avoid having to manually set the sample rate on every block. How can I manage the step size inheritance of reference models being called by Simulink Function blocks in Stateflow?
Answers (1)
Corey Lagunowich
on 3 Oct 2025
Hi Christopher,
Is it possible for your model references to be Export Function models? Then you could use Stateflow to schedule the rate at which they run using output events. See: https://www.mathworks.com/help/simulink/ug/export-function-models.html#bt2rr_n-1
0 Comments
See Also
Categories
Find more on Decision Logic in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!