Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermal Resistance Conversion Methods #113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions Units_Engine/Convert/ThermalResistance/RValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2024, 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 UN = UnitsNet; //This is to avoid clashes between UnitsNet quantity attributes and BHoM quantity attributes
using UnitsNet.Units;

using System.ComponentModel;
using BH.oM.Base.Attributes;
using BH.oM.Quantities.Attributes;

namespace BH.Engine.Units
{
public static partial class Convert
{
[Description("Convert metric RSI (m2K/W) into R-value (ft2-h-F/Btu)")]

Check warning on line 40 in Units_Engine/Convert/ThermalResistance/RValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/RValue.cs#L40

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("metricRSI", "Metric RSI (m2K/W) to convert", typeof(ThermalResistanceUnit))]

Check warning on line 41 in Units_Engine/Convert/ThermalResistance/RValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/RValue.cs#L41

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Output("rValue", "Imperial R-value in ft2-h-F/Btu")]

Check warning on line 42 in Units_Engine/Convert/ThermalResistance/RValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/RValue.cs#L42

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
public static double ToRValue(this double metricRSI)
{
UN.QuantityValue qv = metricRSI;
return UN.UnitConverter.Convert(qv, ThermalResistanceUnit.SquareMeterKelvinPerWatt, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu);
}

[Description("Convert R-value (ft2-h-F/Btu) into metric RSI (m2K/W)")]

Check warning on line 49 in Units_Engine/Convert/ThermalResistance/RValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/RValue.cs#L49

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("rValue", "Imperial R-value (ft2-h-F/Btu) to convert")]

Check warning on line 50 in Units_Engine/Convert/ThermalResistance/RValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/RValue.cs#L50

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Output("metricRSI", "Metric RSI in m2K/W", typeof(ThermalResistanceUnit))]

Check warning on line 51 in Units_Engine/Convert/ThermalResistance/RValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/RValue.cs#L51

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
public static double FromRvalue(this double rValue)
{
UN.QuantityValue qv = rValue;
return UN.UnitConverter.Convert(qv, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, ThermalResistanceUnit.SquareMeterKelvinPerWatt);
}
}
}




62 changes: 62 additions & 0 deletions Units_Engine/Convert/ThermalResistance/UValue.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* This file is part of the Buildings and Habitats object Model (BHoM)
* Copyright (c) 2015 - 2024, 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 UN = UnitsNet; //This is to avoid clashes between UnitsNet quantity attributes and BHoM quantity attributes
using UnitsNet.Units;

using System.ComponentModel;
using BH.oM.Base.Attributes;
using BH.oM.Quantities.Attributes;

namespace BH.Engine.Units
{
public static partial class Convert
{
[Description("Convert metric U-value (W/m2K) into imperial U-value (Btu/ft2-h-F)")]

Check warning on line 40 in Units_Engine/Convert/ThermalResistance/UValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/UValue.cs#L40

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("metricUValue", "Metric U-value (W/m2K) to convert")]

Check warning on line 41 in Units_Engine/Convert/ThermalResistance/UValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/UValue.cs#L41

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Output("uValue", "Imperial U-value in Btu/ft2-h-F")]

Check warning on line 42 in Units_Engine/Convert/ThermalResistance/UValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/UValue.cs#L42

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
public static double ToUValue(this double metricUValue)
{
double rSI = 1/metricUValue;
return 1/ToRValue(rSI);
}

[Description("Convert U-value (Btu/ft2-h-F) into metric U-value (W/m2K)")]

Check warning on line 49 in Units_Engine/Convert/ThermalResistance/UValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/UValue.cs#L49

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("uValue", "Imperial U-value (Btu/ft2-h-F) to convert")]

Check warning on line 50 in Units_Engine/Convert/ThermalResistance/UValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/UValue.cs#L50

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Output("metricUValue", "Metric U-value in W/m2K", typeof(ThermalResistanceUnit))]

Check warning on line 51 in Units_Engine/Convert/ThermalResistance/UValue.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Units_Engine/Convert/ThermalResistance/UValue.cs#L51

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
public static double FromUvalue(this double uValue)
{
double rValue = 1/uValue;
return 1/FromRvalue(rValue);
}
}
}