-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(units): Add Ah unit #3617
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
base: develop
Are you sure you want to change the base?
feat(units): Add Ah unit #3617
Conversation
|
This looks pretty straightforward to me, but I defer to @josdejong on approving any Unit-related PRs because of a long-standing desire to make Unit an independent package and never being quite sure how changes play into that. However, if it is generally approved as to the content of the change, this PR will need some additional work: there would need to be an addition to docs/datatypes/units.md, and at least one test added for the new Amp-hour Ah unit. |
Hi and merry Christmas! 🎄 I added two commits, one modifying |
Yes, that's all good. Also, in this particular case since it's a new compound unit, you should test that an amp times an hour is an Ah and that sort of thing. I think but am not sure that such products, unless they have automatic simplification off, should now just end up as Ah when computed. In any case, it would be good to test whether that's true, and then we can make sure that it is working the way Jos intends, once he has a chance to do the final review of this. Thanks so much! |
|
I'm having some difficulty here. The new However, I tried adding a couple of tests and the one for The error is: Why does mathjs simplify Another thing that confuses me is that it appears that At this point I'm not exactly sure what is the expected behaviour and thus what I should test here. |
Ah! It dawned on me the reason for this! The default unit system has Let me know if this is all right and then I'll go on with the other MRs! |
|
All looks good now and thanks for including the Wh test, too. But now the name of the test is a bit misleading; please change the name of the test to "Should be able to combine W and h into J", thanks. Since that's a completely trivial change, I am authorizing the CI checks and as I said since this is a Unit PR, @josdejong will have to take the review from here and land this PR as he sees fit. Thanks for the contribution! |
Sure thing! Ready now; I'll wait for @josdejong's review before updating the other MRs as well Thank you! |
This PR adds
Ah, the ampere-hour, as a unit of electric charge.In the energy and technology, this unit is used all the time much more often than
A horA⋅h.The unit of measure
Whis already considered for energy, so this is in line with that line of thought.