Skip to main content

A tool for creating new Grid2Op Eenvironments.

Project description

Grid2Env

Tool for creating new Grid2OP environments using the Chronix2Grid library.

Grid2Env Workflow

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.

By default, Grid2Env is best used from a clone of the Grid2Env repository.

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 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() or mremove(). 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 if mremove() 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grid2env-0.0.1.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grid2env-0.0.1-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

Details for the file grid2env-0.0.1.tar.gz.

File metadata

  • Download URL: grid2env-0.0.1.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for grid2env-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e14bece532487abe1d3a8d702e541e1f5e6fb515f8cf244143f0e596e87597a5
MD5 c426fb044aef3fa979bc497634c146a1
BLAKE2b-256 68c67f2b75309bc0d8a283466d8cba559239581b7e66e8da37408d49dbc3cde1

See more details on using hashes here.

File details

Details for the file grid2env-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: grid2env-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 50.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for grid2env-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ef4117a76e5ee2e12446f704c532fd6ca54686ae8613a9d6e7b8402de08e30e
MD5 2a2bfb8d8861a60ff4a0f14c71de300c
BLAKE2b-256 d3356fd39406607ae69e40dd5a997e3746c20dd61d2aa3e71b0e222a549dbaec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page