【问题标题】:How correct redeclare of Medium in OpenModelica?在 OpenModelica 中如何正确重新声明 Medium?
【发布时间】:2016-02-01 08:50:15
【问题描述】:

我使用 OpenModelica 1.9.4~dev-675-gb524b08 并尝试建立模拟燃气装置的模型。 当我尝试根据示例重新声明媒介时

model Block_Prep_ASIDGAS
 import Modelica.Fluid.Interfaces;
 import SI=Modelica.SIunits;
 redeclare replaceable package Medium = Modelica.Media.Water.ConstantPropertyLiquidWater constrainedby Modelica.Media.Interfaces.PartialMedium "Medium in the component" annotation(choicesAllMatching = true);
 Interfaces.FluidPort_a port_a (redeclare package Medium = Medium)  "Порт ввода газа" annotation(Placement(visible = true, transformation(origin = {-584, 42}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {-100, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
 Interfaces.FluidPort_b port_b    annotation(Placement(visible = true, transformation(origin = {586, 46}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {102, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
 annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2}), graphics = {Text(origin = {-92, 91}, extent = {{190, 1}, {-8, -1}}, textString = "Блок подготовки кислого газа", fontSize = 40), Rectangle(lineThickness = 2, borderPattern = BorderPattern.Engraved, extent = {{-100, 98}, {100, -98}}, radius = 2), Text(origin = {-8, -3}, lineColor = {255, 0, 0}, extent = {{-70, 79}, {96, -77}}, textString = "B_PAG", fontSize = 200)}), Diagram(coordinateSystem(extent = {{-600, -400}, {600, 400}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.02));
end Block_Prep_ASIDGAS;

我遇到了错误:

[1] Translation Error
[Seneca.BlockModels.Block_Prep_ASIDGAS.Medium: 10:26-10:92]: Illegal redeclare of element Medium, no inherited element with that name exists.
[2] Translation Error
Error occurred while flattening model Seneca.BlockModels.Block_Prep_ASIDGAS

我在 OpenModelica trac #2959#2079 中找到两个请求

建议我如何修正我的模型以在 OpenModelica 中正确模拟?

【问题讨论】:

    标签: simulation modelica openmodelica


    【解决方案1】:

    它应该可以正常工作,但如果没有完整的模型,很难调试并找出问题所在。

    【讨论】:

    • 我可以将此模型封装在具有固定边界的新模型中作为源和流的结束。能帮你调试吗?
    • 这会有所帮助,是的。另外,如果您的模型不是公开的,您可以通过 openmodelica@ida.liu.se 将其发送给我们,我们只会将其用于调试,然后将其删除。
    • 好的,我准备模型并发送它
    【解决方案2】:

    你错过了在 port_b 中重新声明包,其余的似乎没问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-12-16
      • 2021-12-06
      • 2015-02-24
      • 2021-06-06
      • 1970-01-01
      • 2015-02-14
      • 1970-01-01
      相关资源
      最近更新 更多