Recent Releases of Grid2Op
Grid2Op - Pre release: 1.11.0
This is rather large release, including (but not limited too):
A whole new feature: it is now possible to continue an episode if a load or a generator is disconnected by an Agent (this is called detachement
) This feature is disabled by default, unless the kwargs allow_detachment=True
is passed when an environment is created). This comes with added action and observation attributes.
Different bugfixes, including some for the "protections" module and the SOFT_OVERFLOW_THRESHOLD
parameters.
The ability to tell an environment not to perform redispatching and let either the Agent take care of it (if the agent actions is correct) or the Environment (in case the action does not lead to an equilibrium)
And some quality of life feature, for example being able to retrieve information about objects based on their names or ids, some methods are now correctly spelled (eg check_kirchoff) or improved type hinting.
Full changes are:
- [BREAKING] Change for
FromMultiEpisodeData
that disables the caching by default
when creating the data. - [BREAKING] deprecation of
backend.check_kirchoff
in favor ofbackend.check_kirchhoff
(fix the typo in the name) - [BREAKING] change the name of the generated classes: now by default the backend class
name is added. This behaviour can be turned off by passing_add_cls_nm_bk=False
when callinggrid2op.make(...)
. If you develop a new Backend, you can also
customize the added name by overloading theget_class_added_name
class method. - [BREAKING] it is now forbidden to create environment with arguments.
Only key-word arguments are allowed. - [BREAKING] the way actions is serialized has been changed with respect to the
from_vect
/
to_vect
method. This might introduce some issues when loading previously saved actions
with this methods. - [BREAKING] first kwargs of
backend.apply_action
method is now spelledbackend_action
(instead of backendAction) - [BREAKING] (not yet) rationalization of the backend public / private API part. The
environment (and simulator, forecast env etc.) will always call the method_public
for exampleload_grid_public
,reset_public
,copy_public
andapply_action_public
.
These function of the baseBackend
should NOT be overriden, and will internally call
the functionsload_grid
,reset
,copy
andapply_action
which were part of the public
API. These last member functions will be renamed (in a later version)_load_grid
,
_reset
,_copy
and_apply_action
to reflect this change. NOT for this version however ! - [BREAKING] removal of the
rest_server
grid2op module (it will be release as a separate package instead)
It has been removed from grid2op core package for securtiy reasons. - [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.
- [FIXED] the
obs.get_forecast_env
: in some cases the resulting first
observation (obtained fromfor_env.reset()
) did not have the correct
topology. - [FIXED] issue https://github.com/Grid2op/grid2op/issues/665 (
obs.reset()
was not correctly implemented: some attributes were forgotten) - [FIXED] issue https://github.com/Grid2op/grid2op/issues/667 (
act.as_serializable_dict()
was not correctly implemented AND the_aux_affect_object_int
and_aux_affect_object_float
have been also fixed - weird behaviour when you give them a list with the exact length of the
object you tried to modified (for example a list with a size ofn_load
that affected the loads)) - [FIXED] a bug when using the
DoNothingHandler
for the maintenance and the
environment data - [FIXED] an issue preventing to set the thermal limit in the options
if the last simulated action lead to a game over - [FIXED] some bugs in
act.from_json(...)
due to the handling of the injection modifications. - [FIXED] logos now have the correct URL
- [FIXED] deprecated call to
tostring_rgb
(replacedtostring_argb
) in the env.render function. - [FIXED] warnings not properly issued in the AAA test when backend failed to call
can_handle_XXX
functions (egcan_handle_more_than_2_busbar()
orcan_handle_detachment()
) - [FIXED] an issue with
obs.get_forecast_env
with changeNothing and DoNothingHandler time series - [FIXED] a bug in updating the shunt in PandaPowerBackend (depdending on pandas version)
- [FIXED] a bug when action that reconnect loads, storage units or shunts are done
in the "obs.simulate" (results could depend from previous "obs.simulate" calls) - [FIXED] a bug in "obs.simulate" and "obs.get_forecast_env" : when a line was disconnected
and the user tried to reconnect it (without specifying on which bus) it could do something
different than "env.step" (with the same action) - [FIXED] a powerflow is run when the environment is first created even before the initial "env.step"
function is called. This is to ensure proper behaviour if env is used without being reset. - [FIXED] no error was catched if the backend could not properly apply the action sent by the environment.
- [FIXED] an issue in the AAA tests: when backend does not support storages, some tests were skipped not correctly
- [FIXED] an issue when computing the cascading failure routine, in case multiple iterations were performed,
the cooldowns were not updated correctly. - [FIXED] cascading failure could be started at the first observation (t=0, just after a reset).
- [FIXED] a bug when "SOFT_OVERFLOW_THRESHOLD" was not 1.: it also impacted "instantaneous overcurrent protections"
(it was triggered whenflow > SOFT_OVERFLOW_THRESHOLD * HARD_OVERFLOW_THRESHOLD * th_lim
) - [FIXED] a bug when "SOFT_OVERFLOW_THRESHOLD" was not 1.: the backend routine to compute the protections
disconnected the lines with a counter based onflow > th_lim
and notflow > th_lim * SOFT_OVERFLOW_THRESHOLD
- [ADDED] Possibility to disconnect loads, generators and storage units (if proper flag set in the environment).
See documentation. - [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
withgridobj.get_line_info(...)
,gridobj.get_load_info(...)
,gridobj.get_gen_info(...)
or ,gridobj.get_storage_info(...)
- [ADDED] codacy badge on the readme
- [ADDED] a method to check the KCL (
obs.check_kirchhoff
) directly from the observation
(previously it was only possible to do it from the backend). This should
be used for testing purpose only - [ADDED] parameters to disable the "redispatching routine" of the environment
(seeparams.ENV_DOES_REDISPATCHING
) - [ADDED] parameters to stop the episode when one of the constraints of one of the
generators is not met (seeparams.STOP_EP_IF_SLACK_BREAK_CONSTRAINTS
) - [ADDED] possibility to set the initial time stamp of the observation in the
env.reset
kwargs by usingenv.reset(..., options={"init datetime": XXX})
- [ADDED] the
ChangeNothing
time series class now supports forecast - [ADDED] test coverage on the CI
- [ADDED] the
obs.timestep_protection_triggered
counter which counts whether or not the
"time overcurrent protection" (soft overflow) will be triggered: lines will be disconnected
iftime overcurrent protection > parameters.NB_TIMESTEP_POWERFLOW_ALLOWED
- [IMPROVED] possibility to set the injections values with names
to be consistent with other way to set the actions (eg set_bus) - [IMPROVED] error messages when creating an action which changes the injections
- [IMPROVED] (linked to https://github.com/Grid2op/grid2op/issues/657) the way the
"chronics_hander" in the ObsEnv behaves (it now fully implements the public interface of
a "real" chronic_handler) - [IMPROVED] error message in the
FromNPY
class when the backend is checked - [IMRPOVED] the
FromMultiEpisodeData
class with the addition of thecaching
kwargs to allow / disable caching (which was default behavior in previous version) - [IMPROVED] the
FromMultiEpisodeData
class that now returns also the path of the data - [IMPROVED] the classes inherited from
GreedyAgent
with the added possibility to
do theobs.simulate
on a different time horizon (kwargsimulated_time_step
) - [IMPROVED] some type hints for some agent class
- [IMPROVED] the
backend.update_from_obs
function to work even when observation
does not have shunt information but there are not shunts on the grid. - [IMPROVED] consistency of
MultiMixEnv
in case of automatic_classes (only one
class is generated for all mixes) - [IMRPOVED] handling of disconnected elements in the backend no more
raise error. The baseBackend
class does that. - [IMPROVED] the
act.as_serializable_dict()
to be more 'backend agnostic'as
it nows tries to use the name of the elements in the json output - [IMPROVED] the way shunt data are digested in the
BaseAction
class (it is now
possible to use the same things as for the other types of element) - [IMPROVED] grid2op does not require the
chronics
folder when using theFromHandlers
class - [IMPROVED] the function
action.get_topological_impact(...)
has now a "caching" mechanism
that allows not to recompute it over and over again (this is internal API please do not change
it... unless you know what you are doing) - [IMPROVED]
ForecastEnv
is now part of the public API. - [IMPROVED] no need to call
self._compute_pos_big_top()
at the end of the implementation ofbackend.load_grid()
- [IMPROVED] type hints in various files.
- [IMPROVED] documentation of the backend
- [IMRPOVED]
SOFT_OVERFLOW_THRESHOLD
can now be lower than 1
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot 17 days ago
Grid2Op - Pre release: 1.11.0.dev4
Pre release that robustifies the "detachment" feature.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot about 2 months ago
Grid2Op - Release v1.10.5
- [FIXED] new pypi link (no change in code)
- [FIXED] mybinder environment
- [FIXED] update all the links in the README.md (for the new grid2op location)
- [FIXED] update all the links in the docs and the grid2op source files
(to match new location: Grid2op/grid2op.git) - [FIXED] the link in the
make_env
andupdate_env
to point to
https://api.github.com/repos/Grid2Op/grid2op-datasets/ - [IMPROVED] clarity of the "work in progress" in this CHANGELOG
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot 7 months ago
Grid2Op - Release v1.10.4
- [FIXED] an issue in the backend: if the backend failed to be
created the_grid
attribute was set toNone
and not set back to - [FIXED] the
self.skip_if_needed()
was missing for one of the test suite. - [FIXED] an error in the descirption of the
educ_case14_storage
environment
(wrong sign for the slack generator) - [FIXED] the environment would not load in case of an incorrect "layout.json"
instead of raising a warning. - [FIXED] some issue with gym_compat module for "newest" version of
gymnasium (1.0.0) - [FIXED] github ci (v1 and v2 artifact are now deprecated)
- [ADDED] a code of conduct from github
- [ADDED] a "CONTRIBUTING.md" files (instead of having contribution instructions
in the readme) - [ADDED] numpy 2 support (now that pandapower allows it)
- [IMPROVED] error message when forecasts are not correctly set-up
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot 7 months ago
Grid2Op - Release v1.10.3
- [BREAKING]
env.chronics_hander.set_max_iter(xxx)
is now a private function. Use
env.set_max_iter(xxx)
or even betterenv.reset(options={"max step": xxx})
.
Indeed,env.chronics_hander.set_max_iter()
will likely have
no effect at all on your environment. - [BREAKING] for all the
Handler
(egCSVForecastHandler
) the methodset_max_iter
is
now private (for the same reason as theenv.chronics_handler
). We do not recommend to
use it (will likely have no effect). Prefer usingenv.set_max_iter
instead. - [BREAKING] now the
runner.run()
method only accept kwargs argument
(because it should always have been like this) - [BREAKING] to improve pickle support and multi processing capabilities, the attribute
gym_env.observation_space._init_env
andgym_env.observation_space.initial_obs_space
have been deleted (for theDict
space only, for the other spaces like theBox
they
were not present in the first place) - [BREAKING] in the
GymEnv
class now by default the underlying grid2op environment has no
forecast anymore in an attempt to make this wrapper faster AND more easily pickle-able. You can
retrieve the old behaviour by passinggym_env = GymEnv(grid2op_env, with_forecast=True)
- [FIXED] a bug in the
MultiFolder
andMultifolderWithCache
leading to the wrong
computation ofmax_iter
on some corner cases - [FIXED] the function
cleanup_action_space()
did not work correctly when the "chronics_hander"
was not initialized for some classes - [FIXED] the
_observationClass
attribute of the "observation env" (used for simulate and forecasted env)
is now an Observation and not an Action. - [FIXED] a bug when deep copying an "observation environment" (it changes its class)
- [FIXED] issue on
seed
andMultifolderWithCache
which caused
https://github.com/rte-france/Grid2Op/issues/616 - [FIXED] another issue with the seeding of
MultifolderWithCache
: the seed was not used
correctly on the cache data when callingchronics_handler.reset
multiple times without
any changes - [FIXED]
Backend
now properly raise EnvError (grid2op exception) instead of previously
EnvironmentError
(python default exception) - [FIXED] a bug in
PandaPowerBackend
(missing attribute) causing directly
https://github.com/rte-france/Grid2Op/issues/617 - [FIXED] a bug in
Environment
: the thermal limit were used when loading the environment
even before the "time series" are applied (and before the user defined thermal limits were set)
which could lead to disconnected powerlines even before the initial step (t=0, when time
series are loaded) - [FIXED] an issue with the "max_iter" for
FromNPY
time series generator - [FIXED] a bug in
MultiMixEnvironment
: a multi-mix could be created even if the underlying
powergrids (for each mix) where not the same. - [FIXED] a bug in
generate_classes
(experimental_read_from_local_dir) with alert data. - [FIXED] a bug in the
Runner
when using multi processing on macos and windows OS: some non default
parameters where not propagated in the "child" process (bug inrunner._ger_params
) - [ADDED] possibility to skip some step when calling
env.reset(..., options={"init ts": ...})
- [ADDED] possibility to limit the duration of an episode with
env.reset(..., options={"max step": ...})
- [ADDED] possibility to specify the "reset_options" used in
env.reset
when
using the runner withrunner.run(..., reset_options=xxx)
- [ADDED] the argument
mp_context
when building the runner to help pass a multiprocessing context in the
grid2opRunner
- [ADDED] the time series are now able to regenerate their "random" part
even when "cached" thanks to the addition of theregenerate_with_new_seed
of the
GridValue
class (in public API) - [ADDED]
MultifolderWithCache
now supportsFromHandlers
time series generator - [IMPROVED] more consistency in the way the classes are initialized at the creation of an environment
- [IMPROVED] more consistency when an environment is copied (some attributes of the copied env were
deep copied incorrectly) - [IMPROVED] Doc about the runner
- [IMPROVED] the documentation on the
time series
folder. - [IMPROVED] now the "maintenance from json" (eg the
JSONMaintenanceHandler
or the
GridStateFromFileWithForecastsWithMaintenance
) can be customized with the day
of the week where the maintenance happens (keymaintenance_day_of_week
) - [IMPROVED] in case of "
MultiMixEnvironment
" there is now only class generated for
all the underlying mixes (instead of having one class per mixes) - [IMPROVED] the
EpisodeData
have now explicitely a mode where they can be shared accross
processes (usingfork
at least), seeep_data.make_serializable
- [IMPROVED] chronix2grid tests are now done independantly on the CI
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot 10 months ago
Grid2Op - Release v1.10.2
Lots of things have been done in this release that focuses on user experience.
The most notable addition is to be able to set the initial state of the grid when calling env.reset()
Unfortunately, this comes with a few breaking changes.
Breaking changes
- [BREAKING] the
runner.run_one_episode
now returns an extra first argument:
chron_id, chron_name, cum_reward, timestep, max_ts = runner.run_one_episode()
which
is consistant withrunner.run(...)
(previously it returned only
chron_name, cum_reward, timestep, max_ts = runner.run_one_episode()
) - [BREAKING] the runner now has no
chronics_handler
attribute (runner.chronics_handler
is not defined) - [BREAKING] now grid2op forces everything to be connected at busbar 1 if
param.IGNORE_INITIAL_STATE_TIME_SERIE == True
(NOT the default) and
no initial state is provided inenv.reset(..., options={"init state": ...})
Additions
- [ADDED] it is now possible to call
change_reward
directly from
an observation (no need to do it from the Observation Space) - [ADDED] method to change the reward from the observation (observation_space
is not needed anymore): you can useobs.change_reward
- [ADDED] a way to automatically set the
experimental_read_from_local_dir
flags
(with automatic class creation). For now it is disable by default, but you can
activate it transparently (see doc) - [ADDED] possibility to set the grid to an initial state (using an action) when using the
"time series" classes. The supported classes areGridStateFromFile
- and all its derivative,
FromOneEpisodeData
,FromMultiEpisodeData
,FromNPY
andFromHandlers
. The classesChangeNothing
andFromChronix2grid
are not supported at the moment. - [ADDED] an "Handler" (
JSONInitStateHandler
) that can set the grid to an initial state (so as to make
compatible theFromHandlers
time series class with this new feature) - [ADDED] some more type hints in the
GridObject
class - [ADDED] Possibility to deactive the support of shunts if subclassing
PandaPowerBackend
(and add some basic tests) - [ADDED] a parameters (
param.IGNORE_INITIAL_STATE_TIME_SERIE
) which defaults to
False
that tells the environment whether it should ignore the
initial state of the grid provided in the time series.
By default it is NOT ignored, it is taken into account
(for the environment that supports this feature)
Bug fixes
- [FIXED] a small issue that could lead to having
"redispatching_unit_commitment_availble" flag set even if the redispatching
data was not loaded correctly - [FIXED] EducPandaPowerBackend now properly sends numpy array in the class attributes
(instead of pandas series) - [FIXED] an issue when loading back data (with
EpisodeData
): when there were no storage units
on the grid it did not set properly the "storage relevant" class attributes - [FIXED] a bug in the "gridobj.generate_classes()" function which crashes when no
grid layout was set - [FIXED] notebook 5 on loading back data with
EpisodeData
. - [FIXED] converter between backends (could not handle more than 2 busbars)
- [FIXED] a bug in
BaseMultiProcessEnvironment
: set_filter had no impact - [FIXED] an issue in the
Runner
(self.chronics_handler
was sometimes used, sometimes not
and most of the time incorrectly) - [FIXED] on
RemoteEnv
class (impact all multi process environment): the kwargs used to build then backend
where not used which could lead to"wrong" backends being used in the sub processes. - [FIXED] a bug when the name of the times series and the names of the elements in the backend were
different: it was not possible to setnames_chronics_to_grid
correctly when callingenv.make
Improvments
- [IMPROVED] documentation about
obs.simulate
to make it clearer the
difference between env.step and obs.simulate on some cases - [IMPROVED] type hints on some methods of
GridObjects
- [IMPROVED] replace
np.nonzero(arr)
calls witharr.nonzero()
which could
save up a bit of computation time. - [IMPROVED] force class attributes to be numpy arrays of proper types when the
classes are initialized from the backend. - [IMPROVED] some (slight) speed improvments when comparing actions or deep copying objects
- [IMPROVED] the way the "grid2op compat" mode is handled
- [IMPROVED] the coverage of the tests in the "test_basic_env_ls.py" to test more in depth lightsim2grid
(creation of multiple environments, grid2op compatibility mode) - [IMPROVED] the function to test the backend interface in case when shunts are not supported
(improved testAAATestBackendAPI.test_01load_grid
)
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot 11 months ago
Grid2Op - Release v1.10.1
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/593
- [FIXED] backward compatibility issues with "oldest" lightsim2grid versions
(now tested in basic settings) - [ADDED] a "compact" way to store the data in the Runner
- [IMPROVED] the "
train_val_split
" functions, now more names (for the folders)
can be used
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot about 1 year ago
Grid2Op - Release v1.10.0
- [BREAKING] the order of the actions in
env.action_space.get_all_unitary_line_set
and
env.action_space.get_all_unitary_topologies_set
might have changed (this is caused
by a rewriting of these functions in case there is not 2 busbars per substation) - [FIXED] github CI did not upload the source files
- [FIXED]
l2rpn_utils
module did not stored correctly the order
of actions and observation for wcci_2020 - [FIXED] 2 bugs detected by static code analysis (thanks sonar cloud)
- [FIXED] a bug in
act.get_gen_modif
(vector of wrong size was used, could lead
to some crashes ifn_gen >= n_load
) - [FIXED] a bug in
act.as_dict
when shunts were modified - [FIXED] a bug affecting shunts: sometimes it was not possible to modify their p / q
values for certain values of p or q (an AmbiguousAction exception was raised wrongly) - [FIXED] a bug in the
_BackendAction
: the "last known topoolgy" was not properly computed
in some cases (especially at the time where a line was reconnected) - [FIXED]
MultiDiscreteActSpace
andDiscreteActSpace
could be the same classes
on some cases (typo in the code). - [FIXED] a bug in
MultiDiscreteActSpace
: the "do nothing" action could not be done ifone_sub_set
(orone_sub_change
)
was selected inattr_to_keep
- [ADDED] a method
gridobj.topo_vect_element()
that does the opposite ofgridobj.xxx_pos_topo_vect
- [ADDED] a mthod
gridobj.get_powerline_id(sub_id)
that gives the
id of all powerlines connected to a given substation - [ADDED] a convenience function
obs.get_back_to_ref_state(...)
for the observation and not only the action_space. - [IMPROVED] handling of "compatibility" grid2op version
(by calling the relevant things done in the base class
inBaseAction
andBaseObservation
) and by using thefrom packaging import version
to check version (instead of comparing strings) - [IMPROVED] slightly the code of
check_kirchoff
to make it slightly clearer - [IMRPOVED] typing and doc for some of the main classes of the
Action
module - [IMRPOVED] typing and doc for some of the main classes of the
Observation
module - [IMPROVED] methods
gridobj.get_lines_id
,gridobj.get_generators_id
,gridobj.get_loads_id
gridobj.get_storages_id
are now class methods and can be used withtype(env).get_lines_id(...)
oract.get_lines_id(...)
for example. - [IMPROVED]
obs.get_energy_graph()
by giving the "local_bus_id" and the "global_bus_id"
of the bus that represents each node of this graph. - [IMPROVED]
obs.get_elements_graph()
by giving access to the bus id (local, global and
id of the node) where each element is connected. - [IMPROVED] description of the different graph of the grid in the documentation.
- [IMPROVED] type hints for the
gym_compat
module (more work still required in this area) - [IMPROVED] the
MultiDiscreteActSpace
to have one "dimension" controling all powerlines
(see "one_line_set" and "one_line_change") - [IMPROVED] doc at different places, including the addition of the MDP implemented by grid2op.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot about 1 year ago
Grid2Op - Release v1.9.8
- [FIXED] the
backend.check_kirchoff
function was not correct when some elements were disconnected
(the wrong columns of the p_bus and q_bus was set in case of disconnected elements) - [FIXED]
PandapowerBackend
, when no slack was present - [FIXED] the "BaseBackendTest" class did not correctly detect divergence in most cases (which lead
to weird bugs in failing tests) - [FIXED] an issue with imageio having deprecated the
fps
kwargs (see https://github.com/rte-france/Grid2Op/issues/569) - [FIXED] adding the "
loads_charac.csv
" in the package data - [FIXED] a bug when using grid2op, not "utils.py" script could be used (see
https://github.com/rte-france/Grid2Op/issues/577). This was caused by the modification of
sys.path
when importing the grid2op test suite. - [ADDED] A type of environment that does not perform the "emulation of the protections"
for some part of the grid (MaskedEnvironment
) see https://github.com/rte-france/Grid2Op/issues/571 - [ADDED] a "gym like" API for reset allowing to set the seed and the time serie id directly when calling
env.reset(seed=.., options={"time serie id": ...})
- [IMPROVED] the CI speed: by not testing every possible numpy version but only most ancient and most recent
- [IMPROVED] Runner now test grid2op version 1.9.6 and 1.9.7
- [IMPROVED] refacto
gridobj_cls._clear_class_attribute
andgridobj_cls._clear_grid_dependant_class_attributes
- [IMPROVED] the bahviour of the generic class
MakeBackend
used for the test suite. - [IMPROVED] re introducing python 12 testing
- [IMPROVED] error messages in the automatic test suite (
AAATestBackendAPI
)
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 1 year ago
Grid2Op - Release v1.9.7
- [BREAKING] removal of the
grid2op/Exceptions/PowerflowExceptions.py
file and move the
DivergingPowerflow
as part of the BackendException. If you imported (to be avoided)
withfrom grid2op.Exceptions.PowerflowExceptions import PowerflowExceptions
simply dofrom grid2op.Exceptions import PowerflowExceptions
and nothing
will change. - [BREAKING] rename with filename starting with lowercase all the files in the "
Exceptions
",
module. This is both consistent with python practice but allows also to make the
difference between the files in the
module and the class imported. This should have little to no impact on all codes but to "upgrade"
instead offrom grid2op.Exceptions.XXX import PowerflowExceptions
(which you should not have done in the first place)
just dofrom grid2op.Exceptions import PowerflowExceptions
. Expect other changes like this for other grid2op modules
in the near future. - [BREAKING] change the
gridobj_cls.shape()
andgridobj_cls.dtype()
togridobj_cls.shapes()
andgridobj_cls.dtypes()
to be more clear when dealing with action_space and observation_space (whereshape
anddtype
are attribute and not functions)
This change means you can still useact.shape()
andact.dtype()
but thatact_space.shape
andact_space.dtype
are now
clearly properties (and NOT attribute). For the old functiongridobj_cls.dtype()
you can now usegridobj_cls.dtypes()
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/561 (indent issue)
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/550 : issue with
shunts_data_available
now better handled - [IMPROVED] the function to check the backend interface now also check that
thetopo_vect
returns value between 1 and 2. - [IMPROVED] the function to check backend now also check the
topo_vect
for each type of elements.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 1 year ago
Grid2Op - Release v1.9.6
- [BREAKING] when a storage is connected alone on a bus, even if it produces / absorbs 0.0 MW it
will raise a diverging powerflow error (previously the storage was automatically disconnected by
PandaPowerBackend
, but probably not by other backends) - [BREAKING] when a shunt is alone on a bus, the powerflow will diverge even in DC mode
(previously it only converges which was wrong behaviour: grid2op should not disconnect shunt) - [FIXED] a bug in PandaPowerBackend (DC mode) where isolated load did not raised
exception (they should lead to a divergence) - [FIXED] some wrong behaviour in the
remove_line_status_from_topo
when no observation where provided
andcheck_cooldown
isFalse
- [FIXED] a bug in PandaPowerBackend in AC powerflow: disconnected storage unit had no 0. as voltage
- [FIXED] a bug in PandaPowerBackend in AC powerflow when a generator was alone a bus it made the powerflow
crash on some cases (eg without lightsim2grid, without numba) - [FIXED] a bug in PandaPowerBackend in DC (in some cases non connected grid were not spotted)
- [FIXED] now the observations once reloaded have the correct
_is_done
flag (obs._is_done = False
)
which allows to use theobs.get_energy_graph()
for example. This fixes https://github.com/rte-france/Grid2Op/issues/538 - [ADDED] now depends on the
typing_extensions
package - [ADDED] a complete test suite to help people develop new backend using "Test Driven Programming"
techniques - [ADDED] the information on which time series data has been used by the environment in the
info
return value
ofenv.step(...)
- [ADDED] a test suite easy to set up to test the backend API (and only the backend for now, integration tests with
runner and environment will follow) - [ADDED] an attribute of the backend to specify which file extension can be processed by it. Environment creation will
fail if none are found. Seebackend.supported_grid_format
see https://github.com/rte-france/Grid2Op/issues/429 - [IMPROVED] now easier than ever to run the grid2op test suite with a new backend (for relevant tests)
- [IMPROVED] type hints for
Backend
andPandapowerBackend
- [IMPROVED] distribute python 3.12 wheel
- [IMPROVED] test for python 3.12 and numpy 1.26 when appropriate (eg when numpy version is released)
- [IMPROVED] handling of environments without shunts
- [IMPROVED] error messages when grid is not consistent
- [IMPROVED] add the default
l2rpn_case14_sandbox
environment in all part of the docs (substituingrte_case14_realistic
or nothing) - [IMPROVED] imports on the
Exceptions
module - [IMPROVED] pandapower backend raises
BackendError
when "diverging"
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 1 year ago
Grid2Op - Release v1.9.5
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/518
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/446
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/523 by having a "_BackendAction" folder instead of a file
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/522 and adding back certain notebooks to the CI
- [FIXED] an issue when disconnecting loads / generators on msot recent pandas version
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/527 : now do nothing action are detected in
act.as_serializable_dict()
AND weird do nothing action can be made through the action space
(env.action_space({"change_bus": {}})
is not ambiguous, though might not be super efficient...)
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 1 year ago
Grid2Op - Release v1.9.4
- [FIXED] read-the-docs template is not compatible with latest sphinx version (7.0.0)
see https://github.com/readthedocs/sphinx_rtd_theme/issues/1463 - [FIXED] issue https://github.com/rte-france/Grid2Op/issues/511
- [FIXED] issue https://github.com/rte-france/Grid2Op/issues/508
- [ADDED] some classes that can be used to reproduce exactly what happened in a previously run environment
seegrid2op.Chronics.FromOneEpisodeData
andgrid2op.Opponent.FromEpisodeDataOpponent
andgrid2op.Chronics.FromMultiEpisodeData
- [ADDED] An helper function to get the kwargs to disable the opponent (see
grid2op.Opponent.get_kwargs_no_opponent()
) - [IMPROVED] doc of
obs.to_dict
andobs.to_json
(see https://github.com/rte-france/Grid2Op/issues/509)
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 1 year ago
Grid2Op - Release v1.9.3
- [BREAKING] the "chronix2grid" dependency now points to chronix2grid and not to the right branch
this might cause an issue if you installgrid2op[chronix2grid]
for the short term - [BREAKING] force key-word arguments in
grid2op.make
except for the first one (env name), see
rte-france#503 - [FIXED] a bug preventing to use storage units in "sim2real" environment (when the
grid for forecast is not the same as the grid for the environment) - [ADDED] a CI to test package can be installed and loaded correctly on windows, macos and line_ex_to_sub_pos
for python 3.8, 3.9, 3.10 and 3.11 - [ADDED] possibility to change the "soft_overflow_threshold" in the parameters (like
the "hard_overflow_threshold" but for delayed protections).
Seeparam.SOFT_OVERFLOW_THRESHOLD
- [ADDED] the
gym_env.observation_space.get_index(attr_nm)
forBoxGymObsSpace
that allows to retrieve which index
of the observation represents which attribute.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 2 years ago
Grid2Op - Release v1.9.2
- [BREAKING] rename with filename starting with lowercase all the files in the "
Backend
", "Action
" and
"Environment
" modules. This is both consistent with python practice but allows also to make the
difference between the files in the
module and the class imported. This should have little to no impact on all codes but to "upgrade"
instead offrom grid2op.Action.BaseAction import BaseAction
(which you should not have done in the first place)
just dofrom grid2op.Action import BaseAction
. Expect other changes like this for other grid2op modules
in the near future. - [FIXED] broken environ "l2rpn_idf_2023" (with test=True) due to the presence of a
__pycache__
folder - [FIXED] time series
MultiFolder
will now ignore folder__pycache__
- [FIXED] an issue with compatibility with previous versions (due to alert)
- [FIXED] an issue with the
_ObsEnv
when using reward that could not be used in forecast (self.is_simulated_env()
was not working as expected due to a wrong init of the reward in_ObsEnv
) - [FIXED] an issue when disconnecting loads / generators / storage units and changing their values in the same
action: the behaviour could depend on the backend. As of 1.9.2 the "disconnections" have the priority (if
an action disconnect an element, it will not change its sepoint at the same time). - [FIXED] a bug in
AlertReward
due toreset
not being called. - [FIXED] issue https://github.com/rte-france/Grid2Op/issues/494
- [ADDED] the score function used for the L2RPN 2023 competition (Paris Area)
- [IMPROVED] overall performances by calling
arr.sum()
orarr.any()
instead ofnp.sum(arr)
or
np.any(arr)
see https://numpy.org/neps/nep-0018-array-function-protocol.html#performance - [IMPROVED] overall performance of
obs.simulate
function by improving speed of copy of_BackendAction
- [IMPROVED] overall performance of
env.step
/obs.simulate
by preventing unnecessary observation deep copy - [IMPROVED] overall performance of
env.step
/obs.simulate
by switching tocopy.deepcopy(obs)
instead of
obs.copy()
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 2 years ago
Grid2Op - Release v1.9.1
Still lots of changes for this release (that should have been part of grid2op 1.9.0)
And some functionalities are still missing (and will be added shortly in version 1.9.2)
Breaking changes
- default
gym_compat
module now inherit fromgymnasium
(if
gymnasium is installed) instead ofgym
. If you want legacy behaviour,
do not installgymnasium
. If you want compatibility with sota softwares usinggymnasium
,
install it and continue using grid2op transparently. See doc ofgym_compat
module for more
information. - remove the support of the "raise_alarm" kwargs in the DiscreteActSpace
- [BREAKING] remove support for python 3.7 that has reached end of life on 2023-06-27 on
pypi and on CI - to avoid misleading behaviour, by default the
BoxGymActSpace
no longer uses
the "discrete" attributes ("set_line_status", "change_line_status", "set_bus", "change_bus"). You can
still use them in the "attr_to_keep" kwargs if you want. - rename with filename starting with lowercase all the files in the "Reward" module. This is
both consistent with python practice but allows also to make the difference between the file in the
module and the class imported. This should have little to no impact on all codes but to "upgrade"
instead offrom grid2op.Reward.BaseReward import BaseReward
just do
from grid2op.Reward import BaseReward
.
Fixed issues
- an error when an environment with alarm was created before an environment
without alert. This lead to a crash when creating the second environment. This is now fixed. - an issue with non renewable generators in
GymActionSpace
(some curtailment was made
at 100% of their capacity instead of "no curtailment") - a bug in computing the datatype of
BoxGymActSpace
andBoxGymObsSpace
leading to
using "bool" as dtype when it should be int. - the behaviour of
BoxGymActSpace
whensubtract
/divide
were provided (the dtype was
not propagated correctly)
New features
- support for the "alert" feature (see main doc page) with new observation attributes
(obs.active_alert
,obs.time_since_last_alert
,obs.alert_duration
,obs.total_number_of_alert,
obs.time_since_last_attack
,obs.was_alert_used_after_attack
andobs.attack_under_alert
)
a new type of action:act.raise_alert
and a new reward classAlertReward
(among others) - the environment "l2rpn_idf_2023" (accessible via
grid2op.make("l2rpn_idf_2023", test=True)
) - the
RecoPowerlinePerArea
that is able to reconnect multiple lines in different area in
the same action - the kwargs "with_numba" in
PandaPowerBackend
to offer more control on whether or not you want
to use numba (default behaviour did not change: "if numba is availble, use it" but now you can disable it
if numba is available but you don't want it) - the method
act.decompose_as_unary_actions(...)
to automatically
decompose a "complex" action on its unary counterpart. - the env attribute
env._reward_to_obs
that allows to pass information to the observation directly
from the reward (this can only be used by regular environment and not byobs.simulate
nor byForecastEnv
) - the whole "alert" concept in grid2op with a grid2op environment supporting it (
l2rpn_idf_2023
) - the
gym_env.action_space.get_index(attr_nm)
forBoxGymActSpace
that allows to retrieve which index
of the action represents which attribute. - the argument
quiet_warnings
in the handlers to prevent the issue of too many warnings when using
ForecastHandler
Improvements
- the method
act.as_serializable_dict()
to work better when exporting / importing actions on different
grids (the output dictionary forset_bus
andchange_bus
now split the keys between all elements types
instead of relying on the "topo_vect" order (which might vary)) - consistency between how to perform action on storage units between "raw" grid2op,
GymActionSpace
,BoxGymActSpace
,DiscreteActSpace
andMultiDiscreteActSpace
(
used to be a mix ofset_storage
andstorage_power
now it's consistent and isset_storage
everywhere) - error message when the "stat.clear_all()" function has been called on a statistic and this same
statistic is reused. - possibility to set "other_rewards" in the config file of the env
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 2 years ago
Grid2Op - Version 1.9.0
Breaking changes
- (because prone to bug): force the environment name in the
grid2op.make
function. - 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. - the "maintenance_forecast" file is deprecated and is no longer used (this should not
not impact anything) - 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. - the function "obs.as_networkx" will be renamed "
obs.get_energy_graph
" and the
description has been adapted. - In
PandaPowerBackend
the kwargs argument "ligthsim2grid" was misspelled and is now properly
renamedlightsim2grid
- you can no longer use the
env.reactivate_forecast()
in the middle of an episode. - the method
runner.run_one_episode()
(that should not use !) now
returns also the total number of steps of the environment.
Fixed issues
-
a bug in
PandapowerBackend
when running in dc mode (voltages were not read correctly
from the generators) -
issue https://github.com/rte-france/Grid2Op/issues/389 which was caused by 2 independant things:
- the
PandapowerBackend
did not compute thetheta
correctly on powerline especially if
they are connected to a disconnected bus (in this case I chose to puttheta=0
) - the
obs.get_energy_graph
(previouslyobs.as_networkx()
) method did not check,
when updating nodes attributes if powerlines
were connected or not, which was wrong in some cases
- the
-
the
N1Reward
that was broken -
the
act._check_for_ambiguity
: a case where missing (when you used topology to disconnect a powerline,
but also set_bus to connect it) -
a bug when the storage unit names where not set in the backend and needed to be set
automatically (wrong names were used) -
a bug in
PandaPowerBackend
when usingBackendConverter
and one the backend do not support shunts. -
2 issues related to gym env: https://github.com/rte-france/Grid2Op/issues/407 and
https://github.com/rte-france/Grid2Op/issues/418 -
some bus in the
obs.get_energy_graph
(previouslyobs.as_networkx()
) for the cooldowns of substation -
a bug in
PandaPowerBackend
when it was copied (the kwargs used to build it were not propagated) -
a bug in the
Runner
when the time series class used is notMultiFolder
(egGridStateFromFile
): we could
not run twice the same environment. -
a bug n the
GridStateFromFile
,GridStateFromFileWithForecasts
and
GridStateFromFileWithForecastsWithoutMaintenance
classes that caused the maintenance file to be
ignored when "chunk_size" was set. -
a bug when shunts were alone in
backend.check_kirchoff()
-
an issue with "max_iter" in the runner when
MultifolderWithCache
(see issue https://github.com/rte-france/Grid2Op/issues/447) -
a bug in
MultifolderWithCache
when seeding was applied
New features
- 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. - an example on how to write a backend.
- 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) [seegridobject.global_bus_to_local
orgridobject.local_bus_to_global
] - a step by step (very detailed) example on how to build a Backend from an existing grid "solver".
- some test when the shunt bus are modified.
- a function to get the "elements graph" from the grid2op observation (represented as a networkx graph)
as well as its description on the documentation. - a method to retrieve the "elements graph" (see doc) fom an observation
obs.get_elements_graph()
- a whole new way to deal with input time series data (see the module
grid2op.Chronics.handlers
for more information) - possibility to change the parameters used for the
obs.simulate(...)
directly from the grid2op action, seeobs.change_forecast_parameters()
- possibility to retrieve a "forecast environment" with custom forecasts, see
obs.get_env_from_external_forecasts(...)
- now requires "importlib-metadata" package at install
- adding the
TimedOutEnvironment
that takes "do nothing" actions when the agent
takes too much time to compute. This involves quite some changes in the runner too. - Runner is now able to store if an action is legal or ambiguous
- experimental support to count the number of "high resolution simulator" (
obs.simulate
,
obs.get_simulator
andobs.get_forecast_env
) in the environment (see
https://github.com/rte-france/Grid2Op/issues/417). It might not work properly in distributed settings
(if the agents uses parrallel processing or if MultiProcessEnv is used), in MultiMixEnv, etc. - it now possible to check the some rules based on the definition of
areas on the grid.
Improvments
- possibility to "chain" the call to simulate when multiple forecast
horizon are available. - the
GridStateFromFileWithForecasts
is now able to read forecast from multiple steps
ahead (provided that it knows the horizons in its constructor) - documentation of the gym
DiscreteActSpace
: it is now explicit that the "do nothing" action
is by default encoded by0
- documentation of
BaseObservation
and its attributes PandapowerBackend
can now be loaded even if the underlying grid does not converge inAC
(but
it should still converge inDC
) see https://github.com/rte-france/Grid2Op/issues/391obs.get_energy_graph
(previouslyobs.as_networkx()
) method:
almost all powerlines attributes can now be read from the
resulting graph object.- possibility to set
data_feeding_kwargs
from the config file directly. - so "FutureWarnings" are silenced (depending on pandas and pandapower version)
- error messages when "env.reset()" has not been called and some functions are not available.
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 withset_line_status
is -1 or to removeset_bus
to -1 whenset_line_status
is 1
or to removechange_bus
whenset_line_status
is -1)- 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). - 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) - 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. 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.- the
obs.get_energy_graph
(previouslyobs.as_networkx()
) method with added attributes for edges (origin and extremity substation, as well as origin and
extremity buses) - the doc of the
obs.get_energy_graph
(previouslyobs.as_networkx()
) - it is now possible to use a different backend, a different grid or different kwargs between the
env backend and the obs backend. - the environment now called the "chronics_handler.forecast" function at most once per step.
- make it easier to create an environment without
MultiFolder
orMultifolderWithCache
- add the possibility to forward kwargs to chronix2grid function when calling
env.generate_data
- when calling
env.generate_data
an extra file (json) will be read to set default values
passed tochronix2grid.add_data
- it is no more reasonably possible to misuse the
MultifolderWithCache
(for example by
forgetting toreset()
the cache): an error will be raised in case the proper function has not been called. - possibility to pass game rules by instance of object and not by class.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 2 years ago
Grid2Op - Release v1.8.1
Fixed issues
- a deprecation with numpy>= 1.24 (eg
np.bool
andnp.str
), related to #393
Additions
- the baseAgent class now has two new template methods
save_state
andload_state
to save and
load the agent's state during Grid2op simulations. Examples can be found in L2RPN baselines (PandapowerOPFAgent and curriculumagent).
Improvments
- improved error messages in pandapower backend when the grid do not converge due to disconnected generators or loads.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 2 years ago
Grid2Op - Version 1.8.0
Breaking changes
- now requires numpy >= 1.20 to work (otherwise there are
issues with newer versions of pandas). - issue https://github.com/rte-france/Grid2Op/issues/379 requires
different behaviour depending on installed gym package. - cooldowns are not consistent between
env.step
andobs.simulate
.
Ifobs.time_before_cooldown_line[l_id] > 0
it will be illegal, at the next call toenv.step
(andobs.simulate
) to modify the status of this powerlinel_id
. Same for
obs.time_before_cooldown_sub[s_id] > 0
if trying to modify topology of
substations_id
. This also impacts the maintenances and hazards.
This is also linked to github issue https://github.com/rte-france/Grid2Op/issues/148
Fixed issues
- a bug when using a
Runner
with an environment that has
been copied (see https://github.com/rte-france/Grid2Op/issues/361) - issue https://github.com/rte-france/Grid2Op/issues/358
- issue https://github.com/rte-france/Grid2Op/issues/363
- issue https://github.com/rte-france/Grid2Op/issues/364
- issue https://github.com/rte-france/Grid2Op/issues/365 and
https://github.com/rte-france/Grid2Op/issues/376 . Now the function(s)
gridobj.process_shunt_data
andgridobj.process_grid2op_shunt_data
are called
gridobj.process_shunt_static_data
- issue https://github.com/rte-france/Grid2Op/issues/367
- issue https://github.com/rte-france/Grid2Op/issues/369
- issue https://github.com/rte-france/Grid2Op/issues/374
- issue https://github.com/rte-france/Grid2Op/issues/377 by adding a special
methodbackend.update_thermal_limit_from_vect
Addition
- the "
packaging
" python package is now required to install grid2op.
It allows to support differentgym
versions that changes behavior regarding
numpy pseudo random generator. - the function
act.remove_line_status_from_topo
to ignore the line status modification
that would be induced by "set_bus" or "change_bus" when some cooldown applies on the powerline.
Improvement
- clarify documentation of gym compat module (see
https://github.com/rte-france/Grid2Op/issues/372 and
https://github.com/rte-france/Grid2Op/issues/373) as well as the doc
for MultifolderWithCache (see https://github.com/rte-france/Grid2Op/issues/370)
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 2 years ago
Grid2Op - Release 1.7.2
[1.7.2] - 2022-07-05
- [FIXED] seeding issue https://github.com/rte-france/Grid2Op/issues/331
- [FIXED] clarify doc about fixed size matrices / graphs https://github.com/rte-france/Grid2Op/issues/330
- [FIXED] improved the behaviour of
obs._get_bus_id
andobs._aux_fun_get_bus
: when some objects were on busbar 2
they had a "wrong" bus id (it was lagged by 1) meaning an empty "bus" was introduced. - [FIXED] an issue with
obs.state_of(...)
when inspecting storage units
(see https://github.com/rte-france/Grid2Op/issues/340) - [FIXED] an issue with
act0 + act1
when curtailment was applied
(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. - [IMPROVED] support of "kwargs" backend arguments in
MultiMixEnv
see first
item of version 1.7.1 below
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 3 years ago
Grid2Op - Release 1.7.1
This release will most likely be the grid2op version used for the l2rpn 2022 competition at WCCI conference.
Breaking changes
- The possibility to propagate keyword arguments between the environment
and the runner implied adding some arguments in the constructor of
PandapowerBackend
. So if you made a class that inherit from it, you should
add these arguments in the constructor (otherwise you will not be able to use
the runner) [This should not impact lot of codes, if any]
Fixed issues
- a documentation issue https://github.com/rte-france/Grid2Op/issues/281
- a bug preventing to use the
FromChronix2grid
chronics class when
there is an opponent on the grid. - a documentation issue https://github.com/rte-france/Grid2Op/issues/319
on notebook 11 - some issues when the backend does not support shunts data (caused during the
computation of the size of the observation) Tests are now performed in
grid2op/tests/test_educpp_backend.py
- a bug when downloading an environment when the archive name is not the
same as the environment names (attempt to delete a non existing folder). This
is the case forl2rpn_wcci_2022
env. For this env, your are forced to use
grid2op version >= 1.7.1 - an issue when converting a "done" action as a graph, see
https://github.com/rte-france/Grid2Op/issues/327
New features
- score function for the L2RPN WCCI 2022 competition
Improvments
- adding the compatibility with logger in the reward functions.
- when there is a game over caused by redispatching, the observation is
not updated, as it is the case for other type of game over (improved consistency) - it is now possible to make an environment with a backend that
cannot be copied. - the arguments used to create a backend can be (if used properly)
re used (without copy !) when making aRunner
from an environment for example. - description and definition of
obs.curtailment_limit_effective
are now
consistent (issue https://github.com/rte-france/Grid2Op/issues/321)
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 3 years ago
Grid2Op - Release 1.7.0
This release introduces some new functionalities, such as the compatibility to generate data "on the fly" or add more data to an environment.
It also adds some useful features for the curtailment and storage units (some new attributes of the observation) and a first version of the environment used for l2rpn WCCI 2022 competition.
Python 3.6 support has been dropped.
Breaking changes
- the
L2RPNSandBoxScore
,RedispReward
andEconomicReward
now properly computes the cost of the grid
(there was an error between the conversion from MWh - cost is given in $ / MWh - and MW). This impacts alsoScoreICAPS2021
andScoreL2RPN2020
. - in the "gym_compat" module the curtailment action type has
for dimension the number of dispatchable generators (as opposed to all generators
before) this was mandatory to fix issue https://github.com/rte-france/Grid2Op/issues/282 - the size of the continuous action space for the redispatching in
case of gym compatibility has also been adjusted to be consistent with curtailment.
Before it has the size ofenv.n_gen
nownp.sum(env.gen_redispatchable)
. - move the
_ObsEnv
module toEnvironment
(was before inObservation
). - adding the
curtailment_limit_effective
in the observation converted to gym. This changes
the sizes of the gym observation. - officially drop python 3.6 supports (which could not benefit from all the features)
Fixed issues
- a bug preventing to use
backend.update_from_obs
when there are shunts on the grid forPandapowerBackend
- a bug in the gym action space: see issue https://github.com/rte-france/Grid2Op/issues/281
- a bug in the gym box action space: see issue https://github.com/rte-france/Grid2Op/issues/283
- a bug when using
MultifolderWithCache
andRunner
(see issue https://github.com/rte-france/Grid2Op/issues/285) - a bug in the
env.train_val_split_random
where sometimes some wrong chronics
name were sampled. - the
max
value of the observation space is now 1.3 * pmax to account for the slack bus (it was
1.01 of pmax before and was not sufficient in some cases) - a proper exception is added to the "except" kwargs of the "info" return argument of
env.step(...)
(previously it was only a string) when redispatching was illegal. - a bug in
env.train_val_split_random
when some non chronics files where present in the
"chronics" folder of the environment. - an error in the redispatching: in some cases, the environment detected that the redispatching was infeasible when it
was not and in some others it did not detect when it while it was infeasible. This was mainly the case
when curtailment and storage units were heavily modified. - now possible to create an environment with the
FromNPY
chronixcs even if the "chronics" folder is absent. - a bug preventing to converte observation as networkx graph with oldest version of numpy and newest version of scipy.
- a bug when using
max_iter
andRunner
in case of max_iter being larger than the number of steps in the
environment andnb_episode
>= 2. - a bug in the hashing of environment in case of storage units (the characteristics of the storage units
were not taken into account in the hash). - a bug in the
obs.as_dict()
method. - a bug in when using the "env.generate_classe()" https://github.com/rte-france/Grid2Op/issues/310
- another bug in when using the "env.generate_classe()" on windows https://github.com/rte-france/Grid2Op/issues/311
New features
- a function
normalize_attr
allowing to easily scale some data for the
BoxGymObsSpace
andBoxGymActSpace
- support for distributed slack in pandapower (if supported)
- an attribute
self.infos
for the BaseEnv that contains the "info" return value ofenv.step(...)
- the possibility to shuffle the chronics of a
GymEnv
(the default behavior is now to shuffle them) - two attribtues for the observation:
obs.gen_margin_up
andobs.gen_margin_down
- support for hashing chronix2grid related components.
- possibility to change the type of the opponent space type from the
make(...)
command - a method to "limit the curtailment / storage" action depending on the availability of controllable generators
(seeact.limit_curtail_storage(...)
) - a class to generate data "on the fly" using chronix2grid (for now really slow and only available for
a single environment) - a first version (for testing only) for the
l2rpn_wcci_2022
environment. - a method to compute the "simple" line reconnection actions (adding 2 actions per lines instead of 5)
in the action space (seeact_space.get_all_unitary_line_set_simple()
)
Improvements
- better difference between
env_path
andgrid_path
in environments. - addition of a flag to control whether pandapower can use lightsim2grid (to solve the powerflows) or not
- clean the warnings issued by pandas when used with pandapower
- doc of observation module (some attributes were missing)
- add support for setting the maximum number of iteration in the
PandaPowerBackend
- when the curtailment / storage is too "strong" at a given step, the environment will now allow
every controllable turned-on generators to mitigate it. This should increase the possibility to act on the
curtailment and storage units without "breaking" the environment. - have dedicated type of actions / observation for L2RPN competition environments,
defined in the "conf.py" file (to make possible the use of different
grid2op version transparently) - on some cases, the routine used to compute the redispatching would lead to a "redispatch" that would
change even if you don't apply any, for no obvious reasons. This has been addressed, though it's not perfect. - finer resolution when measuring execution times
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot about 3 years ago
Grid2Op - Release 1.6.5
This release focuses on grid2op improvment, especially adressing some enhancement of the github issues.
Breaking changes
- the function "env.reset()" now reset the underlying pseudo random number generators
of all the environment subclasses (eg. observation space, action space, etc.) This change has been made to
ensure reproducibility between episodes: ifenv.seed(...)
is called once, then regardless of what happens
(basically the number of "env.step()" between calls to "env.reset()")
the "env.reset()" will be generated with the same prng (drawn from the environment)
This effect the opponent and the chronics (when maintenance are generated "on the fly"). - the name of the python files for the "Chronics" module are now lowercase (complient with PEP). If you
did things likefrom grid2op.Chronics.ChangeNothing import ChangeNothing
you need to change it like
from grid2op.Chronics.changeNothing import ChangeNothing
or even better, and this is the preferred way to include
them:from grid2op.Chronics import ChangeNothing
. It should not affect lots of code (more refactoring of the kind
are to be expected in following versions). - same as above for the "Observation" module. It should not affect lots of code (more refactoring of the kind
are to be expected in following versions).
Fixed issues
- a bug for the EpisodeData that did not save the first observation when
"add_detailed_output" was set toTrue
and the data were not saved on disk. - an issue when copying the environment with the opponent (see issue https://github.com/rte-france/Grid2Op/issues/274)
- a bug leading to the wrong "backend.get_action_to_set()" when there were storage units on the grid.
- a bug in the "BackendConverter" when there are storage on the grid
- issue https://github.com/rte-france/Grid2Op/issues/265
- issue https://github.com/rte-france/Grid2Op/issues/261
New features
- possibility to "env.set_id" by giving only the folder of the chronics and not the whole path.
- function "env.chronics_handler.available_chronics()" to return the list of available chronics
for a given environment - possibility, through the
Parameters
class, to limit the number of possible calls toobs.simulate(...)
seeparam.MAX_SIMULATE_PER_STEP
andparam.MAX_SIMULATE_PER_EPISODE
(see issue https://github.com/rte-france/Grid2Op/issues/273) - a class to generate a "Chronics" readable by grid2op from numpy arrays (see https://github.com/rte-france/Grid2Op/issues/271)
- an attribute
delta_time
in the observation that tells the time (in minutes) between two consecutive steps. - a method of the action space to show a list of actions to get back to the original topology
(see https://github.com/rte-france/Grid2Op/issues/275)
env.action_space.get_back_to_ref_state(obs)
- a method of the action to store it in a grid2op independant fashion (using json and dictionaries), see
act.as_serializable_dict()
- possibility to generate a gym
DiscreteActSpace
from a given list of actions (see https://github.com/rte-france/Grid2Op/issues/277) - a class that output a noisy observation to the agent (see
NoisyObservation
): the agent sees
the real values of the environment with some noise, this could used to model inacurate
sensors.
Improvements
- observation now raises
Grid2OpException
instead ofRuntimeError
- docs (and notebooks) for the "split_train_val" https://github.com/rte-france/Grid2Op/issues/269
- the "split_train_val" function to also generate a test dataset see https://github.com/rte-france/Grid2Op/issues/276
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 3 years ago
Grid2Op - Release 1.6.4
Some quality of life features and minor speed improvments
Breaking changes
- the name of the python file for the "agent" module are now lowercase (complient with PEP). If you
did things likefrom grid2op.Agent.BaseAgent import BaseAgent
you need to change it like
from grid2op.Agent.baseAgent import BaseAgent
or even better, and this is the preferred way to include
them:from grid2op.Agent import BaseAgent
It should not affect lots of code.
Fixed issues
- a bug where the shunt had a voltage when disconnected using pandapower backend
- a bug preventing to print the action space if some "part" of it had no size (empty action space)
- a bug preventing to copy an action properly (especially for the alarm)
- a bug that did not "close" the backend of the observation space when the environment was
closed
. This
might be related to #255
New features
- serialization of
current_iter
andmax_iter
in the observation. - the possibility to use the runner only on certain episode id
(seerunner.run(..., episode_id=[xxx, yyy, ...])
) - a function that returns if an action has any change to modify the grid see
act.can_affect_something()
- a ttype of agent that performs predefined actions from a given list
- basic support for logging in environment and runner (more coming soon)
- possibility to make an environment with an implementation of a reward, instead of relying on a reward class.
- a possible implementation of a N-1 reward
Improvements
- right time stamp is now set in the observation after the game over.
- correct current number of steps when the observation is set to a game over state.
- documentation to clearly state that the action_class should not be modified.
- possibility to tell which chronics to use with the result of
env.chronics_handler.get_id()
(this is also
compatible in the runner) - it is no more possible to call "env.reset()" or "env.step()" after an environment has been closed: a clean error
is raised in this case.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 3 years ago
Grid2Op - Version 1.6.3
This version focuses on performances when using env.copy
and fixes some bugs in obs.simulate
- [FIXED] a bug that allowed to use wrongly the function
backend.get_action_to_set()
even when the backend
has diverged (which should not be possible) - [FIXED] a bug leading to non correct consideration of the status of powerlines right after the activation
of some protections (see issue #245 ) - [IMPROVED] the PandaPowerBackend is now able to load a grid with a distributed slack bus. When loaded though, the
said grid will be converted to one with a single slack bus (the first slack among the distributed) - [IMPROVED] massive speed-ups when copying environment or using
obs.simulate
(sometimes higher than 30x speed up) - [IMPROVED] experimental compatibility with different frameworks thanks to the possibility to serialize, as text
files the class created "on the fly" (should solve most of the "pickle" error). Seeenv.generate_classes()
for an example usage. Every feedback is appreciated.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 3 years ago
Grid2Op - Version 1.6.2 (hotfx)
A bug was present since version 1.6.0 that prevented, in some specific cases to use "obs.simulate" if the "alarm" / "attention budget" where used.
This hotfix (that will not be ported back to previous grid2op version) fix that issue.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 3 years ago
Grid2Op - Version 1.6.2
Adding the complete support for pickling grid2op classes. This is a major feature that allows to use grid2op
way more easily with multiprocessing and to ensure compatibility with more recent version of some RL package
(eg ray / rllib). Note that full compatibility with "multiprocessing" and "pickle" is not completely done yet.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 3 years ago
Grid2Op - Release 1.6.1
This will be the grid2op version used to rank the submission of the ICAPS 2021 competition.
Fixed issues
- a bug in the "env.get_path_env()" in case
env
was a multimix (it returned the path of the current mix
instead of the path of the multimix environment) - a bug in the
backend.get_action_to_set()
andbackend.update_from_obs()
in case of disconnected shunt
with backend that supported shunts (values forp
andq
were set even if the shunt was disconnected, which
could lead to undefined behaviour)
Improvements
- now grid2op is able to check if an environment needs to be updated when calling
grid2op.update_env()
thanks to the use of registered hash values. - now grid2op will check if an update is available when an environment is being downloaded for the
first time.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 4 years ago
Grid2Op - Release v1.6.0 (hotfix)
Fix the issue #235
This can be installed with:
pip install -U grid2op
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 4 years ago
Grid2Op - Version 1.6.0
EDIT a bug (#235 ) has slipped through our tests and is present in this release. This will be update as soon as possible
Minor breaking changes
- (but transparent for everyone): the
disc_lines
attribute is now part of the environment, and is also
containing integer (representing the "order" on which the lines are disconnected due to protections) rather
than just boolean. - now the observation stores the information related to shunts by default. This means old logs computed with
the runner might not work with this new version. - the "Runner.py" file has been renamed, following pep convention "runner.py". You should rename your
importfrom grid2op.Runner.Runner import Runner
tofrom grid2op.Runner.runner import Runner
(NB we higly recommend importing theRunner
likefrom grid2op.Runner import Runner
though !)
Fixed issues
- the L2RPN_2020 score has been updated to reflect the score used during these competitions (there was an
error betweenDoNothingAgent
andRecoPowerlineAgent
)
[see #228] - some bugs in the
action_space.get_all_unitary_redispatch
andaction_space.get_all_unitary_curtail
- some bugs in the
GreedyAgent
andTopologyGreedy
- #220
flow_bus_matrix
did not took into
account disconnected powerlines, leading to impossibility to compute this matrix in some cases. - #223 : now able to plot a grid even
if there is nothing controllable in grid2op present in it. - an issue where the parameters would not be completely saved when saved in json format (alarm feature was
absent) (related to #224 ) - an error caused by the observation non being copied when a game over occurred that caused some issue in
some cases (related to #226 ) - a bug in the opponent space where the "
previous_fail
" kwargs was not updated properly and send wrongly
to the opponent - a bug in the geometric opponent when it did attack that failed.
- #229 typo in the
AlarmReward
class when reset.
Addition
- retrieval of the
max_step
(ie the maximum number of step that can be performed for the current episode)
in the observation - some handy argument in the
action_space.get_all_unitary_redispatch
and
action_space.get_all_unitary_curtail
(see doc) - as utils function to compute the score used for the ICAPS 2021 competition (see
from grid2op.utils import ScoreICAPS2021
and the associate documentation for more information) - a first version of the "l2rpn_icaps_2021" environment (accessible with
grid2op.make("l2rpn_icaps_2021", test=True)
)
Improvements
- prevent the use of the same instance of a backend in different environments
- #217 : no more errors when trying to
load a grid with unsupported elements (eg. 3w trafos or static generators) by PandaPowerBackend - #215 : warnings are issued when elements
present in pandapower grid will not be modified grid2op side. - #214 : adding the shunt information
in the observation documentation. - documentation to use the
env.change_paramters
function.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 4 years ago
Grid2Op - Release version 1.5.2
Minor breaking changes
- Allow the opponent to chose the duration of its attack. This breaks the previous "Opponent.attack(...)"
signature by adding an object in the return value. All code provided with grid2op are compatible with this
new change. (for previously coded opponent, the only thing you have to do to make it compliant with
the new interface is, in theopponent.attack(...)
function returnwhatever_you_returned_before, None
instead
of simplywhatever_you_returned_before
Fixed issues
- #196 an issue related to the
low / high of the observation if using the gym_compat module. Some more protections
are enforced now. - #196 an issue related the scaling when negative
numbers are used (in these cases low / max would be mixed up) - an issue with the
IncreasingFlatReward
reward types - a bug due to the conversion of int to float in the range of the
BoxActionSpace
for thegym_compat
module - a bug in the
BoxGymActSpace
,BoxGymObsSpace
,MultiDiscreteActSpace
andDiscreteActSpace
where the order of the attribute for the conversion
was encoded in a set. We enforced a sorted list now. We did not manage to find a bug caused by this issue, but
it is definitely possible. This has been fixed now. - a bug where, when an observation was set to a "game over" state, some of its attributes were below the
maximum values allowed in theBoxGymObsSpace
Addition
- A reward
EpisodeDurationReward
that is always 0 unless at the end of an episode where it returns a float
proportional to the number of step made from the beginning of the environment. - in the
Observation
the possibility to retrieve the current number of steps - easier function to manipulate the max number of iteration we want to perform directly from the environment
- function to retrieve the maximum duration of the current episode.
- a new kind of opponent that is able to attack at "more random" times with "more random" duration.
See theGeometricOpponent
.
Improvements
- on windows at least, grid2op does not work with gym < 0.17.2 Checks are performed in order to make sure
the installed open ai gym package meets this requirement (see issue
Issue#185 <https://github.com/rte-france/Grid2Op/issues/185>
_ ) - the seed of openAI gym for composed action space (see issue
https://github.com/openai/gym/issues/2166
):
in waiting for an official fix, grid2op will use the solution proposed there
https://github.com/openai/gym/issues/2166#issuecomment-803984619 )
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot almost 4 years ago
Grid2Op - Release v1.5.1 (hotfix)
A file had been named "platform.py" in grid2op, which could lead to some bug during the import of the package (see https://stackoverflow.com/questions/22438609/attributeerror-module-object-has-no-attribute-python-implementation-running or https://www.programmersought.com/article/52577306429/)
This file has been renamed to avoid this issue. This is the only fix provided.
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot about 4 years ago
Grid2Op - Release version 1.5.1
Fixed issues
- Issue #187: improve the computation and the
documentation of theRedispReward
. This has an impact on theenv.reward_range
of all environments using this
reward, because the old "reward_max" was not correct. - Issue #181 : now environment can be created with
a layout and a warning is issued in this case. - Issue #180 : it is now possible to set the thermal
limit with a dictionary - a typo that would cause the attack to be discarded in the runner in some cases (cases for now not used)
- an issue linked to the transformation into gym box space for some environments,
this might be linked to Issue #185
Addition
- A feature to retrieve the voltage angle (theta) in the backend (
backend.get_theta
) and in the observation. - Support for multimix in the GymEnv (lack of support spotted thanks to Issue #185
- Basic documentation of the environment available.
- Issue #166 : support for simulate in multi environment settings.
Improvements
- Extra layer of security preventing modification of
observation_space
andaction_space
of environment - Better handling of dynamically generated classes
- The documentation of the opponent
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot about 4 years ago
Grid2Op - Release version 1.5.0
Changelog
Breaking changes
backend.check_kirchoff()
method now returns also the discrepancy in the voltage magnitude and not only the error in the P and Q injected at each bus.- the class method "to_dict" used to serialize the action_space and observation_space has been renamed cls_to_dict to avoid confusion with the to_dict method of action and observation (that stores, as dictionary the instance of the action / observation). It is now then possible to serialize the action class used and the observation class used as dictionary to (using action.cls_to_dict)
- for backend class implementation: need to upgrade your code to take into account the storage units if some are present in the grid even if you don't want to use storage units.
- the backend runpf method now returns a flag indicating if the simulation was successful AND (new) the exception in case there are some (it now returns a tuple). This change only affect new Backends.
- rename the attribute "parameters" of the "observation_space" to _simulate_parameters to avoid confusion with the parameters attributes of the environment.
- change of behaviour of the env.parameters attribute behaviour. It is no more possible to modified it with env.parameters = ... and the env.parameters.PARAM_ATTRIBUTE = xxx will have not effect at all. Use env.change_parameters(new_parameters) for changing the environment parameters and env.change_forecast_parameters(new_param_for_simulate) for changing the parameters used for simulate. (NB in both case you need to perform a "env.reset()" for the new parameters to be used. Any attempt to use an environment without a call to 'env.reset()' will lead to undefined behaviour).
- env.obs_space.rewardClass is not private and is called env.obs_space._reward_func. To change this function, you need to call env.change_reward(...)
- more consistency in the observation attribute names, they are now gen_p, gen_q and gen_v instead of prod_p, prod_q and prod_v (old names are still accessible for backward compatibility in the observation space) but conversion to json / dict will be affected as well as the converters (eg for gym compatibility)
Fixed issues
- Issue #164: reward is now properly computed at the end of an episode.
- A bug where after running a Runner, the corresponding EpisodeData's CollectionWrapper where not properly updated, and did not contain any objects.
- A bug when the opponent should chose an attack with all lines having flow 0, but one being still connected.
- An error in the obs.flow_bus_matrix when active_flow=False and there were shunts on the powergrid.
- obs.connectivity_matrix now properly takes into account when two objects are disconnected (before it was as if there were connected together)
- some surprising behaviour when using obs.simulate just before or just after a planned maintenance operation.
- a minimal bug in the env.copy method (the wrong simulated backend was used in the observation at right after the copy).
- a bug in the serialization (as vector) of some action classes, namely: PowerlineSetAction and PowerlineSetAndDispatchAction and PowerlineChangeDispatchAndStorageAction
- a bug preventing to use the obs.XXX_matrix() function twice
- issue Issue #172 : wrong assertion was made preventing the use of env.train_val_split_random()
- issue Issue #173 : a full nan vector could be converted to action or observation without any issue if it had the proper dimension. This was due to a conversion to integer from float.
- an issue preventing to load the grid2op.utils submodule when installed not in "develop" mode
- some issue with the multiprocessing of the runner on windows
New features
- more complete documentation for the runner.
- a convenient function to evaluate the impact (especially on topology) of an action on a state (obs + act)
- a property to retrieve the thermal limits from the observation.
- documentation of the main elements of the grid and their "modeling" in grid2op.
- parameters are now checked and refused if not valid (a RuntimeError is raised)
- support for storage unit in grid2op (analog as a "load" convention positive: power absorbed from the grid, negative: power given to the grid having some energy limit and power limit). A new object if added in the substation.
- Support for sparse matrices in obs.bus_connectivity_matrix
- In the observation, it is now possible to retrieve the "active flow graph" (ie graph with edges having active flows, and nodes the active production / consumption) and "reactive flow graph" (see flow_bus_matrix)
- more consistent behaviour when using the action space across the different type of actions. Now it should understand much more way to interact with it.
- lots of action properties to manipulate action in a more pythonic way, for example using act.load_set_bus = ... instead of the previously way more verbose act.update({"set_bus": {"loads_id": ...}} (this applies for load, gen, storage, line_or and line_ex and to set_bus and change_bus and also to storage_p and redispatch so making 12 "properties" in total)
- an option to retrieve in memory the EpisodeData of each episode computed when using the runner. see runner.run(..., add_detailed_output=True)
- the option as_csr_matrix in obs.connectivity_matrix function
- convenient option to get the topology of a substation from an observation (obs.sub_topology(sub_id=...))
- some basic tests for the environments shipped with grid2op.
- grid2op now ships with the l2rpn_case14_sandbox environment
- a function to list environments available for testing / illustration purpose.
- a function of the observation to convert it to a networkx graph (obs.as_networkx())
- support for curtailment feature in grid2op (curtailment on the renewable generator units).
- better backward compatibility when reading data generated with previous grid2op version.
Improvements
- simplify the interface for the gym converter.
- simplify the interface for the env.train_val_split and env.train_val_split_random
- print of an action now limits the number of decimal for redispatching and storage units
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot about 4 years ago
Grid2Op - Version 1.4.0
Energy Systems - Grid Analysis and Planning
- Python
Published by BDonnot over 4 years ago