From 6a2fbb02bbce7f275b0b794c26dc13be3d4df9d7 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Mon, 2 Dec 2024 17:30:18 +0100 Subject: [PATCH] Rename res_series_currents to res_series_current --- roseau/load_flow_single/models/lines.py | 8 ++++---- roseau/load_flow_single/models/tests/test_lines.py | 4 ++-- roseau/load_flow_single/tests/test_electrical_network.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/roseau/load_flow_single/models/lines.py b/roseau/load_flow_single/models/lines.py index 5e261a4..554387c 100644 --- a/roseau/load_flow_single/models/lines.py +++ b/roseau/load_flow_single/models/lines.py @@ -194,15 +194,15 @@ def _res_series_values_getter(self, warning: bool) -> tuple[Complex, Complex]: i_line = self._z_line_inv * du_line / SQRT3 # Zₗ x Iₗ = ΔU -> I = Zₗ⁻¹ x ΔU return du_line, i_line - def _res_series_currents_getter(self, warning: bool) -> Complex: + def _res_series_current_getter(self, warning: bool) -> Complex: _, i_line = self._res_series_values_getter(warning) return i_line @property @ureg_wraps("A", (None,)) - def res_series_currents(self) -> Q_[Complex]: + def res_series_current(self) -> Q_[Complex]: """Get the current in the series elements of the line (in A).""" - return self._res_series_currents_getter(warning=True) + return self._res_series_current_getter(warning=True) def _res_series_power_losses_getter(self, warning: bool) -> Complex: du_line, i_line = self._res_series_values_getter(warning) @@ -319,7 +319,7 @@ def _results_to_dict(self, warning: bool, full: bool) -> JsonDict: results["power2"] = [power2.real, power2.imag] s = self._res_power_losses_getter(warning=False) results["power_losses"] = [s.real, s.imag] - i = self._res_series_currents_getter(warning=False) + i = self._res_series_current_getter(warning=False) results["series_current"] = [i.real, i.imag] s = self._res_series_power_losses_getter(warning=False) results["series_power_loss"] = [s.real, s.imag] diff --git a/roseau/load_flow_single/models/tests/test_lines.py b/roseau/load_flow_single/models/tests/test_lines.py index d940e56..85219fb 100644 --- a/roseau/load_flow_single/models/tests/test_lines.py +++ b/roseau/load_flow_single/models/tests/test_lines.py @@ -218,7 +218,7 @@ def test_lines_results(): # Check currents (Kirchhoff's law at each end of the line) i1_line, i2_line = (x.m for x in line.res_currents) - i_series = line.res_series_currents.m + i_series = line.res_series_current.m i1_shunt, i2_shunt = (x.m for x in line.res_shunt_currents) assert np.isclose(i1_line, i_series + i1_shunt) assert np.isclose(i2_line + i_series, i2_shunt) @@ -227,7 +227,7 @@ def test_lines_results(): def test_currents_equal(network_with_results): line = network_with_results.lines["line"] current1, current2 = (x.m for x in line.res_currents) - series_current = line.res_series_currents.m + series_current = line.res_series_current.m shunt_current1, shunt_current2 = (x.m for x in line.res_shunt_currents) assert np.isclose(current1, series_current + shunt_current1) assert np.isclose(current2 + series_current, shunt_current2) diff --git a/roseau/load_flow_single/tests/test_electrical_network.py b/roseau/load_flow_single/tests/test_electrical_network.py index 44caad9..0556c0b 100644 --- a/roseau/load_flow_single/tests/test_electrical_network.py +++ b/roseau/load_flow_single/tests/test_electrical_network.py @@ -557,7 +557,7 @@ def test_network_results_warning(small_network, small_network_with_results, recw "res_voltages", "res_power_losses", "res_powers", - "res_series_currents", + "res_series_current", "res_series_power_losses", "res_shunt_current", "res_shunt_power_losses", @@ -1241,8 +1241,8 @@ def test_results_to_dict_full(all_elements_network_with_results): complex_power_losses = res_line["power_losses"][0] + 1j * res_line["power_losses"][1] np.testing.assert_allclose(complex_power_losses, line.res_power_losses.m) # Series currents - complex_series_currents = res_line["series_current"][0] + 1j * res_line["series_current"][1] - np.testing.assert_allclose(complex_series_currents, line.res_series_currents.m) + complex_series_current = res_line["series_current"][0] + 1j * res_line["series_current"][1] + np.testing.assert_allclose(complex_series_current, line.res_series_current.m) # Shunt currents complex_shunt_currents1 = res_line["shunt_current1"][0] + 1j * res_line["shunt_current1"][1] np.testing.assert_allclose(complex_shunt_currents1, line.res_shunt_currents[0].m)