.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

equation_clause :
  [ initial ] equation { equation ";" | annotation  ";" }

equation :
  ( simple_expression "=" expression
    | conditional_equation_e
    | for_clause_e
    | connect_clause
    | when_clause_e
    | IDENT function_call )
  comment

connect_clause :
  connect "(" component_reference "," component_reference ")"

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-05T07:38:22Z by OpenModelica 1.16.0~dev-420-gc007a39