.ModelicaReference.Operators.'connect()'

Information

Connect objects

Examples

model Integrate
  Modelica.Blocks.Sources.Step step;
  Modelica.Blocks.Continuous.Integrator integrator;
equation
  connect(step.outPort, integrator.inPort);
end Integrate;

Example of array use:

connector InPort = input Real;

connector OutPort = output Real;

block MatrixGain
  input InPort u[size(A,1)];
  output OutPort y[size(A,2)]
  parameter Real A[:,:]=[1];
equation
  y=A*u;
end MatrixGain;

  sin sinSource[5];
  MatrixGain gain(A=5*identity(5));
  MatrixGain gain2(A=ones(5,2));
  OutPort x[2];
equation
  connect(sinSource.y, gain.u); // Legal
  connect(gain.y, gain2.u);     // Legal
  connect(gain2.y, x);          // Legal

Syntax

See section on connect_clause in the Modelica Grammar.

Description

Connections between objects are introduced by the connect statement in the equation part of a class. The connect construct takes two references to connectors, each of which is either of the following forms:

There may optionally be array subscripts on any of the components; the array subscripts shall be parameter expressions. If the connect construct references array of connectors, the array dimensions must match, and each corresponding pair of elements from the arrays is connected as a pair of scalar connectors.

The two main tasks are to:

Definitions:


Generated at 2020-06-05T21:39:08Z by OpenModelica 1.16.0~dev-442-g2e5bc9f