Skip to content

Commit bed62ca

Browse files
tmilnthorpangularsen
authored andcommitted
Adding lbf/(ft·s) and lb/s³ units for heat flux (#536)
1 parent 3e3e7d6 commit bed62ca

File tree

8 files changed

+141
-1
lines changed

8 files changed

+141
-1
lines changed

Common/GeneratedCode/Quantities/HeatFlux.Common.g.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,16 @@ public static BaseDimensions BaseDimensions
226226
/// </summary>
227227
public double NanowattsPerSquareMeter => As(HeatFluxUnit.NanowattPerSquareMeter);
228228

229+
/// <summary>
230+
/// Get HeatFlux in PoundsForcePerFootSecond.
231+
/// </summary>
232+
public double PoundsForcePerFootSecond => As(HeatFluxUnit.PoundForcePerFootSecond);
233+
234+
/// <summary>
235+
/// Get HeatFlux in PoundsPerSecondCubed.
236+
/// </summary>
237+
public double PoundsPerSecondCubed => As(HeatFluxUnit.PoundPerSecondCubed);
238+
229239
/// <summary>
230240
/// Get HeatFlux in WattsPerSquareFoot.
231241
/// </summary>
@@ -432,6 +442,34 @@ public static HeatFlux FromNanowattsPerSquareMeter(QuantityValue nanowattspersqu
432442
return new HeatFlux(value, HeatFluxUnit.NanowattPerSquareMeter);
433443
}
434444

445+
/// <summary>
446+
/// Get HeatFlux from PoundsForcePerFootSecond.
447+
/// </summary>
448+
#if WINDOWS_UWP
449+
[Windows.Foundation.Metadata.DefaultOverload]
450+
public static HeatFlux FromPoundsForcePerFootSecond(double poundsforceperfootsecond)
451+
#else
452+
public static HeatFlux FromPoundsForcePerFootSecond(QuantityValue poundsforceperfootsecond)
453+
#endif
454+
{
455+
double value = (double) poundsforceperfootsecond;
456+
return new HeatFlux(value, HeatFluxUnit.PoundForcePerFootSecond);
457+
}
458+
459+
/// <summary>
460+
/// Get HeatFlux from PoundsPerSecondCubed.
461+
/// </summary>
462+
#if WINDOWS_UWP
463+
[Windows.Foundation.Metadata.DefaultOverload]
464+
public static HeatFlux FromPoundsPerSecondCubed(double poundspersecondcubed)
465+
#else
466+
public static HeatFlux FromPoundsPerSecondCubed(QuantityValue poundspersecondcubed)
467+
#endif
468+
{
469+
double value = (double) poundspersecondcubed;
470+
return new HeatFlux(value, HeatFluxUnit.PoundPerSecondCubed);
471+
}
472+
435473
/// <summary>
436474
/// Get HeatFlux from WattsPerSquareFoot.
437475
/// </summary>
@@ -659,6 +697,8 @@ private double AsBaseUnit()
659697
case HeatFluxUnit.MicrowattPerSquareMeter: return (_value) * 1e-6d;
660698
case HeatFluxUnit.MilliwattPerSquareMeter: return (_value) * 1e-3d;
661699
case HeatFluxUnit.NanowattPerSquareMeter: return (_value) * 1e-9d;
700+
case HeatFluxUnit.PoundForcePerFootSecond: return _value*1.459390293720636e1;
701+
case HeatFluxUnit.PoundPerSecondCubed: return _value*4.5359237e-1;
662702
case HeatFluxUnit.WattPerSquareFoot: return _value*1.07639e1;
663703
case HeatFluxUnit.WattPerSquareInch: return _value*1.5500031e3;
664704
case HeatFluxUnit.WattPerSquareMeter: return _value;
@@ -689,6 +729,8 @@ private double AsBaseNumericType(HeatFluxUnit unit)
689729
case HeatFluxUnit.MicrowattPerSquareMeter: return (baseUnitValue) / 1e-6d;
690730
case HeatFluxUnit.MilliwattPerSquareMeter: return (baseUnitValue) / 1e-3d;
691731
case HeatFluxUnit.NanowattPerSquareMeter: return (baseUnitValue) / 1e-9d;
732+
case HeatFluxUnit.PoundForcePerFootSecond: return baseUnitValue/1.459390293720636e1;
733+
case HeatFluxUnit.PoundPerSecondCubed: return baseUnitValue/4.5359237e-1;
692734
case HeatFluxUnit.WattPerSquareFoot: return baseUnitValue/1.07639e1;
693735
case HeatFluxUnit.WattPerSquareInch: return baseUnitValue/1.5500031e3;
694736
case HeatFluxUnit.WattPerSquareMeter: return baseUnitValue;

Common/UnitDefinitions/HeatFlux.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,30 @@
116116
"Abbreviations": [ "kcal/h·m²" ]
117117
}
118118
]
119+
},
120+
{
121+
"SingularName": "PoundForcePerFootSecond",
122+
"PluralName": "PoundsForcePerFootSecond",
123+
"FromUnitToBaseFunc": "x*1.459390293720636e1",
124+
"FromBaseToUnitFunc": "x/1.459390293720636e1",
125+
"Localization": [
126+
{
127+
"Culture": "en-US",
128+
"Abbreviations": [ "lbf/(ft·s)" ]
129+
}
130+
]
131+
},
132+
{
133+
"SingularName": "PoundPerSecondCubed",
134+
"PluralName": "PoundsPerSecondCubed",
135+
"FromUnitToBaseFunc": "x*4.5359237e-1",
136+
"FromBaseToUnitFunc": "x/4.5359237e-1",
137+
"Localization": [
138+
{
139+
"Culture": "en-US",
140+
"Abbreviations": [ "lb/s³", "lbm/s³" ]
141+
}
142+
]
119143
}
120144
]
121145
}

UnitsNet.Tests/CustomCode/HeatFluxTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ public class HeatFluxTests : HeatFluxTestsBase
6363
protected override double WattsPerSquareFootInOneWattPerSquareMeter => 9.290304e-2;
6464
protected override double WattsPerSquareInchInOneWattPerSquareMeter => 6.4516e-4;
6565
protected override double WattsPerSquareMeterInOneWattPerSquareMeter => 1;
66+
protected override double PoundsForcePerFootSecondInOneWattPerSquareMeter => 6.852176585679176e-2;
67+
protected override double PoundsPerSecondCubedInOneWattPerSquareMeter => 2.204622621848776;
6668

67-
[Fact]
69+
[ Fact]
6870
public void PowerDividedByAreaEqualsHeatFlux()
6971
{
7072
HeatFlux heatFlux = Power.FromWatts(12) / Area.FromSquareMeters(3);

UnitsNet.Tests/GeneratedCode/HeatFluxTestsBase.g.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ public abstract partial class HeatFluxTestsBase
6666
protected abstract double MicrowattsPerSquareMeterInOneWattPerSquareMeter { get; }
6767
protected abstract double MilliwattsPerSquareMeterInOneWattPerSquareMeter { get; }
6868
protected abstract double NanowattsPerSquareMeterInOneWattPerSquareMeter { get; }
69+
protected abstract double PoundsForcePerFootSecondInOneWattPerSquareMeter { get; }
70+
protected abstract double PoundsPerSecondCubedInOneWattPerSquareMeter { get; }
6971
protected abstract double WattsPerSquareFootInOneWattPerSquareMeter { get; }
7072
protected abstract double WattsPerSquareInchInOneWattPerSquareMeter { get; }
7173
protected abstract double WattsPerSquareMeterInOneWattPerSquareMeter { get; }
@@ -84,6 +86,8 @@ public abstract partial class HeatFluxTestsBase
8486
protected virtual double MicrowattsPerSquareMeterTolerance { get { return 1e-5; } }
8587
protected virtual double MilliwattsPerSquareMeterTolerance { get { return 1e-5; } }
8688
protected virtual double NanowattsPerSquareMeterTolerance { get { return 1e-5; } }
89+
protected virtual double PoundsForcePerFootSecondTolerance { get { return 1e-5; } }
90+
protected virtual double PoundsPerSecondCubedTolerance { get { return 1e-5; } }
8791
protected virtual double WattsPerSquareFootTolerance { get { return 1e-5; } }
8892
protected virtual double WattsPerSquareInchTolerance { get { return 1e-5; } }
8993
protected virtual double WattsPerSquareMeterTolerance { get { return 1e-5; } }
@@ -106,6 +110,8 @@ public void WattPerSquareMeterToHeatFluxUnits()
106110
AssertEx.EqualTolerance(MicrowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.MicrowattsPerSquareMeter, MicrowattsPerSquareMeterTolerance);
107111
AssertEx.EqualTolerance(MilliwattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.MilliwattsPerSquareMeter, MilliwattsPerSquareMeterTolerance);
108112
AssertEx.EqualTolerance(NanowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.NanowattsPerSquareMeter, NanowattsPerSquareMeterTolerance);
113+
AssertEx.EqualTolerance(PoundsForcePerFootSecondInOneWattPerSquareMeter, wattpersquaremeter.PoundsForcePerFootSecond, PoundsForcePerFootSecondTolerance);
114+
AssertEx.EqualTolerance(PoundsPerSecondCubedInOneWattPerSquareMeter, wattpersquaremeter.PoundsPerSecondCubed, PoundsPerSecondCubedTolerance);
109115
AssertEx.EqualTolerance(WattsPerSquareFootInOneWattPerSquareMeter, wattpersquaremeter.WattsPerSquareFoot, WattsPerSquareFootTolerance);
110116
AssertEx.EqualTolerance(WattsPerSquareInchInOneWattPerSquareMeter, wattpersquaremeter.WattsPerSquareInch, WattsPerSquareInchTolerance);
111117
AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.WattsPerSquareMeter, WattsPerSquareMeterTolerance);
@@ -127,6 +133,8 @@ public void FromValueAndUnit()
127133
AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.MicrowattPerSquareMeter).MicrowattsPerSquareMeter, MicrowattsPerSquareMeterTolerance);
128134
AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.MilliwattPerSquareMeter).MilliwattsPerSquareMeter, MilliwattsPerSquareMeterTolerance);
129135
AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.NanowattPerSquareMeter).NanowattsPerSquareMeter, NanowattsPerSquareMeterTolerance);
136+
AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.PoundForcePerFootSecond).PoundsForcePerFootSecond, PoundsForcePerFootSecondTolerance);
137+
AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.PoundPerSecondCubed).PoundsPerSecondCubed, PoundsPerSecondCubedTolerance);
130138
AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareFoot).WattsPerSquareFoot, WattsPerSquareFootTolerance);
131139
AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareInch).WattsPerSquareInch, WattsPerSquareInchTolerance);
132140
AssertEx.EqualTolerance(1, HeatFlux.From(1, HeatFluxUnit.WattPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance);
@@ -149,6 +157,8 @@ public void As()
149157
AssertEx.EqualTolerance(MicrowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.MicrowattPerSquareMeter), MicrowattsPerSquareMeterTolerance);
150158
AssertEx.EqualTolerance(MilliwattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.MilliwattPerSquareMeter), MilliwattsPerSquareMeterTolerance);
151159
AssertEx.EqualTolerance(NanowattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.NanowattPerSquareMeter), NanowattsPerSquareMeterTolerance);
160+
AssertEx.EqualTolerance(PoundsForcePerFootSecondInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.PoundForcePerFootSecond), PoundsForcePerFootSecondTolerance);
161+
AssertEx.EqualTolerance(PoundsPerSecondCubedInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.PoundPerSecondCubed), PoundsPerSecondCubedTolerance);
152162
AssertEx.EqualTolerance(WattsPerSquareFootInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.WattPerSquareFoot), WattsPerSquareFootTolerance);
153163
AssertEx.EqualTolerance(WattsPerSquareInchInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.WattPerSquareInch), WattsPerSquareInchTolerance);
154164
AssertEx.EqualTolerance(WattsPerSquareMeterInOneWattPerSquareMeter, wattpersquaremeter.As(HeatFluxUnit.WattPerSquareMeter), WattsPerSquareMeterTolerance);
@@ -211,6 +221,14 @@ public void ToUnit()
211221
AssertEx.EqualTolerance(NanowattsPerSquareMeterInOneWattPerSquareMeter, (double)nanowattpersquaremeterQuantity.Value, NanowattsPerSquareMeterTolerance);
212222
Assert.Equal(HeatFluxUnit.NanowattPerSquareMeter, nanowattpersquaremeterQuantity.Unit);
213223

