- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Fluid / troubles mixing moistAir and...
Fluid / troubles mixing moistAir and steam using MSL medium definition
Fluid / troubles mixing moistAir and steam using MSL medium definition
Hi,
I am new to Modelica and think it is a great language and OM a very good tool.
I am working on my thesis and get stuck because of under determined system creating a steady state mixer object.
Did anybody try to create a mixer object for moistAir and steam before?
Your help would very much appreciated...
Thanks in advance.
Uwe
- uschoene
- 8 Posts
Re: Fluid / troubles mixing moistAir and steam using MSL medium definition
Ok, as my torubles are not easily to understand without source code, I created a simple example, what is not working:
For the test I connected two boundaries from Modelica.Fluid.Sources:
MassFlowSource_T and Boundary_pT
If you are looking at the documentation of Boundary_pT, it says:
<p>If <code>use_p_in</code> is false (default option), the <code>p</code> parameter
is used as boundary pressure, and the <code>p_in</code> input connector is disabled; if <code>use_p_in</code> is true, then the <code>p</code> parameter is ignored, and the value provided by the input connector is used instead.</p>
<p>The same thing goes for the temperature, composition and trace substances.</p>
So I define m_flow, T and X fpr MassFlowSource_T and only the pressure for Boundary_pT:
Code:
model TestSingleMoistAir
inner Modelica.Fluid.System system
annotation (Placement(transformation(extent={{-76,68},{-56,88}})));
Modelica.Fluid.Sources.MassFlowSource_T boundary_mT(
nPorts=1,
redeclare package Medium = Modelica.Media.Air.MoistAir,
m_flow=1000,
X={0.01,0.99},
T=353.15)
annotation (Placement(transformation(extent={{-66,20},{-46,40}})));
Modelica.Fluid.Sources.Boundary_pT boundary_p(
nPorts=1,
redeclare package Medium = Modelica.Media.Air.MoistAir,
p=100000)
annotation (Placement(transformation(extent={{50,20},{30,40}})));
equation
connect(boundary_mT.ports[1], boundary_p.ports[1]) annotation (Line(
points={{-46,30},{30,30}},
color={0,127,255},
smooth=Smooth.None));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
-100},{100,100}}), graphics));
end TestSingleMoistAir;
When you do the simulation, you can see, that it does not what the documentation is promising:
It takes the default Temp in the bondary_pT and not the one from boundary_mT:
Code:
val(boundary_mT.ports[1].m_flow,1);
val(boundary_p.ports[1].m_flow,1);
val(boundary_mT.ports[1].h_outflow,1);
val(boundary_p.ports[1].h_outflow,1);
val(boundary_mT.medium.T,1);
val(boundary_p.medium.T,1)
Results in:
-1000.0
1000.0
106157.20683546351
45263.2387446934
353.15
293.15
=> Does anybody have an idea why this happens, and what I could do?
Thanks in advance.
Uwe
- uschoene
- 8 Posts
Re: Fluid / troubles mixing moistAir and steam using MSL medium definition
Hi,
This might be a bug either in the flattening (or in the back-end/runtime system).
I suggest you do instantiateModel and see what kind of equations you're getting.
Also, run omc from command line with +d=dumpindxdae and see how the variables are calculated (from which equation).
See here in the README how to write the script and give command line options:
https://build.openmodelica.org/omc/buil … ly-builds/
Let us know which version/revision of OpenModelica you're using (and what OS).
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
Re: Fluid / troubles mixing moistAir and steam using MSL medium definition
Hi Adrian,
thank you for your reply.
I am using OpenModelica 1.9.0 beta4+dev (r16548) on WinXP Prof SP3, 32Bit.
I used the mos script and got a log file.
The temperature of the boundary seems to be calculated from the internal parameter which is by default 293.15K.
The equation in the log is:
"58/58 (1): boundary_p.medium.T = boundary_p.T_in_internal
But as referring to the help of the boundary_p object Modelica should ignore this value...
What else to do?
> I could send you my model and the log file.
Adrian, may I ask you for an advice to handle the usage of inStream an object two streams entering and one stream leaving?
Regards,
Uwe
- uschoene
- 8 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Fluid / troubles mixing moistAir and...