Skip to main content

Crate powerio_dist

Crate powerio_dist 

Source
Expand description

Multiconductor distribution network models and converters for 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/distribution-system-opt/dsopt-schema).

The model uses wire coordinates: string bus IDs, ordered terminal names, explicit grounding, terminal maps on every element, SI units, and radians. The transmission model in powerio is positive sequence and remains a separate type.

let source = powerio_core::Source::open("feeder.dss")?;
let module = powerio_dist::parse(source)?;
for line in powerio_dist::diagnostics::render_diagnostics(module.diagnostics()) {
    eprintln!("parse: {line}");
}
let emitted = powerio_dist::emit(
    &module,
    powerio_dist::DistTargetFormat::PmdJson,
    powerio_core::Destination::memory("feeder.pmd.json")?,
)?;
for line in powerio_dist::diagnostics::render_diagnostics(emitted.diagnostics()) {
    eprintln!("emit: {line}");
}

§Fidelity rules

Emitting to the retained source format returns the original bytes. Cross format emission uses the typed model and reports fields the target cannot represent through powerio_core::EmitResult::diagnostics. The DSS reader expands OpenDSS class defaults into explicit model values and records them in MulticonductorNetwork::defaulted. BMOPF output includes those values. 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 emissions are idempotent. JSON cannot carry Inf/NaN: the PMD emitter uses null (PMD restores the value from the field name suffix), and the BMOPF emitter uses 0 with a warning, since the schema requires numbers. The byte exact echo tier is unaffected; it never reformats.

Re-exports§

pub use bmopf::BMOPF_SCHEMA_ID;
pub use bmopf::BMOPF_SCHEMA_VERSION;
pub use bmopf::BmopfEmitOptions;
pub use bmopf::BmopfSchemaVersion;
pub use convert::DistTargetFormat;
pub use convert::EmitOptions;
pub use convert::classify_distribution_json;
pub use convert::emit;
pub use convert::emit_with_options;
pub use convert::parse;
pub use convert::parse_dist_target_format;
pub use dss::DssEmitOptions;
pub use dss::DssLoadVoltageBounds;
pub use error::Error;
pub use error::Result;
pub use geo::CoordinateSpace;
pub use geo::DistCanvas;
pub use geo::DistCoordsKind;
pub use geo::DistGeoMeta;
pub use geo::DistLocation;
pub use graph::DistGraph;
pub use graph::DistGraphAttachment;
pub use graph::DistGraphAttachmentKind;
pub use graph::DistGraphBus;
pub use graph::DistGraphEdge;
pub use graph::DistGraphEdgeKind;
pub use model::ActivePowerReference;
pub use model::ActivePowerUnit;
pub use model::ConductorMatrix;
pub use model::Configuration;
pub use model::ControlVoltageReference;
pub use model::DistBus;
pub use model::DistCapacitor;
pub use model::DistControlProfile;
pub use model::DistGenerator;
pub use model::DistIbr;
pub use model::DistLine;
pub use model::DistLineCode;
pub use model::DistLoad;
pub use model::DistLoadVoltageModel;
pub use model::DistShunt;
pub use model::DistSourceFormat;
pub use model::DistSwitch;
pub use model::DistTransformer;
pub use model::DistWinding;
pub use model::DistWindingConn;
pub use model::Extras;
pub use model::IbrPrimeMover;
pub use model::IbrTopology;
pub use model::IbrVoltageAggregation;
pub use model::MulticonductorNetwork;
pub use model::PowerFactorControl;
pub use model::ReactivePowerReference;
pub use model::ReactivePowerUnit;
pub use model::UntypedObject;
pub use model::VoltVarControl;
pub use model::VoltWattControl;
pub use model::VoltageSource;
pub use model::find_unresolved_references;
pub use readiness::ElectricalReadiness;
pub use readiness::ReadinessFinding;
pub use readiness::ReadinessSeverity;
pub use readiness::audit_electrical_readiness;
pub use readiness::require_electrical_readiness;

Modules§

bmopf
The BMOPF task force JSON schema (https://github.com/distribution-system-opt/dsopt-schema).
convert
Distribution format dispatch.
diagnostics
The codes this crate emits.
dss
OpenDSS .dss support: tokenizer, RPN, class tables, raw object layer.
error
geo
Typed coordinate metadata for the distribution model.
graph
Render ready bus and terminal graph projection.
model
The canonical multiconductor network model.
pmd
The PowerModelsDistribution ENGINEERING model as JSON (“PMD JSON”).
readiness
Pre-solver structural readiness checks for distribution networks.

Structs§

Diagnostic
One coded user facing finding.
DiagnosticCode
Stable dotted identity of one diagnostic.

Enums§

DiagnosticSeverity
Severity of one user facing finding.
DiagnosticStage
Pipeline stage encoded by the first segment of a diagnostic code.