PowerIO

Parses power system case files into a typed Network, converts between formats, and builds sparse matrices and graph representations for solver and analysis code.
https://github.com/eigenergy/powerio

Category: Energy Systems
Sub Category: Energy Data Accessibility and Integration

Keywords

converter electrical-engineering interoperability parser parsing-library power-systems

Last synced: about 17 hours ago
JSON representation

Repository metadata

Power system compiler infrastructure

README.md

PowerIO

PowerIO is compiler infrastructure for power systems. Case files from a dozen
transmission and distribution formats parse into typed intermediate
representations (IR). Once parsed, you can perform explicit, recorded operations, like normalization, validation, and lowering.
You can compile/write the case back into any supported target format, sparse matrix families, and ML model formats.

The .pio.json package serves as a unified network payload under declared schema versions,
which records where the data came from, and how it maps back to the original source file.
Furthermore, the package contains structured diagnostics, validation, and replayable operating points, enabling many downstream tasks.

Data fidelity and interoperability is the primary goal of the PowerIO project. Writing a parsed file back to its own format returns
the original text when the reader kept it. Converting to another format writes
the modeled electrical data and reports every field the target cannot carry in
Conversion::warnings.

The core of PowerIO is written in Rust. The Rust version is used to create the Python package and the command line interface, both of which sit in this repo. The Rust implementation also enables the creation of a C ABI, which exposes PowerIO capabilities to C, C++, Julia, and other foreign function interfaces (FFIs).

Overview

PowerIO is a community infrastructure project intended to serve all developers working on electric power systems. Everyone is welcome to use, build upon, and contribute to the PowerIO infrastructure project.

Formats

Supported formats:

Distribution networks are supported in wire coordinates via powerio-dist:

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 representations
powerio-dist     # multiconductor distribution model, dss/PMD/BMOPF converters
powerio-pkg      # .pio.json compiler package envelope
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 keeps parsing
and conversion separate from matrix, TUI, and data frame dependencies. The
Python package imports with no required
third party packages; matrix and graph helpers live behind extras.

Docs site: https://powerio.dev.
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 psse35 -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 convert case.epc --from pslf --to matpower -o case.m
powerio convert case.surge.json --from surge-json --to matpower -o case.m
powerio convert goc3_case.json --from goc3-json --to matpower -o case.m
powerio package tests/data/case14.m -o case14.pio.json
powerio package goc3_case.json --from goc3-json -o goc3_case.pio.json
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

Every network reader lowers to Network. The table separates writing back to
the original file type from converting to a different file type.

file type read write writing back to the original file type converting to another file type
MATPOWER .m yes yes byte exact retained source canonical MATPOWER blocks; warnings for fields MATPOWER cannot carry
PowerModels JSON yes yes byte exact retained source per unit structured data checked against PowerModels.jl
PSS/E .raw yes yes byte exact only when writing the source revision power flow core; revision downgrade and unsupported records are warned
PowerWorld .aux yes yes byte exact retained source power flow core; PowerWorld only fields are projected or warned
PowerWorld .pwb yes no n/a read only binary case; decoded core converts through every text writer
PSLF .epc yes yes byte exact retained source power flow core; unsupported EPC sections are read warnings
egret JSON yes yes byte exact retained source ModelData shape checked against egret and PowerModels.jl
pandapower JSON yes yes byte exact retained source pandapower import validator checks counts and Y_bus
PyPSA CSV folder yes yes directory output, not text echo PyPSA import validator checks the exported static components
GO Challenge 3 JSON yes source echo only byte exact retained source first interval maps to the static power flow core; .pio.json packages retain time series as operating points
Surge JSON yes yes byte exact retained source versioned JSON network body; unsupported source sections stay in retained source or warnings
GridFM Parquet yes yes directory output, deliberately lossy read recovers the power flow core for conversion back to classical formats
PowerIO JSON yes yes structured model snapshot, not byte exact source echo lossless for Network fields except retained source text

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 are maintainer notes at
powerio/src/format/powerworld/FORMAT.md.

