Skip to content

OPF on case9Q raises exception on bool test of qcost #97

Description

@dchassin

Solving case9Q raises the following exception:

    result = opf(self.model.case,ppoption(**self.model.options))
  File "/Users/david/GitHub/eudoxys/pypower_sim/pypower_sim/.venv/lib/python3.14/site-packages/pypower/runopf.py", line 31, in runopf
    r = opf(casedata, ppopt)
  File "/Users/david/GitHub/eudoxys/pypower_sim/pypower_sim/.venv/lib/python3.14/site-packages/pypower/opf.py", line 172, in opf
    results, success, raw = opf_execute(om, ppopt)
                            ~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/david/GitHub/eudoxys/pypower_sim/pypower_sim/.venv/lib/python3.14/site-packages/pypower/opf_execute.py", line 81, in opf_execute
    results, success, raw = pipsopf_solver(om, ppopt)
                            ~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/Users/david/GitHub/eudoxys/pypower_sim/pypower_sim/.venv/lib/python3.14/site-packages/pypower/pipsopf_solver.py", line 135, in pipsopf_solver
    solution = pips(f_fcn, x0, A, l, u, xmin, xmax, gh_fcn, hess_fcn, opt)
  File "/Users/david/GitHub/eudoxys/pypower_sim/pypower_sim/.venv/lib/python3.14/site-packages/pypower/pips.py", line 372, in pips
    Lxx = hess_fcn(x, lmbda, opt["cost_mult"])
  File "/Users/david/GitHub/eudoxys/pypower_sim/pypower_sim/.venv/lib/python3.14/site-packages/pypower/pipsopf_solver.py", line 133, in <lambda>
    hess_fcn = lambda x, lmbda, cost_mult: opf_hessfcn(x, lmbda, om, Ybus, Yf[il, :], Yt[il, :], ppopt, il, cost_mult)
                                           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/david/GitHub/eudoxys/pypower_sim/pypower_sim/.venv/lib/python3.14/site-packages/pypower/opf_hessfcn.py", line 106, in opf_hessfcn
    if any(qcost):          ## Qg is not free
       ~~~^^^^^^^
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Recommend changing opf_hessfnc.py@106 to the following:

    if qcost.any():          ## Qg is not free

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions