Skip to content

Voltage fields and Units #1821

Closed
Closed

Description

@luke-kiernan

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.

Activity

  1. kdayday commented on Sep 28, 2026

    @kdayday
    Contributor

    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?

  2. luke-kiernan commented on Sep 28, 2026

    @luke-kiernan
    ContributorAuthor

    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.

  3. self-assigned this
    on Sep 29, 2026
  4. luke-kiernan commented on Oct 6, 2026

    @luke-kiernan
    ContributorAuthor

    Merged into psy6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions