Stateflow with variable solver step time

조회 수: 5 (최근 30일)
Jonathan
Jonathan 2023년 9월 15일
답변: Jonathan 2023년 9월 28일
Hi,
We would like to use stateflow in our next product. We would like to know if it's possible to generate C code that can be run on a variable time frame ?
We are not 100% sure that the step function will be called at the periodic rate (like fixed step require).
for example, if a delay is put into the chart, the generated code is assuming that the step function is called at a certain rate (invrement only a vraible and compare the delay value). I think we need to have a step function that need to take a delta time or a way of computing the last call time and the new call time and compute de delta.
Hope I'm clear !!
Regards,
Jonathan

답변 (2개)

Binaya
Binaya 2023년 9월 26일
Hi Jonathan,
I understand that you want to generate C code for your model using the variable-step solver. For Simulink and Embedded coder, the grt.tlcand ert.tlctarget file needs a fixed step solver with discrete time step as the solver configuration. This is done to avoid complex codes and highercomputation power needed for implementing the C code with variable step solver in the hardware.
If you want to use variable step solver for generating the C code, please usersim.tlcas the system target file in code generation configuration parameters. For details please explore the below documentation:
I hope this helps.
Regards
Binaya

Jonathan
Jonathan 2023년 9월 28일
Hi Binaya,
With rsim, should we be able to acheive the main goal ? i.e to be able to call the step function async (not periodycaly) ?
Regards,

카테고리

Help CenterFile Exchange에서 Stateflow에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by