Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 157 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ executors:
- image: cimg/python:3.13

jobs:
test:
test_generic:
executor: grid2op-executor
resource_class: medium+
parallelism: 4
Expand Down Expand Up @@ -70,6 +70,155 @@ jobs:
# - store_artifacts:
# path: "/Grid2Op/grid2op/tests/test_Action.py"
# destination: coverage_artifacts/
test_agent:
executor: grid2op-executor
resource_class: small
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y coinor-cbc
- run: python -m pip install virtualenv
- run: python -m virtualenv venv_test
- run:
command: |
source venv_test/bin/activate
pip install -U pip setuptools wheel
- run:
command: |
source venv_test/bin/activate
pip install -e .[test]
pip freeze
- run:
command: |
source venv_test/bin/activate
export _GRID2OP_FORCE_TEST=1
cd grid2op/tests/
python -m unittest -v test_Agent test_AgentsFast test_recopowerlineperarea

test_converter:
executor: grid2op-executor
resource_class: small
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y coinor-cbc
- run: python -m pip install virtualenv
- run: python -m virtualenv venv_test
- run:
command: |
source venv_test/bin/activate
pip install -U pip setuptools wheel
- run:
command: |
source venv_test/bin/activate
pip install -e .[test]
pip freeze
- run:
command: |
source venv_test/bin/activate
export _GRID2OP_FORCE_TEST=1
cd grid2op/tests/
python -m unittest -v test_AgentConverter test_Converter test_BackendConverter

test_runner_epdata_score:
executor: grid2op-executor
resource_class: small
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y coinor-cbc
- run: python -m pip install virtualenv
- run: python -m virtualenv venv_test
- run:
command: |
source venv_test/bin/activate
pip install -U pip setuptools wheel
- run:
command: |
source venv_test/bin/activate
pip install -e .[test]
pip freeze
- run:
command: |
source venv_test/bin/activate
export _GRID2OP_FORCE_TEST=1
cd grid2op/tests/
python -m unittest -v test_EpisodeData test_runner_kwargs_backend test_Runner test_RunnerFast test_score_idf_2023_assistant test_score_idf_2023_nres test_score_idf_2023 test_score_wcci_2022 test_AlarmScore test_RewardAlertCostScore test_RewardNewRenewableSourcesUsageScore test_utils test_CompactEpisodeData test_reset_options_runner

test_env_general:
executor: grid2op-executor
resource_class: small
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y coinor-cbc
- run: python -m pip install virtualenv
- run: python -m virtualenv venv_test
- run:
command: |
source venv_test/bin/activate
pip install -U pip setuptools wheel
- run:
command: |
source venv_test/bin/activate
pip install -e .[test]
pip freeze
- run:
command: |
source venv_test/bin/activate
export _GRID2OP_FORCE_TEST=1
cd grid2op/tests/
python -m unittest -v test_attached_envs test_attached_envs_compat test_l2rpn_idf_2023 test_MultiMix test_timeOutEnvironment test_MaskedEnvironment test_MakeEnv test_multi_steps_env test_simenv_blackout

test_alert_alarm:
executor: grid2op-executor
resource_class: small
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y coinor-cbc
- run: python -m pip install virtualenv
- run: python -m virtualenv venv_test
- run:
command: |
source venv_test/bin/activate
pip install -U pip setuptools wheel
- run:
command: |
source venv_test/bin/activate
pip install -e .[test]
pip freeze
- run:
command: |
source venv_test/bin/activate
export _GRID2OP_FORCE_TEST=1
cd grid2op/tests/
python -m unittest -v test_AlarmFeature test_alert_gym_compat test_alert_obs_act test_alert_trust_score test_AlertReward

test_issue:
executor: grid2op-executor
resource_class: small
steps:
- checkout
- run: apt-get update -y
- run: apt-get install -y coinor-cbc
- run: python -m pip install virtualenv
- run: python -m virtualenv venv_test
- run:
command: |
source venv_test/bin/activate
pip install -U pip setuptools wheel
- run:
command: |
source venv_test/bin/activate
pip install -e .[test]
pip freeze
- run:
command: |
source venv_test/bin/activate
export _GRID2OP_FORCE_TEST=1
cd grid2op/tests/
python -m unittest -v test_issue_*

