Open isaacsas opened 2 weeks ago
This really requires someone to dig into MTK and DynamicQuantites to understand how they are handling numeric coefficients that arise when converting and comparing units, and ensure that only numeric components arising from unit conversions are getting compared (i.e. numeric components that are part of expressions like X^2/2
should get dropped probably before conversion, including when tracing through registered functions).
MTK version 9.34 supports non-SI units as described here: https://github.com/SciML/ModelingToolkit.jl/pull/2621 . However Catalyst is currently pinned to MTK v9.32. So it may just be as simple as updating that dependency.
Catalyst isn't pinned to 9.32; are you sure this isn't something you did locally? I currently have ModelingToolkit 9.35.1 with Catalyst 14.4 locally.
Note that the line
ModelingToolkit = "9.32"
in the Project.toml means support is declared for any 9.X release with X >= 32 (see https://pkgdocs.julialang.org/v1/compatibility/).
I suspect the issue here is that ModelingToolkit converts non-SI units to SI internally it seems, and that can lead to expressions where numeric coefficients in a symbolic expression get merged with numeric coefficients generated from the unit conversions (like in converting micromolar to mol/m^3). There is then no effective way to unit check after this point. I think expressions need to have numeric coefficients removed prior to unit conversion to avoid this issue.
Or perhaps a way is needed for users to indicate how registered functions transform units to avoid having to try to trace through them.
Catalyst isn't pinned to 9.32; are you sure this isn't something you did locally? I currently have ModelingToolkit 9.35.1 with Catalyst 14.4 locally.
Note that the line
ModelingToolkit = "9.32"
in the Project.toml means support is declared for any 9.X release with X >= 32 (see https://pkgdocs.julialang.org/v1/compatibility/).
Oh, sorry, I guess I should have read the manual more carefully :)
No worries! I still get messed up on aspects of semver in Julia (and finding out where to even read about it can take a bit of effort).
This may be related to https://github.com/SciML/ModelingToolkit.jl/issues/3017
SI units works, i.e.
passes, but non-SI units still have issues right now:
gives
So it seems there are still issues with unit conversion to SI going on.