Skip to content

_run_ac_pf_with_qlims_enforced continues even if _run_ac_pf_without_qlims_enforced did not succeed. Intended behaviour? #3085

Description

@LKuhrmann

Bug report checklist

  • Searched the issues page for similar reports

  • Read the relevant sections of the documentation

  • Browse the tutorials and tests for usefull code snippets and examples of use

  • Reproduced the issue after updating with pip install --upgrade pandapower (or git pull)

  • Tried basic troubleshooting (if a bug/error) like restarting the interpreter and checking the pythonpath

Issue Description and Traceback

In runpf_newton_raphson_pf.py, _run_ac_pf_with_qlims_enforced calls _run_ac_pf_without_qlims_enforced within its loop.

However, if _run_ac_pf_without_qlims_enforced returns success = false, the loop within _run_ac_pf_with_qlims_enforced keeps going.
If a later _run_ac_pf_without_qlims_enforced call returns success = true, _run_ac_pf_with_qlims_enforced reports success, despite one of the power flows in its iteration not converging.

To me this seems like a straightforward bug, if success is false, _run_ac_pf_with_qlims_enforced should stop iterating, as later results cannot be trusted to have correctly limited generators (as the generators are Q limited based on non-converged results).

As a test, I added print(success) at line 193 in runpf_newton_raphson_pf.py.
This is the output I get in my (seemingly quite special) case:

True
True
False
True

For some reason could only get this printing to work on the conda install which is older in my case (running from Julia via PythonCall.jl and CondaPkg.jl), resulting solution is the same in the newest pandapower though. Thats why my versions are also outdated.

I am afraid I cannot provide the network with which this happened, but I hope that you can follow the issue I am presenting.

What are your thoughts? Should _run_ac_pf_with_qlims_enforced return success = true as long as the last iteration converges even if previous iterations did not?

Expected Behavior

_run_ac_pf_with_qlims_enforced should return success=false if any of its _run_ac_pf_without_qlims_enforced calls return success=false

Reproducible Example

I cannot provide a reproducible example, as I cannot share the network on which I found this issue. I hope that the reasoning is enough. Otherwise, feel free to close this bug report.

Installed Versions

Pandapower: 3.2.1

INSTALLED VERSIONS

commit : 9c8bc3e55188c8aff37207a74f1dd144980b8874
python : 3.12.13
python-bits : 64
OS : Windows
OS-release : 11
Version : 10.0.26200
machine : AMD64
processor : Intel64 Family 6 Model 186 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : English_Sweden.1252

pandas : 2.3.3
numpy : 2.2.6
pytz : 2026.3.post1
dateutil : 2.9.0.post0
pip : None
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : None
lxml.etree : 6.1.1
matplotlib : 3.11.1
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : None
pyreadstat : None
pytest : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.13.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2026.3
qtpy : None
pyqt5 : None

Label

  • Relevant labels are selected

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions