Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] res tables are not updated correctly when switching from AC to DC powerflow #2562

Open
5 of 6 tasks
BDonnot opened this issue Mar 20, 2025 · 0 comments
Open
5 of 6 tasks
Labels

Comments

@BDonnot
Copy link
Contributor

BDonnot commented Mar 20, 2025

Bug report checklis

  • 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

Reproducible Example

import pandapower as pp
import pandapower.networks as pn
import numpy as np

net = pn.case1118()

# after a dc powerflow, q_mvar is nan, which is correct
pp.rundcpp(net)
assert not np.isfinite(net.res_load["q_mvar"]).any()

# then I run an AC powerflow, q_mvar is finite for all, which is again correct
pp.runpp(net)
assert np.isfinite(net.res_load["q_mvar"]).all()
res_load = 1. * net.res_load["q_mvar"]

# I run a second DC powerflow after a the AC one, results from AC are kept
pp.rundcpp(net)
print(f"max diff between AC and DC (should be Nan): {(net.res_load['q_mvar'] - res_load).max()}")
assert not np.isfinite(net.res_load["q_mvar"]).any()

Issue Description and Traceback

The first DC powerflow (and by extension as long as no AC powerflow are fun) is correct (nan for q)

But when an AC powerflow is run, some results from this computation are kept for the DC powerflow. Which lead some res tables (at least res_load and res_gen, but probably more) to be incorrect.

Expected Behavior

In DC, q should be 0 (or NaN) in the result tables as far as I understand DC computation :-)

Installed Versions

I tested it with pandapower 3. and pandapower 2.xx and behaviour is still the same, not sure it's relevant.

However, here are the full venv used:
certifi==2025.1.31
charset-normalizer==3.4.1
deepdiff==8.3.0
geojson==3.2.0
-e git+https://github.com/bdonnot/grid2op.git@b1dde84b0920299f0487388f55a98eaf02321a69#egg=Grid2Op
idna==3.10
-e git+https://github.com/grid2op/lightsim2grid.git@0a03640974d3764e4e5aa2c49b03a9ed0300bc99#egg=LightSim2Grid
lxml==5.3.1
networkx==3.4.2
numpy==2.2.3
orderly-set==5.3.0
packaging==24.2
pandapower==3.0.0
pandas==2.2.3
pybind11==2.13.6
python-dateutil==2.9.0.post0
pytz==2025.1
requests==2.32.3
scipy==1.13.1
setuptools==76.0.0
six==1.17.0
tqdm==4.67.1
typing_extensions==4.12.2
tzdata==2025.1
urllib3==2.3.0

Label

  • Relevant labels are selected
@BDonnot BDonnot added the bug label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant