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_LINDIST3FLOW_EXPLICIT_NEUTRAL = "BUILD.LINDIST3FLOW.EXPLICIT_NEUTRAL", Error,
48 "LinDist3Flow requires a neutral-reduced conductor model", category = Data;
49 BUILD_LINDIST3FLOW_UNSUPPORTED_COMPONENT =
50 "BUILD.LINDIST3FLOW.UNSUPPORTED_COMPONENT", Error,
51 "a network component is outside the implemented LinDist3Flow slice",
52 category = Data;
53 BUILD_LINDIST3FLOW_TOPOLOGY_INVALID = "BUILD.LINDIST3FLOW.TOPOLOGY_INVALID", Error,
54 "the conductor-resolved network is not a source-rooted forest", category = Data;
55 BUILD_LINDIST3FLOW_REFERENCE_INVALID = "BUILD.LINDIST3FLOW.REFERENCE_INVALID", Error,
56 "the LinDist3Flow coefficient reference is missing or invalid", category = Data;
57 BUILD_LINDIST3FLOW_POLICY_UNAVAILABLE = "BUILD.LINDIST3FLOW.POLICY_UNAVAILABLE", Error,
58 "the requested LinDist3Flow projection policy is not implemented", category = Data;
59 BUILD_LINDIST3FLOW_OBJECTIVE_UNSUPPORTED =
60 "BUILD.LINDIST3FLOW.OBJECTIVE_UNSUPPORTED", Error,
61 "the LinDist3Flow objective is outside the implemented formulation",
62 category = Data;
63 BUILD_LINDIST3FLOW_COST_MISSING = "BUILD.LINDIST3FLOW.COST_MISSING", Warning,
64 "a dispatched resource has no active-power cost and contributes zero to the objective";
65 BUILD_LINDIST3FLOW_DEVICE_INVALID = "BUILD.LINDIST3FLOW.DEVICE_INVALID", Error,
66 "a LinDist3Flow device has inconsistent connection, channel, bound, or rating data",
67 category = Data;
68 BUILD_OPERATOR_ZERO_IMPEDANCE = "BUILD.OPERATOR.ZERO_IMPEDANCE", Error,
69 "a zero impedance branch has no finite DC operator row", category = Data;
70 BUILD_OPERATOR_NOT_A_NUMBER = "BUILD.OPERATOR.NOT_A_NUMBER", Error,
71 "a branch value produced a non-finite operator entry", category = Data;
72 BUILD_SOLUTION_SHAPE_MISMATCH = "BUILD.SOLUTION.SHAPE_MISMATCH", Error,
73 "a solution column disagrees with the instance's element tables",
74 category = Data;
75 BUILD_SOLUTION_MULTIPLIER_INVALID = "BUILD.SOLUTION.MULTIPLIER_INVALID", Error,
76 "a constraint multiplier is negative or non-finite", category = Data;
77 TRANSFORM_INSTANCE_DATA_DISCARDED = "TRANSFORM.INSTANCE.DATA_DISCARDED", Warning,
78 "the derived calculation does not carry part of the source instance";
79 TRANSFORM_INSTANCE_ASSUMPTION = "TRANSFORM.INSTANCE.ASSUMPTION", Warning,
80 "the derived calculation rests on a stated modeling assumption";
81 CANONICALIZE_MERGE_ZERO_IMPEDANCE = "CANONICALIZE.MERGE.ZERO_IMPEDANCE", Warning,
82 "a zero impedance branch was merged and its flow is no longer recoverable";
83 CANONICALIZE_MERGE_ATTRIBUTE_CONFLICT = "CANONICALIZE.MERGE.ATTRIBUTE_CONFLICT", Warning,
84 "merged buses stated different attributes; the surviving bus's values were kept";
85 BUILD_INSTANCE_UNSUPPORTED_COST_MODEL = "BUILD.INSTANCE.UNSUPPORTED_COST_MODEL", Error,
86 "a generator cost model the instance builder cannot state", category = Data;
87 BUILD_INSTANCE_PIECEWISE_COST_INVALID = "BUILD.INSTANCE.PIECEWISE_COST_INVALID", Error,
88 "a piecewise linear generator cost row is malformed", category = Data;
89 BUILD_INSTANCE_PIECEWISE_COST_NONCONVEX = "BUILD.INSTANCE.PIECEWISE_COST_NONCONVEX", Error,
90 "a piecewise linear generator cost row is nonconvex", category = Data;
91 BUILD_INSTANCE_CONCAVE_COST = "BUILD.INSTANCE.CONCAVE_COST", Error,
92 "a generator cost row states a concave curve", category = Data;
93 READ_INSTANCE_IO_FAILED = "READ.INSTANCE.IO_FAILED", Error,
94 "an instance file could not be read", category = Io;
95 REQUEST_GOC3_FORMAT_UNKNOWN = "REQUEST.GOC3.FORMAT_UNKNOWN", Error,
96 "the named GOC3 source format is not one this build reads",
97 category = Request;
98 }
99}
100
101#[must_use]
103pub fn registry() -> Vec<&'static DiagnosticInfo> {
104 codes::ALL.to_vec()
105}
106
107#[cfg(test)]
108mod tests {
109 use super::*;
110
111 #[test]
112 fn the_registry_is_sound() {
113 let problems = check_registry(registry());
114 assert!(problems.is_empty(), "{problems:#?}");
115 }
116}