Skip to content

Commit aaf2e66

Browse files
committed
format
Signed-off-by: Martijn Govers <[email protected]>
1 parent c328ae8 commit aaf2e66

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

src/power_grid_model_io/converters/pandapower_converter.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ def _create_pgm_input_lines(self):
425425
pgm_lines["tan1"] = np.divide(
426426
self._get_pp_attr("line", "g_us_per_km", expected_type="f8", default=0),
427427
c_nf_per_km * (2 * np.pi * self.system_frequency * 1e-3),
428-
where=np.not_equal(c_nf_per_km, 0.0))
428+
where=np.not_equal(c_nf_per_km, 0.0),
429+
)
429430
pgm_lines["tan1"][np.equal(c_nf_per_km, 0.0)] = 0.0
430431
pgm_lines["i_n"] = (
431432
(self._get_pp_attr("line", "max_i_ka", expected_type="f8", default=np.nan) * 1e3)
@@ -437,8 +438,9 @@ def _create_pgm_input_lines(self):
437438
pgm_lines["c0"] = c0_nf_per_km * length_km * parallel * 1e-9
438439
pgm_lines["tan0"] = np.divide(
439440
self._get_pp_attr("line", "g0_us_per_km", expected_type="f8", default=0),
440-
c0_nf_per_km * (2 * np.pi * self.system_frequency * 1e-3)
441-
,where=np.not_equal(c0_nf_per_km, 0.0))
441+
c0_nf_per_km * (2 * np.pi * self.system_frequency * 1e-3),
442+
where=np.not_equal(c0_nf_per_km, 0.0),
443+
)
442444
pgm_lines["tan0"][np.equal(c0_nf_per_km, 0.0)] = 0.0
443445
assert ComponentType.line not in self.pgm_input_data
444446
self.pgm_input_data[ComponentType.line] = pgm_lines
@@ -1942,8 +1944,10 @@ def _pp_lines_output_3ph(self):
19421944
pp_output_lines_3ph["loading_c_percent"] = (
19431945
np.maximum(pp_output_lines_3ph["i_c_from_ka"], pp_output_lines_3ph["i_c_to_ka"]) / pgm_input_lines["i_n"]
19441946
) * 1e5
1945-
pp_output_lines_3ph["loading_percent"] = np.maximum(np.maximum(pp_output_lines_3ph["loading_a_percent"], pp_output_lines_3ph["loading_b_percent"]),
1946-
pp_output_lines_3ph["loading_c_percent"])
1947+
pp_output_lines_3ph["loading_percent"] = np.maximum(
1948+
np.maximum(pp_output_lines_3ph["loading_a_percent"], pp_output_lines_3ph["loading_b_percent"]),
1949+
pp_output_lines_3ph["loading_c_percent"],
1950+
)
19471951

19481952
assert "res_line_3ph" not in self.pp_output_data
19491953
self.pp_output_data["res_line_3ph"] = pp_output_lines_3ph

tests/validation/converters/test_pandapower_converter_output.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,19 @@ def check_result(net):
154154
np.maximum(i_c_hv / i_max_hv, i_c_lv / i_max_lv) * 100, net.res_trafo_3ph.loading_c_percent
155155
)
156156
np.testing.assert_allclose(
157-
np.maximum(np.maximum(net.res_trafo_3ph.loading_a_percent, net.res_trafo_3ph.loading_b_percent),
158-
net.res_trafo_3ph.loading_c_percent), net.res_trafo_3ph.loading_percent)
157+
np.maximum(
158+
np.maximum(net.res_trafo_3ph.loading_a_percent, net.res_trafo_3ph.loading_b_percent),
159+
net.res_trafo_3ph.loading_c_percent,
160+
),
161+
net.res_trafo_3ph.loading_percent,
162+
)
159163
np.testing.assert_allclose(
160-
np.maximum(np.maximum(net.res_line_3ph.loading_a_percent, net.res_line_3ph.loading_b_percent),
161-
net.res_line_3ph.loading_c_percent), net.res_line_3ph.loading_percent)
162-
164+
np.maximum(
165+
np.maximum(net.res_line_3ph.loading_a_percent, net.res_line_3ph.loading_b_percent),
166+
net.res_line_3ph.loading_c_percent,
167+
),
168+
net.res_line_3ph.loading_percent,
169+
)
163170

164171
def compare_result(actual, expected, *, rtol):
165172
np.testing.assert_allclose(actual.trafo.vn_hv_kv, expected.trafo.vn_hv_kv, rtol=rtol)

0 commit comments

Comments
 (0)