Skip to content

[bug] pandapower.converter.{pypower, matpower} broken #2932

@determ1ne

Description

@determ1ne

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

"""
% export a mpc from matpower first
mpc = case9241pegase;
save('mpc.mat');
"""
from pandapower.converter.matpower import from_mpc, to_mpc
net = from_mpc('mpc.mat')
to_mpc(net, 'mpc_out.mat', init="flat")

# the matpower will fail to run OPF with the new mat
"""
load("mpc_out.mat");
runopf(mpc);
% Did not converge in 2 iterations
"""

Issue Description and Traceback

This issue may be similar or related to #2620 .

  1. Currently from_mpc and to_mpc combination destroys the data.
from pandapower.converter.matpower import from_mpc, to_mpc

net = from_mpc('case9241.mat')
to_mpc(net, 'case9241_out.mat', init="flat")

output:

There are 22 branches which are considered as trafos - due to ratio unequal 0 or 1 - but connect same voltage levels.
  1. from_ppc get the same output, seems broken too.

Expected Behavior

MATPOWER OPF should converge with the exported case file.

Installed Versions

  • pandapower version: develop branch, commit f91a669
  • python version: 3.13.12
  • pandas version: 2.3.3
  • networkx version: 3.6.1
  • scipy version: 1.16.3
  • numpy version: 2.3.5
  • packaging version: 25.0
  • tqdm version: 4.67.3
  • deepdiff version: 8.6.2
  • Operating System name/version: Microsoft Windows Version 10.0.26200.7628

Label

  • Relevant labels are selected

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions