Skip to content

Commit

Permalink
Merge pull request #428 from BDonnot/dev_multiagent
Browse files Browse the repository at this point in the history
Synch with dev_1.8.2
  • Loading branch information
BDonnot committed Mar 17, 2023
2 parents 4b5b834 + 5fadd37 commit 605f870
Show file tree
Hide file tree
Showing 186 changed files with 13,211 additions and 1,085 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ grid2op/data_test/test_issue_367/chronics/2050-01-03_7/generation_quality.json
grid2op/data_test/test_issue_367/chronics/2050-01-03_7/maintenance_meta.json
test_doc.py
examples/multi_agents/ma_ppo_test/
test_render.py
requirements_issue_389.txt
test_multi_step_for.py

# profiling files
**.prof
Expand Down
92 changes: 89 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,94 @@ Change Log
- [???] "asynch" multienv
- [???] properly model interconnecting powerlines

[1.8.0] - 2022-12-yy
[1.8.2] - 2023-xx-yy
--------------------
- [BREAKING] because bugged... The default behaviour for `env.render()` is now "rgb_array". The mode
"human" has been removed because it needs some fixes. This should not impact lots of code.
- [BREAKING] the "maintenance_forecast" file is deprecated and is no longer used (this should not
not impact anything)
- [BREAKING] the attribute "connected" as been removed in the edges of the observation converted as
as a networkx graph. It is replaced by a "nb_connected" attribute. More information on the doc.
- [BREAKING] the function "obs.as_networkx" will be renamed "`obs.get_energy_graph`" and the
description has been adapted.
- [BREAKING] In `PandaPowerBackend` the kwargs argument "ligthsim2grid" was misspelled and is now properly
renamed `lightsim2grid`
- [FIXED] a bug in `PandapowerBackend` when running in dc mode (voltages were not read correctly
from the generators)
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/389 which was caused by 2 independant things:

1) the `PandapowerBackend` did not compute the `theta` correctly on powerline especially if
they are connected to a disconnected bus (in this case I chose to put `theta=0`)
2) the `obs.get_energy_graph` (previously `obs.as_networkx()`) method did not check,
when updating nodes attributes if powerlines
were connected or not, which was wrong in some cases

- [FIXED] the `N1Reward` that was broken
- [FIXED] the `act._check_for_ambiguity`: a case where missing (when you used topology to disconnect a powerline,
but also set_bus to connect it)
- [FIXED] a bug when the storage unit names where not set in the backend and needed to be set
automatically (wrong names were used)
- [FIXED] a bug in `PandaPowerBackend` when using `BackendConverter` and one the backend do not support shunts.
- [FIXED] 2 issues related to gym env: https://github.com/rte-france/Grid2Op/issues/407 and
https://github.com/rte-france/Grid2Op/issues/418
- [FIXED] some bus in the `obs.get_energy_graph` (previously `obs.as_networkx()`) for the cooldowns of substation
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/396
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/403
- [FIXED] a bug in `PandaPowerBackend` when it was copied (the kwargs used to build it were not propagated)
- [ADDED] the function `obs.get_forecast_env()` that is able to generate a grid2op environment from the
forecasts data in the observation. This is especially useful in model based RL.
- [ADDED] an example on how to write a backend.
- [ADDED] some convenient function of `gridobject` class to convert back and forth "local bus id" (1 or 2) to
"global bus id" (0, 1, 2, ... 2*n_sub) [see `gridobject.global_bus_to_local` or `gridobject.local_bus_to_global`]
- [ADDED] a step by step (very detailed) example on how to build a Backend from an existing grid "solver".
- [ADDED] some test when the shunt bus are modified.
- [ADDED] a function to get the "elements graph" from the grid2op observation (represented as a networkx graph)
as well as its description on the documentation.
- [ADDED] a method to retrieve the "elements graph" (see doc) fom an observation `obs.get_elements_graph()`
- [IMPROVED] possibility to "chain" the call to simulate when multiple forecast
horizon are available.
- [IMPROVED] the `GridStateFromFileWithForecasts` is now able to read forecast from multiple steps
ahead (provided that it knows the horizons in its constructor)
- [IMPROVED] documentation of the gym `DiscreteActSpace`: it is now explicit that the "do nothing" action
is by default encoded by `0`
- [IMPROVED] documentation of `BaseObservation` and its attributes
- [IMPROVED] `PandapowerBackend` can now be loaded even if the underlying grid does not converge in `AC` (but
it should still converge in `DC`) see https://github.com/rte-france/Grid2Op/issues/391
- [IMPROVED] `obs.get_energy_graph` (previously `obs.as_networkx()`) method:
almost all powerlines attributes can now be read from the
resulting graph object.
- [IMPROVED] possibility to set `data_feeding_kwargs` from the config file directly.
- [IMPROVED] so "FutureWarnings" are silenced (depending on pandas and pandapower version)
- [IMPROVED] error messages when "env.reset()" has not been called and some functions are not available.
- [IMPROVED] `act.remove_line_status_from_topo` can now be used without an observation and will "remove"
all the impact on line status from the topology if it causes "AmbiguousAction" (this includes removing
`set_bus` to 1 or 2 with `set_line_status` is -1 or to remove `set_bus` to -1 when `set_line_status` is 1
or to remove `change_bus` when `set_line_status` is -1)
- [IMPROVED] possibility, for `BackendConverter` to converter between backends where one does support
storage units (the one making powerflow) and the other one don't (the one the user will see).
- [IMPROVED] in `BackendConverter` names of the "source backend" can be used to match the time series data
when the "use_target_backend_name=True" (new kwargs)
- [IMPROVED] environment do not crash when it fails to load redispatching data. It issues a warning and continue as if
the description file was not present.
- [IMPROVED] `BackendConverter` is now able to automatically map between different backend with different naming convention
under some hypothesis. CAREFUL: the generated mapping might not be the one you "have in mind" ! As for everything automatic,
it's good because it's fast. It's terrible when you think it does something but in fact it does something else.
- [IMPROVED] the `obs.get_energy_graph` (previously `obs.as_networkx()`) method with added attributes for edges (origin and extremity substation, as well as origin and
extremity buses)
- [IMPROVED] the doc of the `obs.get_energy_graph` (previously `obs.as_networkx()`)
- [IMPROVED] it is now possible to use a different backend, a different grid or different kwargs between the
env backend and the obs backend.

