Skip to content

Commit a7ad759

Browse files
resolve comment; putting clang-tidy out of its misery
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
1 parent 22d574e commit a7ad759

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

power_grid_model_c/power_grid_model/include/power_grid_model/optimizer/tap_position_optimizer.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,13 @@ inline auto get_edge_weights(TransformerGraph const& graph) -> TrafoGraphEdgePro
324324
// In two winding trafo, the edge is always pointing to the control side; in three winding trafo edges, the
325325
// edges are always pointing parallel to the control side: meaning that for delta configuration ABC, the above
326326
// situations can happen.
327+
// The logic still holds in meshed grids, albeit operating a more complex graph.
327328
if (edge_src_rank != edge_tgt_rank - 1) {
328-
throw AutomaticTapInputError(
329-
"Control side of a transformer should be the relatively further side to a source.\n");
329+
throw AutomaticTapInputError("The control side of a transformer regulator should be relatively further "
330+
"away from the source than the tap side.\n");
330331
}
331332
if (!is_unreachable(edge_res)) {
332-
result.emplace_back(graph[e].regulated_idx, edge_tgt_rank);
333+
result.emplace_back(TrafoGraphEdge{graph[e].regulated_idx, edge_tgt_rank}); // NOLINT
333334
}
334335
}
335336

@@ -745,8 +746,7 @@ class TapPositionOptimizerImpl<std::tuple<TransformerTypes...>, StateCalculator,
745746
// Lower bound should be updated to the current tap position if following is the case:
746747
// - tap_max > tap_min && strategy_max == true
747748
// - tap_max < tap_min && strategy_max == false
748-
// Upper bound should be updated to the current tap position if the rest is the case.
749-
bool const invert_strategy = control_at_tap_side_ ? !strategy_max : strategy_max;
749+
bool const invert_strategy = control_at_tap_side_ != strategy_max;
750750
if (tap_reverse_ == invert_strategy) {
751751
lower_bound_ = current_;
752752
last_down_ = false;

src/power_grid_model/_core/error_handling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
_AUTOMATIC_TAP_CALCULATION_ERROR_RE = re.compile(
7373
r"Automatic tap changing regulator with tap_side at LV side is not supported. Found at id (-?\d+)\n"
7474
)
75-
_AUTOMATIC_TAP_INPUT_ERROR_RE = re.compile(r"Automatic tap changer has invalid configuration\..*")
75+
_AUTOMATIC_TAP_INPUT_ERROR_RE = re.compile(r"Automatic tap changer has invalid configuration")
7676

7777
_ID_WRONG_TYPE_RE = re.compile(r"Wrong type for object with id (-?\d+)\n")
7878
_INVALID_CALCULATION_METHOD_RE = re.compile(r"The calculation method is invalid for this calculation!")

0 commit comments

Comments
 (0)