Setting up variables that reference simulation objects is essential when writing complex Visual Logic for SIMUL8.
However, when your simulation employs a large number of variable names, (e.g. when using Component objects or looping through a long spreadsheet of names) this can impact the speed of your simulation from the large number of objects needing looked up by text.
Speed Lists can address this problem by creating one-off automatically generated reference codes for each of your object variables. Let’s explore how to do this.
For simplicity’s sake, let’s look at an example using a basic simulation with 5 Activities.
As can be seen, we have a basic simulation with a Start Point, a Queue, 5 Activities and an End.
We then need to create a simple spreadsheet (we’ll call it ‘ssSpeedList’) of 2 columns by 5 rows which will contain the automatically generated references to correspond to these 5 activities, like so:
NB that the ‘Ref Codes’ column is left blank. This is so our reference codes can now be generated automatically, using Visual Logic.
We do this by accessing SIMUL8’s Visual Logic tab. Use the following command:
Add speed list location ss_SpeedList[1,2]
This will inform SIMUL8 that we wish to keep a new Speed List in our spreadsheet ssSpeedList. The Visual Logic command points to the top, first name of all our Activities. References codes will be automatically updated each time the simulation file is opened or when SIMUL8 needs to, e.g. when changing object names in the first column.
From there, instead of using the regular assignment command: Set MyObjectVariable = “Activity 1” variables can be assigned using their Speed List locations instead, like so:
Set Object Var from Object Speed Code ss_SpeedList[1,row] , MyObjectVariable
where ‘row’ in the above is the number of the row containing the text name of the relevant object.
Now your reference codes will be generated automatically as your simulation is running.
Do you use Speed Lists in your simulations?