generated from BHoM/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#12) moved methods from climate toolkit
- Loading branch information
1 parent
9e866fe
commit 276ba3d
Showing
6 changed files
with
198 additions
and
27 deletions.
There are no files selected for viewing
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,55 @@ | ||
/* | ||
* This file is part of the Buildings and Habitats object Model (BHoM) | ||
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved. | ||
* | ||
* Each contributor holds copyright over their respective contributions. | ||
* The project versioning (Git) records all such contribution source information. | ||
* | ||
* | ||
* The BHoM is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3.0 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The BHoM is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. | ||
*/ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.ComponentModel; | ||
using BH.oM.Base.Attributes; | ||
using BH.oM.Base; | ||
using BH.Engine.Base; | ||
|
||
namespace BH.Engine.Psychrometrics | ||
{ | ||
public static partial class Compute | ||
{ | ||
[Description("Calculates water density from temperature.")] | ||
[Input("temperature", "temperature (C).")] | ||
[Output("density", "Density (kg/m3).")] | ||
[PreviousVersion("6.3", "BH.Engine.Climate.Compute.DensityWater(System.Double)")] | ||
public static double DensityWater(double temperature) | ||
{ | ||
double t = temperature; | ||
if (t < 0 || t > 150) | ||
{ | ||
BH.Engine.Base.Compute.RecordError("Temperature must be greater than 0 and less than 150 degC."); | ||
return double.NaN; | ||
} | ||
else | ||
{ | ||
return 999.792764532729 + 0.07544354069978 * t - 8.88812233461067e-03 * Math.Pow(t, 2) + 7.43496157156187e-05 * Math.Pow(t, 3) - 5.05819372165206e-07 * Math.Pow(t, 4) + 1.71286251848812e-09 * Math.Pow(t, 5) - 3.41712769191815e-13 * Math.Pow(t, 6) - 8.9940922954777e-15 * Math.Pow(t, 7); | ||
} | ||
} | ||
} | ||
} |
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
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
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
61 changes: 61 additions & 0 deletions
61
Psychrometrics_Engine/Compute/SaturatedVapourPressureWater.cs
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,61 @@ | ||
/* | ||
* This file is part of the Buildings and Habitats object Model (BHoM) | ||
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved. | ||
* | ||
* Each contributor holds copyright over their respective contributions. | ||
* The project versioning (Git) records all such contribution source information. | ||
* | ||
* | ||
* The BHoM is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3.0 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The BHoM is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. | ||
*/ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.ComponentModel; | ||
using BH.oM.Base.Attributes; | ||
using BH.oM.Base; | ||
using BH.Engine.Base; | ||
|
||
namespace BH.Engine.Psychrometrics | ||
{ | ||
public static partial class Compute | ||
{ | ||
[Description("Calculates water SaturatedVapourPressure from temperature.")] | ||
[Input("temperature", "temperature (degC).")] | ||
[Output("saturatedVapourPressure", "Saturated Vapour Pressure (Pa).")] | ||
[PreviousVersion("6.3", "BH.Engine.Climate.Compute.SaturatedVapourPressureWater(Systetm.Double)")] | ||
public static double SaturatedVapourPressureWater(double temperature) | ||
{ | ||
BH.Engine.Base.Compute.RecordWarning("This method has not been thoroughly tested. The output may be incorrect. Use at own risk."); | ||
|
||
double t = temperature; | ||
if (t < 0 || t > 150) | ||
{ | ||
BH.Engine.Base.Compute.RecordError("Temperature must be greater than 0 and less than 150 degC."); | ||
return double.NaN; | ||
} | ||
else if (temperature < 21) | ||
{ | ||
return 6.10830198582769e-03 + 3.69554702125838e-04 * t + 2.4671509929139e-05 * Math.Pow(t, 2); | ||
} | ||
else | ||
{ | ||
return 2.76521518826485e-02 - 1.9984832033515e-03 * t + 1.26386221381836e-04 * Math.Pow(t, 2) - 2.43248314291122E-06 * Math.Pow(t, 3) + 3.97667179186101E-08 * Math.Pow(t, 4) - 2.63438493242063e-10 * Math.Pow(t, 5) + 1.23191485224688e-12 * Math.Pow(t, 6) - 2.20158156672378E-15 * Math.Pow(t, 7); | ||
} | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
Psychrometrics_Engine/Compute/SpecificHeatCapacityWater.cs
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,55 @@ | ||
/* | ||
* This file is part of the Buildings and Habitats object Model (BHoM) | ||
* Copyright (c) 2015 - 2023, the respective contributors. All rights reserved. | ||
* | ||
* Each contributor holds copyright over their respective contributions. | ||
* The project versioning (Git) records all such contribution source information. | ||
* | ||
* | ||
* The BHoM is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3.0 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The BHoM is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. | ||
*/ | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.ComponentModel; | ||
using BH.oM.Base.Attributes; | ||
using BH.oM.Base; | ||
using BH.Engine.Base; | ||
|
||
namespace BH.Engine.Psychrometrics | ||
{ | ||
public static partial class Compute | ||
{ | ||
[Description("Calculates Water SpecificHeatCapacity from temperature.")] | ||
[Input("temperature", "temperature (C).")] | ||
[Output("specificHeatCapacity", "Specific Heat Capacity (kJ/kgK).")] | ||
[PreviousVersion("6.3", "BH.Engine.Climate.Compute.SpecificHeatCapacityWater(System.Double)")] | ||
public static double SpecificHeatCapacityWater(double temperature) | ||
{ | ||
double t = temperature; | ||
if (t < 0 || t > 150) | ||
{ | ||
BH.Engine.Base.Compute.RecordError("Temperature must be greater than 0 and less than 150 degC."); | ||
return double.NaN; | ||
} | ||
else | ||
{ | ||
return 4.21704317315562 - 3.38336617551249e-03 * t + 1.15883761850455e-04 * Math.Pow(t, 2) - 2.08959843561729e-06 * Math.Pow(t, 3) + 2.27639253003176e-08 * Math.Pow(t, 4) - 1.42019051900533e-10 * Math.Pow(t, 5) + 4.7949488211343e-13 * Math.Pow(t, 6) - 6.7653778811732e-16 * Math.Pow(t, 7); | ||
} | ||
} | ||
} | ||
} |