Skip to content

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

Closed
@SimonUlm

Description

@SimonUlm

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions