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

Load and Generation Shedding #655

Merged
merged 49 commits into from
Dec 13, 2024
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
96e1ca5
Add: AllowShedding attribute to GridObjects
DEUCE1957 Nov 4, 2024
75cf5a7
Debug: GridObject AllowShedding conversion
DEUCE1957 Nov 4, 2024
55e8c41
Add: Exception if shedding is not supported by Backend
DEUCE1957 Nov 4, 2024
51eb97e
Refact: Remove bool return from set_shedding() method
DEUCE1957 Nov 4, 2024
623d04b
Test: Add Entry for Allow_Shedding
DEUCE1957 Nov 4, 2024
ccbd1db
Refact: Remove Allow_Shedding from dict repr of GridObject
DEUCE1957 Nov 4, 2024
9c0078e
Add: Unit Tests
DEUCE1957 Nov 5, 2024
90c96d8
Refact: Use DEFAULT constants for n_busbar and allow_shedding
DEUCE1957 Nov 6, 2024
50b7c0f
Add: Can/Cannot Handle Interface for Load/Gen detachment
DEUCE1957 Nov 6, 2024
54ef719
Refact: Remove Set_Shedding
DEUCE1957 Nov 6, 2024
d9da4bf
Add: Backend-Agnostic Detachment Check
DEUCE1957 Nov 6, 2024
e66fd03
Add: ClassAttribute integration for AllowDetachment
DEUCE1957 Nov 6, 2024
6aa67c0
Debug: Use _get_topo_vect inside Backend check for Detachment
DEUCE1957 Nov 8, 2024
aebfaa1
Test: Update Backend Tests to expect _run_pf_with_diverging to catch …
DEUCE1957 Nov 8, 2024
486cffa
Debug: Try to fix Test_Issue_125
DEUCE1957 Nov 8, 2024
f16ba3c
Merge remote-tracking branch 'deuce1957/dev_shedding' into dev_shedding
BDonnot Nov 19, 2024
938709a
Add: 'detachment_is_allowed' in GridObj and Environment
DEUCE1957 Nov 23, 2024
4112dfe
Debug: assert 'detachment_is_allowed' in GridObject
DEUCE1957 Nov 23, 2024
7b6dabc
Test: Update strings for detachment
DEUCE1957 Nov 24, 2024
0666b39
Debug: Fix nested f-string in GridObjects
DEUCE1957 Nov 24, 2024
7cdf6c2
Debug: Add post-powerflow check for load / gen disconnect
DEUCE1957 Nov 24, 2024
bb23193
Debug: Add convergence check to post-powerflow check
DEUCE1957 Nov 24, 2024
c4d2c5c
Merge remote-tracking branch 'deuce1957/dev_shedding' into dev_shedding
BDonnot Nov 25, 2024
62f5428
fixing conflicts
BDonnot Nov 25, 2024
6e08212
forbid args in env creation, fix bug on CI, refacto the 'make' call
BDonnot Nov 25, 2024
4cf73c6
fixes to make tests pass
BDonnot Nov 25, 2024
dbba375
fix issue 125
BDonnot Nov 25, 2024
09d1a65
still working on making tests pass with new more concise implementation
BDonnot Nov 25, 2024
d6bf9a8
should fix all issues, need to make the AAA test suite better now
BDonnot Nov 26, 2024
8b70407
fixing broken tests (hopefully) and improve AAA backend test suite fo…
BDonnot Nov 26, 2024
2e81300
remove a pdb...
BDonnot Nov 26, 2024
3e25e95
Debug: Fix check in PandaPower Backend that prevents large-scale load…
DEUCE1957 Nov 27, 2024
d2d71ba
Debug: Use load dataframe instead of res_load for in_service check
DEUCE1957 Nov 27, 2024
809dfe4
Debug: Temporarily Rollback HotFix to PandaPowerBackend
DEUCE1957 Nov 27, 2024
5350712
Merge pull request #1 from BDonnot/dev_shedding
DEUCE1957 Nov 27, 2024
d2117e9
Merge branch 'dev_1.11.0' of https://github.com/Grid2op/grid2op into …
DEUCE1957 Dec 2, 2024
edcc81c
Refact: Improve Code Smell
DEUCE1957 Dec 2, 2024
5ee9aee
Add: Bring back fix to PandaPowerBackend for isolated loads
DEUCE1957 Dec 2, 2024
9adc3a4
Refact: Simplify _check_kirchhoff
DEUCE1957 Dec 2, 2024
42535de
Debug: Fix missing param in kirchhoff static methods
DEUCE1957 Dec 2, 2024
9a6b696
Refact: Emulate obs._check_kirchhoff in Backend._check_kirchhoff
DEUCE1957 Dec 2, 2024
5851026
refactoring check_kirchhoff methods of Observation and Backend, shoul…
BDonnot Dec 4, 2024
70d9292
Merge: dev_1.11.0 into dev_shedding
DEUCE1957 Dec 5, 2024
7dcbfa4
Merge pull request #2 from BDonnot/dev_shedding
DEUCE1957 Dec 5, 2024
1bdce5d
adding a kwargs to set the initial time stamp of the observation
BDonnot Dec 12, 2024
aab2b8d
Merge pull request #673 from BDonnot/bd_dev
BDonnot Dec 12, 2024
812a2e8
Merge remote-tracking branch 'upstream/dev_1.11.0' into dev_shedding
BDonnot Dec 13, 2024
c29b619
fix some last issue before merging on dev_turnoff_gen_load
BDonnot Dec 13, 2024
73d14dd
Merge branch 'BDonnot-dev_shedding' into dev_shedding
DEUCE1957 Dec 13, 2024
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
Prev Previous commit
Next Next commit
fix some last issue before merging on dev_turnoff_gen_load
Signed-off-by: DONNOT Benjamin <benjamin.donnot@rte-france.com>
BDonnot committed Dec 13, 2024
commit c29b619e15d3cad494e37c0a60f1b4be47abc777
2 changes: 2 additions & 0 deletions grid2op/Backend/backend.py
Original file line number Diff line number Diff line change
@@ -1226,6 +1226,8 @@ def storages_info(self) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
raise BackendError(
"storages_info method is not implemented yet there is batteries on the grid."
)
empty_ = np.array([])
return empty_, empty_, empty_

