Skip to content

Commit d9d352c

Browse files
BickelLukasangularsen
authored andcommitted
Add joules/hour, GigaJoule and MegaCalorie (#725)
1 parent 8ea1dbb commit d9d352c

File tree

17 files changed

+380
-3
lines changed

17 files changed

+380
-3
lines changed

Common/UnitDefinitions/Energy.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"FromUnitToBaseFunc": "x",
2020
"FromBaseToUnitFunc": "x",
21-
"Prefixes": [ "Milli", "Kilo", "Mega" ],
21+
"Prefixes": [ "Milli", "Kilo", "Mega", "Giga" ],
2222
"Localization": [
2323
{
2424
"Culture": "en-US",
@@ -31,7 +31,7 @@
3131
"PluralName": "Calories",
3232
"FromUnitToBaseFunc": "x*4.184",
3333
"FromBaseToUnitFunc": "x/4.184",
34-
"Prefixes": [ "Kilo" ],
34+
"Prefixes": [ "Kilo", "Mega" ],
3535
"Localization": [
3636
{
3737
"Culture": "en-US",

Common/UnitDefinitions/Power.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@
9494
"Abbreviations": [ "Btu/h", "Btu/hr" ]
9595
}
9696
]
97-
}
97+
},
98+
{
99+
"SingularName": "JoulePerHour",
100+
"PluralName": "JoulesPerHour",
101+
"FromUnitToBaseFunc": "x/3600m",
102+
"FromBaseToUnitFunc": "x*3600m",
103+
"Prefixes": [ "Milli", "Kilo", "Mega", "Giga" ],
104+
"Localization": [
105+
{
106+
"Culture": "en-US",
107+
"Abbreviations": [ "J/h" ]
108+
}
109+
]
110+
},
98111
]
99112
}

UnitsNet.Tests/CustomCode/EnergyTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public class EnergyTests : EnergyTestsBase
1818

1919
protected override double MegabritishThermalUnitsInOneJoule => 9.4781712e-10;
2020

21+
protected override double MegacaloriesInOneJoule => 0.239005736e-6;
22+
2123
protected override double MegajoulesInOneJoule => 1E-6;
2224

2325
protected override double BritishThermalUnitsInOneJoule => 0.00094781712;
@@ -44,6 +46,8 @@ public class EnergyTests : EnergyTestsBase
4446

4547
protected override double GigabritishThermalUnitsInOneJoule => 9.4781712e-13;
4648

49+
protected override double GigajoulesInOneJoule => 1e-9;
50+
4751
protected override double GigawattHoursInOneJoule => 2.77777778e-13;
4852

4953
protected override double KilocaloriesInOneJoule => 0.00023900573614;

UnitsNet.Tests/CustomCode/PowerTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ public class PowerTests : PowerTestsBase
1010
{
1111
protected override double FemtowattsInOneWatt => 1e15;
1212

13+
protected override double GigajoulesPerHourInOneWatt => 3600e-9;
14+
1315
protected override double PicowattsInOneWatt => 1e12;
1416

1517
protected override double NanowattsInOneWatt => 1e9;
1618

1719
protected override double MicrowattsInOneWatt => 1e6;
1820

21+
protected override double MillijoulesPerHourInOneWatt => 3600e3;
22+
1923
protected override double MilliwattsInOneWatt => 1e3;
2024

2125
protected override double DeciwattsInOneWatt => 1e1;
@@ -24,8 +28,12 @@ public class PowerTests : PowerTestsBase
2428

2529
protected override double DecawattsInOneWatt => 1e-1;
2630

31+
protected override double KilojoulesPerHourInOneWatt => 3600e-3;
32+
2733
protected override double KilowattsInOneWatt => 1e-3;
2834

35+
protected override double MegajoulesPerHourInOneWatt => 3600e-6;
36+
2937
protected override double MegawattsInOneWatt => 1e-6;
3038

3139
protected override double GigawattsInOneWatt => 1e-9;
@@ -34,6 +42,8 @@ public class PowerTests : PowerTestsBase
3442

3543
protected override double PetawattsInOneWatt => 1e-15;
3644

45+
protected override double JoulesPerHourInOneWatt => 3600;
46+
3747
protected override double KilobritishThermalUnitsPerHourInOneWatt => 3.412141633e-3;
3848

3949
protected override double BoilerHorsepowerInOneWatt => 1.0191082802547770700636942675159e-4;

UnitsNet.Tests/GeneratedCode/EnergyTestsBase.g.cs

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)