gen_coverage:
executor: grid2op-executor
Expand Down Expand Up @@ -446,7 +595,13 @@ workflows:
version: 2.1
test:
jobs:
- test
- test_generic
- test_agent
- test_converter
- test_runner_epdata_score
- test_env_general
- test_alert_alarm
- test_issue
- legacy_lightsim_old_pp
- legacy_lightsim
- test_chronix2grid
Expand Down
20 changes: 18 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ Native multi agents support:
- add detachment
- add change_bus / set_bus

[1.12.3] - 2026-02-04
-----------------------
- [FIXED] the warnings when building the documentation.
- [FIXED] the deprecation warnings when importing grid2op
with recent python versions (due to presence of math equation
in some docstring)
- [FIXED] issues when loading a grid with disconnected elements: grid2op
did not know on which bus to reconnect them when only the "reconnect" bus was given.
- [FIXED] an issue leading to wrong setpoint values for shunt_p and shunt_q in the previous
stored state (EnvPreviousState)
- [FIXED] a wrong type hints in `_aux_check_finite_float` of Backend (in Backend.py)
- [ADDED] a test (in the AAA test) to assess that the backend._sh_vnkv is properly set if the shunts are
handled by the backend.
- [IMPROVED] code for AAA backend tests (avoid equality check for float)
- [IMPROVED] doc when loading grid with disconnected elements

[1.12.2] - 2025-11-18
----------------------
- [FIXED] an issue preventing to change the way
Expand Down Expand Up @@ -1169,8 +1185,8 @@ Native multi agents support:
- [ADDED]: a new kind of opponent that is able to attack at "more random" times with "more random" duration.
See the `GeometricOpponent`.
- [IMPROVED]: 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/Grid2Op/grid2op/issues/185>`_ )
the installed open ai gym package meets this requirement
(see issue `Issue#185 <https://github.com/Grid2Op/grid2op/issues/185>`_ )
- [IMPROVED] 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
Expand Down
7 changes: 4 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Benjamin Donnot'

# The full version, including alpha/beta/rc tags
release = '1.12.2'
release = '1.12.3'
version = '1.12'


Expand All @@ -35,14 +35,15 @@
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.coverage',
'sphinx.ext.imgmath',
'sphinx.ext.imgmath', # for math in documentation
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
# 'builder',
'sphinx.ext.extlinks',
'sphinx.ext.napoleon',
'sphinxcontrib_trio',
"sphinx_rtd_theme",
"sphinx_rtd_theme",
# 'sphinx.ext.mathjax',
# toc of modules
'autodocsumm',
# 'sphinx.ext.autosectionlabel',
Expand Down
8 changes: 0 additions & 8 deletions docs/developer.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/grid2op_dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
:maxdepth: 1

grid2op_dev/action
grid2op_dev/observation

.. include:: final.rst
9 changes: 9 additions & 0 deletions docs/grid2op_extend.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. toctree::
:maxdepth: 1

grid2op_extend/env_content
grid2op_extend/create_an_environment
grid2op_extend/createbackend
grid2op_extend/observation

.. include:: final.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ Objectives
You will also find in this file the complete description on how the "powergrid" is represented in grid2op.

Backend is an abstraction that represents the physical system (the powergrid). In theory every powerflow can be
used as a backend. And example of a backend using `Pandapower <http://www.pandapower.org/>`_ is available with
the :class:`grid2op.Backend.EducPandaPowerBackend.EducPandaPowerBackend` (only for demonstration purpose)
used as a backend. And example of a backend using `Pandapower <http://www.pandapower.org/>`__ is available with
the :class:`grid2op.Backend.educPandaPowerBackend.EducPandaPowerBackend` (only for demonstration purpose)

If you want working backend, please use the :class:`grid2op.Backend.PandaPowerBackend` that
uses `Pandapower <http://www.pandapower.org/>`_ and
a port in c++ to a subset of pandapower called `LightSim2Grid <https://github.com/BDonnot/lightsim2grid>`_ .
uses `Pandapower <http://www.pandapower.org/>`__ and
a port in c++ to a subset of pandapower called `LightSim2Grid <https://github.com/BDonnot/lightsim2grid>`__ .


