Skip to content

Commit

Permalink
Merge branch 'master' into issue1575_addPVModel
Browse files Browse the repository at this point in the history
  • Loading branch information
LauraMaier committed Oct 7, 2022
2 parents a79a5bf + 50b5b93 commit fe90fad
Show file tree
Hide file tree
Showing 53 changed files with 545 additions and 11,199 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:
global:
- [email protected]
- OMC_VERSION=ubuntu-2004-omc:1.19.0_dev-551-g1772c4b-1
- DYMOLA_VERSION=travis_ubuntu-2004_dymola:2022x-x86_64_rev-2
- DYMOLA_VERSION=travis_ubuntu-2004_dymola:2023-x86_64

jobs:
# Test matrix for regression tests.
Expand Down
8 changes: 4 additions & 4 deletions IBPSA/Fluid/Actuators/Valves/TwoWayTable.mo
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ initial equation
Modelica.Constants.eps,
"flowCharateristics.phi[end] must be 1.");

// Assert that the sequences are strictly monotonic increasing
// Assert that the sequences are strictly increasing
assert(IBPSA.Utilities.Math.Functions.isMonotonic(
x=flowCharacteristics.y,
strict=true),
"The values for y in flowCharacteristics must be strictly monotone increasing.");
"The values for y in flowCharacteristics must be strictly increasing.");
assert(IBPSA.Utilities.Math.Functions.isMonotonic(
x=flowCharacteristics.phi,
strict=true),
"The values for phi in flowCharacteristics must be strictly monotone increasing.");
"The values for phi in flowCharacteristics must be strictly increasing.");

