Skip to content

Commit

Permalink
Update transformer catalogue and parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
alihamdan committed Nov 29, 2024
1 parent 54c3e44 commit dbc9e78
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 776 deletions.
5 changes: 3 additions & 2 deletions roseau/load_flow_single/models/tests/test_buses.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def test_voltage_limits():
bus.max_voltage_level = None

# Bad values
bus.nominal_voltage = 400
bus.min_voltage_level = 0.95
with pytest.raises(RoseauLoadFlowException) as e:
bus.max_voltage_level = 0.92
Expand Down Expand Up @@ -185,7 +186,7 @@ def test_propagate_limits(): # noqa: C901

lp_mv = LineParameters(id="lp_mv", z_line=1.0, y_shunt=0.1)
lp_lv = LineParameters(id="lp_lv", z_line=1.0)
tp = TransformerParameters.from_catalogue(name="SE_Minera_A0Ak_100kVA", manufacturer="SE")
tp = TransformerParameters.from_catalogue(name="SE Minera A0Ak 100kVA 15/20kV(20) 410V Dyn11")

Line(id="l1_mv", bus1=b1_mv, bus2=b2_mv, length=1.5, parameters=lp_mv)
Line(id="l2_mv", bus1=b2_mv, bus2=b3_mv, length=2, parameters=lp_mv)
Expand Down Expand Up @@ -341,7 +342,7 @@ def test_get_connected_buses():

lp_mv = LineParameters(id="lp_mv", z_line=1.0, y_shunt=0.1)
lp_lv = LineParameters(id="lp_lv", z_line=1.0)
tp = TransformerParameters.from_catalogue(name="SE_Minera_A0Ak_100kVA", manufacturer="SE")
tp = TransformerParameters.from_catalogue(name="SE Minera A0Ak 100kVA 15/20kV(20) 410V Dyn11")

Line(id="l1_mv", bus1=b1_mv, bus2=b2_mv, length=1.5, parameters=lp_mv)
Line(id="l2_mv", bus1=b2_mv, bus2=b3_mv, length=2, parameters=lp_mv)
Expand Down
31 changes: 14 additions & 17 deletions roseau/load_flow_single/models/tests/test_flexible_parameters.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

import numpy as np
import pytest

Expand Down Expand Up @@ -56,14 +54,14 @@ def test_control():
assert e.value.code == RoseauLoadFlowExceptionCode.BAD_CONTROL_VALUE

# Warning if values provided to useless values
with warnings.catch_warnings(record=True) as records:
with pytest.warns(
UserWarning,
match=(
r"Some voltage norm value\(s\) will not be used by the 'p_max_u_production' control. "
r"Nevertheless, values different from 0 were given: 'u_min' \(2.0 V\), 'u_down' \(1.0 V\)"
),
):
Control(type="p_max_u_production", u_min=2, u_down=1, u_up=240, u_max=250)
assert len(records) == 1
assert (
records[0].message.args[0] == "Some voltage norm value(s) will not be used by the 'p_max_u_production' "
"control. Nevertheless, values different from 0 were given: 'u_min' (2.0 V), 'u_down' (1.0 V)"
)
assert records[0].category is UserWarning

# Bad control value for p_max_u_consumption
with pytest.raises(RoseauLoadFlowException) as e:
Expand Down Expand Up @@ -102,15 +100,14 @@ def test_control():
assert e.value.code == RoseauLoadFlowExceptionCode.BAD_CONTROL_VALUE

# Warning if values provided to useless values
with warnings.catch_warnings(record=True) as records:
with pytest.warns(
UserWarning,
match=(
r"Some voltage norm value\(s\) will not be used by the 'p_max_u_consumption' control. "
r"Nevertheless, values different from 0 were given: 'u_max' \(-1.0 V\), 'u_up' \(2.3 V\)"
),
):
Control(type="p_max_u_consumption", u_min=210, u_down=220, u_up=2.3, u_max=-1)
assert len(records) == 1
assert (
records[0].message.args[0] == "Some voltage norm value(s) will not be used by the 'p_max_u_consumption' "
"control. Nevertheless, values different from 0 were given: 'u_max' (-1.0 "
"V), 'u_up' (2.3 V)"
)
assert records[0].category is UserWarning

# Bad control value for q_u
with pytest.raises(RoseauLoadFlowException) as e:
Expand Down
4 changes: 2 additions & 2 deletions roseau/load_flow_single/models/tests/test_line_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,8 @@ def test_equality():

other_data = {
"id": lp.id + " other",
"z_line": lp.z_line.m + 1,
"y_shunt": lp.y_shunt.m + 1,
"z_line": lp.z_line.m + 1j,
"y_shunt": lp.y_shunt.m + 1j,
"ampacity": lp.ampacity.m + 1,
"line_type": LineType.OVERHEAD,
"material": Material.CU,
Expand Down
Loading

0 comments on commit dbc9e78

Please sign in to comment.