Skip to content

Commit

Permalink
Add UsGallonsPerMile, ImperialGallonPerMile, MegaukGallonPerDay, Mega…
Browse files Browse the repository at this point in the history
…usGallonPerDay (#1225)

Co-authored-by: Andreas Gullberg Larsen <[email protected]>
  • Loading branch information
t03apt and angularsen authored Apr 1, 2023
1 parent f41770a commit f146813
Show file tree
Hide file tree
Showing 20 changed files with 483 additions and 94 deletions.
2 changes: 2 additions & 0 deletions Common/UnitDefinitions/VolumeFlow.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
"PluralName": "UsGallonsPerDay",
"FromUnitToBaseFunc": "{x} / 22824465.227",
"FromBaseToUnitFunc": "{x} * 22824465.227",
"Prefixes": [ "Mega" ],
"Localization": [
{
"Culture": "en-US",
Expand Down Expand Up @@ -268,6 +269,7 @@
"PluralName": "UkGallonsPerDay",
"FromUnitToBaseFunc": "{x} / 19005304",
"FromBaseToUnitFunc": "{x} * 19005304",
"Prefixes": [ "Mega" ],
"Localization": [
{
"Culture": "en-US",
Expand Down
24 changes: 24 additions & 0 deletions Common/UnitDefinitions/VolumePerLength.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,30 @@
"Abbreviations": [ "yd³/ftUS" ]
}
]
},
{
"SingularName": "UsGallonPerMile",
"PluralName": "UsGallonsPerMile",
"FromUnitToBaseFunc": "{x} / (1000 * 1609.344 / 3.785411784)",
"FromBaseToUnitFunc": "{x} * (1000 * 1609.344 / 3.785411784)",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "gal (U.S.)/mi" ]
}
]
},
{
"SingularName": "ImperialGallonPerMile",
"PluralName": "ImperialGallonsPerMile",
"FromUnitToBaseFunc": "{x} / (1000 * 1609.344 / 4.54609)",
"FromBaseToUnitFunc": "{x} * (1000 * 1609.344 / 4.54609)",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "gal (imp.)/mi" ]
}
]
}
]
}
8 changes: 6 additions & 2 deletions Common/UnitEnumValues.g.json
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,9 @@
"MillionUsGallonPerDay": 66,
"MegaliterPerHour": 68,
"MegaliterPerMinute": 64,
"MegaliterPerSecond": 65
"MegaliterPerSecond": 65,
"MegaukGallonPerDay": 73,
"MegausGallonPerDay": 77
},
"VolumeFlowPerArea": {
"CubicFootPerMinutePerSquareFoot": 1,
Expand All @@ -1657,7 +1659,9 @@
"LiterPerKilometer": 4,
"LiterPerMeter": 5,
"LiterPerMillimeter": 6,
"OilBarrelPerFoot": 7
"OilBarrelPerFoot": 7,
"UsGallonPerMile": 8,
"ImperialGallonPerMile": 11
},
"VolumetricHeatCapacity": {
"BtuPerCubicFootDegreeFahrenheit": 1,
Expand Down
26 changes: 26 additions & 0 deletions UnitsNet.NanoFramework/GeneratedCode/Quantities/VolumeFlow.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion UnitsNet.Tests/CustomCode/VolumeFlowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ public class VolumeFlowTests : VolumeFlowTestsBase

protected override double MegaukGallonsPerSecondInOneCubicMeterPerSecond => 2.19969e-4;

// https://www.wolframalpha.com/input?i=1.0000000000000000+Cubic+Meter+Per+Second+to+Megaukgallons+Per+Day
protected override double MegaukGallonsPerDayInOneCubicMeterPerSecond => 19.00534305304118;

// https://www.wolframalpha.com/input?i=1.0000000000000000+Cubic+Meter+Per+Second+to+MegaGallons+Per+Day
protected override double MegausGallonsPerDayInOneCubicMeterPerSecond => 22.82446532374402;

protected override double MicrolitersPerDayInOneCubicMeterPerSecond => 8.64e+13;

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

protected override double UsGallonsPerSecondInOneCubicMeterPerSecond => 2.64172052358148E2;


[Theory]
[InlineData(20, 2, 40)]
[InlineData(20, 62, 1240)]
Expand Down
6 changes: 6 additions & 0 deletions UnitsNet.Tests/CustomCode/VolumePerLengthTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,11 @@ public class VolumePerLengthTests : VolumePerLengthTestsBase
protected override double LitersPerKilometerInOneCubicMeterPerMeter => 1E6;

protected override double LitersPerMillimeterInOneCubicMeterPerMeter => 1;

// https://www.wolframalpha.com/input?i=1.0000000000000000+cubic+meter+per+meter+to+us+gallon+per+mile
protected override double UsGallonsPerMileInOneCubicMeterPerMeter => 4.25143707430272e5;

// https://www.wolframalpha.com/input?i=1.0000000000000000+cubic+meter+per+meter+to+imperial+gallon+per+mile
protected override double ImperialGallonsPerMileInOneCubicMeterPerMeter => 3.540061899346471e5;
}
}
2 changes: 1 addition & 1 deletion UnitsNet.Tests/GeneratedCode/IQuantityTests.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f146813

Please sign in to comment.