Skip to content

Branch into itself: core implementation#1419

Merged
mgovers merged 17 commits into
mainfrom
pgm/feature/lines-into-itself-core
Jun 4, 2026
Merged

Branch into itself: core implementation#1419
mgovers merged 17 commits into
mainfrom
pgm/feature/lines-into-itself-core

Conversation

@mgovers
Copy link
Copy Markdown
Member

@mgovers mgovers commented Jun 2, 2026

Part of #1418

Contributes towards #35

NOTE: this only affects the core. No validation cases are added in this PR. While it is of course possible that there are bugs introduced that will be caught by such validation cases, since both the docs and the data validator at this point in time still reject branches into itself, the behavior is still unspecified (subcategory of undefined behavior) and, therefore, such a bug should not be considered to affect users, because it is the user's responsibility to not invoke undefined behavior.

@mgovers mgovers self-assigned this Jun 2, 2026
@mgovers mgovers added the feature New feature or request label Jun 2, 2026
Copy link
Copy Markdown
Member

@figueroa1395 figueroa1395 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm almost done, but checking out the topology tests is not an easy task. I will finish tomorrow with the last part, but so far, so good.

In addition, I will also dig into the SE to double check again if nothing breaks there.

Comment thread tests/cpp_unit_tests/test_link.cpp Outdated
Comment thread tests/cpp_unit_tests/test_y_bus.cpp Outdated
Comment thread tests/cpp_unit_tests/test_y_bus.cpp Outdated
Comment thread tests/cpp_unit_tests/test_y_bus.cpp
Comment thread tests/cpp_unit_tests/test_topology.cpp
Comment thread tests/cpp_unit_tests/test_topology.cpp Outdated
Comment thread tests/cpp_unit_tests/test_topology.cpp
mgovers added 8 commits June 3, 2026 08:19
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@mgovers mgovers force-pushed the pgm/feature/lines-into-itself-core branch from f832760 to 363a965 Compare June 3, 2026 06:26
Copy link
Copy Markdown
Member

@figueroa1395 figueroa1395 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since both the docs and the data validator at this point in time still reject branches into itself, the behavior is still unspecified (subcategory of undefined behavior) and, therefore, such a bug should not be considered to affect users, because it is the user's responsibility to not invoke undefined behavior.

I agree, but lets make sure we all agree on this so we don't have to circle back later. We also may want to send a deprecation notice via the mailing list/community meeting or similar.

On the other hand, I scanned again NRSE and I didn't see any problem thus far. There isn't any explicit check against having self connecting branches + the math seems to hold as long as the ybus entries are fine, which seems to be the case as well.

Finally, I noticed that we may have an issue with observability, as I don't think it will recognize "flow" sensors on a self connecting branch since this will only appear in the y-bus diagonal, whereas the check looks for the upper diagonal parts. This needs to be further checked, but something to keep and potentially tackle in a follow up.

Comment thread tests/cpp_unit_tests/test_topology.cpp
Comment thread tests/cpp_unit_tests/test_y_bus.cpp Outdated
Comment thread tests/cpp_unit_tests/test_y_bus.cpp Outdated
Comment thread tests/unit/test_error_handling.py
Comment thread src/power_grid_model/errors.py
mgovers and others added 2 commits June 3, 2026 10:01
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>

Co-authored-by: Santiago Figueroa Manrique <figueroa1395@gmail.com>
Signed-off-by: Martijn Govers <martygovers@hotmail.com>
mgovers added 2 commits June 3, 2026 10:19
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Comment thread tests/cpp_unit_tests/test_observability.cpp
mgovers added 2 commits June 3, 2026 11:32
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
…o itself, one voltage sensor and one power sensor on the branch

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@mgovers mgovers force-pushed the pgm/feature/lines-into-itself-core branch from 3b01b4f to 0224416 Compare June 3, 2026 09:40
Comment thread tests/cpp_unit_tests/test_topology.cpp
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@mgovers mgovers enabled auto-merge June 3, 2026 11:32
…ranking

Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
Comment thread tests/cpp_unit_tests/test_tap_position_optimizer.cpp Outdated
Comment thread tests/cpp_unit_tests/test_tap_position_optimizer.cpp Outdated
Signed-off-by: Martijn Govers <Martijn.Govers@Alliander.com>
@mgovers mgovers force-pushed the pgm/feature/lines-into-itself-core branch from e51c729 to 45a257d Compare June 4, 2026 06:17
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 4, 2026

@mgovers mgovers added this pull request to the merge queue Jun 4, 2026
Merged via the queue into main with commit aa0fc3e Jun 4, 2026
59 of 62 checks passed
@mgovers mgovers deleted the pgm/feature/lines-into-itself-core branch June 4, 2026 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants