diff --git a/roseau/load_flow/models/buses.py b/roseau/load_flow/models/buses.py index 08d3ad2b..928ff1e1 100644 --- a/roseau/load_flow/models/buses.py +++ b/roseau/load_flow/models/buses.py @@ -279,7 +279,8 @@ def get_connected_buses(self) -> Iterator[Id]: to_add = set(element._connected_elements).difference(visited) remaining.update(to_add) - def res_voltage_unbalance(self) -> float: + @ureg_wraps("percent", (None,), strict=False) + def res_voltage_unbalance(self) -> Q_[float]: """Calculate the voltage unbalance on this bus according to the IEC definition. Voltage Unbalance Factor: diff --git a/roseau/load_flow/models/tests/test_buses.py b/roseau/load_flow/models/tests/test_buses.py index b6f7586c..24fe9749 100644 --- a/roseau/load_flow/models/tests/test_buses.py +++ b/roseau/load_flow/models/tests/test_buses.py @@ -335,18 +335,18 @@ def test_res_voltage_unbalance(): # Balanced system bus._res_potentials = np.array([va, vb, vc]) - assert np.isclose(bus.res_voltage_unbalance(), 0) + assert np.isclose(bus.res_voltage_unbalance().m_as("percent"), 0) # Unbalanced system bus._res_potentials = np.array([va, vb, vb]) - assert np.isclose(bus.res_voltage_unbalance(), 100) + assert np.isclose(bus.res_voltage_unbalance().m_as("percent"), 100) # With neutral bus = Bus("b3n", phases="abcn") bus._res_potentials = np.array([va, vb, vc, 0]) - assert np.isclose(bus.res_voltage_unbalance(), 0) + assert np.isclose(bus.res_voltage_unbalance().m_as("percent"), 0) bus._res_potentials = np.array([va, vb, vb, 0]) - assert np.isclose(bus.res_voltage_unbalance(), 100) + assert np.isclose(bus.res_voltage_unbalance().m_as("percent"), 100) # Non 3-phase bus bus = Bus("b1", phases="an")