
p. 

==<div style="counter-reset: h1 3">==

h1(#simu_simulating_statecharts). Simulating statecharts

Simulating a statechart model means to execute it, raise events manually, have time-based and other events being triggered automatically, and observe the model's behavior.

You can run multiple state machines in parallel and even multiple instances of the same state machine.

An introduction to simulation is given in section "&quot;Simulating the light switch model&quot;":../tutorials/tutorials.html#tutorial_simulating_the_light_switch_model.




h2(#simu_starting_a_simulation). Starting a simulation

You have several options to start a statechart simulation.



h3(#simu_using_the_statechart_model_file_context_menu). Using the statechart model file context menu

The most direct way is to start the simulation based on the statechart model file.
# In the _project explorer_ view, right-click on the statechart model file. The context menu opens.
# In the context menu, select _Run As → Statechart Simulation_, see figure "&quot;Selecting _Run As → Statechart Simulation_ in the context menu&quot;":#simu_fig_run_as_statechart_simulation.

p(#simu_fig_run_as_statechart_simulation). 

!(large)images/simulation_010_statechart_simulator_run_as_statechart_simulation.png(Selecting "Run As → Statechart Simulation" in the context menu)!

p=. Selecting _Run As → Statechart Simulation_ in the context menu



h3(#simu_repeating_the_last_simulation). Repeating the last simulation

In order to re-run the simulation you have most recently executed, simply
* press @[Ctrl+F11]@ on the keyboard
or
* select _Run → Run_ in the main menu.

To be exact, this operation does not necessarily re-run the last _simulation_, but rather the last executed _launch_. So if, for example, you first run a statechart simulation followed by running a Java program, then upon pressing @[Ctrl+F11]@ that Java program is executed once again, not the statechart simulation.



h3(#simu_repeating_a_former_simulation). Repeating an earlier simulation

Let's consider a scenario where you want to execute a simulation that you have run before, but not as the most recently executed launch. So you cannot use the procedure described in section "&quot;Repeating the last simulation&quot;":#simu_repeating_the_last_simulation.

However, as long as you haven't launched too many other programs in between, chances are good to find your simulation in the _history_.

Try the following:
# In the main menu, open the _Run_ menu and move your mouse pointer over the _Run History_ entry.
# A submenu attached to the _Run History_ menu entry opens, containing the most recently executed launches. Check whether the simulation you want to execute is available in the submenu. If it is, select it to start the simulation.



h3(#simu_creating_and_executing_a_run_configuration). Creating and executing a launch configuration

When a statechart is simulated for the first time, a _launch configuration_ is automatically created. A _launch configuration_ describes the parameters used for a particular launch. In case of a statechart simulation, it describes which statechart is to be simulated and the simulation mode (event-driven or cycle-based). For details on how to create and modify a launch configuration, see section "&quot;Configuring a simulation&quot;":#simu_configuring_a_simulation.

To execute an existing launch configuration, proceed as follows:
# In the main menu, select _Run → Run Configurations…_. The _Run Configurations_ dialog appears.
# The list on the left-hand side of the _Run Configurations_ dialog displays all available launch configurations. Select the launch configuration you want to execute.
# Click on _Run_ to execute the launch configuration.




h2(#simu_the_sc_simulation_perspective). The _SC Simulation_ perspective

The _SC Simulation_ perspective provides selected views that are most useful when running a statechart simulation.



h3(#simu_engaging_the_sc_simulation_perspective). Engaging the _SC Simulation_ perspective

When a simulation starts, the perspective usually changes to the _SC Simulation_ perspective. If this doesn't happen, you can manually engage the _SC Simulation_ perspective as follows:

* In the main menu, select _Window → Perspective → Open Perspective → SC Simulation_.

Alternatively, you can do the following:
* In the main menu, select _Window → Perspective → Open Perspective → Other…_. The _Open Perspective_ dialog appears.
* In the _Open Perspective_ dialog, select _SC Simulation_.
* Click on _Okay_. The _SC Simulation_ perspective opens.



h3(#simu_views_contained_in_the_sc_simulation_perspective). Views contained in the SC Simulation perspective

By default, the _SC Simulation_ perspective shows the following views:
* _Project Explorer_ (top-left): This view displays your workspace and projects, folders, and files contained therein. You can also use the _Project Explorer_ to inspect the internal structure of your statechart models.
* _Outline_ (bottom-left): This view is a bird's eye view on the opened statechart. It also indicates the current viewport for better orientation in large models.
* _Simulation_ (right): This view shows the current state of all variables and events during a simulation. A detailed description is available in section "&quot;The Simulation view&quot;":#simu_the_simulation_view.
* %(pro-feature)_Breakpoints_ (right): This view shows a list of all breakpoints. You can use it for disabling, enabling, or removing breakpoints as well as for defining conditional breakpoints.%
* %(pro-feature)_Snapshots_ (right): This view contains all snapshots with their respective names and timestamps.%



h3(#simu_displaying_simulation_progress_in_the_statechart_editor). Displaying simulation progress in the statechart editor

The _SC Simulation_ perspective also includes the statechart editor. In a running simulation, the statechart editor highlights active states by coloring their backgrounds.

When a transition is taken, the transition arc leading from the source state to the target state flashes briefly in the transition highlighting color. After that, the target state becomes active and changes its background to the state highlighting color. The source state's background color becomes normal again.

p(#simu_fig_the_sc_simulation_perspective). 

!(large)images/simulation_020_statechart_simulator_state_off.png(The "SC Simulation" perspective)!

p=. The _SC Simulation_ perspective




h2(#simu_the_simulation_view). The _Simulation_ view

The _Simulation_ view is used to manually raise events and to inspect and modify variables of a running simulation. By default, that view is located on the right-hand side of the "_SC Simulation_":#simu_the_sc_simulation_perspective perspective, see "figure &quot;Simulation view&quot;":#simu_fig_simulation_view for an example.

The _Simulation_ view groups events and variables by their _interfaces_. The unnamed interface appears as _default_ in the interface list. Click on the small triangle left from an interface's name to show or hide that interface's contents, i.e., events and variables.

The simulation view also displays _time events_, provided the statechart uses time constructs like _after_ or _every_. Press or release the _"show time events"_ button !(inlinemediaobject)images/symbol_event_time_016.png(symbol: "show time events")! to toggle between displaying and not displaying time events. You can click on a time event to raise it, i.e., you don't have to wait for 24 hours to elapse in real time until the _"after 24 * 60 * 60 s"_ transition fires.

You can have multiple simulation instances running at the same time. They may simulate the same or different statecharts. Use the simulation view's drop-down menu to switch between simulation instances.

A digital clock right from the drop-down menu displays the virtual time elapsed in the simulation. It pauses while the simulation is suspended.

p(#simu_fig_simulation_view). 
!(shadowless)images/simulation_030_simulation_view.png(The "Simulation" view)!

p=. The _Simulation_ view 

bq.. *Please note:*

Depending on your screen resolution and font size settings, you might not be able to spot the _Simulation_ view by its name, because the tab containing it is quite narrow and might not provide enough space for displaying the title. Hover over the tabs to reveal their respective titles in a pop-up window.

"Figure &quot;The SC Simulation perspective&quot;":#simu_fig_the_sc_simulation_perspective is demonstrating this: The user has hovered the mouse pointer over a tab that just displays the first letters of its title. However, a pop-up window right under the pointer shows the tab's full title "Simulation".




h2(#simu_controlling_a_simulation). Controlling a simulation

* To terminate the simulation, click on the _Terminate_ button !(inlinemediaobject)images/symbol_terminate.png(Symbol: Terminate)!.
* To suspend the simulation, click on the _Suspend_ button !(inlinemediaobject)images/symbol_suspend.png(Symbol: Suspend)!.
* To resume a suspended simulation, click on the _Resume_ button !(inlinemediaobject)images/symbol_resume.png(Symbol: Resume)!.
* Use the _Step Over_ button !(inlinemediaobject)images/symbol_stepover.png(Symbol: Step Over)! to execute a single run-to-completion step.




h2(#simu_interacting_with_a_simulation). Interacting with a simulation

You can interact with a running simulation by manually raising events and by inspecting and modifying variables. You can do so at any point in time, but in most cases you will do it while the simulation "sits idle" at its active state and waits for an event to trigger a transition.



h3(#simu_raising_an_event_in_the_simulation). Raising an event in the simulation

To raise an event, proceed as follows:
# In the simulation view, click on the small triangle to open the interface containing the event, if needed.
# Click on the event to raise it for the next run-to-completion step.



h3(#simu_inspecting_a_variable). Inspecting a variable

To inspect a variable's value, proceed as follows:
# In the simulation view, click on the small triangle to open the interface containing the variable, if needed.
# The variables contained in the interface are displayed.

Watch the displayed values change as the simulation progresses and actions in states or transitions are executed that modify the variables' contents.



h3(#simu_modifying_a_variable). Modifying a variable

To manually modify a variable's value, proceed as follows:
# If needed, open the interface containing the variable by clicking on the small, hollow triangle left from the interface name in the simulation view.
# Click on the variable's value. You can edit the value now.
# Enter the variable's new value and press @[Enter]@. The new value is assigned to the variable and replaces the former value.




h2(#simu_configuring_a_simulation). Configuring a simulation

Section "&quot;Creating and executing a launch configuration&quot;":#simu_creating_and_executing_a_run_configuration describes how to start an existing launch configuration.

The present section describes how to create and configure a new launch configuration for a statechart simulation.

# In the main menu, select _Run → Run Configurations…_. The _Run Configurations_ dialog appears. !images/simulation_040_launch_configuration_01.png(The "Run Configurations" dialog)!
# In the _Run Configurations_ dialog, right-click on _Statechart Simulation_ and select _New_ in the context menu. !images/simulation_040_launch_configuration_02.png(The "Run Configurations" dialog)!<br/>Alternatively, you can select _Statechart Simulation_ and then click on the _New_ symbol near the top-left corner of the dialog. !images/simulation_040_launch_configuration_03.png(The "Run Configurations" dialog)!<br/>However you do it, a new launch configuration is created and displayed in the main area of the _Run Configurations_ dialog. The launch configuration's _Main_ tab is opened.
# Enter the launch configuration's parameters as necessary:
** In the _Name_ text field, change the default name @New_configuration@ to something sensible, e.g., @Light switch@.
** In the _Model file_ text field, enter the path to the statechart model you want to simulate. Click on the _Search_ button to browse for statecharts.
** If your model uses Java operations, specify the Java class implementing those operations in the _Operation class_ text field. If you have multiple Java classes, specify them as a comma-separated list.<br/>!images/simulation_040_launch_configuration_04.png(The "Run Configurations" dialog)!
 
bq.. *Please note:* Besides the _Main_ tab described above, a statechart simulation launch configuration also has a tab named _Common_. This tab is a common standard to all types of launch configurations, and it is described "in the Eclipse documentation":https://help.eclipse.org/oxygen/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Flaunchers%2Fcommon.htm.

p. In addition to creating new launch configurations, you can also duplicate or delete launch configurations in the _Run configurations_ dialog. Right-click on a launch configuration and select _Duplicate_ or _Delete_ from the context menu.





==<div class="pro-feature">==

h2(#advsim_debugging_with_breakpoints_and_snapshots). Debugging with breakpoints and snapshots

h3(#advsim_introduction). Introduction

YAKINDU Statechart Tools' Professional Edition includes two simulator features that increase your productivity considerably when debugging statecharts:
* You can attach *breakpoints* to states and transitions. If a statechart simulation reaches a transition or state with a breakpoint, it suspends execution of the simulation. A breakpoint can be amended with a _condition_. Such a breakpoint will suspend the simulation only if that condition is fulfilled, i.e., evaluates to _true_.
* You can create *snapshots* of your statechart simulation. A snapshot contains everything making up your state machine simulation at any point in time. It describes the state of the state machine. Snapshots can be saved and restored later in order to continue the simulation from exactly the point the snapshot was taken.


h4(#advsim_the_light_switch_example). The light switch example

Throughout this chapter we will be using the _light switch_ statechart as an example. It models a lamp which can be turned on and off and also supports various brightness values.

If you press the _pressLightOn_ button, the lamp turns on at its lowest brightness value. If you operate _pressLightOn_ repeatedly, each time the lamp becomes brighter until it reaches its maximum brightness. Pressing the _pressLightOff_ button immediately turns off the light completely. The brightness can only be raised as long as it hasn't yet reached its maximum value of five. After that, the guard condition disallows to raise it any further.

Here's the light switch example's statechart followed by its definition section:

p(#advsim_fig_the_light_switch_sample_statechart). 
!images/advsim_010_lightswitch_010_statechart.png(The light switch sample statechart)!

p=. The light switch sample statechart

bc.. interface:
    in event pressLightOn
    in event pressLightOff

interface Lamp:
    var brightness: integer
p. 



h3(#advsim_breakpoints). Breakpoints

Breakpoints allow for automatically suspending the simulation when a certain element of the state machine is activated. Optionally, a halting condition can be specified to better control the behavior of a breakpoint. Breakpoints can be set on transitions or states. If a state or transition with a breakpoint is reached, the simulation pauses, and the current state of variable values can be examined in the simulation view. It is possible to change variable values and to trigger events that will be raised when the simulation run is manually resumed.



h3(#advsim_executing_in_debug_mode). Executing in debug mode

To make use of breakpoints, the statechart simulation needs to be executed in debug mode. You have already seen how to "start a statechart simulation in run mode":#simu_starting_a_simulation. For using breakpoints and snapshots, however, the _debug mode_ is needed.

# Right-click on the statechart model. The context menu opens.
# Select _Debug As → Statechart Simulation_, see "Figure &quot;Starting a simulation in debugging mode&quot;":#advsim_fig_starting_a_simulation_in_debugging_mode.
# The statechart simulation starts in the debugging mode.

p(#advsim_fig_starting_a_simulation_in_debugging_mode). 
!(shadowless)images/advsim_020_start_debugging_010_debug_as_menu.png(Starting a simulation in debugging mode)!

p=. Starting a simulation in debug mode


h4(#advsim_setting_a_breakpoint). Setting a breakpoint

# Right-click on a state or transition. The context menu opens.
# Select _Toggle breakpoint_ from the context menu, see "Figure &quot;Setting a breakpoint&quot;":#advsim_fig_setting_a_breakpoint.

p(#advsim_fig_setting_a_breakpoint). 
!(shadowless)images/advsim_030_breakpoint_010_setting_on_transition.png(Setting a breakpoint)!

p=. Setting a breakpoint

States and transitions with a breakpoint are labeled with a !(inlinemediaobject)images/symbol_breakpoint_enabled.png(Symbol: Breakpoint enabled)! symbol. "Figure &quot;Breakpoints on transition and state&quot;":#advsim_fig_breakpoints_on_transition_and_state shows an example.

p(#advsim_fig_breakpoints_on_transition_and_state). 
!(shadowless)images/advsim_030_breakpoint_020_transition_and_state_with_breakpoints.png(Breakpoints on transition and state)!

p=. Breakpoints on transition and state


h4(#advsim_hitting_a_breakpoint). Hitting a breakpoint

If the simulation runs into a _state_ with a breakpoint, the state's entry actions, if any, are executed. After that, execution of the state machine is suspended. The state is highlighted by a small green border.

!images/advsim_030_breakpoint_030_suspending_at_state.png(Highlighting a suspended state)!

p=. Highlighting a suspended state

If the simulation runs into a _transition_ with a breakpoint, execution of the state machine is suspended. The transition is highlighted by drawing the transition arc in green. The transition's actions, if any, are executed when the state machine is resumed.

!images/advsim_030_breakpoint_040_suspending_at_transition.png(Highlighting a suspended transition)!

p=. Highlighting a suspended transition


h4(#advsim_continuing_the_simulation). Continuing the simulation

In order to continue from a breakpoint, you have two options:

* To continue execution, click on the resume button !(inlinemediaobject)images/symbol_resume.png(Symbol: Resume)! in the simulation view. The statechart simulation continues until the next breakpoint is hit or the simulation is terminated.
* To execute only the next run-cycle of the simulation and then suspend again, click on the step-over button !(inlinemediaobject)images/symbol_stepover.png(Symbol: Step Over)! in the simulation view.


h4(#advsim_using_the_breakpoints_view). Using the breakpoints view

The _breakpoints_ view shows a list of all breakpoints. The respective breakpoint name identifies the state or transition in question. See "figure &quot;Breakpoints view&quot;":#advsim_fig_breakpoints_view for an example.

You can use the _breakpoints_ view for disabling, enabling, and removing breakpoints as well as for defining "conditional breakpoints":#advsim_conditional_breakpoints.

p(#advsim_fig_breakpoints_view). 
!images/advsim_030_breakpoint_050_enabled_and_disabled_breakpoints.png(The "Breakpoints" view)!

p=. The _Breakpoints_ view


h4(#advsim_enabling_and_disabling_breakpoints). Enabling and disabling breakpoints

A breakpoint is either enabled or disabled.

* An _enabled_ breakpoint causes the statechart simulation to suspend when reaching it. In the statechart and in the breakpoints view, an enabled breakpoint is visualized by a filled light blue circle with a grey border: !(inlinemediaobject)images/symbol_breakpoint_enabled.png(Symbol: Breakpoint enabled)!.
* A _disabled_ breakpoint is ignored by the statechart simulation. In the statechart and in the breakpoints view, a disabled breakpoint is visualized by a hollow circle with a grey border: !(inlinemediaobject)images/symbol_breakpoint_disabled.png(Symbol: Breakpoint disabled)!.

"Figure &quot;Breakpoints view&quot;":#advsim_fig_breakpoints_view shows an enabled and a disabled breakpoint in the statechart editor and in the breakpoints view, respectively.

You can instruct the statechart simulation to _skip all breakpoints_ by clicking on the !(inlinemediaobject)images/advsim_button_breakpoint_skip_disengaged.png(Button [disengaged]: Skip all breakpoints)! button in the breakpoints view. The button will appear "pressed", and while it is, the "skip breakpoints" functionality is engaged. That means, the simulation will not suspend at any breakpoint.

This is different from _disabling all breakpoints_, in that each breakpoint keeps its state of being enabled or disabled. Once you disengage the skip breakpoints functionality by clicking on the !(inlinemediaobject)images/advsim_button_breakpoint_skip_engaged.png(Button [engaged]: Skip all breakpoints)! button again, the simulation will suspend again at enabled breakpoints and will not suspend at disabled breakpoints.


h4(#advsim_removing_breakpoints). Removing breakpoints

In order to remove _some_ breakpoints, select these breakpoints in the breakpoints view, then click on the !(inlinemediaobject)images/advsim_button_remove.png(Button: Remove)! button. The selected breakpoints will be removed.

To remove _all_ breakpoints, click on the !(inlinemediaobject)images/advsim_button_remove_all.png(Button: Remove all)! button


h4(#advsim_conditional_breakpoints). Conditional breakpoints

A _conditional_ breakpoint has an associated condition and suspends the simulation only if
* that condition is fulfilled (true) _and_
* the breakpoint is enabled.

In order to attach a condition to a breakpoint, proceed as follows:
* In the breakpoints view, select the breakpoint in question.
* Check the _Conditional_ checkbox, see "figure &quot;Breakpoints view&quot;":#advsim_fig_breakpoints_view in the lower right area. The associated text field becomes writable.
* Enter the condition into the text field. Like in the statechart editor, a content assist is available when pressing @[Ctrl+Space]@. The expression you entered into the text field is validated automatically. In the example shown in "figure &quot;Breakpoints view&quot;":#advsim_fig_breakpoints_view, the transition suspends the simulation only if the variable _brightness_ has a value of 4.



h3(#advsim_debugging_a_statechart). Debugging a statechart

h4(#advsim_changing_variable_values). Changing variable values

In the suspended status of a statechart simulation, you can change variable values using the simulation view. When continuing execution – see section "Continuing the simulation":#advsim_continuing_the_simulation – you can observe how your state machine behaves with those modified values.


h4(#advsim_raising_multiple_events_simultaneously). Raising multiple events simultaneously

If you click on an event's name in the simulation view to raise that event in normal simulation, i.e., while execution isn't suspended, the state machine processes that event and takes the corresponding transition, if any.

However, while the simulation is suspended, you can raise multiple events, without instant execution. Once execution resumes, the state machine's behavior depends on its "execution scheme":../user-guide/code_generation_intro.html#codegen_execution_schemes:
* In the _cycle-based_ execution scheme, both events are handled at the same time, or, to be more exact, in the same run-to-completion step (RTC).
* In the _event-driven_ execution scheme, each of the two events will trigger a run-to-completion step (RTC) of its own.

==<div class="example">==

Let's have a look at an example. Please note that this example uses the _cycle-based_ execution scheme! This is important, because in the the _event-driven_ case the state machine's behavior would be different.

Let's consider that you want to press the &quot;light on&quot; and &quot;light off&quot; buttons _at the same time_ and want to observe what happens. "Figure &quot;Raising multiple events simultaneously&quot;":#advsim_fig_raising_multiple_events_simultaneously_1 shows the scenario:

p(#advsim_fig_raising_multiple_events_simultaneously_1). 
!images/advsim_040_multiple_events_010_events_not_raised.png(Raising multiple events simultaneously [1])!

p=. Raising multiple events simultaneously &#91;1]

* The simulation has encountered a breakpoint at the _LightOn_ state and has been suspended there.
* The simulation view shows the _pressLightOn_ and the _pressLightOff_ events. Both events are labeled with a !(inlinemediaobject)images/symbol_event.png(Symbol: Event [not raised])! symbol, meaning the respective event is not raised.

p(#advsim_fig_raising_multiple_events_simultaneously_2). 
!images/advsim_040_multiple_events_020_events_raised.png(Raising multiple events simultaneously [2])!

p=. Raising multiple events simultaneously &#91;2]

* Clicking on an event raises it and adds a blue triangle to the event symbol: !(inlinemediaobject)images/symbol_event_raised.png(Symbol: Event [raised])!. Since the simulation remains suspended, the user can raise multiple events.

Both events are raised and will be handled by the state machine during the next run-to-completion step. The latter will be performed as soon as the user clicks on the step-over button !(inlinemediaobject)images/symbol_stepover.png(Symbol: Step Over)! or the resume button !(inlinemediaobject)images/symbol_resume.png(Symbol: Resume)!.

bq. *Please note:* Under the _even-driven_ execution scheme, multiple events are never processed at the same time. Each event triggers a separate RTC.

==</div>==

bq. *Please note:* While the execution is still suspended, you can "unraise" an already raised event by clicking on the event symbol !(inlinemediaobject)images/symbol_event_raised.png(Symbol: Event [raised])! a second time. The blue triangle will disappear, and upon continuation of the simulation the event will not be handled.

h5(#advsim_transition_priorities). Transition priorities

It is important to understand that in the event-driven execution scheme there is a queue of events, while in the cycle-based scheme there isn't. If in the latter case multiple events occur simultaneously, they are all present at the same time, and the state machine has to figure out which event should trigger which transition. For example, what should the light switch state machine do, if it is in the *LightOn* state and both events, _pressLightOn_ and _pressLightOff_, have been raised simultaneously?

The answer is "transition priorities":../user-guide/statechart_language.html#sclang_transition_priorities. The state machine always consults the active state's transitions in a well-defined order, it fires the first matching transition it encounters, and it forgets about the rest. Transition priorities are specified in the corresponding property of the respective state, see "figure &quot;Transition priorities&quot;":#advsim_fig_transition_priorities. You can change these priorities, and thus the order the transitions are being checked, by selecting a transition and moving it up or down by clicking on the respective button.

The first transition whose condition is fulfilled will be executed. Under the cycle-based execution scheme, all remaining events are quashed. In the light switch example as shown in "figure &quot;Transition priorities&quot;":#advsim_fig_transition_priorities, the _pressLightOff_ event would "win" and trigger a transition from the *LightOn* to the *LightOff* state, while the _pressLightOff_ event would be discarded. 

p(#advsim_fig_transition_priorities). 
!images/advsim_040_multiple_events_030_transition_priorities.png(Transition priorities)!

p=. Transition priorities



h3(#advsim_snapshots). Snapshots

The snapshot feature allows to store and restore the state of a simulation run. A snapshot comprises all _active states_ of the state machine as well as all _variable values_ at the time of snapshot creation. 

This feature is especially useful when testing complex state machines in which a number of steps need to be taken before reaching a certain situation you want to investigate. Using snapshots, you can store this desired situation once and then simply restore it anytime and as often as you like, without having to repeat all the tedious steps to reach that situation from scratch. Depending on the complexity of your use case, using snapshots can be a huge time-saver.


h4(#advsim_creating_a_snapshot). Creating a snapshot

To create a snapshot of the current statechart simulation, proceed as follows:

# Change to _Snapshots_ view on the right-hand side of the YAKINDU Statechart Tools window.
# Click at the camera button !(inlinemediaobject)images/advsim_button_camera.png(Button: Camera)! in the view's toolbar.
# The snapshot is taken and appears in the snapshot list. It is labeled "Snapshot" (can be changed), and it is tagged with the current timestamp. "Figure &quot;A freshly taken snapshot&quot;":#advsim_fig_a_freshly_taken_snapshot shows an example.

p(#advsim_fig_a_freshly_taken_snapshot). 
!images/advsim_050_snapshots_010_a_freshly-taken_snapshot.png(A freshly taken snapshot)!

p=. A freshly taken snapshot


h4(#advsim_the_snapshots_view). The snapshots view

The _snapshots_ view consists of two parts.
* The _snapshot list_ in the upper half contains all snapshots with their respective names and timestamps.
* The _snapshot details_ part in the lower half displays the contents of the snapshot. It contains two different views which can be toggled via its toolbar buttons:
** !(inlinemediaobject)images/advsim_button_snapshot_variable_overview.png(Button: Show all variable values)!: shows all variable values
** !(inlinemediaobject)images/advsim_button_snapshot_image_overview.png(Button: Show image overview)!: shows an overview image of the state machine with the active state(s) being highlighted

p(#advsim_fig_inspecting_a_snapshot). 
!(shadowless)images/advsim_050_snapshots_040_snapshot_details_combined.png(Inspecting snapshot details: variables overview [left], states overview [right])!

p=. Inspecting snapshot details: variables overview [left], states overview [right]

h4(#advsim_restoring_a_snapshot). Restoring a snapshot

To restore a snapshot for execution, proceed as follows:
# Select the snapshot to be restored.
# Click at the _restore_ button !(inlinemediaobject)images/advsim_button_snapshot_restore.png(Button: Restore snapshot)!.
# The snapshot is restored as an additional executing state machine instance.

bq. Please note: When the semantics of the underlying state machine have been changed, it might not be possible to restore a snapshot, e.g., when the active state has been deleted.

h4(#advsim_naming_a_snapshot). Naming a snapshot

The label of a snapshot can be changed as follows:
# Click at its label. The label becomes an editable field.
# Enter the new snapshot name and press @[Return]@, or click anywhere outside the editable field.

h4(#advsim_deleting_a_snapshot). Deleting a snapshot

* To delete one or more snapshots, select the snapshots to be deleted, then click on the _remove_ button !(inlinemediaobject)images/advsim_button_remove_red.png(Button: Remove)!.
* To delete _all_ snapshots, click on the _remove all_ button !(inlinemediaobject)images/advsim_button_remove_all.png(Button: Remove all)!.

==</div>==

==</div>==
