Saving and Restoring Model Snapshots via API

Saving / restoring model snapshot from simulation experiment, optimization, calibration, parameter variation, sensitivity analysis, Monte-Carlo, compare runs experiment

You can save and restore model snaphots using API functions which both take one parameter – the name of the snapshot file. Call them as follows:

These both functions return immediately (operations are performed in a separate thread). When the function returns it doesn’t mean that operation is complete – it may be still in progress. In order to monitor events of snapshot actual loading/saving (and perform any actions), listeners can be provided (see addSnapshotEventListener and removeSnapshotEventListener functions of Presentation class).

Saving / restoring model snapshot from custom experiment

You can also save and restore model snapshots from custom experiment code using the following functions of Engine:


When you create a custom experiment, the experiment has default auto-generated code (see the custom experiment's properties, Code section) containing this line of code: Engine engine = createEngine();

This code creates engine and stores it in the local variable engine. Use it to call the functions mentioned above. To call the functions, write the following code:


Main root = (Main)engine.loadRootObjectSnapshot("C:\Model\Model.als");

Or, instead of typing the code, you can automatically insert the load snapshot function call while creating a custom experiment, by selecting the checkbox Load top-level agent from snapshot on the second page of the New Experiment wizard.