MATLAB: How do scope blocks negatively affect the performance or speed of a large parallel simulation

parallelParallel Computing Toolboxperformanceprofilerscopescopessimulationsimulinkspeed

In my model, I have many scopes for debugging purposes. I plan to simulate my large model using the Parallel Computing Toolbox. Will having these scopes in my model affect the simulation performance?
 

Best Answer

Anything you put into a model will have some kind of impact on performance, but the impact relative to the rest of the simulation can vary depending on many factors. The following scenarios are listed from greatest negative impact on simulation performance to least negative impact:
  • Keeping the scopes as they are in your model and having them open during simulation will have the greatest potential for slowing simulation speed.
  • Keeping the scopes as they are in your model but having them closed during simulation is better.
  • Commenting out the scopes will ensure no simulation time is spent on them. However, if commented out, they cannot record data during simulation.
The best way to see how scopes are impacting your specific model would be to use the Simulink Profiler. The results of the profiler will show you how much time of the simulation was spent on each scope block. To run the Simulink Profiler, open the profiler report by going to Analysis > Performance Tools in the Simulink menu. Then, simulate your model as you typically would. Once the simulation is complete, the profiler report will have the results that break down how time was spent during the simulation.
 
You can read more about the Simulink Profiler here:
 
Here is an example that shows how to use the Simulink Profiler: