Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Set Up Simulation Script

Simulation scripts are used to provide fine control over how a simulation starts. In general, you do not need to set up a Simulation script unless you wish to:

An interpreted simulation requires variables to be initialized before the simulation commences
The default behavior of interpreting the guards in Corporate Edition and above is undesired (ie. a Manual execution is preferred)
Multiple ways of running the same diagram are required


For most diagrams it is possible to start a simulation simply by opening the diagram of interest and pressing the "Play" button on the Simulation control window.

To configure a simulation execution script, first select the package in either the Project Browser, Package Browser, Diagram List or Model Search. You can then use the Execution Analyzer window to add a new Script for the currently selected package. You will use the Simulation page of the Execution Analyzer dialog to configure the relevant properties.

Access    Analyzer | Execution Analyzer (Shift+F12) : New (Toolbar icon)
                  Analyzer | Execution Analyzer (Shift+F12) : locate and double-click on required script > Simulation


Execution Analyzer dialog Simulation page



See also

Entry Point

Click on the ( ... ) button and select the required:

Entry point for the simulation, and
Activity, Interaction or State Machine to simulate


Note that if you do not specify an entry point, the simulator attempts to simulate the entire package.




For UML Activity, Interaction or State Machine simulation, click on the drop-down arrow and select UML Basic.

For BPMN diagrams, click on the drop-down arrow and select BPMN.



Evaluate Guards and Effects using JavaScript

If required, select the checkbox to execute the code for effect behavior in the simulation (instead of a manual simulation, where you select the next state to transition to and the point where a decision must be made) [note - this feature is only available in Corporate and above editions].

The simulation executes javascript code in the following places:

State entry/exit/do operations
Transition guard/effect
BPMN Activity Loop Conditions and Sequence Flow Condition Expressions.


With the exception of the guard, all should be one or more valid javaScript statements, including the semi-colon.

The guard must be a valid boolean expression, also terminated with a semi-colon.

Variables that are initialized with a prefix of sim. or this. are available in the Locals window when a simulation breakpoint is hitsim.count = 0;


State Machine Table Conventions


View the Local Variables


When Javascript is enabled, you can enter script commands here that will execute prior to the simulation being run. This is useful setting up global variables and defining functions.By using multiple Analyzer Scripts with differing input scripts, you can run your simulation under a wide variety of conditions.




Click to save changes.




All simulation elements and relationships must reside within the package configured for simulation

Learn more

Learning Center topics

(Alt+F1) | Execution Analysis | Simulation | Configure a Simulation