Skip to content

to_powerdata returns bus va in degrees while its docstring says angles are radians #138

Closed

Description

@samtalki

to_powerdata's docstring states:

Powers are per unit on baseMVA, angles are radians, bus_i keeps the source bus id [...]

The branch rows honour that — src/exa.jl converts phase_shift_degrees, angle_min_degrees and angle_max_degrees with deg2rad. The bus rows do not:

va = _finite(b.va_degrees, T, label, :va),

so bus.va reaches the caller in degrees while branch.shift, branch.angmin and branch.angmax reach it in radians, out of the same call.

A consumer that trusts the docstring and uses bus.va as a warm start, or compares it against branch.shift, is silently off by 180/pi. It is invisible on a flat start, where every va is zero, which is most test cases.

Expected: va = deg2rad(_finite(b.va_degrees, ...)), matching the branch rows and the docstring. Alternatively rename the field so the unit is stated, but the docstring promise is the simpler thing to keep.

This is a behaviour change for anyone already compensating, so it probably wants a CHANGELOG note.

Found while porting PowerDiff.jl to 0.11 (grid-opt-alg-lab/PowerDiff.jl#76). PowerDiff does not consume bus.va, so it is unaffected either way.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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