定制 Modelica.Fluid.DynamicPipe 模型

问题描述 投票:0回答:1

我需要针对特定应用修改Fluid.DynamicPipe模型(不能用流模型来完成,但需要是DynamicPipe)。 虽然这对于 MSL3.x 来说很容易,我可以在本地 MSL 中制作一个副本并在那里进行修改。有了这个,扩展工作得很好。然而对于 MSL4.x,人们无法修改该库。

这使得我必须在自己的模型结构中制作本地副本。问题就在这里出现。我修改后的代码如下。通过我所做的更改,我希望编译器根据需要查看原始 MSL4.x 模型,但它似乎不想这样做 - 如果返回以下消息。 有人可以提出解决方案吗?

注意,PartialStraightPipe、PartialTwoPortFlow、PartialStraightPipe、PartialTwoPort、PartialDistributedVolume 不需要修改。
我想使用我自己的 FlowModels 和 HeatTransfer 模型,但这是下一阶段。 - 但指导会有帮助。

model w2DynamicPipe1 "Dynamic pipe model with storage of mass and energy"
  import Modelica.Fluid.Types.ModelStructure;
  // extending PartialStraightPipe
  extends Modelica.Fluid.Pipes.BaseClasses.PartialStraightPipe(final port_a_exposesState = modelStructure == ModelStructure.av_b or modelStructure == ModelStructure.av_vb, final port_b_exposesState = modelStructure == ModelStructure.a_vb or modelStructure == ModelStructure.av_vb);
  // extending PartialTwoPortFlow
  extends Modelica.Fluid.Pipes.BaseClasses.PartialTwoPortFlow (final lengths = fill(length / n, n), final crossAreas = fill(crossArea, n), final dimensions = fill(4 * crossArea / perimeter, n), final roughnesses = fill(roughness, n), final dheights = height_ab * dxs);
  // Wall heat transfer

这将返回以下内容:

[86] 12:23 Validation of w2DynamicPipe1 finished 
Notification: Modelica.Fluid.Interfaces.PartialTwoPort [3:5-3:5] Missing inner. Outer declaration system is missing a corresponding inner declaration. An inner declaration will be added using the outer declaration.
Error: Modelica.Fluid.Interfaces.PartialDistributedVolume [34:5-34:5] Invalid instantiation. Modelica.Media.Interfaces.PartialMedium.BaseProperties is partial.
Validation of model w2_Models.w2pipes.w2DynamicPipe1 completed with 1 error.

任何想法都将不胜感激。 感谢您的帮助。

modelica
1个回答
0
投票

Modelica 中的多重继承规则相当严格,正如 Markus A. 指出的那样,模型因此会产生错误。

可以通过添加相应的括号来处理,如下所示:

model w2DynamicPipe1 "Dynamic pipe model with storage of mass and energy"
  import Modelica.Fluid.Types.ModelStructure;
  // extending PartialStraightPipe
  extends Modelica.Fluid.Pipes.BaseClasses.PartialStraightPipe(final port_a_exposesState = (modelStructure == ModelStructure.av_b) or (modelStructure == ModelStructure.av_vb), final port_b_exposesState = (modelStructure == ModelStructure.a_vb) or (modelStructure == ModelStructure.av_vb));
  // extending PartialTwoPortFlow
  extends Modelica.Fluid.Pipes.BaseClasses.PartialTwoPortFlow (final lengths = fill(length / n, n), final crossAreas = fill(crossArea, n), final dimensions = fill(4 * crossArea / perimeter, n), final roughnesses = fill(roughness, n), final dheights = height_ab * dxs);
  // Wall heat transfer
  parameter Real dxs[:];
end w2DynamicPipe1;

该模型在 Dymola 中进行检查,并且应该可以用作起点。 还有关于 BaseProperties 是部分的并且它包含外部系统的注释,我不知道向量 dxs 应该有多大。

© www.soinside.com 2019 - 2024. All rights reserved.