e2nIEE / pandapower

Convenient Power System Modelling and Analysis based on PYPOWER and pandas
https://www.pandapower.org
Other
848 stars 478 forks source link

[bug] Powerflow performance drop with newer versions #2264

Closed Thomas8558 closed 5 months ago

Thomas8558 commented 6 months ago

Bug report checklist

Reproducible Example

import timeit
import pandapower as pp

setup = """
import warnings
import pandapower as pp
import pandapower.networks as pn

warnings.filterwarnings("ignore")

net = pn.case9241pegase()
pp.runpp(net)  # first run for numba "compiling"
"""

number = 10

with_numba = timeit.timeit("pp.runpp(net, numba=True)", setup=setup, number=number)
without_numba = timeit.timeit("pp.runpp(net, numba=False)", setup=setup, number=number)

print(f"Pandapower version: {pp.__version__}")
print(f"With numba: {with_numba/number*1000:.1f} ms")
print(f"Without numba: {without_numba/number*1000:.1f} ms")

Issue Description and Traceback

Hello, I have noticed a performance drop with newer versions of pandapower when running the power flow. I have checked the performance with the snippet of code provided on 3 different pandapower versions, with the following results:

Pandapower version: 2.10.1 With numba: 272.48 ms Without numba: 360.51 ms

Pandapower version: 2.13.1 With numba: 1456.08 ms Without numba: 1528.37 ms

Pandapower version: 2.14.6 With numba: 3591.73 ms Without numba: 3685.65 ms

These 3 tests were done each time on a new python environment where only pandapower, numba and their dependencies were installed.

Could you please help me with this issue? Is the problem on my end?

Expected Behavior

The expected behavior is to have the same or close to the same performance with newer versions.

Installed Versions

Label

rbolgaryn commented 5 months ago

Dear @Thomas8558 ,

thank you for this bug report!

We implemented a hotfix on develop branch. We also have a more elegant solution on a different branch that is work in progress, which will be finalized in the coming days or weeks. Anyways, the fix right now should have solved the problem.

Please refer to the documentation to install the pandapower development version from GitHub (section "Development version"):

https://www.pandapower.org/start/