PowerIO.jl

PowerIO.jl is the Julia binding of PowerIO, a compiler for power system data. It reads grid exchange formats (MATPOWER, PSS/E RAW and RAWX, XIIDM and JIIDM, CGMES, UCTE-DEF, IEEE CDF, PowerWorld, PSLF, PyPSA, GridFM, OpenDSS, PMD JSON, BMOPF, and the PowerModels, Egret, pandapower, and Surge JSON dialects) into typed Julia values, writes them back out, and computes the matrices power flow and optimization code needs.

using Pkg; Pkg.add("PowerIO")

Requires Julia 1.10 or newer. Save case9.m in your working directory before running the example below.

using PowerIO

case = parse("case9.m")              # PioModule{BalancedNetwork}
net = case.value
length(net.buses)                    # 9
net.branches[1].reactance_pu         # 0.0576
[g.active_power_mw for g in net.generators]
case.diagnostics                     # what the reader kept, defaulted, or dropped

emit(case, "matpower", "copy.m")     # same format: the original file, unchanged
result = emit(case, "psse")          # another format, in memory
result.text
result.diagnostics                   # what PSS/E cannot carry

serialize(case, "case9.pio.json")    # PowerIO IR, for other PowerIO consumers

Operations

The operations share their names with the Rust, Python, and C APIs:

OperationWhat it does
parse(source; format)reads one grid exchange source into a PioModule{T}
emit(module, format, destination)writes a grid exchange format
serialize(module, destination) and deserialize(source)move PowerIO IR between PowerIO consumers
calc_*(net)computes a matrix or vector
to_*(module)constructs another value type in memory
apply_updates!(module, updates)changes a module in place

Element tables are properties of a network (net.buses, net.branches, net.lines) and behave as Julia vectors of immutable structs. Indices are 1-based, in the tables and in the sparse matrices alike. parse extends Base.parse, so the bare name works after using PowerIO.

Pages

Version compatibility

VersionDescribes
PowerIO.jl 0.12 / PowerIO 0.12The package APIs documented here
PowerIO IRThe document written by serialize; its version names the PowerIO release whose schema it follows
C ABIThe interface to the native library; it only gains symbols within a release series

A binding generated from the header of one PowerIO release works with a library from the same release series at that release or a newer one. Use a matching library when developing this binding. Regenerate stored 0.10 modules from their original grid data before loading them in 0.11. The migration guide lists the API replacements.

The C library

PowerIO.jl calls the powerio C library (libpowerio_capi). You do not normally have to find it yourself: on a supported platform the bundled artifact is used, and during development a sibling powerio checkout's build is picked up. To point at another build, call set_library! or set the POWERIO_CAPI environment variable. library_available tells you whether a compatible library was found, and library_version which PowerIO release it comes from. A compatible library comes from the release series of the header this binding was generated from, at that header's release or a newer one; any other library is refused at first use with an error that names both releases.