Skip to content

Commit c145eef

Browse files
authored
Merge pull request #334 from PowerGridModel/feature/resolve-validation-test-warnings
Tests: resolve remaining deprecation warnings
2 parents a408a90 + f95319f commit c145eef

File tree

9 files changed

+598
-566
lines changed

9 files changed

+598
-566
lines changed

src/power_grid_model_io/converters/pandapower_converter.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,17 +1699,14 @@ def join_currents(table: str, bus_name: str, i_name: str) -> pd.DataFrame:
16991699
pp_switches_output_index = pp_switches_output.index
17001700

17011701
# Combine all branch bus, current and et in one dataframe
1702-
all_i_df = pd.concat(
1703-
[
1704-
(
1705-
join_currents(table, bus_name, i_name)
1706-
if not rest_switches_absent[table]
1707-
else pd.DataFrame(columns=["bus", "element", "et", "i_ka"])
1708-
)
1709-
for table, attr_names in switch_attrs.items()
1710-
for bus_name, i_name in attr_names.items()
1711-
]
1712-
)
1702+
dfs = [
1703+
join_currents(table, bus_name, i_name)
1704+
for table, attr_names in switch_attrs.items()
1705+
for bus_name, i_name in attr_names.items()
1706+
if not rest_switches_absent[table]
1707+
]
1708+
all_i_df = pd.DataFrame(columns=["bus", "element", "et", "i_ka"]) if not dfs else pd.concat(dfs)
1709+
17131710
# Merge on input data to get current and drop other columns
17141711
pp_switches_output = pd.merge(
17151712
pp_switches_output,
Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,49 @@
11
{
2-
"node":
3-
[
4-
{"id": 0, "energized": 1, "u_pu": [1.000000000042805, 1.000000000042805, 1.000000000040956], "u": [63508.52961357732, 63508.52961357732, 63508.52961345989], "u_angle": [-2.297462191765614e-10, -2.094395102622942, 2.094395102852041], "p": [765820.7217852274, 765820.7235734381, -1529485.490304183], "q": [-142683.6055350895, -142683.5967414472, -136520.3696246375], "id_reference": {"table": "bus", "index": 101}},
5-
{"id": 1, "energized": 1, "u_pu": [0.9994132656313264, 0.9994132656313274, 1.002844167287654], "u": [11540.23035887859, 11540.2303588786, 11579.84699877547], "u_angle": [-0.002501623712801432, -2.096896726105997, 2.098735152107258], "p": [5.662039942836705e-08, 4.158749852077411e-07, 5.339208304447429e-08], "q": [-7.588863607722517e-08, -6.631148746093378e-08, 3.610845913546241e-07], "id_reference": {"table": "bus", "index": 102}},
6-
{"id": 2, "energized": 1, "u_pu": [0.9987870960752929, 0.9987870960752938, 1.004418511811836], "u": [11532.9999756439, 11532.99997564391, 11598.02596347214], "u_angle": [-0.002966986920613948, -2.09736208931381, 2.099116406819713], "p": [-729999.9999998733, -730000.000000165, 1570000.000000135], "q": [189999.9999999996, 190000.0000003468, 189999.9999996292], "id_reference": {"table": "bus", "index": 103}},
7-
{"id": 3, "energized": 1, "u_pu": [1.000000000042805, 1.000000000042805, 1.000000000040956], "u": [63508.52961357732, 63508.52961357732, 63508.52961345989], "u_angle": [-2.297462191765614e-10, -2.094395102622942, 2.094395102852041], "p": [0, 0, 0], "q": [0, 0, 0], "id_reference": {"table": "bus", "index": 106}}
8-
],
9-
"line":
10-
[
11-
{"id": 4, "energized": 1, "loading": 1.265330032238072, "p_from": [-729999.9999998733, -730000.000000165, 1570000.000000135], "q_from": [189999.9999999996, 190000.0000003468, 189999.9999996292], "i_from": [65.40543555178559, 65.40543555181758, 136.3555342275158], "s_from": [754320.8866257217, 754320.8866260914, 1581455.026233842], "p_to": [730552.3008243673, 730552.3008246894, -1567616.527443881], "q_to": [-216633.7469513389, -216633.7469515898, -216173.5239478488], "i_to": [66.02947091323357, 66.02947091326645, 136.6556434817117], "s_to": [761995.3048135885, 761995.3048139686, 1582451.44303743], "id_reference": {"table": "line", "index": 101}, "pgm_input": {"from_node": 2, "to_node": 1, "i_n": 108.0}}
12-
],
13-
"source":
14-
[
15-
{"id": 5, "energized": 1, "p": [765820.730621319, 765820.4766903995, -1529485.219644774], "q": [-142683.6428608279, -142684.1067247107, -136520.4031334404], "i": [12.26605892917178, 12.26605633625489, 24.17889348713215], "s": [778999.36674519, 778999.2020728515, 1535565.973048225], "pf": [0.9830826099654819, 0.9830824918082272, -0.9960400572100595], "id_reference": {"table": "ext_grid", "index": 0}, "pgm_input": {"node": 0}}
16-
],
17-
"sym_load":
18-
[
19-
{"id": 6, "energized": 1, "p": [833333.3333333333, 833333.3333333333, 833333.3333333333], "q": [79999.99999999999, 79999.99999999999, 79999.99999999999], "i": [72.58861772969922, 72.58861772969915, 72.18163928458914], "s": [837164.5265086454, 837164.5265086454, 837164.5265086454], "pf": [0.9954236078405162, 0.9954236078405162, 0.9954236078405162], "id_reference": {"table": "load", "name": "const_power", "index": 101}, "pgm_input": {"node": 2}},
20-
{"id": 7, "energized": 1, "p": [0, 0, 0], "q": [0, 0, 0], "i": [0, 0, 0], "s": [0, 0, 0], "pf": [0, 0, 0], "id_reference": {"table": "load", "name": "const_impedance", "index": 101}, "pgm_input": {"node": 2}},
21-
{"id": 8, "energized": 1, "p": [0, 0, 0], "q": [0, 0, 0], "i": [0, 0, 0], "s": [0, 0, 0], "pf": [0, 0, 0], "id_reference": {"table": "load", "name": "const_current", "index": 101}, "pgm_input": {"node": 2}}
22-
],
23-
"transformer":
24-
[
25-
{"id": 9, "energized": 1, "loading": 0.03883052565830863, "p_from": [765820.724989093, 765820.7249890427, -1529485.491438911], "q_from": [-142683.6001096883, -142683.6001099306, -136520.3668874493], "i_from": [12.26605871869048, 12.2660587186904, 24.17889769909201], "s_from": [778999.3533778327, 778999.3533778277, 1535566.240543602], "p_to": [-730552.3008242727, -730552.300824217, 1567616.527444104], "q_to": [216633.7469512629, 216633.7469515783, 216173.5239482207], "i_to": [66.02947091322386, 66.02947091322693, 136.6556434817352], "s_to": [761995.3048134763, 761995.3048135125, 1582451.443037701], "id_reference": {"table": "trafo", "index": 0}, "pgm_input": {"from_node": 0, "to_node": 1}, "pp_input": {"df": 1.0}}
26-
],
27-
"sym_gen":
28-
[
29-
{"id": 10, "energized": 1, "p": [403333.3333333333, 403333.3333333333, 403333.3333333333], "q": [269999.9999999999, 269999.9999999999, 269999.9999999999], "i": [42.08476139753746, 42.08476139753742, 41.84880717644763], "s": [485363.5521727787, 485363.5521727787, 485363.5521727787], "pf": [0.8309922150680065, 0.8309922150680065, 0.8309922150680065], "id_reference": {"table": "sgen", "index": 31}, "pgm_input": {"node": 2}}
30-
],
31-
"link":
32-
[
33-
{"id": 11, "energized": 1, "loading": 0, "p_from": [0, 0, 0], "q_from": [0, 0, 0], "i_from": [0, 0, 0], "s_from": [0, 0, 0], "p_to": [0, 0, 0], "q_to": [0, 0, 0], "i_to": [0, 0, 0], "s_to": [0, 0, 0], "id_reference": {"table": "switch", "name": "b2b_switches", "index": 3021}, "pgm_input": {"from_node": 0, "to_node": 3}}
34-
],
35-
"asym_load":
36-
[
37-
{"id": 12, "energized": 1, "p": [399999.9999999999, 500000, 1000000], "q": [10000, 10000, 10000], "i": [34.69392016993495, 43.36252415313805, 86.22588032650638], "s": [400124.980474851, 500099.9900019995, 1000049.998750063], "pf": [0.9996876464081228, 0.999800059980007, 0.9999500037496875], "id_reference": {"table": "asymmetric_load", "index": 33}, "pgm_input": {"node": 2}}
38-
],
39-
"asym_gen":
40-
[
41-
{"id": 13, "energized": 1, "p": [99999.99999999999, 200000, 3000000], "q": [10000, 10000, 10000], "i": [8.71401685801165, 17.3632050956306, 258.6661450895947], "s": [100498.7562112089, 200249.8439450078, 3000016.66662037], "pf": [0.9950371902099889, 0.9987523388778446, 0.9999944444907404], "id_reference": {"table": "asymmetric_sgen", "index": 32}, "pgm_input": {"node": 2}}
42-
]
43-
}
2+
"version": "1.0",
3+
"type": "asym_output",
4+
"is_batch": false,
5+
"attributes": {},
6+
"data": {
7+
"node":
8+
[
9+
{"id": 0, "energized": 1, "u_pu": [1.000000000042805, 1.000000000042805, 1.000000000040956], "u": [63508.52961357732, 63508.52961357732, 63508.52961345989], "u_angle": [-2.297462191765614e-10, -2.094395102622942, 2.094395102852041], "p": [765820.7217852274, 765820.7235734381, -1529485.490304183], "q": [-142683.6055350895, -142683.5967414472, -136520.3696246375], "id_reference": {"table": "bus", "index": 101}},
10+
{"id": 1, "energized": 1, "u_pu": [0.9994132656313264, 0.9994132656313274, 1.002844167287654], "u": [11540.23035887859, 11540.2303588786, 11579.84699877547], "u_angle": [-0.002501623712801432, -2.096896726105997, 2.098735152107258], "p": [5.662039942836705e-08, 4.158749852077411e-07, 5.339208304447429e-08], "q": [-7.588863607722517e-08, -6.631148746093378e-08, 3.610845913546241e-07], "id_reference": {"table": "bus", "index": 102}},
11+
{"id": 2, "energized": 1, "u_pu": [0.9987870960752929, 0.9987870960752938, 1.004418511811836], "u": [11532.9999756439, 11532.99997564391, 11598.02596347214], "u_angle": [-0.002966986920613948, -2.09736208931381, 2.099116406819713], "p": [-729999.9999998733, -730000.000000165, 1570000.000000135], "q": [189999.9999999996, 190000.0000003468, 189999.9999996292], "id_reference": {"table": "bus", "index": 103}},
12+
{"id": 3, "energized": 1, "u_pu": [1.000000000042805, 1.000000000042805, 1.000000000040956], "u": [63508.52961357732, 63508.52961357732, 63508.52961345989], "u_angle": [-2.297462191765614e-10, -2.094395102622942, 2.094395102852041], "p": [0, 0, 0], "q": [0, 0, 0], "id_reference": {"table": "bus", "index": 106}}
13+
],
14+
"line":
15+
[
16+
{"id": 4, "energized": 1, "loading": 1.265330032238072, "p_from": [-729999.9999998733, -730000.000000165, 1570000.000000135], "q_from": [189999.9999999996, 190000.0000003468, 189999.9999996292], "i_from": [65.40543555178559, 65.40543555181758, 136.3555342275158], "s_from": [754320.8866257217, 754320.8866260914, 1581455.026233842], "p_to": [730552.3008243673, 730552.3008246894, -1567616.527443881], "q_to": [-216633.7469513389, -216633.7469515898, -216173.5239478488], "i_to": [66.02947091323357, 66.02947091326645, 136.6556434817117], "s_to": [761995.3048135885, 761995.3048139686, 1582451.44303743], "id_reference": {"table": "line", "index": 101}, "pgm_input": {"from_node": 2, "to_node": 1, "i_n": 108.0}}
17+
],
18+
"source":
19+
[
20+
{"id": 5, "energized": 1, "p": [765820.730621319, 765820.4766903995, -1529485.219644774], "q": [-142683.6428608279, -142684.1067247107, -136520.4031334404], "i": [12.26605892917178, 12.26605633625489, 24.17889348713215], "s": [778999.36674519, 778999.2020728515, 1535565.973048225], "pf": [0.9830826099654819, 0.9830824918082272, -0.9960400572100595], "id_reference": {"table": "ext_grid", "index": 0}, "pgm_input": {"node": 0}}
21+
],
22+
"sym_load":
23+
[
24+
{"id": 6, "energized": 1, "p": [833333.3333333333, 833333.3333333333, 833333.3333333333], "q": [79999.99999999999, 79999.99999999999, 79999.99999999999], "i": [72.58861772969922, 72.58861772969915, 72.18163928458914], "s": [837164.5265086454, 837164.5265086454, 837164.5265086454], "pf": [0.9954236078405162, 0.9954236078405162, 0.9954236078405162], "id_reference": {"table": "load", "name": "const_power", "index": 101}, "pgm_input": {"node": 2}},
25+
{"id": 7, "energized": 1, "p": [0, 0, 0], "q": [0, 0, 0], "i": [0, 0, 0], "s": [0, 0, 0], "pf": [0, 0, 0], "id_reference": {"table": "load", "name": "const_impedance", "index": 101}, "pgm_input": {"node": 2}},
26+
{"id": 8, "energized": 1, "p": [0, 0, 0], "q": [0, 0, 0], "i": [0, 0, 0], "s": [0, 0, 0], "pf": [0, 0, 0], "id_reference": {"table": "load", "name": "const_current", "index": 101}, "pgm_input": {"node": 2}}
27+
],
28+
"transformer":
29+
[
30+
{"id": 9, "energized": 1, "loading": 0.03883052565830863, "p_from": [765820.724989093, 765820.7249890427, -1529485.491438911], "q_from": [-142683.6001096883, -142683.6001099306, -136520.3668874493], "i_from": [12.26605871869048, 12.2660587186904, 24.17889769909201], "s_from": [778999.3533778327, 778999.3533778277, 1535566.240543602], "p_to": [-730552.3008242727, -730552.300824217, 1567616.527444104], "q_to": [216633.7469512629, 216633.7469515783, 216173.5239482207], "i_to": [66.02947091322386, 66.02947091322693, 136.6556434817352], "s_to": [761995.3048134763, 761995.3048135125, 1582451.443037701], "id_reference": {"table": "trafo", "index": 0}, "pgm_input": {"from_node": 0, "to_node": 1}, "pp_input": {"df": 1.0}}
31+
],
32+
"sym_gen":
33+
[
34+
{"id": 10, "energized": 1, "p": [403333.3333333333, 403333.3333333333, 403333.3333333333], "q": [269999.9999999999, 269999.9999999999, 269999.9999999999], "i": [42.08476139753746, 42.08476139753742, 41.84880717644763], "s": [485363.5521727787, 485363.5521727787, 485363.5521727787], "pf": [0.8309922150680065, 0.8309922150680065, 0.8309922150680065], "id_reference": {"table": "sgen", "index": 31}, "pgm_input": {"node": 2}}
35+
],
36+
"link":
37+
[
38+
{"id": 11, "energized": 1, "loading": 0, "p_from": [0, 0, 0], "q_from": [0, 0, 0], "i_from": [0, 0, 0], "s_from": [0, 0, 0], "p_to": [0, 0, 0], "q_to": [0, 0, 0], "i_to": [0, 0, 0], "s_to": [0, 0, 0], "id_reference": {"table": "switch", "name": "b2b_switches", "index": 3021}, "pgm_input": {"from_node": 0, "to_node": 3}}
39+
],
40+
"asym_load":
41+
[
42+
{"id": 12, "energized": 1, "p": [399999.9999999999, 500000, 1000000], "q": [10000, 10000, 10000], "i": [34.69392016993495, 43.36252415313805, 86.22588032650638], "s": [400124.980474851, 500099.9900019995, 1000049.998750063], "pf": [0.9996876464081228, 0.999800059980007, 0.9999500037496875], "id_reference": {"table": "asymmetric_load", "index": 33}, "pgm_input": {"node": 2}}
43+
],
44+
"asym_gen":
45+
[
46+
{"id": 13, "energized": 1, "p": [99999.99999999999, 200000, 3000000], "q": [10000, 10000, 10000], "i": [8.71401685801165, 17.3632050956306, 258.6661450895947], "s": [100498.7562112089, 200249.8439450078, 3000016.66662037], "pf": [0.9950371902099889, 0.9987523388778446, 0.9999944444907404], "id_reference": {"table": "asymmetric_sgen", "index": 32}, "pgm_input": {"node": 2}}
47+
]
48+
}
49+
}

0 commit comments

Comments
 (0)