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] Wrong direction of transformers when importing .m files #2409

Open
5 of 6 tasks
SimonUlm opened this issue Sep 27, 2024 · 3 comments
Open
5 of 6 tasks

[bug] Wrong direction of transformers when importing .m files #2409

SimonUlm opened this issue Sep 27, 2024 · 3 comments
Labels

Comments

@SimonUlm
Copy link

SimonUlm commented Sep 27, 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

from pandapower.converter.matpower.from_mpc import _m2ppc

file = 'pglib_opf_case24_ieee_rts.m'
ppc_before = _m2ppc(file, 'mpc')
net = pp.converter.from_mpc(file)
ppc_after = pp.converter.to_ppc(net, init='flat')

Issue Description and Traceback

Note

The file mentioned above is from the pglib-opf library.

Issue

When comparing ppc_before['branch'] and ppc_after['branch'], you will notice that the from and to buses of all transformers have been swapped. However, the tap ratios remain the same, which will result in wrong results in pf and opf calculations.
Afaik this is due to from_ppc.py (lines 241 to 245) where hv_bus and lv_bus are swapped in case the base voltage of the from bus is less than the base voltage if the to bus, but the tap ratio and phase shift remain the same.

Expected Behavior

The pandapower case structure should contain the correct direction of the transformer or at least contain information to restore the original direction.

Installed Versions

  • python version: * pandas version: * networkx version: * scipy version: * numpy version: * packaging version: * tqdm version: * deepdiff version: * Operating System name/version:

Label

  • Relevant labels are selected
@SimonUlm SimonUlm added the bug label Sep 27, 2024
@SimonUlm SimonUlm changed the title [bug] YOUR TITLE [bug] Wrong direction of transformers when importing .m files Sep 27, 2024
@vogt31337
Copy link
Contributor

Hi, interesting error. I'll discuss it with some people. I am wondering that this problem hasn't surfaced earlier, since pandapower is basically built around the matpower architecture. And I am confused why the tests don't capture it...

@vogt31337
Copy link
Contributor

Discussed this a little, seems to be a really weird setup, since normally you would connect the HV-Side of a transformer to the higher voltage in a grid model and the LV-Side of the transformer to the lower voltage. Your suggest that this was flipped in your example and therefore errors occured. I'd suggest repairing your examples / test cases. But still this should be at least communicated to the user.

@SimonUlm
Copy link
Author

SimonUlm commented Nov 4, 2024

Hi, thank you very much for your reply and sorry for my very late response. I agree that this setting is rather unusual. However, this wasn't just any test case, but a pglib-opf (former NESTA) test case which are considered state-of-the-art benachmarking test cases by many. (Especially when it comes to convex relaxation, which is admittedly not the focus of pandapower, yet). Also, this wasn't the only test case having this issue. Therefore, I think this issue should be addressed. Either by communicating it to the user (as you already suggested) or recalculate the tap ratio. Personally, I would prefer the latter.

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

2 participants