menu
info Documentation

Scripts

D2S2 can execute scripts that predefine or automate sequences within the simulator. These scripts are packaged together with plugins. This section of the documentation focuses on running scripts from the D2S2 user interface. The Run Script window, shown in Figure 1, is accessed by pressing the Run Script button.

Figure 1: The Run script window displaying the available scripts on the left, and the script-options relevant to the selected script on the right.

This window opens with the available scripts listed on the left. Potentially deviating from Figure 1, the list of scripts may vary between users depending on license type and the plugins enabled. Detailed documentation on scripts associated with specific plugins will be provided in the respective plugin documentation.

Running scripts

To run a script, press the button. The operations that a script execute can vary. It is possible for a script to make modifications to the current model (add or remove model objects), make adjustments to model input properties, and it is possible to run a simulation as part of script execution. The script can also reset and re-run the simulation multiple times, typically with modification to input properties inbetween simulation runs. The above modifications to model and model input properties require that the simulation is in the Reset state, so care must be taken what state the UI is in, before running a script. When a simulation is run inside a script, the currently configured simulation run settings, as specified in the Simulation Settings window, will be used.

Script execution can be stopped using the Reset simulation button. Whenever a script is run, its output and status messages will appear in the Script Output, as shown in Figure 2.

Figure 2: The Script Output view.

Script options and script-options file

The behaviour of scripts can be influenced through options. Each script defines its own set of options. Changes are made to the Options section in the Run Script window, prior to running the script. To make running scripts repeatable, D2S2 allows the option to save the current scrip-options in a file that can be easily loaded on consecutive runs. Loading and saving a script-options file can be done by pressing the load and save icons at the top-right of the Run-Script window, as shown in Figure 1. These files will have a file extention of .d2s2-script.