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
Right-click an element and select Simulation > AddBreakpoint(s). The breakpoints will be shown in the Breakpoints pane of the Simulation window.
The Breakpoints pane in the Simulation window.
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.
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.
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.
5. Click the Resume button on the Simulation window toolbar to continue the simulation.
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.
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.