Skip to content

Commit

Permalink
Merge pull request #1622 from ibpsa/issue1621_negativeFanPower
Browse files Browse the repository at this point in the history
Issue1621 negative fan power
  • Loading branch information
hcasperfu authored Sep 28, 2022
2 parents 36b9a23 + 46d1c6f commit 50b5b93
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 1 deletion.
20 changes: 19 additions & 1 deletion IBPSA/Fluid/Movers/BaseClasses/FlowMachineInterface.mo
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,10 @@ equation
end if;

// Flow work
WFlo = dp_internal*V_flow;
WFlo = IBPSA.Utilities.Math.Functions.smoothMax(
x1=dp_internal*V_flow,
x2=0,
deltaX=1E-4*dpMax*V_flow_max);

// Power consumption
if per.use_powerCharacteristic then
Expand Down Expand Up @@ -665,10 +668,25 @@ point is added and where two additional points are added.
The parameter <code>curve</code> causes the correct data record
to be used during the simulation.
</p>
<p>
In order to prevent the model from producing negative mover power
when either the flow rate or pressure rise is forced to be negative,
the flow work <i>W&#775;<sub>flo</sub></i> is constrained to be non-negative.
The regularisation starts around 0.01% of the characteristic maximum power
<i>W&#775;<sub>max</sub> = V&#775;<sub>max</sub> &Delta;p<sub>max</sub></i>.
See discussions and an example of this situation in
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1621\">IBPSA, #1621</a>.
</p>
</html>",
revisions="<html>
<ul>
<li>
June 6, 2022, by Hongxiang Fu:<br/>
Added a constraint that <i>W<sub>flo</sub> = V&#775; &Delta;p &ge; 0</i>.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1621\">IBPSA, #1621</a>.
</li>
<li>
April 14, 2020, by Michael Wetter:<br/>
Changed <code>homotopyInitialization</code> to a constant.<br/>
This is for
Expand Down
9 changes: 9 additions & 0 deletions IBPSA/Fluid/Movers/UsersGuide.mo
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,15 @@ the hydraulic power input <i>W<sub>hyd</sub></i>, the flow work
<p>
where <i>V&#775;</i> is the volume flow rate and
<i>&Delta;p</i> is the pressure rise.
In order to prevent the model from producing negative mover power
when either the flow rate or pressure rise is forced to be negative,
the flow work <i>W&#775;<sub>flo</sub></i> is constrained to be non-negative.
The regularisation starts around 0.01% of the characteristic maximum power
<i>W&#775;<sub>max</sub> = V&#775;<sub>max</sub> &Delta;p<sub>max</sub></i>.
See discussions and an example of this situation in
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1621\">IBPSA, #1621</a>.
</p>
<p>
The heat dissipated into the medium is as follows:
If the motor is cooled by the fluid, as indicated by
<code>per.motorCooledByFluid=true</code>, then the heat dissipated into the medium is
Expand Down
75 changes: 75 additions & 0 deletions IBPSA/Fluid/Movers/Validation/NegativePressureOrFlow.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
within IBPSA.Fluid.Movers.Validation;
model NegativePressureOrFlow
"A validation model that tests the mover behaviour when the pressure rise or flow is negative"
extends Modelica.Icons.Example;

package Medium = IBPSA.Media.Air;

parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=0.1
"Nominal mass flow rate";
parameter Modelica.Units.SI.PressureDifference dp_nominal=sou.p*0.1
"Nominal pressure difference";

IBPSA.Fluid.Movers.SpeedControlled_y fan(
redeclare package Medium = Medium,
per(pressure(V_flow={0,m_flow_nominal,2*m_flow_nominal}/1.2,
dp={0.5*dp_nominal,0.25*dp_nominal,0})),
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial) "Fan"
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
IBPSA.Fluid.Sources.Boundary_pT sou(
redeclare package Medium = Medium,
use_p_in=false,
p(displayUnit="Pa") = 101325,
T=293.15,
nPorts=1) "Source with constant pressure"
annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
IBPSA.Fluid.Sources.Boundary_pT sin(
redeclare package Medium = Medium,
use_p_in=true,
T=293.15,
nPorts=1) "Sink with varying pressure"
annotation (Placement(transformation(extent={{80,-10},{60,10}})));
Modelica.Blocks.Sources.Constant one(k=1) "Constant one"
annotation (Placement(transformation(extent={{-40,20},{-20,40}})));
Modelica.Blocks.Sources.Ramp ram(
height=-sou.p*0.5,
duration=3600,
offset=sou.p*1.25) "Ramp signal"
annotation (Placement(transformation(extent={{40,20},{60,40}})));
equation
connect(one.y, fan.y)
annotation (Line(points={{-19,30},{0,30},{0,12}}, color={0,0,127}));

connect(ram.y, sin.p_in)
annotation (Line(points={{61,30},{88,30},{88,8},{82,8}}, color={0,0,127}));
connect(fan.port_b, sin.ports[1])
annotation (Line(points={{10,0},{60,0}}, color={0,127,255}));
connect(sou.ports[1], fan.port_a)
annotation (Line(points={{-60,0},{-10,0}}, color={0,127,255}));
annotation(__Dymola_Commands(file="modelica://IBPSA/Resources/Scripts/Dymola/Fluid/Movers/Validation/NegativePressureOrFlow.mos"
"Simulate and plot"),
experiment(
StopTime=3600,
Tolerance=1e-06),
Documentation(info="<html>
<p>
Without the constraint that
<i>W<sub>flo</sub> = V&#775; &Delta;p &ge; 0</i>,
this validation model would produce negative computed mover power
when the pressure rise or the flow rate is forced to be negative,
as shown below.
</p>
<p align=\"center\">
<img alt=\"image\" src=\"modelica://IBPSA/Resources/Images/Fluid/Movers/Validation/NegativePressureOrFlow.png\"/>
</p>
</html>", revisions="<html>
<ul>
<li>
June 6, 2022, by Hongxiang Fu:<br/>
First implementation.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1621\">IBPSA, #1621</a>.
</li>
</ul>
</html>"));
end NegativePressureOrFlow;
1 change: 1 addition & 0 deletions IBPSA/Fluid/Movers/Validation/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ ControlledFlowMachineDynamic
FlowControlled_dp
FlowControlled_dpSystem
FlowControlled_m_flow
NegativePressureOrFlow
PowerExact
PowerSimplified
PumpCurveConstruction
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 50b5b93

Please sign in to comment.