Skip to content

Commit f146813

Browse files
t03aptangularsen
andauthored
Add UsGallonsPerMile, ImperialGallonPerMile, MegaukGallonPerDay, MegausGallonPerDay (#1225)
Co-authored-by: Andreas Gullberg Larsen <[email protected]>
1 parent f41770a commit f146813

20 files changed

+483
-94
lines changed

Common/UnitDefinitions/VolumeFlow.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@
168168
"PluralName": "UsGallonsPerDay",
169169
"FromUnitToBaseFunc": "{x} / 22824465.227",
170170
"FromBaseToUnitFunc": "{x} * 22824465.227",
171+
"Prefixes": [ "Mega" ],
171172
"Localization": [
172173
{
173174
"Culture": "en-US",
@@ -268,6 +269,7 @@
268269
"PluralName": "UkGallonsPerDay",
269270
"FromUnitToBaseFunc": "{x} / 19005304",
270271
"FromBaseToUnitFunc": "{x} * 19005304",
272+
"Prefixes": [ "Mega" ],
271273
"Localization": [
272274
{
273275
"Culture": "en-US",

Common/UnitDefinitions/VolumePerLength.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,30 @@
100100
"Abbreviations": [ "yd³/ftUS" ]
101101
}
102102
]
103+
},
104+
{
105+
"SingularName": "UsGallonPerMile",
106+
"PluralName": "UsGallonsPerMile",
107+
"FromUnitToBaseFunc": "{x} / (1000 * 1609.344 / 3.785411784)",
108+
"FromBaseToUnitFunc": "{x} * (1000 * 1609.344 / 3.785411784)",
109+
"Localization": [
110+
{
111+
"Culture": "en-US",
112+
"Abbreviations": [ "gal (U.S.)/mi" ]
113+
}
114+
]
115+
},
116+
{
117+
"SingularName": "ImperialGallonPerMile",
118+
"PluralName": "ImperialGallonsPerMile",
119+
"FromUnitToBaseFunc": "{x} / (1000 * 1609.344 / 4.54609)",
120+
"FromBaseToUnitFunc": "{x} * (1000 * 1609.344 / 4.54609)",
121+
"Localization": [
122+
{
123+
"Culture": "en-US",
124+
"Abbreviations": [ "gal (imp.)/mi" ]
125+
}
126+
]
103127
}
104128
]
105129
}

Common/UnitEnumValues.g.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,7 +1644,9 @@
16441644
"MillionUsGallonPerDay": 66,
16451645
"MegaliterPerHour": 68,
16461646
"MegaliterPerMinute": 64,
1647-
"MegaliterPerSecond": 65
1647+
"MegaliterPerSecond": 65,
1648+
"MegaukGallonPerDay": 73,
1649+
"MegausGallonPerDay": 77
16481650
},
16491651
"VolumeFlowPerArea": {
16501652
"CubicFootPerMinutePerSquareFoot": 1,
@@ -1657,7 +1659,9 @@
16571659
"LiterPerKilometer": 4,
16581660
"LiterPerMeter": 5,
16591661
"LiterPerMillimeter": 6,
1660-
"OilBarrelPerFoot": 7
1662+
"OilBarrelPerFoot": 7,
1663+
"UsGallonPerMile": 8,
1664+
"ImperialGallonPerMile": 11
16611665
},
16621666
"VolumetricHeatCapacity": {
16631667
"BtuPerCubicFootDegreeFahrenheit": 1,

UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs

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

UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumePerLength.g.cs

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

UnitsNet.NanoFramework/GeneratedCode/Units/VolumeFlowUnit.g.cs

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

UnitsNet.NanoFramework/GeneratedCode/Units/VolumePerLengthUnit.g.cs

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

UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumeFlowExtensionsTest.g.cs

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

UnitsNet.NumberExtensions.Tests/GeneratedCode/NumberToVolumePerLengthExtensionsTest.g.cs

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

UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumeFlowExtensions.g.cs

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

UnitsNet.NumberExtensions/GeneratedCode/NumberToVolumePerLengthExtensions.g.cs

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

UnitsNet.Tests/CustomCode/VolumeFlowTests.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ public class VolumeFlowTests : VolumeFlowTestsBase
109109

110110
protected override double MegaukGallonsPerSecondInOneCubicMeterPerSecond => 2.19969e-4;
111111

112+
// https://www.wolframalpha.com/input?i=1.0000000000000000+Cubic+Meter+Per+Second+to+Megaukgallons+Per+Day
113+
protected override double MegaukGallonsPerDayInOneCubicMeterPerSecond => 19.00534305304118;
114+
115+
// https://www.wolframalpha.com/input?i=1.0000000000000000+Cubic+Meter+Per+Second+to+MegaGallons+Per+Day
116+
protected override double MegausGallonsPerDayInOneCubicMeterPerSecond => 22.82446532374402;
117+
112118
protected override double MicrolitersPerDayInOneCubicMeterPerSecond => 8.64e+13;
113119

114120
protected override double MicrolitersPerHourInOneCubicMeterPerSecond => 3.6e12;
@@ -159,7 +165,6 @@ public class VolumeFlowTests : VolumeFlowTestsBase
159165

160166
protected override double UsGallonsPerSecondInOneCubicMeterPerSecond => 2.64172052358148E2;
161167

162-
163168
[Theory]
164169
[InlineData(20, 2, 40)]
165170
[InlineData(20, 62, 1240)]

UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,11 @@ public class VolumePerLengthTests : VolumePerLengthTestsBase
4040
protected override double LitersPerKilometerInOneCubicMeterPerMeter => 1E6;
4141

4242
protected override double LitersPerMillimeterInOneCubicMeterPerMeter => 1;
43+
44+
// https://www.wolframalpha.com/input?i=1.0000000000000000+cubic+meter+per+meter+to+us+gallon+per+mile
45+
protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 4.25143707430272e5;
46+
47+
// https://www.wolframalpha.com/input?i=1.0000000000000000+cubic+meter+per+meter+to+imperial+gallon+per+mile
48+
protected override double ImperialGallonsPerMileInOneCubicMeterPerMeter => 3.540061899346471e5;
4349
}
4450
}

UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)