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

Update the UnitRelations.json #1453

Merged
merged 5 commits into from
Dec 15, 2024

Conversation

lipchev
Copy link
Collaborator

@lipchev lipchev commented Dec 12, 2024

As per my comments from #1200 here are the proposed modifications to the operators:

  • adding an Inverse relation 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)
  • added the -- NoInferredDivision to the KinematicViscosity.SquareMeterPerSecond * Duration.Second operator (as the opposite of the relation was Area / Duration -> KinematicViscosity 😏 )
  • added the -- NoInferredDivision to the Area.SquareMeter * ReciprocalArea.InverseSquareMeter operator (as the opposite of the relation was Ratio / Area -> InverseArea does not appear intuitive )
  • change the multiplication units (using the BaseUnit) for the Mass.Kilogram = AmountOfSubstance.Mole * MolarMass.KilogramPerMole
  • change the multiplication units (using the BaseUnit) for the AmountOfSubstance.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).

- 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)
@lipchev
Copy link
Collaborator Author

lipchev commented Dec 12, 2024

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..

@angularsen
Copy link
Owner

@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?

@lipchev
Copy link
Collaborator Author

lipchev commented Dec 13, 2024

@angularsen I've selected them such that they shouldn't have any merge conflicts between each other.

Copy link
Owner

@angularsen angularsen left a 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])
@lipchev
Copy link
Collaborator Author

lipchev commented Dec 15, 2024

I've added another small change (and updated the description in the PR)

change the multiplication units (using the BaseUnit) for the AmountOfSubstance.Mole = MolarFlow.MolePerSecond * Duration.Second

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).

Copy link
Owner

@angularsen angularsen left a 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 👍

@angularsen angularsen merged commit ef739cd into angularsen:release/v6 Dec 15, 2024
1 check was pending
@angularsen
Copy link
Owner

@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! ❤️

@lipchev lipchev deleted the unit-relations-v6 branch December 16, 2024 15:19
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.

2 participants