Exporting a Library or a Model to a Modelica File

You can export a library or a model to a Modelica file. For a library, you have some options:

  • You can export a library as one file or as a hierarchy of files.
  • If you export the library as one file, you can also encrypt it.

A library is exported with its associated external resources (.html, .png, .mos...).

A model, including its subclasses, can only be exported as one encrypted file.

This task shows you how to:

Exporting a Library to a Single Modelica File, Optionally Encrypted

You can export a behavior library to a single Modelica (.mo) file, and optionally encrypt it (to a.moe file).

  1. Activate the library to export.
  2. Click Export to Modelica File .
  3. To select how to export: and click OK.
    1. Select Export Library, with content of package saved in one file.
    2. Optional: To encrypt the exported file, activate Encrypt exported data.
    3. Click OK.
  4. Browse to export your Modelica file to the convenient folder.

    A new folder is created at the selected location, containing the file of the exported library, including its external resources. A .mo file represents an unencrypted library, a .moe file represents an encrypted library.

Exporting a Library to a Hierarchy of Folders and Files

You can export a behavior library to a hierarchy of folders and files. You cannot export this hierarchy as encrypted, the resulting Modelica files are .mo files.

  1. Activate the library to export.
  2. Click Export to Modelica File .
  3. Select Export Library, in a hierarchy of files and click OK.

    Note: The option Encrypt exported data in unconditionally cleared in this case.

  4. Browse to export your Modelica file hierarchy to the convenient folder.

    The Dymola: Hierarchical storage dialog box appears.
  5. To select how to store the hierarchy, do the following:
    1. In the dialog, right-click the top folder and select any of:
    • To export the library as one file, select One File.

      This alternative is, for this folder, the same as the first task above, saving the library as one file, except that encryption cannot be selected. If you select this alternative, no additional selection can be made for any subfolder.

    • To export this package as a directory, select One Directory.

      This package is exported as a directory. By default, all subdirectories are exported as files in this directory, if no additional change is made.

    • To export this package, and all subpackages, as directories, select Directories for all sub-packages.

      This package is exported as a directory, and by default all subpackages are exported as subdirectories, if no additional change is made.

    • To replicate the folder structure of another package to this package, select Match Directory Structure Containing Similar Package....

      A Load dialog box appears to let you select the package to supply the structure.

      The basic case is that you have created a new library that is to be a development of a present library, and you want to replicate the structure of the present library.

      When you have loaded the present package, your new library is adapted to that structure.

  6. To refine the structure, you can do the following:
    1. In the dialog, expand the folder structure.
    2. For each folder, if the enclosing folder is not selected as File, you can right-click it and select any of the four above alternatives.
  7. Click OK to export your library with the selected structure.
    A new folder is created at the selected location, containing the exported library hierarchy, with its external resources included.

Exporting a Model to a Single Encrypted Modelica File

You can export a model to a single encrypted Modelica file. This file also contains all dependencies of the model.

  1. Activate the model to export.
  2. Click Export to Modelica File .
  3. Select Export Total Class (with dependencies) and click OK.

    Note: The option Encrypt exported data is unconditionally selected.

  4. Browse to export your Modelica file to the convenient folder.

    A new folder is created at the selected location, containing the encrypted file of the exported class, with dependencies included.