Working with Coupled Analysis Snapshots

System Coupling's snapshot capabilities allow you to capture the current state of a coupled analysis as a whole and then later restore the analysis to that state. This functionality is available for coupled analyses run using either System Coupling's GUI or its CLI.

Snapshots give you the ability to save and return to a specific point in a coupled analysis, providing you with:

  • more latitude to experiment with different coupled analysis settings, without needing to remove unrelated files manually or lose existing data;

  • improved portability and file management capabilities for coupled analyses, and

  • reduced storage requirements when saving multiple coupled analysis configurations.


Note:
  • Snapshot functionality is not available when coupling participants have been started or another instance of System Coupling is already running in the current working directory.

  • Some snapshot operations can be performed only by running a command, either in System Coupling's CLI or on its GUI's Command Console tab.


Creation of Snapshots

A snapshot captures the current state of the coupled analysis as a whole (rather than just of the data model). It includes all the files and directories contained in System Coupling's working directory that are necessary to restore the coupled analysis to its current state — specifically, the SyC subdirectory and the coupling working directories of all loaded coupling participants.

Both the SyC directory and coupling participants' working directories must be subdirectories of System Coupling's working directory. If a participant places its working directory elsewhere or attempts to reuse System Coupling's working directory, its state data will not be included in any snapshots created for the analysis. Additionally, snapshots cannot be created or opened after participants have been started (that is, when a Solve operation has been started or the Initialize() or Step() interactive solve command has been issued).

Snapshots can be created by either of the following methods:

Automatically:

System Coupling automatically creates an initial coupled analysis snapshot named Initial.zip (if it does not already exist) when the coupling participants are started by any method.


Note:  The creation of an initial snapshot is controlled by the OutputControl.WriteInitialSnapshot setting, which defaults to True. To disable initial snapshot generation, change the value to False.


On Demand:

You can create snapshots on demand using the Save Snapshot operation, as described in Saving a Snapshot. There is no limit on the number of snapshots that can be created.

When a snapshot is created, System Coupling first saves the coupled analysis and its data model, then writes required state information to an archive fie (.zip) of the specified file name in the SyCSnapshots subdirectory of its working directory.

Saving a Snapshot

You can save a snapshot of the coupled analysis state at any time (provided that the coupling participants have not been started). To save an on-demand snapshot, you can use either of the following methods:

Saving a snapshot in the GUI:

Select File > Save Snapshot and specify a name for the snapshot in the dialog that opens.

Saving a snapshot in the CLI:

Run the SaveSnapshot() command, using the required SnapshotName argument to specify a name for the snapshot.

System Coupling writes the coupled analysis state information to an archive of the specified name in the SyCSnapshots subdirectory of its working directory. You can use the snapshot to restore the analysis to the saved state, as described in Opening a Snapshot.

Overwriting an Existing Snapshot

Snapshots must have unique names within the analysis. If you attempt to save a new snapshot with the name of a snapshot that already exists, by default the existing snapshot will not be overwritten. If you wish to replace the existing snapshot with the one you are saving, use the optional OverwriteExisting argument with the SaveSnapshot() command, as follows:


>>> SaveSnapshot(SnapshotName='Initial', OverwriteExisting=True)

Printing a List of Available Snapshots

You can view a list of the snapshots available for a coupled analysis to System Coupling's Transcript. This is useful for finding the snapshot name needed to open a particular snapshot.

To do so, run the PrintSnapshots() command in the CLI or on the GUI's Command Console tab. A list containing the names and time steps of each snapshot that exists for the coupled analysis is printed to an Available Snapshots section in the Transcript.


>>> PrintSnapshots()

+-----------------------------------------------------------------------------+
|                             Available Snapshots                             |
+-----------------------------------------------------------------------------+
| FinalState                                                                  |
|    Steps :                                                          1, 3, 5 |
| InitialState                                                                |
|    Steps :                                                                  |
+-----------------------------------------------------------------------------+

Opening a Snapshot

When directed to open a snapshot, System Coupling looks in the SyCSnapshots subdirectory of its current working directory for snapshot archives. You can open a snapshot using the following methods:

Opening a snapshot in the GUI:

Select the File > Open Snapshot menu option and use the dialog that opens to specify the name of the snapshot to be opened.

Opening a snapshot in the CLI:

Run the OpenSnapshot() command.

  • If only one snapshot exists, then System Coupling opens that snapshot by default.

  • If more than one snapshot exist, then use the required SnapshotName argument to specify the name of the snapshot to be opened.

System Coupling restores the coupled analysis to its previously saved state, opening the snapshot to the most recent restart point available. (Note that this is not necessarily the restart point that was open at the time the snapshot was created.) All files and directories in the snapshot are restored to the coupled analysis working directories, overwriting the files and directories corresponding to the current state. Other state files and directories (that is, which are not included in the snapshot) are not affected.


Note:  If expression functions are used in the analysis and changes were made to modules before the snapshot was saved, then inconsistencies between the modified modules and the expression definitions may cause validation errors when the snapshot is opened later. For more information, see Reloading Expression Function Modules.



Tip:

Deleting a Snapshot

You can delete a snapshot from the CLI or on the GUI's Command Console tab.

To do so, run the DeleteSnapshot() command, using the required SnapshotName argument to specify the snapshot to be deleted.


>>> DeleteSnapshot(SnapshotName = 'Initial')