You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I realized that basically none of the fields in PSY that carry voltage values are wired into the new units system. Should they be? I tend to think so.
By "wired into the new units system," I mean the following:
get_foo(comp) errors: you need get_foo(comp, {SU/DU/NU})
there's a get_foo_unitful(comp, {SU/DU/NU} function
[similar for the setters]
This is largely a UI question: we always use the component's base voltage as the system voltage for that component, so per-unitized voltage is the same in CU and in SU. As such, there's not a lot of times when the functionality is needed, except for the rare situation where we want voltage in NU.
All the same, I think we should probably add it for consistency.
I agree this should be one of the categories we add for consistency, though I think the most useful one is just the natural units interface for base_voltage so it's explicit. In constructors (e.g., ACBus), will you be required to define the natural units of base_voltage (100u"kV") or is it a float in kV?
base_power and base_voltage are always in natural units. Otherwise things get weird: set_base_power!(gen, 0.5 * CU) is literally impossible, while set_base_power!(gen, 1 * CU) is ambiguous. Calling {get/set}_base_foo with CU or SU errors.
The getters and the setters accept both raw float (no units) and natural units. The "all keywords" constructor is the same. However, the "positional arguments" constructors only accepts raw floats. I'll open an issue on making positional constructors accept natural units--should be doable by a similar strategy.
Activity
kdayday commentedon Sep 28, 2026
I agree this should be one of the categories we add for consistency, though I think the most useful one is just the natural units interface for
base_voltageso it's explicit. In constructors (e.g.,ACBus), will you be required to define the natural units ofbase_voltage(100u"kV") or is it a float in kV?luke-kiernan commentedon Sep 28, 2026
base_powerandbase_voltageare always in natural units. Otherwise things get weird:set_base_power!(gen, 0.5 * CU)is literally impossible, whileset_base_power!(gen, 1 * CU)is ambiguous. Calling{get/set}_base_foowithCUorSUerrors.The getters and the setters accept both raw float (no units) and natural units. The "all keywords" constructor is the same. However, the "positional arguments" constructors only accepts raw floats. I'll open an issue on making positional constructors accept natural units--should be doable by a similar strategy.
Wire voltage fields into the explicit-units engine (#1823)
luke-kiernan commentedon Oct 6, 2026
Merged into
psy6.