How do I generate Simulink Profiler Report with execution times of subsystems in my model?

4 次查看(过去 30 天)
My Simulink model interfaces with real-time hardware and performs three tasks:
1) Read sensor data from an external device.
2) Perform calculations.
3) Write control commands to the external device.
The blocks involved in each of these tasks are encapsulated in separate subsystem blocks. I want to know how much time is spent within each subsystem block during a simulation run.
How do I create a Simulink Profiler report with execution times reported in this format?

采纳的回答

MathWorks Support Team
To set Simulink Profiler to generate a report with the rows in the table showing the processing time taken by each task's subsystem block, follow these steps:
For the subsystem block corresponding to each of the tasks in the model,
1. Right-click on the subsystem block and click on "Block Parameters (Subsystem)" near the bottom of the menu.
2. In the "Main" tab, enable the "Treat as atomic unit" option.
3. In the "Code Generation" tab, in the drop-down menu for "Function Packaging:", select the "Reusable function" option.
4. Click the "OK" button.
In the Simulink model, navigate to the following setting:
Configuration Parameters > "Verification" tab > Measure function execution times
Set to "Coarse (referenced models and subsystems only)"
Click on the OK button.
Now follow one of the procedures to run the model with the profiler on, such as:
>> modelName = 'simulink_model_filename_noExt';
>> load_system(modelName)
>> set_param(modelName,'Profile','on')
>> sim(modelName);
The above solution was verified in MATLAB R2019b.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Subsystems 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by