224+
var poundforceperfootsecondQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.PoundForcePerFootSecond);
225+
AssertEx.EqualTolerance(PoundsForcePerFootSecondInOneWattPerSquareMeter, (double)poundforceperfootsecondQuantity.Value, PoundsForcePerFootSecondTolerance);
226+
Assert.Equal(HeatFluxUnit.PoundForcePerFootSecond, poundforceperfootsecondQuantity.Unit);
227+
228+
var poundpersecondcubedQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.PoundPerSecondCubed);
229+
AssertEx.EqualTolerance(PoundsPerSecondCubedInOneWattPerSquareMeter, (double)poundpersecondcubedQuantity.Value, PoundsPerSecondCubedTolerance);
230+
Assert.Equal(HeatFluxUnit.PoundPerSecondCubed, poundpersecondcubedQuantity.Unit);
231+
214232
var wattpersquarefootQuantity = wattpersquaremeter.ToUnit(HeatFluxUnit.WattPerSquareFoot);
215233
AssertEx.EqualTolerance(WattsPerSquareFootInOneWattPerSquareMeter, (double)wattpersquarefootQuantity.Value, WattsPerSquareFootTolerance);
216234
Assert.Equal(HeatFluxUnit.WattPerSquareFoot, wattpersquarefootQuantity.Unit);
@@ -241,6 +259,8 @@ public void ConversionRoundTrip()
241259
AssertEx.EqualTolerance(1, HeatFlux.FromMicrowattsPerSquareMeter(wattpersquaremeter.MicrowattsPerSquareMeter).WattsPerSquareMeter, MicrowattsPerSquareMeterTolerance);
242260
AssertEx.EqualTolerance(1, HeatFlux.FromMilliwattsPerSquareMeter(wattpersquaremeter.MilliwattsPerSquareMeter).WattsPerSquareMeter, MilliwattsPerSquareMeterTolerance);
243261
AssertEx.EqualTolerance(1, HeatFlux.FromNanowattsPerSquareMeter(wattpersquaremeter.NanowattsPerSquareMeter).WattsPerSquareMeter, NanowattsPerSquareMeterTolerance);
262+
AssertEx.EqualTolerance(1, HeatFlux.FromPoundsForcePerFootSecond(wattpersquaremeter.PoundsForcePerFootSecond).WattsPerSquareMeter, PoundsForcePerFootSecondTolerance);
263+
AssertEx.EqualTolerance(1, HeatFlux.FromPoundsPerSecondCubed(wattpersquaremeter.PoundsPerSecondCubed).WattsPerSquareMeter, PoundsPerSecondCubedTolerance);
244264
AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareFoot(wattpersquaremeter.WattsPerSquareFoot).WattsPerSquareMeter, WattsPerSquareFootTolerance);
245265
AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareInch(wattpersquaremeter.WattsPerSquareInch).WattsPerSquareMeter, WattsPerSquareInchTolerance);
246266
AssertEx.EqualTolerance(1, HeatFlux.FromWattsPerSquareMeter(wattpersquaremeter.WattsPerSquareMeter).WattsPerSquareMeter, WattsPerSquareMeterTolerance);

