Language map

The Rust, Python, Julia, and C APIs use the same names for the same operations. The complete table is in the powerio documentation (Rust, Python, Julia, and C); this page covers what is specific to Julia.

MeaningJuliaPythonC ABI 7
acquire a pathparse("case.m")parse(Path("case.m"))pio_source_open
acquire memoryparse(io; name), parse(bytes; name)pass a file or bytes-like objectpio_source_from_memory
parseparse(source; format)parse(source, format=...)pio_parse
module valuem.valuemodule.valuepio_module_value
module diagnosticsm.diagnosticsmodule.diagnosticspio_module_diagnostics
emit a formatemit(m, format, destination)emit(module, format, destination)pio_emit
serialize IRserialize(m, destination)serialize(module, destination)pio_module_serialize
deserialize IRdeserialize(source)deserialize(source)pio_module_deserialize
apply updatesapply_updates!(m, updates)apply_updates(module, updates)pio_apply_updates
bus tablenet.buses (Elements{Bus})network.buses (list of dicts)pio_balanced_network_bus_count, pio_balanced_network_bus_at
time series entryseries[1]series[0]pio_time_series_get(series, 0)
scenario entryscenarios["7"]scenarios["7"]pio_scenario_set_get

Julia specifics

parse extends Base.parse with methods for a path string, an IO, and a byte vector. No Base method takes one positional argument, so existing code is unaffected and the bare name works after using PowerIO.

There is no kind enum. You find out what a module holds by dispatching on its type: PioModule{BalancedNetwork}, PioModule{TimeSeries{BalancedNetwork}}, and so on.

Tables are properties returning AbstractVectors of immutable structs. Field names follow the C header (vm_pu, active_power_mw), whereas Python uses the MATPOWER short names (vm, pg).

Indices are 1-based: collection entries, sparse matrix positions, and the to_dense bus rows. Bus ids and component ids are source identifiers and do not change at the language boundary.

Errors are PowerIOError exceptions with the code, message, and diagnostics. Python raises PowerIOError subclasses, and C writes one PioError.

Functions that mutate their argument end in !: apply_updates!, set_library!, repair_powermodels_angle_bounds!.

Only Rust and C have a Source type, because those languages need an explicit owner for acquired bytes. A Julia path, IO, or byte vector already says where the bytes come from and who owns them.

The admittance matrices (calc_admittance_matrix, calc_bprime_matrix, calc_bdoubleprime_matrix) are assembled in Julia, whereas Python reaches the Rust implementation directly. The eight DC calculations come from the library in all four languages.