SIMUL8 Tip: Optimizing Run Speeds in SIMUL8
At SIMUL8 we pride ourselves on the extremely fast run times of our simulation models. One of the tools that helps you optimize your simulation run speeds even further is the Speed Analysis option for Visual Logic. If your simulation contains a lot of Visual Logic, running it with Speed Analysis enabled will give you a very good sense of the efficiency of your code.
Using Speed Analysis is as simple as enabling the functionality prior to running the simulation. You can find it on the Visual Logic tab:
Once you have enabled Speed Analysis, run your model and return to the Speed Analysis option again. You will now see the following results:
- Total time of the simulation run spent on VL (highlighted at the bottom of the dialog)
- Percentage of simulation run time spent on individual sections of code
Please see the following results from one of my simulations:
As you can see SIMUL8 spends more than 99% of the model run time on executing VL. This means that (depending on total model run-time), significant improvements to model run speed can be achieved by optimizing VL.
As you can see in the center of the dialog, 2 sections of code each take about 45% of the simulation run time. In the second column we can find information about the number of times these sections have been executed. The names of the sections of code are blurred out, but we can easily look them up in our list of VL sections and find ways to improve the code. We can either try to reduce the number of times the code is executed or we can find ways to write more efficient code.
Please see our previous SIMUL8 Tip on How To Speed Up Your Simulation for for additional information on how to speed up your model.