我想在我的模拟中放置一个“系统”组件(类似于Modelica.Fluid.System
and Modelica.Mechanics.MultiBody.World
),所有其他组件都可以从中访问Medium
包,以便在整个流程图中仅设置一次工作流体。我的System
定义如下:
model System annotation(defaultAttributes="inner");
replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
annotation(choicesAllMatching=true);
parameter Modelica.SIunits.Temperature T_amb=293.15;
// ...
equation
// empty
end System;
我已经参考了System
在其他组件中使用outer System system;
,因此我可以访问其中包含的所有变量/参数,例如system.T_amb
。然而,试图拉Medium
像这样的包不起作用:
model MixingVolume
outer System system;
package Medium = system.Medium;
// ...
equation
// ...
end MixingVolume;
我收到一条消息,说缺少基类“system.Medium”。 (这是从我注定要使用的 CATIA V6 的 Modelica 环境中极其糟糕的德语翻译重新翻译的 - 也许原始消息会提供更多信息。)我做错了什么?我很困惑,因为这...
model MixingVolume
outer System system;
Constant Integer nXi = system.Medium.nXi; // number of independent mass fractions
// ...
equation
// ...
end MixingVolume;
...工作正常,所以MixingVolume
does看到system.Medium
成分。有什么线索吗?非常感谢您的帮助。
您无法通过点表示法访问组件内部的包。
如果名字是一个组件引用,点后仅是一个组件
可以跟随参考或函数。阅读 Modelica 规范:https://www.modelica.org/documents/ModelicaSpec32Revision2.pdf https://www.modelica.org/documents/ModelicaSpec32Revision2.pdf.
如果允许 system.Medium.nXi,则可能是工具中的错误。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)