Importing a Modelica Library or a Modelica Model

You can import Modelica libraries and models without any external licensing. You can also import Modelica libraries with external license files.

A Modelica file contains the description of one or several libraries, or models. When a Modelica file contains several libraries, importing this file creates several Dymola behavior library references.

Notes:
  • The Import Modelica File command checks if there is an existing library with the same name in the database and allows you to create a new PLM version of the existing library.
  • Encrypted models are imported as read-only files. You can select the top-level node to perform a virtual execution, but you cannot display neither the Modelica text nor the components from the diagram layer.
Important: The structure of the imported Modelica library or model must be correct. See Modelica Library File Structure.

This task shows you how to:

Import a Modelica Library or a Modelica Model without External Licensing

You can import Modelica libraries and models without any external licensing. This is by far the most common case. You can import Modelica files that are encrypted (.moe files) or not encrypted (.mo files) with their associated external resources (.html, .png, .mos, and others).

  1. From the Behavior Authoring section of the action bar, click Import a Modelica File .

    Tip: You can also drag the Modelica file from, for example, the file browser to the work area.

  2. In the Modelica File Import dialog box, browse to find the Modelica file.
  3. In the pane, select the file.

    Important: If you have opened a Modelica file with the same name as the Modelica file you want to import, you must unload that file before import, to avoid name conflicts.

  4. To validate file selection and import your Modelica file, click Open.
    Depending on if a Modelica file with the same name already exists in the database, there are two alternative results:
    • If no Modelica file with the same name exists in the database, the Modelica file is imported in your session as a library reference. Its packages appear from the Package Browser. External files such as .htm, .png or .mos are also imported.
    • If a Modelica file with the same name already exists in the database, the Library Version Management dialog box appears.
  5. If the Library Version Management dialog box does not appear, to save this new library with its behavior content, select Share > Save.
  6. If the Library Version Management dialog box appears, do the following:
    • To let the imported Modelica file replace an existing Modelica file, do the following:
      1. Select The imported library will replace the existing library and click Continue.
        Important: This selection is only possible if you import a library with the same name and the same Modelica version as a library that exists in the database.
        Note: This is the default alternative, if possible.
      2. In the Revision Selector dialog box that appears, select the corresponding library revision from the database and click OK.
        Notes:
        • The dialog box displays all revisions of the selected library in the database.
        • Currently only the revisions (A, B, C...) in the database are displayed, not the Modelica versions. To see both revisions and the corresponding Modelica versions, perform, from the top bar, a search for the library. As an example, to search for a library MyLib, enter dbl:*MyLib* and then click Search.
        • For more information about the Revision Selector, see Collaborative Lifecycle User's Guide: Creating Revisions and Branches: Revision Explorer.

        The Modelica file is imported in your session as a library reference. Its packages appear from the Package Browser. External files such as .htm, .png or .mos are also imported.

        Note: If any of the libraries involved are encrypted, error messages may appear to indicate that you must perform additional actions. See Step 7.

      3. To save this new library with its behavior content, select Share > Save.

        The library revision in the database is overwritten by the imported library.

    • To use the imported library to create a new revision in the database, do the following:
      Note: You can create that new revision from any existing revision in the database.
      1. Select Select an existing library to create a new version with the imported library and click Continue.
      2. In the Revision Selector dialog box that appears, select the revision that the imported library is to be a new revision of, and click OK.
        Tip: Typically, when you want to create a new revision from a new build of a Modelica library, you select the latest revision.
        Notes:
        • The dialog box displays all revisions of the selected library in the database.
        • Currently only the revisions (A, B, C...) in the database are displayed, not the Modelica versions. To see both revisions and the corresponding Modelica versions, perform, from the top bar, a search for the library. As an example, to search for a library MyLib, enter dbl:*MyLib* and then click Search.
        • For more information about the Revision Selector, see Collaborative Lifecycle User's Guide: Creating Revisions and Branches: Revision Explorer.

        The Modelica file is imported in your session as a library reference. Its packages appear from the Package Browser. External files such as .htm, .png or .mos are also imported.

        Note: If any of the libraries involved are encrypted, error messages may appear to indicate that you must perform additional actions. See Step 7.

      3. To save this new library with its behavior content as a new revision, select Share > Save.

        A new revision is created in the database. The revision is created from the selected library and contains the imported library.

  7. When you work with encrypted files, you may get error messages that you have to act on:
    • If you try to replace an encrypted library version with another encrypted library version, a warning appears. You have three choices:
      • To replace the encrypted library with a new encrypted one, click Yes.

        The Modelica file is imported in your session as a library reference. Its packages appear from the Package Browser. External files such as .htm, .png or .mos are also imported.

      • To go back to the previous dialog box without doing any import/replacement, click No.
      • To cancel the import/replacement operation, click Cancel.
    • If you try to replace an encrypted library version with an unencrypted version, an error message appears. To replace an encrypted library with an unencrypted library, you must first remove the encrypted library from the database. This is an administrator task.

Import a Modelica Library with External Licensing

You can import Modelica libraries and models with external licensing. The import is the same as in the task above, but you also have to take care of the licensing file.

Before you begin:
  • Make sure that there is a corresponding authorization file with the file extension .mo_lic in the same directory as the library you are to import.
  • You must yourself be authorized by the original authorization file to perform the import, additional users can only be added when the library is imported.
Import the Modelica library. See previous task.
The result is the same as in the previous task.
Note: The authorization file is also imported as a resource.

Important: You can open the imported library with the computer you imported it with, but other users on other machines must configure the licensing to be able to open the library. It is recommended to always do the configuration. See Prepare Opening a Modelica Library with External Licensing for the First Time.