Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace PlugFlowPipe outlet from vectorized to single port #1503

Merged
merged 43 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b7803cd
first commit
bravache Jul 12, 2021
04f29e0
fix package order
bravache Jul 12, 2021
d0bff32
add documentation to obsolete package
bravache Jul 12, 2021
403a976
fix typo
bravache Jul 12, 2021
7c513c7
fix variable references
bravache Jul 13, 2021
c9d7e1d
Minor changes [ci skip]
AntoineGautier Jul 15, 2021
9eccb21
Expand PlugFlowCore in PlugFlowPipe
bravache Jul 19, 2021
333dd4f
fix syntax
bravache Jul 19, 2021
7304835
fix test variable name
bravache Jul 19, 2021
655e53c
Update doc
AntoineGautier Jul 27, 2021
43529e3
Rename parameter
AntoineGautier Jul 27, 2021
b0fbc02
Merge examples
bravache Jul 27, 2021
245cc2c
Merge branch 'master' into issue1494_plugflowpipe_singleoutlet
bravache Jul 29, 2021
2909c70
Merge branch 'master' into issue1494_plugflowpipe_singleoutlet
mwetter Aug 16, 2021
6dce628
Merge branch 'master' into issue1494_plugflowpipe_singleoutlet
mwetter Aug 16, 2021
d40c322
Replaced links with full class name
mwetter Sep 13, 2021
8bbc228
Introduced parameter for complex parameter expression
mwetter Sep 13, 2021
784ce99
Updated documentation
mwetter Sep 13, 2021
670f3ce
Fixed drawing into pane
mwetter Sep 13, 2021
463ff71
Made most components protected and exposed main variables
mwetter Sep 13, 2021
7065294
Added obsolete annotation
mwetter Sep 13, 2021
5a18c03
Removed non-needed start value
mwetter Sep 13, 2021
b83f5d6
Added obsolete annotation
mwetter Sep 13, 2021
a637e26
Removed setup tools
mwetter Sep 14, 2021
5031c9b
Merge branch 'issue1494_plugflowpipe_singleoutlet' of github.com:ibps…
mwetter Sep 14, 2021
7d31f46
Moved conversion to top of file (as has been done with other entries)
mwetter Sep 14, 2021
73e7d11
Removed setup tools
mwetter Sep 14, 2021
bb0338c
Added constant to suppress calculation of flow resistance
mwetter Sep 14, 2021
072086f
Updated variable names in CI tests
mwetter Sep 14, 2021
1fc20a4
Corrected error in newly introduced constant.
mwetter Sep 14, 2021
beef79c
Updated reference result for new output variables
mwetter Sep 14, 2021
c8c7ca7
Removed parameter computeFlowResistance, introduced QEnv_flow
mwetter Sep 14, 2021
b204dc5
simplify unecessary parameters
bravache Sep 23, 2021
146ce65
Merge branch 'master' into issue1494_plugflowpipe_singleoutlet
bravache Sep 23, 2021
3705e42
make m_flow consistent in example
bravache Sep 23, 2021
505bb91
make model symmetrical
bravache Oct 5, 2021
0f0dbb5
update documentation
bravache Oct 5, 2021
5f64335
update documentation 2
bravache Oct 5, 2021
6c0b7f9
Changed m_flow to m_flow_nominal
mwetter Oct 6, 2021
bd7c690
Changed annotation
mwetter Oct 6, 2021
abc385c
Updated revision notes
mwetter Oct 6, 2021
9d1abcf
Removed trailing white space
mwetter Oct 6, 2021
fb7d4ce
Merge branch 'master' into issue1494_plugflowpipe_singleoutlet
bravache Oct 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions IBPSA/Fluid/FixedResistances/BaseClasses/PlugFlowTransportDelay.mo
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ model PlugFlowTransportDelay "Delay time for given normalized velocity"
if initDelay and (abs(m_flow_start) > 1E-10*m_flow_nominal)
then min(-length/m_flow_start*(rho*dh^2/4*Modelica.Constants.pi), 0) else 0
"Initial value of input time at outlet";

final parameter Real conUM(unit="1/kg") = 4/rho/dh/dh/Modelica.Constants.pi/length
"Constant to convert mass flow rate into velocity normalized by the pipe length";
Modelica.SIunits.Time time_out_rev "Reverse flow direction output time";
Modelica.SIunits.Time time_out_des "Design flow direction output time";

Real x(start=0) "Spatial coordinate for spatialDistribution operator";
Modelica.SIunits.Frequency u "Normalized fluid velocity (1/s)";
Real u(unit="1/s") "Normalized fluid velocity (1/s)";

