Skip to content

Adding deformation and electric ratio units #697

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

Closed
wants to merge 2 commits into from
Closed

Adding deformation and electric ratio units #697

wants to merge 2 commits into from

Conversation

n-tiz
Copy link
Contributor

@n-tiz n-tiz commented Aug 21, 2019

Pull request for adding 2 (ratio) units:

  • Deformation: a dimensionless quantity used to measure deformations in continuum mechanics.
  • ElectricRatio: Used to measure an electrical signal which is proportional to the applied excitation voltage (also called ratio-metric system).

@codecov-io
Copy link

Codecov Report

Merging #697 into master will decrease coverage by 0.26%.
The diff coverage is 40.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #697      +/-   ##
==========================================
- Coverage   58.34%   58.08%   -0.27%     
==========================================
  Files         165      167       +2     
  Lines       37450    38028     +578     
==========================================
+ Hits        21852    22087     +235     
- Misses      15598    15941     +343
Impacted Files Coverage Δ
UnitsNet/GeneratedCode/UnitAbbreviationsCache.g.cs 100% <ø> (ø) ⬆️
UnitsNet/GeneratedCode/UnitConverter.g.cs 100% <100%> (ø) ⬆️
UnitsNet/GeneratedCode/Quantities/Deformation.g.cs 36.13% <36.13%> (ø)
...itsNet/GeneratedCode/Quantities/ElectricRatio.g.cs 42.36% <42.36%> (ø)
UnitsNet/GeneratedCode/Quantity.g.cs 81.48% <80%> (-0.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1103295...09b93c5. Read the comment docs.

@tmilnthorp
Copy link
Collaborator

Does the existing ratio unit not suffice for these? Just curious as it seems to just be a named ratio, but I'm not familiar with these use cases.

@n-tiz
Copy link
Contributor Author

n-tiz commented Aug 22, 2019

Does the existing ratio unit not suffice for these? Just curious as it seems to just be a named ratio, but I'm not familiar with these use cases.

In the facts, yes, there are ratio units, but where the current Ratio unit is not linked to physical quantities, theses new units are linked to Length (for Deformation), or ElectricPotential (for ElectricRatio).

The uses cases is to condition a measurement signal from strain gauges.

@angularsen
Copy link
Owner

angularsen commented Aug 29, 2019

@salido-m The only reason we are a bit hesitant to add these quantities is that we are simply trying to avoid the library growing too fat with little-used quantities or if we don't immediately see that it adds enough value, so please bear with us trying to understand the usecase better.

This is not the first time we are debating whether to add quantities and ratio-quantities is a recurring theme since there are so many variations of them. We don't yet have a good guideline for whether a quantity should be added or not, so it's not always easy to decide.

The main reasons I can think of for adding quantities to the library in general are:

  • You get Parse() and ToString() out of the box
  • Consistent API design and behavior as all the other quantities in Units.NET
  • Dynamic conversion and parsing via Quantity and IQuantity
  • Arithmetic with the same quantity (add, subtract, multiply and divide)
  • Arithmetic with other quantities, f.ex: Torque = Length x Mass
  • Convert between units of the same quantitiy
  • It is widely used and others will benefit from it or expect it to be in the library

The reasons why custom ratio quantity is useful instead of Ratio:

  • You can Parse() and ToString() with the unit abbreviations
  • It can be the result of a computation, f.ex: ElectricRatio = ElectricPotential / ElectricPotential
  • Strongly typed quantity to pass around in code (although this is easily added per-application)

I've checked the boxes that I think you obtain with ElectricRatio, which does have "meaningful" unit abbreviations as well as multiple units.
Deformation only has one unit and is dimensionless so I feel perhaps it adds less value over simply using Ratio?

Could you perhaps give a short pseudo code example that illustrates why adding these quantities would be useful to you and others, and why using Ratio or providing your own app-specific types would not be as good or not very useful at all? It would help us decide for this and future ratio quantities, thanks!

@angularsen
Copy link
Owner

Following up on this, do you have any thoughts on my previous comments and questions? It would be helpful to better understand your use cases. Thanks!

@stale
Copy link

stale bot commented Nov 28, 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 28, 2019
@stale stale bot closed this Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants