1pub use powerio_core::{DiagnosticInfo, DiagnosticSeverity, check_registry};
9
10pub mod codes {
11 powerio_core::diagnostic_codes! {
12 BUILD_OPERATING_POINT_SHAPE_MISMATCH = "BUILD.OPERATING_POINT.SHAPE_MISMATCH", Error,
13 "an operating point column disagrees with the resolved identity layout",
14 category = Data;
15 BUILD_OPERATING_POINT_IDENTITY_UNKNOWN = "BUILD.OPERATING_POINT.IDENTITY_UNKNOWN", Error,
16 "an operating point names an element identity the network does not declare",
17 category = Data;
18 VALIDATE_UPDATE_COMPONENT_TYPE = "VALIDATE.UPDATE.COMPONENT_TYPE", Error,
19 "an update names the wrong component type for its field", category = Data;
20 VALIDATE_UPDATE_COMPONENT_UNKNOWN = "VALIDATE.UPDATE.COMPONENT_UNKNOWN", Error,
21 "an update names no component in the target value", category = Data;
22 VALIDATE_UPDATE_STABLE_ID_REQUIRED = "VALIDATE.UPDATE.STABLE_ID_REQUIRED", Error,
23 "an update cannot target a table row position or an unidentified component",
24 category = Data;
25 VALIDATE_UPDATE_COMPONENT_AMBIGUOUS = "VALIDATE.UPDATE.COMPONENT_AMBIGUOUS", Error,
26 "an update identity resolves to more than one component", category = Data;
27 VALIDATE_UPDATE_FIELD_UNSUPPORTED = "VALIDATE.UPDATE.FIELD_UNSUPPORTED", Error,
28 "the target electrical model does not define the requested field", category = Data;
29 VALIDATE_UPDATE_VALUE_INVALID = "VALIDATE.UPDATE.VALUE_INVALID", Error,
30 "an update replacement value is outside the field's domain", category = Data;
31 VALIDATE_UPDATE_TERMINAL_UNKNOWN = "VALIDATE.UPDATE.TERMINAL_UNKNOWN", Error,
32 "an update names no terminal on its component", category = Data;
33 VALIDATE_UPDATE_DUPLICATE_FIELD = "VALIDATE.UPDATE.DUPLICATE_FIELD", Error,
34 "an atomic update batch assigns one component field more than once", category = Data;
35 VALIDATE_UPDATE_ALLOCATION_FAILED = "VALIDATE.UPDATE.ALLOCATION_FAILED", Error,
36 "an aggregate load update has no valid allocation basis", category = Data;
37 BUILD_INSTANCE_NO_GENERATORS = "BUILD.INSTANCE.NO_GENERATORS", Error,
38 "the case has no generator for the problem to dispatch", category = Data;
39 BUILD_INSTANCE_NO_REFERENCE_BUS = "BUILD.INSTANCE.NO_REFERENCE_BUS", Error,
40 "the network states no reference (slack) bus", category = Data;
41 BUILD_INSTANCE_VOLTAGE_CONTROL_CONFLICT = "BUILD.INSTANCE.VOLTAGE_CONTROL_CONFLICT", Error,
42 "in service generators at one bus state conflicting voltage setpoints",
43 category = Data;
44 BUILD_INSTANCE_SHAPE_MISMATCH = "BUILD.INSTANCE.SHAPE_MISMATCH", Error,
45 "a calculation input disagrees with the network's element tables",
46 category = Data;
47 BUILD_INSTANCE_NOMINAL_VOLTAGE_UNRESOLVED =
48 "BUILD.INSTANCE.NOMINAL_VOLTAGE_UNRESOLVED", Error,
49 "a load states no nominal voltage and its zone has no single voltage anchor",
50 category = Data;
51 BUILD_INSTANCE_SWITCHING_OPTIONS_INVALID =
52 "BUILD.INSTANCE.SWITCHING_OPTIONS_INVALID", Error,
53 "a switching option names an unknown or repeated branch, or states an invalid cost, current limit, or budget",
54 category = Data;
55 BUILD_INSTANCE_TOPOLOGY_INVALID = "BUILD.INSTANCE.TOPOLOGY_INVALID", Error,
56 "a final branch status vector violates the fixed branches, budgets, or islanding policy",
57 category = Data;
58 BUILD_LINDIST3FLOW_EXPLICIT_NEUTRAL = "BUILD.LINDIST3FLOW.EXPLICIT_NEUTRAL", Error,
59 "LinDist3Flow requires a neutral-reduced conductor model", category = Data;
60 BUILD_LINDIST3FLOW_UNSUPPORTED_COMPONENT =
61 "BUILD.LINDIST3FLOW.UNSUPPORTED_COMPONENT", Error,
62 "a network component is outside the implemented LinDist3Flow slice",
63 category = Data;
64 BUILD_LINDIST3FLOW_TOPOLOGY_INVALID = "BUILD.LINDIST3FLOW.TOPOLOGY_INVALID", Error,
65 "the conductor-resolved network is not a valid source-covered graph", category = Data;
66 BUILD_LINDIST3FLOW_MESH_APPROXIMATION =
67 "BUILD.LINDIST3FLOW.MESH_APPROXIMATION", Warning,
68 "a meshed LinDist3Flow model omits angle and loop-consistency equations";
69 BUILD_LINDIST3FLOW_REFERENCE_INVALID = "BUILD.LINDIST3FLOW.REFERENCE_INVALID", Error,
70 "the LinDist3Flow coefficient reference is missing or invalid", category = Data;
71 BUILD_LINDIST3FLOW_POLICY_UNAVAILABLE = "BUILD.LINDIST3FLOW.POLICY_UNAVAILABLE", Error,
72 "the requested LinDist3Flow projection policy is not implemented", category = Data;
73 BUILD_LINDIST3FLOW_PREPARATION_FAILED =
74 "BUILD.LINDIST3FLOW.PREPARATION_FAILED", Error,
75 "a selected LinDist3Flow component preparation failed", category = Data;
76 BUILD_LINDIST3FLOW_COMPONENT_LOWERED =
77 "BUILD.LINDIST3FLOW.COMPONENT_LOWERED", Warning,
78 "a distribution component was lowered to the LinDist3Flow vocabulary";
79 BUILD_LINDIST3FLOW_COMPONENT_APPROXIMATED =
80 "BUILD.LINDIST3FLOW.COMPONENT_APPROXIMATED", Warning,
81 "a distribution component was approximated for LinDist3Flow";
82 BUILD_LINDIST3FLOW_COMPONENT_OMITTED =
83 "BUILD.LINDIST3FLOW.COMPONENT_OMITTED", Warning,
84 "source data with no retained LinDist3Flow role was omitted";
85 BUILD_LINDIST3FLOW_FIXED_DISPATCH_REQUIRED =
86 "BUILD.LINDIST3FLOW.FIXED_DISPATCH_REQUIRED", Error,
87 "fixed-dispatch LinDist3Flow requires fixed generator active and reactive power",
88 category = Data;
89 BUILD_LINDIST3FLOW_OBJECTIVE_UNSUPPORTED =
90 "BUILD.LINDIST3FLOW.OBJECTIVE_UNSUPPORTED", Error,
91 "the LinDist3Flow objective is outside the implemented formulation",
92 category = Data;
93 BUILD_LINDIST3FLOW_COST_MISSING = "BUILD.LINDIST3FLOW.COST_MISSING", Warning,
94 "a dispatched resource has no active-power cost and contributes zero to the objective";
95 BUILD_LINDIST3FLOW_DEVICE_INVALID = "BUILD.LINDIST3FLOW.DEVICE_INVALID", Error,
96 "a LinDist3Flow device has inconsistent connection, channel, bound, or rating data",
97 category = Data;
98 BUILD_OPERATOR_ZERO_IMPEDANCE = "BUILD.OPERATOR.ZERO_IMPEDANCE", Error,
99 "a zero impedance branch has no finite DC operator row", category = Data;
100 BUILD_OPERATOR_NOT_A_NUMBER = "BUILD.OPERATOR.NOT_A_NUMBER", Error,
101 "a branch value produced a non-finite operator entry", category = Data;
102 BUILD_SOLUTION_SHAPE_MISMATCH = "BUILD.SOLUTION.SHAPE_MISMATCH", Error,
103 "a solution column disagrees with the instance's element tables",
104 category = Data;
105 BUILD_SOLUTION_LIMIT_CHECK_INVALID = "BUILD.SOLUTION.LIMIT_CHECK_INVALID", Error,
106 "a semantic limit check is inconsistent with its instance or reported values",
107 category = Data;
108 BUILD_SOLUTION_MULTIPLIER_INVALID = "BUILD.SOLUTION.MULTIPLIER_INVALID", Error,
109 "a constraint multiplier is negative or non-finite", category = Data;
110 BUILD_SOLUTION_TOPOLOGY_MISMATCH = "BUILD.SOLUTION.TOPOLOGY_MISMATCH", Error,
111 "an AC solution does not solve the switching instance's fixed-topology problem",
112 category = Data;
113 BUILD_SOLUTION_VALUE_INVALID = "BUILD.SOLUTION.VALUE_INVALID", Error,
114 "a solution value is non-finite, or an open branch carries flow", category = Data;
115 TRANSFORM_INSTANCE_DATA_DISCARDED = "TRANSFORM.INSTANCE.DATA_DISCARDED", Warning,
116 "the derived calculation does not carry part of the source instance";
117 TRANSFORM_INSTANCE_ASSUMPTION = "TRANSFORM.INSTANCE.ASSUMPTION", Warning,
118 "the derived calculation rests on a stated modeling assumption";
119 BUILD_INSTANCE_UNSUPPORTED_COST_MODEL = "BUILD.INSTANCE.UNSUPPORTED_COST_MODEL", Error,
120 "a generator cost model the instance builder cannot state", category = Data;
121 BUILD_INSTANCE_PIECEWISE_COST_INVALID = "BUILD.INSTANCE.PIECEWISE_COST_INVALID", Error,
122 "a piecewise linear generator cost row is malformed", category = Data;
123 BUILD_INSTANCE_PIECEWISE_COST_NONCONVEX = "BUILD.INSTANCE.PIECEWISE_COST_NONCONVEX", Error,
124 "a piecewise linear generator cost row is nonconvex", category = Data;
125 BUILD_INSTANCE_CONCAVE_COST = "BUILD.INSTANCE.CONCAVE_COST", Error,
126 "a generator cost row states a concave curve", category = Data;
127 READ_INSTANCE_IO_FAILED = "READ.INSTANCE.IO_FAILED", Error,
128 "an instance file could not be read", category = Io;
129 REQUEST_GOC3_FORMAT_UNKNOWN = "REQUEST.GOC3.FORMAT_UNKNOWN", Error,
130 "the named GOC3 source format is not one this build reads",
131 category = Request;
132 }
133
134 pub const CANONICALIZE_MERGE_ZERO_IMPEDANCE: powerio_core::DiagnosticInfo =
140 powerio_tx::diagnostics::codes::CANONICALIZE_MERGE_ZERO_IMPEDANCE;
141 pub const CANONICALIZE_MERGE_ATTRIBUTE_CONFLICT: powerio_core::DiagnosticInfo =
143 powerio_tx::diagnostics::codes::CANONICALIZE_MERGE_ATTRIBUTE_CONFLICT;
144}
145
146#[must_use]
148pub fn registry() -> Vec<&'static DiagnosticInfo> {
149 codes::ALL.to_vec()
150}
151
152#[cfg(test)]
153mod tests {
154 use super::*;
155
156 #[test]
157 fn the_registry_is_sound() {
158 let problems = check_registry(registry());
159 assert!(problems.is_empty(), "{problems:#?}");
160 }
161}