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.8 to 3.12, 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)
[ComponentResult(connected_component_num=0, synchronous_component_num=0, status=CONVERGED, status_text=CONVERGED, iteration_count=3, reference_bus_id='VL1_0', slack_bus_results=[SlackBusResult(id='VL1_0', active_power_mismatch=-0.006730108618313579)], distributed_active_power=0.0)]
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 opening 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.4.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca5f25a1ddb4a5cb99b56d675aa02dcefaaf854f78bcc6f0cbf6db72987dfd3e |
|
MD5 | 42c33d863c0ba1ff26d7a247706c3943 |
|
BLAKE2b-256 | dbe4e8f5fecb0319f7638cd53606078fb01fcbf49ef10023c521d4d55bed007b |
Hashes for pypowsybl-1.4.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90803f47524f3c32869021d194ffd731f7c4e7b48b4ebb5fb82d41cf0ae3e3f4 |
|
MD5 | d5caab44943678f288040494a7355095 |
|
BLAKE2b-256 | 88221ba3fd688038a7c13805543c3f747c4475354e8ae8e39b3a1ff16b7a0f80 |
Hashes for pypowsybl-1.4.0-cp312-cp312-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1612f09c68f3d947678cd3de654c7630e787029c03f58e173d7b82b7a3cb02ba |
|
MD5 | e8b7180a27e28ba651195ea3d4911446 |
|
BLAKE2b-256 | 95261c6812e1e539941a8f1d222e909805e44baf6ef649874a1996109a02eb04 |
Hashes for pypowsybl-1.4.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efc7d573d199c07f191d06d1751effb9630e4c6417b280af9cdc20393e2787a8 |
|
MD5 | 5a232649d152c43bb397c66e65d596d7 |
|
BLAKE2b-256 | fac8abee9d35a1b968326552b12a84c14737314394dfe4f24bde2bcde4ed1ac7 |
Hashes for pypowsybl-1.4.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae2224b199477fa8b2aa672a867eeae5c5e263bef48698329f4ab6a1e1edb1a2 |
|
MD5 | 05e663a742f8c7e2fcd55bb115fb5595 |
|
BLAKE2b-256 | 100652e9b575e42ec2051277b7c0e9c68dd8b1a1acdfc9eed959a64d7f8d2af6 |
Hashes for pypowsybl-1.4.0-cp311-cp311-macosx_11_0_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70ff780f6d68b882ac5a1a559130d06d8f2a38d0d029df899da1734bb5099b35 |
|
MD5 | 9178493f60656da28cd7712877d972d0 |
|
BLAKE2b-256 | f8ad767f13b1d02adfc13ba98c5f37d631df9c40fcbe27c6c598459740bb5d8f |
Hashes for pypowsybl-1.4.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93206bd56933b1dc574958b0dd2e2ddb5029272f5c3279ded9e03e34ee3dd6be |
|
MD5 | 1e3c5ff829f7155a026b5019a51f1014 |
|
BLAKE2b-256 | 895ce63bb2ee1362b2c2ee32293efff331d9c79fb64ad41f571d3c9fe3f7a9dd |
Hashes for pypowsybl-1.4.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dbf861cff9d0d898808968fa3e14d5f472e007a1968eef926699d6827988ffa |
|
MD5 | 6668c8117f17bd7a4d001b501f2a5822 |
|
BLAKE2b-256 | bfe4a4c7c2d83fdc5c2db509dc68b7a25f2f265e3b37d6c357d3f8d2f5086857 |
Hashes for pypowsybl-1.4.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ef0467ec0989b0864e55004dcb1fd3528d1da29aa263ee83dcaee29ed325428 |
|
MD5 | fa24b64e73db35fbfefafaf446227575 |
|
BLAKE2b-256 | 1bdc480ad8cdf0b9ea4919320e3da776d25b56c4649bc31bfd79189da734aa14 |
Hashes for pypowsybl-1.4.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c7f9b66c6bf34daba7daf6364094a63eec244f0b1450e90beebcd816e092d9e |
|
MD5 | badfea1b96da4d38d146be0e199ad5d6 |
|
BLAKE2b-256 | 5191f04015382f0ba84c8ac50bf3e1ac743a01554ebf6bf897573ebffbbe7a82 |
Hashes for pypowsybl-1.4.0-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd30fd5edf2dca2e7161de6efd3d83d2406a7e7ddcb2eaa7cc0855f97db44d93 |
|
MD5 | 47a39f66145aa7a470afdb815453ffaa |
|
BLAKE2b-256 | 6e8f1efed75f80adc958ca120d0fdc8723cf875d1e4c9125431d08c4216f47f4 |
Hashes for pypowsybl-1.4.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8c760df8157e9cbcc618d38d8063ba188e62711870bee462c8df8b70aa51593 |
|
MD5 | a32c3c9ec6082c50050ad3496e128796 |
|
BLAKE2b-256 | d0e77f57309b417936684e0a993c385a9882b8ca614067413d246b9c66ef82ff |
Hashes for pypowsybl-1.4.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55904f87ec70e1092e155bdd35272ea0262be3a28225728005ddea7e9bd1f162 |
|
MD5 | 1551b605699715196ae1b88fd7a5784b |
|
BLAKE2b-256 | dcb29e12076673edeb228d9985132b79add22bd76ce3dc9984a2e18c5977e99a |
Hashes for pypowsybl-1.4.0-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8dc3c09f7931e9948710adad2b618c42def19d94fce9ede59c5f2fff2fd22c4e |
|
MD5 | fc9690206f15217cad8aad33b33647e0 |
|
BLAKE2b-256 | 371f32717a4769123f30e65acd73f10a7225e2c4349133dd31118aa0dfdd355b |
Hashes for pypowsybl-1.4.0-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8365bcf05d92c7ccfc98f30e1b121acc632c958561babd54f82937aadf9ee34e |
|
MD5 | 558c80bc0e2869853a04a3c428355f75 |
|
BLAKE2b-256 | 9767bfbfa8d6b950489d653f794b305e6523c51c55de92e3a43939cde4a68475 |