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

Capability to mix connection and disconnection in a single update #896

Merged
merged 2 commits into from
Nov 28, 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 @@ -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()
Loading