powerio_matrix/
diagnostics.rs1pub use powerio_core::{
9 Diagnostic, DiagnosticInfo, DiagnosticSeverity, check_registry, render_diagnostic,
10 render_diagnostics,
11};
12
13pub mod codes {
14 powerio_core::diagnostic_codes! {
15 BUILD_MATRIX_SHAPE_MISMATCH = "BUILD.MATRIX.SHAPE_MISMATCH", Error,
17 "an operand's length does not match the matrix it is used with", category = Data;
18 BUILD_OPF_OBJECTIVE_UNSUPPORTED = "BUILD.OPF.OBJECTIVE_UNSUPPORTED", Error,
19 "the OPF preparation cannot compile the instance objective", category = Data;
20 BUILD_OPF_CONSTRAINT_IDENTITY_UNKNOWN = "BUILD.OPF.CONSTRAINT_IDENTITY_UNKNOWN", Error,
21 "an active constraint selection names no element in its family", category = Data;
22 BUILD_OPF_ELEMENT_IDENTITY_DUPLICATE = "BUILD.OPF.ELEMENT_IDENTITY_DUPLICATE", Error,
23 "an OPF element family does not have unique stable identities", category = Data;
24 BUILD_OPF_NODAL_COST_UNSUPPORTED = "BUILD.OPF.NODAL_COST_UNSUPPORTED", Error,
25 "a nodal quadratic projection cannot carry the prepared generator cost", category = Request;
26 BUILD_AC_PF_SPECIFICATION_UNSUPPORTED = "BUILD.AC_PF.SPECIFICATION_UNSUPPORTED", Error,
27 "the AC power flow preparation does not support a bus specification", category = Data;
28 BUILD_MULTI_PHYSICS_UNSUPPORTED = "BUILD.MULTI.PHYSICS_UNSUPPORTED", Error,
29 "the requested multiconductor calculation requires unsupported equipment equations", category = Data;
30 BUILD_MULTI_UNSUPPORTED_STAMP = "BUILD.MULTI.UNSUPPORTED_STAMP", Warning,
31 "an element has no exact multiconductor admittance or ideal stamp and was omitted loudly";
32 BUILD_LINDIST3FLOW_COEFFICIENT_INVALID = "BUILD.MULTI.LINDIST3FLOW_COEFFICIENT_INVALID", Error,
33 "a LinDist3Flow affine coefficient operand is invalid", category = Data;
34 BUILD_SENSITIVITY_SINGULAR = "BUILD.SENSITIVITY.SINGULAR", Error,
35 "the reference grounded Laplacian is singular", category = Data;
36 BUILD_SENSITIVITY_INVALID_OPTION = "BUILD.SENSITIVITY.INVALID_OPTION", Error,
37 "a DC sensitivity option is outside the range it is defined on", category = Data;
38 BUILD_SENSITIVITY_NO_CONVERGENCE = "BUILD.SENSITIVITY.NO_CONVERGENCE", Error,
42 "the iterative DC sensitivity solve ran out of iterations", retired = "0.11.0";
43 BUILD_GRIDFM_EMPTY_BATCH = "BUILD.GRIDFM.EMPTY_BATCH", Error,
44 "a gridfm scenario batch holds no snapshot", category = Data;
45 BUILD_GRIDFM_SCENARIO_ID_OVERFLOW = "BUILD.GRIDFM.SCENARIO_ID_OVERFLOW", Error,
46 "numbering a gridfm snapshot overflows the scenario id", category = Data;
47 BUILD_GRIDFM_NORMALIZED_SNAPSHOT = "BUILD.GRIDFM.NORMALIZED_SNAPSHOT", Error,
48 "a gridfm snapshot is normalized and the export expects raw units", category = Data;
49 BUILD_GRIDFM_NOT_A_NUMBER = "BUILD.GRIDFM.NOT_A_NUMBER", Error,
50 "a gridfm snapshot field is not finite", category = Data;
51 BUILD_GRIDFM_SCENARIO_SHAPE_MISMATCH = "BUILD.GRIDFM.SCENARIO_SHAPE_MISMATCH", Error,
52 "a gridfm snapshot does not share the batch's base element set", category = Data;
53
54 READ_MATRIX_IO_FAILED = "READ.MATRIX.IO_FAILED", Error,
56 "a matrix or dataset file could not be read", category = Io;
57 EMIT_MTX_FAILED = "EMIT.MTX.FAILED", Error,
58 "a matrix-market write failed", category = Output;
59 EMIT_PARQUET_FAILED = "EMIT.PARQUET.FAILED", Error,
60 "a gridfm Parquet write failed", category = Output;
61 EMIT_GRIDFM_FIELD_DROPPED = "EMIT.GRIDFM.FIELD_DROPPED", Warning,
62 "a source field has no GridFM table column";
63 EMIT_GRIDFM_VALUE_COLLAPSED = "EMIT.GRIDFM.VALUE_COLLAPSED", Warning,
64 "several source records were folded into one GridFM row";
65 EMIT_GRIDFM_VALUE_SUBSTITUTED = "EMIT.GRIDFM.VALUE_SUBSTITUTED", Warning,
66 "a source value was replaced by GridFM's indexed or fixed representation";
67 EMIT_GRIDFM_VALUE_DEFAULTED = "EMIT.GRIDFM.VALUE_DEFAULTED", Warning,
68 "a required GridFM value was derived because the source did not state it";
69
70 }
71}
72
73#[must_use]
75pub fn registry() -> Vec<&'static DiagnosticInfo> {
76 codes::ALL.to_vec()
77}
78
79#[cfg(test)]
80mod tests {
81 use super::*;
82
83 #[test]
84 fn the_registry_is_sound() {
85 let problems = check_registry(registry());
86 assert!(problems.is_empty(), "{problems:#?}");
87 }
88}