Open GabrielKS opened 5 months ago
one thing to consider in all of this is the fact that unitful.jl doesn't resolve the challenges of per unit modeling.
Further evidence that the current approach causes anguish "in the field": https://github.com/NREL-Sienna/PowerFlows.jl/blob/a93412c6c1712071f9117278e6654a84fcb25199/src/psse_exporter/psse_exporter.jl#L182
From time to time, issues come up relating to confusion about the various units systems PowerSystems uses — natural units (which may perhaps be subdivided into mega- vs. kilo-, etc.), device base units, and system base units; where in the latter two cases the units are defined in reference to a per-device or per-system reference quantity. Some of these issues are:
To be thorough, the units issue can be broken down into a few parts:
In theory, most of these issues can be eliminated by forcing the user to specify units as a keyword argument all over the place, or by having sensible, well-documented defaults and allowing the user to specify units if they want something different. I think a more robust solution, which would put all the units logic in a single place and automatically provide a consistent interface wherever units appear, is something along the lines of Unitful.jl that attaches units directly to quantities themselves. In either case, a significant refactor is required. I'm hoping that for the next major release of PowerSystems, we can solve this problem holistically and give the user a simple mental model of how PowerSystems deals with units systems. Let's use this issue to track our progress.