Skip to content

Commit

Permalink
Merge pull request #13 from ibpsa/master
Browse files Browse the repository at this point in the history
update local master
  • Loading branch information
EttoreZ committed Aug 4, 2020
2 parents 76e5d94 + e36816a commit a66fa5c
Show file tree
Hide file tree
Showing 223 changed files with 2,785 additions and 3,147 deletions.
49 changes: 25 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dist: trusty
sudo: false
dist: bionic

language: python

python:
- "3.6"

Expand All @@ -15,6 +15,7 @@ git:

services:
- docker
- xvfb

env:
- TEST_ARG="make test-documentation test-experiment-setup test-autogenerated-files test-verify-files"
Expand All @@ -34,14 +35,12 @@ env:
before_install:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- if [[ "$TEST_ARG" == *test-dymola* ]]; then
docker pull "$DOCKER_USERNAME"/travis_ubuntu-1804_dymola-2020x-x86_64;
chmod +x IBPSA/Resources/Scripts/travis/bin/dymola;
cp IBPSA/Resources/Scripts/travis/bin/dymola $HOME/bin/;
docker pull "$DOCKER_USERNAME"/travis_ubuntu-1804_dymola:2021-x86_64;
cp IBPSA/Resources/Scripts/travis/dymola/dymola $HOME/bin/;
fi;
- if [[ "$TEST_ARG" == *test-jmodelica* ]]; then
docker pull "$DOCKER_USERNAME"/ubuntu-1804_jmodelica_trunk;
chmod +x IBPSA/Resources/Scripts/travis/bin/jm_ipython.sh;
cp IBPSA/Resources/Scripts/travis/bin/jm_ipython.sh $HOME/bin/;
cp IBPSA/Resources/Scripts/travis/jmodelica/jm_ipython.sh $HOME/bin/;
fi;

# Install dependencies
Expand All @@ -51,23 +50,25 @@ before_install:
install:
- pip3 install --upgrade pip setuptools wheel
- pip3 install --only-binary=numpy,scipy,matplotlib numpy==1.13.3 scipy==0.19.1 matplotlib==2.1.0
- pip3 install sphinx==2.1.2 \
sphinx-bootstrap-theme==0.7.1 \
sphinxcontrib-bibtex==0.4.2 \
sphinxcontrib-plantuml==0.17 \
alabaster==0.7.12 \
MarkupSafe==1.1.1 \
Pygments==2.4.2 \
snowballstemmer==1.9.0 \
docutils==0.15.2 \
Babel==2.7.0 \
requests==2.22.0 \
Jinja2==2.10.1 \
latexcodec==1.0.7 \
pybtex==0.22.2
pybtex-docutils==0.2.1 \
oset==0.1.3 \
PyYAML==5.1.2
- if [[ "$TEST_ARG" == *test-documentation* ]]; then
pip3 install sphinx==2.1.2 \
sphinx-bootstrap-theme==0.7.1 \
sphinxcontrib-bibtex==0.4.2 \
sphinxcontrib-plantuml==0.17 \
alabaster==0.7.12 \
MarkupSafe==1.1.1 \
Pygments==2.4.2 \
snowballstemmer==1.9.0 \
docutils==0.15.2 \
Babel==2.7.0 \
requests==2.22.0 \
Jinja2==2.10.1 \
latexcodec==1.0.7 \
pybtex==0.22.2
pybtex-docutils==0.2.1 \
oset==0.1.3 \
PyYAML==5.1.2;
fi;
- pip3 install git+https://github.com/lbl-srg/BuildingsPy@master

# Execute tests
Expand Down
25 changes: 21 additions & 4 deletions IBPSA/Airflow/Multizone/BaseClasses/PowerLawResistance.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ within IBPSA.Airflow.Multizone.BaseClasses;
partial model PowerLawResistance "Flow resistance that uses the power law"
extends IBPSA.Fluid.Interfaces.PartialTwoPortInterface(
final allowFlowReversal=true,
final m_flow_nominal=rho_default*k*dp_turbulent);
final m_flow_nominal=rho_default*k*dp_turbulent,
final m_flow_small=1E-4*abs(m_flow_nominal));
extends IBPSA.Airflow.Multizone.BaseClasses.ErrorControl;

constant Boolean homotopyInitialization = true "= true, use homotopy method"
annotation(HideResult=true);

