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

Multiplying Ah and V results in kNm #310

Open
fwolter opened this issue May 26, 2024 · 2 comments
Open

Multiplying Ah and V results in kNm #310

fwolter opened this issue May 26, 2024 · 2 comments

Comments

@fwolter
Copy link

fwolter commented May 26, 2024

When you calculate the capacity of a battery in Wh, the result is returned in a strange kNm number. When you force the correct unit, the result is OK.

2Ah*3V
2Ah*3V|Wh

grafik

@Proektsoftbg
Copy link
Owner

Hi!

Thank you for your feedback. This is because the way of which unit arithmetic works.
Composite units are internally represented by vectors of basic units (mass, length, time, etc.). So arithmetic operations are actually performed between those vectors. A a result, we obtain a unit like [kg, m^2, s^-2, ...]. After that, Calcpad looks up in a table and composes the resulting unit back. You can read more about that in this blog post:
https://calcpad.blog/2018/01/28/how-units-work/

However, it happens that some units have the same internal representation but different meaning in different engineering/physics fields as it is in your case (torgue - Nm and energy - Wh). But Calcpad does not understand physics and does not "know" what you are trying to calculate. It always looks up in a predefined order - first for mechanical units, then electrical and so on. To be honest, we made it like that for a bit of a selfish reason. We are structural engineers and we made it first to be comfortable for us :).

But we can improve that further of course. We can introduce and option for the user to specify a field (mechanical, electrical, thermal, etc.) and make Calcpad to output the respective units with priority when ambiguous. Even further, it can scan your input units and try to guess what field you are working automatically.

@fwolter
Copy link
Author

fwolter commented May 27, 2024

OK, understood. Thanks for the explaination! I guess it's a feature request, then 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants