-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maint 8.1.x issue2792 down port (#2794)
* Copied files from master, 7255b26 * Downported models from master. For #2792 * Removed Steam again from 8.1 as Examples are not backward compatible * Removed BuriedPipes again from 8.1 as changes are not backward compatible * Corrected revision notes
- Loading branch information
Showing
135 changed files
with
5,367 additions
and
25 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
Buildings/BoundaryConditions/GroundTemperature/BaseClasses/package.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
within Buildings.BoundaryConditions.GroundTemperature; | ||
package BaseClasses "Package with base classes for Buildings.BoundaryConditions.GroundTemperature" | ||
extends Modelica.Icons.BasesPackage; | ||
|
||
annotation (Documentation(info="<html> | ||
<p> | ||
This package contains base classes that are used to construct the models in | ||
<a href=\"modelica://Buildings.BoundaryConditions.GroundTemperature\">Buildings.BoundaryConditions.GroundTemperature</a>. | ||
</p> | ||
</html>", revisions="<html> | ||
<ul> | ||
<li> | ||
May 19, 2021, by Baptiste Ravache:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>")); | ||
end BaseClasses; |
1 change: 1 addition & 0 deletions
1
Buildings/BoundaryConditions/GroundTemperature/BaseClasses/package.order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
surfaceTemperature |
107 changes: 107 additions & 0 deletions
107
Buildings/BoundaryConditions/GroundTemperature/BaseClasses/surfaceTemperature.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
within Buildings.BoundaryConditions.GroundTemperature.BaseClasses; | ||
function surfaceTemperature | ||
"Function to correct the climatic constants using <i>n</i>-factors" | ||
extends Modelica.Icons.Function; | ||
|
||
input ClimaticConstants.Generic cliCon | ||
"Surface temperature climatic conditions"; | ||
input Real nFacTha "Thawing n-factor (TAir > 0degC)"; | ||
input Real nFacFre "Freezing n-factor (TAir <= 0degC)"; | ||
output ClimaticConstants.Generic corCliCon | ||
"Corrected surface temperature climatic conditions"; | ||
|
||
protected | ||
constant Integer Year=365 "Year period in days"; | ||
constant Integer secInDay = 24 * 60 * 60 "Seconds in a day"; | ||
constant Modelica.SIunits.Angle pi = Modelica.Constants.pi; | ||
constant Modelica.SIunits.Temperature TFre = 273.15 "Freezing temperature of water"; | ||
constant Real freq = 2 * pi / Year "Year frequency in rad/days"; | ||
parameter Modelica.SIunits.Temperature TAirDayMea[Year] = {cliCon.TSurMea + cliCon.TSurAmp / freq * ( | ||
cos(freq * (cliCon.sinPha / secInDay - day)) - | ||
cos(freq * (cliCon.sinPha / secInDay - (day + 1)))) | ||
for day in 1:Year} "Daily mean air temperature (surface = 0 from uncorrected climatic constants)"; | ||
parameter Modelica.SIunits.Temperature TSurDayMea[Year] = { | ||
if TAirDayMea[day] > TFre | ||
then (TFre + (TAirDayMea[day] - TFre) * nFacTha) | ||
else (TFre + (TAirDayMea[day] - TFre) * nFacFre) | ||
for day in 1:Year} "Daily mean corrected surface temperature"; | ||
parameter Real C1 = sum({TSurDayMea[day] * cos(freq * day) for day in 1:Year}); | ||
parameter Real C2 = sum({TSurDayMea[day] * sin(freq * day) for day in 1:Year}); | ||
|
||
parameter Modelica.SIunits.Temperature corTSurMea = sum(TSurDayMea)/Year | ||
"Mean annual surface temperature"; | ||
parameter Modelica.SIunits.TemperatureDifference corTSurAmp = 2/Year .* (C1^2 + C2^2)^0.5 | ||
"Surface temperature amplitude"; | ||
parameter Modelica.SIunits.Duration corSinPha(displayUnit="d") = (Modelica.Math.atan(C2/C1) + pi/2)*secInDay/freq | ||
"Phase lag of soil surface temperature"; | ||
|
||
algorithm | ||
// Analytical mean by integrating undisturbed soil temperature formula | ||
corCliCon := ClimaticConstants.Generic( | ||
TSurMea = corTSurMea, | ||
TSurAmp = corTSurAmp, | ||
sinPha = corSinPha); | ||
|
||
annotation (Documentation(revisions="<html> | ||
<ul> | ||
<li> | ||
October 17, 2021, by Baptiste Ravache:<br/> | ||
Declare record parameters to avoid translation error in OpenModelica.<br/> | ||
This is for | ||
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/2698\">issue 2698</a>. | ||
</li> | ||
<li> | ||
May 19, 2021, by Baptiste Ravache:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>", info="<html> | ||
<p> | ||
This function corrects the surface temperature climatic constants | ||
by applying <i>n</i>-factors with the methodology prescribed in the | ||
<i>District Cooling Guide</i> (ASHRAE, 2013). | ||
</p> | ||
<p> | ||
<i>n</i>-factors corresponds to the ratio of freezing (/thawing) degree | ||
days or index between the air and the ground surface and can | ||
be used to couple the air and ground surface temperatures.<br> | ||
For example, a freezing <i>n</i>-factor of 1.35 means that during the | ||
freezing season, the daily average ground surface temperature is | ||
on average 1.35 times colder than the air (using the freezing | ||
temperature of water as a reference).<br> | ||
In its guide, ASHRAE suggests to first apply the <i>n</i>-factors to the | ||
uncorrected ground temperature at zero burial depth, and to fit a | ||
new sinusoidal curve to the result. | ||
<br> | ||
In this function, the freezing <i>n</i>-factor is applied to days where | ||
the daily mean air temperature is below the freezing temperature (0degC), | ||
whereas the thawing <i>n</i>-factor is applied to the remaining days. | ||
</p> | ||
<p align=\"center\" style=\"font-style:italic;\"> | ||
T<sub>ground</sub> - T<sub>freezing</sub> = η<sub>freezing</sub> * (T<sub>air</sub> - T<sub>freezing</sub>) if T<sub>air</sub> <= T<sub>freezing</sub><br> | ||
T<sub>ground</sub> - T<sub>freezing</sub> = η<sub>thawing</sub> * (T<sub>air</sub> - T<sub>freezing</sub>) if T<sub>air</sub> > T<sub>freezing</sub> | ||
</p> | ||
<p> | ||
The sinusoidal curve is then fitted using the analytical solution | ||
proposed in Appendix B of the District Heating Guide. | ||
</p> | ||
<p> | ||
<i>n</i>-factors are specific to a climate and surface cover, and should be | ||
extrapolated from other sites with caution. As a first approximation, | ||
tabulated values of <i>n</i>-factors are available in Lunardini (1981) and | ||
Freitag and McFadden (1997). | ||
</p> | ||
<h4>References</h4> | ||
<p> | ||
ASHRAE (2013). <i>District Cooling Guide</i>. ASHRAE, Atlanta, GA.<br> | ||
ASHRAE (2013). <i>District Heating Guide</i>. ASHRAE, Atlanta, GA.<br> | ||
D.W. Riseborough (2003). <i>Thawing and freezing indices in the active layer</i>. Proceedings of the 8th International Conference on Permafrost, Swets & Zeitlinger.<br> | ||
V.J. Lunardini (1981). <i>Heat Transfer in Cold Climates</i>. Van Nostrand Reinhold Company.<br> | ||
D.R. Freitag and T. McFadden (1997). <i>Introduction to Cold Regions Engineering</i>. American Society of Civil Engineers. | ||
</p> | ||
</html>")); | ||
end surfaceTemperature; |
48 changes: 48 additions & 0 deletions
48
Buildings/BoundaryConditions/GroundTemperature/ClimaticConstants.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
within Buildings.BoundaryConditions.GroundTemperature; | ||
package ClimaticConstants "Surface temperature climatic constants" | ||
extends Modelica.Icons.MaterialPropertiesPackage; | ||
|
||
record Generic "Generic climatic constants" | ||
extends Modelica.Icons.Record; | ||
parameter Modelica.SIunits.Temperature TSurMea | ||
"Mean annual surface temperature"; | ||
parameter Modelica.SIunits.TemperatureDifference TSurAmp | ||
"Surface temperature amplitude"; | ||
parameter Modelica.SIunits.Duration sinPha(displayUnit="d") | ||
"Phase lag of soil surface temperature"; | ||
end Generic; | ||
|
||
record Boston = | ||
Buildings.BoundaryConditions.GroundTemperature.ClimaticConstants.Generic( | ||
TSurMea=284.23, | ||
TSurAmp=11.57, | ||
sinPha=9944640) "Boston"; | ||
|
||
record NewYork = | ||
Buildings.BoundaryConditions.GroundTemperature.ClimaticConstants.Generic( | ||
TSurMea=286.03, | ||
TSurAmp=11.45, | ||
sinPha=9728640) "New York"; | ||
|
||
record SanFrancisco = | ||
Buildings.BoundaryConditions.GroundTemperature.ClimaticConstants.Generic( | ||
TSurMea=287.64, | ||
TSurAmp=3.35, | ||
sinPha=10419840) "San Francisco"; | ||
|
||
annotation (Documentation(info="<html> | ||
<p> | ||
Surface temperature data that is used in the calculation of undisturbed soil temperature. | ||
See <a href=\"https://tc0602.ashraetcs.org/Climatic_constants_using_ASHRAE_CD_Ver_6.0.pdf\"> | ||
Climatic Constants for Calculating Subsurface Soil Temperatures</a> for | ||
more information and a table of values. | ||
</p> | ||
</html>", revisions="<html> | ||
<ul> | ||
<li> | ||
March 17, 2021, by Baptiste Ravache:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>")); | ||
end ClimaticConstants; |
22 changes: 22 additions & 0 deletions
22
Buildings/BoundaryConditions/GroundTemperature/Examples/CorrectedConvection.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
within Buildings.BoundaryConditions.GroundTemperature.Examples; | ||
model CorrectedConvection | ||
"Example model for undisturbed soil temperature with surface convection correction" | ||
extends UndisturbedSoilTemperature(TSoi(each useCon=true, each hSur=5)); | ||
annotation (Documentation(revisions="<html> | ||
<ul> | ||
<li> | ||
May 21, 2021, by Baptiste Ravache:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>", info="<html> | ||
<p> | ||
This example model showcases the use of the convection coefficient | ||
correction, which allows to specify the heat transfer rate between | ||
the air and the surface temperature. | ||
</p> | ||
</html>"), | ||
experiment(StopTime=31536000, Tolerance=1e-6), | ||
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/BoundaryConditions/GroundTemperature/Examples/CorrectedConvection.mos" | ||
"Simulate and plot")); | ||
end CorrectedConvection; |
30 changes: 30 additions & 0 deletions
30
Buildings/BoundaryConditions/GroundTemperature/Examples/CorrectedNFactors.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
within Buildings.BoundaryConditions.GroundTemperature.Examples; | ||
model CorrectedNFactors | ||
"Example model for undisturbed soil temperature with n-factors correction" | ||
extends UndisturbedSoilTemperature( | ||
TSoi(each useNFac=true, each nFacTha=1.7, each nFacFre=0.66)); | ||
annotation (Documentation(revisions="<html> | ||
<ul> | ||
<li> | ||
May 21, 2021, by Baptiste Ravache:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>", info="<html> | ||
<p> | ||
This example model showcases the use of n-factors, which are used | ||
to correct the surface temperature given the ratio of freezing/thawing | ||
degree days (FDD/TDD) between the air and the ground. | ||
</p> | ||
<h4>References</h4> | ||
<p> | ||
The values used in this example are equivalent to the use-case | ||
presented in the \"Heat Transfer at Ground Surface\" section of the | ||
<i>District Cooling Guide</i> (ASHRAE, 2013). | ||
</p> | ||
</html>"), | ||
experiment(StopTime=31536000, Tolerance=1e-6), | ||
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/BoundaryConditions/GroundTemperature/Examples/CorrectedNFactors.mos" | ||
"Simulate and plot")); | ||
end CorrectedNFactors; |
37 changes: 37 additions & 0 deletions
37
Buildings/BoundaryConditions/GroundTemperature/Examples/UndisturbedSoilTemperature.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
within Buildings.BoundaryConditions.GroundTemperature.Examples; | ||
model UndisturbedSoilTemperature "Example model for undisturbed soil temperature" | ||
extends Modelica.Icons.Example; | ||
|
||
parameter Integer nSoi = 4 "Number of probed depths"; | ||
parameter Modelica.SIunits.Length dep[nSoi] = {0,2,5,9} "Probed depths"; | ||
|
||
Buildings.BoundaryConditions.GroundTemperature.UndisturbedSoilTemperature | ||
TSoi[nSoi](dep=dep, each cliCon=cliCon, each soiDat=soiDat) | ||
"Undisturbed soil temperatures" | ||
annotation (Placement(transformation(extent={{-20,-20},{20,20}}))); | ||
|
||
protected | ||
replaceable parameter ClimaticConstants.Boston cliCon | ||
"Surface temperature climatic conditions"; | ||
replaceable parameter Buildings.HeatTransfer.Data.Soil.Generic soiDat( | ||
k=1.58,c=1150,d=1600) "Soil thermal properties"; | ||
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( | ||
coordinateSystem(preserveAspectRatio=false)), | ||
experiment(StopTime=31536000, Tolerance=1e-6), | ||
Documentation(info="<html> | ||
<p> | ||
This example model illustrates how the undisturbed soil temperature model | ||
decreases seasonal temperature oscillations and increases delay as depth is | ||
increasing. | ||
</p> | ||
</html>", revisions="<html> | ||
<ul> | ||
<li> | ||
March 17, 2021, by Baptiste Ravache:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>"), | ||
__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/BoundaryConditions/GroundTemperature/Examples/UndisturbedSoilTemperature.mos" | ||
"Simulate and plot")); | ||
end UndisturbedSoilTemperature; |
19 changes: 19 additions & 0 deletions
19
Buildings/BoundaryConditions/GroundTemperature/Examples/package.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
within Buildings.BoundaryConditions.GroundTemperature; | ||
package Examples "Collection of models that illustrate model use and test models" | ||
extends Modelica.Icons.ExamplesPackage; | ||
|
||
annotation (Documentation(info="<html> | ||
<p> | ||
This package contains examples for the use of models that can be found in | ||
<a href=\"modelica://Buildings.BoundaryConditions.GroundTemperature\"> | ||
Buildings.BoundaryConditions.GroundTemperature</a>. | ||
</p> | ||
</html>", revisions="<html> | ||
<ul> | ||
<li> | ||
March 17, 2021, by Baptiste Ravache:<br/> | ||
First implementation. | ||
</li> | ||
</ul> | ||
</html>")); | ||
end Examples; |
3 changes: 3 additions & 0 deletions
3
Buildings/BoundaryConditions/GroundTemperature/Examples/package.order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CorrectedConvection | ||
CorrectedNFactors | ||
UndisturbedSoilTemperature |
Oops, something went wrong.