首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何正确地在OpenModelica中重新声明媒体?

如何正确地在OpenModelica中重新声明媒体?
EN

Stack Overflow用户
提问于 2016-02-01 16:50:15
回答 2查看 954关注 0票数 0

我使用了OpenModelica 1.9.4~dev-675-gb524b08,并尝试为模拟燃气工厂创建模型。当我尝试根据示例重新声明一个媒体时

代码语言:javascript
复制
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;

我收到错误:

代码语言:javascript
复制
[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跟踪#2959#2079中发现了两个请求

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

EN

回答 2

Stack Overflow用户

发布于 2016-02-01 18:13:28

它应该像你做的那样工作,但是如果没有一个完整的模型,就很难进行调试,也很难看到问题所在。

票数 1
EN

Stack Overflow用户

发布于 2016-02-01 22:07:11

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35126281

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档