问题描述
我想使用 modelica
进行建模,尤其是 thermial
和 fluid
分支.因此,现在我正在从 stackoverflow 和 modelica
库中逆向和更改示例,以更好地了解该语言.
目前我试图理解 Modelica.Fluid.Examples.DrumBoiler.DrumBoiler
.我没有任何问题可以理解模型在物理上的作用.但是当我重建它时,我收到错误消息:
在作用域 DrumBoiler 中找不到函数 Cv.from_bar.
我从头开始重建模型,并从库中复制了示例.两者同样的问题.问题出在这里:
Modelica.Fluid.Sources.FixedBoundary sink(nPorts = 1,p = Cv.from_bar(0.5), <-- 问题重新声明包 Medium = Modelica.Media.Water.StandardWaterOnePhase,T = 500)
为了定义水槽的起始 (?) 压力,调用了一个函数.但是该函数没有在任何地方定义.然而,当我从库中模拟它时,该模型有效,但当我从那里复制它时却不起作用.
我错过了什么?我正在使用 OMedit.
函数在这里:Modelica.SIunits.Conversions.from_bar
.您可以使用 import
导入它,或使用 import Cv = Modelica.SIunits.Conversions
以较短的别名 Cv
导入它.>
您还可以在此处阅读有关导入的更多信息:
- https://mbe.modelica.university/components/packages/nimport
- https://mbe.modelica.university/components/packages/importing
I want to get into modeling with modelica
especially the thermial
and fluid
branches. So now I am reversing and altering examples from stackoverflow and the modelica
library to get to know the language better.
At the moment I try to understand Modelica.Fluid.Examples.DrumBoiler.DrumBoiler
. I have no problems to comprehend what the model does physically. But when I rebuilt it, I get the error message:
I rebuild the model from scratch and I copied the example from the library. Both the same problem.The problem lies here:
Modelica.Fluid.Sources.FixedBoundary sink(
nPorts = 1,
p = Cv.from_bar(0.5), <-- problem
redeclare package Medium = Modelica.Media.Water.StandardWaterOnePhase,
T = 500)
In order to define the starting (?) pressure of the sink, a function is called. But the function was not defined anywhere. And yet the model works when I simulate it from the library, but it does not when I copy it from there.
What am I missing?I am using OMedit.
The function is here: Modelica.SIunits.Conversions.from_bar
. You can use import
to import it, or import Cv = Modelica.SIunits.Conversions
to import it under the shorter alias name Cv
.
You can also read more about importing here:
- https://mbe.modelica.university/components/packages/nimport
- https://mbe.modelica.university/components/packages/importing
这篇关于Modelica 中的 DrumBoiler 建模的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!