阵列组件的冗余连接

时间:2019-06-14 00:50:14

标签: modelica dymola fmi

已收到警告,我有一个“冗余连接(由于其他连接)”。我将一个HeatPort链接到通过使用数组扩展的几个组件。请参见下面的代码段。

使用each似乎无效,或者我没有正确执行。

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.

.solid.port_a之间的热量平衡在数学上应该是正确的,但是我可能没有在Modelica中正确设置热量平衡。请让我知道是否有一种方法可以创建这些连接而又不会多余。尽管这只是一个警告,但基于这些警告,我收到以下错误。

Edit 1我已经建立了一个辅助模型,该组件不再排列数组,而是在模型中复制了多次。热端口已连接到其他几个热端口,但我仍然收到上述消息。连接看起来像这样: Redundant Connection

连接方式有问题吗?

Edit 2添加代码段。以下是冗余连接警告的相关代码。此模型有更多代码,但是为了简洁起见,已将其删除。

  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);

1 个答案:

答案 0 :(得分:3)

问题在于以下几行:

public void onDataChange(DataSnapshot dataSnapshot) {
    for(DataSnapshot ds : dataSnapshot.getChildren()) {
        String name= ds.child("name").getValue(String.class);
        String age= ds.child("age").getValue(String.class);
        //and similar for others
        Log.d("TAG", email + " / " + name);
    }
}

这意味着涉及numPipes + 2连接器的numPipes * 2连接,如果numPipes足够大,则意味着冗余连接。

一种避免这种情况的方法是:

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