Skip to main content

Crate powerio_dist

Crate powerio_dist 

Source
Expand description

powerio-dist: a multiconductor distribution network model and lossless converters between OpenDSS .dss, PowerModelsDistribution ENGINEERING JSON (“PMD JSON”), and the draft JSON schema of the IEEE PES Task Force on Benchmarking Multiconductor OPF (“BMOPF JSON”, https://github.com/frederikgeth/bmopf-report).

The canonical model is a network in wire coordinates: string bus ids, ordered string terminal names per bus, explicit grounding, terminal maps on every element, SI units and radians internally (BMOPF semantics, the most explicit of the three formats). The transmission model in the powerio crate is positive sequence and stays separate; the two crates share conventions, not types.

let net = powerio_dist::parse_file("feeder.dss", None)?;
for w in &net.warnings {
    eprintln!("parse: {w}");
}
let conv = net.to_format(powerio_dist::DistTargetFormat::PmdJson);

§Fidelity contract

The contract matches powerio. Writing back to the source format reproduces the file byte for byte via retained source text. Every cross format conversion regenerates from the typed model and reports each field the target cannot represent in Conversion::warnings; nothing drops silently. The dss reader materializes every OpenDSS class default into an explicit model value and records which fields were defaulted (DistNetwork::defaulted), so BMOPF output is always fully explicit. The per fixture results live in docs/conversion-matrix.md.

§Float formatting

Canonical output formats every number as its shortest round trip representation: Rust’s Display for .dss, serde_json (ryu) for both JSON formats. The readers parse with serde_json’s float_roundtrip feature, so a parse of canonical output recovers the exact bit pattern and canonical writes are idempotent. JSON cannot carry Inf/NaN: the PMD writer emits null (PMD restores the value from the field name suffix), and the BMOPF writer emits 0 with a warning, since the schema requires numbers. The byte exact echo tier is unaffected; it never reformats.

Re-exports§

pub use bmopf::parse_bmopf_file;
pub use bmopf::parse_bmopf_str;
pub use bmopf::write_bmopf_json;
pub use convert::Conversion;
pub use convert::DistTargetFormat;
pub use convert::convert_file;
pub use convert::convert_str;
pub use convert::dist_target_from_name;
pub use convert::parse_file;
pub use convert::parse_str;
pub use dss::parse_dss_file;
pub use dss::parse_dss_str;
pub use dss::write_dss;
pub use error::Error;
pub use error::Result;
pub use model::Configuration;
pub use model::DistBus;
pub use model::DistGenerator;
pub use model::DistLine;
pub use model::DistLineCode;
pub use model::DistLoad;
pub use model::DistLoadVoltageModel;
pub use model::DistNetwork;
pub use model::DistShunt;
pub use model::DistSourceFormat;
pub use model::DistSwitch;
pub use model::DistTransformer;
pub use model::Extras;
pub use model::Mat;
pub use model::MulticonductorNetwork;
pub use model::UntypedObject;
pub use model::VoltageSource;
pub use model::Winding;
pub use model::WindingConn;
pub use pmd::parse_pmd_file;
pub use pmd::parse_pmd_str;
pub use pmd::write_pmd_json;

Modules§

bmopf
The draft BMOPF task force JSON schema (frederikgeth/bmopf-report).
convert
Cross format conversion output and the format dispatcher.
dss
OpenDSS .dss support: tokenizer, RPN, class tables, raw object layer.
error
model
The canonical multiconductor network model.
pmd
The PowerModelsDistribution ENGINEERING model as JSON (“PMD JSON”).