Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Group

Model Interaction, Snapshot

Description

Takes

Take or

restores

restore a snapshot of the model. A snapshot is an image of the model, at a specific time, this snapshot contains the following values for the model: states, parameters, inputs and outputs.

Required Control

Snapshot Control (or Monitoring Control).

Usage

RtlabApi.Snapshot (cmd, fileName, overwrite, increment, comment, commentLength)

Input

  • cmd: see OP_SNAPSHOT_CMD.

  • fileName: Path on the target (optional) + name of file (without any extension) in which snapshot information is to be saved or to be read. This parameter is case-sensitive when the target runs on Linux.

  • overwrite: True to overwrite the file if it already exists. If this parameter is set to false, a new snapshot file will be created each time a snapshot is taken. An incremental suffix (number) is added to filename.

  • increment: Used only when restoring a snapshot. When taking a snapshot and if overwrite is set to false, a number is added at the end of the filename. This number is chosen automatically and is incremented with each new snapshot. When restoring a snapshot, the increment is used to select file created with an automatic number.

  • comment: User comments to add to the snapshot file.

  • commentLen: Length in number of bytes of the comment string input parameter.

Output

None

Exception

  • EOK: Success.

  • E2BIG: Filename length or comment length too big.

  • EPERM: Snapshot control had not been granted to this client.

  • EFAULT: Invalid snapshot file name.

  • EINVAL: Trying to take snapshot when system is not loaded or trying to restore snapshot when system is not paused.

  • EBADF: Model not specified by previous

OpalConnect
  • Connect or

OpalSetCurrentModel
  • OpenProject.

  • EIO: Error sending the request or receiving the reply.

  • OP_API_MODEL_IO_TIMEOUT: Timed out waiting for a reply from the model.

  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.

  • ENODEV: Snapshot has been disabled.

  • EPERM: An error occurs when taking or restoring a snapshot.

  • EBUSY: A snapshot command is already in progress. Try again later.

Examples

See example snapshot.

Related Items

GetMonitoringControl, OP_SNAPSHOT_CMD.

Modules

import RtlabApi