Page 637 - ExtendSim User Guide
P. 637

Model Execution 611
Slowing down simulations
run, the difference in the allocated memory at the end of the tun, and information about hierarchical blocks. Since profiling significantly slows the simulation, the Block Pro- files tab provides options for disabling profiling during subsequent runs.
• Usingamenucommand.SelectthecommandRun>Debugging>ProfileBlockCode, then run the model. A text file is generated with the following information for each block the model uses: name, number, time spent executing, percentage of total time spent executing.
• DisplayValueblock.TheDisplayValueblock(Valuelibrary)maycausethesimulationto run more slowly. This is because the Display Value block pauses while it shows you infor- mation. To speed it up, set its dialog’s Wait value to 0 ticks or seconds. You can also deselect the Dialog opens option if you don’t want to see the dialog during the entire model run.
• Executiveblock.TheExecutiveblock(Itemlibrary)storesinformationabouteachitemin the model. As the simulation is run, the Executive block allocates additional items in groups of a fixed size when necessary. In the Control tab of the Executive block’s dialog, you can specify how many items are allocated at the beginning of the run and the number of addi- tional items allocated when required during the run. The procedure of allocating additional items during the run can slow the simulation down if performed numerous times. Therefore, set the number of items initially allocated to be the maximum number of items that are expected to be in the model at any given time, plus 10%. Note that unnecessarily allocating too many items will take up available memory and can slow down the simulation.
Other factors that affect simulation speed
• Increase the amount of physical memory (RAM) in your computer. If your computer runs out of RAM, it will use virtual memory, which can slow down your model significantly.
• UsingalargenumberofValuelibraryblocksconnectedtogethertoperformasimplecalcu- lation can slow a model down. Where possible, replace large “webs” of blocks with equation blocks that perform the same calculation.
• For discrete event models, you may be able to scale the number of items you generate. For example, if your model is of a factory floor, instead of generating one item for each object manufactured, you might generate one item for each set of five objects.
Slowing down simulations
You might want a model to run more slowly to debug it or critically visualize what the model is doing. If this is the case, the best way to slow down your model is to turn on animation. If the model is still running too fast, click the Animation Slower (turtle) button in the toolbar: this causes animated models to run even slower. To speed up the model again, choose the Anima- tion Faster (rabbit) button.
Another example of when you might want to slow down a model is if you want to synchronize the model to real-time events. This might be required if you are receiving real-world data. To accomplish this, refer to the TimeSync block (Utilities library).
If you set it to leave the dialog open while the simulation runs, the Display Value block (Value library) is also useful for slowing down the simulation.
See also “Stepping through a model” on page 600.
How To

   635   636   637   638   639