Modelica.Blocks.Interfaces.RealInput m_flow "Mass flow of fluid" annotation (
Placement(transformation(extent={{-140,-20},{-100,20}}),
Expand All @@ -48,8 +49,7 @@ initial equation
t0 = time;

equation
u = m_flow/(rho*(dh^2)/4*Modelica.Constants.pi)/length;

u = m_flow * conUM;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

der(x) = u;
(time_out_rev, time_out_des) = spatialDistribution(
time,
Expand Down Expand Up @@ -119,17 +119,14 @@ function. This components requires the mass flow through the pipe and the pipe
dimensions in order to derive information about the fluid propagation.
</p>
<p>
The component calculates the delay time at both in/outlet ports of the pipe
and therefore has two outlets. During forward flow, only the forward
<a href=\"modelica://IBPSA.Fluid.FixedResistances.BaseClasses.PlugFlowTransportDelay\">
IBPSA.Fluid.FixedResistances.BaseClasses.PlugFlowTransportDelay</a> component in
<a href=\"modelica://IBPSA.Fluid.FixedResistances.BaseClasses.PlugFlowCore\">
IBPSA.Fluid.FixedResistances.BaseClasses.PlugFlowCore</a>
will be active and uses the forward output of PlugFlowTransportDelay.
During reverse, the opposite is true and only the reverse output is used.
The component calculates the delay time at the inlet and the outlet port of the pipe.
For the forward flow, the time delay is exposed at the output <code>tau</code>,
and for the backward flow, the time delay is exposed at the output <code>tauRev</code>.
</p>
<h4>Assumption</h4>
<p>It is assumed that no axial mixing takes place in the pipe. </p>
<p>
No axial mixing takes place in the pipe.
</p>
</html>", revisions="<html>
<ul>
<li>
Expand Down
2 changes: 0 additions & 2 deletions IBPSA/Fluid/FixedResistances/BaseClasses/package.order
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
PlugFlow
PlugFlowCore
PlugFlowHeatLoss
PlugFlowTransportDelay
Validation
114 changes: 88 additions & 26 deletions IBPSA/Fluid/FixedResistances/Examples/PlugFlowPipe.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,67 +3,124 @@ model PlugFlowPipe "Simple example of plug flow pipe"
extends Modelica.Icons.Example;
replaceable package Medium = IBPSA.Media.Water "Medium in the pipe" annotation (
choicesAllMatching=true);

final parameter Modelica.SIunits.MassFlowRate m_flow_nominal=3
"Mass flow rate";

Modelica.Blocks.Sources.Ramp Tin(
height=20,
duration=0,
offset=273.15 + 50,
startTime=100) "Ramp pressure signal"
annotation (Placement(transformation(extent={{-92,-6},{-72,14}})));
annotation (Placement(transformation(extent={{-100,-10},{-80,10}})));
Sources.Boundary_pT sin(
redeclare package Medium = Medium,
T=273.15 + 10,
nPorts=1,
nPorts=2,
p(displayUnit="Pa") = 101325) "Pressure boundary condition"
annotation (Placement(transformation(extent={{82,-10},{62,10}})));
annotation (Placement(transformation(extent={{100,-10},{80,10}})));
IBPSA.Fluid.FixedResistances.PlugFlowPipe pip(
redeclare package Medium = Medium,
nPorts=1,
dh=0.1,
length=100,
dIns=0.05,
kIns=0.028,
m_flow_nominal=1,
m_flow_nominal=m_flow_nominal,
cPip=500,
thickness=0.0032,
initDelay=true,
m_flow_start=1,
m_flow_start=m_flow_nominal,
rhoPip=8000,
T_start_in=323.15,
T_start_out=323.15) "Pipe"
annotation (Placement(transformation(extent={{0,-10},{20,10}})));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature bou(T=283.15)
annotation (Placement(transformation(extent={{0,10},{20,30}})));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature bou[2](each T=283.15)
"Boundary temperature"
annotation (Placement(transformation(extent={{-40,60},{-20,80}})));
IBPSA.Fluid.Sources.MassFlowSource_T sou(
nPorts=1,
redeclare package Medium = Medium,
use_T_in=true,
m_flow=3) "Flow source"
annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
m_flow=m_flow_nominal,
nPorts=1) "Flow source"
annotation (Placement(transformation(extent={{-60,10},{-40,30}})));

IBPSA.Fluid.Sensors.TemperatureTwoPort senTemOut(
redeclare package Medium = Medium,
m_flow_nominal=1,
m_flow_nominal=m_flow_nominal,
tau=0,
T_start=323.15) "Temperature sensor"
annotation (Placement(transformation(extent={{30,-10},{50,10}})));
annotation (Placement(transformation(extent={{40,10},{60,30}})));
IBPSA.Fluid.Sensors.TemperatureTwoPort senTemIn(
redeclare package Medium = Medium,
m_flow_nominal=1,
m_flow_nominal=m_flow_nominal,
tau=0,
T_start=323.15) "Temperature sensor"
annotation (Placement(transformation(extent={{-30,10},{-10,30}})));
Sensors.TemperatureTwoPort senTemInNoMix(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal,
tau=0,
T_start=323.15) "Temperature sensor"
annotation (Placement(transformation(extent={{-30,-10},{-10,10}})));
annotation (Placement(transformation(extent={{-30,-30},{-10,-10}})));
IBPSA.Fluid.FixedResistances.PlugFlowPipe pipNoMix(
have_pipCap=false,
redeclare package Medium = Medium,
dh=0.1,
length=100,
dIns=0.05,
kIns=0.028,
m_flow_nominal=m_flow_nominal,
cPip=500,
thickness=0.0032,
initDelay=true,
m_flow_start=m_flow_nominal,
rhoPip=8000,
T_start_in=323.15,
T_start_out=323.15) "Pipe"
annotation (Placement(transformation(extent={{0,-30},{20,-10}})));
Sensors.TemperatureTwoPort senTemOutNoMix(
redeclare package Medium = Medium,
m_flow_nominal=m_flow_nominal,
tau=0,
T_start=323.15) "Temperature sensor"
annotation (Placement(transformation(extent={{40,-30},{60,-10}})));
Sources.MassFlowSource_T souNoMix(
redeclare package Medium = Medium,
use_T_in=true,
m_flow=m_flow_nominal,
nPorts=1) "Flow source"
annotation (Placement(transformation(extent={{-60,-30},{-40,-10}})));
equation
connect(bou.port, pip.heatPort)
annotation (Line(points={{-20,70},{10,70},{10,10}}, color={191,0,0}));
connect(Tin.y, sou.T_in)
annotation (Line(points={{-71,4},{-62,4}}, color={0,0,127}));
connect(pip.ports_b[1], senTemOut.port_a)
annotation (Line(points={{20,0},{30,0}}, color={0,127,255}));
annotation (Line(points={{-79,0},{-68,0},{-68,24},{-62,24}},
color={0,0,127}));
connect(pip.port_b, senTemOut.port_a)
annotation (Line(points={{20,20},{40,20}},
color={0,127,255}));
connect(senTemOut.port_b, sin.ports[1])
annotation (Line(points={{50,0},{62,0}}, color={0,127,255}));
connect(sou.ports[1], senTemIn.port_a)
annotation (Line(points={{-40,0},{-30,0}}, color={0,127,255}));
annotation (Line(points={{60,20},{76,20},{76,-1},{80,-1}},
color={0,127,255}));
connect(senTemIn.port_b, pip.port_a)
annotation (Line(points={{-10,0},{0,0}}, color={0,127,255}));
annotation (Line(points={{-10,20},{0,20}},
color={0,127,255}));
connect(senTemInNoMix.port_b, pipNoMix.port_a)
annotation (Line(points={{-10,-20},{0,-20}}, color={0,127,255}));
connect(pipNoMix.port_b, senTemOutNoMix.port_a)
annotation (Line(points={{20,-20},{40,-20}}, color={0,127,255}));
connect(senTemOutNoMix.port_b, sin.ports[2]) annotation (Line(points={{60,-20},
{76,-20},{76,1},{80,1}}, color={0,127,255}));
connect(bou[1].port, pip.heatPort)
annotation (Line(points={{-20,70},{-4,70},{-4,40},{10,40},{10,30}},
color={191,0,0}));
connect(bou[2].port, pipNoMix.heatPort) annotation (Line(points={{-20,70},{-4,
70},{-4,0},{10,0},{10,-10}}, color={191,0,0}));
connect(sou.ports[1], senTemIn.port_a) annotation (Line(points={{-40,20},{-30,
20}}, color={0,127,255}));
connect(souNoMix.ports[1], senTemInNoMix.port_a)
annotation (Line(points={{-40,-20},{-30,-20}}, color={0,127,255}));
connect(Tin.y, souNoMix.T_in) annotation (Line(points={{-79,0},{-68,0},{-68,
-16},{-62,-16}},
color={0,0,127}));
annotation (
__Dymola_Commands(file=
"Resources/Scripts/Dymola/Fluid/FixedResistances/Examples/PlugFlowPipe.mos"
Expand All @@ -72,12 +129,17 @@ equation
Documentation(info="<html>
<p>Basic test of model
<a href=\"modelica://IBPSA.Fluid.FixedResistances.PlugFlowPipe\">
IBPSA.Fluid.FixedResistances.PlugFlowPipe</a>.
IBPSA.Fluid.FixedResistances.PlugFlowPipe</a> with and without outlet mixing volume.
This test includes an inlet temperature step under a constant mass flow rate.
</p>
</html>", revisions="<html>
<ul>
<li>July 27, 2021 by Baptiste Ravache<br/>Add case without mixing volume</li>
</ul>
<ul>
<li>September 8, 2017 by Bram van der Heijde<br/>First implementation</li>
</ul>
</html>"));
</html>"),
Diagram(coordinateSystem(extent={{-120,-100},{120,100}})),
Icon(coordinateSystem(extent={{-100,-100},{100,100}})));
end PlugFlowPipe;
Loading