Grid2Env
Tool for creating new Grid2OP environments using the Chronix2Grid library.
Features:
- Load any PandaPower network and generate load, solar, wind and dispatch timeseries for it.
- Generate extreme events (N-k) line outages, to create more challenging, resilience-oriented episodes / scenarios (optional)
- Enhance network with energy storage, sized according to the size of the loads they are located alongside.
Installation
See the documentation for more details.
To get the correct folder structure, you can clone Grid2Env and work on it from there:
git clone git@github.com:DEUCE1957/Grid2Env.git
cd Grid2Env
...
Once you are happy with your generated environment, you can copy it over to your Grid2Op environment directory for actual use (e.g. for a training a reinforcement learning agent).
You can also install Grid2Env as a standalone Python package:
pip install grid2env
...
Usage (Command Line Interface)
python grid2env --env cigre_mv --network cigre_network_mv --n_scenarios 365 --gap 1 --scenario_length 28 --extreme 2 --verbosity info
Will generate 365 scenarios in Grid2Op's local directory (changed using '''grid2op.change_local_dir(PATH)'''). Each scenario will be 28 days long, with its start date offst by 1 day from the previous scenario. This means there will be 27 days overlap with the previous scenario, though the actual timeseries will be different. Each scenario will have between 1 and 2 (upper limit) random components disabled, representing an extreme initial event that the RL agent must recover from.
The script will look for a .json file called 'cigre_network_mv.json' in the '.../Grid2Env/Networks/' folder which represents a PandaPower grid. Since 'cigre_network_mv' also matches a function called 'create_cigre_network_mv' in PandaPower, the network will be 'fetched' automatically.
To create the network manually, simply do the following:
import pandapower as pp
network = pp.networks.create_cigre_network_mv(with_der="pv_wind")
network.to_json("cigre_mv.json") # Put this in '.../Grid2Env/Networks/cigre_mv.json'
The Jupyter Notebook 'PandaPowerNetworks.ipynb' provides some more examples of built-in PandaPower networks.
The script cli.py is the recommended / most-up-to-date way to generate scenarios.
Planned Features
Currently Grid2Env does NOT include these features, but it may be expanded in the future to include them:
- Support for networks with multiple external grids / a distributed slack.
- Support for converting other power system network formates / libraries (PyPowSybl, etc.)
- Reduce dependency on Chronix2Grid
Known Problems
- Chronix2Grid throws error on method
lopf()ormremove(). This is because it was built with an older version of PyPSA. Clone the latest Github repository of Chronix2Grid and install from there instead of PyPi. Also see PR #92 ifmremove()still throws an error. - Numba Warning: When executing methods in Grid2Env, you may get a numba warning printed. This is hard-coded into PandaPower and cannot be suppressed. The 'Suppresor' content manager in 'utilities.py' can be used to suppress print statements over a block of code.
Citing
@misc{grid2env,
author = {X. Weiss},
title = {Grid2Env - Tool for creating new Grid2Op environments using the Chronix2Grid library},
year = {2026},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/DEUCE1957/Grid2Env}},
}
License Information
This source code is subject to the terms of the non-AI Mozilla Public License (MPL) v2, also available here.
Metadata
Release files for Grid2Env 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| grid2env-0.0.2.tar.gz | 45.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| grid2env-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 96.0 kB
Release files / grid2env-0.0.2.tar.gz
| Download URL | grid2env-0.0.2.tar.gz |
|---|---|
| Size | 45.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b00c8e9e6b2b8b37db1f2db8152f2bfe0f7e521e10a2b32d3d06127ce3efede7
|
|
BLAKE2b-256 checksum How to use checksums |
ff9e72074dae2b664d6d0669f2c445ebcc9c6f7d4514c1ba9c526047d40af6a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / grid2env-0.0.2-py3-none-any.whl
| Download URL | grid2env-0.0.2-py3-none-any.whl |
|---|---|
| Size | 50.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3e9ce83fa1c353ecf9e18ef3b2743efddbf5078ddafe31e42df1a47989c0d1f3
|
|
BLAKE2b-256 checksum How to use checksums |
03937f06dd89e5651cde17860b87e37c4e9cd44be8629205c33ece99ca0aa86c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|