Instantiating a Component from a Library

From a behavior library, you can instantiate (or multi-instantiate) a class in a logical behavior or in a library. You can then position and resize the created component.

In this scenario, you will instantiate classes from the Modelica Standard Library, which is provided by default with the Dynamic Behavior Modeling workbench.


Before you begin:
  • Create a behavior representation (either behavior library or logical behavior).
  • In this behavior representation, create a new class with a Model class type (Motor).

    This Motor model will be the destination class, i.e. the class in which you will instantiate a component.

  1. From the Package Browser, double-click to activate the Motor model.

    Warning: You cannot instantiate a component neither in a package nor in a PLMInterface/PLMConnector model (these two models are reserved for ports mapping purpose).

    The empty Motor model appears from the Component Browser.

  2. From the Package Browser, expand Modelica > Electrical > Analog > Basic to select the Resistor class.



  3. Drag the Resistor class from the Package Browser to the diagram layer.

    The Resistor 2D representation follows the cursor.

  4. Position the cursor in the diagram layer of the active model, then drop it on the desired location.

    Tips:
    • To multi-instantiate a class, press Ctrl when dragging the class. You can then drop as many instances as you need.
    • To instantiate a class, you can also right-click the class from the Package Browser then select Instantiate from the contextual menu.

    The Resistor component is created in the Motor model.

  5. If need be, resize the component by dragging the handles.