Skip to content

Commit

Permalink
Add 3 windings transformers ratio and phase tap changers (#937)
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
  • Loading branch information
geofjamg authored Jan 31, 2025
1 parent d2ee246 commit b713a69
Show file tree
Hide file tree
Showing 9 changed files with 570 additions and 220 deletions.
14 changes: 7 additions & 7 deletions docs/user_guide/flowdecomposition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ As we cannot set a PST on an interconnection, we set an equivalent null load cal
id
BLOAD 11 BLOAD 12 2 0.5 1.5 0.0002 0.00015 400.0 400.0 NaN NaN NaN NaN NaN NaN NaN BLOAD 1 BLOAD 1 BLOAD 1_1 BLOAD 1_0 True True
>>> network.get_phase_tap_changers()
tap low_tap high_tap step_count regulating regulation_mode regulation_value target_deadband regulating_bus_id
id
BLOAD 11 BLOAD 12 2 0 -16 16 33 False FIXED_TAP NaN NaN
side tap low_tap high_tap step_count regulating regulation_mode regulation_value target_deadband regulating_bus_id
id
BLOAD 11 BLOAD 12 2 0 -16 16 33 False FIXED_TAP NaN NaN

Neutral tap position
^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -154,9 +154,9 @@ Here are the results with non-neutral tap position.
>>> network = pp.network.load(str(DATA_DIR.joinpath('NETWORK_PST_FLOW_WITH_COUNTRIES.uct')))
>>> network.update_phase_tap_changers(id="BLOAD 11 BLOAD 12 2", tap=1)
>>> network.get_phase_tap_changers()
tap low_tap high_tap step_count regulating regulation_mode regulation_value target_deadband regulating_bus_id
id
BLOAD 11 BLOAD 12 2 1 -16 16 33 False FIXED_TAP NaN NaN
side tap low_tap high_tap step_count regulating regulation_mode regulation_value target_deadband regulating_bus_id
id
BLOAD 11 BLOAD 12 2 1 -16 16 33 False FIXED_TAP NaN NaN
>>> flow_decomposition = pp.flowdecomposition.create_decomposition().add_monitored_elements(['FGEN 11 BLOAD 11 1', 'FGEN 11 BLOAD 12 1'])
>>> flow_decomposition_dataframe = flow_decomposition.run(network)
>>> flow_decomposition_dataframe
Expand Down
16 changes: 8 additions & 8 deletions docs/user_guide/network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,22 @@ the step position:
.. doctest::

>>> network.get_ratio_tap_changer_steps() # doctest: +NORMALIZE_WHITESPACE
rho r x g b
side rho r x g b
id position
NHV2_NLOAD 0 0.850567 0.0 0.0 0.0 0.0
1 1.000667 0.0 0.0 0.0 0.0
2 1.150767 0.0 0.0 0.0 0.0
NHV2_NLOAD 0 0.850567 0.0 0.0 0.0 0.0
1 1.000667 0.0 0.0 0.0 0.0
2 1.150767 0.0 0.0 0.0 0.0

This allows to easily get steps related to just one transformer:

.. doctest::

>>> network.get_ratio_tap_changer_steps().loc['NHV2_NLOAD'] # doctest: +NORMALIZE_WHITESPACE
rho r x g b
side rho r x g b
position
0 0.850567 0.0 0.0 0.0 0.0
1 1.000667 0.0 0.0 0.0 0.0
2 1.150767 0.0 0.0 0.0 0.0
0 0.850567 0.0 0.0 0.0 0.0
1 1.000667 0.0 0.0 0.0 0.0
2 1.150767 0.0 0.0 0.0 0.0

For a detailed description of each dataframe, please refer
to the reference API :doc:`documentation </reference/network>`.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ public static double perUnitRho(NetworkDataframeContext context, TwoWindingsTran
return context.isPerUnit() ? rho * twt.getTerminal1().getVoltageLevel().getNominalV() / twt.getTerminal2().getVoltageLevel().getNominalV() : rho;
}

public static double perUnitRho(NetworkDataframeContext context, ThreeWindingsTransformer twt, ThreeSides side, double rho) {
return context.isPerUnit() ? rho * twt.getTerminal(side).getVoltageLevel().getNominalV() / twt.getTerminal(ThreeSides.ONE).getVoltageLevel().getNominalV() : rho;
}

public static double perUnitAngle(NetworkDataframeContext context, double angle) {
return context.isPerUnit() ? toRadians(angle) : angle; // this is not per-uniting but a convention to have radian in per unit view
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ void twoWindingTransformers() {
.extracting(Series::getName)
.containsExactly("id", "name", "r", "x", "g", "b", "rated_u1", "rated_u2", "rated_s", "p1", "q1", "i1", "p2", "q2", "i2",
"voltage_level1_id", "voltage_level2_id", "bus1_id", "bus_breaker_bus1_id", "node1", "bus2_id", "bus_breaker_bus2_id", "node2",
"connected1", "connected2", "fictitious", "selected_limits_group_1", "selected_limits_group_2");
"connected1", "connected2", "fictitious", "selected_limits_group_1", "selected_limits_group_2", "rho");
}

@Test
Expand All @@ -460,9 +460,9 @@ void threeWindingTransformers() {
assertThat(allAttributeSeries)
.extracting(Series::getName)
.containsExactly("id", "name", "rated_u0",
"r1", "x1", "g1", "b1", "rated_u1", "rated_s1", "ratio_tap_position1", "phase_tap_position1", "p1", "q1", "i1", "voltage_level1_id", "bus1_id", "bus_breaker_bus1_id", "node1", "connected1", "selected_limits_group_1",
"r2", "x2", "g2", "b2", "rated_u2", "rated_s2", "ratio_tap_position2", "phase_tap_position2", "p2", "q2", "i2", "voltage_level2_id", "bus2_id", "bus_breaker_bus2_id", "node2", "connected2", "selected_limits_group_2",
"r3", "x3", "g3", "b3", "rated_u3", "rated_s3", "ratio_tap_position3", "phase_tap_position3", "p3", "q3", "i3", "voltage_level3_id", "bus3_id", "bus_breaker_bus3_id", "node3", "connected3", "selected_limits_group_3",
"r1", "x1", "g1", "b1", "rated_u1", "rated_s1", "ratio_tap_position1", "phase_tap_position1", "p1", "q1", "i1", "voltage_level1_id", "bus1_id", "bus_breaker_bus1_id", "node1", "connected1", "selected_limits_group_1", "rho1",
"r2", "x2", "g2", "b2", "rated_u2", "rated_s2", "ratio_tap_position2", "phase_tap_position2", "p2", "q2", "i2", "voltage_level2_id", "bus2_id", "bus_breaker_bus2_id", "node2", "connected2", "selected_limits_group_2", "rho2",
"r3", "x3", "g3", "b3", "rated_u3", "rated_s3", "ratio_tap_position3", "phase_tap_position3", "p3", "q3", "i3", "voltage_level3_id", "bus3_id", "bus_breaker_bus3_id", "node3", "connected3", "selected_limits_group_3", "rho3",
"fictitious");
}

Expand Down Expand Up @@ -598,7 +598,7 @@ void ratioTapChangerSteps() {

assertThat(series)
.extracting(Series::getName)
.containsExactly("id", "position", "rho", "r", "x", "g", "b");
.containsExactly("id", "position", "side", "rho", "r", "x", "g", "b");
}

@Test
Expand All @@ -608,7 +608,7 @@ void phaseTapChangerSteps() {

assertThat(series)
.extracting(Series::getName)
.containsExactly("id", "position", "rho", "alpha", "r", "x", "g", "b");
.containsExactly("id", "position", "side", "rho", "alpha", "r", "x", "g", "b");
}

@Test
Expand All @@ -618,8 +618,8 @@ void ratioTapChangers() {

assertThat(series)
.extracting(Series::getName)
.containsExactly("id", "tap", "low_tap", "high_tap", "step_count", "on_load", "regulating", "target_v",
"target_deadband", "regulating_bus_id", "rho", "alpha");
.containsExactly("id", "side", "tap", "low_tap", "high_tap", "step_count", "on_load", "regulating", "target_v",
"target_deadband", "regulating_bus_id");
}

@Test
Expand All @@ -629,7 +629,7 @@ void phaseTapChangers() {

assertThat(series)
.extracting(Series::getName)
.containsExactly("id", "tap", "low_tap", "high_tap", "step_count", "regulating", "regulation_mode",
.containsExactly("id", "side", "tap", "low_tap", "high_tap", "step_count", "regulating", "regulation_mode",
"regulation_value", "target_deadband", "regulating_bus_id");
}

Expand Down
Loading

0 comments on commit b713a69

Please sign in to comment.