Skip to content

Commit

Permalink
Merge pull request #1821 from ibpsa/master
Browse files Browse the repository at this point in the history
Merging master into issue1707
  • Loading branch information
amaccarini authored Jan 4, 2024
2 parents 7eb5c80 + 3fad3f6 commit 348ba57
Show file tree
Hide file tree
Showing 1,157 changed files with 63,885 additions and 43,692 deletions.
16 changes: 8 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ services:

env:
global:
- BUILDINGSPY_VERSION=BuildingsPy@50ac74d8e4fd067179bb38bc23140c2c9254c94c

- OMC_VERSION=ubuntu-2004-omc:1.20.0_dev-314-g3033f43-1
- DYMOLA_VERSION=travis_ubuntu-2004_dymola:2023x-x86_64
- DOCKER_REPONAME=lbnlblum
- [email protected]
- OMC_VERSION=ubuntu-2204-omc:1.22.0_dev-41-g8a5b18f-1
- DYMOLA_VERSION=travis_ubuntu-2004_dymola:2023x-x86_64_rev-1

jobs:
# Test matrix for regression tests.
# The documentation is tested using github actions.
- TEST_ARG="make test-bestest"
- TEST_ARG="make test-dymola PACKAGE=\"IBPSA.Experimental\""
- TEST_ARG="make test-openmodelica PACKAGE=\"IBPSA.Experimental\""
- TEST_ARG="make test-dymola PACKAGE=\"IBPSA.{Examples,Experimental}\""
- TEST_ARG="make test-openmodelica PACKAGE=\"IBPSA.{Examples,Experimental}\""
- TEST_ARG="make test-dymola PACKAGE=\"IBPSA.Fluid.{Actuators,BaseClasses,Chillers,Delays,Geothermal,Examples,FMI,FixedResistances}\""
- TEST_ARG="make test-openmodelica PACKAGE=\"IBPSA.Fluid.{Actuators,BaseClasses,Chillers,Delays,Geothermal,Examples,FMI,FixedResistances}\""
- TEST_ARG="make test-dymola PACKAGE=\"IBPSA.Fluid.{HeatExchangers,HeatPumps,Humidifiers,Interfaces,MassExchangers,MixingVolumes,Movers,Sensors,Sources,Storage}\""
Expand All @@ -45,11 +45,11 @@ env:
before_install:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- if [[ "$TEST_ARG" == *test-dymola* || "$TEST_ARG" == *test-bestest* ]]; then
docker pull "$DOCKER_USERNAME"/${DYMOLA_VERSION};
docker pull "$DOCKER_REPONAME"/${DYMOLA_VERSION};
cp IBPSA/Resources/Scripts/travis/dymola/dymola $HOME/bin/;
fi;
- if [[ "$TEST_ARG" == *test-openmodelica* ]]; then
docker pull "$DOCKER_USERNAME"/${OMC_VERSION};
docker pull "$DOCKER_REPONAME"/${OMC_VERSION};
cp IBPSA/Resources/Scripts/travis/omc/omc $HOME/bin/omc;
fi;

