You can add some breakpoints to the model created when Creating a model for Activity simulation before executing it. This section demonstrates how to suspend the model simulation at some specific points with breakpoints. You can use either the diagram or browser context menu to add a breakpoint to an element. 

The following example shows you how to add breakpoints to pins a and b of the action print. Once the model simulation has reached these pins, the simulation will be suspended. 


To add a breakpoint to an element and simulate the model


  1. Right-click an element and select Simulation > AddBreakpoint(s). The breakpoints will be shown in the Breakpoints pane of the Simulation window.

    Adding Breakpoints to Pin a of print Action
    The Breakpoints Pane in the Simulation Window
    The Breakpoints pane in the Simulation window.
    Opening the Simulation Window from the Main Menu
Clicking Window > Simulation on the main menu to open the Simulation window.

2. Right-click instance in the containment browser and select Simulation > Run to simulate the model from instance, which is the InstanceSpecification of the SumPrinter Classifier.

Executing the InstanceSpecification of the SumPrinter Classifier

3. A new simulation session will be created and displayed in the Sessions pane of the Simulation window. The symbol of the elements with breakpoints attached will be highlighted in yellow by default. Click the Start button on the Simulation window toolbar to animate the simulation on the Print-Sum Activity diagram.

A Simulation Session in the Sessions Pane of the Simulation Window


4.  The simulation will be suspended when pin a or b of the print action is activated. You can hover your mouse pointer over the active element to see its runtime value.

The Simulation Is Suspended When Pin a Is Activated


5. Click the Resume button on the Simulation window toolbar to continue the simulation.

The Resume Button in the Simulation Window


6. The simulation will be suspended again when pin b is activated. Click the Resume button to continue the simulation. In the Console pane of the Simulation window, you can see the printed value of 10, which is the summation between 2 and 8. 

The Console Pane of the Simulation Window Showing the Printed Result of the Summation

 

Note

If you do not want to display animation (silent simulation), you can create Simulation Configuration to customize the simulation, select instance as the simulationTarget, and set silent to true. See Simulating a Simulation Configuration and Simulation Configuration and UI modeling for more information.