diff --git a/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/package.mo b/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/package.mo new file mode 100644 index 00000000000..17c961397e9 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/package.mo @@ -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=" +

+This package contains base classes that are used to construct the models in +Buildings.BoundaryConditions.GroundTemperature. +

+", revisions=" + +")); +end BaseClasses; diff --git a/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/package.order b/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/package.order new file mode 100644 index 00000000000..24bfde8718b --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/package.order @@ -0,0 +1 @@ +surfaceTemperature diff --git a/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/surfaceTemperature.mo b/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/surfaceTemperature.mo new file mode 100644 index 00000000000..e63ead84292 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/BaseClasses/surfaceTemperature.mo @@ -0,0 +1,100 @@ +within Buildings.BoundaryConditions.GroundTemperature.BaseClasses; +function surfaceTemperature + "Function to correct the climatic constants using n-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"; + Real freq = 2 * pi / Year "Year frequency in rad/days"; + Modelica.SIunits.Temperature TAirDayMea[Year] "Daily mean air temperature (surface = 0 from uncorrected climatic constants)"; + Modelica.SIunits.Temperature TSurDayMea[Year] "Daily mean corrected surface temperature"; + Real C1; + Real C2; + +algorithm + // Analytical mean by integrating undisturbed soil temperature formula + TAirDayMea := {cliCon.TSurMea + cliCon.TSurAmp / freq * ( + cos(freq * (cliCon.sinPha / secInDay - day)) - + cos(freq * (cliCon.sinPha / secInDay - (day + 1)))) + for day in 1:Year}; + + TSurDayMea := { + if TAirDayMea[day] > TFre + then (TFre + (TAirDayMea[day] - TFre) * nFacTha) + else (TFre + (TAirDayMea[day] - TFre) * nFacFre) + for day in 1:Year}; + C1 := sum({TSurDayMea[day] * cos(freq * day) for day in 1:Year}); + C2 := sum({TSurDayMea[day] * sin(freq * day) for day in 1:Year}); + + corCliCon := ClimaticConstants.Generic( + TSurMea = sum(TSurDayMea)/Year, + TSurAmp = 2 / Year .* (C1^2 + C2^2)^0.5, + sinPha = (Modelica.Math.atan(C2 / C1) + pi/2) * secInDay / freq); + + annotation (Documentation(revisions=" + +", info=" +

+This function corrects the surface temperature climatic constants +by applying n-factors with the methodology prescribed in the +District Cooling Guide (ASHRAE, 2013). +

+

+n-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.
+For example, a freezing n-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).
+In its guide, ASHRAE suggests to first apply the n-factors to the +uncorrected ground temperature at zero burial depth, and to fit a +new sinusoidal curve to the result. +
+In this function, the freezing n-factor is applied to days where +the daily mean air temperature is below the freezing temperature (0degC), +whereas the thawing n-factor is applied to the remaining days. +

+

+ Tground - Tfreezing = ηfreezing * (Tair - Tfreezing)   if Tair <= Tfreezing
+ Tground - Tfreezing = ηthawing * (Tair - Tfreezing)   if Tair > Tfreezing +

+

+The sinusoidal curve is then fitted using the analytical solution +proposed in Appendix B of the District Heating Guide. +

+

+n-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 n-factors are available in Lunardini (1981) and +Freitag and McFadden (1997). +

+ + +

References

+

+ASHRAE (2013). District Cooling Guide. ASHRAE, Atlanta, GA.
+ASHRAE (2013). District Heating Guide. ASHRAE, Atlanta, GA.
+D.W. Riseborough (2003). Thawing and freezing indices in the active layer. Proceedings of the 8th International Conference on Permafrost, Swets & Zeitlinger.
+V.J. Lunardini (1981). Heat Transfer in Cold Climates. Van Nostrand Reinhold Company.
+D.R. Freitag and T. McFadden (1997). Introduction to Cold Regions Engineering. American Society of Civil Engineers. + +

+ +")); +end surfaceTemperature; diff --git a/Buildings/BoundaryConditions/GroundTemperature/ClimaticConstants.mo b/Buildings/BoundaryConditions/GroundTemperature/ClimaticConstants.mo new file mode 100644 index 00000000000..9a228053a29 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/ClimaticConstants.mo @@ -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=" +

+Surface temperature data that is used in the calculation of undisturbed soil temperature. +See +Climatic Constants for Calculating Subsurface Soil Temperatures for +more information and a table of values. +

