Skip to content

Support scaled SI units #2616

@TorkelE

Description

@TorkelE

E.g. this fails:

using ModelingToolkit, DynamicQuantities
@parameters p [unit = u"L/s"] d [unit = u"s^(-1)"]
@parameters t [unit = u"s"] 
@variables X [unit = u"L"]
D = Differential(t)
eqs =[D(X) ~ p - d*X]
ModelingToolkit.validate(eqs) # Does not work.

Instead, one have to do:

using ModelingToolkit, DynamicQuantities
@parameters p [unit = u"m^3/s"] d [unit = u"s^(-1)"]
@parameters t [unit = u"s"] 
@variables X [unit = u"m^3"]
D = Differential(t)
eqs =[D(X) ~ p - d*X]
ModelingToolkit.validate(eqs) # Does not work.

These are identical. For highly composite units, rather cumbersome expressions will be generated. Allowing composite units should be very desirable (and was how things used to work).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions