You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You know how many of the quantities would throw an exception from their ToUnit/As(UnitSystem) method when they don't have any unit with a proper SI BaseUnit.. well I'd like to change that (at least in regards to UnitSystem.SI):
I think it's reasonable to say that no matter what unit system we use, "a dimensionless quantity should have the decimal fraction as it's base unit" - with the %, ppm, ppb etc. being the derived units. In the future we could probably talk about extending our definition of the BaseUnits (e.g. consider mg/mg as [M][M^-1] or something) but as long as the ratio is composed of the same base-units (i.e. no additional conversion such as x * 100) we could simplify the code generated for these methods to ignore the parameter (the unit system) and simply return the As(BaseUnit).
from memory, there are only a couple of other quantities which were failing (mostly due to simply missing their BaseUnits in the json-definition): I've already got these ready (as I needed them for something else)
from memory, the only breaking change w.r.t. the existing definitions was the Angle which used to have the DegreeCelsius as it's BaseUnit (which we've already fixed) and the FuelEfficiency, which I wanted to invert (I don't remember where I mentioned this), and for which I had to add the "SI unit" (don't quote me on that ) MeterPerCubicMeter (m/m³) (we could go even further and say that this should probably be it's BaseUnit but I haven't gone that far..😆)
Overall, I know that this can be done (as I've already removed the SupportsSIUnitSystem from my version of the tests, a few months ago..), so if you don't mind I'd like to do it for the v6.
PS In the future (or whenever you say), I'd also like to move the As(UnitSystem) and the ToUnit(UnitSystem) methods out of the IQuantity interface (similarly to what I propose in #1461 w.r.t. the "Equals with tolerance", these could be transformed into extension methods, without breaking the existing usages).
PS2 There is of course a lot more work to be done regarding the support for the other unit systems but I think we can keep the experimental flag on these for the v6 release, and come back to it later (I do have some ideas on the matter)
The text was updated successfully, but these errors were encountered:
You know how many of the quantities would throw an exception from their
ToUnit
/As(UnitSystem)
method when they don't have any unit with a proper SIBaseUnit
.. well I'd like to change that (at least in regards toUnitSystem.SI
):%
,ppm
,ppb
etc. being the derived units. In the future we could probably talk about extending our definition of theBaseUnits
(e.g. considermg/mg
as[M][M^-1]
or something) but as long as the ratio is composed of the same base-units (i.e. no additional conversion such asx * 100
) we could simplify the code generated for these methods to ignore the parameter (the unit system) and simply return theAs(BaseUnit)
.BaseUnits
in the json-definition): I've already got these ready (as I needed them for something else)Angle
which used to have theDegreeCelsius
as it'sBaseUnit
(which we've already fixed) and theFuelEfficiency
, which I wanted to invert (I don't remember where I mentioned this), and for which I had to add the "SI unit" (don't quote me on that )MeterPerCubicMeter
(m/m³) (we could go even further and say that this should probably be it'sBaseUnit
but I haven't gone that far..😆)Overall, I know that this can be done (as I've already removed the
SupportsSIUnitSystem
from my version of the tests, a few months ago..), so if you don't mind I'd like to do it for thev6
.PS In the future (or whenever you say), I'd also like to move the
As(UnitSystem)
and theToUnit(UnitSystem)
methods out of theIQuantity
interface (similarly to what I propose in #1461 w.r.t. the "Equals with tolerance", these could be transformed into extension methods, without breaking the existing usages).PS2 There is of course a lot more work to be done regarding the support for the other unit systems but I think we can keep the experimental flag on these for the
v6
release, and come back to it later (I do have some ideas on the matter)The text was updated successfully, but these errors were encountered: