Skip to content

Commit

Permalink
Add SpecificEnergy.MegaJoulePerTonne (#1184)
Browse files Browse the repository at this point in the history
* Add unit definition "MegaJoulePerTonne" to SpecificEnergy

* Fix conversion value to/from BaseUnit

Co-authored-by: Matthias Kuhn <[email protected]>
  • Loading branch information
kuhnm and Matthias Kuhn authored Jan 26, 2023
1 parent ed0ab59 commit ee0253d
Show file tree
Hide file tree
Showing 10 changed files with 135 additions and 40 deletions.
12 changes: 12 additions & 0 deletions Common/UnitDefinitions/SpecificEnergy.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
}
]
},
{
"SingularName": "MegaJoulePerTonne",
"PluralName": "MegaJoulesPerTonne",
"FromUnitToBaseFunc": "{x} * 1e3",
"FromBaseToUnitFunc": "{x} / 1e3",
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "MJ/t" ]
}
]
},
{
"SingularName": "CaloriePerGram",
"PluralName": "CaloriesPerGram",
Expand Down
3 changes: 2 additions & 1 deletion Common/UnitEnumValues.g.json
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,8 @@
"WattDayPerShortTon": 26,
"WattDayPerTonne": 27,
"WattHourPerKilogram": 28,
"WattHourPerPound": 29
"WattHourPerPound": 29,
"MegaJoulePerTonne": 37
},
"SpecificEntropy": {
"BtuPerPoundFahrenheit": 1,
Expand Down

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.

1 change: 1 addition & 0 deletions UnitsNet.Tests/CustomCode/SpecificEnergyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class SpecificEnergyTests : SpecificEnergyTestsBase
protected override double JoulesPerKilogramInOneJoulePerKilogram => 1e0;
protected override double KilojoulesPerKilogramInOneJoulePerKilogram => 1e-3;
protected override double MegajoulesPerKilogramInOneJoulePerKilogram => 1e-6;
protected override double MegaJoulesPerTonneInOneJoulePerKilogram => 1e-3;

protected override double BtuPerPoundInOneJoulePerKilogram => 4.299226e-4;

Expand Down
Loading

0 comments on commit ee0253d

Please sign in to comment.