Skip to main content

A PowSyBl Python API

Project description

PyPowSyBl

Actions Status Quality Gate Status Coverage PyPI Latest Release Documentation Status MPL-2.0 License Slack

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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pypowsybl-1.5.1-cp312-cp312-win_amd64.whl (45.9 MB view details)

Uploaded CPython 3.12Windows x86-64

pypowsybl-1.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (54.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pypowsybl-1.5.1-cp312-cp312-macosx_11_0_universal2.whl (44.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ universal2 (ARM64, x86-64)

pypowsybl-1.5.1-cp311-cp311-win_amd64.whl (45.9 MB view details)

Uploaded CPython 3.11Windows x86-64

pypowsybl-1.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (54.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pypowsybl-1.5.1-cp311-cp311-macosx_11_0_universal2.whl (44.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

pypowsybl-1.5.1-cp310-cp310-win_amd64.whl (45.9 MB view details)

Uploaded CPython 3.10Windows x86-64

pypowsybl-1.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (54.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pypowsybl-1.5.1-cp310-cp310-macosx_11_0_x86_64.whl (44.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

pypowsybl-1.5.1-cp39-cp39-win_amd64.whl (45.9 MB view details)

Uploaded CPython 3.9Windows x86-64

pypowsybl-1.5.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (54.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pypowsybl-1.5.1-cp39-cp39-macosx_11_0_x86_64.whl (44.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

pypowsybl-1.5.1-cp38-cp38-win_amd64.whl (45.9 MB view details)

Uploaded CPython 3.8Windows x86-64

pypowsybl-1.5.1-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (54.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

pypowsybl-1.5.1-cp38-cp38-macosx_11_0_x86_64.whl (44.1 MB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

File details

Details for the file pypowsybl-1.5.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pypowsybl-1.5.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 45.9 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for pypowsybl-1.5.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 32077f466f1143b0e9ee8638bee21631c338e5b7ee82092d6b5d13c9458a18c4
MD5 6651f207e98f6244eb15cce51bb50ff9
BLAKE2b-256 8b3b1684d44a9de2b85465f0581c998dc85c86e5c6d65b459f8637f9e127c96c

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 46191d48fb811c62e5cede38af73be76a6829ac34e4a2023565c74418fc25c60
MD5 7fc1ac21cc96cbd73d9f5f91f1728377
BLAKE2b-256 af45d5fddf426e839aae491611778bcbaed3914b99ea2b8c0df201aa1719c896

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp312-cp312-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp312-cp312-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 357ffbb3f7fa94d286f4e356dbcde0c45061f0190280f24224c8e9f5fbae56c0
MD5 640d99b348a3d1a10953062a7929069c
BLAKE2b-256 87c1c2d25ff69279c972b663b97b145d6933310abbfa81f3c749441c34e1f31d

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pypowsybl-1.5.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 45.9 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for pypowsybl-1.5.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d9fbb11ea6881e49f4995026fbebd481b194512e9a7dbe9a358535ded710e39e
MD5 39e4652702376e0e8794617a0009a00e
BLAKE2b-256 7014b8e2edab184783beaccb5db2903492fc70bb304017626d4562368e413e53

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5234a8b49365b1794e6c9e693797107fd6a5c7807276620ad9cdef30f74c21e9
MD5 0e0c0949d58a3d4c0be2503f0301c065
BLAKE2b-256 90abcb6b0502db52b936b5aa554ce5a18e30198b173cbd767199ecb509c19a52

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 8863db6fd6a264841be54729aae395d6dcc511be665ce468492c5f70c0caa9bc
MD5 b1a2bf8143a9e962a91752246fe46a56
BLAKE2b-256 b1ebe5c2f6bbcbf891280b01b2efe6dada38f75f055d002ddcbed5c682951aa8

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pypowsybl-1.5.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 45.9 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for pypowsybl-1.5.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 38bfa22d70f12b2925c30bd4afc0bb96ccb447b4bc05921a69737398e5c5aca7
MD5 e4d93399de77f795429fb8b5b3e1e298
BLAKE2b-256 f6ca38260786cc0e9f73a1c35a0f126271d0f9e2b507fbfe0f88ac3d648bc205

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eb41c2b20f2c891407380be6eacd746d0cd5a9d30273b30e704a2f31cd9ac195
MD5 9a887e49f05dd1e0843dbbc4446592d5
BLAKE2b-256 05b267b9f15daf4af40ab0b66bcdeb829ddbdbadf4a3635c52fcbe173da506a3

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 08af476a917a90a6d1dbf4e73ffd31a4074d1195dbc90aa56e41aea229e56623
MD5 157533cbc08f53c0e39068268fececdd
BLAKE2b-256 4f7036b1cbbdcbd4a38f070b7b62e7de00a9ad342cc4c5822a48b8cda9aef623

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pypowsybl-1.5.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 45.9 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for pypowsybl-1.5.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4c7dfcdab206f1a9edabb7b054af81b211e07ff4eb2f7ce89728bd3f885d123d
MD5 aca165d866b275736eea93d7f9f69c1f
BLAKE2b-256 417a087ccc1e31476bd8be49918df88c14f4b45945a959d5a1c21adbb92edebd

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f9ff8731682fd6877db2a7b32de65f2bff07f41168525be337f3f86935f371fd
MD5 16203fe3636e7608434ef04e367bb937
BLAKE2b-256 569a61dedc1ecc87c904839eb7996855db83e97020af4699ec78f58ed6fd0c45

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 85b2fdecb5c3aacf2cbc27f19801465afda98a3dceb7c0e470a1b0634026e949
MD5 adf71213e965e329d266e9630f8e83ba
BLAKE2b-256 fc624c287d832c7baee5e7d56eb43920be00edac894faaa5e740245fe14af2a3

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pypowsybl-1.5.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 45.9 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for pypowsybl-1.5.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 1bfa988ca5c7ac5e421a71fd11982498ddafebf238306e762aeecab72b35123b
MD5 b38c718c5d396ea3fd3fe93300f7fa4e
BLAKE2b-256 da223fadc4433048ded63f55e2e4286b8831a7e48cd6ac0f33c97a2ed84622f3

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ea6e6247e5d43639dc6a85c5d9365e64e96f6c65b5c70ca5129ac10b854ec4f6
MD5 b9f5a2c6f01f904168229af6c5e6bb5d
BLAKE2b-256 a21306a36e84494d56f2a2fd313ff4692890d4d5410bbfa6e7e1cf07570f0fed

See more details on using hashes here.

File details

Details for the file pypowsybl-1.5.1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pypowsybl-1.5.1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c75b8f70a120728b7b4379250a377377db1c4bf2c26ab129fba629b5f4ef4db2
MD5 1b784373083b35058cff3d9f08ea8436
BLAKE2b-256 5e7b0d8da00b7ce70420b9b2a0bdbed3a51fe197df3c2cfdee6d625b3e48e6e8

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