Skip to content

sim.nr_pq() fails to detect over-constrained buses when values are zero #140

Description

@marcostfermin

Describe the bug

nr_pq() detects over-constrained buses using truthiness checks like all((P_set[i], Q_set[i], V_set[i][0])). Valid values of 0.0 are treated as False, so buses that are still over-specified are not detected.

Reproduction Code

# Setup
import electricpy as ep

Ybus = [[-10j, 10j],
        [ 10j,-10j]]

V_set = [[1.0, 0.0], [None, None]]
P_set = [0.0, None]
Q_set = [0.0, None]

# Code which causes failure
ep.sim.nr_pq(Ybus, V_set, P_set, Q_set)

Expected behavior

The function should raise ValueError("Over-Constrained System") because P, Q, and V are all specified for the same bus, even if P and Q are zero.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Linux]
  • Python Version [e.g. 3.7]
  • Version [e.g. 0.2.1]

Additional context

Checks should use explicit is not None logic instead of truthiness.

Activity

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

Metadata

Metadata

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions