.ModelicaReference.Classes.'connector'

Information

Define specialized class connector

Examples

connector flange
  Modelica.SIunits.Angle phi;
  flow Modelica.SIunits.Torque tau;
end flange;

Syntax

   [ encapsulated ][ partial ] connector
   IDENT class_specifier

class_specifier :
   string_comment composition end IDENT
   | "=" base_prefix name [ array_subscripts ] [ class_modification ] comment
   | "=" enumeration "(" ( [enum_list] | ":" ) ")" comment

See Modelica Language Specification for further details.

Description

The keyword connector is used to define connectors, which are used in connect() statements. In connectors, no equations are allowed in the definition or in any of its components. With respect to "class", it is enhanced to allow connect(..) to components of connector classes.

Variable declarations in a connector can have the additional prefixes flow or stream, besides the prefixes input and output, that are also allowed outside of a connector. Based on the prefix, a connect() statement leads to specific connection equations, that describe the balance equations in the infinitesimal connection points.

Example

If three connectors c1, c2, c3 with the definition

connector Demo
  Real        p;  // potential variable
  flow   Real f;  // flow variable
  stream Real s;  // stream variable
end Demo;

are connected together with

   connect(c1,c2);
   connect(c1,c3);

then this leads to the following equations:

  // Potential variables are identical
  c1.p = c2.p;
  c1.p = c3.p;

  // The sum of the flow variables is zero
  0 = c1.f + c2.f + c3.f;

  /* The sum of the product of flow variables and upstream stream variables is zero
     (this implicit set of equations is explicitly solved when generating code;
     the "<undefined>" parts are defined in such a way that
     inStream(..) is continuous).
  */
  0 = c1.f*(if c1.f > 0 then s_mix else c1.s) +
      c2.f*(if c2.f > 0 then s_mix else c2.s) +
      c3.f*(if c3.f > 0 then s_mix else c3.s);

  inStream(c1.s) = if c1.f > 0 then s_mix else <undefined>;
  inStream(c2.s) = if c2.f > 0 then s_mix else <undefined>;
  inStream(c3.s) = if c3.f > 0 then s_mix else <undefined>;

Generated at 2020-06-05T07:38:22Z by OpenModelica 1.16.0~dev-420-gc007a39