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] IEEE14 Case: Zero resistance lines get interpreted as transformers #2392

Open
4 of 6 tasks
leuchtum opened this issue Sep 5, 2024 · 5 comments
Open
4 of 6 tasks
Assignees
Labels

Comments

@leuchtum
Copy link

leuchtum commented Sep 5, 2024

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
import pandas as pd
import pypowsybl

pandapower_net = pandapower.networks.case14()
pypowsybl_net = pypowsybl.network.create_ieee14()

results = {
    "n_buses": {
        "expected": 14,
        "powsybl": len(pypowsybl_net.get_buses()),
        "pandapower": len(pandapower_net.bus),
    },
    "n_lines": {
        "expected": 17,
        "powsybl": len(pypowsybl_net.get_lines()),
        "pandapower": len(pandapower_net.line),
    },
    "n_trafos": {
        "expected": 3,
        "powsybl": len(pypowsybl_net.get_2_windings_transformers()),
        "pandapower": len(pandapower_net.trafo),
    },
    "n_gens": {
        "expected": 5,
        "powsybl": len(pypowsybl_net.get_generators()),
        "pandapower": len(pandapower_net.gen),
    },
    "n_loads": {
        "expected": 11,
        "powsybl": len(pypowsybl_net.get_loads()),
        "pandapower": len(pandapower_net.load),
    },
    "n_shunts": {
        "expected": 1,
        "powsybl": len(pypowsybl_net.get_shunt_compensators()),
        "pandapower": len(pandapower_net.shunt),
    },
}

print(pd.DataFrame(results).T)

#           expected  powsybl  pandapower
# n_buses         14       14          14
# n_lines         17       17          15
# n_trafos         3        3           5
# n_gens           5        5           4
# n_loads         11       11          11
# n_shunts         1        1           1

Issue Description and Traceback

The IEEE14 case has 3 trafos and 17 lines, resulting in 20 branches (when interpreting it in MATPOWER style). If we look at the example above , pandapower has some trouble.

First, there is one generator less than expected. This is ok, as the missing generator is interpreted as the external grid.

But then if you compare n_linesand n_trafos, something is odd. Two lines are interpreted as trafos. I had a deeper look into it and I think the problem lies in how a zero-resistance line is interpreted by pandapower when loading a case file. If we have a look at the normal ieee14 data (see here) there are two lines that have a zero resistance.

Expected Behavior

Expected result see example above.

Installed Versions

INSTALLED VERSIONS
------------------
commit                : d9cdd2ee5a58015ef6f4d15c7226110c9aab8140
python                : 3.12.5.final.0
python-bits           : 64
OS                    : Darwin
OS-release            : 23.6.0
Version               : Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:21 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8103
machine               : arm64
processor             : arm
byteorder             : little
LC_ALL                : None
LANG                  : en_US.UTF-8
LOCALE                : en_US.UTF-8

pandas                : 2.2.2
numpy                 : 1.26.4
pytz                  : 2024.1
dateutil              : 2.9.0.post0
setuptools            : None
pip                   : 24.2
Cython                : None
pytest                : 8.3.2
hypothesis            : None
sphinx                : None
blosc                 : None
feather               : None
xlsxwriter            : None
lxml.etree            : None
html5lib              : None
pymysql               : None
psycopg2              : None
jinja2                : None
IPython               : None
pandas_datareader     : None
adbc-driver-postgresql: None
adbc-driver-sqlite    : None
bs4                   : None
bottleneck            : None
dataframe-api-compat  : None
fastparquet           : None
fsspec                : None
gcsfs                 : None
matplotlib            : 3.9.2
numba                 : None
numexpr               : None
odfpy                 : None
openpyxl              : None
pandas_gbq            : None
pyarrow               : None
pyreadstat            : None
python-calamine       : None
pyxlsb                : None
s3fs                  : None
scipy                 : 1.13.1
sqlalchemy            : None
tables                : None
tabulate              : None
xarray                : None
xlrd                  : None
zstandard             : None
tzdata                : 2024.1
qtpy                  : None
pyqt5                 : None
> pip freeze
annotated-types==0.7.0
bracex==2.5
bump-my-version==0.26.0
click==8.1.7
contourpy==1.3.0
cycler==0.12.1
deepdiff==8.0.1
fonttools==4.53.1
iniconfig==2.0.0
kiwisolver==1.4.5
-e git+ssh://[email protected]/leuchtum/ma-core.git@e480e47f57173f3d45d811e2edcd0e8721171d17#egg=macore
markdown-it-py==3.0.0
matplotlib==3.9.2
mdurl==0.1.2
mypy==1.11.2
mypy-extensions==1.0.0
networkx==3.3
numpy==1.26.4
orderly-set==5.2.2
packaging==24.1
pandapower==2.14.11
pandas==2.2.2
pandas-stubs==2.2.2.240807
pillow==10.4.0
pimpmyplt==0.0.6
pluggy==1.5.0
prettytable==3.11.0
prompt-toolkit==3.0.36
pydantic==2.8.2
pydantic-settings==2.4.0
pydantic_core==2.20.1
Pygments==2.18.0
pyparsing==3.1.4
pypowsybl @ file:///Users/daniel/Desktop/DEV_ma_core/pypowsybl-1.7.0.dev1-cp312-cp312-macosx_11_0_arm64.whl
pytest==8.3.2
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
pytz==2024.1
questionary==2.0.1
rich==13.8.0
rich-click==1.8.3
ruff==0.6.3
scipy==1.13.1
six==1.16.0
tomlkit==0.13.2
tqdm==4.66.5
types-pytz==2024.1.0.20240417
typing_extensions==4.12.2
tzdata==2024.1
wcmatch==9.0
wcwidth==0.2.13

Label

  • Relevant labels are selected
@leuchtum leuchtum added the bug label Sep 5, 2024
@leuchtum
Copy link
Author

leuchtum commented Sep 5, 2024

Supplement:

pandapower.runpp(pandapower_net)
assert pandapower_net["_ppc"]["branch"].shape[0] == 20

@pawellytaev
Copy link
Contributor

Hi @leuchtum, thanks for bringing that up. We made some recent changes in pandapower develop that affected the networks in pandapower, see the PR #2347. Could you test this with the current version of develop and see what happens? Maybe this is already solved there

@pawellytaev pawellytaev self-assigned this Sep 5, 2024
@leuchtum
Copy link
Author

leuchtum commented Sep 5, 2024

@pawellytaev Checked on 2.8.0, 2.14.11 and branch develop (commit 11af12c), all with same result.

@pawellytaev
Copy link
Contributor

alright, let me take a look into it. I'll come back to this in the next few days

@vogt31337
Copy link
Contributor

@leuchtum, I think this is because normally lines with zero impedance, produce lots of problems (loadflow does not converge and so on). And therefore I think they get rewritten as a transformer. Why exactly this happens I cannot currently say. I think this to have the phase shifter and circumvent convergence errors...

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

3 participants