Skip to content

eigenergy/PowerIO.jl

Repository files navigation

PowerIO.jl

PowerIO logo

Julia entry point for PowerIO: parser, compiler package, and IR infrastructure for power system software. The Rust core reads case files, writes them back, converts between formats, and exposes the same model through Julia, Python, C/C++, and Rust.

Documentation: eigenergy.github.io/PowerIO.jl

Supported transmission formats:

Supported distribution formats:

  • OpenDSS .dss
  • PowerModelsDistribution ENGINEERING JSON
  • IEEE BMOPF JSON

PowerIO package JSON (.pio.json) carries either model between PowerIO consumers with provenance and diagnostics. to_json / from_json expose the balanced model's internal JSON snapshot; use .pio.json packages or a named exchange format for files shared with other tools.

Each classical exchange format reads and writes where the Rust core has a writer, so any supported pair converts. A same format round trip is byte exact; cross format conversion reports fields the target cannot represent as warnings. Multiconductor distribution cases parse into the separate MulticonductorNetwork model through the same verbs; see the distribution guide. GridFM Parquet readback and GO Challenge 3 helpers round out the data import surface.

PowerIO format and matrix flow

Install

pkg> add PowerIO

Released versions fetch the per-platform powerio-capi binary as a lazy artifact; users never build Rust. Working on the binding itself needs a local build; see Develop below.

Use

using PowerIO

net = parse_file("case14.m")
net isa BalancedNetwork
PowerIO.buses(net)             # raw bus table
length(PowerIO.buses(net))     # bus count
PowerIO.n_buses(net)           # stable accessor over the parsed payload
PowerIO.n_gens(net), PowerIO.base_mva(net)
PowerIO.source_format(net)        # "Matpower"
PowerIO.reference_bus_id(net)     # the slack bus id (or nothing)

text, warnings = convert_file("case14.m", "psse")

# egret and PowerModels both use .json; pass `from` to disambiguate:
egret = parse_file("grid.json"; from="egret")

The main transforms off a parsed network:

to_normalized(net)                 # per unit, radians, filtered copy
to_normalized(net; clamp_angle_bounds=true)
to_dense(net)                      # dense typed arrays for matrix assembly
to_arrow(net, :branch)             # one table over the Arrow C Data Interface
to_arrow(net, :bprime)             # matrix Arrow COO selectors
to_matpower(net)                   # byte exact when the input was MATPOWER
to_format(net, "powermodels-json") # (text, warnings)
to_powermodels(net)                # PowerModels.jl network data Dict
to_powerdata(net)                  # ExaPowerIO PowerData NamedTuple
to_package(net)                    # .pio.json compiler package
features()                         # optional C ABI surfaces
dist_capabilities()                # BMOPF distribution fidelity flags

Distribution cases share the verbs, routed by format:

dn = parse_file("feeder.dss")        # ::MulticonductorNetwork, element tables + handle
PowerIO.buses(dn), PowerIO.lines(dn), PowerIO.transformers(dn)
PowerIO.to_graph(dn)
text, warnings = to_format(dn, "pmd")

The transmission, distribution, and interop guides cover the full surface: accessors, Arrow export, .pio.json packages, the gridfm reader, and GO Challenge 3 helpers.

At first use the binding checks pio_abi_version against the core ABI version it targets and refuses a stale or mismatched library with an error stating both versions. Distribution entry points also check pio_dist_abi_version.

Interop

Target Direction Mechanism
PowerModels.jl both to_powermodels / from_powermodels
BMOPFTools.jl both PowerIO backed OpenDSS / BMOPF conversion
ExaPowerIO.jl / ExaModelsPower.jl out to_powerdata / parse_ac_power_data feeding build_polar_opf / build_rect_opf / build_dcopf
PowerGridPlanning.jl out to_powermodels, build_ref, and angle repair helpers
powerio-pkg .pio.json both models to_package / from_package / read_package / write_package
PowerDiff.jl out PowerDiff depends on PowerIO as its parser and data layer
MATPOWER / PSS/E / PowerWorld / PSLF / PowerModels JSON / egret / pandapower / PyPSA / Surge file parse_file / convert_file
GridFM (gridfm-datakit Parquet) in read_gridfm / read_gridfm_scenarios
OpenDSS / PowerModelsDistribution / IEEE BMOPF (distribution) both format-routed parse_file / to_format / convert_file

The parse_file / to_* naming is shared across Rust, Python, Julia, and the C ABI; the cross language table is in docs/src/languages.md.

Develop

With a sibling powerio checkout, build the C ABI and using PowerIO finds it:

# in the sibling powerio checkout:
cargo build -p powerio-capi --release --features arrow,matrix,gridfm,dist,pkg

For a non-sibling layout, point Julia at the library explicitly:

PowerIO.set_library!("/path/to/libpowerio_capi.dylib")
# or: ENV["POWERIO_CAPI"] = "...path..."  before `using PowerIO`

# Save the override in LocalPreferences.toml for this Julia environment:
PowerIO.set_library!("/path/to/libpowerio_capi.dylib"; persist=true)
PowerIO.clear_library!(persist=true)

The artifact pipeline behind released versions is described in docs/src/binary.md.

Version line

0.6.2 tracks powerio v0.6.2 in lockstep: core C ABI 4, distribution C ABI 1, with the Arrow, matrix, GridFM, distribution, package, BMOPF fidelity, and study package surfaces enabled in the released artifacts. The Julia package stays thin around the C ABI while owning stable Julia entry points for parsing, conversion, packages, dense tables, Arrow tables, distribution networks, GridFM, and ecosystem interop. PowerIO_jll remains the later distribution cleanup. Version history is in CHANGELOG.md.

License

MIT.

About

Power system compiler infrastructure

Topics

Resources

License

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages