About Connectors and Connections

A connection is a graphical representation of a Modelica connect statement between two connectors (also called behavior ports/interfaces).

In a connection, connectors must be compatible. For example, you cannot connect a resistor to a spring.

Modelica connectors can be linked with functions and logical components.

This section deals with the following topics:

This page discusses:

Ways to Connect

You can use three different basic connection modes when connecting. On top of this, you can also connect using specific connect features.

Connection Modes

You can use any of the three modes when connecting. You can use direct connection, the connection starter, or a start connection command when connecting.

Using Direct Connection
Direct connection, that is, you connect by dragging from one connector to another, is the default way of connecting. This way of connecting is assumed in the tasks. To use the direct connection, an option must be active. For more information about this setting, and an example, see Use Direct Connection.
Using the Connection Starter
To use the connection starter, an option must be activated. For more information about this settings, and an example of using the connection starter, see Use the Connection Starter.
Using the Start Connection Command
You can always use the command Start Connection to connect. For an example of using the Start Connection command, see Use the Start Connection Command.

Specific Connect Features

You can use specific connect features in some cases.

Smart Connect
You can connect by smart connect in two ways:
  • You can drag a component over a connector in such a way that a connector of the component hits that connector. If they match, a connection is created.
  • You can drop a component on an existing connection line in such a way that a connector of the component hits the connection line. If the connector matches a connector of the connection line, a connection is created between these connectors.
  • You can connect a two-ports component by dropping it on a corresponding existing connection line.
Note: To use smart connect, an option must be active.
For more information about this setting, and examples of smart connect, see Connecting with Smart Connect.
Connecting from and to Connection Lines
You can start a new connection from an existing connection line, and end a new connection on an existing matching connection line. See Starting a Connection from an Existing Connection Line and Ending a Connection on an Existing Connection Line.
Using the Connection Manager
You can use the Connection Manager to:
  • Display all connectors and connections in a model
  • Create new connections
  • Repair broken connections
  • Delete connections
For more information, see Using the Connection Manager.

Connectors

There are several kinds of connectors and connections in Modelica.

For further details, see the Modelica Language Specification (available at www.modelica.org).

Tips:
  • You can create connectors from scratch, but it is much more common to reuse connectors by instantiating them from libraries. As an example, in the Modelica Standard Library, you have many connectors in the different sublibraries in the package Interfaces, for example, Modelica.Blocks.Interfaces, Modelica.Electrical.Analog.Interfaces, and Modelica.Mechanics.MultiBody.Interfaces.
  • When you add connectors in a model, it is useful to show the frame for the diagram extent of the model. To do this, click, from the Diagram section of the action bar, the command Show Diagram Extent .

    Notes:
    • This option is by default not activated.
    • The frame of the extent of the icon layer is always displayed.
    • Applying this command corresponds to changing the option Show frame for diagram extent. To specify this option, select Me > Preferences > App Preferences > 3D Modeling > Systems Modeling and Execution > Dymola Behavior Modeling , the Editor tab, the Component Visualization group.

      For more information about this option, see Native Apps Preferences Guide: Editor

  • You can synchronize the position of all connectors between the icon layer and the diagram layer in a model. For more information, see Synchronizing the Position of Connectors Between the Diagram Layer and the Icon Layer.

Standard Connectors
For connecting standard connectors. How to create a standard connection is documented both using direct connection and using the connection starter. See Ways to Connect for references to the two ways of connecting.
Array of Connectors
If one of the connectors in a connection is an array, you must select one of the connectors in the array for the connection.

The array dimension can either be a number or a simple parameter:

ConnType a [3];
parameter Real n = 2;
ConnType b[n];

An array of connectors can be connected to one or several functional or logical ports.

See Creating and Connecting an Array of Connectors.

Expandable Connectors
The connection of an expandable connector can be done to the whole bus connector, to one of its subcomponents, or to a new subcomponent added on the fly.

Components of expandable connectors are automatically treated as connectors.

See Connecting and Tracing Expandable Connectors.

Nested Connectors
A nested connector is a connector that contains subconnectors. The connection can be either to the top connector or to one of the subconnectors.

See Creating a Connection to a Nested Connector.

Stacked (Overlapping) Connectors
If many connectors created from the same parent component exist, these connectors can be displayed as only one connector, called a stacked connector. For example, an FMU having many inputs and outputs is greatly simplified in the diagram by this.

By default, the minimum number of such connectors to be displayed as stacked is 10. To change the value, change Minimal number to activate stacked connectors in Me > Preferences > Systems > Behavior Modeling, the FMI tab.

For more information about connecting, see Connecting Stacked Connectors.

Bus Modeling

It is possible to draw connections from a connector back to itself. This allows signals on a bus to be rerouted.

Connecting to Functional or Logical Ports and Interfaces

You can edit a functional or logical behavior in the Dymola Behavior Modeling app. The ports and interfaces of such a behavior can be connected to the ports and interfaces of the corresponding function or logical behavior.

See Creating a Connection to a Functional or Logical Port or Interface.

Ports and interfaces are synchronized from the Functional & Logical Design app. See Functional & Logical Design User's Guide: Managing Behaviors in Functions and Logical Components: Working with Dymola Behaviors and Context Behaviors: Synchronizing and Updating Ports and Interfaces: Synchronizing the Mapping of Behavior Ports and Interfaces.

Functional and logical ports and interfaces are located in the PLMConnectors package, in the Package Browser. The example below shows a logical behavior:

Important: After duplication, a functional or logical port or interface has no type. When connected to a behavior port or interface, the functional or logical port or interface inherits the type of the behavior port/interface, through an Extends clause.

Check of Connections

When a connection has been defined, the following checks are automatically performed and the corresponding error messages appears:

Note: If a model singularity is caused by incorrect or missing connections, no additional diagnostic is given.

  • If there is more than one connection between the same connectors.
  • If the connectors at each end of a connection are compatible.

    The error message if the connectors are not compatible displays the declarations of the connectors.

  • If connections are set with multiple sources for the same casual signal, or no source for a casual signal.
    Note: In some models, the missing equation for the input is provided textually. Change these models to use source-blocks instead.

Improve Connection Line Drawing

You can improve the connection line drawing in a number of ways. The following features are available:

  • Adding connection labels to, for example, handle hidden connections more easily
  • Reroute connections while drawing to, for example, avoid connections going through components
  • Reorganize connection lines after drawing
  • Cross-connection management, to make joins and gaps of connection line crossings more visible
  • Hide connection lines
For more information, see Improving Connection Line Drawing.

Highlighting Connections

You can highlight connections by clicking them. This is useful for investigating, for example, large models where many connections are used.

For more information, see Highlighting Connections.

Finding Connections

From a selected connection line, you can search the connection and the corresponding connected components. This is useful for investigating, for example, large models where expandable connectors are used.

For more information, see Finding Connections.