diff --git a/Common/UnitDefinitions/Power.json b/Common/UnitDefinitions/Power.json
index c850f494f2..7ceb8e082b 100644
--- a/Common/UnitDefinitions/Power.json
+++ b/Common/UnitDefinitions/Power.json
@@ -135,6 +135,19 @@
"Abbreviations": [ "TR" ]
}
]
+ },
+ {
+ "SingularName": "CaloriePerHour",
+ "PluralName": "CaloriesPerHour",
+ "FromUnitToBaseFunc": "{x} / 859.8452279",
+ "FromBaseToUnitFunc": "{x} * 859.8452279",
+ "Prefixes": [ "Kilo", "Mega", "Giga" ],
+ "Localization": [
+ {
+ "Culture": "en-US",
+ "Abbreviations": [ "cal/h" ]
+ }
+ ]
}
]
}
diff --git a/Common/UnitEnumValues.g.json b/Common/UnitEnumValues.g.json
index ca73979277..02e4ec593a 100644
--- a/Common/UnitEnumValues.g.json
+++ b/Common/UnitEnumValues.g.json
@@ -1055,7 +1055,11 @@
"Picowatt": 24,
"Terawatt": 25,
"Watt": 26,
- "TonOfRefrigeration": 29
+ "TonOfRefrigeration": 29,
+ "CaloriePerHour": 33,
+ "GigacaloriePerHour": 37,
+ "KilocaloriePerHour": 34,
+ "MegacaloriePerHour": 27
},
"PowerDensity": {
"DecawattPerCubicFoot": 1,
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Power.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Power.g.cs
index 1320540aeb..bf15c0d3d0 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/Quantities/Power.g.cs
+++ b/UnitsNet.NanoFramework/GeneratedCode/Quantities/Power.g.cs
@@ -88,6 +88,11 @@ public Power(double value, PowerUnit unit)
///
public double BritishThermalUnitsPerHour => As(PowerUnit.BritishThermalUnitPerHour);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double CaloriesPerHour => As(PowerUnit.CaloriePerHour);
+
///
/// Gets a value of this quantity converted into
///
@@ -108,6 +113,11 @@ public Power(double value, PowerUnit unit)
///
public double Femtowatts => As(PowerUnit.Femtowatt);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double GigacaloriesPerHour => As(PowerUnit.GigacaloriePerHour);
+
///
/// Gets a value of this quantity converted into
///
@@ -133,6 +143,11 @@ public Power(double value, PowerUnit unit)
///
public double KilobritishThermalUnitsPerHour => As(PowerUnit.KilobritishThermalUnitPerHour);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double KilocaloriesPerHour => As(PowerUnit.KilocaloriePerHour);
+
///
/// Gets a value of this quantity converted into
///
@@ -153,6 +168,11 @@ public Power(double value, PowerUnit unit)
///
public double MegabritishThermalUnitsPerHour => As(PowerUnit.MegabritishThermalUnitPerHour);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double MegacaloriesPerHour => As(PowerUnit.MegacaloriePerHour);
+
///
/// Gets a value of this quantity converted into
///
@@ -227,6 +247,11 @@ public Power(double value, PowerUnit unit)
///
public static Power FromBritishThermalUnitsPerHour(double britishthermalunitsperhour) => new Power(britishthermalunitsperhour, PowerUnit.BritishThermalUnitPerHour);
+ ///
+ /// Creates a from .
+ ///
+ public static Power FromCaloriesPerHour(double caloriesperhour) => new Power(caloriesperhour, PowerUnit.CaloriePerHour);
+
///
/// Creates a from .
///
@@ -247,6 +272,11 @@ public Power(double value, PowerUnit unit)
///
public static Power FromFemtowatts(double femtowatts) => new Power(femtowatts, PowerUnit.Femtowatt);
+ ///
+ /// Creates a from .
+ ///
+ public static Power FromGigacaloriesPerHour(double gigacaloriesperhour) => new Power(gigacaloriesperhour, PowerUnit.GigacaloriePerHour);
+
///
/// Creates a from .
///
@@ -272,6 +302,11 @@ public Power(double value, PowerUnit unit)
///
public static Power FromKilobritishThermalUnitsPerHour(double kilobritishthermalunitsperhour) => new Power(kilobritishthermalunitsperhour, PowerUnit.KilobritishThermalUnitPerHour);
+ ///
+ /// Creates a from .
+ ///
+ public static Power FromKilocaloriesPerHour(double kilocaloriesperhour) => new Power(kilocaloriesperhour, PowerUnit.KilocaloriePerHour);
+
///
/// Creates a from .
///
@@ -292,6 +327,11 @@ public Power(double value, PowerUnit unit)
///
public static Power FromMegabritishThermalUnitsPerHour(double megabritishthermalunitsperhour) => new Power(megabritishthermalunitsperhour, PowerUnit.MegabritishThermalUnitPerHour);
+ ///
+ /// Creates a from .
+ ///
+ public static Power FromMegacaloriesPerHour(double megacaloriesperhour) => new Power(megacaloriesperhour, PowerUnit.MegacaloriePerHour);
+
///
/// Creates a from .
///
@@ -394,19 +434,23 @@ private double GetValueInBaseUnit()
{
PowerUnit.BoilerHorsepower => _value * 9812.5,
PowerUnit.BritishThermalUnitPerHour => _value * 1055.05585262 / 3600,
+ PowerUnit.CaloriePerHour => _value / 859.8452279,
PowerUnit.Decawatt => (_value) * 1e1d,
PowerUnit.Deciwatt => (_value) * 1e-1d,
PowerUnit.ElectricalHorsepower => _value * 746,
PowerUnit.Femtowatt => (_value) * 1e-15d,
+ PowerUnit.GigacaloriePerHour => (_value / 859.8452279) * 1e9d,
PowerUnit.GigajoulePerHour => (_value / 3600) * 1e9d,
PowerUnit.Gigawatt => (_value) * 1e9d,
PowerUnit.HydraulicHorsepower => _value * 745.69987158227022,
PowerUnit.JoulePerHour => _value / 3600,
PowerUnit.KilobritishThermalUnitPerHour => (_value * 1055.05585262 / 3600) * 1e3d,
+ PowerUnit.KilocaloriePerHour => (_value / 859.8452279) * 1e3d,
PowerUnit.KilojoulePerHour => (_value / 3600) * 1e3d,
PowerUnit.Kilowatt => (_value) * 1e3d,
PowerUnit.MechanicalHorsepower => _value * 76.0402249 * 9.80665,
PowerUnit.MegabritishThermalUnitPerHour => (_value * 1055.05585262 / 3600) * 1e6d,
+ PowerUnit.MegacaloriePerHour => (_value / 859.8452279) * 1e6d,
PowerUnit.MegajoulePerHour => (_value / 3600) * 1e6d,
PowerUnit.Megawatt => (_value) * 1e6d,
PowerUnit.MetricHorsepower => _value * 75 * 9.80665,
@@ -434,19 +478,23 @@ private double GetValueAs(PowerUnit unit)
{
PowerUnit.BoilerHorsepower => baseUnitValue / 9812.5,
PowerUnit.BritishThermalUnitPerHour => baseUnitValue * 3600 / 1055.05585262,
+ PowerUnit.CaloriePerHour => baseUnitValue * 859.8452279,
PowerUnit.Decawatt => (baseUnitValue) / 1e1d,
PowerUnit.Deciwatt => (baseUnitValue) / 1e-1d,
PowerUnit.ElectricalHorsepower => baseUnitValue / 746,
PowerUnit.Femtowatt => (baseUnitValue) / 1e-15d,
+ PowerUnit.GigacaloriePerHour => (baseUnitValue * 859.8452279) / 1e9d,
PowerUnit.GigajoulePerHour => (baseUnitValue * 3600) / 1e9d,
PowerUnit.Gigawatt => (baseUnitValue) / 1e9d,
PowerUnit.HydraulicHorsepower => baseUnitValue / 745.69987158227022,
PowerUnit.JoulePerHour => baseUnitValue * 3600,
PowerUnit.KilobritishThermalUnitPerHour => (baseUnitValue * 3600 / 1055.05585262) / 1e3d,
+ PowerUnit.KilocaloriePerHour => (baseUnitValue * 859.8452279) / 1e3d,
PowerUnit.KilojoulePerHour => (baseUnitValue * 3600) / 1e3d,
PowerUnit.Kilowatt => (baseUnitValue) / 1e3d,
PowerUnit.MechanicalHorsepower => baseUnitValue / (76.0402249 * 9.80665),
PowerUnit.MegabritishThermalUnitPerHour => (baseUnitValue * 3600 / 1055.05585262) / 1e6d,
+ PowerUnit.MegacaloriePerHour => (baseUnitValue * 859.8452279) / 1e6d,
PowerUnit.MegajoulePerHour => (baseUnitValue * 3600) / 1e6d,
PowerUnit.Megawatt => (baseUnitValue) / 1e6d,
PowerUnit.MetricHorsepower => baseUnitValue / (75 * 9.80665),
diff --git a/UnitsNet.NanoFramework/GeneratedCode/Units/PowerUnit.g.cs b/UnitsNet.NanoFramework/GeneratedCode/Units/PowerUnit.g.cs
index c0ddfe10ec..b9be8c883e 100644
--- a/UnitsNet.NanoFramework/GeneratedCode/Units/PowerUnit.g.cs
+++ b/UnitsNet.NanoFramework/GeneratedCode/Units/PowerUnit.g.cs
@@ -33,6 +33,7 @@ public enum PowerUnit
BoilerHorsepower = 1,
/// Based on the International Table (IT) definition of the British thermal unit (BTU), where 1 BTU is defined as exactly 1055.05585262 joules (≈1.05506 kJ). See https://en.wikipedia.org/wiki/British_thermal_unit for details.
BritishThermalUnitPerHour = 2,
+ CaloriePerHour = 33,
Decawatt = 3,
Deciwatt = 4,
@@ -42,6 +43,7 @@ public enum PowerUnit
/// https://en.wikipedia.org/wiki/Horsepower#Electrical_horsepower
ElectricalHorsepower = 5,
Femtowatt = 6,
+ GigacaloriePerHour = 37,
GigajoulePerHour = 7,
Gigawatt = 8,
@@ -52,6 +54,7 @@ public enum PowerUnit
HydraulicHorsepower = 9,
JoulePerHour = 10,
KilobritishThermalUnitPerHour = 11,
+ KilocaloriePerHour = 34,
KilojoulePerHour = 12,
Kilowatt = 13,
@@ -61,6 +64,7 @@ public enum PowerUnit
/// https://en.wikipedia.org/wiki/Horsepower#Imperial_horsepower
MechanicalHorsepower = 14,
MegabritishThermalUnitPerHour = 15,
+ MegacaloriePerHour = 27,
MegajoulePerHour = 16,
Megawatt = 17,
diff --git a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerExtensionsTest.g.cs b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerExtensionsTest.g.cs
index 43c762e9e1..295ccacfd3 100644
--- a/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerExtensionsTest.g.cs
+++ b/UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToPowerExtensionsTest.g.cs
@@ -32,6 +32,10 @@ public void NumberToBoilerHorsepowerTest() =>
public void NumberToBritishThermalUnitsPerHourTest() =>
Assert.Equal(Power.FromBritishThermalUnitsPerHour(2), 2.BritishThermalUnitsPerHour());
+ [Fact]
+ public void NumberToCaloriesPerHourTest() =>
+ Assert.Equal(Power.FromCaloriesPerHour(2), 2.CaloriesPerHour());
+
[Fact]
public void NumberToDecawattsTest() =>
Assert.Equal(Power.FromDecawatts(2), 2.Decawatts());
@@ -48,6 +52,10 @@ public void NumberToElectricalHorsepowerTest() =>
public void NumberToFemtowattsTest() =>
Assert.Equal(Power.FromFemtowatts(2), 2.Femtowatts());
+ [Fact]
+ public void NumberToGigacaloriesPerHourTest() =>
+ Assert.Equal(Power.FromGigacaloriesPerHour(2), 2.GigacaloriesPerHour());
+
[Fact]
public void NumberToGigajoulesPerHourTest() =>
Assert.Equal(Power.FromGigajoulesPerHour(2), 2.GigajoulesPerHour());
@@ -68,6 +76,10 @@ public void NumberToJoulesPerHourTest() =>
public void NumberToKilobritishThermalUnitsPerHourTest() =>
Assert.Equal(Power.FromKilobritishThermalUnitsPerHour(2), 2.KilobritishThermalUnitsPerHour());
+ [Fact]
+ public void NumberToKilocaloriesPerHourTest() =>
+ Assert.Equal(Power.FromKilocaloriesPerHour(2), 2.KilocaloriesPerHour());
+
[Fact]
public void NumberToKilojoulesPerHourTest() =>
Assert.Equal(Power.FromKilojoulesPerHour(2), 2.KilojoulesPerHour());
@@ -84,6 +96,10 @@ public void NumberToMechanicalHorsepowerTest() =>
public void NumberToMegabritishThermalUnitsPerHourTest() =>
Assert.Equal(Power.FromMegabritishThermalUnitsPerHour(2), 2.MegabritishThermalUnitsPerHour());
+ [Fact]
+ public void NumberToMegacaloriesPerHourTest() =>
+ Assert.Equal(Power.FromMegacaloriesPerHour(2), 2.MegacaloriesPerHour());
+
[Fact]
public void NumberToMegajoulesPerHourTest() =>
Assert.Equal(Power.FromMegajoulesPerHour(2), 2.MegajoulesPerHour());
diff --git a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerExtensions.g.cs b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerExtensions.g.cs
index a3f802215b..617b12edf4 100644
--- a/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerExtensions.g.cs
+++ b/UnitsNet.NumberExtensions/GeneratedCode/NumberToPowerExtensions.g.cs
@@ -54,6 +54,17 @@ public static Power BritishThermalUnitsPerHour(this T value)
=> Power.FromBritishThermalUnitsPerHour(value.ToDouble(null));
#endif
+ ///
+ public static Power CaloriesPerHour(this T value)
+ where T : notnull
+#if NET7_0_OR_GREATER
+ , INumber
+ => Power.FromCaloriesPerHour(double.CreateChecked(value));
+#else
+ , IConvertible
+ => Power.FromCaloriesPerHour(value.ToDouble(null));
+#endif
+
///
public static Power Decawatts(this T value)
where T : notnull
@@ -98,6 +109,17 @@ public static Power Femtowatts(this T value)
=> Power.FromFemtowatts(value.ToDouble(null));
#endif
+ ///
+ public static Power GigacaloriesPerHour(this T value)
+ where T : notnull
+#if NET7_0_OR_GREATER
+ , INumber
+ => Power.FromGigacaloriesPerHour(double.CreateChecked(value));
+#else
+ , IConvertible
+ => Power.FromGigacaloriesPerHour(value.ToDouble(null));
+#endif
+
///
public static Power GigajoulesPerHour(this T value)
where T : notnull
@@ -153,6 +175,17 @@ public static Power KilobritishThermalUnitsPerHour(this T value)
=> Power.FromKilobritishThermalUnitsPerHour(value.ToDouble(null));
#endif
+ ///
+ public static Power KilocaloriesPerHour(this T value)
+ where T : notnull
+#if NET7_0_OR_GREATER
+ , INumber
+ => Power.FromKilocaloriesPerHour(double.CreateChecked(value));
+#else
+ , IConvertible
+ => Power.FromKilocaloriesPerHour(value.ToDouble(null));
+#endif
+
///
public static Power KilojoulesPerHour(this T value)
where T : notnull
@@ -197,6 +230,17 @@ public static Power MegabritishThermalUnitsPerHour(this T value)
=> Power.FromMegabritishThermalUnitsPerHour(value.ToDouble(null));
#endif
+ ///
+ public static Power MegacaloriesPerHour(this T value)
+ where T : notnull
+#if NET7_0_OR_GREATER
+ , INumber
+ => Power.FromMegacaloriesPerHour(double.CreateChecked(value));
+#else
+ , IConvertible
+ => Power.FromMegacaloriesPerHour(value.ToDouble(null));
+#endif
+
///
public static Power MegajoulesPerHour(this T value)
where T : notnull
diff --git a/UnitsNet.Tests/CustomCode/PowerTests.cs b/UnitsNet.Tests/CustomCode/PowerTests.cs
index 945031a401..76487791fa 100644
--- a/UnitsNet.Tests/CustomCode/PowerTests.cs
+++ b/UnitsNet.Tests/CustomCode/PowerTests.cs
@@ -62,6 +62,14 @@ public class PowerTests : PowerTestsBase
protected override double MetricHorsepowerInOneWatt => 0.00135962161730390432342679032425;
+ protected override double CaloriesPerHourInOneWatt => 859.8452279;
+
+ protected override double GigacaloriesPerHourInOneWatt => 859.8452279e-9;
+
+ protected override double KilocaloriesPerHourInOneWatt => 859.8452279e-3;
+
+ protected override double MegacaloriesPerHourInOneWatt => 859.8452279e-6;
+
[Fact]
public void DurationTimesPowerEqualsEnergy()
{
diff --git a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs
index a58c390dde..46eb316bd9 100644
--- a/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs
+++ b/UnitsNet.Tests/GeneratedCode/TestsBase/PowerTestsBase.g.cs
@@ -41,19 +41,23 @@ public abstract partial class PowerTestsBase : QuantityTestsBase
{
protected abstract double BoilerHorsepowerInOneWatt { get; }
protected abstract double BritishThermalUnitsPerHourInOneWatt { get; }
+ protected abstract double CaloriesPerHourInOneWatt { get; }
protected abstract double DecawattsInOneWatt { get; }
protected abstract double DeciwattsInOneWatt { get; }
protected abstract double ElectricalHorsepowerInOneWatt { get; }
protected abstract double FemtowattsInOneWatt { get; }
+ protected abstract double GigacaloriesPerHourInOneWatt { get; }
protected abstract double GigajoulesPerHourInOneWatt { get; }
protected abstract double GigawattsInOneWatt { get; }
protected abstract double HydraulicHorsepowerInOneWatt { get; }
protected abstract double JoulesPerHourInOneWatt { get; }
protected abstract double KilobritishThermalUnitsPerHourInOneWatt { get; }
+ protected abstract double KilocaloriesPerHourInOneWatt { get; }
protected abstract double KilojoulesPerHourInOneWatt { get; }
protected abstract double KilowattsInOneWatt { get; }
protected abstract double MechanicalHorsepowerInOneWatt { get; }
protected abstract double MegabritishThermalUnitsPerHourInOneWatt { get; }
+ protected abstract double MegacaloriesPerHourInOneWatt { get; }
protected abstract double MegajoulesPerHourInOneWatt { get; }
protected abstract double MegawattsInOneWatt { get; }
protected abstract double MetricHorsepowerInOneWatt { get; }
@@ -70,19 +74,23 @@ public abstract partial class PowerTestsBase : QuantityTestsBase
// ReSharper disable VirtualMemberNeverOverriden.Global
protected virtual double BoilerHorsepowerTolerance { get { return 1e-5; } }
protected virtual double BritishThermalUnitsPerHourTolerance { get { return 1e-5; } }
+ protected virtual double CaloriesPerHourTolerance { get { return 1e-5; } }
protected virtual double DecawattsTolerance { get { return 1e-5; } }
protected virtual double DeciwattsTolerance { get { return 1e-5; } }
protected virtual double ElectricalHorsepowerTolerance { get { return 1e-5; } }
protected virtual double FemtowattsTolerance { get { return 1e-5; } }
+ protected virtual double GigacaloriesPerHourTolerance { get { return 1e-5; } }
protected virtual double GigajoulesPerHourTolerance { get { return 1e-5; } }
protected virtual double GigawattsTolerance { get { return 1e-5; } }
protected virtual double HydraulicHorsepowerTolerance { get { return 1e-5; } }
protected virtual double JoulesPerHourTolerance { get { return 1e-5; } }
protected virtual double KilobritishThermalUnitsPerHourTolerance { get { return 1e-5; } }
+ protected virtual double KilocaloriesPerHourTolerance { get { return 1e-5; } }
protected virtual double KilojoulesPerHourTolerance { get { return 1e-5; } }
protected virtual double KilowattsTolerance { get { return 1e-5; } }
protected virtual double MechanicalHorsepowerTolerance { get { return 1e-5; } }
protected virtual double MegabritishThermalUnitsPerHourTolerance { get { return 1e-5; } }
+ protected virtual double MegacaloriesPerHourTolerance { get { return 1e-5; } }
protected virtual double MegajoulesPerHourTolerance { get { return 1e-5; } }
protected virtual double MegawattsTolerance { get { return 1e-5; } }
protected virtual double MetricHorsepowerTolerance { get { return 1e-5; } }
@@ -103,19 +111,23 @@ public abstract partial class PowerTestsBase : QuantityTestsBase
{
PowerUnit.BoilerHorsepower => (BoilerHorsepowerInOneWatt, BoilerHorsepowerTolerance),
PowerUnit.BritishThermalUnitPerHour => (BritishThermalUnitsPerHourInOneWatt, BritishThermalUnitsPerHourTolerance),
+ PowerUnit.CaloriePerHour => (CaloriesPerHourInOneWatt, CaloriesPerHourTolerance),
PowerUnit.Decawatt => (DecawattsInOneWatt, DecawattsTolerance),
PowerUnit.Deciwatt => (DeciwattsInOneWatt, DeciwattsTolerance),
PowerUnit.ElectricalHorsepower => (ElectricalHorsepowerInOneWatt, ElectricalHorsepowerTolerance),
PowerUnit.Femtowatt => (FemtowattsInOneWatt, FemtowattsTolerance),
+ PowerUnit.GigacaloriePerHour => (GigacaloriesPerHourInOneWatt, GigacaloriesPerHourTolerance),
PowerUnit.GigajoulePerHour => (GigajoulesPerHourInOneWatt, GigajoulesPerHourTolerance),
PowerUnit.Gigawatt => (GigawattsInOneWatt, GigawattsTolerance),
PowerUnit.HydraulicHorsepower => (HydraulicHorsepowerInOneWatt, HydraulicHorsepowerTolerance),
PowerUnit.JoulePerHour => (JoulesPerHourInOneWatt, JoulesPerHourTolerance),
PowerUnit.KilobritishThermalUnitPerHour => (KilobritishThermalUnitsPerHourInOneWatt, KilobritishThermalUnitsPerHourTolerance),
+ PowerUnit.KilocaloriePerHour => (KilocaloriesPerHourInOneWatt, KilocaloriesPerHourTolerance),
PowerUnit.KilojoulePerHour => (KilojoulesPerHourInOneWatt, KilojoulesPerHourTolerance),
PowerUnit.Kilowatt => (KilowattsInOneWatt, KilowattsTolerance),
PowerUnit.MechanicalHorsepower => (MechanicalHorsepowerInOneWatt, MechanicalHorsepowerTolerance),
PowerUnit.MegabritishThermalUnitPerHour => (MegabritishThermalUnitsPerHourInOneWatt, MegabritishThermalUnitsPerHourTolerance),
+ PowerUnit.MegacaloriePerHour => (MegacaloriesPerHourInOneWatt, MegacaloriesPerHourTolerance),
PowerUnit.MegajoulePerHour => (MegajoulesPerHourInOneWatt, MegajoulesPerHourTolerance),
PowerUnit.Megawatt => (MegawattsInOneWatt, MegawattsTolerance),
PowerUnit.MetricHorsepower => (MetricHorsepowerInOneWatt, MetricHorsepowerTolerance),
@@ -136,19 +148,23 @@ public abstract partial class PowerTestsBase : QuantityTestsBase
{
new object[] { PowerUnit.BoilerHorsepower },
new object[] { PowerUnit.BritishThermalUnitPerHour },
+ new object[] { PowerUnit.CaloriePerHour },
new object[] { PowerUnit.Decawatt },
new object[] { PowerUnit.Deciwatt },
new object[] { PowerUnit.ElectricalHorsepower },
new object[] { PowerUnit.Femtowatt },
+ new object[] { PowerUnit.GigacaloriePerHour },
new object[] { PowerUnit.GigajoulePerHour },
new object[] { PowerUnit.Gigawatt },
new object[] { PowerUnit.HydraulicHorsepower },
new object[] { PowerUnit.JoulePerHour },
new object[] { PowerUnit.KilobritishThermalUnitPerHour },
+ new object[] { PowerUnit.KilocaloriePerHour },
new object[] { PowerUnit.KilojoulePerHour },
new object[] { PowerUnit.Kilowatt },
new object[] { PowerUnit.MechanicalHorsepower },
new object[] { PowerUnit.MegabritishThermalUnitPerHour },
+ new object[] { PowerUnit.MegacaloriePerHour },
new object[] { PowerUnit.MegajoulePerHour },
new object[] { PowerUnit.Megawatt },
new object[] { PowerUnit.MetricHorsepower },
@@ -230,19 +246,23 @@ public void WattToPowerUnits()
Power watt = Power.FromWatts(1);
AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, watt.BoilerHorsepower, BoilerHorsepowerTolerance);
AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, watt.BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(CaloriesPerHourInOneWatt, watt.CaloriesPerHour, CaloriesPerHourTolerance);
AssertEx.EqualTolerance(DecawattsInOneWatt, watt.Decawatts, DecawattsTolerance);
AssertEx.EqualTolerance(DeciwattsInOneWatt, watt.Deciwatts, DeciwattsTolerance);
AssertEx.EqualTolerance(ElectricalHorsepowerInOneWatt, watt.ElectricalHorsepower, ElectricalHorsepowerTolerance);
AssertEx.EqualTolerance(FemtowattsInOneWatt, watt.Femtowatts, FemtowattsTolerance);
+ AssertEx.EqualTolerance(GigacaloriesPerHourInOneWatt, watt.GigacaloriesPerHour, GigacaloriesPerHourTolerance);
AssertEx.EqualTolerance(GigajoulesPerHourInOneWatt, watt.GigajoulesPerHour, GigajoulesPerHourTolerance);
AssertEx.EqualTolerance(GigawattsInOneWatt, watt.Gigawatts, GigawattsTolerance);
AssertEx.EqualTolerance(HydraulicHorsepowerInOneWatt, watt.HydraulicHorsepower, HydraulicHorsepowerTolerance);
AssertEx.EqualTolerance(JoulesPerHourInOneWatt, watt.JoulesPerHour, JoulesPerHourTolerance);
AssertEx.EqualTolerance(KilobritishThermalUnitsPerHourInOneWatt, watt.KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(KilocaloriesPerHourInOneWatt, watt.KilocaloriesPerHour, KilocaloriesPerHourTolerance);
AssertEx.EqualTolerance(KilojoulesPerHourInOneWatt, watt.KilojoulesPerHour, KilojoulesPerHourTolerance);
AssertEx.EqualTolerance(KilowattsInOneWatt, watt.Kilowatts, KilowattsTolerance);
AssertEx.EqualTolerance(MechanicalHorsepowerInOneWatt, watt.MechanicalHorsepower, MechanicalHorsepowerTolerance);
AssertEx.EqualTolerance(MegabritishThermalUnitsPerHourInOneWatt, watt.MegabritishThermalUnitsPerHour, MegabritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(MegacaloriesPerHourInOneWatt, watt.MegacaloriesPerHour, MegacaloriesPerHourTolerance);
AssertEx.EqualTolerance(MegajoulesPerHourInOneWatt, watt.MegajoulesPerHour, MegajoulesPerHourTolerance);
AssertEx.EqualTolerance(MegawattsInOneWatt, watt.Megawatts, MegawattsTolerance);
AssertEx.EqualTolerance(MetricHorsepowerInOneWatt, watt.MetricHorsepower, MetricHorsepowerTolerance);
@@ -268,105 +288,121 @@ public void From_ValueAndUnit_ReturnsQuantityWithSameValueAndUnit()
AssertEx.EqualTolerance(1, quantity01.BritishThermalUnitsPerHour, BritishThermalUnitsPerHourTolerance);
Assert.Equal(PowerUnit.BritishThermalUnitPerHour, quantity01.Unit);
- var quantity02 = Power.From(1, PowerUnit.Decawatt);
- AssertEx.EqualTolerance(1, quantity02.Decawatts, DecawattsTolerance);
- Assert.Equal(PowerUnit.Decawatt, quantity02.Unit);
+ var quantity02 = Power.From(1, PowerUnit.CaloriePerHour);
+ AssertEx.EqualTolerance(1, quantity02.CaloriesPerHour, CaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.CaloriePerHour, quantity02.Unit);
- var quantity03 = Power.From(1, PowerUnit.Deciwatt);
- AssertEx.EqualTolerance(1, quantity03.Deciwatts, DeciwattsTolerance);
- Assert.Equal(PowerUnit.Deciwatt, quantity03.Unit);
+ var quantity03 = Power.From(1, PowerUnit.Decawatt);
+ AssertEx.EqualTolerance(1, quantity03.Decawatts, DecawattsTolerance);
+ Assert.Equal(PowerUnit.Decawatt, quantity03.Unit);
- var quantity04 = Power.From(1, PowerUnit.ElectricalHorsepower);
- AssertEx.EqualTolerance(1, quantity04.ElectricalHorsepower, ElectricalHorsepowerTolerance);
- Assert.Equal(PowerUnit.ElectricalHorsepower, quantity04.Unit);
+ var quantity04 = Power.From(1, PowerUnit.Deciwatt);
+ AssertEx.EqualTolerance(1, quantity04.Deciwatts, DeciwattsTolerance);
+ Assert.Equal(PowerUnit.Deciwatt, quantity04.Unit);
- var quantity05 = Power.From(1, PowerUnit.Femtowatt);
- AssertEx.EqualTolerance(1, quantity05.Femtowatts, FemtowattsTolerance);
- Assert.Equal(PowerUnit.Femtowatt, quantity05.Unit);
+ var quantity05 = Power.From(1, PowerUnit.ElectricalHorsepower);
+ AssertEx.EqualTolerance(1, quantity05.ElectricalHorsepower, ElectricalHorsepowerTolerance);
+ Assert.Equal(PowerUnit.ElectricalHorsepower, quantity05.Unit);
- var quantity06 = Power.From(1, PowerUnit.GigajoulePerHour);
- AssertEx.EqualTolerance(1, quantity06.GigajoulesPerHour, GigajoulesPerHourTolerance);
- Assert.Equal(PowerUnit.GigajoulePerHour, quantity06.Unit);
+ var quantity06 = Power.From(1, PowerUnit.Femtowatt);
+ AssertEx.EqualTolerance(1, quantity06.Femtowatts, FemtowattsTolerance);
+ Assert.Equal(PowerUnit.Femtowatt, quantity06.Unit);
- var quantity07 = Power.From(1, PowerUnit.Gigawatt);
- AssertEx.EqualTolerance(1, quantity07.Gigawatts, GigawattsTolerance);
- Assert.Equal(PowerUnit.Gigawatt, quantity07.Unit);
+ var quantity07 = Power.From(1, PowerUnit.GigacaloriePerHour);
+ AssertEx.EqualTolerance(1, quantity07.GigacaloriesPerHour, GigacaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.GigacaloriePerHour, quantity07.Unit);
- var quantity08 = Power.From(1, PowerUnit.HydraulicHorsepower);
- AssertEx.EqualTolerance(1, quantity08.HydraulicHorsepower, HydraulicHorsepowerTolerance);
- Assert.Equal(PowerUnit.HydraulicHorsepower, quantity08.Unit);
+ var quantity08 = Power.From(1, PowerUnit.GigajoulePerHour);
+ AssertEx.EqualTolerance(1, quantity08.GigajoulesPerHour, GigajoulesPerHourTolerance);
+ Assert.Equal(PowerUnit.GigajoulePerHour, quantity08.Unit);
- var quantity09 = Power.From(1, PowerUnit.JoulePerHour);
- AssertEx.EqualTolerance(1, quantity09.JoulesPerHour, JoulesPerHourTolerance);
- Assert.Equal(PowerUnit.JoulePerHour, quantity09.Unit);
+ var quantity09 = Power.From(1, PowerUnit.Gigawatt);
+ AssertEx.EqualTolerance(1, quantity09.Gigawatts, GigawattsTolerance);
+ Assert.Equal(PowerUnit.Gigawatt, quantity09.Unit);
- var quantity10 = Power.From(1, PowerUnit.KilobritishThermalUnitPerHour);
- AssertEx.EqualTolerance(1, quantity10.KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance);
- Assert.Equal(PowerUnit.KilobritishThermalUnitPerHour, quantity10.Unit);
+ var quantity10 = Power.From(1, PowerUnit.HydraulicHorsepower);
+ AssertEx.EqualTolerance(1, quantity10.HydraulicHorsepower, HydraulicHorsepowerTolerance);
+ Assert.Equal(PowerUnit.HydraulicHorsepower, quantity10.Unit);
- var quantity11 = Power.From(1, PowerUnit.KilojoulePerHour);
- AssertEx.EqualTolerance(1, quantity11.KilojoulesPerHour, KilojoulesPerHourTolerance);
- Assert.Equal(PowerUnit.KilojoulePerHour, quantity11.Unit);
+ var quantity11 = Power.From(1, PowerUnit.JoulePerHour);
+ AssertEx.EqualTolerance(1, quantity11.JoulesPerHour, JoulesPerHourTolerance);
+ Assert.Equal(PowerUnit.JoulePerHour, quantity11.Unit);
- var quantity12 = Power.From(1, PowerUnit.Kilowatt);
- AssertEx.EqualTolerance(1, quantity12.Kilowatts, KilowattsTolerance);
- Assert.Equal(PowerUnit.Kilowatt, quantity12.Unit);
+ var quantity12 = Power.From(1, PowerUnit.KilobritishThermalUnitPerHour);
+ AssertEx.EqualTolerance(1, quantity12.KilobritishThermalUnitsPerHour, KilobritishThermalUnitsPerHourTolerance);
+ Assert.Equal(PowerUnit.KilobritishThermalUnitPerHour, quantity12.Unit);
- var quantity13 = Power.From(1, PowerUnit.MechanicalHorsepower);
- AssertEx.EqualTolerance(1, quantity13.MechanicalHorsepower, MechanicalHorsepowerTolerance);
- Assert.Equal(PowerUnit.MechanicalHorsepower, quantity13.Unit);
+ var quantity13 = Power.From(1, PowerUnit.KilocaloriePerHour);
+ AssertEx.EqualTolerance(1, quantity13.KilocaloriesPerHour, KilocaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.KilocaloriePerHour, quantity13.Unit);
- var quantity14 = Power.From(1, PowerUnit.MegabritishThermalUnitPerHour);
- AssertEx.EqualTolerance(1, quantity14.MegabritishThermalUnitsPerHour, MegabritishThermalUnitsPerHourTolerance);
- Assert.Equal(PowerUnit.MegabritishThermalUnitPerHour, quantity14.Unit);
+ var quantity14 = Power.From(1, PowerUnit.KilojoulePerHour);
+ AssertEx.EqualTolerance(1, quantity14.KilojoulesPerHour, KilojoulesPerHourTolerance);
+ Assert.Equal(PowerUnit.KilojoulePerHour, quantity14.Unit);
- var quantity15 = Power.From(1, PowerUnit.MegajoulePerHour);
- AssertEx.EqualTolerance(1, quantity15.MegajoulesPerHour, MegajoulesPerHourTolerance);
- Assert.Equal(PowerUnit.MegajoulePerHour, quantity15.Unit);
+ var quantity15 = Power.From(1, PowerUnit.Kilowatt);
+ AssertEx.EqualTolerance(1, quantity15.Kilowatts, KilowattsTolerance);
+ Assert.Equal(PowerUnit.Kilowatt, quantity15.Unit);
- var quantity16 = Power.From(1, PowerUnit.Megawatt);
- AssertEx.EqualTolerance(1, quantity16.Megawatts, MegawattsTolerance);
- Assert.Equal(PowerUnit.Megawatt, quantity16.Unit);
+ var quantity16 = Power.From(1, PowerUnit.MechanicalHorsepower);
+ AssertEx.EqualTolerance(1, quantity16.MechanicalHorsepower, MechanicalHorsepowerTolerance);
+ Assert.Equal(PowerUnit.MechanicalHorsepower, quantity16.Unit);
- var quantity17 = Power.From(1, PowerUnit.MetricHorsepower);
- AssertEx.EqualTolerance(1, quantity17.MetricHorsepower, MetricHorsepowerTolerance);
- Assert.Equal(PowerUnit.MetricHorsepower, quantity17.Unit);
+ var quantity17 = Power.From(1, PowerUnit.MegabritishThermalUnitPerHour);
+ AssertEx.EqualTolerance(1, quantity17.MegabritishThermalUnitsPerHour, MegabritishThermalUnitsPerHourTolerance);
+ Assert.Equal(PowerUnit.MegabritishThermalUnitPerHour, quantity17.Unit);
- var quantity18 = Power.From(1, PowerUnit.Microwatt);
- AssertEx.EqualTolerance(1, quantity18.Microwatts, MicrowattsTolerance);
- Assert.Equal(PowerUnit.Microwatt, quantity18.Unit);
+ var quantity18 = Power.From(1, PowerUnit.MegacaloriePerHour);
+ AssertEx.EqualTolerance(1, quantity18.MegacaloriesPerHour, MegacaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.MegacaloriePerHour, quantity18.Unit);
- var quantity19 = Power.From(1, PowerUnit.MillijoulePerHour);
- AssertEx.EqualTolerance(1, quantity19.MillijoulesPerHour, MillijoulesPerHourTolerance);
- Assert.Equal(PowerUnit.MillijoulePerHour, quantity19.Unit);
+ var quantity19 = Power.From(1, PowerUnit.MegajoulePerHour);
+ AssertEx.EqualTolerance(1, quantity19.MegajoulesPerHour, MegajoulesPerHourTolerance);
+ Assert.Equal(PowerUnit.MegajoulePerHour, quantity19.Unit);
- var quantity20 = Power.From(1, PowerUnit.Milliwatt);
- AssertEx.EqualTolerance(1, quantity20.Milliwatts, MilliwattsTolerance);
- Assert.Equal(PowerUnit.Milliwatt, quantity20.Unit);
+ var quantity20 = Power.From(1, PowerUnit.Megawatt);
+ AssertEx.EqualTolerance(1, quantity20.Megawatts, MegawattsTolerance);
+ Assert.Equal(PowerUnit.Megawatt, quantity20.Unit);
- var quantity21 = Power.From(1, PowerUnit.Nanowatt);
- AssertEx.EqualTolerance(1, quantity21.Nanowatts, NanowattsTolerance);
- Assert.Equal(PowerUnit.Nanowatt, quantity21.Unit);
+ var quantity21 = Power.From(1, PowerUnit.MetricHorsepower);
+ AssertEx.EqualTolerance(1, quantity21.MetricHorsepower, MetricHorsepowerTolerance);
+ Assert.Equal(PowerUnit.MetricHorsepower, quantity21.Unit);
- var quantity22 = Power.From(1, PowerUnit.Petawatt);
- AssertEx.EqualTolerance(1, quantity22.Petawatts, PetawattsTolerance);
- Assert.Equal(PowerUnit.Petawatt, quantity22.Unit);
+ var quantity22 = Power.From(1, PowerUnit.Microwatt);
+ AssertEx.EqualTolerance(1, quantity22.Microwatts, MicrowattsTolerance);
+ Assert.Equal(PowerUnit.Microwatt, quantity22.Unit);
- var quantity23 = Power.From(1, PowerUnit.Picowatt);
- AssertEx.EqualTolerance(1, quantity23.Picowatts, PicowattsTolerance);
- Assert.Equal(PowerUnit.Picowatt, quantity23.Unit);
+ var quantity23 = Power.From(1, PowerUnit.MillijoulePerHour);
+ AssertEx.EqualTolerance(1, quantity23.MillijoulesPerHour, MillijoulesPerHourTolerance);
+ Assert.Equal(PowerUnit.MillijoulePerHour, quantity23.Unit);
- var quantity24 = Power.From(1, PowerUnit.Terawatt);
- AssertEx.EqualTolerance(1, quantity24.Terawatts, TerawattsTolerance);
- Assert.Equal(PowerUnit.Terawatt, quantity24.Unit);
+ var quantity24 = Power.From(1, PowerUnit.Milliwatt);
+ AssertEx.EqualTolerance(1, quantity24.Milliwatts, MilliwattsTolerance);
+ Assert.Equal(PowerUnit.Milliwatt, quantity24.Unit);
- var quantity25 = Power.From(1, PowerUnit.TonOfRefrigeration);
- AssertEx.EqualTolerance(1, quantity25.TonsOfRefrigeration, TonsOfRefrigerationTolerance);
- Assert.Equal(PowerUnit.TonOfRefrigeration, quantity25.Unit);
+ var quantity25 = Power.From(1, PowerUnit.Nanowatt);
+ AssertEx.EqualTolerance(1, quantity25.Nanowatts, NanowattsTolerance);
+ Assert.Equal(PowerUnit.Nanowatt, quantity25.Unit);
- var quantity26 = Power.From(1, PowerUnit.Watt);
- AssertEx.EqualTolerance(1, quantity26.Watts, WattsTolerance);
- Assert.Equal(PowerUnit.Watt, quantity26.Unit);
+ var quantity26 = Power.From(1, PowerUnit.Petawatt);
+ AssertEx.EqualTolerance(1, quantity26.Petawatts, PetawattsTolerance);
+ Assert.Equal(PowerUnit.Petawatt, quantity26.Unit);
+
+ var quantity27 = Power.From(1, PowerUnit.Picowatt);
+ AssertEx.EqualTolerance(1, quantity27.Picowatts, PicowattsTolerance);
+ Assert.Equal(PowerUnit.Picowatt, quantity27.Unit);
+
+ var quantity28 = Power.From(1, PowerUnit.Terawatt);
+ AssertEx.EqualTolerance(1, quantity28.Terawatts, TerawattsTolerance);
+ Assert.Equal(PowerUnit.Terawatt, quantity28.Unit);
+
+ var quantity29 = Power.From(1, PowerUnit.TonOfRefrigeration);
+ AssertEx.EqualTolerance(1, quantity29.TonsOfRefrigeration, TonsOfRefrigerationTolerance);
+ Assert.Equal(PowerUnit.TonOfRefrigeration, quantity29.Unit);
+
+ var quantity30 = Power.From(1, PowerUnit.Watt);
+ AssertEx.EqualTolerance(1, quantity30.Watts, WattsTolerance);
+ Assert.Equal(PowerUnit.Watt, quantity30.Unit);
}
@@ -394,19 +430,23 @@ public void As()
var watt = Power.FromWatts(1);
AssertEx.EqualTolerance(BoilerHorsepowerInOneWatt, watt.As(PowerUnit.BoilerHorsepower), BoilerHorsepowerTolerance);
AssertEx.EqualTolerance(BritishThermalUnitsPerHourInOneWatt, watt.As(PowerUnit.BritishThermalUnitPerHour), BritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(CaloriesPerHourInOneWatt, watt.As(PowerUnit.CaloriePerHour), CaloriesPerHourTolerance);
AssertEx.EqualTolerance(DecawattsInOneWatt, watt.As(PowerUnit.Decawatt), DecawattsTolerance);
AssertEx.EqualTolerance(DeciwattsInOneWatt, watt.As(PowerUnit.Deciwatt), DeciwattsTolerance);
AssertEx.EqualTolerance(ElectricalHorsepowerInOneWatt, watt.As(PowerUnit.ElectricalHorsepower), ElectricalHorsepowerTolerance);
AssertEx.EqualTolerance(FemtowattsInOneWatt, watt.As(PowerUnit.Femtowatt), FemtowattsTolerance);
+ AssertEx.EqualTolerance(GigacaloriesPerHourInOneWatt, watt.As(PowerUnit.GigacaloriePerHour), GigacaloriesPerHourTolerance);
AssertEx.EqualTolerance(GigajoulesPerHourInOneWatt, watt.As(PowerUnit.GigajoulePerHour), GigajoulesPerHourTolerance);
AssertEx.EqualTolerance(GigawattsInOneWatt, watt.As(PowerUnit.Gigawatt), GigawattsTolerance);
AssertEx.EqualTolerance(HydraulicHorsepowerInOneWatt, watt.As(PowerUnit.HydraulicHorsepower), HydraulicHorsepowerTolerance);
AssertEx.EqualTolerance(JoulesPerHourInOneWatt, watt.As(PowerUnit.JoulePerHour), JoulesPerHourTolerance);
AssertEx.EqualTolerance(KilobritishThermalUnitsPerHourInOneWatt, watt.As(PowerUnit.KilobritishThermalUnitPerHour), KilobritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(KilocaloriesPerHourInOneWatt, watt.As(PowerUnit.KilocaloriePerHour), KilocaloriesPerHourTolerance);
AssertEx.EqualTolerance(KilojoulesPerHourInOneWatt, watt.As(PowerUnit.KilojoulePerHour), KilojoulesPerHourTolerance);
AssertEx.EqualTolerance(KilowattsInOneWatt, watt.As(PowerUnit.Kilowatt), KilowattsTolerance);
AssertEx.EqualTolerance(MechanicalHorsepowerInOneWatt, watt.As(PowerUnit.MechanicalHorsepower), MechanicalHorsepowerTolerance);
AssertEx.EqualTolerance(MegabritishThermalUnitsPerHourInOneWatt, watt.As(PowerUnit.MegabritishThermalUnitPerHour), MegabritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(MegacaloriesPerHourInOneWatt, watt.As(PowerUnit.MegacaloriePerHour), MegacaloriesPerHourTolerance);
AssertEx.EqualTolerance(MegajoulesPerHourInOneWatt, watt.As(PowerUnit.MegajoulePerHour), MegajoulesPerHourTolerance);
AssertEx.EqualTolerance(MegawattsInOneWatt, watt.As(PowerUnit.Megawatt), MegawattsTolerance);
AssertEx.EqualTolerance(MetricHorsepowerInOneWatt, watt.As(PowerUnit.MetricHorsepower), MetricHorsepowerTolerance);
@@ -551,6 +591,13 @@ public void Parse()
Assert.Equal(PowerUnit.BritishThermalUnitPerHour, parsed.Unit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsed = Power.Parse("1 cal/h", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.CaloriesPerHour, CaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.CaloriePerHour, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsed = Power.Parse("1 daW", CultureInfo.GetCultureInfo("en-US"));
@@ -579,6 +626,13 @@ public void Parse()
Assert.Equal(PowerUnit.Femtowatt, parsed.Unit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsed = Power.Parse("1 Gcal/h", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.GigacaloriesPerHour, GigacaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.GigacaloriePerHour, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsed = Power.Parse("1 GJ/h", CultureInfo.GetCultureInfo("en-US"));
@@ -621,6 +675,13 @@ public void Parse()
Assert.Equal(PowerUnit.KilobritishThermalUnitPerHour, parsed.Unit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsed = Power.Parse("1 kcal/h", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.KilocaloriesPerHour, KilocaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.KilocaloriePerHour, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsed = Power.Parse("1 kJ/h", CultureInfo.GetCultureInfo("en-US"));
@@ -656,6 +717,13 @@ public void Parse()
Assert.Equal(PowerUnit.MegabritishThermalUnitPerHour, parsed.Unit);
} catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+ try
+ {
+ var parsed = Power.Parse("1 Mcal/h", CultureInfo.GetCultureInfo("en-US"));
+ AssertEx.EqualTolerance(1, parsed.MegacaloriesPerHour, MegacaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.MegacaloriePerHour, parsed.Unit);
+ } catch (AmbiguousUnitParseException) { /* Some units have the same abbreviations */ }
+
try
{
var parsed = Power.Parse("1 MJ/h", CultureInfo.GetCultureInfo("en-US"));
@@ -763,6 +831,12 @@ public void TryParse()
Assert.Equal(PowerUnit.BritishThermalUnitPerHour, parsed.Unit);
}
+ {
+ Assert.True(Power.TryParse("1 cal/h", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.CaloriesPerHour, CaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.CaloriePerHour, parsed.Unit);
+ }
+
{
Assert.True(Power.TryParse("1 daW", CultureInfo.GetCultureInfo("en-US"), out var parsed));
AssertEx.EqualTolerance(1, parsed.Decawatts, DecawattsTolerance);
@@ -787,6 +861,12 @@ public void TryParse()
Assert.Equal(PowerUnit.Femtowatt, parsed.Unit);
}
+ {
+ Assert.True(Power.TryParse("1 Gcal/h", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.GigacaloriesPerHour, GigacaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.GigacaloriePerHour, parsed.Unit);
+ }
+
{
Assert.True(Power.TryParse("1 GJ/h", CultureInfo.GetCultureInfo("en-US"), out var parsed));
AssertEx.EqualTolerance(1, parsed.GigajoulesPerHour, GigajoulesPerHourTolerance);
@@ -823,6 +903,12 @@ public void TryParse()
Assert.Equal(PowerUnit.KilobritishThermalUnitPerHour, parsed.Unit);
}
+ {
+ Assert.True(Power.TryParse("1 kcal/h", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.KilocaloriesPerHour, KilocaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.KilocaloriePerHour, parsed.Unit);
+ }
+
{
Assert.True(Power.TryParse("1 kJ/h", CultureInfo.GetCultureInfo("en-US"), out var parsed));
AssertEx.EqualTolerance(1, parsed.KilojoulesPerHour, KilojoulesPerHourTolerance);
@@ -853,6 +939,12 @@ public void TryParse()
Assert.Equal(PowerUnit.MegabritishThermalUnitPerHour, parsed.Unit);
}
+ {
+ Assert.True(Power.TryParse("1 Mcal/h", CultureInfo.GetCultureInfo("en-US"), out var parsed));
+ AssertEx.EqualTolerance(1, parsed.MegacaloriesPerHour, MegacaloriesPerHourTolerance);
+ Assert.Equal(PowerUnit.MegacaloriePerHour, parsed.Unit);
+ }
+
{
Assert.True(Power.TryParse("1 hp(M)", CultureInfo.GetCultureInfo("en-US"), out var parsed));
AssertEx.EqualTolerance(1, parsed.MetricHorsepower, MetricHorsepowerTolerance);
@@ -895,21 +987,25 @@ public void TryParse()
[InlineData("hp(S)", PowerUnit.BoilerHorsepower)]
[InlineData("Btu/h", PowerUnit.BritishThermalUnitPerHour)]
[InlineData("Btu/hr", PowerUnit.BritishThermalUnitPerHour)]
+ [InlineData("cal/h", PowerUnit.CaloriePerHour)]
[InlineData("daW", PowerUnit.Decawatt)]
[InlineData("dW", PowerUnit.Deciwatt)]
[InlineData("hp(E)", PowerUnit.ElectricalHorsepower)]
[InlineData("fW", PowerUnit.Femtowatt)]
+ [InlineData("Gcal/h", PowerUnit.GigacaloriePerHour)]
[InlineData("GJ/h", PowerUnit.GigajoulePerHour)]
[InlineData("GW", PowerUnit.Gigawatt)]
[InlineData("hp(H)", PowerUnit.HydraulicHorsepower)]
[InlineData("J/h", PowerUnit.JoulePerHour)]
[InlineData("kBtu/h", PowerUnit.KilobritishThermalUnitPerHour)]
[InlineData("kBtu/hr", PowerUnit.KilobritishThermalUnitPerHour)]
+ [InlineData("kcal/h", PowerUnit.KilocaloriePerHour)]
[InlineData("kJ/h", PowerUnit.KilojoulePerHour)]
[InlineData("kW", PowerUnit.Kilowatt)]
[InlineData("hp(I)", PowerUnit.MechanicalHorsepower)]
[InlineData("MBtu/h", PowerUnit.MegabritishThermalUnitPerHour)]
[InlineData("MBtu/hr", PowerUnit.MegabritishThermalUnitPerHour)]
+ [InlineData("Mcal/h", PowerUnit.MegacaloriePerHour)]
[InlineData("MJ/h", PowerUnit.MegajoulePerHour)]
[InlineData("MW", PowerUnit.Megawatt)]
[InlineData("hp(M)", PowerUnit.MetricHorsepower)]
@@ -934,21 +1030,25 @@ public void ParseUnit_WithUsEnglishCurrentCulture(string abbreviation, PowerUnit
[InlineData("hp(S)", PowerUnit.BoilerHorsepower)]
[InlineData("Btu/h", PowerUnit.BritishThermalUnitPerHour)]
[InlineData("Btu/hr", PowerUnit.BritishThermalUnitPerHour)]
+ [InlineData("cal/h", PowerUnit.CaloriePerHour)]
[InlineData("daW", PowerUnit.Decawatt)]
[InlineData("dW", PowerUnit.Deciwatt)]
[InlineData("hp(E)", PowerUnit.ElectricalHorsepower)]
[InlineData("fW", PowerUnit.Femtowatt)]
+ [InlineData("Gcal/h", PowerUnit.GigacaloriePerHour)]
[InlineData("GJ/h", PowerUnit.GigajoulePerHour)]
[InlineData("GW", PowerUnit.Gigawatt)]
[InlineData("hp(H)", PowerUnit.HydraulicHorsepower)]
[InlineData("J/h", PowerUnit.JoulePerHour)]
[InlineData("kBtu/h", PowerUnit.KilobritishThermalUnitPerHour)]
[InlineData("kBtu/hr", PowerUnit.KilobritishThermalUnitPerHour)]
+ [InlineData("kcal/h", PowerUnit.KilocaloriePerHour)]
[InlineData("kJ/h", PowerUnit.KilojoulePerHour)]
[InlineData("kW", PowerUnit.Kilowatt)]
[InlineData("hp(I)", PowerUnit.MechanicalHorsepower)]
[InlineData("MBtu/h", PowerUnit.MegabritishThermalUnitPerHour)]
[InlineData("MBtu/hr", PowerUnit.MegabritishThermalUnitPerHour)]
+ [InlineData("Mcal/h", PowerUnit.MegacaloriePerHour)]
[InlineData("MJ/h", PowerUnit.MegajoulePerHour)]
[InlineData("MW", PowerUnit.Megawatt)]
[InlineData("hp(M)", PowerUnit.MetricHorsepower)]
@@ -973,21 +1073,25 @@ public void ParseUnit_WithUnsupportedCurrentCulture_FallsBackToUsEnglish(string
[InlineData("en-US", "hp(S)", PowerUnit.BoilerHorsepower)]
[InlineData("en-US", "Btu/h", PowerUnit.BritishThermalUnitPerHour)]
[InlineData("en-US", "Btu/hr", PowerUnit.BritishThermalUnitPerHour)]
+ [InlineData("en-US", "cal/h", PowerUnit.CaloriePerHour)]
[InlineData("en-US", "daW", PowerUnit.Decawatt)]
[InlineData("en-US", "dW", PowerUnit.Deciwatt)]
[InlineData("en-US", "hp(E)", PowerUnit.ElectricalHorsepower)]
[InlineData("en-US", "fW", PowerUnit.Femtowatt)]
+ [InlineData("en-US", "Gcal/h", PowerUnit.GigacaloriePerHour)]
[InlineData("en-US", "GJ/h", PowerUnit.GigajoulePerHour)]
[InlineData("en-US", "GW", PowerUnit.Gigawatt)]
[InlineData("en-US", "hp(H)", PowerUnit.HydraulicHorsepower)]
[InlineData("en-US", "J/h", PowerUnit.JoulePerHour)]
[InlineData("en-US", "kBtu/h", PowerUnit.KilobritishThermalUnitPerHour)]
[InlineData("en-US", "kBtu/hr", PowerUnit.KilobritishThermalUnitPerHour)]
+ [InlineData("en-US", "kcal/h", PowerUnit.KilocaloriePerHour)]
[InlineData("en-US", "kJ/h", PowerUnit.KilojoulePerHour)]
[InlineData("en-US", "kW", PowerUnit.Kilowatt)]
[InlineData("en-US", "hp(I)", PowerUnit.MechanicalHorsepower)]
[InlineData("en-US", "MBtu/h", PowerUnit.MegabritishThermalUnitPerHour)]
[InlineData("en-US", "MBtu/hr", PowerUnit.MegabritishThermalUnitPerHour)]
+ [InlineData("en-US", "Mcal/h", PowerUnit.MegacaloriePerHour)]
[InlineData("en-US", "MJ/h", PowerUnit.MegajoulePerHour)]
[InlineData("en-US", "MW", PowerUnit.Megawatt)]
[InlineData("en-US", "hp(M)", PowerUnit.MetricHorsepower)]
@@ -1011,21 +1115,25 @@ public void ParseUnit_WithCurrentCulture(string culture, string abbreviation, Po
[InlineData("en-US", "hp(S)", PowerUnit.BoilerHorsepower)]
[InlineData("en-US", "Btu/h", PowerUnit.BritishThermalUnitPerHour)]
[InlineData("en-US", "Btu/hr", PowerUnit.BritishThermalUnitPerHour)]
+ [InlineData("en-US", "cal/h", PowerUnit.CaloriePerHour)]
[InlineData("en-US", "daW", PowerUnit.Decawatt)]
[InlineData("en-US", "dW", PowerUnit.Deciwatt)]
[InlineData("en-US", "hp(E)", PowerUnit.ElectricalHorsepower)]
[InlineData("en-US", "fW", PowerUnit.Femtowatt)]
+ [InlineData("en-US", "Gcal/h", PowerUnit.GigacaloriePerHour)]
[InlineData("en-US", "GJ/h", PowerUnit.GigajoulePerHour)]
[InlineData("en-US", "GW", PowerUnit.Gigawatt)]
[InlineData("en-US", "hp(H)", PowerUnit.HydraulicHorsepower)]
[InlineData("en-US", "J/h", PowerUnit.JoulePerHour)]
[InlineData("en-US", "kBtu/h", PowerUnit.KilobritishThermalUnitPerHour)]
[InlineData("en-US", "kBtu/hr", PowerUnit.KilobritishThermalUnitPerHour)]
+ [InlineData("en-US", "kcal/h", PowerUnit.KilocaloriePerHour)]
[InlineData("en-US", "kJ/h", PowerUnit.KilojoulePerHour)]
[InlineData("en-US", "kW", PowerUnit.Kilowatt)]
[InlineData("en-US", "hp(I)", PowerUnit.MechanicalHorsepower)]
[InlineData("en-US", "MBtu/h", PowerUnit.MegabritishThermalUnitPerHour)]
[InlineData("en-US", "MBtu/hr", PowerUnit.MegabritishThermalUnitPerHour)]
+ [InlineData("en-US", "Mcal/h", PowerUnit.MegacaloriePerHour)]
[InlineData("en-US", "MJ/h", PowerUnit.MegajoulePerHour)]
[InlineData("en-US", "MW", PowerUnit.Megawatt)]
[InlineData("en-US", "hp(M)", PowerUnit.MetricHorsepower)]
@@ -1048,21 +1156,25 @@ public void ParseUnit_WithCulture(string culture, string abbreviation, PowerUnit
[InlineData("hp(S)", PowerUnit.BoilerHorsepower)]
[InlineData("Btu/h", PowerUnit.BritishThermalUnitPerHour)]
[InlineData("Btu/hr", PowerUnit.BritishThermalUnitPerHour)]
+ [InlineData("cal/h", PowerUnit.CaloriePerHour)]
[InlineData("daW", PowerUnit.Decawatt)]
[InlineData("dW", PowerUnit.Deciwatt)]
[InlineData("hp(E)", PowerUnit.ElectricalHorsepower)]
[InlineData("fW", PowerUnit.Femtowatt)]
+ [InlineData("Gcal/h", PowerUnit.GigacaloriePerHour)]
[InlineData("GJ/h", PowerUnit.GigajoulePerHour)]
[InlineData("GW", PowerUnit.Gigawatt)]
[InlineData("hp(H)", PowerUnit.HydraulicHorsepower)]
[InlineData("J/h", PowerUnit.JoulePerHour)]
[InlineData("kBtu/h", PowerUnit.KilobritishThermalUnitPerHour)]
[InlineData("kBtu/hr", PowerUnit.KilobritishThermalUnitPerHour)]
+ [InlineData("kcal/h", PowerUnit.KilocaloriePerHour)]
[InlineData("kJ/h", PowerUnit.KilojoulePerHour)]
[InlineData("kW", PowerUnit.Kilowatt)]
[InlineData("hp(I)", PowerUnit.MechanicalHorsepower)]
[InlineData("MBtu/h", PowerUnit.MegabritishThermalUnitPerHour)]
[InlineData("MBtu/hr", PowerUnit.MegabritishThermalUnitPerHour)]
+ [InlineData("Mcal/h", PowerUnit.MegacaloriePerHour)]
[InlineData("MJ/h", PowerUnit.MegajoulePerHour)]
[InlineData("MW", PowerUnit.Megawatt)]
[InlineData("hp(M)", PowerUnit.MetricHorsepower)]
@@ -1087,21 +1199,25 @@ public void TryParseUnit_WithUsEnglishCurrentCulture(string abbreviation, PowerU
[InlineData("hp(S)", PowerUnit.BoilerHorsepower)]
[InlineData("Btu/h", PowerUnit.BritishThermalUnitPerHour)]
[InlineData("Btu/hr", PowerUnit.BritishThermalUnitPerHour)]
+ [InlineData("cal/h", PowerUnit.CaloriePerHour)]
[InlineData("daW", PowerUnit.Decawatt)]
[InlineData("dW", PowerUnit.Deciwatt)]
[InlineData("hp(E)", PowerUnit.ElectricalHorsepower)]
[InlineData("fW", PowerUnit.Femtowatt)]
+ [InlineData("Gcal/h", PowerUnit.GigacaloriePerHour)]
[InlineData("GJ/h", PowerUnit.GigajoulePerHour)]
[InlineData("GW", PowerUnit.Gigawatt)]
[InlineData("hp(H)", PowerUnit.HydraulicHorsepower)]
[InlineData("J/h", PowerUnit.JoulePerHour)]
[InlineData("kBtu/h", PowerUnit.KilobritishThermalUnitPerHour)]
[InlineData("kBtu/hr", PowerUnit.KilobritishThermalUnitPerHour)]
+ [InlineData("kcal/h", PowerUnit.KilocaloriePerHour)]
[InlineData("kJ/h", PowerUnit.KilojoulePerHour)]
[InlineData("kW", PowerUnit.Kilowatt)]
[InlineData("hp(I)", PowerUnit.MechanicalHorsepower)]
[InlineData("MBtu/h", PowerUnit.MegabritishThermalUnitPerHour)]
[InlineData("MBtu/hr", PowerUnit.MegabritishThermalUnitPerHour)]
+ [InlineData("Mcal/h", PowerUnit.MegacaloriePerHour)]
[InlineData("MJ/h", PowerUnit.MegajoulePerHour)]
[InlineData("MW", PowerUnit.Megawatt)]
[InlineData("hp(M)", PowerUnit.MetricHorsepower)]
@@ -1126,21 +1242,25 @@ public void TryParseUnit_WithUnsupportedCurrentCulture_FallsBackToUsEnglish(stri
[InlineData("en-US", "hp(S)", PowerUnit.BoilerHorsepower)]
[InlineData("en-US", "Btu/h", PowerUnit.BritishThermalUnitPerHour)]
[InlineData("en-US", "Btu/hr", PowerUnit.BritishThermalUnitPerHour)]
+ [InlineData("en-US", "cal/h", PowerUnit.CaloriePerHour)]
[InlineData("en-US", "daW", PowerUnit.Decawatt)]
[InlineData("en-US", "dW", PowerUnit.Deciwatt)]
[InlineData("en-US", "hp(E)", PowerUnit.ElectricalHorsepower)]
[InlineData("en-US", "fW", PowerUnit.Femtowatt)]
+ [InlineData("en-US", "Gcal/h", PowerUnit.GigacaloriePerHour)]
[InlineData("en-US", "GJ/h", PowerUnit.GigajoulePerHour)]
[InlineData("en-US", "GW", PowerUnit.Gigawatt)]
[InlineData("en-US", "hp(H)", PowerUnit.HydraulicHorsepower)]
[InlineData("en-US", "J/h", PowerUnit.JoulePerHour)]
[InlineData("en-US", "kBtu/h", PowerUnit.KilobritishThermalUnitPerHour)]
[InlineData("en-US", "kBtu/hr", PowerUnit.KilobritishThermalUnitPerHour)]
+ [InlineData("en-US", "kcal/h", PowerUnit.KilocaloriePerHour)]
[InlineData("en-US", "kJ/h", PowerUnit.KilojoulePerHour)]
[InlineData("en-US", "kW", PowerUnit.Kilowatt)]
[InlineData("en-US", "hp(I)", PowerUnit.MechanicalHorsepower)]
[InlineData("en-US", "MBtu/h", PowerUnit.MegabritishThermalUnitPerHour)]
[InlineData("en-US", "MBtu/hr", PowerUnit.MegabritishThermalUnitPerHour)]
+ [InlineData("en-US", "Mcal/h", PowerUnit.MegacaloriePerHour)]
[InlineData("en-US", "MJ/h", PowerUnit.MegajoulePerHour)]
[InlineData("en-US", "MW", PowerUnit.Megawatt)]
[InlineData("en-US", "hp(M)", PowerUnit.MetricHorsepower)]
@@ -1164,21 +1284,25 @@ public void TryParseUnit_WithCurrentCulture(string culture, string abbreviation,
[InlineData("en-US", "hp(S)", PowerUnit.BoilerHorsepower)]
[InlineData("en-US", "Btu/h", PowerUnit.BritishThermalUnitPerHour)]
[InlineData("en-US", "Btu/hr", PowerUnit.BritishThermalUnitPerHour)]
+ [InlineData("en-US", "cal/h", PowerUnit.CaloriePerHour)]
[InlineData("en-US", "daW", PowerUnit.Decawatt)]
[InlineData("en-US", "dW", PowerUnit.Deciwatt)]
[InlineData("en-US", "hp(E)", PowerUnit.ElectricalHorsepower)]
[InlineData("en-US", "fW", PowerUnit.Femtowatt)]
+ [InlineData("en-US", "Gcal/h", PowerUnit.GigacaloriePerHour)]
[InlineData("en-US", "GJ/h", PowerUnit.GigajoulePerHour)]
[InlineData("en-US", "GW", PowerUnit.Gigawatt)]
[InlineData("en-US", "hp(H)", PowerUnit.HydraulicHorsepower)]
[InlineData("en-US", "J/h", PowerUnit.JoulePerHour)]
[InlineData("en-US", "kBtu/h", PowerUnit.KilobritishThermalUnitPerHour)]
[InlineData("en-US", "kBtu/hr", PowerUnit.KilobritishThermalUnitPerHour)]
+ [InlineData("en-US", "kcal/h", PowerUnit.KilocaloriePerHour)]
[InlineData("en-US", "kJ/h", PowerUnit.KilojoulePerHour)]
[InlineData("en-US", "kW", PowerUnit.Kilowatt)]
[InlineData("en-US", "hp(I)", PowerUnit.MechanicalHorsepower)]
[InlineData("en-US", "MBtu/h", PowerUnit.MegabritishThermalUnitPerHour)]
[InlineData("en-US", "MBtu/hr", PowerUnit.MegabritishThermalUnitPerHour)]
+ [InlineData("en-US", "Mcal/h", PowerUnit.MegacaloriePerHour)]
[InlineData("en-US", "MJ/h", PowerUnit.MegajoulePerHour)]
[InlineData("en-US", "MW", PowerUnit.Megawatt)]
[InlineData("en-US", "hp(M)", PowerUnit.MetricHorsepower)]
@@ -1264,19 +1388,23 @@ public void ConversionRoundTrip()
Power watt = Power.FromWatts(1);
AssertEx.EqualTolerance(1, Power.FromBoilerHorsepower(watt.BoilerHorsepower).Watts, BoilerHorsepowerTolerance);
AssertEx.EqualTolerance(1, Power.FromBritishThermalUnitsPerHour(watt.BritishThermalUnitsPerHour).Watts, BritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(1, Power.FromCaloriesPerHour(watt.CaloriesPerHour).Watts, CaloriesPerHourTolerance);
AssertEx.EqualTolerance(1, Power.FromDecawatts(watt.Decawatts).Watts, DecawattsTolerance);
AssertEx.EqualTolerance(1, Power.FromDeciwatts(watt.Deciwatts).Watts, DeciwattsTolerance);
AssertEx.EqualTolerance(1, Power.FromElectricalHorsepower(watt.ElectricalHorsepower).Watts, ElectricalHorsepowerTolerance);
AssertEx.EqualTolerance(1, Power.FromFemtowatts(watt.Femtowatts).Watts, FemtowattsTolerance);
+ AssertEx.EqualTolerance(1, Power.FromGigacaloriesPerHour(watt.GigacaloriesPerHour).Watts, GigacaloriesPerHourTolerance);
AssertEx.EqualTolerance(1, Power.FromGigajoulesPerHour(watt.GigajoulesPerHour).Watts, GigajoulesPerHourTolerance);
AssertEx.EqualTolerance(1, Power.FromGigawatts(watt.Gigawatts).Watts, GigawattsTolerance);
AssertEx.EqualTolerance(1, Power.FromHydraulicHorsepower(watt.HydraulicHorsepower).Watts, HydraulicHorsepowerTolerance);
AssertEx.EqualTolerance(1, Power.FromJoulesPerHour(watt.JoulesPerHour).Watts, JoulesPerHourTolerance);
AssertEx.EqualTolerance(1, Power.FromKilobritishThermalUnitsPerHour(watt.KilobritishThermalUnitsPerHour).Watts, KilobritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(1, Power.FromKilocaloriesPerHour(watt.KilocaloriesPerHour).Watts, KilocaloriesPerHourTolerance);
AssertEx.EqualTolerance(1, Power.FromKilojoulesPerHour(watt.KilojoulesPerHour).Watts, KilojoulesPerHourTolerance);
AssertEx.EqualTolerance(1, Power.FromKilowatts(watt.Kilowatts).Watts, KilowattsTolerance);
AssertEx.EqualTolerance(1, Power.FromMechanicalHorsepower(watt.MechanicalHorsepower).Watts, MechanicalHorsepowerTolerance);
AssertEx.EqualTolerance(1, Power.FromMegabritishThermalUnitsPerHour(watt.MegabritishThermalUnitsPerHour).Watts, MegabritishThermalUnitsPerHourTolerance);
+ AssertEx.EqualTolerance(1, Power.FromMegacaloriesPerHour(watt.MegacaloriesPerHour).Watts, MegacaloriesPerHourTolerance);
AssertEx.EqualTolerance(1, Power.FromMegajoulesPerHour(watt.MegajoulesPerHour).Watts, MegajoulesPerHourTolerance);
AssertEx.EqualTolerance(1, Power.FromMegawatts(watt.Megawatts).Watts, MegawattsTolerance);
AssertEx.EqualTolerance(1, Power.FromMetricHorsepower(watt.MetricHorsepower).Watts, MetricHorsepowerTolerance);
@@ -1438,19 +1566,23 @@ public void ToString_ReturnsValueAndUnitAbbreviationInCurrentCulture()
using var _ = new CultureScope("en-US");
Assert.Equal("1 hp(S)", new Power(1, PowerUnit.BoilerHorsepower).ToString());
Assert.Equal("1 Btu/h", new Power(1, PowerUnit.BritishThermalUnitPerHour).ToString());
+ Assert.Equal("1 cal/h", new Power(1, PowerUnit.CaloriePerHour).ToString());
Assert.Equal("1 daW", new Power(1, PowerUnit.Decawatt).ToString());
Assert.Equal("1 dW", new Power(1, PowerUnit.Deciwatt).ToString());
Assert.Equal("1 hp(E)", new Power(1, PowerUnit.ElectricalHorsepower).ToString());
Assert.Equal("1 fW", new Power(1, PowerUnit.Femtowatt).ToString());
+ Assert.Equal("1 Gcal/h", new Power(1, PowerUnit.GigacaloriePerHour).ToString());
Assert.Equal("1 GJ/h", new Power(1, PowerUnit.GigajoulePerHour).ToString());
Assert.Equal("1 GW", new Power(1, PowerUnit.Gigawatt).ToString());
Assert.Equal("1 hp(H)", new Power(1, PowerUnit.HydraulicHorsepower).ToString());
Assert.Equal("1 J/h", new Power(1, PowerUnit.JoulePerHour).ToString());
Assert.Equal("1 kBtu/h", new Power(1, PowerUnit.KilobritishThermalUnitPerHour).ToString());
+ Assert.Equal("1 kcal/h", new Power(1, PowerUnit.KilocaloriePerHour).ToString());
Assert.Equal("1 kJ/h", new Power(1, PowerUnit.KilojoulePerHour).ToString());
Assert.Equal("1 kW", new Power(1, PowerUnit.Kilowatt).ToString());
Assert.Equal("1 hp(I)", new Power(1, PowerUnit.MechanicalHorsepower).ToString());
Assert.Equal("1 MBtu/h", new Power(1, PowerUnit.MegabritishThermalUnitPerHour).ToString());
+ Assert.Equal("1 Mcal/h", new Power(1, PowerUnit.MegacaloriePerHour).ToString());
Assert.Equal("1 MJ/h", new Power(1, PowerUnit.MegajoulePerHour).ToString());
Assert.Equal("1 MW", new Power(1, PowerUnit.Megawatt).ToString());
Assert.Equal("1 hp(M)", new Power(1, PowerUnit.MetricHorsepower).ToString());
@@ -1473,19 +1605,23 @@ public void ToString_WithSwedishCulture_ReturnsUnitAbbreviationForEnglishCulture
Assert.Equal("1 hp(S)", new Power(1, PowerUnit.BoilerHorsepower).ToString(swedishCulture));
Assert.Equal("1 Btu/h", new Power(1, PowerUnit.BritishThermalUnitPerHour).ToString(swedishCulture));
+ Assert.Equal("1 cal/h", new Power(1, PowerUnit.CaloriePerHour).ToString(swedishCulture));
Assert.Equal("1 daW", new Power(1, PowerUnit.Decawatt).ToString(swedishCulture));
Assert.Equal("1 dW", new Power(1, PowerUnit.Deciwatt).ToString(swedishCulture));
Assert.Equal("1 hp(E)", new Power(1, PowerUnit.ElectricalHorsepower).ToString(swedishCulture));
Assert.Equal("1 fW", new Power(1, PowerUnit.Femtowatt).ToString(swedishCulture));
+ Assert.Equal("1 Gcal/h", new Power(1, PowerUnit.GigacaloriePerHour).ToString(swedishCulture));
Assert.Equal("1 GJ/h", new Power(1, PowerUnit.GigajoulePerHour).ToString(swedishCulture));
Assert.Equal("1 GW", new Power(1, PowerUnit.Gigawatt).ToString(swedishCulture));
Assert.Equal("1 hp(H)", new Power(1, PowerUnit.HydraulicHorsepower).ToString(swedishCulture));
Assert.Equal("1 J/h", new Power(1, PowerUnit.JoulePerHour).ToString(swedishCulture));
Assert.Equal("1 kBtu/h", new Power(1, PowerUnit.KilobritishThermalUnitPerHour).ToString(swedishCulture));
+ Assert.Equal("1 kcal/h", new Power(1, PowerUnit.KilocaloriePerHour).ToString(swedishCulture));
Assert.Equal("1 kJ/h", new Power(1, PowerUnit.KilojoulePerHour).ToString(swedishCulture));
Assert.Equal("1 kW", new Power(1, PowerUnit.Kilowatt).ToString(swedishCulture));
Assert.Equal("1 hp(I)", new Power(1, PowerUnit.MechanicalHorsepower).ToString(swedishCulture));
Assert.Equal("1 MBtu/h", new Power(1, PowerUnit.MegabritishThermalUnitPerHour).ToString(swedishCulture));
+ Assert.Equal("1 Mcal/h", new Power(1, PowerUnit.MegacaloriePerHour).ToString(swedishCulture));
Assert.Equal("1 MJ/h", new Power(1, PowerUnit.MegajoulePerHour).ToString(swedishCulture));
Assert.Equal("1 MW", new Power(1, PowerUnit.Megawatt).ToString(swedishCulture));
Assert.Equal("1 hp(M)", new Power(1, PowerUnit.MetricHorsepower).ToString(swedishCulture));
diff --git a/UnitsNet/GeneratedCode/Quantities/Power.g.cs b/UnitsNet/GeneratedCode/Quantities/Power.g.cs
index 6c8b2cb6a7..5f97eafc4f 100644
--- a/UnitsNet/GeneratedCode/Quantities/Power.g.cs
+++ b/UnitsNet/GeneratedCode/Quantities/Power.g.cs
@@ -91,19 +91,23 @@ static Power()
{
new UnitInfo(PowerUnit.BoilerHorsepower, "BoilerHorsepower", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.BritishThermalUnitPerHour, "BritishThermalUnitsPerHour", BaseUnits.Undefined, "Power"),
+ new UnitInfo(PowerUnit.CaloriePerHour, "CaloriesPerHour", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.Decawatt, "Decawatts", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.Deciwatt, "Deciwatts", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Hectogram, time: DurationUnit.Second), "Power"),
new UnitInfo(PowerUnit.ElectricalHorsepower, "ElectricalHorsepower", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.Femtowatt, "Femtowatts", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Picogram, time: DurationUnit.Second), "Power"),
+ new UnitInfo(PowerUnit.GigacaloriePerHour, "GigacaloriesPerHour", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.GigajoulePerHour, "GigajoulesPerHour", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.Gigawatt, "Gigawatts", new BaseUnits(length: LengthUnit.Meter, mass: MassUnit.Kilogram, time: DurationUnit.Millisecond), "Power"),
new UnitInfo(PowerUnit.HydraulicHorsepower, "HydraulicHorsepower", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.JoulePerHour, "JoulesPerHour", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.KilobritishThermalUnitPerHour, "KilobritishThermalUnitsPerHour", BaseUnits.Undefined, "Power"),
+ new UnitInfo(PowerUnit.KilocaloriePerHour, "KilocaloriesPerHour", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.KilojoulePerHour, "KilojoulesPerHour", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.Kilowatt, "Kilowatts", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.MechanicalHorsepower, "MechanicalHorsepower", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.MegabritishThermalUnitPerHour, "MegabritishThermalUnitsPerHour", BaseUnits.Undefined, "Power"),
+ new UnitInfo(PowerUnit.MegacaloriePerHour, "MegacaloriesPerHour", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.MegajoulePerHour, "MegajoulesPerHour", BaseUnits.Undefined, "Power"),
new UnitInfo(PowerUnit.Megawatt, "Megawatts", new BaseUnits(length: LengthUnit.Kilometer, mass: MassUnit.Kilogram, time: DurationUnit.Second), "Power"),
new UnitInfo(PowerUnit.MetricHorsepower, "MetricHorsepower", BaseUnits.Undefined, "Power"),
@@ -223,6 +227,11 @@ public Power(double value, UnitSystem unitSystem)
///
public double BritishThermalUnitsPerHour => As(PowerUnit.BritishThermalUnitPerHour);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double CaloriesPerHour => As(PowerUnit.CaloriePerHour);
+
///
/// Gets a value of this quantity converted into
///
@@ -243,6 +252,11 @@ public Power(double value, UnitSystem unitSystem)
///
public double Femtowatts => As(PowerUnit.Femtowatt);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double GigacaloriesPerHour => As(PowerUnit.GigacaloriePerHour);
+
///
/// Gets a value of this quantity converted into
///
@@ -268,6 +282,11 @@ public Power(double value, UnitSystem unitSystem)
///
public double KilobritishThermalUnitsPerHour => As(PowerUnit.KilobritishThermalUnitPerHour);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double KilocaloriesPerHour => As(PowerUnit.KilocaloriePerHour);
+
///
/// Gets a value of this quantity converted into
///
@@ -288,6 +307,11 @@ public Power(double value, UnitSystem unitSystem)
///
public double MegabritishThermalUnitsPerHour => As(PowerUnit.MegabritishThermalUnitPerHour);
+ ///
+ /// Gets a value of this quantity converted into
+ ///
+ public double MegacaloriesPerHour => As(PowerUnit.MegacaloriePerHour);
+
///
/// Gets a value of this quantity converted into
///
@@ -361,19 +385,23 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
// Register in unit converter: PowerUnit -> BaseUnit
unitConverter.SetConversionFunction(PowerUnit.BoilerHorsepower, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.BritishThermalUnitPerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
+ unitConverter.SetConversionFunction(PowerUnit.CaloriePerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.Decawatt, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.Deciwatt, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.ElectricalHorsepower, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.Femtowatt, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
+ unitConverter.SetConversionFunction(PowerUnit.GigacaloriePerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.GigajoulePerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.Gigawatt, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.HydraulicHorsepower, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.JoulePerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.KilobritishThermalUnitPerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
+ unitConverter.SetConversionFunction(PowerUnit.KilocaloriePerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.KilojoulePerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.Kilowatt, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.MechanicalHorsepower, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.MegabritishThermalUnitPerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
+ unitConverter.SetConversionFunction(PowerUnit.MegacaloriePerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.MegajoulePerHour, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.Megawatt, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
unitConverter.SetConversionFunction(PowerUnit.MetricHorsepower, PowerUnit.Watt, quantity => quantity.ToUnit(PowerUnit.Watt));
@@ -392,19 +420,23 @@ internal static void RegisterDefaultConversions(UnitConverter unitConverter)
// Register in unit converter: BaseUnit -> PowerUnit
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.BoilerHorsepower, quantity => quantity.ToUnit(PowerUnit.BoilerHorsepower));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.BritishThermalUnitPerHour, quantity => quantity.ToUnit(PowerUnit.BritishThermalUnitPerHour));
+ unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.CaloriePerHour, quantity => quantity.ToUnit(PowerUnit.CaloriePerHour));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Decawatt, quantity => quantity.ToUnit(PowerUnit.Decawatt));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Deciwatt, quantity => quantity.ToUnit(PowerUnit.Deciwatt));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.ElectricalHorsepower, quantity => quantity.ToUnit(PowerUnit.ElectricalHorsepower));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Femtowatt, quantity => quantity.ToUnit(PowerUnit.Femtowatt));
+ unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.GigacaloriePerHour, quantity => quantity.ToUnit(PowerUnit.GigacaloriePerHour));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.GigajoulePerHour, quantity => quantity.ToUnit(PowerUnit.GigajoulePerHour));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Gigawatt, quantity => quantity.ToUnit(PowerUnit.Gigawatt));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.HydraulicHorsepower, quantity => quantity.ToUnit(PowerUnit.HydraulicHorsepower));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.JoulePerHour, quantity => quantity.ToUnit(PowerUnit.JoulePerHour));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.KilobritishThermalUnitPerHour, quantity => quantity.ToUnit(PowerUnit.KilobritishThermalUnitPerHour));
+ unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.KilocaloriePerHour, quantity => quantity.ToUnit(PowerUnit.KilocaloriePerHour));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.KilojoulePerHour, quantity => quantity.ToUnit(PowerUnit.KilojoulePerHour));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Kilowatt, quantity => quantity.ToUnit(PowerUnit.Kilowatt));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.MechanicalHorsepower, quantity => quantity.ToUnit(PowerUnit.MechanicalHorsepower));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.MegabritishThermalUnitPerHour, quantity => quantity.ToUnit(PowerUnit.MegabritishThermalUnitPerHour));
+ unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.MegacaloriePerHour, quantity => quantity.ToUnit(PowerUnit.MegacaloriePerHour));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.MegajoulePerHour, quantity => quantity.ToUnit(PowerUnit.MegajoulePerHour));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.Megawatt, quantity => quantity.ToUnit(PowerUnit.Megawatt));
unitConverter.SetConversionFunction(PowerUnit.Watt, PowerUnit.MetricHorsepower, quantity => quantity.ToUnit(PowerUnit.MetricHorsepower));
@@ -459,6 +491,14 @@ public static Power FromBritishThermalUnitsPerHour(double value)
return new Power(value, PowerUnit.BritishThermalUnitPerHour);
}
+ ///
+ /// Creates a from .
+ ///
+ public static Power FromCaloriesPerHour(double value)
+ {
+ return new Power(value, PowerUnit.CaloriePerHour);
+ }
+
///
/// Creates a from .
///
@@ -491,6 +531,14 @@ public static Power FromFemtowatts(double value)
return new Power(value, PowerUnit.Femtowatt);
}
+ ///
+ /// Creates a from .
+ ///
+ public static Power FromGigacaloriesPerHour(double value)
+ {
+ return new Power(value, PowerUnit.GigacaloriePerHour);
+ }
+
///
/// Creates a from .
///
@@ -531,6 +579,14 @@ public static Power FromKilobritishThermalUnitsPerHour(double value)
return new Power(value, PowerUnit.KilobritishThermalUnitPerHour);
}
+ ///
+ /// Creates a from .
+ ///
+ public static Power FromKilocaloriesPerHour(double value)
+ {
+ return new Power(value, PowerUnit.KilocaloriePerHour);
+ }
+
///
/// Creates a from .
///
@@ -563,6 +619,14 @@ public static Power FromMegabritishThermalUnitsPerHour(double value)
return new Power(value, PowerUnit.MegabritishThermalUnitPerHour);
}
+ ///
+ /// Creates a from .
+ ///
+ public static Power FromMegacaloriesPerHour(double value)
+ {
+ return new Power(value, PowerUnit.MegacaloriePerHour);
+ }
+
///
/// Creates a from .
///
@@ -1215,19 +1279,23 @@ private bool TryToUnit(PowerUnit unit, [NotNullWhen(true)] out Power? converted)
// PowerUnit -> BaseUnit
(PowerUnit.BoilerHorsepower, PowerUnit.Watt) => new Power(_value * 9812.5, PowerUnit.Watt),
(PowerUnit.BritishThermalUnitPerHour, PowerUnit.Watt) => new Power(_value * 1055.05585262 / 3600, PowerUnit.Watt),
+ (PowerUnit.CaloriePerHour, PowerUnit.Watt) => new Power(_value / 859.8452279, PowerUnit.Watt),
(PowerUnit.Decawatt, PowerUnit.Watt) => new Power((_value) * 1e1d, PowerUnit.Watt),
(PowerUnit.Deciwatt, PowerUnit.Watt) => new Power((_value) * 1e-1d, PowerUnit.Watt),
(PowerUnit.ElectricalHorsepower, PowerUnit.Watt) => new Power(_value * 746, PowerUnit.Watt),
(PowerUnit.Femtowatt, PowerUnit.Watt) => new Power((_value) * 1e-15d, PowerUnit.Watt),
+ (PowerUnit.GigacaloriePerHour, PowerUnit.Watt) => new Power((_value / 859.8452279) * 1e9d, PowerUnit.Watt),
(PowerUnit.GigajoulePerHour, PowerUnit.Watt) => new Power((_value / 3600) * 1e9d, PowerUnit.Watt),
(PowerUnit.Gigawatt, PowerUnit.Watt) => new Power((_value) * 1e9d, PowerUnit.Watt),
(PowerUnit.HydraulicHorsepower, PowerUnit.Watt) => new Power(_value * 745.69987158227022, PowerUnit.Watt),
(PowerUnit.JoulePerHour, PowerUnit.Watt) => new Power(_value / 3600, PowerUnit.Watt),
(PowerUnit.KilobritishThermalUnitPerHour, PowerUnit.Watt) => new Power((_value * 1055.05585262 / 3600) * 1e3d, PowerUnit.Watt),
+ (PowerUnit.KilocaloriePerHour, PowerUnit.Watt) => new Power((_value / 859.8452279) * 1e3d, PowerUnit.Watt),
(PowerUnit.KilojoulePerHour, PowerUnit.Watt) => new Power((_value / 3600) * 1e3d, PowerUnit.Watt),
(PowerUnit.Kilowatt, PowerUnit.Watt) => new Power((_value) * 1e3d, PowerUnit.Watt),
(PowerUnit.MechanicalHorsepower, PowerUnit.Watt) => new Power(_value * 76.0402249 * 9.80665, PowerUnit.Watt),
(PowerUnit.MegabritishThermalUnitPerHour, PowerUnit.Watt) => new Power((_value * 1055.05585262 / 3600) * 1e6d, PowerUnit.Watt),
+ (PowerUnit.MegacaloriePerHour, PowerUnit.Watt) => new Power((_value / 859.8452279) * 1e6d, PowerUnit.Watt),
(PowerUnit.MegajoulePerHour, PowerUnit.Watt) => new Power((_value / 3600) * 1e6d, PowerUnit.Watt),
(PowerUnit.Megawatt, PowerUnit.Watt) => new Power((_value) * 1e6d, PowerUnit.Watt),
(PowerUnit.MetricHorsepower, PowerUnit.Watt) => new Power(_value * 75 * 9.80665, PowerUnit.Watt),
@@ -1243,19 +1311,23 @@ private bool TryToUnit(PowerUnit unit, [NotNullWhen(true)] out Power? converted)
// BaseUnit -> PowerUnit
(PowerUnit.Watt, PowerUnit.BoilerHorsepower) => new Power(_value / 9812.5, PowerUnit.BoilerHorsepower),
(PowerUnit.Watt, PowerUnit.BritishThermalUnitPerHour) => new Power(_value * 3600 / 1055.05585262, PowerUnit.BritishThermalUnitPerHour),
+ (PowerUnit.Watt, PowerUnit.CaloriePerHour) => new Power(_value * 859.8452279, PowerUnit.CaloriePerHour),
(PowerUnit.Watt, PowerUnit.Decawatt) => new Power((_value) / 1e1d, PowerUnit.Decawatt),
(PowerUnit.Watt, PowerUnit.Deciwatt) => new Power((_value) / 1e-1d, PowerUnit.Deciwatt),
(PowerUnit.Watt, PowerUnit.ElectricalHorsepower) => new Power(_value / 746, PowerUnit.ElectricalHorsepower),
(PowerUnit.Watt, PowerUnit.Femtowatt) => new Power((_value) / 1e-15d, PowerUnit.Femtowatt),
+ (PowerUnit.Watt, PowerUnit.GigacaloriePerHour) => new Power((_value * 859.8452279) / 1e9d, PowerUnit.GigacaloriePerHour),
(PowerUnit.Watt, PowerUnit.GigajoulePerHour) => new Power((_value * 3600) / 1e9d, PowerUnit.GigajoulePerHour),
(PowerUnit.Watt, PowerUnit.Gigawatt) => new Power((_value) / 1e9d, PowerUnit.Gigawatt),
(PowerUnit.Watt, PowerUnit.HydraulicHorsepower) => new Power(_value / 745.69987158227022, PowerUnit.HydraulicHorsepower),
(PowerUnit.Watt, PowerUnit.JoulePerHour) => new Power(_value * 3600, PowerUnit.JoulePerHour),
(PowerUnit.Watt, PowerUnit.KilobritishThermalUnitPerHour) => new Power((_value * 3600 / 1055.05585262) / 1e3d, PowerUnit.KilobritishThermalUnitPerHour),
+ (PowerUnit.Watt, PowerUnit.KilocaloriePerHour) => new Power((_value * 859.8452279) / 1e3d, PowerUnit.KilocaloriePerHour),
(PowerUnit.Watt, PowerUnit.KilojoulePerHour) => new Power((_value * 3600) / 1e3d, PowerUnit.KilojoulePerHour),
(PowerUnit.Watt, PowerUnit.Kilowatt) => new Power((_value) / 1e3d, PowerUnit.Kilowatt),
(PowerUnit.Watt, PowerUnit.MechanicalHorsepower) => new Power(_value / (76.0402249 * 9.80665), PowerUnit.MechanicalHorsepower),
(PowerUnit.Watt, PowerUnit.MegabritishThermalUnitPerHour) => new Power((_value * 3600 / 1055.05585262) / 1e6d, PowerUnit.MegabritishThermalUnitPerHour),
+ (PowerUnit.Watt, PowerUnit.MegacaloriePerHour) => new Power((_value * 859.8452279) / 1e6d, PowerUnit.MegacaloriePerHour),
(PowerUnit.Watt, PowerUnit.MegajoulePerHour) => new Power((_value * 3600) / 1e6d, PowerUnit.MegajoulePerHour),
(PowerUnit.Watt, PowerUnit.Megawatt) => new Power((_value) / 1e6d, PowerUnit.Megawatt),
(PowerUnit.Watt, PowerUnit.MetricHorsepower) => new Power(_value / (75 * 9.80665), PowerUnit.MetricHorsepower),
diff --git a/UnitsNet/GeneratedCode/Resources/Power.restext b/UnitsNet/GeneratedCode/Resources/Power.restext
index a9f68096c3..e09926df24 100644
--- a/UnitsNet/GeneratedCode/Resources/Power.restext
+++ b/UnitsNet/GeneratedCode/Resources/Power.restext
@@ -1,18 +1,22 @@
BoilerHorsepower=hp(S)
BritishThermalUnitsPerHour=Btu/h,Btu/hr
+CaloriesPerHour=cal/h
Decawatts=daW
Deciwatts=dW
ElectricalHorsepower=hp(E)
Femtowatts=fW
+GigacaloriesPerHour=Gcal/h
GigajoulesPerHour=GJ/h
Gigawatts=GW
HydraulicHorsepower=hp(H)
JoulesPerHour=J/h
KilobritishThermalUnitsPerHour=kBtu/h,kBtu/hr
+KilocaloriesPerHour=kcal/h
KilojoulesPerHour=kJ/h
Kilowatts=kW
MechanicalHorsepower=hp(I)
MegabritishThermalUnitsPerHour=MBtu/h,MBtu/hr
+MegacaloriesPerHour=Mcal/h
MegajoulesPerHour=MJ/h
Megawatts=MW
MetricHorsepower=hp(M)
diff --git a/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs b/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs
index c0ddfe10ec..b9be8c883e 100644
--- a/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs
+++ b/UnitsNet/GeneratedCode/Units/PowerUnit.g.cs
@@ -33,6 +33,7 @@ public enum PowerUnit
BoilerHorsepower = 1,
/// Based on the International Table (IT) definition of the British thermal unit (BTU), where 1 BTU is defined as exactly 1055.05585262 joules (≈1.05506 kJ). See https://en.wikipedia.org/wiki/British_thermal_unit for details.
BritishThermalUnitPerHour = 2,
+ CaloriePerHour = 33,
Decawatt = 3,
Deciwatt = 4,
@@ -42,6 +43,7 @@ public enum PowerUnit
/// https://en.wikipedia.org/wiki/Horsepower#Electrical_horsepower
ElectricalHorsepower = 5,
Femtowatt = 6,
+ GigacaloriePerHour = 37,
GigajoulePerHour = 7,
Gigawatt = 8,
@@ -52,6 +54,7 @@ public enum PowerUnit
HydraulicHorsepower = 9,
JoulePerHour = 10,
KilobritishThermalUnitPerHour = 11,
+ KilocaloriePerHour = 34,
KilojoulePerHour = 12,
Kilowatt = 13,
@@ -61,6 +64,7 @@ public enum PowerUnit
/// https://en.wikipedia.org/wiki/Horsepower#Imperial_horsepower
MechanicalHorsepower = 14,
MegabritishThermalUnitPerHour = 15,
+ MegacaloriePerHour = 27,
MegajoulePerHour = 16,
Megawatt = 17,