Skip to content

Commit

Permalink
fixing an issue in the action
Browse files Browse the repository at this point in the history
Signed-off-by: DONNOT Benjamin <[email protected]>
  • Loading branch information
BDonnot committed Nov 19, 2024
1 parent 7acf066 commit bbec434
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Native multi agents support:
when creating the data.
- [FIXED] issue https://github.com/Grid2op/grid2op/issues/657
- [FIXED] missing an import on the `MaskedEnvironment` class
- [FIXED] a bug when trying to set the load_p, load_q, gen_p, gen_v by names.
- [ADDED] possibility to set the "thermal limits" when calling `env.reset(..., options={"thermal limit": xxx})`
- [ADDED] possibility to retrieve some structural information about elements with
with `gridobj.get_line_info(...)`, `gridobj.get_load_info(...)`, `gridobj.get_gen_info(...)`
Expand Down
1 change: 1 addition & 0 deletions grid2op/Action/baseAction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1941,6 +1941,7 @@ def _digest_injection(self, dict_):
elif len(el_ids) >= 2:
raise AmbiguousAction(f"More than one element named {el_nm} for key {k} when trying to modify the injection")
vals[el_ids[0]] = dt_float(el_val)
self._dict_inj[k] = vals
else:
self._dict_inj[k] = np.array(tmp_d[k]).astype(dt_float)
# TODO check the size based on the input data !
Expand Down
2 changes: 1 addition & 1 deletion grid2op/Backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1600,7 +1600,7 @@ def load_redispacthing_data(self,
for el in mandatory_columns:
if el not in df.columns:
warnings.warn(
f"Impossible to load the redispatching data for this environment because"
f"Impossible to load the redispatching data for this environment because "
f"one of the mandatory column is not present ({el}). Please check the file "
f'"{name}" contains all the mandatory columns: {mandatory_columns}'
)
Expand Down
9 changes: 7 additions & 2 deletions grid2op/Environment/baseEnv.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ def foo(manager):

#: this are the keys of the dictionnary `options`
#: that can be used when calling `env.reset(..., options={})`
KEYS_RESET_OPTIONS = {"time serie id", "init state", "init ts", "max step", "thermal limit"}
KEYS_RESET_OPTIONS = {"time serie id",
"init state",
"init ts",
"max step",
"thermal limit",
}

def __init__(
self,
Expand Down Expand Up @@ -1882,7 +1887,7 @@ def _get_new_prod_setpoint(self, action):
tmp = action._dict_inj["prod_p"]
indx_ok = np.isfinite(tmp)
new_p[indx_ok] = tmp[indx_ok]

# modification of the environment always override the modification of the agents (if any)
# TODO have a flag there if this is the case.
if "prod_p" in self._env_modification._dict_inj:
Expand Down

0 comments on commit bbec434

Please sign in to comment.