Simul8 Tips, Technical Corner

SIMUL8 Tip – Exporting Results from Multiple Runs (Trials)

When using SIMUL8 Professional, there is a quick snippet of Visual Logic that you can use to export the results from each individual run in a trial. By default, SIMUL8 will export the results from an End Point from the most recent run (or last run in a trial). However, our users have been asking how it may be possible to record the results for each individual run, so this SIMUL8 Tip will show you how it’s done!

As the End Point will export the results to file on the end of the run, we will need to add some Visual Logic in the “End Run” block; this will then create multiple files, one for each run in a trial.

To do this:
– First create a global variable to store the current run number (let’s call this gbl_TrialNo).
– Open the End Run Logic for the simulation
– Using the variable above, we will use these commands:
exportResults

Here are the meanings behind the specific commands:

Get Trial Run Number – This command will get the current run number in the trial, and then store it to a variable (in this case, gbl_TrialNo, a numerical global variable).
Set Work Exit Completion File – Creates a file that contains the results for the End Point. Since we are using this on End Run logic, it will create a new file after every run in the trial. We can also signify each run by including the current run number in the file name. This will give us files names like Results1.csv, Results2.csv, etc, for each run in our trial.

It’s as easy as that! Now you can use trials and gather the exported results for each run instead of just the current run, and you’ll be able to make additional comparisons for each of your trials.