Info

This question is closed. Reopen it to edit or answer.

How to make generated code from stateflow charts deterministic(e.g execute same amount of time every timestep) to get worst case execution time (WCET)?

1 view (last 30 days)
Artyom
Artyom on 16 Dec 2019
Closed: MATLAB Answer Bot on 20 Aug 2021
Hi there. Many of us deploy automatically generated code from Stateflow charts on real-time targets.
Usually this code is executed on periodical basis - e.g. every couple of milliseconds the step() function is called, which runs through the chart states, transitions and functions and finaly exits.
I found that the time it takes to run one step on my real-time target is highly undeterministic - e.g. it varies in very wide range and highly depends on what states are currently active in chart, which transitions are checked end executed at this step,system operation mode etc. So it's hard to estimate really worst case execution time to make sure, that there is no overrun possible. In my application I would prefer to have long but deterministic execution time against fast, but undeterministic time.
I know that in Simulink it's possible to disable some optimizations to get more deterministic simulink model execution - e.g. it possible to generate code, which execute both conditional branches even if there is a switch at the end which selects just one result out of two. Is there something similar in Stateflow? For example execute all states even if they are not active?
I really would like to know the worst case execution time, even if it would be just theoretical value to be 100% sure. Otherwise I never know and need to profile the code execution under different conditions which would take much longer time.
Thanks for hints

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by