You are here

Scripting

Simile scripting language

The scripting language has been superseded by the Simile/R interface and will be phased out as of Simile v7.

Introduction

Simile includes a scripting language that provides control of all functions for model loading and execution. The objective is to allow multiple simulations using one or more models, with different parameters, time step settings and so forth for each run. The results can be recorded to a text file, for later analysis, or processed in the script. Several different approaches to meeting this need have been considered, including providing a specific graphic interface such as a new run control. We concluded that scripting allowed the most flexibility and encouraged users to find applications beyond those which we have initially considered.

Commands are provided to control key parts (model window, run control and data table) of the Simile user interface. (Simile is hidden by default.) Program objects are created that have commands (methods) that generally correspond to menu commands or tool buttons in the interactive graphical interface.

Using Simile scripting

Typically, the script interface to Simile is accessed by running the SimileScript application that is provided with Simile. A program object to control the model window is created and then used to load a model and scenario file. A run control object is then created to set time-steps, how long to run the model for, etc, and a data table control object is created to record variables. At the end of the simulation the data table object is used to write values to a file.

The script interface to Simile is accessed under Windows by running the SimileScript application that is provided with Simile. Under Linux and MacOS-X use the wish application in the Simile distribution and follow the instructions as for scripting from other interpreters . Scripts can be pasted in to the window or loaded via the File>Source menu item. Commands can also be added one at a time. This can be useful to explore the script interface capablities. Some example scripts are included below.

Simile script is an extension to TclTk and the full functionality is available to those that want to use it (see http://www.tcl.tk/).

In: Contents