Using model references within Stateflow simulink function blocks.

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?

댓글 수: 1

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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Corey Lagunowich
Corey Lagunowich 2025년 10월 3일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Decision Logic에 대해 자세히 알아보기

제품

릴리스

R2023b

질문:

2025년 9월 24일

답변:

2025년 10월 3일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by