Speeding Up Your Simulation

Simul8 is known for its very fast run times. Independent trials have been shown to be 6 times faster than our nearest speed competitor when running simulations of the same system. Below are some tips to consider to further increase the run speed of simulation.

Speed Analysis

Has your Visual Logic been written in an efficient way? Use Simul8’s Speed Analyzer to find out the sections of your code that take the longest to run and improve them. This is a Professional feature and you can access it from the Visual Logic Tab or by pressing Ctrl+Alt+S on your keyboard. Analysis is provided by assigning each block of Visual Logic code a percentage of total Visual Logic run time.

Visual Logic Route-in Before Selecting

This section of Visual Logic is different from others as it doesn't execute when a work item passes through and triggers it, but rather after every simulated event. This leads to an increase in the number of events. To speed up your simulation try to use in routing-in and routing-out Visual Logic instead.

No Routing Discipline Conflicts

Routing Discipline conflicts can slow down your simulation because Simul8 has to do more calculations to decide where the work item should go. To avoid this, make sure your simulation never has a priority routing-out object linking into a priority routing-in object. This can be corrected by placing a Storage Bin between these items or changing one of the routing disciplines to passive.

High Volume

If you are working with hundreds of thousands of work items that are essentially the same considered using High Volume. Maybe this could even be used for part of your system. This is useful for simulating many items with similar properties. All your work items are batched up and treated in bulk rather than individually so there are lots less events to process.

More information

Results Synchronization Interval

You can change the Results Synchronization Interval using Preferences.

The default interval to collect results in Simul8 is every five time units. If you require greater accuracy this interval can be reduced, but to increase the speed of your model this interval can also be increased. In simulations that run over a long time period with many events, you can also increase this time interval to save memory, if this is an important factor to you.

More information

Simulation Exit Objects

Information carried on work items often take up a lot of memory, particularly if you have many work items. By ensuring where possible that your simulation exit objects are specific Work Exit Points rather than Storage Bins for example, this will ensure less memory is used recording finished work item’s label values.

Minimum Wait Time and Shelf Life

Storage bins making use of the Minimum Wait Time or Shelf Life features may also impact the speed that your simulation runs. This is due to Simul8 having to generate lots of events to keep checking on the status of the work item. You could use a Work Center with replicate set to a high value and the cycle time to represent the wait time instead, then you only have one event per work item.

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.

Use Routing out by Label instead of Batch by Type

When you have many Work Items, use Routing out by Label instead of Batch by Type to send them to the appropriate Object. Simul8 will spend less time to check a Label value on Routing out, than checking whether an item can enter an Activity based on its Label value. Consider using a dummy activity (with a Fixed distribution and 0 time) for setting out the Routing out by Label logic.

Simulation Objects that Collect Results

By default every simulation object in Simul8 collects results. Turn off results collection for objects you're not interested in, for example dummy Work Centers added for routing purposes. This saves memory space on the PC and can allows simulations to run faster, reducing the execution time for each run.

Use Results All dialog and highlight each object you want to switch results collection off (or on) then check or un-check the “Collect Results” check box. You can highlight one or many objects at the same time using Ctrl or Shift keys.

Be Clever With 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.

Use 'Else If' statements

When writing Visual Logic 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.