To implement completely a backend, you should implement all the abstract function defined here :ref:`backend-module`.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ but if you want to slightly modify one of its component.
:maxdepth: 1
:caption: Technical documentation for grid2op "external" contributions

developer
grid2op_extend


Technical documentation for grid2op developers
Expand Down
3 changes: 2 additions & 1 deletion docs/special.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.. Color profiles for Sphinx.
.. Has to be used with hacks.css
.. (https://bitbucket.org/lbesson/web-sphinx/src/master/.static/hacks.css)

.. role:: black
.. role:: gray
.. role:: grey
Expand Down Expand Up @@ -38,4 +39,4 @@
.. role:: center
.. role:: left
.. role:: right
.. (c) Lilian Besson, 2011-2016, https://bitbucket.org/lbesson/web-sphinx/
.. (c) Lilian Besson, 2011-2016, https://bitbucket.org/lbesson/web-sphinx/
11 changes: 11 additions & 0 deletions docs/user/action.rst
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,17 @@ action original status final status

\* means that this bus is affected: if it was on bus 1 it moves on bus 2 and vice versa.

.. danger::
In the general case, the "last state" (denoted `PREVIOUS_OR` or `PREVIOUS_EX`) is known. But it is not always the case.

It can happen that the original grid file (the one loaded by grid2op backend to create the environment) has
disconnected elements.

In this case, it is NOT possible to reconnect said elements without provided explicitely the buses at both sides. Any
attempt to do so will lead to a "illegal" action and will be replaced by "do nohting" in env.step (thus discarding all other
"parts" of the action).


Note on random actions
------------------------
Sampling a "non ambiguous" legal action is a difficult task.
Expand Down
31 changes: 16 additions & 15 deletions docs/user/opponent.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ First, a grid is said to be "in security" if no threshold are violate for any eq
In the context of grid2op, this most often means that all powerlines have a flow under a certain
threshold (refer to as "thermal limit" in grid2op).

``̀`
A grid is N-1 safe, if, for any "contingency" (*eg* the disconnection a powerline) from
a given list (in general this list is "all the lines / transformers on the grid"), the grid would
still be "in security" (define in the above paragraph) after this contingency occurred.
``̀`
.. important::

A grid is N-1 safe, if, for any "contingency" (*eg* the disconnection a powerline) from
a given list (in general this list is "all the lines / transformers on the grid"), the grid would
still be "in security" (define in the above paragraph) after this contingency occurred.


N-1 with corrective actions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -59,11 +60,11 @@ contingency to avoid the grid to go out of security.

This would give the following definition of N-1 security:

``̀`
A grid is N-1 secure (with corrective action), if an only if, for a any contingency (among a given list),
it is possible to find (at least) a corrective action (understand: an action that can be quickly implemented after
the contingency, including the "I do nothing action") that would bring the grid back to security.
``̀`
.. important::
A grid is N-1 secure (with corrective action), if an only if, for a any contingency (among a given list),
it is possible to find (at least) a corrective action (understand: an action that can be quickly implemented after
the contingency, including the "I do nothing action") that would bring the grid back to security.

.. note::
If a grid is N-1 secure (as described in the above paragraph), it will be "N-1 secure (with corrective action)".
Expand All @@ -78,11 +79,11 @@ or a few days).

The N-1 criterion can then be "extended" to include the time dependance. The natural definition would be:

``̀`
A grid is N-1 scure accross the time interval [beginning, end] if (and only if), for any contingency
(among a given list) occurring during this time interval, there exists a list of corrective actions that
can ensure the grid remains in security at any time until the end of this interval".
``̀`
.. important::
A grid is N-1 scure accross the time interval [beginning, end] if (and only if), for any contingency
(among a given list) occurring during this time interval, there exists a list of corrective actions that
can ensure the grid remains in security at any time until the end of this interval".

.. note::
If the grid state is not modified by any action, assessing whether or not the grid is "N-1 secure on a given time interval"
Expand Down
1 change: 1 addition & 0 deletions docs/user/special.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.. for the color

.. include:: ../special.rst

.. _n_gen: ./space.html#grid2op.Space.GridObjects.n_gen
Expand Down
Loading
Loading