Skip to content

Automatic simplification of composed quantity typesΒ #16

@nicoddemus

Description

@nicoddemus

Follow up: #15 (comment)

We should discuss how to automatically simplify composing units:

Scalar(1, 'kg') * Scalar(1, 'm3') / Scalar(1, 'm3') should return a scalar with Quantity('kg').

This implies that we should not have simple units in our database which are actually composed: for example, Quantity("kg/m3") should really be handled as Quantity([("kg", 1), ("m3", 1)]) internally.

This simplification process needs to make sure to not throw away all units and get a Quantity("unitless") back, as an important feature is to have units like "m3/m3" or "g/kg" in our systems.

This also implies that scalar.GetValue("kg/m3") will need to parse "kg/m3" properly into the respective exponents [("kg", 1), ("m3", -1)], as "kg/m3" as a single unit will no longer exist.

@fabioz please let me know if I'm missing something.

cc @igortg @kfasolin @tadeu @damianimc @arthursoprana

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions