-
Notifications
You must be signed in to change notification settings - Fork 386
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
Update the UnitRelations.json #1453
Conversation
- adding an Inverse releation between Density and SpecificVolume (replacing the existing multiplication) - adding standard multiplication for MolarEnergy.JoulePerMole * AmountOfSubstance.Mole (returning Energy.Joule) - adding standard multiplication for Illuminance.Lux * Area.SquareMeter (returning LuminousFlux.Lumen) - TemperatureDelta.Kelvin * CoefficientOfThermalExpansion.PerKelvin now returns a Ratio (instead of a double) includes tests for all operators from the affected classes (most operators, introduced with the UnitRelations.json were never covered by tests)
You'll probably remark that there more than one styles for naming / testing the operators, I've been following the convention in the file (or rather the AI was eager to suggest the same naming and I just went along) : which one do you think we should prefer? There is a of course benefits from using the [Theory] variant everywhere, but frankly- writing in this style is quite tedious with the 6 parameters.. Donno, up to you.. |
@lipchev Holy cow, you have like 10 PRs active right now 😅 I'll try to get to them this weekend, any particular order or ones I should do first? |
@angularsen I've selected them such that they shouldn't have any merge conflicts between each other. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions and suggestions
…Flow * Duration (using the BaseUnits) - simplifying the tests (removing the [Theory])
…ersion to/from Kilo)
I've added another small change (and updated the description in the PR)
I have a plan to change this in the future, but for the time being I think it's best to avoid using derived units in the operators (due to the additional conversions that are required). |
…emperatureDeltaTests (and fixed the direction of the operands)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me now 👍
@lipchev that's what I got for now, I'll have to find time later this week for the remaining PRs. Awesome work though, thanks! ❤️ |
As per my comments from #1200 here are the proposed modifications to the operators:
Inverse
relation betweenDensity
andSpecificVolume
(replacing the existing multiplication)MolarEnergy.JoulePerMole * AmountOfSubstance.Mole
(returningEnergy.Joule
)Illuminance.Lux * Area.SquareMeter
(returningLuminousFlux.Lumen
)TemperatureDelta.Kelvin * CoefficientOfThermalExpansion.PerKelvin
now returns aRatio
(instead of adouble
)-- NoInferredDivision
to theKinematicViscosity.SquareMeterPerSecond * Duration.Second
operator (as the opposite of the relation wasArea / Duration
->KinematicViscosity
😏 )-- NoInferredDivision
to theArea.SquareMeter * ReciprocalArea.InverseSquareMeter
operator (as the opposite of the relation wasRatio / Area
->InverseArea
does not appear intuitive )BaseUnit
) for theMass.Kilogram = AmountOfSubstance.Mole * MolarMass.KilogramPerMole
BaseUnit
) for theAmountOfSubstance.Mole = MolarFlow.MolePerSecond * Duration.Second
I've included tests for all operators from the affected classes (most operators, introduced with the
UnitRelations.json
were never covered by tests).PS There are still many operators not covered by tests, but I'd rather finish them later (hopefully once we no longer have to worry about rounding errors).