No project description provided
Project description
pypowsybl-grid2opbackend integration (AIRGo project)
Attribution
This library is part of a project that has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 101016508.
Prerequisite
To be able to work properly with this backend integration you will have to install a specific version of pypowsybl. You can find it there : specific pypowsybl branch.
Installation process
You will have to follow the requirements from the pypowsybl repo build from sources I copy/paste here a version of those requirements (from 10/10/2023).
Build from sources
That section is intended for developers who wish to build pypowsybl from the sources in this repository.
Requirements:
- Maven >= 3.1
- Cmake >= 3.14
- C++11 compiler
- Python >= 3.7 for Linux, Windows and MacOS amd64
- Python >= 3.8 for MacOS arm64
- Oracle GraalVM Java 17
To build from sources and install PyPowSyBl package:
git clone --recursive https://github.com/powsybl/pypowsybl.git export JAVA_HOME=<path to GraalVM> pip install --upgrade setuptools pip pip install -r requirements.txt pip install .While developing, you may find it convenient to use the developer (or editable) mode of installation:
pip install -e . # or, to build the C extension with debug symbols: python setup.py build --debug develop --userPlease refer to pip and setuptools documentations for more information.
To run unit tests:
pytest tests
To run static type checking with
mypy
:mypy -p pypowsyblTo run linting inspection with
pylint
:pylint pypowsybl
Simple example of use
In the script ScriptForSimpleUseCase.py you can find an example of simple agent doing one action using our backend on the ieee14 case network. Some several actions could be taken up for you to comment/decomment to act as you like on the network.
AirGo project dataset generation
The dataset created for the needs of the project can be found here.
Processes of creation
This dataset was created using chronics_creator.py. We generated data for january for exactly 4 weeks of 7 days with a 5 minutes step resolution. The given dates do not correspond to any real date. Every month starting with a monday.
For some simplification purpose each week of a given month have exactly the same probabilistic distribution, what differentiates
them is only the randomisation seed chose.
Potential use for machine learning
In a classical machine learning training example we could decide for example to choose 3 weeks for training and 1 week for evaluation purposes. Nevertheless, it is also possible to separate more precisely data based on time step for example, but it will be more complicated.
How to create some more synthetic data
If the available data are not enough we can create some more by changing the nb_of_week parameter in the main of the file. The data will be created starting from the month of january until december, 4 weeks per month each.
Definition and comparison of objects between Pypowsybl and Grid2op
Lines and transformers
Pypowsybl
In Pypowsybl there is a real distinction between lines, 2 winding transformers and 3 winding transformers.
Grid2op
In Grid2op all those objects are assimilated as lines. Nevertheless, Grid2op knows which of these lines are real powerlines and those that are not.
Use of pandapower format to test pypowsybl backend
Because of the converter chain (Pandapower format -> Matpower -> Pypowsybl inner format), issues often happen and some lines or transfos are considered by pypowsybl as the opposite. A way to see those changes is to analyze the lines that have a null resistance (they were transfos in pandapower format), but it is still a workaround and not a solution or complete analysis.
Thermal limitation
Pypowsybl
In Pypowsybl thermal limitations are set for both buses of a line (two extremities).
Grid2op
In Grid2op thermal limitations are set for the entire line.
We decided to choose the smallest value of both extremities in pypowsybl and to give that information for the line thermal limitation in Grid2op. We also chose to take into account only permanent limit in current. By default if none information is available in pypowsybl I set a huge limit which is equal to no limit.
Substations
Pypowsybl
In Pypowsybl substations should contain at least one voltage level and busbar.
Grid2op
We chose to have 2 busbars at each substation to facilitate the integration of our backend with existent tests but this remains a personal choice, the explanation is bellow.
Because we don't want to have to make topological choices on how to deal when multiple buses are in the same substation in pypowybl we decided to double the busbars in the backend and to give the information to Grid2op as described in the doc : This “coding” allows for easily mapping the bus id (each bus is represented with an id in pandapower) and whether its busbar 1 or busbar 2 (grid2op side). More precisely: busbar 1 of substation with id sub_id will have id sub_id and busbar 2 of the same substation will have id sub_id + n_sub (recall that n_sub is the number of substation on the grid).
Function part
Usage in the code
Functions for topological actions
Doubling buses (Pypowsybl backend)
This is done by calling the _double_buses function in the PowsyblBackend.py file. Like so the initial buses (in bus_breaker_view) are doubled but initially connected with none object.
Usage of move_connectable (Pypowsybl backend)
This allows the user to move any object from one bus to another in the backend. This function could only use bus_breaker_view buses id to work (different from bus_view buses id in pypowsybl). This is particularly useful for Grid2op topological changes to switch any object from a bus to another inside a substation (only possible topological action in Grid2op)
License information
Copyright 2023 Artelys: http://www.artelys.com
This Source Code is subject to the terms of the Mozilla Public License (MPL) v2 also available here or in the repository.
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
Built Distribution
File details
Details for the file pypowsybl_grid2opbackend-1.0.0.tar.gz
.
File metadata
- Download URL: pypowsybl_grid2opbackend-1.0.0.tar.gz
- Upload date:
- Size: 132.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.9.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5890cc46730c4bb0fcf6ecae653c810bedc4f9fb925f8b1392d4a2f734fc7706 |
|
MD5 | ddadff4c7fd39961f7eeae637c43ff79 |
|
BLAKE2b-256 | 54d20c32bf87503a35ed57f91c1238e938db0296dcb017a89c7448f97d019d6f |
File details
Details for the file pypowsybl_grid2opbackend-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pypowsybl_grid2opbackend-1.0.0-py3-none-any.whl
- Upload date:
- Size: 144.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.0 CPython/3.9.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51229237e6bb6a7559fbe50db12f167a6ff28b0dd0edc73cf3bb84f1036fbec1 |
|
MD5 | 7aebca7223f9c4d9c9c071798f336016 |
|
BLAKE2b-256 | 6981ee1d4897d5a255a0f8f84b218e917a8389b720a6f01166757d4ef399ab24 |