equation
connect(phiLooUp.u[1], y_actual) annotation (Line(
Expand Down Expand Up @@ -102,7 +102,7 @@ requirements, otherwise the model stops with an error:
<li>
Their arrays
<code>y</code> and <code>phi</code>
must be strictly monotonic increasing.
must be strictly increasing.
</li>
<li>
The first value must satisfy
Expand Down
4 changes: 2 additions & 2 deletions IBPSA/Fluid/BaseClasses/FlowModels/basicFlowFunction_dp.mo
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ Documentation(info="<html>
Function that computes the pressure drop of flow elements as
</p>
<p align=\"center\" style=\"font-style:italic;\">
m = sign(&Delta;p) k &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
m&#775; = sign(&Delta;p) k &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
</p>
<p>
with regularization near the origin.
Therefore, the flow coefficient is
</p>
<p align=\"center\" style=\"font-style:italic;\">
k = m &frasl; &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
k = m&#775; &frasl; &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
</p>
<p>
The input <code>m_flow_turbulent</code> determines the location of the regularization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ Documentation(info="<html>
Function that computes the pressure drop of flow elements as
</p>
<p align=\"center\" style=\"font-style:italic;\">
&Delta;p = sign(m) (m &frasl; k)<sup>2</sup>
&Delta;p = sign(m&#775;) (m&#775; &frasl; k)<sup>2</sup>
</p>
<p>
with regularization near the origin.
Therefore, the flow coefficient is
</p>
<p align=\"center\" style=\"font-style:italic;\">
k = m &frasl; &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
k = m&#775; &frasl; &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
</p>
<p>
The input <code>m_flow_turbulent</code> determines the location of the regularization.
Expand Down
6 changes: 2 additions & 4 deletions IBPSA/Fluid/Examples/SimpleHouse.mo
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,13 @@ equation
June 15, 2022, by Hongxiang Fu:<br/>
Changed <code>conDam.yMin</code> from 0.1 to 0.25.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1624\">
IBPSA, #1624</a>.
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1624\">IBPSA, #1624</a>.
</li>
<li>
May 8, 2017, by Michael Wetter:<br/>
Updated heater model.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/763\">
IBPSA, #763</a>.
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/763\">IBPSA, #763</a>.
</li>
<li>
November 10, 2016, by Michael Wetter:<br/>
Expand Down
4 changes: 2 additions & 2 deletions IBPSA/Fluid/FixedResistances/CheckValve.mo
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ Note that the small reverse flows can still occur with this model.
The basic flow function
</p>
<p align=\"center\" style=\"font-style:italic;\">
m = sign(&Delta;p) k &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>,
m&#775; = sign(&Delta;p) k &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>,
</p>
<p>
with regularization near the origin, is used to compute the pressure drop.
The flow coefficient
</p>
<p align=\"center\" style=\"font-style:italic;\">
k = m &frasl; &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
k = m&#775; &frasl; &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
</p>
<p>
is increased from <code>l*KV_Si</code> to <code>KV_Si</code>,
Expand Down
6 changes: 3 additions & 3 deletions IBPSA/Fluid/FixedResistances/HydraulicDiameter.mo
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ The mass flow rate is computed as
</p>
<p align=\"center\" style=\"font-style:italic;\">
m&#775; = k
&radic;<span style=\"text-decoration:overline;\">&Delta;P</span>,
&radic;<span style=\"text-decoration:overline;\">&Delta;p</span>,
</p>
<p>
where
<i>k</i> is a constant and
<i>&Delta;P</i> is the pressure drop.
<i>&Delta;p</i> is the pressure drop.
The constant <i>k</i> is equal to
<code>k=m_flow_nominal/sqrt(dp_nominal)</code>,
where <code>m_flow_nominal</code> is a parameter.
Expand Down Expand Up @@ -163,7 +163,7 @@ IBPSA.Fluid.BaseClasses.FlowModels</a>,
This package contains regularized implementations of the equation
</p>
<p align=\"center\" style=\"font-style:italic;\">
m = sign(&Delta;p) k &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
m&#775; = sign(&Delta;p) k &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
</p>
<p>
and its inverse function.
Expand Down
6 changes: 3 additions & 3 deletions IBPSA/Fluid/FixedResistances/PressureDrop.mo
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ The mass flow rate is
</p>
<p align=\"center\" style=\"font-style:italic;\">
m&#775; = k
&radic;<span style=\"text-decoration:overline;\">&Delta;P</span>,
&radic;<span style=\"text-decoration:overline;\">&Delta;p</span>,
</p>
<p>
where
<i>k</i> is a constant and
<i>&Delta;P</i> is the pressure drop.
<i>&Delta;p</i> is the pressure drop.
The constant <i>k</i> is equal to
<code>k=m_flow_nominal/sqrt(dp_nominal)</code>,
where <code>m_flow_nominal</code> and <code>dp_nominal</code>
Expand Down Expand Up @@ -163,7 +163,7 @@ IBPSA.Fluid.BaseClasses.FlowModels</a>,
This package contains regularized implementations of the equation
</p>
<p align=\"center\" style=\"font-style:italic;\">
m = sign(&Delta;p) k &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
m&#775; = sign(&Delta;p) k &radic;<span style=\"text-decoration:overline;\">&nbsp;&Delta;p &nbsp;</span>
</p>
<p>
and its inverse function.
Expand Down
2 changes: 1 addition & 1 deletion IBPSA/Fluid/FixedResistances/package.mo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ flow coefficient
</p>
<p align=\"center\" style=\"font-style:italic;\">
k = m &frasl;
&radic;<span style=\"text-decoration:overline;\">&Delta;P</span>.
&radic;<span style=\"text-decoration:overline;\">&Delta;p</span>.
</p>
<p>
For models of valves and air dampers, see
Expand Down
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
2 changes: 1 addition & 1 deletion IBPSA/Fluid/Movers/Validation/FlowControlled_dpSystem.mo
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,5 @@ This is for
</li>
</ul>
</html>"),
Icon(coordinateSystem(extent={{-120,-120},{120,120}})));
Icon(coordinateSystem(extent={{-100,-100},{100,100}})));
end FlowControlled_dpSystem;
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 fe90fad

Please sign in to comment.