UnitsNet/GeneratedCode/Extensions/Number/NumberToHeatFluxExtensions.g.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,28 @@ public static class NumberToHeatFluxExtensions
187187

188188
#endregion
189189

190+
#region PoundForcePerFootSecond
191+
192+
/// <inheritdoc cref="HeatFlux.FromPoundsForcePerFootSecond(UnitsNet.QuantityValue)" />
193+
public static HeatFlux PoundsForcePerFootSecond<T>(this T value) => HeatFlux.FromPoundsForcePerFootSecond(Convert.ToDouble(value));
194+
195+
/// <inheritdoc cref="HeatFlux.FromPoundsForcePerFootSecond(UnitsNet.QuantityValue)" />
196+
[Obsolete("Nullable type support has been deprecated and will be removed in a future release.")]
197+
public static HeatFlux? PoundsForcePerFootSecond<T>(this T? value) where T : struct => HeatFlux.FromPoundsForcePerFootSecond(value == null ? (double?)null : Convert.ToDouble(value.Value));
198+
199+
#endregion
200+
201+
#region PoundPerSecondCubed
202+
203+
/// <inheritdoc cref="HeatFlux.FromPoundsPerSecondCubed(UnitsNet.QuantityValue)" />
204+
public static HeatFlux PoundsPerSecondCubed<T>(this T value) => HeatFlux.FromPoundsPerSecondCubed(Convert.ToDouble(value));
205+
206+
/// <inheritdoc cref="HeatFlux.FromPoundsPerSecondCubed(UnitsNet.QuantityValue)" />
207+
[Obsolete("Nullable type support has been deprecated and will be removed in a future release.")]
208+
public static HeatFlux? PoundsPerSecondCubed<T>(this T? value) where T : struct => HeatFlux.FromPoundsPerSecondCubed(value == null ? (double?)null : Convert.ToDouble(value.Value));
209+
210+
#endregion
211+
190212
#region WattPerSquareFoot
191213

