WSMLink`
WSMLink`

WSMSaveModel

WSMSaveModel is being phased out in favor of the Export format "MO", which was introduced experimentally in Version 11.3.

WSMSaveModel["mmodel"]

saves a model previously associated with a location.

WSMSaveModel["location","mmodel"]

saves the model mmodel in files in location.

Details

  • The mmodel refers to the fully qualified Modelica names.
  • The mmodel can be given as a string or as DotName.
  • The shortest unique model name mmodel can be used where WSMNames["*.mmodel"] gives a unique match.
  • The first time a new model is saved, a location has to be given with WSMSaveModel["location","mmodel"].
  • If location is a path to a file mmodel.mo, the model is saved in that single file.
  • If location is a path to a directory, the package "mmodel" is saved in a hierarchical directory structure.
  • Subsequent calls to WSMSaveModel automatically determine the file where the model is saved.
  • WSMSaveModel saves all contents of mmodel, including models contained in it.
  • WSMSaveModel returns WSMModelData["mmodel"] if it succeeds, and $Failed if it fails.

Examples

open allclose all

Basic Examples  (3)

Load Wolfram SystemModeler Link:

Create a new model:

Save the model:

Show the saved file:

Clean up by deleting the new file and model:

Create a new model inside a new package:

Save the package in a directory structure:

The package is saved in a directory "MyPackage", where files mirror the model structure:

Clean up by deleting the new files and model:

Possible Issues  (1)

Already saved models cannot be saved in a different place using WSMSaveModel:

Make a copy of the model to save it in a different location:

Clean up by deleting the new files and model: