Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add EnergyEfficiency unit #1419

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Binary file added Common/.DS_Store
Chef904 marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
42 changes: 42 additions & 0 deletions Common/UnitDefinitions/EnergyEfficiency.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"Name": "EnergyEfficiency",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What domain is this, is it related to transport?
If so, it feels a bit too domain specific for UnitsNet maybe.
Can you help me understand the domain and usecases better?

Here are some criteria we have to consider before adding new units:
https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit#great--but-before-you-start-

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,
it's like the FuelEfficiency Quantity but related to electric powered vehicles. This domain is getting more and more important these days.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it is getting kind of mainstream so maybe it makes sense to add something here.
However, maybe we just need to name it something else.

EnergyEfficiency means?

Googling energy efficiency units returns a lot of different things, from energy generators, heating/cooling, and more. Not much about EV efficiency in the first few results.

Rename EnergyEfficiency to...?

It seems there is no well defined name for this, but electric vehicle converters do pop up for these units.

"Electric car energy economy"
https://www.aqua-calc.com/one-to-all/electric-car-energy-economy

"Electric Vehicle Range / Efficiency Unit Conversions"
https://home.hasslers.net/ev/convert/

I propose ElectricVehicleEfficiency, since there does not seem to be a well defined, generic physical quantity with units like kWH/km. They are all domain specific; heating/cooling, energy generators, etc.

Maybe also add kWh/100km unit?

Most common in Europe is the specification kilowatt-hours per 100 kilometers (kWh/100km).
https://e-automobile.info/en/calculator.php

Summary of proposed changes to PR

  • Rename quantity to ElectricVehicleEfficiency
  • Add unit WattHourPer100Kilometer with prefix Kilo

"BaseUnit": "WattHourPerKilometer",
"XmlDocSummary": "",
"BaseDimensions": {
"Wh/km": 1
},
"Units": [
{
"SingularName": "WattHourPerKilometer",
"PluralName": "WattHoursPerKilometer",
"BaseUnits": {
"Wh/km": "WattHourPerKilometer"
},
"FromUnitToBaseFunc": "{x}",
"FromBaseToUnitFunc": "{x}",
"Prefixes": ["Kilo" ],
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "Wh/km" ]
}
]
},
{
"SingularName": "WattHourPerMeter",
"PluralName": "WattHoursPerMeter",
"BaseUnits": {
"Wh/m": "WattHourPerMeter"
},
"FromUnitToBaseFunc": "{x} * 1e3",
"FromBaseToUnitFunc": "{x} / 1e3",
"Prefixes": ["Kilo"],
"Localization": [
{
"Culture": "en-US",
"Abbreviations": [ "Wh/m" ]
}
]
}
]
}
20 changes: 20 additions & 0 deletions Common/UnitEnumValues.g.json
Original file line number Diff line number Diff line change
Expand Up @@ -1862,5 +1862,25 @@
"Sievert": 9,
"Kilosievert": 3,
"Megasievert": 6
},
"EnergyEfficiency": {
"FemtowattHourPerKilometer": 7,
"FemtowattHourPerMeter": 9,
"GigawattHourPerKilometer": 10,
"GigawattHourPerMeter": 2,
"KilowattHourPerKilometer": 5,
"KilowattHourPerMeter": 3,
"MegawattHourPerKilometer": 1,
"MegawattHourPerMeter": 6,
"MicrowattHourPerKilometer": 4,
"MicrowattHourPerMeter": 8,
"MilliwattHourPerKilometer": 12,
"MilliwattHourPerMeter": 15,
"NanowattHourPerKilometer": 11,
"NanowattHourPerMeter": 16,
"PicowattHourPerKilometer": 14,
"PicowattHourPerMeter": 19,
"WattHourPerKilometer": 13,
"WattHourPerMeter": 20
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<NanoFrameworkProjectSystemPath>$(MSBuildExtensionsPath)\nanoFramework\v1.0\</NanoFrameworkProjectSystemPath>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.Default.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{31f3d11e-76d2-1914-ebad-28e0cb77326b}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<FileAlignment>512</FileAlignment>
<RootNamespace>UnitsNet</RootNamespace>
<AssemblyName>UnitsNet.EnergyEfficiency</AssemblyName>
<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
<DocumentationFile>bin\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.props" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.props')" />
<ItemGroup>
<Compile Include="..\Quantities\EnergyEfficiency.g.cs" />
<Compile Include="..\Units\EnergyEfficiencyUnit.g.cs" />
<Compile Include="..\Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib, Version=1.15.6.0, Culture=neutral, PublicKeyToken=c07d481e9758c731">
<HintPath>..\packages\nanoFramework.CoreLibrary.1.15.5\lib\mscorlib.dll</HintPath>
<Private>True</Private>
<SpecificVersion>True</SpecificVersion>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets" Condition="Exists('$(NanoFrameworkProjectSystemPath)NFProjectSystem.CSharp.targets')" />
<ProjectExtensions>
<ProjectCapabilities>
<ProjectConfigurationsDeclaredAsItems />
</ProjectCapabilities>
</ProjectExtensions>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>UnitsNet.nanoFramework.EnergyEfficiency</id>
<version>5.57.0</version>
<title>Units.NET EnergyEfficiency - nanoFramework</title>
<authors>Andreas Gullberg Larsen,nanoframework</authors>
<owners>UnitsNet</owners>
<license type="expression">MIT-0</license>
<projectUrl>https://github.com/angularsen/UnitsNet</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Adds EnergyEfficiency units for Units.NET on .NET nanoFramework. For .NET or .NET Core, use UnitsNet instead.</description>
<iconUrl>https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png</iconUrl>
<releaseNotes>
</releaseNotes>
<copyright>Copyright 2013 Andreas Gullberg Larsen ([email protected]).</copyright>
<language>en-US</language>
<tags>nanoframework energyefficiency unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable</tags>
<dependencies>
<dependency id="nanoFramework.CoreLibrary" version="1.15.5" />
</dependencies>
</metadata>
<files>
<file src="..\..\..\Artifacts\UnitsNet.NanoFramework\EnergyEfficiency\UnitsNet.*" target="lib" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="nanoFramework.CoreLibrary" version="1.15.5" targetFramework="netnanoframework10" />
</packages>
198 changes: 198 additions & 0 deletions UnitsNet.NanoFramework/GeneratedCode/Quantities/EnergyEfficiency.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.

Loading