SIMUL8 User
 

Faster Simulation
by Frances Collins

7 March, 2002
support.SIMUL8.com
  Learning Zone
SIMUL8 Cafe
Templates
Components
Glossary
Back Issues
Win a Visor!
Six Sigma

SIMUL8 is very fast! Major power simulation users based in Detroit performed a test with a standard simulation model to evaluate how the major simulation packages compared on speed. Time to complete a full simulation run was as follows:

  • Package A 29 seconds
  • Package B 18 seconds
  • SIMUL8 3 seconds

If your simulation takes longer than a few minutes to complete 1 run it is probably too slow and there are many ways to speed up your simulation. Below you will find some of the common causes of slow simulations and how they can be resolved.

Don't Collect All Results

Results are stored in memory for everything that happens to every work item and every simulation objects. This means that at the end of a run you can look up any aspect of the simulation and see how it has performed.

SIMUL8 asks Windows to provide as much memory as it needs. However Windows memory handling becomes very slow once a single package is itself requesting more memory than physically exists in the PC.

If you find that during a long run your model slows progressively then its probably the results collection which is causing it to slow down. Try switching off results collection for some of the simulation objects:

Select RESULTS > ALL from the main toolbar to display the objects window on the left.

If the COLLECT RESULTS box is checked results will be collected for the highlighted object in the list. You can highlight one or many objects at the same time using CTRL or SHIFT keys (normal windows conventions are used).

Click on AUTO ADJUST to only collect results for objects you have selected to be displayed in the results summary.

Click ALL OFF to turn off all results collection. Click ALL ON to turn on Results Collection for every object.

Take Care Writing to and from Excel

Many users like to create an Excel interface for their simulation. It allows non SIMUL8 users to use their simulation in an environment they are familiar with and Excel has some additional functionality that SIMUL8 internal spreadsheets don't. Writing and reading from SIMUL8 to Excel is fast but doing it extensively during run time can seriously slow down your simulation. It is much better to copy the information to a SIMUL8 internal spreadsheet at the beginning of a run and write all the information to Excel at the end of a run.

Be Clever With SIMUL8's Spreadsheets

SIMUL8's internal spreadsheets are really useful but when a vast amount of data is being written to them during the simulation run they can begin to slow down your simulation.

To help keep your simulation file size small when a spreadsheet is created it is very small. This means that as the spreadsheet grows, line by line, SIMUL8 has to expand the sheet. So as you write to a sheet it is dynamically expanded with each expansion requiring some processor time.

Store a 0 or blank ("") in the first cell of the row that you think the data will extend to. This will avoid the spreadsheet having to be extended with each new row of data and speed up your simulation. The file size will increase, but this should not matter except for save purposes.

In BPM and FMCG use High Volume

In BPM (Business Process Management) and FMCG (Fast Moving Consumer Goods) applications it is common to have millions of work items in the simulation at any one time. This will slow down your simulation because it is storing information on each individual work item. Sometimes it isn't necessary to individually distinguish between every piece of work a work center does, for example cookies being produced in a factory.

High volume mode lets SIMUL8 process large numbers of transactions very quickly in batches while still retaining the ability to consider work individually (in terms of timing etc.). The timing information you place in a work center dialog box for a high volume work center is the time it will take to work on one unit of work in the batch. For example if the timing panel in the work center dialog is FIXED 10 and the Quantity label for a work item is set to 20 then it will take 200 minutes to process the work item. If the timing panel specifies a distribution then SIMUL8 will automatically adjust that distribution to one which is appropriate for the batch of work.

Only Use Match on Small Queues

The Match function in Routing In Collect in work centers tells SIMUL8 to search through the contents of a storage bin to find 2 or more work items with identical label values. But if you use this option on long queues, say 50 work items or more, then it can slow down your simulation as SIMUL8 has to scan all the work items in the queue.

Write Effective Visual Logic

Each Visual Logic command takes milliseconds to execute. But sometimes the way code is written or where it is written can cause a simulation to become slow. Here are three tips:

Take Care with the 'Before Selecting' Event
Any Visual Logic written in 'Before Selecting' in a work center will run for each time unit whenever the work center is not currently working. So if, for example, you have a long complex loop it could significantly slow down your simulation. Carefully construct any logic you put in this section and try if you can to find an alternative place to put the code.

Use 'Else If' statements
Often a string of 'If' statements can be replaced with 'Else If' statements speeding up the code execution time. SIMUL8 must test each 'If' statement to see if it is true. If 'Else If' statements are used then if SIMUL8 has found a previous condition to be true it does not have to test the subsequent 'Else If' statements. Below is a simple example where only 1 line less of code needs to be run. But if you have, for example, 20 'If' statements the time saved is significant.

How to find slow VL code
If you think it could be a section of Visual Logic that is slowing down your simulation then disable all your Visual Logic. (Right click on the title of each Visual Logic section and click disable, a red cross appear beside the title.) Reintroduce each section one by one. When you see the run time significantly increase you will have found the code causing the problem.

Increase PC Power

The faster the PC, the faster the simulation. SIMUL8 uses disk space during simulation runs to store results information. If SIMUL8 has become very slow at the end of a simulation run or while resetting the clock this is because Windows has placed a large percentage of the data about the simulation run on disk because it ran out of RAM.

 

If you have any questions generated from, or comments about this newsletter then email

You are receiving this e-mail because you subscribed or are a new SIMUL8 user. To unsubscribe click here.