Export/Import models

To exchange models with others or to safeguard your modeling progress the Export Library and Import Library functionality is provided.

Export Libraries

The export mechanism is provided by the Tree View. Right-click on the library you wish to export and choose Export Library... to start the export process.

Only top-level libraries can be exported.

The export process in detail

  1. A check is performed to find library dependencies.
  2. A subsequent check is performed on the library and its dependencies to find inconsistencies with the model database. These inconsistencies originate from physically altering models, that is, renaming them or moving them to different locations.
  3. When inconsistencies with the model database were detected you will be prompted to resolve them.

    Be aware that resolving these inconsistencies is important to ensure that the exported libraries are working on other MLDesigner installations.

  4. In case the models you try to export contain construction errors the resolve process is canceled. Construction errors have to be solved manually in order to guarantee a successful export.
  5. When all required models are consistent or the resolve process was canceled the Export Library dialog appears.
  6. The Export Library dialog presents you with the libraries which will be exported. You may choose whether or not to export any dependent libraries by using the check mark in front of a library.
  7. You can define a different directory in which the created archive (.mar.gz) will be placed. Make sure you have read/write access to this directory.

Protecting Intellectual Property

Intellectual property can be protected if needed. You can do this by clearing the check mark for Include *.pl Files and adding a check mark to Include *.o Files, in the Export Library dialog. This ensures that only compiled object files are exported to the archive. Note that precompiled systems are platform dependent. It is not possible to export precompiled objects and execute the simulation on another platform. To do this the entire library must be recompiled after being exported and imported again.

With extremely large systems the size of the archive could be an inhibiting factor. To reduce the size of the archive exclude the .htm online documentation and the .o files.

Import Libraries

The Import Library option is only available on the model bases My Libraries and Shared Libraries in the Tree view.

Right-click on My Libraries or Shared Libraries and choose Import Library... to start the import process.

The import process in detail

  1. The Select Archive dialog is shown and allows the selection of mar and tar archives in the formats .mar, .tar, .mar.gz, .tar.gz and .tgz.
  2. The Import Library dialog shows the file types included in the archive (.mml, .htm, .pl, or .o files) and lists the top-level libraries it contains.

    If there are several libraries listed, the first library (depicted in gray) is the one which was previously exported. Any library subsequently listed is a dependency and can be de-/selected for the import. The main purpose of this is to resolve errors where imported libraries would overwrite existing libraries.
    In this case you can deselect offending libraries and only import libraries which won't conflict with existing libraries.
    The main library cannot be de-/selected. If it should conflict with an existing library, the import should be aborted, and restarted after the existing library was moved or renamed.
  3. After accepting the dialog with OK, the selected top-level libraries are extracted and appear in the Tree View after the import is completed.

Troubleshooting

Broken models due to duplicate GIDs

Figure 1: warning message
Figure 2: Log window

It's possible that the archive you are trying to import contains more than one model with the same Global ID (GID).

A model's GID is supposed to be unique and cannot be directly influenced by the user. However, it is possible (due to software bugs in previous versions of MLDesigner) that there is more than one model with the same GID. The import will detect these models and generate new GIDs for them. A warning message will inform you of this. It will also list the models which possibly contain references to the models with now regenerated GIDs (which is also put out to the Log window for later reference).

To repair these models proceed as follows:

  1. Open the broken model by double-clicking the appropriate entry in the Log Window (broken models are indicated by an exclamation mark in front of the log entry).
  2. Inspect the model for instances of models that caused the breakage (they are listed as subitems to the log entry from the previous step and are indicated by an i in front of them).
  3. Replace every instance you find with a new instance of the appropriate model, even if they're already correct, because internally the model is still referencing the old GID.
    Additionally it is necessary to check the replaced instances for proper connections to other instances, correct parameter values and argument links.
  4. Save the model and repeat these steps for any other broken model listed in the Log window.
Example
Figure 3: Receiver in broken model
Figure 4: Transmitter in broken model
Figure 5: Receiver in fixed model

The warning message and the log window above (fig. 1 and 2) tell you that the models $MLD_USER/StopWaitExample/Receiver and $MLD_USER/StopWaitExample/Transmitter had the same GID which caused the StopWaitSystem to break.

Once opened, the error in the StopWaitSystem (fig. 3 and 4) is apparent. The Receiver instance has an unconnected port, its tooltip shows that it's actually an instance of Transmitter, and the Parameters shown in the Instance Properties are actually those of the Transmitter.

To fix this, both the Receiver and the Transmitter instance have to be replaced with a new instance of the respective model. This can be easily done by dragging the appropriate model from the Tree View directly onto the instance to be replaced.

In this example, replacing the Transmitter instance is enough, it will cause the correct GID to be used. However, just replacing the Receiver instance is not enough. Unlike the Transmitter, the Receiver actually has two output ports (not two input ports) and only one Parameter AckLength (not two, TimeoutPeriod and MaximumQueueSize). So the connection to Channel#2 has to be remade and the value of the Parameter AckLength has to be set properly (fig. 5).