Skip to content

Step-up transformer tap changer support: feature branch #826

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 128 commits into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from 127 commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
4bfc775
init
Jerry-Jinfeng-Guo Aug 20, 2024
db8e33f
updated transformer rank algorithm; updated tests; updated doc
Jerry-Jinfeng-Guo Aug 20, 2024
009771f
Merge branch 'main' into feature/updated-transformer-ranking
Jerry-Jinfeng-Guo Sep 24, 2024
2719982
Merge branch 'main' into feature/updated-transformer-ranking
Jerry-Jinfeng-Guo Oct 9, 2024
61cae1a
Merge branch 'main' into feature/updated-transformer-ranking
Jerry-Jinfeng-Guo Oct 21, 2024
1ed3cb1
Merge branch 'main' into feature/updated-transformer-ranking
Jerry-Jinfeng-Guo Nov 7, 2024
a4ad95c
Merge branch 'main' into feature/updated-transformer-ranking
Jerry-Jinfeng-Guo Nov 7, 2024
9b9f40f
base branch for step up transformer tap changer support
Jerry-Jinfeng-Guo Nov 11, 2024
e420373
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Nov 11, 2024
0afeedc
Merge branch 'feature/step-up-transformer-tap-changer-support' into f…
Jerry-Jinfeng-Guo Nov 11, 2024
a68f7de
add case to validator
nitbharambe Nov 11, 2024
a1d8a37
spell error
nitbharambe Nov 11, 2024
402253e
Merge branch 'feature/step-up-transformer-tap-changer-support' into f…
nitbharambe Nov 13, 2024
d7f9b46
Merge pull request #829 from PowerGridModel/feature/regulator-unique-…
TonyXiang8787 Nov 13, 2024
66d6683
address comments
Jerry-Jinfeng-Guo Nov 14, 2024
4d390d5
minor
Jerry-Jinfeng-Guo Nov 14, 2024
40748ce
Merge branch 'feature/step-up-transformer-tap-changer-support' into f…
Jerry-Jinfeng-Guo Nov 14, 2024
6b98146
f formatter
Jerry-Jinfeng-Guo Nov 14, 2024
0f668d1
Merge pull request #698 from PowerGridModel/feature/updated-transform…
mgovers Nov 14, 2024
8dd99ca
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Nov 14, 2024
1f2e30f
init branch
Jerry-Jinfeng-Guo Nov 14, 2024
0105588
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Nov 15, 2024
6aeb317
Merge branch 'feature/step-up-transformer-tap-changer-support' into f…
Jerry-Jinfeng-Guo Nov 15, 2024
fa55bb4
made control side information available to trafo graph
Jerry-Jinfeng-Guo Nov 15, 2024
fc2efee
logic edges in place
Jerry-Jinfeng-Guo Nov 16, 2024
3a910f5
minor re-organize
Jerry-Jinfeng-Guo Nov 17, 2024
04b173c
tap side and control side made available to ranking
Jerry-Jinfeng-Guo Nov 17, 2024
f83b690
fixed a bug on the three winding transformer edge
Jerry-Jinfeng-Guo Nov 18, 2024
5ae08c5
full logic in place -> validation fail
Jerry-Jinfeng-Guo Nov 18, 2024
6ae1f7c
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Nov 18, 2024
bd59bf5
Merge branch 'feature/step-up-transformer-tap-changer-support' into f…
Jerry-Jinfeng-Guo Nov 18, 2024
b642c97
updated validations test; marked invalid grid; added error interfacing
Jerry-Jinfeng-Guo Nov 19, 2024
da85da9
address comments
Jerry-Jinfeng-Guo Nov 21, 2024
8ceffe1
code coverage
Jerry-Jinfeng-Guo Nov 22, 2024
a5318ae
sonar and test grid asci art in test
Jerry-Jinfeng-Guo Nov 22, 2024
113f138
sonar
Jerry-Jinfeng-Guo Nov 22, 2024
ebefba6
comments addressed
Jerry-Jinfeng-Guo Nov 22, 2024
83c45f6
Merge pull request #832 from PowerGridModel/feature/step-up-trafo-tap…
Jerry-Jinfeng-Guo Nov 22, 2024
e3cfae2
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Nov 22, 2024
8465085
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Nov 25, 2024
a40ba45
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Nov 27, 2024
abad3c8
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Dec 3, 2024
fc2f20f
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Dec 9, 2024
2f41b49
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Dec 20, 2024
1097fea
work in progress
Jerry-Jinfeng-Guo Feb 12, 2025
7ce5269
added control logic for linear search
Jerry-Jinfeng-Guo Feb 12, 2025
ddd8438
added updated binary control logic
Jerry-Jinfeng-Guo Feb 12, 2025
1351164
[skip ci]
Jerry-Jinfeng-Guo Feb 12, 2025
5e466b1
[skip ci]
Jerry-Jinfeng-Guo Feb 12, 2025
327ca17
[skip ci]
Jerry-Jinfeng-Guo Feb 12, 2025
5c856b5
Merge branch 'feature/tap-changer-unit-test-for-new-control-logic' in…
Jerry-Jinfeng-Guo Feb 12, 2025
47f3525
Merge branch 'feature/tap-changer-control-logic-linear-search' into f…
Jerry-Jinfeng-Guo Feb 12, 2025
455d29b
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Feb 12, 2025
8a65598
u_pu
Jerry-Jinfeng-Guo Feb 12, 2025
7d4e3c5
Merge branch 'feature/step-up-transformer-tap-changer-support' into f…
Jerry-Jinfeng-Guo Feb 12, 2025
2b8110a
Merge branch 'feature/tap-changer-unit-test-for-new-control-logic' in…
Jerry-Jinfeng-Guo Feb 12, 2025
32d62ae
Merge branch 'feature/tap-changer-control-logic-linear-search' into f…
Jerry-Jinfeng-Guo Feb 12, 2025
764306a
[skip ci] tap_side
Jerry-Jinfeng-Guo Feb 12, 2025
17bc26d
Merge branch 'feature/tap-changer-unit-test-for-new-control-logic' in…
Jerry-Jinfeng-Guo Feb 12, 2025
d312f0a
Merge branch 'feature/tap-changer-control-logic-linear-search' into f…
Jerry-Jinfeng-Guo Feb 12, 2025
963610a
[skip ci] max_iter
Jerry-Jinfeng-Guo Feb 12, 2025
7095594
Merge branch 'feature/tap-changer-unit-test-for-new-control-logic' in…
Jerry-Jinfeng-Guo Feb 12, 2025
6cff993
Merge branch 'feature/tap-changer-control-logic-linear-search' into f…
Jerry-Jinfeng-Guo Feb 12, 2025
1cd2a1c
[skip ci]
Jerry-Jinfeng-Guo Feb 12, 2025
40b44e5
[skip ci]
Jerry-Jinfeng-Guo Feb 12, 2025
3dccdd3
[skip ci] line drop compensation test
Jerry-Jinfeng-Guo Feb 13, 2025
201596c
Merge branch 'feature/tap-changer-unit-test-for-new-control-logic' in…
Jerry-Jinfeng-Guo Feb 13, 2025
0091d6d
Merge branch 'feature/tap-changer-control-logic-linear-search' into f…
Jerry-Jinfeng-Guo Feb 13, 2025
1b5d166
[skip ci]
Jerry-Jinfeng-Guo Feb 13, 2025
bf3404d
[skip ci] wip line drop compensation 2.0
Jerry-Jinfeng-Guo Feb 13, 2025
98d8562
Merge branch 'feature/tap-changer-unit-test-for-new-control-logic' in…
Jerry-Jinfeng-Guo Feb 13, 2025
9302c24
Merge branch 'feature/tap-changer-control-logic-linear-search' into f…
Jerry-Jinfeng-Guo Feb 13, 2025
79bb7e9
[skip ci] last line drop compensation unit not making sense any more
Jerry-Jinfeng-Guo Feb 13, 2025
70a481e
Merge branch 'feature/tap-changer-unit-test-for-new-control-logic' in…
Jerry-Jinfeng-Guo Feb 13, 2025
625a249
Merge branch 'feature/tap-changer-control-logic-linear-search' into f…
Jerry-Jinfeng-Guo Feb 13, 2025
35d0f63
ready for review
Jerry-Jinfeng-Guo Feb 13, 2025
5d6fe36
[skip ci] ready for review
Jerry-Jinfeng-Guo Feb 13, 2025
8ead84e
Merge branch 'feature/tap-changer-control-logic-linear-search' of htt…
Jerry-Jinfeng-Guo Feb 13, 2025
eef3127
[skip ci] ready for review
Jerry-Jinfeng-Guo Feb 13, 2025
19b5514
apply review suggestions
Jerry-Jinfeng-Guo Feb 21, 2025
73d7979
linux build
Jerry-Jinfeng-Guo Feb 21, 2025
97a1b94
Merge pull request #894 from PowerGridModel/feature/tap-changer-contr…
Jerry-Jinfeng-Guo Feb 21, 2025
ff6abe3
Merge pull request #893 from PowerGridModel/feature/tap-changer-contr…
Jerry-Jinfeng-Guo Feb 21, 2025
8fb6505
processing review comment
Jerry-Jinfeng-Guo Feb 24, 2025
b2bcfa6
processing review comment
Jerry-Jinfeng-Guo Feb 24, 2025
baa3ce2
processing review comment
Jerry-Jinfeng-Guo Feb 24, 2025
e2d2904
processing sonar cloud complains
Jerry-Jinfeng-Guo Feb 26, 2025
2b331c4
processing sonar cloud complains
Jerry-Jinfeng-Guo Feb 26, 2025
8d99c51
processing comments
Jerry-Jinfeng-Guo Feb 26, 2025
9c98f04
processing comments
Jerry-Jinfeng-Guo Feb 26, 2025
31ee56e
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Feb 26, 2025
e0624b8
Merge branch 'feature/step-up-transformer-tap-changer-support' into f…
Jerry-Jinfeng-Guo Feb 26, 2025
64cce0d
final unit test
Jerry-Jinfeng-Guo Feb 27, 2025
236432f
Merge branch 'feature/tap-changer-unit-test-for-new-control-logic' of…
Jerry-Jinfeng-Guo Feb 27, 2025
8863286
gcc complains
Jerry-Jinfeng-Guo Feb 27, 2025
ea4382a
format
Jerry-Jinfeng-Guo Feb 27, 2025
deb3465
sonar
Jerry-Jinfeng-Guo Feb 27, 2025
8933874
gcc complain
Jerry-Jinfeng-Guo Feb 27, 2025
356fe6d
process comment
Jerry-Jinfeng-Guo Feb 28, 2025
1e0dc20
correct error message
Jerry-Jinfeng-Guo Feb 27, 2025
75f1545
Merge pull request #909 from PowerGridModel/feature/patch-new-trafo-r…
figueroa1395 Mar 2, 2025
d83fb05
Validation cases for step up transformer
figueroa1395 Jan 8, 2025
e123fe4
added test grid for transformer ranking
figueroa1395 Jan 9, 2025
d826afd
address comments: more realistic values
figueroa1395 Jan 13, 2025
ef6d084
addressed comments
figueroa1395 Jan 13, 2025
8c34e88
validation case for step up transformer. marked as failing
figueroa1395 Jan 21, 2025
feb3c3d
Move tap side to control side in one 2w trafo
figueroa1395 Mar 2, 2025
7f041bb
addressing comment
Jerry-Jinfeng-Guo Mar 2, 2025
eee1199
Merge branch 'feature/step-up-transformer-tap-changer-support' into f…
Jerry-Jinfeng-Guo Mar 2, 2025
01ceabf
Amend validation case for tap and control on the same side
figueroa1395 Mar 3, 2025
5fdefc9
formatting
figueroa1395 Mar 3, 2025
d1abb55
address comment
Jerry-Jinfeng-Guo Mar 3, 2025
715dbe4
fix uband
figueroa1395 Mar 3, 2025
2eaaf79
Merge pull request #892 from PowerGridModel/feature/tap-changer-unit-…
Jerry-Jinfeng-Guo Mar 5, 2025
65ad028
Merge branch 'feature/step-up-transformer-tap-changer-support' into i…
figueroa1395 Mar 5, 2025
2a3caed
Remove failing tag from validation test cases
figueroa1395 Mar 5, 2025
f4e9108
Fix any_strategy output results and remove failing tag
figueroa1395 Mar 5, 2025
71cde50
fix u_angle values
figueroa1395 Mar 5, 2025
c4ef6ca
Merge pull request #912 from PowerGridModel/improve-step-up-trafo-tests
Jerry-Jinfeng-Guo Mar 6, 2025
383c348
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Mar 6, 2025
22d574e
sonar cloud
Jerry-Jinfeng-Guo Mar 7, 2025
a7ad759
resolve comment; putting clang-tidy out of its misery
Jerry-Jinfeng-Guo Mar 7, 2025
046ad98
clang-tidy
Jerry-Jinfeng-Guo Mar 7, 2025
b75f6d3
submit to clang-tidy
Jerry-Jinfeng-Guo Mar 7, 2025
f9c990c
process comment
Jerry-Jinfeng-Guo Mar 11, 2025
18c8e8f
Merge branch 'main' into feature/step-up-transformer-tap-changer-support
Jerry-Jinfeng-Guo Mar 11, 2025
5e75ccf
clang-tidy new standard
Jerry-Jinfeng-Guo Mar 11, 2025
e911275
Update power_grid_model_c/power_grid_model/include/power_grid_model/o…
Jerry-Jinfeng-Guo Mar 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/user_manual/calculations.md
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ Power flow calculations that take the behavior of these regulators into account

The following control logic is used:

- Regulated transformers are ranked according to how close they are to {hoverxreftooltip}`sources <user_manual/components:source>` in terms of the amount of transformers inbetween.
- Regulated transformers are ranked according to how close they are to {hoverxreftooltip}`sources <user_manual/components:source>` in terms of the amount of regulated transformers inbetween.
- Transformers are regulated in order according to their ranks.
- Initialize all transformers to their starting tap position (see {hoverxreftooltip}`user_manual/calculations:Initialization and exploitation of regulated transformers`)
- Find the optimal state using the following procedure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ class AutomaticTapCalculationError : public PowerGridError {
}
};

class AutomaticTapInputError : public PowerGridError {
public:
AutomaticTapInputError(std::string const& msg) {
append_msg("Automatic tap changer has invalid configuration. " + msg); // NOSONAR
}
};

class IDWrongType : public PowerGridError {
public:
explicit IDWrongType(ID id) { append_msg("Wrong type for object with id " + detail::to_string(id) + '\n'); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,28 +137,8 @@ inline void add_component(MainModelState<ComponentContainer>& state, ForwardIter
}
}();

if (regulated_object_idx.group == get_component_type_index<Transformer>(state)) {
auto const& regulated_object = get_component<Transformer>(state, regulated_object_idx);

auto const non_tap_side =
regulated_object.tap_side() == BranchSide::from ? BranchSide::to : BranchSide::from;
if (get_component<Node>(state, regulated_object.node(regulated_object.tap_side())).u_rated() <
get_component<Node>(state, regulated_object.node(non_tap_side)).u_rated()) {
throw AutomaticTapCalculationError(id);
}
} else if (regulated_object_idx.group == get_component_type_index<ThreeWindingTransformer>(state)) {
auto const& regulated_object = get_component<ThreeWindingTransformer>(state, regulated_object_idx);
auto const tap_side_u_rated =
get_component<Node>(state, regulated_object.node(regulated_object.tap_side())).u_rated();
for (auto const side : branch3_sides) {
if (side == regulated_object.tap_side()) {
continue;
}
if (tap_side_u_rated < get_component<Node>(state, regulated_object.node(side)).u_rated()) {
throw AutomaticTapCalculationError(id);
}
}
} else {
if (regulated_object_idx.group != get_component_type_index<Transformer>(state) &&
regulated_object_idx.group != get_component_type_index<ThreeWindingTransformer>(state)) {
throw InvalidRegulatedObject(input.regulated_object, Component::name);
}

Expand Down

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/power_grid_model/_core/error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from power_grid_model._core.power_grid_core import power_grid_core as pgc
from power_grid_model.errors import (
AutomaticTapCalculationError,
AutomaticTapInputError,
ConflictID,
ConflictVoltage,
IDNotFound,
Expand Down Expand Up @@ -71,6 +72,8 @@
_AUTOMATIC_TAP_CALCULATION_ERROR_RE = re.compile(
r"Automatic tap changing regulator with tap_side at LV side is not supported. Found at id (-?\d+)\n"
)
_AUTOMATIC_TAP_INPUT_ERROR_RE = re.compile(r"Automatic tap changer has invalid configuration")

_ID_WRONG_TYPE_RE = re.compile(r"Wrong type for object with id (-?\d+)\n")
_INVALID_CALCULATION_METHOD_RE = re.compile(r"The calculation method is invalid for this calculation!")
_INVALID_SHORT_CIRCUIT_PHASE_OR_TYPE_RE = re.compile(r"short circuit type") # multiple different flavors
Expand All @@ -95,6 +98,7 @@
_INVALID_MEASURED_OBJECT_RE: InvalidMeasuredObject,
_INVALID_REGULATED_OBJECT_RE: InvalidRegulatedObject,
_AUTOMATIC_TAP_CALCULATION_ERROR_RE: AutomaticTapCalculationError,
_AUTOMATIC_TAP_INPUT_ERROR_RE: AutomaticTapInputError,
_ID_WRONG_TYPE_RE: IDWrongType,
_INVALID_CALCULATION_METHOD_RE: InvalidCalculationMethod,
_INVALID_SHORT_CIRCUIT_PHASE_OR_TYPE_RE: InvalidShortCircuitPhaseOrType,
Expand Down
4 changes: 4 additions & 0 deletions src/power_grid_model/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ class AutomaticTapCalculationError(PowerGridError):
"""Automatic tap changer with tap at LV side is unsupported for automatic tap changing calculation."""


class AutomaticTapInputError(PowerGridError):
"""Automatic tap changer has invalid configuration."""


class InvalidShortCircuitPhaseOrType(PowerGridError):
"""Invalid (combination of) short circuit types and phase(s) provided."""

Expand Down
1 change: 1 addition & 0 deletions src/power_grid_model/validation/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ def validate_regulator(data: SingleDataset, component: ComponentType) -> list[Va
def validate_transformer_tap_regulator(data: SingleDataset) -> list[ValidationError]:
errors = validate_regulator(data, ComponentType.transformer_tap_regulator)
errors += _all_boolean(data, ComponentType.transformer_tap_regulator, "status")
errors += _all_unique(data, ComponentType.transformer_tap_regulator, "regulated_object")
errors += _all_valid_enum_values(
data, ComponentType.transformer_tap_regulator, "control_side", [BranchSide, Branch3Side]
)
Expand Down
2 changes: 1 addition & 1 deletion tests/cpp_unit_tests/test_optimizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ static_assert(std::convertible_to<decltype(stub_const_dataset_update), ConstData

constexpr auto strategies = [] {
using enum OptimizerStrategy;
return std::array{any, global_minimum, global_maximum, local_minimum, local_maximum};
return std::array{any, local_maximum, local_minimum, global_maximum, global_minimum};
}();

constexpr auto calculation_methods = [] {
Expand Down
Loading
Loading