Are you ready to talk?

Hierarchical Connectors in Dymola

Table of contents

A convenient way to pass a number of variables/signals between components or subsystems in Dymola is to use hierarchical connectors.

Modelica supports hierarchical connectors (Connectors which contain sub connectors). As a result, it is possible to connect several sub connectors together with a reduced number of connection lines.

For example, an electrical plug consisting of two electrical pins (sub connectors) can be defined as:

connector Plug
  Modelica.Electrical.Analog.Interfaces.PositivePin positive annotation (
      Placement(transformation(extent=, rotation=0)));
  Modelica.Electrical.Analog.Interfaces.NegativePin negative annotation (
      Placement(transformation(extent=, rotation=0)));
  annotation (
    Diagram(coordinateSystem(preserveAspectRatio=false, extent=), graphics={Ellipse(
          extent=,
          lineColor={0,0,255},
          lineThickness=1)}),
    Icon(coordinateSystem(preserveAspectRatio=false, extent=),
        graphics={Polygon(
          points=,
          lineColor={0,0,255},
          fillColor={255,255,255},
          fillPattern=FillPattern.Solid)}),
    Documentation(info="<html>
</html>"));
end Plug;

With one connect (..) equation, either two plugs can be connected (and therefore implicitly also the positive and negative pins) or a Pin connector can be directly connected to the positive or negative pin of a Plug connector, such as connect (resistor.p, plug.positive). See figure below:

Capture

Figure: Two plugs connected using a single connection line. Each plug has an electrical circuit connected to it via its pins.

Any type of signal or connector can be used in a hierarchical connector: Real input and physical connectors, etc. and there is no limit to the number of sub connectors.

However, contrarily to a Bus, a hierarchical connector is not an expandable connector. This means that we cannot connect it to a connector type that has not previously been declared in the hierarchical connector itself.

Hierarchical connectors are then a good way to reduce the number of connections in the diagram layer of a model by grouping signals together, thus making the model tidier.

 

Need to talk to an expert?

Our engineering teams are on hand to provide tailored guidance and support with a deep knowledge of the full Dassault Systèmes portfolio.

Want to receive more content like this?

Sign up to receive a weekly roundup of Expert insights as they are published...

  • Related news & articles straight to your inbox
  • Hints, tips & how-tos
  • Thought leadership articles