parameter Real m(min=0.5, max=1)
"Flow exponent, m=0.5 for turbulent, m=1 for laminar";
parameter Boolean useDefaultProperties=true
Expand All @@ -14,9 +18,6 @@ partial model PowerLawResistance "Flow resistance that uses the power law"
"Pressure difference where laminar and turbulent flow relation coincide. Recommended = 0.1"
annotation(Dialog(tab="Advanced"));

parameter Boolean homotopyInitialization = true "= true, use homotopy method"
annotation(Evaluate=true, Dialog(tab="Advanced"));

Modelica.SIunits.VolumeFlowRate V_flow
"Volume flow rate through the component";
Modelica.SIunits.Velocity v(nominal=1) "Average velocity";
Expand Down Expand Up @@ -54,6 +55,10 @@ protected
"Air mass exchanged (for purpose of error control only)";
initial equation
mExc=0;
assert(homotopyInitialization, "In " + getInstanceName() +
": The constant homotopyInitialization has been modified from its default value. This constant will be removed in future releases.",
level = AssertionLevel.warning);

equation
if forceErrorControlOnFlow then
der(mExc) = port_a.m_flow;
Expand Down Expand Up @@ -128,6 +133,18 @@ The model is used as a base for the interzonal air flow models.
revisions="<html>
<ul>
<li>
May 12, 2020, by Michael Wetter:<br/>
Changed assignment of <code>m_flow_small</code> to <code>final</code>.
This quantity are not used in this model and models that extend from it.
Hence there is no need for the user to change the value.
</li>
<li>
April 14, 2020, by Michael Wetter:<br/>
Changed <code>homotopyInitialization</code> to a constant.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1341\">IBPSA, #1341</a>.
</li>
<li>
June 24, 2018, by Michael Wetter:<br/>
Removed parameter <code>A</code> because
<a href=\"modelica://IBPSA.Airflow.Multizone.EffectiveAirLeakageArea\">
Expand Down
11 changes: 10 additions & 1 deletion IBPSA/Airflow/Multizone/BaseClasses/TwoWayFlowElement.mo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ partial model TwoWayFlowElement "Flow resistance that uses the power law"
final allowFlowReversal1=true,
final allowFlowReversal2=true,
final m1_flow_nominal=10/3600*1.2,
final m2_flow_nominal=m1_flow_nominal);
final m2_flow_nominal=m1_flow_nominal,
final m1_flow_small=1E-4*abs(m1_flow_nominal),
final m2_flow_small=1E-4*abs(m2_flow_nominal));
extends IBPSA.Airflow.Multizone.BaseClasses.ErrorControl;

replaceable package Medium =
Expand Down Expand Up @@ -133,6 +135,13 @@ for doors that can be open or closed as a function of an input signal.
revisions="<html>
<ul>
<li>
May 12, 2020, by Michael Wetter:<br/>
Changed assignment of <code>m1_flow_small</code> and
<code>m2_flow_small</code> to <code>final</code>.
These quantities are not used in this model and models that extend from it.
Hence there is no need for the user to change the value.
</li>
<li>
January 18, 2019, by Jianjun Hu:<br/>
Limited the media choice to moist air only.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1050\">#1050</a>.
Expand Down
21 changes: 15 additions & 6 deletions IBPSA/Airflow/Multizone/BaseClasses/ZonalFlow.mo
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
within IBPSA.Airflow.Multizone.BaseClasses;
partial model ZonalFlow "Flow across zonal boundaries of a room"
extends IBPSA.Fluid.Interfaces.PartialFourPortInterface(
redeclare final package Medium1 = Medium,
redeclare final package Medium2 = Medium,
final allowFlowReversal1 = false,
final allowFlowReversal2 = false,
final m1_flow_nominal = 10/3600*1.2,
final m2_flow_nominal = m1_flow_nominal);
redeclare final package Medium1 = Medium,
redeclare final package Medium2 = Medium,
final allowFlowReversal1 = false,
final allowFlowReversal2 = false,
final m1_flow_nominal = 10/3600*1.2,
final m2_flow_nominal = m1_flow_nominal,
final m1_flow_small=1E-4*abs(m1_flow_nominal),
final m2_flow_small=1E-4*abs(m2_flow_nominal));

replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
annotation (choices(
Expand Down Expand Up @@ -70,6 +72,13 @@ Models that extend this model need to provide an equation for
revisions="<html>
<ul>
<li>
May 12, 2020, by Michael Wetter:<br/>
Changed assignment of <code>m1_flow_small</code> and
<code>m2_flow_small</code> to <code>final</code>.
These quantities are not used in this model and models that extend from it.
Hence there is no need for the user to change the value.
</li>
<li>
January 18, 2019, by Jianjun Hu:<br/>
Limited the media choice to moist air only.
See <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1050\">#1050</a>.
Expand Down
30 changes: 12 additions & 18 deletions IBPSA/BoundaryConditions/SolarGeometry/BaseClasses/SolarAzimuth.mo
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,16 @@ protected
equation
tmp = (Modelica.Math.sin(lat)*Modelica.Math.cos(zen) - Modelica.Math.sin(
decAng))/(Modelica.Math.cos(lat)*Modelica.Math.sin(zen));

arg = min(1.0, max(-1.0, tmp));

solAziTem = Modelica.Math.acos(arg); // Solar azimuth (A4.9a and b) as a positive number

if outsidePolarCircle then
// Outside the polar circle, the only non-differentiability is at night when the sun is set.
// Hence, we use noEvent.
if noEvent(solTim - integer(solTim/day)*day < 43200) then
solAzi =-solAziTem;
else
solAzi = solAziTem;
end if;
else
// Inside the polar circle, there is a jump at (solar-)midnight when the sun can
// be above the horizon. Hence, we do not use noEvent(...)
if solTim - integer(solTim/day)*day < 43200 then
solAzi =-solAziTem;
else
solAzi = solAziTem;
end if;
end if;
// If outside the polar circle, the only non-differentiability is at night when the sun is set.
// Hence, we use noEvent.
// If inside the polar circle, there is a jump at (solar-)midnight when the sun can
// be above the horizon. Hence, we do not use noEvent(...)
// Written as one line with functions so that lat does not become structural parameter with JModelica.org
solAzi = if outsidePolarCircle then solarAzimuthNoEvent(solAziTem, solTim, day) else solarAzimuthWithEvent(solAziTem, solTim, day);

annotation (
defaultComponentName="solAzi",
Expand All @@ -62,6 +50,12 @@ This component computes the solar azimuth angle.
</html>", revisions="<html>
<ul>
<li>
June 9, 2020, by David Blum:<br/>
Reformulated to use one-line if-statements.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1373\">issue 1373</a>.
</li>
<li>
October 13, 2017, by Michael Wetter:<br/>
Reformulated to use equation rather than algorithm section.<br/>
This is for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ SolarAzimuth
SolarHourAngle
WallSolarAzimuth
ZenithAngle
solarAzimuthNoEvent
solarAzimuthWithEvent
Examples
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
within IBPSA.BoundaryConditions.SolarGeometry.BaseClasses;
function solarAzimuthNoEvent "Determines solar azimuth with no event"
input Real solAziTem(quantity="Angle",unit="rad",displayUnit="deg") "Temporary solar azimuth";
input Real solTim(quantity="Time", unit="s") "Solar time";
input Real day(quantity="Time", unit="s") "Number of seconds in day";
output Real solAzi(quantity="Angle",unit="rad",displayUnit="deg") "Solar azimuth";
algorithm
if noEvent(solTim - integer(solTim/day)*day<43200) then
solAzi := -solAziTem;
else
solAzi := solAziTem;
end if;

annotation (
Documentation(info="<html>
<p>
This function is used within
<a href=\"modelica://IBPSA.BoundaryConditions.SolarGeometry.BaseClasses.SolarAzimuth\">
IBPSA.BoundaryConditions.SolarGeometry.BaseClasses.SolarAzimuth</a>
to calculate solar azimuth with no events.
</p>
</html>", revisions="<html>
<ul>
<li>
June 9, 2020 by David Blum:<br/>
Initial implementation.
This is for issue
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1373\">#1373</a>.
</li>
</ul>
</html>"));
end solarAzimuthNoEvent;
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
within IBPSA.BoundaryConditions.SolarGeometry.BaseClasses;
function solarAzimuthWithEvent "Determines solar azimuth with event"
input Real solAziTem(quantity="Angle",unit="rad",displayUnit="deg") "Temporary solar azimuth";
input Real solTim(quantity="Time", unit="s") "Solar time";
input Real day(quantity="Time", unit="s") "Number of seconds in day";
output Real solAzi(quantity="Angle",unit="rad",displayUnit="deg") "Solar azimuth";
algorithm
if (solTim - integer(solTim/day)*day<43200) then
solAzi := -solAziTem;
else
solAzi := solAziTem;
end if;
annotation (
Documentation(info="<html>
<p>
This function is used within
<a href=\"modelica://IBPSA.BoundaryConditions.SolarGeometry.BaseClasses.SolarAzimuth\">
IBPSA.BoundaryConditions.SolarGeometry.BaseClasses.SolarAzimuth</a>
to calculate solar azimuth with events.
</p>
</html>", revisions="<html>
<ul>
<li>
June 9, 2020 by David Blum:<br/>
Initial implementation.
This is for issue
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1373\">#1373</a>.
</li>
</ul>
</html>"));
end solarAzimuthWithEvent;
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@ within IBPSA.BoundaryConditions.WeatherData.BaseClasses;
block CheckBlackBodySkyTemperature
"Check the validity of the black-body sky temperature data"
extends Modelica.Blocks.Icons.Block;

parameter Modelica.SIunits.Temperature TMin(displayUnit="degC") = 203.15
"Minimum allowed temperature";
parameter Modelica.SIunits.Temperature TMax(displayUnit="degC") = 343.15
"Maximum allowed temperature";

Modelica.Blocks.Interfaces.RealInput TIn(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC") "Black-body sky temperature"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Modelica.Blocks.Interfaces.RealOutput TOut(

Modelica.Blocks.Interfaces.RealOutput TBlaSky(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC") "Black-body sky temperature"
annotation (Placement(transformation(extent={{100,-10},{120,10}})));

parameter Modelica.SIunits.Temperature TMin(displayUnit="degC") = 203.15
"Minimum allowed temperature";
parameter Modelica.SIunits.Temperature TMax(displayUnit="degC") = 343.15
"Maximum allowed temperature";

equation
TOut = TIn;
assert(TOut > TMin, "In " + getInstanceName() + ": Weather data black-body sky temperature out of bounds.\n" + " TOut = " + String(
TOut));
assert(TOut < TMax, "In " + getInstanceName() + ": Weather data black-body sky temperature out of bounds.\n" + " TOut = " + String(
TOut));
TBlaSky = TIn;
assert(noEvent(TIn > TMin and TIn < TMax),
"In " + getInstanceName() + ": Weather data black-body sky temperature out of bounds.\n" + " TIn = " +
String(TIn));

annotation (
defaultComponentName="cheSkyBlaBodTem",
Expand All @@ -36,6 +37,11 @@ the simulation will stop with an error.
</html>", revisions="<html>
<ul>
<li>
April 14, 2020, by Michael Wetter:<br/>
Added <code>noEvent</code> and removed output connector.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1340\">#1340</a>.
</li>
<li>
January 31, 2020 by Filip Jorissen:<br/>
Improved error message.
</li>
Expand All @@ -49,8 +55,27 @@ This was implemented to get the corrected documentation string in the weather bu
</ul>
</html>"),
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
100}}), graphics={Text(
extent={{56,12},{-68,-16}},
100}}), graphics={
Ellipse(
extent={{-20,-78},{20,-40}},
lineColor={99,17,20},
lineThickness=0.5,
fillColor={99,17,20},
fillPattern=FillPattern.Solid),
Line(points={{-40,40},{-12,40}}),
Line(points={{-40,10},{-12,10}}),
Line(points={{-40,-20},{-12,-20}}),
Rectangle(
extent={{-12,40},{12,-44}},
lineColor={99,17,20},
fillColor={99,17,20},
fillPattern=FillPattern.Solid),
Polygon(
points={{-12,40},{-12,60},{-10,66},{-6,68},{0,70},{6,68},{10,66},{12,
60},{12,40},{-12,40}},
lineColor={0,0,0},
textString="TSkyBlaBod")}));
lineThickness=0.5),
Line(
points={{-12,40},{-12,-45}},
thickness=0.5)}));
end CheckBlackBodySkyTemperature;
Loading

0 comments on commit a66fa5c

Please sign in to comment.