The distribution matrix (dss, PMD JSON, BMOPF JSON, per fixture) is generated
under powerio-dist/docs/. Vendored test data keeps its own licenses next to
the fixtures under tests/data/dist/.

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 petgraph graph output
  • Matrix Market bundles for 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 Form

Network::to_normalized derives a post processed copy of a case for solvers:

  • powers are in per unit,
  • voltage phase angles are in radians,
  • inactive elements are removed,
  • tap == 0 replaced with 1,
  • 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 form as case.to_normalized(), the C ABI as pio_normalize,
and Julia as to_normalized(case).

C ABI

powerio-capi exposes parse, query, conversion, JSON transport, normalization,
.pio.json package handles, and numeric table extraction through pio_*
functions. The public header is
powerio-capi/include/powerio.h.
Build with --features arrow to enable pio_to_arrow over the
Arrow C Data Interface.

PowerAgent

PowerIO is part of the PowerAgent community. The Python package includes an optional MCP server with tools for conversion, saving, summaries, parsing, normalization, matrix outputs, and display data.

pip install 'powerio[mcp]'
powerio-mcp

MCP clients can keep a case in the .pio.json package transport:

parsed = parse(path="case9.m", transport="package")
pkg = parsed["package_json"]
summary(package_json=pkg)
matrix("bprime", package_json=pkg)
save(out_path="case9.raw", to_format="psse", package_json=pkg)
diagnostics(pkg)

The PowerMCP bundle in PowerMCP uses the same PowerIO tool surface alongside simulator servers and bridge tools.

Compiler Packages

.pio.json packages wrap one balanced or multiconductor payload with provenance,
source maps, diagnostics, validation, summaries, lowering history, optional
derived metadata, and optional operating_points. A GO Challenge 3 package
stores the static first interval in model and the full replayable time series
in operating_points; materializing one point returns a static package with the
updates applied and the series cleared.

Rust uses powerio_pkg::NetworkPackage, Python uses the powerio.Package
class, the C ABI uses pio_package_*, and the CLI writes packages with
powerio package.

GridFM (experimental)

PowerIO writes datasets 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 path is lossy. What it recovers, what it drops, and its warning behavior
are in the format fidelity guide.

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. Install the oracle stack
from benchmarks/requirements.txt into the same Python 3.11+ venv that holds
the local powerio wheel.

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 the
performance guide.

License

PowerIO is distributed under either of:


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 4 days ago

Total Commits: 151
Total Committers: 4
Avg Commits per committer: 37.75
Development Distribution Score (DDS): 0.066

Commits in past year: 151
Committers in past year: 4
Avg Commits per committer in past year: 37.75
Development Distribution Score (DDS) in past year: 0.066

Name Email Commits
Samuel Talkington 1****i 141
Qian Zhang q****g@g****u 5
Cameron Khanpour 9****r 4
dependabot[bot] 4****] 1

Committer domains:


Issue and Pull Request metadata

Last synced: 10 days ago

Total issues: 55
Total pull requests: 36
Average time to close issues: 8 days
Average time to close pull requests: about 24 hours
Total issue authors: 4
Total pull request authors: 5
Average comments per issue: 0.58
Average comments per pull request: 1.14
Merged pull request: 33
Bot issues: 0
Bot pull requests: 1

Past year issues: 55
Past year pull requests: 36
Past year average time to close issues: 8 days
Past year average time to close pull requests: about 24 hours
Past year issue authors: 4
Past year pull request authors: 5
Past year average comments per issue: 0.58
Past year average comments per pull request: 1.14
Past year merged pull request: 33
Past year bot issues: 0
Past year bot pull requests: 1

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/eigenergy/powerio

Top Issue Authors

  • samtalki (50)
  • cameronkhanpour (2)
  • frederikgeth (2)
  • MohamedNumair (1)

Top Pull Request Authors

  • samtalki (30)
  • cameronkhanpour (3)
  • matheusduartedm (1)
  • dependabot[bot] (1)
  • qian-harvard (1)

