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

Add radiation equivalent dose rate #1464

Merged

Conversation

voronizer
Copy link
Contributor

Add radiation equivalent dose rate.

@angularsen angularsen merged commit 8621421 into angularsen:master Dec 25, 2024
1 check passed
angularsen pushed a commit that referenced this pull request Dec 25, 2024
angularsen added a commit that referenced this pull request Dec 25, 2024
Add radiation equivalent [dose rate](https://en.wikipedia.org/wiki/Dose_rate).

Port of #1464 to v6.
- migrate .extra.cs files to UnitRelations.json

---------

Co-authored-by: Alexander Voronische <[email protected]>
@angularsen
Copy link
Owner

Thanks! I ported this to v6 branch also.
#1468

Nuget should be out shortly.
Release UnitsNet/5.62.0 · angularsen/UnitsNet

@lipchev
Copy link
Collaborator

lipchev commented Dec 25, 2024

@angularsen
Sorry, I'm perhaps a little late for the party, but I'd just like to point out that, IMO, the use of Seconds should be preferred to Hours for the BaseUnit definition, with the latter corresponding to the derived unit of time of SI.

As it stands, the RadiationEquivalentDose would likely throw if asked for it's official SI unit (i.e. using ToUnit(UnitSystem.Si)). We don't have any rules for having a SI base unit present (or be the default) (see #1463) but even if just as a performance consideration- given an operation (like the multiplication with Duration) that operates using the quantities BaseUnits is significantly faster than one requiring a conversion to a non-base unit.

For example, multiplying some RadiationEquivalentDose by "30 minutes" would have the Duration perform a dual conversion from Minutes to Seconds and then from Seconds to Hours, which currently involves extra boxing of the Enum, in addition to asking the ConcurrentDictionary of the UnitConverter for a custom conversion that likely does not exist..

PS I love how the build failed due to the lack of coverage of the operator (and the uncovered lines are finally showing up clearly)- it's very useful in highlighting issues like the one I spotted just now.. 👍

@angularsen
Copy link
Owner

Gotcha, I was thinking about it, but didn't know if seconds made sense in this domain. A quick google reveals that there are conversions for Sievert/second, so sure, we can add that and set it as base unit I guess.

@angularsen
Copy link
Owner

angularsen commented Dec 25, 2024

Changed base unit here
#1469

angularsen added a commit that referenced this pull request Dec 25, 2024
Fixup of #1464 

- Add unit `SievertPerSecond`, for SI compatibility, with prefixes Nano,
Micro, Milli
- Change `RadiationEquivalentDoseRate` base unit from `SievertPerHour`
to `SievertPerSecond`
- Update conversion functions.
@voronizer
Copy link
Contributor Author

voronizer commented Dec 25, 2024

Sorry, I'm perhaps a little late for the party :), but. I'm working for the company related to measurement of radiation an I could say that the amount of Sieverts per seconds value could be too small even for Double unit - it's just no sense. I don't know internals of UnitsNet deeply. I added Sv(rem) per hour as base unit widely used in industry.

@angularsen
Copy link
Owner

Not late at all, I'm just pushing too fast here, sorry my bad.

I did find references to Sievert/second, millisievert/second etc. so I assumed it would make sense to include it, mostly to have SI compatible units.
https://www.translatorscafe.com/unit-converter/en-US/radiation/21-27/sievert/second-milliroentgen/hour/
https://www.rp-alba.com/index.php?filename=radiationDoseRateConverter.php

I have no idea if these are reputable sources, but at least more than one source included it.

@voronizer
Copy link
Contributor Author

Ok. Lets see how it will work. Thank you!

@angularsen angularsen added this to the v6 milestone Dec 29, 2024
@angularsen
Copy link
Owner

Merged into V6 branch, nuget should be out shortly.

Release UnitsNet/6.0.0-pre013 · angularsen/UnitsNet

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

Successfully merging this pull request may close these issues.

3 participants