+", revisions=" + +")); +end ClimaticConstants; diff --git a/Buildings/BoundaryConditions/GroundTemperature/Examples/CorrectedConvection.mo b/Buildings/BoundaryConditions/GroundTemperature/Examples/CorrectedConvection.mo new file mode 100644 index 00000000000..669adb97337 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/Examples/CorrectedConvection.mo @@ -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=" + +", info=" +

+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. +

+"), +experiment(StopTime=31536000, Tolerance=1e-6), +__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/BoundaryConditions/GroundTemperature/Examples/CorrectedConvection.mos" + "Simulate and plot")); +end CorrectedConvection; diff --git a/Buildings/BoundaryConditions/GroundTemperature/Examples/CorrectedNFactors.mo b/Buildings/BoundaryConditions/GroundTemperature/Examples/CorrectedNFactors.mo new file mode 100644 index 00000000000..d7373c55550 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/Examples/CorrectedNFactors.mo @@ -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=" + +", info=" +

+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. +

+ +

References

+

+The values used in this example are equivalent to the use-case +presented in the \"Heat Transfer at Ground Surface\" section of the +District Cooling Guide (ASHRAE, 2013). +

+"), +experiment(StopTime=31536000, Tolerance=1e-6), +__Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/BoundaryConditions/GroundTemperature/Examples/CorrectedNFactors.mos" + "Simulate and plot")); +end CorrectedNFactors; diff --git a/Buildings/BoundaryConditions/GroundTemperature/Examples/UndisturbedSoilTemperature.mo b/Buildings/BoundaryConditions/GroundTemperature/Examples/UndisturbedSoilTemperature.mo new file mode 100644 index 00000000000..f25de2f5af9 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/Examples/UndisturbedSoilTemperature.mo @@ -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=" +

+This example model illustrates how the undisturbed soil temperature model +decreases seasonal temperature oscillations and increases delay as depth is +increasing. +

+", revisions=" + +"), + __Dymola_Commands(file="modelica://Buildings/Resources/Scripts/Dymola/BoundaryConditions/GroundTemperature/Examples/UndisturbedSoilTemperature.mos" + "Simulate and plot")); +end UndisturbedSoilTemperature; diff --git a/Buildings/BoundaryConditions/GroundTemperature/Examples/package.mo b/Buildings/BoundaryConditions/GroundTemperature/Examples/package.mo new file mode 100644 index 00000000000..aeb31ebea6b --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/Examples/package.mo @@ -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=" +

+This package contains examples for the use of models that can be found in + +Buildings.BoundaryConditions.GroundTemperature. +

