modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
472 stars 169 forks source link

Revert adding unit to pi due to regressions #4191

Closed HansOlsson closed 11 months ago

HansOlsson commented 1 year ago

As indicated in #4046 it we need to revert part of #4155 since it is causing too many regressions for a minor release.

With proposed unit-checking in Dymola this reduces the warnings from 2301 to 1224 (Most - but not all are unit-related.)

Obviously many of them could be corrected, but I don't see that we have the resources to focus on that for this minor release. The first models found were CompareTransformers, SeriesResonance in Modelica.Electrical.Analog.Examples.

henrikt-ma commented 1 year ago

I would expect there to be a small number of root causes, and that we would have time to correct these before the freeze at the start of the next year.

Edit: Based on the affected examples mentioned above, the fix would be a simple matter of introducing parameters with the proper units instead of the literals used in the binding equations involving pi. The newly introduced parameters can be made protected when there is a need to protect agains backwards incompatibility in the future, if Modelica one day would have a mechanism for attaching units to literals (for example, L = (0.1)["V/A"] / (2 * pi)). Alternatively, the newly introduced parameters could be made public, which would actually add value to the examples as it makes it more natural to change values after translation.

HansOlsson commented 1 year ago

I would strongly recommend to merge this, and then prioritize investigating and fixing the issues together with other items.

henrikt-ma commented 1 year ago

I suggest that we get started right away cleaning up the uses of pi, and then we can see how far we get before the planned freeze early next year.