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

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

You want to run an interpreted simulation that requires variables to be initialized before the simulation commences; this is useful for setting up global variables and defining functions
(In the Corporate Edition and above) You do not want to apply the default behavior of interpreting the Guards (that is, you prefer to use a Manual execution), or
You want to have multiple ways of running the same diagram

For most diagrams it is possible to initialize a script for a simulation simply by setting variables in the first element or connector after the Start element. For State Charts, this is the Transit connector exiting the initial element, and for Activity models this is the first Action element.

As an alternative, you can use Simulation scripts to initialize settings before a simulation starts. This is useful for setting up different sets of initial values using multiple Analyzer Scripts, so that you can run your simulation under a range of pre-set conditions.

To configure a simulation execution script, first select the Package in the Project Browser, Package Browser, Diagram List or Model Search. You can then use the Execution Analyzer window to add a new Script for that 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

Configure a Simulation Script



See also

Entry Point

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

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

If you do not specify an entry point, the simulator attempts to work through 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

(In Corporate and higher editions) Leave the checkbox unselected to perform a manual simulation, where you select the next State to transition to and the point where a decision must be made.

Select the checkbox to execute the code for Effect behavior in the simulation. 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 of these 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 members of of sim or this are listed in the Locals window when a simulation breakpoint is reached.


sim.count = 0;





State Machine Table Conventions







View the Local Variables


When Javascript is enabled, you can type script commands in this field that will execute prior to the simulation being run.




Click on this button to save your changes.




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

Learn more

Learning Center topics

(Alt+F1) | Enterprise Architect | Simulation | Simulation | Configure a Simulation