Importing Twin Builder Models

Twin Builder lets you import multiple models and symbols, as well as create or update multiple components using the imported models and symbols. The following simulation model file types can be imported:

Additionally, SVG Symbols (SVG) can be imported.

Follow this procedure to import simulation models into a Twin Builder project:

  1. Select Tools > Project Tools > Import Twin Builder Models. A file selection dialog box appears in which you can browse to the file containing the models to import.
  2. When you have located the desired model file, click OK.
    Note:

    The location of imported CModel DLL files is set in the Twin Builder Options panel.

    Note:

    For a Modelica import, a Select Model dialog box appears showing the models, blocks, and classes contained in the selected model or package file. It shows the complete package hierarchy if the selected file is from the library. Review the package hierarchy and choose the desired model, block, or class.

    Select Use External Solver to enable simulation of the selected model using an external solver. The component of selected model will include the following properties that are used to control the usage of the external solver:

    • _cs_solver – Solver used in Co-Simulation. 0 - CVode, 1 – fixed step-size explicit Euler

    • _cs_rel_tol – relative tolerance when CVode is used

    • _cs_step_size – step size for Explicit Euler

    When finished, click OK.

    After model compilation, select the model interfaces you want to expose in the Twin Builder component. See Selecting Component Interface for detailed information.

A progress dialog box shows compilation progress of each model. Click Stop to end the compilation progress, ignoring the remaining models. Models compiled before you clicked Stop are imported.

The Import Components dialog box appears.

If a model fails to compile, the dialog box shows failed status for that model, and a new failed simulation model tab is added to the dialog box listing the error messages for each failed model.

To add models to a component in the panel:

  1. Find the component to which you want to add more models, then click Models > Modify Model Selection.

  2. The Modify Selection dialog box displays, listing all available imported models with compatible interfaces in the left box. Use the arrows to move selected models to the right list-box. To select models from a library, click Select From Library.

  3. Click OK to add all selected models to the component.

To change the symbol selection for a component:

  1. Click the Symbols field of the component whose symbol you want to modify to open a drop-down list and select Modify Symbol Selection.
  2. The Modify Selection dialog box displays all available .svg symbols in the left box. Use the arrows to move the selected symbol to the right box. To select symbols from a library, click Select From Library.
    Note:

    Components can have only one symbol.

  3. Click OK to add the selected symbol.
  1. Ensure that the Import box next to each model and component you want to create is checked.
    Note:

    If you choose not to create a component, the source files will be compiled – no component is created.

  2. On the SDB tab, select the quantities and signals you want to set as default outputs for each created component. By default all signals are selected.
  3. On the Non-Conservative Pins tab, select the non-conservative quantities and signals for which you want pins included on the new component symbol. All terminal pins are added by default; and all signal pins are selected by default.
  4. Click OK to create a component for each imported model.

The new components and models are added to the Components and Models folders within the current project’s Definitions folder in the Project Manager.

New models are also added to the list of Project Components on the Component Libraries Components tab where they can be placed onto a schematic for simulation.

Note:

For Modelica models, extra parameters are added for initializing input values. See Compiling and Updating a Project to Add a Modelica Model and Component for more details.

Handling of Incompatible Definition Names during Simulation Model Import

The syntax rules for definition or instance names in other simulation tools may be different from those in Twin Builder, which may make them incompatible with Twin Builder. For that reason Twin Builder applies some algorithms to make the names compatible with the Twin Builder syntax rules. The most common case for this to happen is during the import of Spice/PSPICE models.

Related Topic

Using the Compile & Update Project Command in a Model Editor