Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.



Model Interaction, Snapshot


Take or 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).


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


  • 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.




  • 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 Connect or 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.


See example snapshot.

Related Items

GetMonitoringControl, OP_SNAPSHOT_CMD.


import RtlabApi


OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323