Skip to content

Commit

Permalink
Rename res_series_currents to res_series_current
Browse files Browse the repository at this point in the history
  • Loading branch information
alihamdan committed Dec 2, 2024
1 parent 098154c commit 6a2fbb0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions roseau/load_flow_single/models/lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions roseau/load_flow_single/models/tests/test_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions roseau/load_flow_single/tests/test_electrical_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 6a2fbb0

Please sign in to comment.