Skip to content

Commit a5318ae

Browse files
sonar and test grid asci art in test
Signed-off-by: Jerry Guo <Jerry.Jinfeng.Guo@alliander.com>
1 parent 8ceffe1 commit a5318ae

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ inline auto get_edge_weights(TransformerGraph const& graph) -> TrafoGraphEdgePro
333333
"Control side of a transformer should be the relatively closer side to a source.\n");
334334
}
335335
if (!is_unreachable(edge_res)) {
336-
result.push_back({graph[e].regulated_idx, edge_tgt_rank});
336+
// result.push_back({graph[e].regulated_idx, edge_tgt_rank});
337+
result.emplace_back(TrafoGraphEdge{graph[e].regulated_idx, edge_tgt_rank});
337338
}
338339
}
339340

tests/cpp_unit_tests/test_tap_position_optimizer.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ TEST_CASE("Test Transformer ranking") {
185185
}
186186

187187
SUBCASE("Full grid") {
188+
// =====Test Grid=====
189+
// ________[0]________
190+
// || | |
191+
// [1] [4]--[5]
192+
// | | |
193+
// [2] | [7]
194+
// | [6] |
195+
// [3]----------| [8]
196+
// | |
197+
// L---------------[9]
188198
TestState state;
189199
std::vector<NodeInput> nodes{{0, 150e3}, {1, 10e3}, {2, 10e3}, {3, 10e3}, {4, 10e3},
190200
{5, 50e3}, {6, 10e3}, {7, 10e3}, {8, 10e3}, {9, 10e3}};

tests/unit/test_error_handling.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,16 @@ def test_handle_invalid_calculation_method_error():
289289

290290

291291
def test_transformer_tap_regulator_control_side_not_closer_to_source():
292+
# =====Test Grid=====
293+
# ________[0]________
294+
# || | |
295+
# [1] [4]--[5]
296+
# | | |
297+
# [2] | [7]
298+
# | [6] |
299+
# [3]----------| [8]
300+
# | |
301+
# L---------------[9]
292302
node_input = initialize_array("input", "node", 10)
293303
node_input["id"] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
294304
node_input["u_rated"] = [150e3, 10e3, 10e3, 10e3, 10e3, 50e3, 10e3, 10e3, 10e3, 10e3]

0 commit comments

Comments
 (0)