问题
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:
Function Cv.from_bar not found in scope DrumBoiler.
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.
回答1:
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
来源:https://stackoverflow.com/questions/60749708/drumboiler-modeling-in-modelica