A PowSyBl Python API
Project description
PyPowSyBl
The PyPowSyBl project gives access PowSyBl Java framework to Python developers. This Python integration relies on GraalVM to compile Java code to a native library.
Documentation
Latest version of the documentation with API reference and many code samples is here.
Notebooks
Notebooks demonstrating PyPowSyBl features can be found in this repository.
Installation
PyPowSyBl is released on PyPi for Python 3.7 to 3.11, on Linux, Windows and MacOS.
First, make sure you have an up-to-date version of pip and setuptools:
pip install --upgrade setuptools pip
Then you can install PyPowSyBl using pip:
pip install pypowsybl
Getting started
First, we have to import pypowsybl:
import pypowsybl as pp
We can create an IEEE 14 buses network and run a load flow computation:
n = pp.network.create_ieee14()
results = pp.loadflow.run_ac(n)
print(results)
[LoadFlowComponentResult(component_num=0, status=CONVERGED, iteration_count=3, slack_bus_id='VL4_0', slack_bus_active_power_mismatch=-0.006081)]
We can now get buses data (like any other network elements) as a Pandas dataframe:
buses = n.get_buses()
print(buses)
v_mag v_angle
VL1_0 1.060 0.00
VL2_0 1.045 -4.98
VL3_0 1.010 -12.72
VL4_0 1.019 -10.33
VL5_0 1.020 -8.78
VL6_0 1.070 -14.22
VL7_0 1.062 -13.37
VL8_0 1.090 -13.36
VL9_0 1.056 -14.94
VL10_0 1.051 -15.10
VL11_0 1.057 -14.79
VL12_0 1.055 -15.07
VL13_0 1.050 -15.16
VL14_0 1.036 -16.04
This is just a quick appetizer of PyPowSyBl features. PyPowsybl provides a lot more features: security analysis, sensitivity analysis, handling of multiple file formats (including CGMES), substation and network diagrams generation, ... For more details and examples, go to the documentation and Jupyter notebooks.
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.8 for Linux, Windows and MacOS (amd64 and 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 --user
Please refer to pip and setuptools documentations for more information.
To run unit tests:
pytest tests
To run static type checking with mypy
:
mypy -p pypowsybl
To run linting inspection with pylint
:
pylint pypowsybl
Contribute to documentation
To run the tests included in the documentation:
cd docs/
make doctest
And then, to build the documentation:
make html
Web pages are generated in repository _build/html/ for preview before openning a pull request. You can for example open it with firefox browser:
firefox _build/html/index.html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for pypowsybl-1.2.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4db15232d21a1ce23d464c5a91777c8ec732735d05aff8b6383992cc2f85ffab |
|
MD5 | 03f7ca8c780d6fd235e8222431a293ac |
|
BLAKE2b-256 | 90432d3b9b6f41e4e477bbb800c77ce7d8820972d47a2b6f870d39069eb99fa0 |
Hashes for pypowsybl-1.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c382fb2197d09e6b1a97964f4d983b76afab61d4248ee2aba176bb491b4454ee |
|
MD5 | 7cf5faadb2c8b9a56cd20045b5889b4f |
|
BLAKE2b-256 | 52732be97805bc23919c6c163865953b422a7c249269c02944d455b58b078607 |
Hashes for pypowsybl-1.2.0-cp312-cp312-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0cfb5f0dd959c8b7cff6b2f8d60ad6029add8605e120e0f40234a77858e2e432 |
|
MD5 | 7f8ef69a914f7069513d67b094748e4d |
|
BLAKE2b-256 | 9882e918c870a093118b1a215baa3331062bfb63ffbdd0bf6d3969782acda1bc |
Hashes for pypowsybl-1.2.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f3bfa05bf2d942ceb97b8f851258524479f72853de33ecb78bfa592f9b518b9 |
|
MD5 | 2b7ecb46ae37a907f0579b8764c10e36 |
|
BLAKE2b-256 | 70fbf63bcb187913ca89b4476b1b47a564137df34d6b9579483a157aa3b27bf2 |
Hashes for pypowsybl-1.2.0-cp311-cp311-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 040c54e91fcb09798492958d38934c5104a3685098db5ddd2c9e864507f61e57 |
|
MD5 | fbc274cf67391bdce49ce785166298b0 |
|
BLAKE2b-256 | 5d04ae4ceb977978eb524dd259087cfc6623c1e0e8e73ef423ab510a966f5966 |
Hashes for pypowsybl-1.2.0-cp311-cp311-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fce472425ae8ef6d4440773ef3528c98aa27d74ca217c7c1da4dac4d52d24ccf |
|
MD5 | fb8273231ff16830ac1b1bcd3006d752 |
|
BLAKE2b-256 | 440d41bb6382c737dfda203353fbd674c05edb9d9d730d7ac60d0a4388a3e55d |
Hashes for pypowsybl-1.2.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7615cf9adba207ac1be1d9717a819ecf5446fb32d80c0b1930ca6c397839e4ca |
|
MD5 | 1f8f8ca4cc1200ca77d21f71b5892703 |
|
BLAKE2b-256 | 44f3f20494392f6269288bb43ee313ebdaa4aa2f9102af8986027742cc5fe800 |
Hashes for pypowsybl-1.2.0-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52eceeb766d77d03a544ebeabd5b7a0d0214ac31513506ea0f85e8bd6075ae10 |
|
MD5 | e6974698675359153b9c014995184399 |
|
BLAKE2b-256 | cdd8d9692e4382381e067610656fa531180ab5975c2bd14a8ded22585be913fc |
Hashes for pypowsybl-1.2.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90d40b949387a5b0bcac4e267fd9e1f6e458b09e638036a5ade65d0902a4ade3 |
|
MD5 | 7367a7428df993ed7061ca4b2db44318 |
|
BLAKE2b-256 | 687c2ea820aa6d3217154264fa191954c90d830edcdc81b9cd8945c0ba2bdf29 |
Hashes for pypowsybl-1.2.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d2c32af960e5ede059edee3813966e25ffac95586662ad73156dc4a9fd854bf |
|
MD5 | bd996bb14756cc8443f60522b5c70946 |
|
BLAKE2b-256 | 49df764ac5b7393930498820f88c7ed5fd40bd23d791b0df1a1a207adc4d37e1 |
Hashes for pypowsybl-1.2.0-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c913de7192ca9f8a9d729f2c4940ff18714c680af69983e7a236d9cd2188de4e |
|
MD5 | 3356518f942e62171509f2cbf1988c8a |
|
BLAKE2b-256 | e57fcbba37cc3ed90e8a404cdeb78311a9239a4cc92bfbc0068b3c7293af8ed1 |
Hashes for pypowsybl-1.2.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39bf59720f8d5e56bb386f070d733debfbcd250255f445c14d7ad9ada33a67ae |
|
MD5 | 3f8934731c4eeb902839a200c664d0ab |
|
BLAKE2b-256 | 04cc633565d513cbdf62dbbb6055be907b8c406f3c773987cdba698d9131fbc4 |
Hashes for pypowsybl-1.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 721816f18962336899aade92dd90b9fa8f0d690eef1c164929f2d3f5cef4ea6a |
|
MD5 | f3b19469c0eb785aee78a386a6d61be4 |
|
BLAKE2b-256 | 4c5df1227d8f1e2b5b4db7d287d4d93cce7c23ebec130b879412766132039af1 |
Hashes for pypowsybl-1.2.0-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 855d9b503e4d2cf32bb24c70ef159688a1a8a6d8768ca365ae0f49bcff5c8a81 |
|
MD5 | 97fb54ba47f287b6240298c7e6b02ebe |
|
BLAKE2b-256 | 756bb8653272538d3ecddeb7b523ec7e98a4faaeb8be7bf854d5fca920ceb06b |
Hashes for pypowsybl-1.2.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b35b707dc93abe5cde63162e1e42cf43be3897f087bce79c76af3f0b0ba2e901 |
|
MD5 | f167b93cf845ab0b73e2483a1c7530ad |
|
BLAKE2b-256 | 956f477b81048d260878c50c3745ccc79e718d7a0c84df128a8d5a5ebf963a89 |