Repository navigation
Fix five conversion factors that disagree with their definitions - #1743
Open
tmilnthorp wants to merge 2 commits into
Open
tmilnthorp wants to merge 2 commits into
tmilnthorp wants to merge 2 commits into
Conversation
- BoilerHorsepower: 9812.5 W -> 9809.5 W (NIST SP 811, Appendix B.8). - ThermEc: 1.05505585262e8 J (100,000 BTU_IT) -> 1.05506e8 J, the defined EC therm (NIST SP 811, Appendix B.8). - TorrLiterPerSecond: 1/7.5 Pa·m³/s -> 101325/760 * 1e-3 Pa·m³/s, using the exact torr, as Pressure.Torr already does. 7.5 is a rounding. - SolarTemperature: 5778 K -> 5772 K, the IAU 2015 Resolution B3 nominal solar effective temperature, like SolarRadius and SolarLuminosity. - SolarMass: 1.98947e30 kg -> 1.98847e30 kg. The old value matches no source and looks like a typo; the new one is within the uncertainty of the current best estimate (1.988475 ± 0.000092) e30 kg. Each changed unit's XmlDocSummary now states the value used and its source, and XmlDocRemarks links to it. ThermEc gets a description of the EC therm instead of the generic one, and TorrLiterPerSecond and SolarTemperature get docs. Also removes a trailing comma in Mass.json, which isn't valid JSON. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012XKhDsyHDc5BHrmibxScqG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012XKhDsyHDc5BHrmibxScqG
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1743 +/- ##
======================================
Coverage 98% 98%
======================================
Files 515 515
Lines 24092 24092
======================================
Hits 23692 23692
Misses 400 400
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Five units convert with a factor that doesn't match the unit's definition. This fixes them and updates the test values to the exact reciprocals.
Power.BoilerHorsepowerEnergy.ThermEcLeakRate.TorrLiterPerSecondTemperature.SolarTemperatureMass.SolarMassSources and history
BoilerHorsepower. NIST SP 811, Appendix B.8: horsepower (boiler) = 9.80950 E+03 W. The old value came from the original horsepower units in 2015 (#65, "as defined on Wikipedia"); the value itself was never discussed.
There are two boiler horsepower variants (Wikipedia):
The old 9812.5 W matches neither. The unit's doc now says which variant it is.
ThermEc. NIST SP 811, Appendix B.8: therm (EC) = 1.05506 E+08 J. The EC therm is defined as 100,000 BTU_ISO = exactly 105,506,000 J (Wikipedia, citing the EC Official Journal L 073 of 1972). The old value was 100,000 BTU_IT instead.
ThermUs(1.054804e8) andThermImperialalready match their definitions and are unchanged.TorrLiterPerSecond. 1 Torr is exactly 101325/760 Pa (NIST SP 811: 1.333224 E+02 Pa), and 1 L = 1e-3 m³. This is the same torr that
Pressure.Torralready uses ({x} * 101325 / 760), so today a leak rate in Torr·L/s and a pressure in Torr times a volume flow in L/s disagree by 82 ppm.The value 7.5 was added with
LeakRatein #1222, and verified at the time against sensorsone.com, which shows the rounded figure. Leak rate references commonly quote 1 mbar·L/s ≈ 0.75 Torr·L/s for the same reason, but the exact ratio is 0.750062.SolarTemperature. IAU 2015 Resolution B3 adopts a nominal solar effective temperature of 5772 K as a conversion constant (Prša et al. 2016, arXiv:1510.07674). The same resolution defines the nominal solar radius and luminosity:
SolarRadiusalready moved to the B3 nominal value in Use the Nominal Solar Radius as defined in IAU Res. B3 #1424.SolarLuminosityuses the B3 nominal 3.828e26 W.5778 K is an older literature value. It was added in #683 without a source.
SolarMass. The old value, 1.98947e30, doesn't match any published value. It looks like a typo of 1.98847e30. The unit links to Wikipedia, which currently gives two values:
The IAU defines only a nominal mass parameter (GM), so the nominal mass in kg is that parameter divided by the measured G, and it changes when G is revised. This PR uses 1.98847e30, within the uncertainty of the best estimate, as the smallest correction. If you'd prefer the IAU-derived nominal value for consistency with
SolarRadius, I'm happy to change it. The value was added in #680.Docs
Each changed unit's
XmlDocSummarynow states the value used and its source, andXmlDocRemarkslinks to that source:ThermEc had the generic therm description shared by all three therms; it now describes the EC therm specifically. TorrLiterPerSecond and SolarTemperature had no docs.
Also
Mass.jsonhad a trailing comma after its last unit, which isn't valid JSON. CodeGen's parser tolerates it, but other tools don't.Not included
A broader audit of the unit definitions found other candidates. They need a decision about which variant to use, so they're left for separate PRs:
Pressure.MeterOfHeaduses a water density of 999.744 kg/m³;MeterOfWaterColumnuses 1000.Speed.Machuses a fixed 340.29 m/s with no reference conditions.Testing
...InOne<BaseUnit>) are updated to the exact reciprocals of the new factors.UnitsNet.Testspasses on net10.0. The only failures are twoFeetInchesTestsde-CH cases, which fail on master on my machine too and pass on CI.The regenerated code is a separate commit.
🤖 Generated with Claude Code
https://claude.ai/code/session_012XKhDsyHDc5BHrmibxScqG