Fast case parsing and conversion: "pandoc for power systems"
Project description
PowerIO
PowerIO is a fast, universal parser and converter for power system case files. It aspires to be "the pandoc for power systems."
Using PowerIO, you can build sparse matrices and graph views for downstream analysis and solver code. PowerIO can serve as a drop-in replacement for the data layers of many popular community libraries, enhancing interoperability between diverse packages and formats.
PowerIO is implemented in Rust with a low-level C ABI; any language with a C foreign function interface (FFI) can call it, including Python and Julia. You can also use it directly in Rust itself or through the command line.
Overview
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 explicitly emits Conversion::warnings for fields the target format cannot represent.
Formats
The following formats are currently supported with read/write functionality:
- MATPOWER
.m - PSS/E
.rawrevision 33 - PowerWorld
.aux, plus read only.pwbbinary cases;.pwddisplay files parse through the separate display API. Vintage coverage and decode evidence live in docs/powerworld.md. - PowerModels.jl network data JSON
- egret
ModelDataJSON - pandapower
pandapowerNetJSON - PyPSA static CSV folders
- GridFM
.parquet
Support for the following formats is under development (see the open pull requests):
- surge
.surge.json - PowerModelsDistribution.jl engineering data JSON
- IEEE BMOPF schema
.json
Other formats are planned; see the GitHub issues. If a format you need is missing, open an issue or a pull request. All are welcome to contribute to this community project.
Packages
This repository contains multiple 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
The core powerio Rust crate is as dependency light as possible, with its companion Python package requiring zero dependencies.
API docs: https://eigenergy.github.io/powerio/. Language API map: languages guide.
Install
cargo add powerio
cargo add powerio-matrix
cargo install 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
Rust
use powerio::{TargetFormat, parse_file};
let parsed = parse_file("case14.m", None)?;
let net = parsed.network;
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]
display = pio.parse_display_file("case.pwd")
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 convert tests/data/case14.m --to pandapower-json -o case14.pp.json
powerio convert tests/data/case14.m --to pypsa-csv -o pypsa_case
powerio convert pypsa_case --from pypsa-csv --to matpower -o case14.m
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
Features
Current Format Fidelity
| reader / writer | MATPOWER | PowerModels JSON | PSS/E | PowerWorld | egret JSON | pandapower JSON |
|---|---|---|---|---|---|---|
| MATPOWER | original text | full | partial | partial | partial | partial |
| PowerModels JSON | partial | original text | partial | partial | partial | partial |
| PSS/E | full | full | original text | partial | partial | partial |
| PowerWorld | full | full | partial | original text | partial | partial |
PowerWorld .pwb |
full | full | partial | partial | partial | partial |
| egret JSON | partial | full | partial | partial | original text | partial |
| pandapower JSON | partial | partial | partial | partial | partial | original text |
partial means the target lacks fields present in the source. The writer reports
those cases in Conversion::warnings. PowerWorld .pwb is read only (no
writer, no retained source): the row shows where its decoded power flow core
lands. PowerWorld .pwd is display data, not a network case, so it is outside
this conversion table and uses parse_display_file / parse_display_bytes.
The decoded vintages and per field evidence live in
docs/powerworld.md.
PyPSA CSV folders and GridFM Parquet are not in this table only because they
are directory datasets, not single text outputs. Both read and write: PyPSA
with regenerable committed fixtures (tests/data/pypsa/README.md), GridFM
with a deliberately lossy read that recovers the power flow core. Known
limits for every format are documented in
the format fidelity guide.
Matrices
The powerio-matrix Rust crate derives an IndexedNetwork with dense bus indices. It enables you to build common power system matrices with minimal dependencies:
- 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
- Adjacency matrix and
petgraphview - Matrix Market bundles for low-level OPF solvers
- KKT operators for OPF solvers (experimental)
Current conventions for signs, taps, phase shifts, per unit scaling, reference buses, and line parameters are documented in the matrices guide.
Normalized View
Network::to_normalized derives a mildly opinionated, post-processed copy of a case that is designed to be solver-friendly:
- powers are in per unit,
- voltage phase angles are in radians,
- inactive elements are removed,
tap == 0replaced with1,- surviving buses keep their source bus ids, and
- bus types are made consistent with generator placement and reference buses.
The normalized copy carries no retained source text, so writing it 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).
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.
PowerAgent
PowerIO is part of the PowerAgent community. The Python interface for PowerIO currently includes an optional MCP server exposing low-level conversion, summaries, JSON transport, matrix views, and file staging as tools.
pip install 'powerio[mcp]'
powerio-mcp
The PowerIO MCP server is currently being integrated as the low-level data exchange substrate for the MCP server bundle in PowerMCP. The PowerMCP bundle ships the same tool surface as PowerIO alongside a wide array of simulator servers, whose bridges ingest the transport directly.
GridFM (experimental)
PowerIO ships first-class support for the LF Energy open Grid Foundation Model (GridFM) project. In the command line:
powerio gridfm <case> -o <dir>
This writes the Parquet tables gridfm-datakit and
gridfm-graphkit consume under <dir>/<case>/raw/; several compatible cases
stack by scenario id.
The gridfm feature also supports reading a .parquet dataset back into a Network (read_gridfm_dataset in powerio-matrix, pio.read_gridfm in
Python), so a perturbed training scenario or a GNN predicted state can be extracted and converted back
out in any classical format:
powerio convert out/case14/raw --from gridfm --to matpower -o case14.m
The --from gridfm read functionality is currently lossy. What it recovers, what it drops, and the warnings contract
are in the format fidelity guide. Improving gridfm read/write functionality is a key priority for the initial development of PowerIO.
Validation
The Rust test suite covers parsers, writers, format conversion, matrix
builders, and normalization; the C ABI crate carries its own tests, and
pytest covers the Python bindings. The benchmark validation suite compares
selected outputs against PowerModels.jl, egret, ExaPowerIO.jl, and pandapower,
and imports PowerIO's PyPSA CSV folders with PyPSA when the optional oracle is
installed.
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.2.3.tar.gz.
File metadata
- Download URL: powerio-0.2.3.tar.gz
- Upload date:
- Size: 310.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be808fb823f704a07d95fd191a67bf32ae02c1a9996f8b690617bea61e45f110
|
|
| MD5 |
8de190005645366015819df54325bfd3
|
|
| BLAKE2b-256 |
25bd53c9d5bde97693766b2065204ad140d990a22da810f7f0beec09e3605c6b
|
Provenance
The following attestation bundles were made for powerio-0.2.3.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.2.3.tar.gz -
Subject digest:
be808fb823f704a07d95fd191a67bf32ae02c1a9996f8b690617bea61e45f110 - Sigstore transparency entry: 1821579319
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.2.3-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: powerio-0.2.3-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 2.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 |
c4708a78d116dc00b2d6f83dde8f719ceba0e3fd2c998f2d48dab62be653b05e
|
|
| MD5 |
f2a5f4593715b56238afcb7750766858
|
|
| BLAKE2b-256 |
86e8da0241525c80fb860b529990f1aab7063158bd94772975bdbeda974e368c
|
Provenance
The following attestation bundles were made for powerio-0.2.3-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.2.3-cp39-abi3-win_amd64.whl -
Subject digest:
c4708a78d116dc00b2d6f83dde8f719ceba0e3fd2c998f2d48dab62be653b05e - Sigstore transparency entry: 1821579402
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.2.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: powerio-0.2.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.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 |
f30acaf2fbc149e623977d2acda14736dec5b025117240dfb80896d3689bf9a4
|
|
| MD5 |
aadbf8501913750d3735ca024aebd902
|
|
| BLAKE2b-256 |
35eaacfe7ba207b4e833b4cbc83e8ea423635a1c6fb36334e966c38e3ff83b85
|
Provenance
The following attestation bundles were made for powerio-0.2.3-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.2.3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
f30acaf2fbc149e623977d2acda14736dec5b025117240dfb80896d3689bf9a4 - Sigstore transparency entry: 1821579423
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.2.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: powerio-0.2.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.4 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 |
8c239d076c5c8447e53ccbe750c2271a90b7f071a10362ad00ca5d05a6e2f39f
|
|
| MD5 |
fef9c7329907c3f1f7d1487317b83559
|
|
| BLAKE2b-256 |
b0e13ae3e013c81f252489761a313547628ac15c09a55137c3e359f4aa54ca5d
|
Provenance
The following attestation bundles were made for powerio-0.2.3-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.2.3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
8c239d076c5c8447e53ccbe750c2271a90b7f071a10362ad00ca5d05a6e2f39f - Sigstore transparency entry: 1821579369
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.2.3-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: powerio-0.2.3-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.3 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 |
81f7d753e7295cf87775192e20044f201a01932be3706c52ce4ac4c752e658a4
|
|
| MD5 |
78d06495068b4bb788d01e0f1a0b6ec0
|
|
| BLAKE2b-256 |
840c2e79e94bc4cd66418b7f0e083f82499e94e93e37f61f3b3aabd0824ed3da
|
Provenance
The following attestation bundles were made for powerio-0.2.3-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.2.3-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
81f7d753e7295cf87775192e20044f201a01932be3706c52ce4ac4c752e658a4 - Sigstore transparency entry: 1821579507
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file powerio-0.2.3-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: powerio-0.2.3-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.5 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 |
eb4071b32af320c2b6a6f736b949c1a12a7b1d3ed27d48bbd4bb0a86c4c0e20b
|
|
| MD5 |
7e46bd60d7993ef21a8d6eaec93e5ec4
|
|
| BLAKE2b-256 |
ef4c4d70cbae82f031001031381a331abe870ea684d4d6ee2a8bd1293bf14a79
|
Provenance
The following attestation bundles were made for powerio-0.2.3-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.2.3-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
eb4071b32af320c2b6a6f736b949c1a12a7b1d3ed27d48bbd4bb0a86c4c0e20b - Sigstore transparency entry: 1821579528
- Sigstore integration time:
-
Permalink:
eigenergy/powerio@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Branch / Tag:
refs/tags/v0.2.3 - Owner: https://github.com/eigenergy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python.yml@7d532ce16ef7beccdf72b83998e1cdba96cb9eb7 -
Trigger Event:
release
-
Statement type: