|
| 1 | +/* |
| 2 | + * This file is part of the Buildings and Habitats object Model (BHoM) |
| 3 | + * Copyright (c) 2015 - 2024, the respective contributors. All rights reserved. |
| 4 | + * |
| 5 | + * Each contributor holds copyright over their respective contributions. |
| 6 | + * The project versioning (Git) records all such contribution source information. |
| 7 | + * |
| 8 | + * |
| 9 | + * The BHoM is free software: you can redistribute it and/or modify |
| 10 | + * it under the terms of the GNU Lesser General Public License as published by |
| 11 | + * the Free Software Foundation, either version 3.0 of the License, or |
| 12 | + * (at your option) any later version. |
| 13 | + * |
| 14 | + * The BHoM is distributed in the hope that it will be useful, |
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | + * GNU Lesser General Public License for more details. |
| 18 | + * |
| 19 | + * You should have received a copy of the GNU Lesser General Public License |
| 20 | + * along with this code. If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>. |
| 21 | + */ |
| 22 | + |
| 23 | +using System; |
| 24 | +using System.Collections.Generic; |
| 25 | +using System.Linq; |
| 26 | +using System.Text; |
| 27 | +using System.Threading.Tasks; |
| 28 | + |
| 29 | +using UN = UnitsNet; //This is to avoid clashes between UnitsNet quantity attributes and BHoM quantity attributes |
| 30 | +using UnitsNet.Units; |
| 31 | + |
| 32 | +using System.ComponentModel; |
| 33 | +using BH.oM.Base.Attributes; |
| 34 | +using BH.oM.Quantities.Attributes; |
| 35 | + |
| 36 | +namespace BH.Engine.Units |
| 37 | +{ |
| 38 | + public static partial class Convert |
| 39 | + { |
| 40 | + [Description("Convert metric RSI (m2K/W) into R-value (ft2-h-F/Btu)")] |
| 41 | + [Input("metricRSI", "Metric RSI (m2K/W) to convert", typeof(ThermalResistanceUnit))] |
| 42 | + [Output("rValue", "Imperial R-value in ft2-h-F/Btu")] |
| 43 | + public static double ToRValue(this double metricRSI) |
| 44 | + { |
| 45 | + UN.QuantityValue qv = metricRSI; |
| 46 | + return UN.UnitConverter.Convert(qv, ThermalResistanceUnit.SquareMeterKelvinPerWatt, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu); |
| 47 | + } |
| 48 | + |
| 49 | + [Description("Convert R-value (ft2-h-F/Btu) into metric RSI (m2K/W)")] |
| 50 | + [Input("rValue", "Imperial R-value (ft2-h-F/Btu) to convert")] |
| 51 | + [Output("metricRSI", "Metric RSI in m2K/W", typeof(ThermalResistanceUnit))] |
| 52 | + public static double FromRvalue(this double rValue) |
| 53 | + { |
| 54 | + UN.QuantityValue qv = rValue; |
| 55 | + return UN.UnitConverter.Convert(qv, ThermalResistanceUnit.HourSquareFeetDegreeFahrenheitPerBtu, ThermalResistanceUnit.SquareMeterKelvinPerWatt); |
| 56 | + } |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
0 commit comments