Obtaining Simulink Model execution loop rate with Simulink Profiler

3 views (last 30 days)
I was wondering what might be the best way to obtain the execution loop rate of my simulink model?
The method I am currently doing is by using Simulink profiler and then utilizing the Total time divided by the number of callbacks to get an approximation to my loop rate.
For instance, in the above profiling session, ALUA_sim is the top level model, and using the above formula:
20.861/60971=0.00034214626s
I obtained 0.34ms loop rate (~3kHz). Would this be a reasonable approach?

Accepted Answer

Sachin Lodhi
Sachin Lodhi on 13 Feb 2024
Yes, this is a common way to get a rough estimate of the execution loop rate. The Simulink Profiler adds some overheads in the background to the functions or models being profiled. Since it gives the detailed execution time for each function during simulation, it is the “best” way to judge the distribution of simulation execution time among model components.
However, keep in mind that this is an average value. The actual time per loop might vary depending on what's being executed in each callback and other system loads that could affect the timing. If you need more precise measurements or if the loop rate is critical for your application, you might need to consider a more detailed analysis or real-time execution profiling.
Some useful links –
  1. https://www.mathworks.com/help/simulink/slref/simulinkprofiler.html
  2. https://www.mathworks.com/help/simulink/ug/understanding-total-time-and-self-time-in-profiler-reports.html
  3. https://in.mathworks.com/help/ti-c2000/ug/real-time-profiling.html

More Answers (0)

Categories

Find more on General Applications in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!