+", revisions=" + +")); +end Examples; diff --git a/Buildings/BoundaryConditions/GroundTemperature/Examples/package.order b/Buildings/BoundaryConditions/GroundTemperature/Examples/package.order new file mode 100644 index 00000000000..db3436c84b4 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/Examples/package.order @@ -0,0 +1,3 @@ +CorrectedConvection +CorrectedNFactors +UndisturbedSoilTemperature diff --git a/Buildings/BoundaryConditions/GroundTemperature/UndisturbedSoilTemperature.mo b/Buildings/BoundaryConditions/GroundTemperature/UndisturbedSoilTemperature.mo new file mode 100644 index 00000000000..16b2a4a1bf6 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/UndisturbedSoilTemperature.mo @@ -0,0 +1,154 @@ +within Buildings.BoundaryConditions.GroundTemperature; +model UndisturbedSoilTemperature "Undisturbed soil temperature" + parameter Modelica.SIunits.Length dep "Depth"; + + parameter Boolean useNFac = false + "= true, use n-factors to correct climatic constants"; + parameter Real nFacTha = 1 "Thawing n-factor (TAir > 0degC)" + annotation(Dialog(enable=useNFac)); + parameter Real nFacFre = 1 "Freezing n-factor (TAir <= 0degC)" + annotation(Dialog(enable=useNFac)); + + parameter Boolean useCon = false + "= true, includes convection between air and surface coupling"; + parameter Real hSur(unit="W/(m2.K)", min=0) = 25 + "Surface convective heat transfer coefficient" + annotation(Dialog(enable=useCon)); + + replaceable parameter Buildings.HeatTransfer.Data.Soil.Generic + soiDat "Soil thermal properties"; + replaceable parameter ClimaticConstants.Generic + cliCon "Surface temperature climatic conditions"; + + Modelica.SIunits.Temperature T + "Undisturbed soil temperature at depth dep"; + +protected + constant Modelica.SIunits.Angle pi = Modelica.Constants.pi; + constant Modelica.SIunits.Duration Year = 365.2422*24*60*60 + "Annual period length"; + + parameter Modelica.SIunits.Length corDep = if useCon + then dep + soiDat.k / hSur + else dep + "Convection-corrected depth"; + parameter ClimaticConstants.Generic corCliCon= if useNFac + then BaseClasses.surfaceTemperature(cliCon=cliCon, nFacTha=nFacTha, nFacFre=nFacFre) + else cliCon + "n-factor corrected climatic constants"; + + parameter Modelica.SIunits.ThermalDiffusivity + soiDif = soiDat.k / soiDat.c / soiDat.d "Soil diffusivity"; + parameter Modelica.SIunits.Duration + timLag = corCliCon.sinPha + "Start time of surface temperature sinusoid"; + parameter Real pha = - corDep * (pi/soiDif/Year)^0.5 + "Phase angle of ground temperature sinusoid"; + +initial equation + assert(not (useCon and useNFac), + "N-Factors and surface convection corrections + would typically not be used simultaneously", + level = AssertionLevel.warning); + +equation + T = corCliCon.TSurMea + corCliCon.TSurAmp * exp(pha) * + sin(2*pi*(time-timLag)/Year + pha); + annotation (Placement(transformation(extent={{-6,-104},{6,-92}}), + iconTransformation(extent={{-6,-104},{6,-92}})), + Icon(coordinateSystem(preserveAspectRatio=false), graphics={ + Text( + lineColor={0,0,255}, + extent={{-150,110},{150,150}}, + textString="%name"), + Rectangle( + extent={{-100,20},{100,-100}}, + lineColor={0,0,0}, + fillColor={211,168,137}, + fillPattern=FillPattern.Backward), + Rectangle( + extent={{-100,20},{100,26}}, + lineColor={0,0,0}, + fillColor={0,255,128}, + fillPattern=FillPattern.Solid), + Rectangle( + extent={{-100,26},{100,100}}, + lineColor={0,0,0}, + fillColor={85,170,255}, + fillPattern=FillPattern.Solid), + Line( + points={{0,38},{0,-60}}, + color={191,0,0}, + thickness=1), + Polygon( + points={{16,-60},{-16,-60},{0,-92},{16,-60}}, + lineColor={191,0,0}, + fillColor={191,0,0}, + fillPattern=FillPattern.Solid), + Text( + extent={{-38,-38},{-100,-100}}, + lineColor={0,0,0}, + textString="K")}), Diagram( + coordinateSystem(preserveAspectRatio=false)), + Documentation(info=" +

+This model provides a prescribed temperature boundary condition for buried objects, +where the temperature is computed per the ASCE (1996) equation: +

+

+\"image\" +

+

+where:
+Ts,z = ground temperature at depth z,
+τ = annual period length (constant 365.25 days),
+α = soil thermal diffusivity (assumed constant throughout the year),
+t = time,
+Tms = mean annual surface temperature,
+As = temperature amplitude throughout the year (max - min),
+tlag = phase lag of the surface temperature sinusoid +

+ +

Corrections

+ +

+Without correction, this model assumes that the surface temperature (depth = 0) is +equal to the air temperature, which is acceptable for most design calculations.
+For more accurate calculation, this model provides methods to compensate for +the convective thermal resistance and the impact of surface cover. +

+

+The convective thermal resistance can be modeled as a virtual equivalent soil layer +by setting the flag useCon to true and specifying the +heat transfer coefficient hSur.
+This correction would result in a larger delay and dampening of the +resulting sinusoid. +

+

+The impact of surface cover on soil temperature can be modeled using +n-factors by setting the flag useNFac to true and +specifying the thawing and freezing n-factors at the surface.
+ +More information about n-factors correction can be found in the documentation +for +Buildings.BoundaryConditions.GroundTemperature.BaseClasses.surfaceTemperature. +

+

+Since n-factors incorporate the effect of surface convection, +both corrections would typically not be applied simultaneously.
+

+ +

References

+

+ASCE (1996). Cold Regions Utilities Monograph. D.W. Smith, Technical Editor. +

+ +", revisions=" + +")); +end UndisturbedSoilTemperature; diff --git a/Buildings/BoundaryConditions/GroundTemperature/package.mo b/Buildings/BoundaryConditions/GroundTemperature/package.mo new file mode 100644 index 00000000000..003ee9a9581 --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/package.mo @@ -0,0 +1,17 @@ +within Buildings.BoundaryConditions; +package GroundTemperature "Package with models to compute ground temperature" + extends Modelica.Icons.VariantsPackage; + + annotation (Documentation(info=" +

+This package contains models to compute the ground temperature. +

+", revisions=" + +")); +end GroundTemperature; diff --git a/Buildings/BoundaryConditions/GroundTemperature/package.order b/Buildings/BoundaryConditions/GroundTemperature/package.order new file mode 100644 index 00000000000..bb516d8747e --- /dev/null +++ b/Buildings/BoundaryConditions/GroundTemperature/package.order @@ -0,0 +1,4 @@ +ClimaticConstants +UndisturbedSoilTemperature +Examples +BaseClasses diff --git a/Buildings/BoundaryConditions/package.order b/Buildings/BoundaryConditions/package.order index 1f2453d93b9..43d148f1d4b 100644 --- a/Buildings/BoundaryConditions/package.order +++ b/Buildings/BoundaryConditions/package.order @@ -1,4 +1,5 @@ UsersGuide +GroundTemperature SkyTemperature SolarGeometry SolarIrradiation diff --git a/Buildings/Examples/VAVReheat/Validation/BaseClasses/Floor.mo b/Buildings/Examples/VAVReheat/Validation/BaseClasses/Floor.mo index 35389593d56..df620094bf5 100644 --- a/Buildings/Examples/VAVReheat/Validation/BaseClasses/Floor.mo +++ b/Buildings/Examples/VAVReheat/Validation/BaseClasses/Floor.mo @@ -1,4 +1,4 @@ -within Buildings.Examples.VAVReheat.Validation.BaseClasses; +within Buildings.Examples.VAVReheat.Validation.BaseClasses; model Floor "Extends Buildings.Examples.VAVReheat.BaseClasses.Floor with CO2 generation from people and CO2 from outside air." extends Buildings.Examples.VAVReheat.BaseClasses.Floor( diff --git a/Buildings/Fluid/FixedResistances/BaseClasses/PlugFlowCore.mo b/Buildings/Fluid/FixedResistances/BaseClasses/PlugFlowCore.mo index 324c27f5962..79f9a01332a 100644 --- a/Buildings/Fluid/FixedResistances/BaseClasses/PlugFlowCore.mo +++ b/Buildings/Fluid/FixedResistances/BaseClasses/PlugFlowCore.mo @@ -9,6 +9,24 @@ model PlugFlowCore parameter Modelica.SIunits.Length dh "Hydraulic diameter (assuming a round cross section area)"; + replaceable Buildings.Fluid.FixedResistances.HydraulicDiameter res( + final dh=dh, + final from_dp=from_dp, + final length=length, + final roughness=roughness, + final fac=fac, + final ReC=ReC, + final v_nominal=v_nominal, + final homotopyInitialization=homotopyInitialization, + final linearized=linearized, + dp(nominal=fac*200*length)) constrainedby + Buildings.Fluid.Interfaces.PartialTwoPortInterface( + redeclare final package Medium = Medium, + final m_flow_nominal=m_flow_nominal, + final allowFlowReversal=allowFlowReversal, + final show_T=false) + "Pressure drop calculation for this pipe" + annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); parameter Modelica.SIunits.Velocity v_nominal "Velocity at m_flow_nominal (used to compute default value for hydraulic diameter dh)" annotation(Dialog(group="Nominal condition")); @@ -60,24 +78,6 @@ model PlugFlowCore "= true, use linear relation between m_flow and dp for any flow rate" annotation(Evaluate=true, Dialog(tab="Advanced")); - Buildings.Fluid.FixedResistances.HydraulicDiameter res( - redeclare final package Medium = Medium, - final dh=dh, - final m_flow_nominal=m_flow_nominal, - final from_dp=from_dp, - final length=length, - final roughness=roughness, - final fac=fac, - final ReC=ReC, - final v_nominal=v_nominal, - final allowFlowReversal=allowFlowReversal, - final show_T=false, - final homotopyInitialization=homotopyInitialization, - final linearized=linearized, - dp(nominal=fac*200*length)) - "Pressure drop calculation for this pipe" - annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); - Buildings.Fluid.FixedResistances.BaseClasses.PlugFlow del( redeclare final package Medium = Medium, final m_flow_small=m_flow_small, @@ -207,6 +207,13 @@ equation Documentation(revisions="