1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//! `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.
//!
//! ```no_run
//! 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);
//! # Ok::<(), powerio_dist::Error>(())
//! ```
//!
//! # 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.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;