Expand Down
2 changes: 1 addition & 1 deletion IBPSA/Airflow/Multizone/MediumColumn.mo
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ equation
lineColor={0,0,0}),
Text(
extent={{-50.5,20.5},{50.5,-20.5}},
lineColor={0,0,127},
textColor={0,0,127},
origin={-72.5,-12.5},
rotation=90,
textString="%name"),
Expand Down
2 changes: 1 addition & 1 deletion IBPSA/Airflow/Multizone/MediumColumnDynamic.mo
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ equation
lineColor={0,0,0}),
Text(
extent={{-50.5,20.5},{50.5,-20.5}},
lineColor={0,0,127},
textColor={0,0,127},
origin={-72.5,-12.5},
rotation=90,
textString="%name"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within IBPSA.BoundaryConditions.SolarGeometry.BaseClasses;
block Declination "Declination angle"
extends Modelica.Blocks.Icons.Block;
extends IBPSA.BoundaryConditions.WeatherData.BaseClasses.PartialConvertTime;
Modelica.Blocks.Interfaces.RealInput nDay(quantity="Time", unit="s")
"Day number with units of seconds"
annotation (Placement(transformation(extent={{-140,-20},{-100,20}})));
Expand All @@ -13,7 +13,8 @@ protected
constant Real k1 = sin(23.45*2*Modelica.Constants.pi/360) "Constant";
constant Real k2 = 2*Modelica.Constants.pi/365.25 "Constant";
equation
decAng = Modelica.Math.asin(-k1 * Modelica.Math.cos((nDay/86400 + 10)*k2))
modTimAux = nDay;
decAng = Modelica.Math.asin(-k1 * Modelica.Math.cos((calTimAux/86400 + 10)*k2))
"(A4.5)";
annotation (
defaultComponentName="decAng",
Expand All @@ -36,6 +37,11 @@ IBPSA.BoundaryConditions.SolarGeometry.BaseClasses.Examples.Declination</a>.
</html>", revisions="<html>
<ul>
<li>
March 27, 2023, by Ettore Zanetti:<br/>
Updated to use partial class for conversion from simulation time to calendar time.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1716\">IBPSA #1716</a>.
</li>
<li>
January 6, 2015, by Michael Wetter:<br/>
Updated documentation and added validation.
This is for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ This component computes the sky clearness.
</p>
<h4>Implementation</h4>
<p>
In the <code>IBPSA</code> library, <code>HGloHor</code>
In the <code>IBPSA</code> library, <code>HDirNor</code>
is always larger than <i>1E-4</i>,
minus some small undershoot due to regularization. Hence,
the implementation is not simplified for
<code>HGloHor &lt; Modelica.Constants.small</code>.
<code>HDirNor &lt; Modelica.Constants.small</code>.
</p>
<p>
The function call
Expand All @@ -68,7 +68,7 @@ is such that the regularization is usually not triggered.
<li>
September 6, 2021, by Ettore Zanetti:<br/>
Changed <code>lat</code> from being a parameter to an input from weather bus.<br/>
Changed input connector <code>HGloHor</code> to <code>HDirHor</code>.<br/>
Changed input connector <code>HGloHor</code> to <code>HDirNor</code>.<br/>
This is for
<a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1477\">IBPSA, #1477</a>.
</li>
Expand Down Expand Up @@ -113,7 +113,7 @@ First implementation.
Text(
extent={{-48,54},{-100,66}},
textColor={0,0,127},
textString="HGloHor"),
textString="HDirNor"),
Text(
extent={{-48,-66},{-100,-54}},
textColor={0,0,127},
Expand Down
2 changes: 1 addition & 1 deletion IBPSA/BoundaryConditions/UsersGuide.mo
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Note that a ceiling has a tilt of <i>0</i>
<!-- @include_Buildings
, and also the solar collector models
in
<a href=\"IBPSA.Fluid.SolarCollectors\">IBPSA.Fluid.SolarCollectors</a>
<a href=\"modelica://IBPSA.Fluid.SolarCollectors\">IBPSA.Fluid.SolarCollectors</a>
require a tilt of <i>0</i>
-->
if they are facing straight upwards.
Expand Down
29 changes: 8 additions & 21 deletions IBPSA/BoundaryConditions/WeatherData/BaseClasses/ConvertTime.mo
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
within IBPSA.BoundaryConditions.WeatherData.BaseClasses;
block ConvertTime
"Converts the simulation time to calendar time in scale of 1 year (365 days), or a multiple of a year"
extends Modelica.Blocks.Icons.Block;

parameter Modelica.Units.SI.Time weaDatStaTim(displayUnit="d")
"Start time of weather data";
parameter Modelica.Units.SI.Time weaDatEndTim(displayUnit="d")
"End time of weather data";

extends PartialConvertTime;
Modelica.Blocks.Interfaces.RealInput modTim(
final quantity="Time",
final unit="s") "Simulation time"
Expand All @@ -20,23 +14,11 @@ block ConvertTime
protected
constant Modelica.Units.SI.Time shiftSolarRad=1800
"Number of seconds for the shift for solar radiation calculation";
parameter Modelica.Units.SI.Time lenWea=weaDatEndTim - weaDatStaTim
"Length of weather data";

parameter Boolean canRepeatWeatherFile = abs(mod(lenWea, 365*24*3600)) < 1E-2
"=true, if the weather file can be repeated, since it has the length of a year or a multiple of it";

discrete Modelica.Units.SI.Time tNext(start=0, fixed=true)
"Start time of next period";

equation
when {initial(), canRepeatWeatherFile and modTim > pre(tNext)} then
// simulation time stamp went over the end time of the weather file
//(last time stamp of the weather file + average increment)
tNext = if canRepeatWeatherFile then integer(modTim/lenWea)*lenWea + lenWea else time;
end when;
calTim = if canRepeatWeatherFile then modTim - tNext + lenWea else modTim;

calTim = calTimAux;
modTimAux = modTim;
assert(canRepeatWeatherFile or noEvent((time - weaDatEndTim) < shiftSolarRad),
"In " + getInstanceName() + ": Insufficient weather data provided for the desired simulation period.
The simulation time " + String(time) +
Expand All @@ -59,6 +41,11 @@ or a multiple of it, if this is the length of the weather file.
</html>", revisions="<html>
<ul>
<li>
March 27, 2023, by Ettore Zanetti:<br/>
Updated to use partial class for conversion from simulation time to calendar time.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1716\">IBPSA #1716</a>.
</li>
<li>
April 15, 2020, by Michael Wetter:<br/>
Added <code>noEvent</code> to assertion to remove zero crossing function in OPTIMICA.
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within IBPSA.BoundaryConditions.WeatherData.BaseClasses;
block EquationOfTime "Equation of time"
extends Modelica.Blocks.Icons.Block;
extends PartialConvertTime;
Modelica.Blocks.Interfaces.RealInput nDay(
quantity="Time",
unit="s")
Expand All @@ -14,19 +14,25 @@ block EquationOfTime "Equation of time"
protected
Real Bt "Intermediate variable";
equation
Bt = Modelica.Constants.pi*((nDay + 86400)/86400 - 81)/182
modTimAux = nDay;
Bt = Modelica.Constants.pi*((calTimAux + 86400)/86400 - 81)/182
"Our unit is s instead of day in (A.4.2b)";
eqnTim = 60*(9.87*Modelica.Math.sin(2*Bt) - 7.53*Modelica.Math.cos(Bt) - 1.5*
Modelica.Math.sin(Bt)) "Our unit is s instead of min in (A.4.2a)";
annotation (
defaultComponentName="eqnTim",
Documentation(info="<html>
<p>
This component computes the difference between solar noon and noon of local civic time.
This component computes the difference between solar noon and noon of local civil time.
</p>
</html>", revisions="<html>
<ul>
<li>
March 27, 2023, by Ettore Zanetti:<br/>
Updated to use partial class for conversion from simulation time to calendar time.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1716\">IBPSA #1716</a>.
</li>
<li>
May 13, 2010, by Wangda Zuo:<br/>
First implementation.
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within IBPSA.BoundaryConditions.WeatherData.BaseClasses;
block LocalCivilTime "Converts the clock time to local civil time."
extends Modelica.Blocks.Icons.Block;
extends PartialConvertTime;
Modelica.Blocks.Interfaces.RealInput cloTim(
final quantity="Time",
final unit="s") "Clock time"
Expand All @@ -15,7 +15,8 @@ protected
final parameter Modelica.Units.SI.Time diff=-timZon + lon*43200/Modelica.Constants.pi
"Difference between local and clock time";
equation
locTim = cloTim + diff;
modTimAux = cloTim;
locTim = calTimAux + diff;

annotation (
defaultComponentName="locTim",
Expand All @@ -34,6 +35,11 @@ The formula is based on Michael Wetter's thesis (A4.1):
</html>", revisions="<html>
<ul>
<li>
March 27, 2023, by Ettore Zanetti:<br/>
Updated to use partial class for conversion from simulation time to calendar time.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1716\">IBPSA #1716</a>.
</li>
<li>
November 14, 2015, by Michael Wetter:<br/>
Introduced <code>diff</code>.
</li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
within IBPSA.BoundaryConditions.WeatherData.BaseClasses;
partial block PartialConvertTime
"Converts the simulation time to calendar time in scale of 1 year (365 days), or a multiple of a year"
extends Modelica.Blocks.Icons.Block;
parameter Modelica.Units.SI.Time weaDatStaTim(displayUnit="d") = 0
"Start time of weather data";
parameter Modelica.Units.SI.Time weaDatEndTim(displayUnit="d") = 31536000
"End time of weather data";
Modelica.Units.SI.Time modTimAux "Model time";
Modelica.Units.SI.Time calTimAux "Calendar time";

protected
parameter Modelica.Units.SI.Time lenWea=weaDatEndTim - weaDatStaTim
"Length of weather data";

parameter Boolean canRepeatWeatherFile = abs(mod(lenWea, 365*24*3600)) < 1E-2
"=true, if the weather file can be repeated, since it has the length of a year or a multiple of it";

discrete Modelica.Units.SI.Time tNext(start=0, fixed=true)
"Start time of next period";

equation
when {initial(), canRepeatWeatherFile and modTimAux > pre(tNext)} then
// simulation time stamp went over the end time of the weather file
//(last time stamp of the weather file + average increment)
tNext = if canRepeatWeatherFile then integer(modTimAux/lenWea)*lenWea + lenWea else time;
end when;
calTimAux = if canRepeatWeatherFile then modTimAux - tNext + lenWea else modTimAux;


annotation (
defaultComponentName="conTim",
Documentation(info="<html>
<p>
This component converts the simulation time to calendar time in a scale of 1 year (365 days),
or a multiple of it, if this is the length of the weather file.
</p>
</html>", revisions="<html>
<ul>
<li>
March 27, 2023, by Ettore Zanetti:<br/>
Added partial class for conversion from simulation time to calendar time, to be
used by solar models that require calendar time for calculations.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1716\">IBPSA #1716</a>.
</li>
</ul>
</html>"),
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
100}})));
end PartialConvertTime;
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ LimiterTotalSkyCover
LimiterWindDirection
LimiterWindSpeed
LocalCivilTime
PartialConvertTime
PartialLimiter
PartialLimiterMin
SolarTime
Expand Down
39 changes: 39 additions & 0 deletions IBPSA/BoundaryConditions/WeatherData/Bus.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,40 @@ within IBPSA.BoundaryConditions.WeatherData;
expandable connector Bus "Data bus that stores weather data"
extends Modelica.Icons.SignalBus;

Modelica.Units.SI.Temperature TDryBul "Dry bulb temperature";
Modelica.Units.SI.Temperature TWetBul "Wet bulb temperature";
Modelica.Units.SI.Temperature TDewPoi "Dew point temperature";
Modelica.Units.SI.Temperature TBlaSky "Black-body sky temperature";

Real relHum(final unit="1") "Relative humidity";

Real HDirNor(final unit="W/m2") "Direct normal solar irradiation";
Real HGloHor(final unit="W/m2") "Global horizontal solar irradiation";
Real HDifHor(final unit="W/m2") "Diffuse horizontal solar irradiation";

Real HHorIR(final unit="W/m2") "Horizontal infrared irradiation";

Modelica.Units.SI.Angle winDir "Wind direction";
Modelica.Units.SI.Velocity winSpe "Wind speed";

Modelica.Units.SI.Height ceiHei "Cloud cover ceiling height";
Real nOpa(final unit="1") "Opaque sky cover";
Real nTot(final unit="1") "Total sky cover";

Modelica.Units.SI.Angle lat "Latitude of the location";
Modelica.Units.SI.Angle lon "Longitude of the location";
Modelica.Units.SI.Height alt "Location altitude above sea level";

Modelica.Units.SI.AbsolutePressure pAtm "Atmospheric pressure";

Modelica.Units.SI.Angle solAlt "Solar altitude angle";
Modelica.Units.SI.Angle solDec "Solar declination angle";
Modelica.Units.SI.Angle solHouAng "Solar hour angle";
Modelica.Units.SI.Angle solZen "Solar zenith angle";

Modelica.Units.SI.Time solTim "Solar time";
Modelica.Units.SI.Time cloTim "Model time";

annotation (
defaultComponentName="weaBus",
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
Expand All @@ -16,6 +50,11 @@ This component is an expandable connector that is used to implement a bus that c
</html>", revisions="<html>
<ul>
<li>
September 22, 2023, by Michael Wetter:<br/>
Declared the variables that are on the bus.<br/>
This is for <a href=\"https://github.com/ibpsa/modelica-ibpsa/issues/1798\">IBPSA, #1798</a>.
</li>
<li>
June 25, 2010, by Wangda Zuo:<br/>
First implementation.
</li>
Expand Down
33 changes: 33 additions & 0 deletions IBPSA/Electrical/AC/Interfaces/PowerOutput.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
within IBPSA.Electrical.AC.Interfaces;
connector PowerOutput
"Connector with real power, reactive power and power factor"
output Modelica.Units.SI.Power real "Real power";
output Modelica.Units.SI.ReactivePower apparent "Apparent power";
output Modelica.Units.SI.Angle phi "Phase shift";
output Real cosPhi "Power factor";

annotation (Icon(graphics={ Polygon(
points={{-100,100},{100,0},{-100,-100},{-100,100}},
lineColor={0,0,127},
fillColor={255,255,255},
fillPattern=FillPattern.Solid)}), Diagram(graphics={
Polygon(
points={{-100,50},{0,0},{-100,-50},{-100,50}},
lineColor={0,0,127},
fillColor={255,255,255},
fillPattern=FillPattern.Solid), Text(
extent={{30,110},{30,60}},
textColor={0,0,127},
textString="%name")}),
Documentation(info="<html>
This connector contains multiple quantities that can be used to monitor
the power consumption of a generic AC systems.
</html>", revisions="<html>
<ul>
<li>
March 19, 2015, by Marco Bonvini:<br/>
Added documentation.
</li>
</ul>
</html>"));
end PowerOutput;
Loading

0 comments on commit 348ba57

Please sign in to comment.