Top Issue Labels

  • interop (14)
  • enhancement (11)
  • julia (4)
  • rust (2)
  • adapter (2)
  • documentation (1)
  • format-fidelity (1)
  • ir (1)
  • partner-ravens (1)
  • dynamic (1)

Top Pull Request Labels

  • dependencies (1)
  • rust (1)

Package metadata

pypi.org: powerio

Case parsing, conversion, matrices, and language bindings for power system data

  • Homepage:
  • Documentation: https://eigenergy.github.io/powerio/
  • Licenses: MIT OR Apache-2.0
  • Latest release: 0.7.1 (published 10 days ago)
  • Last Synced: 2026-07-20T10:17:51.154Z (4 days ago)
  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 4,885 Last month
  • Rankings:
    • Dependent packages count: 7.066%
    • Average: 23.518%
    • Dependent repos count: 39.971%
  • Maintainers (1)
crates.io: powerio-pkg

The .pio.json document model: one PowerIO model JSON object with explicit model kind, provenance, source maps, structured diagnostics, validation, and lowering history.

  • Homepage: https://eigenergy.github.io/powerio/
  • Documentation: https://docs.rs/powerio-pkg/
  • Licenses: MIT OR Apache-2.0
  • Latest release: 0.7.1 (published 10 days ago)
  • Last Synced: 2026-07-20T10:17:49.993Z (4 days ago)
  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 255 Total
  • Rankings:
    • Dependent repos count: 13.664%
    • Dependent packages count: 18.049%
    • Average: 40.242%
    • Downloads: 89.012%
  • Maintainers (1)
crates.io: powerio-dist

Multiconductor distribution network model and lossless converters for OpenDSS, PMD JSON, and BMOPF JSON.

  • Homepage: https://eigenergy.github.io/powerio/
  • Documentation: https://docs.rs/powerio-dist/
  • Licenses: MIT OR Apache-2.0
  • Latest release: 0.7.1 (published 10 days ago)
  • Last Synced: 2026-07-20T10:17:47.020Z (4 days ago)
  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 379 Total
  • Rankings:
    • Dependent repos count: 13.915%
    • Dependent packages count: 18.38%
    • Average: 40.48%
    • Downloads: 89.145%
  • Maintainers (1)
crates.io: powerio-cli

Command line interface and ratatui TUI for powerio: parse and convert power system case files and emit matrices.

  • Homepage: https://eigenergy.github.io/powerio/
  • Documentation: https://docs.rs/powerio-cli/
  • Licenses: MIT OR Apache-2.0
  • Latest release: 0.7.1 (published 10 days ago)
  • Last Synced: 2026-07-20T10:17:47.041Z (4 days ago)
  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 346 Total
  • Rankings:
    • Dependent repos count: 14.148%
    • Dependent packages count: 18.686%
    • Average: 40.719%
    • Downloads: 89.322%
  • Maintainers (1)
crates.io: powerio

Compiler infrastructure for power systems: parse, convert, validate, and lower grid models

  • Homepage: https://eigenergy.github.io/powerio/
  • Documentation: https://docs.rs/powerio/
  • Licenses: MIT OR Apache-2.0
  • Latest release: 0.7.1 (published 10 days ago)
  • Last Synced: 2026-07-20T10:17:47.151Z (4 days ago)
  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 852 Total
  • Rankings:
    • Dependent repos count: 14.148%
    • Dependent packages count: 18.686%
    • Average: 40.719%
    • Downloads: 89.322%
  • Maintainers (1)
crates.io: powerio-matrix

Sparse matrices and graph outputs for power system case files, built on powerio.

  • Homepage: https://eigenergy.github.io/powerio/
  • Documentation: https://docs.rs/powerio-matrix/
  • Licenses: MIT OR Apache-2.0
  • Latest release: 0.7.1 (published 10 days ago)
  • Last Synced: 2026-07-20T10:17:50.804Z (4 days ago)
  • Versions: 21
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 448 Total
  • Rankings:
    • Dependent repos count: 14.148%
    • Dependent packages count: 18.686%
    • Average: 40.719%
    • Downloads: 89.322%
  • Maintainers (1)

Score: 13.901122956840195