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
66
67
68
69
//! `powerio-pkg`: the `.pio.json` compiler package.
//!
//! PowerIO has no single flattened "universal network" struct. It has two
//! concrete static-grid IR families that stay distinct:
//!
//! - [`powerio::BalancedNetwork`] (the scalar positive-sequence transmission
//! model, historically `powerio::Network`);
//! - [`powerio_dist::MulticonductorNetwork`] (the wire-coordinate distribution
//! model, historically `powerio_dist::DistNetwork`).
//!
//! A [`NetworkPackage`] is the readable envelope that wraps exactly one of
//! those payloads at a time, alongside the metadata a compiler artifact needs
//! to be trustworthy: an explicit [`ModelKind`], producer and origin metadata,
//! source maps, structured diagnostics, a validation summary, and lowering
//! history. It can also carry optional operating points that replay state
//! updates over the static payload. GOC3 packages use that block for the source
//! time series: the payload holds one static interval, and
//! [`NetworkPackage::materialize_operating_point`] derives another static
//! package from a selected period. It serializes to `.pio.json`. See
//! `docs/src/compiler-ir.md` for the architecture and
//! `docs/src/pio-json-schema.md` for the field reference.
//!
//! The package always carries [`NetworkPackage::model_kind`] explicitly; a
//! reader must never infer whether the payload is balanced or multiconductor
//! from which field is present. [`NetworkPackage::kind_is_consistent`] asserts
//! the explicit kind agrees with the payload variant.
//!
//! ```
//! use powerio_pkg::{NetworkPackage, ModelKind};
//!
//! let net = powerio::BalancedNetwork::in_memory("demo", 100.0, vec![], vec![]);
//! let pkg = NetworkPackage::from_balanced(net);
//! assert_eq!(pkg.model_kind(), ModelKind::Balanced);
//! assert!(pkg.kind_is_consistent());
//! let json = pkg.to_json_pretty().unwrap();
//! let back = NetworkPackage::from_json(&json).unwrap();
//! assert_eq!(back.model_kind(), ModelKind::Balanced);
//! ```
//!
//! Binary `.pio` is out of scope until the JSON package stabilizes; this crate
//! is JSON only.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;