def storage_deact_for_backward_comaptibility(self) -> None:
"""
8 changes: 1 addition & 7 deletions grid2op/Backend/pandaPowerBackend.py
Original file line number Diff line number Diff line change
@@ -1116,13 +1116,7 @@ def runpf(self, is_dc : bool=False) -> Tuple[bool, Union[Exception, None]]:
self.load_theta[:],
) = self._loads_info()

load_in_service = self._grid.load["in_service"]
if not is_dc:
if not np.isfinite(self.load_v[load_in_service]).all():
# TODO see if there is a better way here
# some loads are disconnected: it's a game over case!
raise pp.powerflow.LoadflowNotConverged(f"Isolated load: check loads {np.isfinite(self.load_v).nonzero()[0]}")
else:
if is_dc:
# fix voltages magnitude that are always "nan" for dc case
# self._grid.res_bus["vm_pu"] is always nan when computed in DC
self.load_v[:] = self.load_pu_to_kv # TODO
14 changes: 6 additions & 8 deletions grid2op/tests/aaa_test_backend_interface.py
Original file line number Diff line number Diff line change
@@ -1001,7 +1001,9 @@ def test_19_isolated_storage_stops_computation(self, allow_detachment=DEFAULT_AL

def test_20_disconnected_load_stops_computation(self, allow_detachment=DEFAULT_ALLOW_DETACHMENT):
"""
Tests that a disconnected load unit will be caught by the `_runpf_with_diverging_exception` method.
Tests that a disconnected load unit will be caught by the `_runpf_with_diverging_exception` method
if loads are not allowed to be "detached" from the grid (or if your backend does not support
the "detachment" feature.)

This test supposes that :

@@ -1010,8 +1012,6 @@ def test_20_disconnected_load_stops_computation(self, allow_detachment=DEFAULT_A
- backend.apply_action() for topology modification
- backend.reset() is implemented

NB: this test is skipped if your backend does not (yet :-) ) supports storage units

.. note::
Currently this stops the computation of the environment and lead to a game over.

@@ -1041,6 +1041,8 @@ def test_20_disconnected_load_stops_computation(self, allow_detachment=DEFAULT_A
def test_21_disconnected_gen_stops_computation(self, allow_detachment=DEFAULT_ALLOW_DETACHMENT):
"""
Tests that a disconnected generator will be caught by the `_runpf_with_diverging_exception` method
if generators are not allowed to be "detached" from the grid (or if your backend does not support
the "detachment" feature.)

This test supposes that :

@@ -1049,8 +1051,6 @@ def test_21_disconnected_gen_stops_computation(self, allow_detachment=DEFAULT_AL
- backend.apply_action() for topology modification
- backend.reset() is implemented

NB: this test is skipped if your backend does not (yet :-) ) supports storage units

.. note::
Currently this stops the computation of the environment and lead to a game over.

@@ -1091,8 +1091,6 @@ def test_22_islanded_grid_stops_computation(self):
- backend.apply_action() for topology modification
- backend.reset() is implemented

NB: this test is skipped if your backend does not (yet :-) ) supports storage units

.. note::
Currently this stops the computation of the environment and lead to a game over.

@@ -1721,7 +1719,7 @@ def test_31_disconnected_storage_with_p_stops_computation(self, allow_detachment
Currently this stops the computation of the environment and lead to a game over.

.. note::
This test is also used in `attr:AAATestBackendAPI.test_31_allow_detachment`
This test is also used in `attr:AAATestBackendAPI.test_33_allow_detachment`

"""
self.skip_if_needed()