Skip to content
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

Make pairing key of dangling lines updatable and remove ucte_xnode_code from the default attributes of the dataframe #811

Merged
merged 8 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ static NetworkDataframeMapper danglingLines() {
.strings("bus_breaker_bus_id", getBusBreakerViewBusId(), NetworkDataframes::setBusBreakerViewBusId, false)
.ints("node", dl -> getNode(dl.getTerminal()), false)
.booleans("connected", dl -> dl.getTerminal().isConnected(), connectInjection())
.strings("pairing_key", dl -> Objects.toString(dl.getPairingKey(), ""))
.strings("pairing_key", dl -> Objects.toString(dl.getPairingKey(), ""), DanglingLine::setPairingKey)
.strings("ucte_xnode_code", dl -> Objects.toString(dl.getPairingKey(), ""))
.booleans("fictitious", Identifiable::isFictitious, Identifiable::setFictitious, false)
.strings("tie_line_id", dl -> dl.getTieLine().map(Identifiable::getId).orElse(""))
Expand Down
2 changes: 2 additions & 0 deletions pypowsybl/network/impl/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2584,6 +2584,8 @@ def update_dangling_lines(self, df: DataFrame = None, **kwargs: ArrayLike) -> No
- `q`
- `connected`
- `fictitious`
- `pairing_key`
- `bus_breaker_bus_id` if the dangling line is in a voltage level with `BUS_BREAKER` topology

See Also:
:meth:`get_dangling_lines`
Expand Down
6 changes: 6 additions & 0 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2092,6 +2092,12 @@ def test_nad_parameters():
assert nad_parameters.radius_factor == 120.0
assert nad_parameters.edge_info_displayed == EdgeInfoType.CURRENT

def test_update_dangling_line():
network = pp.network.create_eurostag_tutorial_example1_network()
network.create_dangling_lines(id='dangling_line', voltage_level_id='VLGEN', bus_id='NGEN', p0=100, q0=100, r=0, x=0, g=0, b=0)
network.update_dangling_lines(id=['dangling_line'], pairing_key=['XNODE'])
assert network.get_dangling_lines().loc['dangling_line'].pairing_key == 'XNODE'


if __name__ == '__main__':
unittest.main()
Loading