- https://www.mathworks.com/help/simulink/slref/simulinkprofiler.html
- https://www.mathworks.com/help/simulink/ug/understanding-total-time-and-self-time-in-profiler-reports.html
- https://in.mathworks.com/help/ti-c2000/ug/real-time-profiling.html
Obtaining Simulink Model execution loop rate with Simulink Profiler
3 views (last 30 days)
Show older comments
Khalid Hersafril
on 6 Feb 2024
Answered: Sachin Lodhi
on 13 Feb 2024
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1608856/image.png)
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?
0 Comments
Accepted Answer
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 –
0 Comments
More Answers (0)
See Also
Categories
Find more on General Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!