Skip to content

Commit

Permalink
Capability to mix connection and disconnection in a single update (#896)
Browse files Browse the repository at this point in the history
Signed-off-by: Geoffroy Jamgotchian <[email protected]>
  • Loading branch information
geofjamg authored Nov 28, 2024
1 parent 43535cc commit 6c4c84e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,9 @@ private static <T extends Injection<T>> Function<T, String> getBusBreakerViewBus
}

private static void setBusBreakerViewBusId(Terminal t, String busId) {
Objects.requireNonNull(t).getBusBreakerView().setConnectableBus(busId);
if (!busId.isEmpty()) {
Objects.requireNonNull(t).getBusBreakerView().setConnectableBus(busId);
}
}

private static <T extends Injection<T>> void setBusBreakerViewBusId(T i, String busId) {
Expand Down
11 changes: 11 additions & 0 deletions tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2487,5 +2487,16 @@ def test_deprecated_operational_limits_element_type_kwargs():
acceptable_duration=[-1, 60], fictitious=[False, True])


def test_connect_disconnect_with_empty_bus():
network = pp.network.create_eurostag_tutorial_example1_with_more_generators_network()
network.update_generators(id=['GEN', 'GEN2'], connected=[False, True], bus_breaker_bus_id=['', 'NGEN'])
generators = network.get_generators(attributes=['connected', 'bus_breaker_bus_id'])
expected_generators = pd.DataFrame(index=pd.Series(name='id', data=['GEN', 'GEN2']),
columns=['connected', 'bus_breaker_bus_id'],
data=[[False, 'NGEN'],
[True, 'NGEN']])
pd.testing.assert_frame_equal(expected_generators, generators, check_dtype=False)


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

0 comments on commit 6c4c84e

Please sign in to comment.