192214
/// <inheritdoc cref="HeatFlux.FromWattsPerSquareFoot(UnitsNet.QuantityValue)" />

UnitsNet/GeneratedCode/Quantities/HeatFlux.NetFramework.g.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,24 @@ public partial struct HeatFlux : IComparable, IComparable<HeatFlux>
179179
return nanowattspersquaremeter.HasValue ? FromNanowattsPerSquareMeter(nanowattspersquaremeter.Value) : default(HeatFlux?);
180180
}
181181

182+
/// <summary>
183+
/// Get nullable HeatFlux from nullable PoundsForcePerFootSecond.
184+
/// </summary>
185+
[Obsolete("Nullable type support is obsolete and will be removed in a future release.")]
186+
public static HeatFlux? FromPoundsForcePerFootSecond(QuantityValue? poundsforceperfootsecond)
187+
{
188+
return poundsforceperfootsecond.HasValue ? FromPoundsForcePerFootSecond(poundsforceperfootsecond.Value) : default(HeatFlux?);
189+
}
190+
191+
/// <summary>
192+
/// Get nullable HeatFlux from nullable PoundsPerSecondCubed.
193+
/// </summary>
194+
[Obsolete("Nullable type support is obsolete and will be removed in a future release.")]
195+
public static HeatFlux? FromPoundsPerSecondCubed(QuantityValue? poundspersecondcubed)
196+
{
197+
return poundspersecondcubed.HasValue ? FromPoundsPerSecondCubed(poundspersecondcubed.Value) : default(HeatFlux?);
198+
}
199+
182200
/// <summary>
183201
/// Get nullable HeatFlux from nullable WattsPerSquareFoot.
184202
/// </summary>

UnitsNet/GeneratedCode/UnitSystem.Default.g.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,16 @@ private static readonly ReadOnlyCollection<UnitLocalization> DefaultLocalization
18401840
{
18411841
new AbbreviationsForCulture("en-US", "nW/m²"),
18421842
}),
1843+
new CulturesForEnumValue((int) HeatFluxUnit.PoundForcePerFootSecond,
1844+
new[]
1845+
{
1846+
new AbbreviationsForCulture("en-US", "lbf/(ft·s)"),
1847+
}),
1848+
new CulturesForEnumValue((int) HeatFluxUnit.PoundPerSecondCubed,
1849+
new[]
1850+
{
1851+
new AbbreviationsForCulture("en-US", "lb/s³", "lbm/s³"),
1852+
}),
18431853
new CulturesForEnumValue((int) HeatFluxUnit.WattPerSquareFoot,
18441854
new[]
18451855
{

UnitsNet/GeneratedCode/Units/HeatFluxUnit.g.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ public enum HeatFluxUnit
5858
MicrowattPerSquareMeter,
5959
MilliwattPerSquareMeter,
6060
NanowattPerSquareMeter,
61+
PoundForcePerFootSecond,
62+
PoundPerSecondCubed,
6163
WattPerSquareFoot,
6264
WattPerSquareInch,
6365
WattPerSquareMeter,

0 commit comments

Comments
 (0)