Skip to content

Commit 9a7568d

Browse files
authored
Merge pull request #596 from rte-france/dev_1.10.1
Ready for version 1.10.1
2 parents 5d93858 + fe41bfd commit 9a7568d

20 files changed

+1141
-147
lines changed

.circleci/config.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,33 @@ jobs:
163163
cd /tmp
164164
grid2op.testinstall
165165
166+
legacy_lightsim:
167+
executor: python38
168+
resource_class: small
169+
steps:
170+
- checkout
171+
- run:
172+
command: |
173+
apt-get update
174+
apt-get install -y coinor-cbc
175+
- run: python -m pip install virtualenv
176+
- run: python -m virtualenv venv_test
177+
- run:
178+
command: |
179+
source venv_test/bin/activate
180+
python -m pip install -U pip setuptools wheel
181+
python -m pip install -U lightsim2grid==0.5.3 gymnasium "numpy<1.22"
182+
- run:
183+
command: |
184+
source venv_test/bin/activate
185+
python -m pip install -e .
186+
pip freeze
187+
- run:
188+
command: |
189+
source venv_test/bin/activate
190+
export _GRID2OP_FORCE_TEST=1
191+
python -m unittest grid2op/tests/test_basic_env_ls.py
192+
166193
install39:
167194
executor: python39
168195
resource_class: small
@@ -313,6 +340,7 @@ workflows:
313340
test:
314341
jobs:
315342
- test
343+
- legacy_lightsim
316344
install:
317345
jobs:
318346
- install38

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ Change Log
3131
- [???] "asynch" multienv
3232
- [???] properly model interconnecting powerlines
3333

34+
[1.10.1] - 2024-03-18
35+
----------------------
36+
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/593
37+
- [FIXED] backward compatibility issues with "oldest" lightsim2grid versions
38+
(now tested in basic settings)
39+
- [ADDED] a "compact" way to store the data in the Runner
40+
- [IMPROVED] the "`train_val_split`" functions, now more names (for the folders)
41+
can be used
3442

3543
[1.10.0] - 2024-03-06
3644
----------------------

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
author = 'Benjamin Donnot'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '1.10.0'
25+
release = '1.10.1.dev0'
2626
version = '1.10'
2727

2828

grid2op/Backend/backend.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,8 +1844,9 @@ def get_action_to_set(self) -> "grid2op.Action.CompleteAction":
18441844
p_s, q_s, sh_v, bus_s = self.shunt_info()
18451845
dict_["shunt"] = {"shunt_bus": bus_s}
18461846
if (bus_s >= 1).sum():
1847-
p_s *= (self._sh_vnkv / sh_v) ** 2
1848-
q_s *= (self._sh_vnkv / sh_v) ** 2
1847+
sh_conn = bus_s > 0
1848+
p_s[sh_conn] *= (self._sh_vnkv[sh_conn] / sh_v[sh_conn]) ** 2
1849+
q_s[sh_conn] *= (self._sh_vnkv[sh_conn] / sh_v[sh_conn]) ** 2
18491850
p_s[bus_s == -1] = np.NaN
18501851
q_s[bus_s == -1] = np.NaN
18511852
dict_["shunt"]["shunt_p"] = p_s
@@ -1944,21 +1945,28 @@ def assert_grid_correct(self) -> None:
19441945
from grid2op.Action import CompleteAction
19451946
from grid2op.Action._backendAction import _BackendAction
19461947

1947-
if self._missing_two_busbars_support_info:
1948-
warnings.warn("The backend implementation you are using is probably too old to take advantage of the "
1949-
"new feature added in grid2op 1.10.0: the possibility "
1950-
"to have more than 2 busbars per substations (or not). "
1951-
"To silence this warning, you can modify the `load_grid` implementation "
1952-
"of your backend and either call:\n"
1953-
"- self.can_handle_more_than_2_busbar if the current implementation "
1954-
" can handle more than 2 busbsars OR\n"
1955-
"- self.cannot_handle_more_than_2_busbar if not."
1956-
"\nAnd of course, ideally, if the current implementation "
1957-
"of your backend cannot "
1958-
"handle more than 2 busbars per substation, then change it :-)\n"
1959-
"Your backend will behave as if it did not support it.")
1948+
if hasattr(self, "_missing_two_busbars_support_info"):
1949+
if self._missing_two_busbars_support_info:
1950+
warnings.warn("The backend implementation you are using is probably too old to take advantage of the "
1951+
"new feature added in grid2op 1.10.0: the possibility "
1952+
"to have more than 2 busbars per substations (or not). "
1953+
"To silence this warning, you can modify the `load_grid` implementation "
1954+
"of your backend and either call:\n"
1955+
"- self.can_handle_more_than_2_busbar if the current implementation "
1956+
" can handle more than 2 busbsars OR\n"
1957+
"- self.cannot_handle_more_than_2_busbar if not."
1958+
"\nAnd of course, ideally, if the current implementation "
1959+
"of your backend cannot "
1960+
"handle more than 2 busbars per substation, then change it :-)\n"
1961+
"Your backend will behave as if it did not support it.")
1962+
self._missing_two_busbars_support_info = False
1963+
self.n_busbar_per_sub = DEFAULT_N_BUSBAR_PER_SUB
1964+
else:
19601965
self._missing_two_busbars_support_info = False
19611966
self.n_busbar_per_sub = DEFAULT_N_BUSBAR_PER_SUB
1967+
warnings.warn("Your backend is missing the `_missing_two_busbars_support_info` "
1968+
"attribute. This is known issue in lightims2grid <= 0.7.5. Please "
1969+
"upgrade your backend. This will raise an error in the future.")
19621970

19631971
orig_type = type(self)
19641972
if orig_type.my_bk_act_class is None:

grid2op/Environment/environment.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Environment(BaseEnv):
7373
7474
"""
7575

76-
REGEX_SPLIT = r"^[a-zA-Z0-9]*$"
76+
REGEX_SPLIT = r"^[a-zA-Z0-9_\\.]*$"
7777

7878
def __init__(
7979
self,
@@ -1362,21 +1362,22 @@ def train_val_split(
13621362
13631363
"""
13641364
# define all the locations
1365-
if re.match(self.REGEX_SPLIT, add_for_train) is None:
1365+
cls = type(self)
1366+
if re.match(cls.REGEX_SPLIT, add_for_train) is None:
13661367
raise EnvError(
13671368
f"The suffixes you can use for training data (add_for_train) "
1368-
f'should match the regex "{self.REGEX_SPLIT}"'
1369+
f'should match the regex "{cls.REGEX_SPLIT}"'
13691370
)
1370-
if re.match(self.REGEX_SPLIT, add_for_val) is None:
1371+
if re.match(cls.REGEX_SPLIT, add_for_val) is None:
13711372
raise EnvError(
13721373
f"The suffixes you can use for validation data (add_for_val)"
1373-
f'should match the regex "{self.REGEX_SPLIT}"'
1374+
f'should match the regex "{cls.REGEX_SPLIT}"'
13741375
)
13751376
if add_for_test is not None:
1376-
if re.match(self.REGEX_SPLIT, add_for_test) is None:
1377+
if re.match(cls.REGEX_SPLIT, add_for_test) is None:
13771378
raise EnvError(
13781379
f"The suffixes you can use for test data (add_for_test)"
1379-
f'should match the regex "{self.REGEX_SPLIT}"'
1380+
f'should match the regex "{cls.REGEX_SPLIT}"'
13801381
)
13811382

13821383
if add_for_test is None and test_scen_id is not None:

0 commit comments

Comments
 (0)