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: Fetch Network - Extract Characteristics - Convert Components - Create Environment - Validate - Generate Timeseries - Validate Episodes / Scenarios

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() 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.2.tar.gz (45.3 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.2-py3-none-any.whl (50.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: grid2env-0.0.2.tar.gz
  • Upload date:
  • Size: 45.3 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.2.tar.gz
Algorithm Hash digest
SHA256 b00c8e9e6b2b8b37db1f2db8152f2bfe0f7e521e10a2b32d3d06127ce3efede7
MD5 2645209ad15545e299a2f74c77db4417
BLAKE2b-256 ff9e72074dae2b664d6d0669f2c445ebcc9c6f7d4514c1ba9c526047d40af6a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: grid2env-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 50.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3e9ce83fa1c353ecf9e18ef3b2743efddbf5078ddafe31e42df1a47989c0d1f3
MD5 c2c7a6a4d35ea219ee151252149921c9
BLAKE2b-256 03937f06dd89e5651cde17860b87e37c4e9cd44be8629205c33ece99ca0aa86c

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