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:

- c1.c2. ... .cn, where c1 is a connector of the class, n≥1 and
ci+1 is a connector element of ci for i=1:(n-1).
- m.c, where m is a non-connector element in the class and c is a
connector element of m.

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:

- Build connection sets from
**connect**
statements.
- Generate equations for the complete model.

Definitions:

- Connection sets

A connection set is a set of variables connected by means of
connect clauses. A connection set shall contain either only flow
variables or only non-flow variables.
- Inside and outside connectors

In an element instance M, each connector element of M is called an
outside connector with respect to M. All other connector elements
that are hierarchically inside M, but not in one of the outside
connectors of M, is called an inside connector with respect to
M.

*[Example: in connect(a,b.c) 'a' is an outside connector and
'b.c' is an inside connector, unless 'b' is a connector.]*

Generated at 2019-12-10T02:38:33Z by OpenModelicaOpenModelica
1.16.0~dev-72-gc3a557c using GenerateDoc.mos