Stateflow with variable solver step time

6 次查看(过去 30 天)
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