Skip to content

Commit cf97710

Browse files
aidbalangularsen
authored andcommitted
Added fuel efficiency unit (#703)
1 parent 1103295 commit cf97710

File tree

14 files changed

+2000
-0
lines changed

14 files changed

+2000
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"Name": "FuelEfficiency",
3+
"BaseUnit": "LiterPer100Kilometers",
4+
"XmlDoc": "Fuel efficiency is a form of thermal efficiency, meaning the ratio from effort to result of a process that converts chemical potential energy contained in a carrier (fuel) into kinetic energy or work. Fuel economy is stated as \"fuel consumption\" in liters per 100 kilometers (L/100 km). In countries using non-metric system, fuel economy is expressed in miles per gallon (mpg) (imperial galon or US galon).",
5+
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Fuel_efficiency",
6+
"Units": [{
7+
"SingularName": "LiterPer100Kilometers",
8+
"PluralName": "LitersPer100Kilometers",
9+
"FromUnitToBaseFunc": "x",
10+
"FromBaseToUnitFunc": "x",
11+
"Localization": [{
12+
"Culture": "en-US",
13+
"Abbreviations": [
14+
"L/100km"
15+
]
16+
}]
17+
},
18+
{
19+
"SingularName": "MilePerUsGallon",
20+
"PluralName": "MilesPerUsGallon",
21+
"FromUnitToBaseFunc": "(100*3.785411784)/(1.609344*x)",
22+
"FromBaseToUnitFunc": "(100*3.785411784)/(1.609344*x)",
23+
"Localization": [{
24+
"Culture": "en-US",
25+
"Abbreviations": [
26+
"mpg (U.S.)"
27+
]
28+
}]
29+
},
30+
{
31+
"SingularName": "MilePerUkGallon",
32+
"PluralName": "MilesPerUkGallon",
33+
"FromUnitToBaseFunc": "(100*4.54609188)/(1.609344*x)",
34+
"FromBaseToUnitFunc": "(100*4.54609188)/(1.609344*x)",
35+
"Localization": [{
36+
"Culture": "en-US",
37+
"Abbreviations": [
38+
"mpg (imp.)"
39+
]
40+
}]
41+
},
42+
{
43+
"SingularName": "KilometerPerLiter",
44+
"PluralName": "KilometersPerLiters",
45+
"FromUnitToBaseFunc": "100/x",
46+
"FromBaseToUnitFunc": "100/x",
47+
"Localization": [{
48+
"Culture": "en-US",
49+
"Abbreviations": [
50+
"km/L"
51+
]
52+
}]
53+
}
54+
]
55+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by \generate-code.bat.
4+
//
5+
// Changes to this file will be lost when the code is regenerated.
6+
// The build server regenerates the code before each build and a pre-build
7+
// step will regenerate the code on each local build.
8+
//
9+
// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
10+
//
11+
// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
12+
// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
13+
//
14+
// </auto-generated>
15+
//------------------------------------------------------------------------------
16+
17+
// Licensed under MIT No Attribution, see LICENSE file at the root.
18+
// Copyright 2013 Andreas Gullberg Larsen ([email protected]). Maintained at https://github.com/angularsen/UnitsNet.
19+
20+
using System;
21+
22+
namespace UnitsNet.Tests.CustomCode
23+
{
24+
public class FuelEfficiencyTests : FuelEfficiencyTestsBase
25+
{
26+
// Override properties in base class here
27+
protected override double KilometersPerLitersInOneLiterPer100Kilometers => 100;
28+
protected override double LitersPer100KilometersInOneLiterPer100Kilometers => 1;
29+
protected override double MilesPerUkGallonInOneLiterPer100Kilometers => 282.4809363;
30+
protected override double MilesPerUsGallonInOneLiterPer100Kilometers => 235.2145833;
31+
}
32+
}

UnitsNet.Tests/GeneratedCode/FuelEfficiencyTestsBase.g.cs

Lines changed: 273 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)