[1.8.1] - 2023-01-11
---------------------
- [FIXED] a deprecation with numpy>= 1.24 (**eg** np.bool and np.str)
- [ADDED] the baseAgent class now has two new template methods `save_state` and `load_state` to save and
load the agent's state during Grid2op simulations. Examples can be found in L2RPN baselines (PandapowerOPFAgent and curriculumagent).
- [IMPROVED] error message in pandapower backend when the grid do not converge due to disconnected
generators or loads.

[1.8.0] - 2022-12-12
---------------------
- [BREAKING] now requires numpy >= 1.20 to work (otherwise there are
issues with newer versions of pandas).
- [BREAKING] issue https://github.com/rte-france/Grid2Op/issues/379 requires
Expand Down Expand Up @@ -79,8 +165,8 @@ Change Log
(see https://github.com/rte-france/Grid2Op/issues/340)
- [FIXED] a slight "bug" in the formula to compute the redispatching cost for L2RPN 2022 competition.
- [IMPROVED] possibility to pass the env variable `_GRID2OP_FORCE_TEST` to force the flag
of "test=True" when creating an environment. This is especially useful when testing to prevent
downloading of data.
of "test=True" when creating an environment. This is especially useful when testing to prevent
downloading of data.
- [IMPROVED] support of "kwargs" backend arguments in `MultiMixEnv` see first
item of version 1.7.1 below

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ WORKDIR /Grid2Op
RUN git pull
RUN git remote update
RUN git fetch --all --tags
RUN git checkout "tags/v1.7.2" -b "v1.7.2-branch"
RUN git checkout "tags/v1.8.2.dev2" -b "v1.8.2.dev2-branch"
# Install Dependencies
RUN pip3 install .[optional,challenge]
WORKDIR /
Expand Down
2 changes: 1 addition & 1 deletion docs/available_envs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ This grid looks like:
|l2rpn_case14_sandbox_layout|


.. _l2rpn_wcci_2022_dev:
.. _l2rpn_wcci_2022:

l2rpn_wcci_2022
++++++++++++++++
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
author = 'Benjamin Donnot'

# The full version, including alpha/beta/rc tags
release = '1.8.0.rc1'
version = '1.7'
release = '1.8.2.dev2'
version = '1.8'


# -- General configuration ---------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion docs/createbackend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ everywhere). This includes, but is not limited to:
Main methods to implement
--------------------------
Typically, a backend has a internal "modeling" / "representation" of the powergrid
stored in the attribute `self._grid` that can be anything.
stored in the attribute `self._grid` that can be anything. An more detailed example, with some
"working minimal code" is given in the "example/backend_integration" of the grid2op repository.

There are 4 **__main__** types of method you need to implement if you want to use a custom powerflow
(*eg* from a physical solver, from a neural network, or any other methods):
Expand Down
4 changes: 2 additions & 2 deletions docs/environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ into memory.

1) create the environment: `env = make(...,chronics_class=MultifolderWithCache)`
2) (optional but recommended) select some scenarios:
`env.chronics_handler.real_data.set_filter(lambda x: re.match(".*december.*", x) is not None)`
3) load the data in memory: `env.chronics_handler.reset()`
`env.chronics_handler.real_data.set_filter(lambda x: re.match(".*december.*", x) is not None)`
3) load the data in memory: `env.chronics_handler.reset()` (see *eg* :func:`grid2op.Chronics.MultifolderWithCache.reset`)
4) do whatever you want using `env`


Expand Down

0 comments on commit 605f870

Please sign in to comment.