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

No units were found for the given UnitSystem: Convert non-base units to SI #700

Closed
SGStino opened this issue Sep 2, 2019 · 2 comments
Closed

Comments

@SGStino
Copy link

SGStino commented Sep 2, 2019

Is your feature request related to a problem? Please describe.
Converting L/h to SI results in "No units were found for the given UnitSystem"

Describe the solution you'd like
I'd love to see the values as m³/s in the SI case.

The use-case is a .NET tool that collects data from various sources in various units (including some weird ones like hL/min, which causes another problem for the moment) and outputs them on a single channel in SI unit by convention.
This channel is used by multiple tools written in multiple languages, hence the SI convention.

Currently we have to remove the Unit from the value and apply a custom scale factor that we have to set it manually (=little more error prone)

this means:
output = input * 4.41631375E-05
instead of
output = VolumeFlow.FromOilBarrelsPerHour(input).As(UnitSystem.SI)

@angularsen
Copy link
Owner

angularsen commented Sep 17, 2019

Thanks for describing the usecase. The UnitSystem concept is still quite new and we have not yet mapped all the units that should be the result of converting a quantity to SI base units. We are also debating a redesign of the system, since it can't easily be used to represent other systems than SI - such as CGS, FPS, British Engineering units and so on.

There are some discussions in #651 and #630 on a possible redesign.

However, I believe your scenario can be implemented by adding BaseUnits to the cubic meters per second unit in VolumeFlow.json, such that .As(UnitSystem.SI) will convert to that unit. Remember to run generate-code.bat after changing .json files.

See these unit definitions as an example:
https://github.com/angularsen/UnitsNet/search?l=JSON&q=baseunits

If you are willing to do a pull request, I'm happy to assist.

@stale
Copy link

stale bot commented Nov 16, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 16, 2019
@stale stale bot closed this as completed Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants