-
Notifications
You must be signed in to change notification settings - Fork 84
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
Changes from 5 commits
b7803cd
04f29e0
d0bff32
403a976
7c513c7
c9d7e1d
9eccb21
333dd4f
7304835
655e53c
43529e3
b0fbc02
245cc2c
2909c70
6dce628
d40c322
8bbc228
784ce99
670f3ce
463ff71
7065294
5a18c03
b83f5d6
a637e26
5031c9b
7d31f46
73e7d11
bb0338c
072086f
1fc20a4
beef79c
c8c7ca7
b204dc5
146ce65
3705e42
505bb91
0f0dbb5
5f64335
6c0b7f9
bd7c690
abc385c
9d1abcf
fb7d4ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
within IBPSA.Fluid.FixedResistances; | ||
model PlugFlowPipe | ||
"Pipe model using spatialDistribution for temperature delay" | ||
extends IBPSA.Fluid.Interfaces.PartialTwoPortVector; | ||
extends IBPSA.Fluid.Interfaces.PartialTwoPort; | ||
|
||
constant Boolean homotopyInitialization = true "= true, use homotopy method" | ||
annotation(HideResult=true); | ||
|
@@ -117,12 +117,12 @@ model PlugFlowPipe | |
redeclare final package Medium = Medium, | ||
final m_flow_nominal=m_flow_nominal, | ||
final V=if rho_default > 500 then VEqu else VEqu/1000, | ||
final nPorts=nPorts + 1, | ||
final nPorts=2, | ||
final T_start=T_start_out, | ||
final energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, | ||
final mSenFac = if rho_default > 500 then 1 else 10) | ||
"Control volume connected to ports_b. Represents equivalent pipe wall thermal capacity." | ||
annotation (Placement(transformation(extent={{60,20},{80,40}}))); | ||
final mSenFac=if rho_default > 500 then 1 else 10) | ||
"Control volume connected to port_b. Represents equivalent pipe wall thermal capacity." | ||
annotation (Placement(transformation(extent={{40,20},{60,40}}))); | ||
|
||
protected | ||
parameter Modelica.SIunits.HeatCapacity CPip= | ||
|
@@ -157,19 +157,16 @@ initial equation | |
level = AssertionLevel.warning); | ||
|
||
equation | ||
for i in 1:nPorts loop | ||
connect(vol.ports[i + 1], ports_b[i]) | ||
annotation (Line(points={{70,20},{72,20},{72,6},{72,0},{100,0}}, | ||
color={0,127,255})); | ||
end for; | ||
connect(cor.heatPort, heatPort) | ||
annotation (Line(points={{0,10},{0,10},{0,100}}, color={191,0,0})); | ||
|
||
connect(cor.port_b, vol.ports[1]) | ||
annotation (Line(points={{10,0},{70,0},{70,20}}, color={0,127,255})); | ||
annotation (Line(points={{10,0},{48,0},{48,20}}, color={0,127,255})); | ||
|
||
connect(cor.port_a, port_a) | ||
annotation (Line(points={{-10,0},{-56,0},{-100,0}}, color={0,127,255})); | ||
connect(vol.ports[2], port_b) annotation (Line(points={{52,20},{52,20},{52,0}, | ||
{100,0}}, color={0,127,255})); | ||
connect(port_a, cor.port_a) | ||
annotation (Line(points={{-100,0},{-10,0}}, color={0,127,255})); | ||
annotation ( | ||
Line(points={{70,20},{72,20},{72,0},{100,0}}, color={0,127,255}), | ||
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{ | ||
|
@@ -215,6 +212,17 @@ d = %dh")}), | |
Documentation(revisions="<html> | ||
<ul> | ||
<li> | ||
July 9, 2021, by Baptiste Ravache:<br/> | ||
Replaced the vectorized outlet port <code>ports_b</code> with | ||
a single outlet port <code>port_b</code>.<br/> | ||
This is for | ||
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1494\">IBPSA, #1494</a>.<br/> | ||
This change is not backward compatible.<br/> | ||
The previous class definition was moved to | ||
<a href=\"modelica://IBPSA.Obsolete.Fluid.FixedResistances.PlugFlowPipe\"> | ||
IBPSA.Obsolete.Fluid.FixedResistances.PlugFlowPipe</a>. | ||
</li> | ||
<li> | ||
April 14, 2020, by Michael Wetter:<br/> | ||
Changed <code>homotopyInitialization</code> to a constant.<br/> | ||
This is for | ||
|
@@ -274,8 +282,6 @@ The thermal capacity of the pipe wall is implemented as a mixing volume | |
of the fluid in the pipe, of which the thermal capacity | ||
is equal to that of the pipe wall material. | ||
In addition, this mixing volume allows the hydraulic separation of subsequent pipes. | ||
Thanks to the vectorized implementation of the (design) outlet port, | ||
splits and junctions of pipes can be handled in a numerically efficient way. | ||
<br/> | ||
This mixing volume is not present in the | ||
<a href=\"modelica://IBPSA.Fluid.FixedResistances.BaseClasses.PlugFlowCore\">PlugFlowCore</a> model, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would delete that sentence as we agreed that the mixing volume was necessary to represent the effect of the pipe wall capacitance (not only for decoupling the DAE between multiple instances).
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've reworded the whole documentation to incorporate part of the |
||
|
@@ -295,7 +301,7 @@ The boundary temperature is uniform. | |
</li> | ||
<li> | ||
The thermal inertia of the pipe wall material is lumped on the side of the pipe | ||
that is connected to <code>ports_b</code>. | ||
that is connected to <code>port_b</code>. | ||
</li> | ||
</ul> | ||
<h4>References</h4> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,6 @@ model PlugFlowAIT | |
kIns=0.024, | ||
length=115, | ||
allowFlowReversal=allowFlowReversal, | ||
nPorts=2, | ||
m_flow_nominal=0.3, | ||
R=1/(2*0.024*Modelica.Constants.pi)*log(0.18/0.0899) + 1/(2*2.4*Modelica.Constants.pi) | ||
*log(2/0.18), | ||
|
@@ -69,7 +68,7 @@ model PlugFlowAIT | |
rhoPip=8000, | ||
initDelay=false, | ||
m_flow_start=0) "Pipe 1" | ||
annotation (Placement(transformation(extent={{50,0},{30,20}}))); | ||
annotation (Placement(transformation(extent={{60,0},{40,20}}))); | ||
PlugFlowPipe pip4( | ||
dh = 0.0337 - 2*0.0032, | ||
redeclare package Medium = Medium, | ||
|
@@ -79,7 +78,6 @@ model PlugFlowAIT | |
allowFlowReversal=allowFlowReversal, | ||
m_flow_nominal=0.3, | ||
thickness=thickness, | ||
nPorts=2, | ||
R=R80, | ||
cPip=500, | ||
rhoPip=8000, | ||
|
@@ -97,7 +95,6 @@ model PlugFlowAIT | |
kIns=0.024, | ||
dIns=0.045, | ||
allowFlowReversal=allowFlowReversal, | ||
nPorts=2, | ||
m_flow_nominal=0.3, | ||
R=1/(2*0.024*Modelica.Constants.pi)*log(0.18/0.0899) + 1/(2*2.4*Modelica.Constants.pi) | ||
*log(2/0.18), | ||
|
@@ -114,7 +111,6 @@ model PlugFlowAIT | |
dIns=0.045, | ||
kIns=0.024, | ||
allowFlowReversal=allowFlowReversal, | ||
nPorts=1, | ||
m_flow_nominal=0.3, | ||
thickness=thickness, | ||
dh=0.0337 - 2*0.0032, | ||
|
@@ -134,7 +130,6 @@ model PlugFlowAIT | |
dIns=0.045, | ||
kIns=0.024, | ||
allowFlowReversal=allowFlowReversal, | ||
nPorts=1, | ||
m_flow_nominal=0.3, | ||
thickness=thickness, | ||
dh=0.0337 - 2*0.0032, | ||
|
@@ -210,7 +205,6 @@ model PlugFlowAIT | |
kIns=0.024, | ||
length=20, | ||
allowFlowReversal=allowFlowReversal, | ||
nPorts=2, | ||
m_flow_nominal=0.3, | ||
R=1/(2*0.024*Modelica.Constants.pi)*log(0.18/0.0899) + 1/(2*2.4*Modelica.Constants.pi) | ||
*log(2/0.18), | ||
|
@@ -261,6 +255,36 @@ model PlugFlowAIT | |
rotation=180, | ||
origin={46,56}))); | ||
|
||
IBPSA.Fluid.FixedResistances.Junction splPip1( | ||
redeclare package Medium = Medium, | ||
m_flow_nominal={pip1.m_flow_nominal,pip5.m_flow_nominal,pip4.m_flow_nominal}, | ||
from_dp=true, | ||
linearized=true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this has no purpose if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed! Good catch. Removed for both junctions in this model. |
||
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, | ||
dp_nominal(each displayUnit="Pa") = {0,0,0}, | ||
portFlowDirection_1=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional | ||
else Modelica.Fluid.Types.PortFlowDirection.Entering, | ||
portFlowDirection_2=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional | ||
else Modelica.Fluid.Types.PortFlowDirection.Leaving, | ||
portFlowDirection_3=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional | ||
else Modelica.Fluid.Types.PortFlowDirection.Leaving) | ||
"Splitter coming out of pip1" | ||
annotation (Placement(transformation(extent={{30,20},{10,0}}))); | ||
IBPSA.Fluid.FixedResistances.Junction splPip2( | ||
redeclare package Medium = Medium, | ||
m_flow_nominal={pip5.m_flow_nominal,pip2.m_flow_nominal,pip3.m_flow_nominal}, | ||
from_dp=true, | ||
linearized=true, | ||
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial, | ||
dp_nominal(each displayUnit="Pa") = {0,0,0}, | ||
portFlowDirection_1=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional | ||
else Modelica.Fluid.Types.PortFlowDirection.Entering, | ||
portFlowDirection_2=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional | ||
else Modelica.Fluid.Types.PortFlowDirection.Leaving, | ||
portFlowDirection_3=if allowFlowReversal then Modelica.Fluid.Types.PortFlowDirection.Bidirectional | ||
else Modelica.Fluid.Types.PortFlowDirection.Leaving) | ||
"Splitter coming out of pip5" | ||
annotation (Placement(transformation(extent={{-30,0},{-50,20}}))); | ||
equation | ||
connect(m_flow_p3.y, Point3.m_flow_in) annotation (Line( | ||
points={{-62,-110},{-58,-110},{-58,-94}}, | ||
|
@@ -280,12 +304,12 @@ equation | |
smooth=Smooth.None)); | ||
connect(DataReader.y[9], prescribedTemperature.T) | ||
annotation (Line(points={{21,-130},{38,-130}}, color={0,0,127})); | ||
connect(pip4.heatPort, pip1.heatPort) annotation (Line(points={{20,40},{20,40}, | ||
{40,40},{40,20}}, color={191,0,0})); | ||
connect(pip1.heatPort, pip0.heatPort) annotation (Line(points={{40,20},{40,26}, | ||
connect(pip4.heatPort, pip1.heatPort) annotation (Line(points={{20,40},{50,40}, | ||
{50,20}}, color={191,0,0})); | ||
connect(pip1.heatPort, pip0.heatPort) annotation (Line(points={{50,20},{50,26}, | ||
{100,26},{100,-10},{90,-10}}, | ||
color={191,0,0})); | ||
connect(pip1.heatPort, pip2.heatPort) annotation (Line(points={{40,20},{40,26}, | ||
connect(pip1.heatPort, pip2.heatPort) annotation (Line(points={{50,20},{50,26}, | ||
{-78,26}}, color={191,0,0})); | ||
connect(pip5.heatPort, pip2.heatPort) annotation (Line(points={{-10,20},{-10,26}, | ||
{-78,26}}, color={191,0,0})); | ||
|
@@ -316,29 +340,21 @@ equation | |
connect(lessThreshold.u, m_flow_p4.y) annotation (Line(points={{93.6,128},{ | ||
100,128},{100,140},{114,140}}, | ||
color={0,0,127})); | ||
connect(pip1.port_a, pip0.ports_b[1]) | ||
annotation (Line(points={{50,10},{78,10},{78,0}}, color={0,127,255})); | ||
connect(pip1.ports_b[1], pip4.port_a) | ||
annotation (Line(points={{30,8},{10,8},{10,30}}, color={0,127,255})); | ||
connect(pip5.port_a, pip1.ports_b[2]) | ||
annotation (Line(points={{0,10},{30,10},{30,12}}, color={0,127,255})); | ||
connect(pip4.ports_b[1], senTem_p4.port_a) | ||
annotation (Line(points={{8,50},{8,70}}, color={0,127,255})); | ||
connect(Point5.ports[1], pip4.ports_b[2]) annotation (Line(points={{36,56},{ | ||
36,56},{12,56},{12,50}}, color={0,127,255})); | ||
connect(pip5.ports_b[1], senTemIn_p2.port_b) | ||
annotation (Line(points={{-20,8},{-60,8}}, color={0,127,255})); | ||
connect(pip3.port_a, pip5.ports_b[2]) | ||
annotation (Line(points={{-50,-10},{-50,12},{-20,12}}, | ||
color={0,127,255})); | ||
connect(pip1.port_a, pip0.port_b) | ||
annotation (Line(points={{60,10},{80,10},{80,0}}, color={0,127,255})); | ||
connect(pip4.port_b, senTem_p4.port_a) | ||
annotation (Line(points={{10,50},{10,60},{8,60},{8,70}}, | ||
color={0,127,255})); | ||
connect(Point5.ports[1], pip4.port_b) annotation (Line(points={{36,56},{36,56}, | ||
{10,56},{10,50}}, color={0,127,255})); | ||
connect(senTemIn_p2.port_a, pip2.port_a) | ||
annotation (Line(points={{-80,8},{-88,8},{-88,16}}, color={0,127,255})); | ||
connect(pip2.ports_b[1], senTem_p2.port_a) | ||
connect(pip2.port_b, senTem_p2.port_a) | ||
annotation (Line(points={{-88,36},{-88,46}}, color={0,127,255})); | ||
connect(pip3.ports_b[1], senTem_p3.port_a) annotation (Line(points={{-50,-30}, | ||
connect(pip3.port_b, senTem_p3.port_a) annotation (Line(points={{-50,-30}, | ||
{-50,-40}}, color={0,127,255})); | ||
connect(ExcludedBranch.ports[1], pip0.ports_b[2]) annotation (Line(points={{82,30}, | ||
{82,0}}, color={0,127,255})); | ||
connect(ExcludedBranch.ports[1], pip0.port_b) annotation (Line(points={{82,30}, | ||
{82,16},{82,0},{80,0}}, color={0,127,255})); | ||
connect(switch1.y, Point5.m_flow_in) annotation (Line(points={{109,64},{58,64}}, | ||
color={0,0,127})); | ||
connect(m_flow_p4.y, switch1.u3) annotation (Line(points={{114,140},{100,140}, | ||
|
@@ -348,6 +364,18 @@ equation | |
connect(lessThreshold.y, switch1.u2) annotation (Line(points={{75.2,128},{66, | ||
128},{66,104},{140,104},{140,64},{132,64}}, | ||
color={255,0,255})); | ||
connect(pip5.port_a, splPip1.port_2) | ||
annotation (Line(points={{0,10},{10,10}},color={0,127,255})); | ||
connect(pip1.port_b, splPip1.port_1) | ||
annotation (Line(points={{40,10},{30,10}}, color={0,127,255})); | ||
connect(splPip1.port_3, pip4.port_a) annotation (Line(points={{20,20},{20,24}, | ||
{10,24},{10,30}}, color={0,127,255})); | ||
connect(senTemIn_p2.port_b, splPip2.port_2) | ||
annotation (Line(points={{-60,8},{-60,10},{-50,10}}, color={0,127,255})); | ||
connect(pip5.port_b, splPip2.port_1) | ||
annotation (Line(points={{-20,10},{-30,10}}, color={0,127,255})); | ||
connect(pip3.port_a, splPip2.port_3) annotation (Line(points={{-50,-10},{-50,-4}, | ||
{-40,-4},{-40,0}}, color={0,127,255})); | ||
annotation ( | ||
experiment( | ||
StopTime=603900, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IBPSA.Fluid.Interfaces.PartialTwoPortVector
may be retired into Obsolete as it was only used by the plug flow model.To be validated with the IBPSA team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might keep it like that since it predates the
PlugFlowPipe
model. Also, in the same package, there is also thePartialFourPortParallel
which is not in used.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed a ticket so that it can be discussed before implemented here: #1504