Stateflow with variable solver step time

4 views (last 30 days)
Jonathan
Jonathan on 15 Sep 2023
Answered: Jonathan on 28 Sep 2023
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

Answers (2)

Binaya
Binaya on 26 Sep 2023
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 on 28 Sep 2023
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,

Categories

Find more on Complex Logic in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!