Lossless power system case file IO, format conversion, and sparse matrix and graph views
Project description
PowerIO
PowerIO reads power system case files into a typed Network, writes them back,
converts between common formats, and builds the sparse matrices and graph views
used by analysis and solver code. It aspires to be "the pandoc for power systems."
Supported formats:
- MATPOWER
.m - PSS/E
.rawrevision 33 - PowerWorld
.aux - PowerModels.jl network data JSON
- egret
ModelDataJSON - GridFM
.parquet(WIP) - surge
.surge.json(WIP)
When writing back to the source format, PowerIO returns the original file exactly when the parser
retained it. Cross format conversion obeys sane defaults, and emits Conversion::warnings for fields the
target format cannot represent.
Packages
powerio parser, Network model, source retaining writers, converters
powerio-matrix sparse matrices, DC sensitivity factors, graph views
powerio-cli the `powerio` command and ratatui TUI
powerio-py PyO3 extension for the Python `powerio` package
powerio-capi C ABI for C, C++, Julia, and other foreign function interfaces
PowerIO.jl Julia bindings over the C ABI
API docs: https://eigenergy.github.io/powerio/. Language API map: docs/languages.md.
Install
cargo add --git https://github.com/eigenergy/powerio powerio
cargo add --git https://github.com/eigenergy/powerio powerio-matrix
cargo install --git https://github.com/eigenergy/powerio powerio-cli
pip install powerio
pip install 'powerio[all]' # scipy, numpy, networkx, polars extras
pip install 'powerio[gridfm]' # polars for Parquet inspection
pip install 'powerio[pandas]' # pandas, pyarrow compatibility reads (Python 3.10+)
julia -e 'using Pkg; Pkg.add(url="https://github.com/eigenergy/PowerIO.jl")'
Use
PowerIO is implemented in Rust and features a low-level C ABI. This lets PowerIO talk to many of your favorite languages. Any language with a C foreign function interface can call it.
Rust
use powerio::{TargetFormat, parse_file};
let net = parse_file("case14.m")?;
let conv = net.to_format(TargetFormat::PowerModelsJson);
for warning in &conv.warnings {
eprintln!("conversion warning: {warning}");
}
std::fs::write("case14.json", conv.text)?;
Python
import powerio as pio
case = pio.parse_file("case9.m")
bprime = case.bprime() # scipy.sparse, needs powerio[matrix]
raw, warnings = pio.convert_file("case9.m", "psse")
Julia
using PowerIO
case = parse_file("case9.m")
text = to_matpower(case)
json, warnings = to_format(case, "powermodels-json")
Command line interface (CLI)
powerio convert tests/data/case14.m --to psse -o case14.raw
powerio verify tests/data/case30.m --kind bdoubleprime
powerio dcopf tests/data/case30.m -o out
powerio sensitivities tests/data/case30.m -o out
powerio gridfm tests/data/case14.m -o out
powerio
Current Format Fidelity
| reader / writer | MATPOWER | PowerModels JSON | PSS/E | PowerWorld | egret JSON |
|---|---|---|---|---|---|
| MATPOWER | original text | full | partial | partial | partial |
| PowerModels JSON | partial | original text | partial | partial | partial |
| PSS/E | full | full | original text | partial | partial |
| PowerWorld | full | full | partial | original text | partial |
| egret JSON | partial | full | partial | partial | original text |
partial means the target lacks fields present in the source. The writer reports
those cases in Conversion::warnings. Known limits are documented in
docs/format-fidelity.md.
Matrices
powerio-matrix derives an IndexedNetwork with dense bus indices and builds:
- B' and B'' DCPF and FDPF matrices
- Nodal admittance matrix
- LACPF block matrix
- Signed incidence, weighted Laplacian, and flow map matrices
- PTDF and LODF sensitivity matrices
- Matrix Market bundle for DC OPF solvers
- Adjacency matrix and
petgraphview
Current conventions for signs, taps, phase shifts, per unit scaling, reference buses, and DC susceptance are documented in docs/matrices.md.
Normalized View
Network::to_normalized derives a solver oriented copy of a case with sane defaults. Powers are provided in per
unit, voltage phase angles are in radians, inactive elements are removed, tap == 0 replaced with 1,
surviving buses are reindexed to a dense 1-based id space, and bus types are made
consistent with generator placement and reference buses. Computing it carries no retained
source text, so writing the normalized network emits the derived model rather than the original file.
Python exposes the normalized view as case.to_normalized(), the C ABI as pio_to_normalized,
and Julia as to_normalized(case).
Special features
GridFM
PowerIO supports the GridFM framework. The command powerio gridfm <case> -o <dir> writes the Parquet tables consumed by
gridfm-datakit and
gridfm-graphkit: bus_data, gen_data, branch_data, and y_bus_data under
<dir>/<case>/raw/. A case file is one scenario. Passing several compatible
cases stacks them by scenario id.
C ABI
powerio-capi exposes parse, query, conversion, JSON transport, normalization,
and numeric table extraction through pio_* functions. The public header is
powerio-capi/include/powerio.h.
Build with --features arrow to enable pio_export_arrow over the
Arrow C Data Interface.
MCP Server
The Python package includes an optional MCP server with convert_case and
case_summary tools. Interoperability with the PowerAgent project is planned.
pip install 'powerio[mcp]'
powerio-mcp
Validation
The Rust test suite covers parsers, writers, format conversion, matrix builders,
and normalization; the C ABI crate carries its own tests (it is outside the
default members, so it needs an explicit -p powerio-capi), and pytest covers
the Python bindings. The benchmark validation suite compares selected outputs
against PowerModels.jl, egret, ExaPowerIO.jl, and pandapower.
cargo fmt --all --check
cargo test
cargo test -p powerio-capi
cargo clippy --all-targets
pytest python/tests
bash benchmarks/run_validation.sh
Benchmark method, environment, and current tables are documented in benchmarks/RESULTS.md.
License
PowerIO is distributed under either of:
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 Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file powerio-0.0.1.tar.gz.
File metadata
- Download URL: powerio-0.0.1.tar.gz
- Upload date:
- Size: 185.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29e259f9a319d5f2ee690a500819e755eb339059cbcac99f62b96bd23986d774
|
|
| MD5 |
ddf2774618ab8567f3d276e4b92576c8
|
|
| BLAKE2b-256 |
9a4429539cddacc01d905baf7a38c85b6f2437f1dfdb05d4ec980eec76b32d16
|
Provenance
The following attestation bundles were made for powerio-0.0.1.tar.gz:
Publisher:
python.yml on eigenergy/powerio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerio-0.0.1.tar.gz -
Subject digest:
29e259f9a319d5f2ee690a500819e755eb339059cbcac99f62b96bd23986d774 - Sigstore transparency entry: 1773924204
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@cbf2fac858de6e071f613ab6bc4d204913429c51 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@cbf2fac858de6e071f613ab6bc4d204913429c51 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file powerio-0.0.1-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: powerio-0.0.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 1.7 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b5cd027410c3dddf337e760248baf7bc9ed3c22cecdf203e580eb7ff1ca5709
|
|
| MD5 |
3f39f53f2bead93ea89c746244680e15
|
|
| BLAKE2b-256 |
f352c3f5eab6d75123551e6d100f197743ac006092ce7e79b6d7dd9391b95fdc
|
Provenance
The following attestation bundles were made for powerio-0.0.1-cp39-abi3-win_amd64.whl:
Publisher:
python.yml on eigenergy/powerio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerio-0.0.1-cp39-abi3-win_amd64.whl -
Subject digest:
1b5cd027410c3dddf337e760248baf7bc9ed3c22cecdf203e580eb7ff1ca5709 - Sigstore transparency entry: 1773745623
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@db944afe3819b2efd67060eda056003846f8e8ad -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@db944afe3819b2efd67060eda056003846f8e8ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powerio-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d38c1de3bb93eb1c79d4b861a036b214af019ec1f00987771440607a755f9b1
|
|
| MD5 |
29001caca45fffc3cd24b87e23e0a4e3
|
|
| BLAKE2b-256 |
677c7e325001ec6dce36824eec6777fbae63629ae8372c499b0ca741bd76d86e
|
Provenance
The following attestation bundles were made for powerio-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
python.yml on eigenergy/powerio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerio-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
8d38c1de3bb93eb1c79d4b861a036b214af019ec1f00987771440607a755f9b1 - Sigstore transparency entry: 1773745011
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@db944afe3819b2efd67060eda056003846f8e8ad -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@db944afe3819b2efd67060eda056003846f8e8ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: powerio-0.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b647ff02e04931fae78365a1ea8bc6f05afdbea2e247e2b6efbb88db9d31020
|
|
| MD5 |
e221ad93ed77596d3f6aae0d1f4bb2fc
|
|
| BLAKE2b-256 |
f70fc0d4fa91e36b10d66d8b3af41b9b0a498745f804404f8f2415612a2307bc
|
Provenance
The following attestation bundles were made for powerio-0.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
python.yml on eigenergy/powerio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerio-0.0.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
2b647ff02e04931fae78365a1ea8bc6f05afdbea2e247e2b6efbb88db9d31020 - Sigstore transparency entry: 1773744719
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@db944afe3819b2efd67060eda056003846f8e8ad -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@db944afe3819b2efd67060eda056003846f8e8ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.0.1-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: powerio-0.0.1-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45dbcffb954f760910fc82ff4b59656afd8ba79f14142202d64c5457359761bc
|
|
| MD5 |
b202516355be3c222ab1d18c09c4dfe0
|
|
| BLAKE2b-256 |
0598e69aea850ed9f701f41aca4e1edfaa6898465cc1f8ff289dfd0de16e6a17
|
Provenance
The following attestation bundles were made for powerio-0.0.1-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
python.yml on eigenergy/powerio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerio-0.0.1-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
45dbcffb954f760910fc82ff4b59656afd8ba79f14142202d64c5457359761bc - Sigstore transparency entry: 1773745438
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@db944afe3819b2efd67060eda056003846f8e8ad -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@db944afe3819b2efd67060eda056003846f8e8ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.0.1-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: powerio-0.0.1-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72810a8f4b9b4e7f39391af8ef4e8b4c432fe2bd4b21490f22271d0d66611749
|
|
| MD5 |
af9979dbedea8f6ea221e2a67686dff5
|
|
| BLAKE2b-256 |
f67298be72b90420777eff6cba85db81c96c9f2ed47059810fe5f9a17b1b08dc
|
Provenance
The following attestation bundles were made for powerio-0.0.1-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
python.yml on eigenergy/powerio
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
powerio-0.0.1-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
72810a8f4b9b4e7f39391af8ef4e8b4c432fe2bd4b21490f22271d0d66611749 - Sigstore transparency entry: 1773744370
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@db944afe3819b2efd67060eda056003846f8e8ad -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@db944afe3819b2efd67060eda056003846f8e8ad -
Trigger Event:
release
-
Statement type: