Search code examples
modelicadymolafmi

Redundant Connection of Arrayed Component


Warning received claims I have a "redundant connection(s) (due to other connections)." I am linking one HeatPort to several components that expand through the use of an array. See the code segment below.

The use of each does not appear to work or I have no done it correctly.

Redundant connection(s) (due to other connections):
connect(topFrontExteriorConvection.solid, module3_PipeComponents[2].port_a);
connect(topFrontExteriorConvection.solid, module3_PipeComponents[3].port_a);
connect(topFrontExteriorConvection.solid, module3_PipeComponents[4].port_a);
connect(topFrontExteriorConvection.solid, module3_PipeComponents[5].port_a);
connect(topFrontExteriorConvection.solid, module3_PipeComponents[6].port_a);
in the connection set.
ecoCeramicRadiation.T =module3_PipeComponents[1].port_a.T =module3_PipeComponents[2].port_a.T =module3_PipeComponents[3].port_a.T =module3_PipeComponents[4].port_a.T =module3_PipeComponents[5].port_a.T =module3_PipeComponents[6].port_a.T =topFrontExteriorConvection.solid.T
Note that this is not an actual error, and the redundancy can be removed in several ways.

The balance of heat between the .solid and .port_a should be correct mathematically but I may not be setting up the balance correctly in Modelica. Please let me know if there is a way I can create these connections without them being redundant. Although this is only a warning, I receive a following ERROR based on these warnings.

Edit 1 I have setup a secondary model where the component is no longer arrayed but instead copied several times in the model. The heat port is connected to several other heatports but I still receive the above message. The connections look like this: Redundant Connection

Is there something wrong with kind of connection?

Edit 2 Adding code snippets. Below is the relevant code to the redundant connection warning. There is more code to this model but it was removed for brevity.

  parameter Integer numPipes=6 "Number of repeating pipes.";

  Buildings.HeatTransfer.Convection.Exterior topFrontExteriorConvection(
    hFixed=exteriorConvectionCoefficientFixed,
    conMod=extMode,
    azi=Azimuth,
    til=ecoCeramicTopPanelTilt,
    A=surfaceAreaTop);

  Components.Module3_PipeComponents module3_PipeComponents[numPipes](
    each segmentLength=segmentLength,
    each thicknessEco=thicknessEco,
    each pipeVolume=pipeVolume,
    each fluidFlow=fluidFlow,
    each initialFluidTemp=initialFluidTemp,
    each fluidDensity=fluidDensity,
    each pipeDiameter=pipeDiameter,
    each pipeLength=pipeLength,
    each surfaceAreaTop=segSurfaceArea);

equation
  connect(fluidInlet, module3_PipeComponents[1].flowPort_a);
  for i in 1:numPipes - 1 loop
    connect(module3_PipeComponents[i].flowPort_b, module3_PipeComponents[i+1].flowPort_a);
  end for;
  for i in 1:numPipes loop
    connect(ecoCeramicRadiation, module3_PipeComponents[i].port_a);
    connect(topFrontExteriorConvection.solid, module3_PipeComponents[i].port_a);
    connect(module3_PipeComponents[i].port_b, topInsulationConduction.port_a);
  end for;
  connect(module3_PipeComponents[numPipes].flowPort_b, fluidOutlet);

Solution

  • The problem are the following lines:

    for i in 1:numPipes loop
        connect(ecoCeramicRadiation,              module3_PipeComponents[i].port_a);
        connect(topFrontExteriorConvection.solid, module3_PipeComponents[i].port_a);
    ...
    end for;
    

    This implies numPipes*2 connections involving numPipes+2 connectors, which imply redundant connections if numPipes is large enough.

    One way of avoiding that is:

    for i in 1:numPipes loop
        connect(ecoCeramicRadiation,              module3_PipeComponents[i].port_a);
    ...
    end for;
    connect(ecoCeramicRadiation, topFrontExteriorConvection.solid);