Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Contents |
Prev | Next |
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
Show the Execution Analyzer window using one of the methods outlined here.
On the Execution Analyzer window, either:
- Locate and double-click on the required script and select the 'Simulation' page or
- Click on in the window Toolbar and select the 'Simulation' page
Ribbon |
Code > Build and Run > Analyzer > Analyzer Scripts Execute > Analyze > Analyzer Scripts |
Context Menu |
Project Browser | Right-click on Package | Execution Analyzer |
Keyboard Shortcuts |
|
Configure a Simulation Script
Option |
Action |
See also |
---|---|---|
Platform |
For UML Activity, Interaction or StateMachine simulation, click on the drop-down arrow and select 'UML Basic'. For BPMN diagrams, click on the drop-down arrow and select 'BPMN'. |
|
Entry Point |
Click on the button and select the:
If you do not specify an entry point, the simulator attempts to work through the entire Package. |
|
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 these places:
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 'sim' or 'this' are listed in the Locals window when a simulation breakpoint is reached. sim.count = 0; |
Transition State Machine Table Conventions View the Local Variables |
Input |
When Javascript is enabled, you can type script commands in this field that will execute prior to the simulation being run. |
|
Post Processing Script |
Using a Post Simulation Script, you can run Javascript after the simulation ends. Type in the qualified name of a script from the model script control. For example, if you have a script named 'MyScript' in the Script Group 'MyGroup', type in the value 'MyGroup.MyScript'. |
|
OK |
Click on this button to save your changes. |
Notes
Learn more