-
Notifications
You must be signed in to change notification settings - Fork 24
What is the recommended way of dealing with non-SI units? #52
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
If you only wish to avoid converting to SI, one option is to use symbolic units: https://github.com/SymbolicML/DynamicQuantities.jl#symbolic-units. You can also define custom dimensions structs: DynamicQuantities.jl/test/unittests.jl Lines 444 to 448 in 87e1eb3
which you could set the default unit system to something else rather than SI. However, to just register a unit, it's probably safer to just define your own While you could technically do |
I'm happy to have all the calculations happen in SI and actually prefer to do so. I'm just looking for the cleanest way to convert things on the way in and on the way out. For example, in a previous life I did a lot of DC motor work, and the input units around torque and inertia can be pretty strange. But even for the output, no human (that I know of) thinks in P.S. I was happy to see the clever support for fractional powers, as one of my tests for a unit system is if it can handle the motor constant which is in dimensions of torque per sqrt(power). |
Cool! Okay so once #48 merges, we should be good to go if its just conversion. Then you could do, for example, 0.5u"1/s" |> as_u("1/min") which would display it in symbolic dimensions of 1/minute. But we're still discussing the API over in that PR. Cheers,
Awesome, I am glad to hear it has found a use-case! |
Thank you for the pointer to that discussion. I think that will probably cover my questions. |
Closed with #48 |
@klaff FYI we just added |
For example, if one wants to be able to use miles/hour, we can do
mile = 5280 * 12 * 0.0254u"m"
followed by
60 * mile/u"hr"
or because the latter is clumsy, maybe we use
mph = mile/u"hr"
after which we can use
mph
.Is there thought about whether the user should be allowed to register new units which could then be used within the
u"..."
strings?The text was updated successfully, but these errors were encountered: