-
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
Conversation
@AntoineGautier Please take a look and let me know if I've missed something. Thanks! |
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.
@bravache Please see my inline comments.
Also, and as proposed in the issue page, I would merge PlugFlowCore
and PlugFlowPipe
into one, making the fluid volume conditional to an advanced Boolean parameter which would be true by default. The two models are too similar in my opinion to justify keeping them both.
<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 comment
The 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).
Instead I would add something like:
Note that in order to model a branched network it is recommended to use
IBPSA.Fluid.FixedResistances.Junction
at each junction and to configure that component with a state (see for instance
<a href="modelica://IBPSA.Fluid.FixedResistances.Validation.PlugFlowPipes.PlugFlowAIT">
IBPSA.Fluid.FixedResistances.Validation.PlugFlowPipes.PlugFlowAIT).
This will avoid the numerical Jacobian that is otherwise created when the inlet ports of two instances of the plug flow model are connected together.
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've reworded the whole documentation to incorporate part of the PlugFlowCore
doc. Let me know if that works.
@@ -1,7 +1,7 @@ | |||
within IBPSA.Fluid.FixedResistances; | |||
model PlugFlowPipe | |||
"Pipe model using spatialDistribution for temperature delay" | |||
extends IBPSA.Fluid.Interfaces.PartialTwoPortVector; |
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 the PartialFourPortParallel
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
I've moved the |
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 just have one minor change request and a suggestion.
Otherwise the changes look good to me.
@Mathadon @nytschgeusen @cvering @mwetter Let me know if you have any comments. Otherwise, this will be merged on 09/03/2021. ContentThe main change introduce is changing the vectorized outlet port of Additionally, the The previous classes were moved to The existing unit tests stored output had to be updated to reflect the change in translation statistics, but the timeseries results remained unchanged. |
@bravache thanks for the summary! I have forwarded this to a colleague who uses this model more actively than I do. |
Michael to merge after last review. |
Otherwise, the rename script will not update them if the classes are moved to another package
…a/modelica-ibpsa into issue1494_plugflowpipe_singleoutlet
This is used by Buildings/Fluid/FixedResistances/PlugFlowDiscretized.mo
Updated reference results, only minor changes
Todo
|
@Mathadon : This is ready to merge from my point of view, but I think it would be good to have another approvals as during the clean up, I changed in |
@mwetter I'll try to review this tomorrow! |
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.
My largest concern is that the model IBPSA.Fluid.FixedResistances.PlugFlowPipe is not yet symmetric: a mixing volume consists at just one of the two pipe outlets/inlets. I propose to use two mixing volumes, each with half the mass.
@@ -48,8 +49,7 @@ initial equation | |||
t0 = time; | |||
|
|||
equation | |||
u = m_flow/(rho*(dh^2)/4*Modelica.Constants.pi)/length; | |||
|
|||
u = m_flow * conUM; |
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.
Great!
annotation (Placement(transformation(extent={{-30,10},{-10,30}}))); | ||
Sensors.TemperatureTwoPort senTemInNoMix( | ||
redeclare package Medium = Medium, | ||
m_flow_nominal=1, |
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.
this could use tau=0
?
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.
Added for all temperature sensors.
annotation (Placement(transformation(extent={{0,-30},{20,-10}}))); | ||
Sensors.TemperatureTwoPort senTemOutNoMix( | ||
redeclare package Medium = Medium, | ||
m_flow_nominal=1, |
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.
tau=0?
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.
Same for all other examples to be honest: the filter slows down the model and skews the results.
"Control volume connected to port_b. Represents equivalent pipe wall thermal capacity." | ||
annotation (Placement(transformation(extent={{70,20},{90,40}}))); | ||
|
||
LosslessPipe noMixPip( |
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.
why not use a simple connection instead?
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 believe I've written it like that to conserve a symmetrical syntax between the case with the mixing volume (have_pipCap
) and the case without a mixing volume (not have_pipCap
).
Also, in the graphical editor of Dymola, you get an annotation in the hover tooltip when a component is optional (screenshot below), but not when a connect statement is optional, which makes that structure a bit more explicit.
That being said, if there is a computational or syntax issue with that format, I can switch back to an optional connect.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
this has no purpose if dp_nominal=0
?
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.
Indeed! Good catch. Removed for both junctions in this model.
package Validation "Collection of validation models" | ||
extends Modelica.Icons.ExamplesPackage; | ||
|
||
model PlugFlowCore "Simple example of plug flow pipe core" |
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.
It would be better to split this package in multiple .mo files?
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.
Good catch! Updated
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.
Thanks Filip, I've reviewed your inline comments.
With regard with the symmetry of the model, I was reluctant to introduce it because when I implement it naively, models that have two PlugFlowPipe
in series become structurally singular because of the two connected mixing volumes.
I am discussing this with Michael and will update you if we come up to a solution.
Edit: Actually you can disregard that message, the structural singularity was a different issue from my rushed implementation.
"Control volume connected to port_b. Represents equivalent pipe wall thermal capacity." | ||
annotation (Placement(transformation(extent={{70,20},{90,40}}))); | ||
|
||
LosslessPipe noMixPip( |
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 believe I've written it like that to conserve a symmetrical syntax between the case with the mixing volume (have_pipCap
) and the case without a mixing volume (not have_pipCap
).
Also, in the graphical editor of Dymola, you get an annotation in the hover tooltip when a component is optional (screenshot below), but not when a connect statement is optional, which makes that structure a bit more explicit.
That being said, if there is a computational or syntax issue with that format, I can switch back to an optional connect.
annotation (Placement(transformation(extent={{-30,10},{-10,30}}))); | ||
Sensors.TemperatureTwoPort senTemInNoMix( | ||
redeclare package Medium = Medium, | ||
m_flow_nominal=1, |
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.
Added for all temperature sensors.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! Good catch. Removed for both junctions in this model.
package Validation "Collection of validation models" | ||
extends Modelica.Icons.ExamplesPackage; | ||
|
||
model PlugFlowCore "Simple example of plug flow pipe core" |
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.
Good catch! Updated
@bravache : Above, there is the declaration:
This looks wrong. All models use |
@mwetter |
Using single line entries avoids very long strings (they will be cut with '...', see FlowReversal model)
Providing the full class name allows refactoring scripts to update them
Closes #1494
This PR addresses the problem of compatibility of
IBPSA.Fluid.FixedResistances.PlugFlowPipe
with other pipe classes, by changing its outlet port from a vectorized port to a single port.The PR brings non-backward compatible changes, for which a conversion script is provided for Dymola users.
Validation results
The following example and validation models uses the
PlugFlowPipe
class and were updated to reflect that change:IBPSA.Fluid.FixedResistances.Examples.PlugFlowPipe
IBPSA.Fluid.FixedResistances.Validation.PlugFlowPipes.FlowReversal
IBPSA.Fluid.FixedResistances.Validation.PlugFlowPipes.PlugFlowAIT
IBPSA.Fluid.FixedResistances.Validation.PlugFlowPipes.PlugFlowULg
IBPSA.Fluid.FixedResistances.Validation.PlugFlowPipes.TransportWaterAir
For most of the models, the only change required was to remove the parameter
nPorts
from the parameterization ofPlugFlowPipe
and update the outlet connection. Additionally, forPlugFlowAIT
, two splitters had to be introduced to replace the connections out ofpip1
andpip5
.The results of all example/validation models remained unchanged, with the exception of
PlugFlowAIT
which only shows an error in the initial step of the simulation, but no error for the remainder of the runtime.On a side note, the pressure boundary condition for the
FlowReversal
example was updated to 5bar, to avoid negative pressure at the inlet when the flow is reversed. This does not change the expected results, but make the example more robust.Backward compatibility
This change is non-backward compatible. A conversion script was written to redirect previous objects to the obsolete class.