Skip to content

Fix: PandapowerConverter compatibility with pandapower 3.5.4 - #496

Open
furqan463 wants to merge 8 commits into
PowerGridModel:mainfrom
furqan463:fix_pp_gen_output
Open

Fix: PandapowerConverter compatibility with pandapower 3.5.4#496
furqan463 wants to merge 8 commits into
PowerGridModel:mainfrom
furqan463:fix_pp_gen_output

Conversation

@furqan463

@furqan463 furqan463 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Fixes #488
Requires #489 #495 to be merged.

Changes proposed in this PR include

pandapower=3.5.4 introduced the network structure for res_gen_3ph which did not exist before. This PR aligns the gen conversion with latest pandapower version.

Checks

  • unit tests updated
  • validation tests clear
  • test data files updated with latest version

Signed-off-by: furqan463 <ahmadfurqanc@gmail.com>
Comment thread src/power_grid_model_io/converters/pandapower_converter.py Outdated
Signed-off-by: furqan463 <ahmadfurqanc@gmail.com>
@furqan463

furqan463 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

pv-node test data files updated using this script:

from copy import deepcopy  # noqa: I001
from pathlib import Path

import pandapower as pp
from power_grid_model import DatasetType, PowerGridModel
from power_grid_model.utils import json_serialize_to_file

from power_grid_model_io.converters.pandapower_converter import PandaPowerConverter

from pp_validation import pp_net_pv_node_3

converter = PandaPowerConverter()

root = Path(__file__).parent / "pv-node" / "pv-node3"
pgm_sym_output_file = root / "pgm_sym_output.json"
pp_sym_output_file = root / "pp_net_sym_output.json"
pgm_asym_output_file = root / "pgm_asym_output.json"
pp_asym_output_file = root / "pp_net_asym_output.json"

net = pp_net_pv_node_3()

pgm_input, _ = converter.load_input_data(net)

model = PowerGridModel(pgm_input)

pgm_sym_output = model.calculate_power_flow(symmetric=True)

json_serialize_to_file(pgm_sym_output_file, pgm_sym_output, dataset_type=DatasetType.sym_output)


pp_sym_out = converter.convert(pgm_sym_output)

net_sym_output = deepcopy(net)
for tbl in pp_sym_out:
    for col in pp_sym_out[tbl].columns:
        net_sym_output[str(tbl)][str(col)] = pp_sym_out[tbl][col]

pp.to_json(net_sym_output, pp_sym_output_file)


pgm_asym_output = model.calculate_power_flow(symmetric=False)

json_serialize_to_file(pgm_asym_output_file, pgm_asym_output, dataset_type=DatasetType.asym_output)

pp_asym_out = converter.convert(pgm_asym_output)

net_asym_output = deepcopy(net)
for tbl in pp_asym_out:
    for col in pp_asym_out[tbl].columns:
        net_asym_output[str(tbl)][col] = pp_asym_out[tbl][col]

pp.to_json(net_asym_output, pp_asym_output_file)

@figueroa1395

Copy link
Copy Markdown
Member

Hello @furqan463,

As mentioned in an earlier PR, we'll get back to you with this as soon as possible. We expect this to be towards the end of the week or the beginning of the next.

Thanks for the contribution!

@figueroa1395 figueroa1395 added the bug Something isn't working label Sep 9, 2026
Comment thread src/power_grid_model_io/converters/pandapower_converter.py Outdated
Comment thread tests/data/pandapower/pv-node/pv-node3/pgm_asym_output.json
Signed-off-by: Engr. Ahmad Furqan <ahmadfurqanc@gmail.com>
@furqan463

Copy link
Copy Markdown
Contributor Author

The json files were copied from power-grid-model before, however, I'm unable to generate json files with same format now. The attributes are combined on one line instead of separate lines.

@figueroa1395

Copy link
Copy Markdown
Member

The json files were copied from power-grid-model before, however, I'm unable to generate json files with same format now. The attributes are combined on one line instead of separate lines.

Hello @furqan463,

This is expected. We decided to remove the previous json formatter because it introduced an npm dependency. npm dependencies have been unfortunately been a target of many vulnerabilities in recent months, so we decided to remove them all altogether to prevent any potential attack vector from that direction.

This said, json files don't need to be formatted currently (you can opt to do that locally) and they are valid as long as the json is valid itself.

So far we haven't found a suitable replacement and the topic is in ongoing discussions. If you have any input, this is welcome.

In short, don't worry about the format at this point in time.

Signed-off-by: furqan463 <ahmadfurqanc@gmail.com>
Signed-off-by: furqan463 <ahmadfurqanc@gmail.com>
Signed-off-by: furqan463 <ahmadfurqanc@gmail.com>
Signed-off-by: furqan463 <ahmadfurqanc@gmail.com>
Signed-off-by: furqan463 <ahmadfurqanc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Support pandapower 3.5.4

3 participants