0

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

4

2 回答 2

1

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

于 2016-02-01T10:13:28.283 回答
0

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

于 2016-02-01T14:07:11.283 回答