如何在OpenModelica中正确重新调整Medium?

时间:2016-02-01 08:50:15

标签: simulation modelica openmodelica

我使用的是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中进行正确的模拟?

2 个答案:

答案 0 :(得分:1)

它应该像你一样工作但没有完整的模型很难调试,看看问题出在哪里。

答案 1 :(得分:0)

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