Skip to main content

hydr_structures/structures/controlled_pump/
capabilities.rs

1//! Capability declaration of sampled controls with ideal instantaneous pump response.
2
3use super::{CONTROLLED_PUMP_CONTRACT_VERSION, CONTROLLED_PUMP_SNAPSHOT_SCHEMA};
4use hydr_core::capability::{
5    ArithmeticRequirement, ComponentCapabilities, ComponentId, Limit, OptionSet, Precision,
6    RuntimeKind, RuntimeStatus, RuntimeSupport, Summary, Unsupported, UnsupportedReason,
7};
8
9/// Path of the guide that defines the response model, operation, restoration and limits.
10const CONTROLLED_PUMP_DOC: &str = "docs/controlled-pumps.md";
11
12const fn unsupported(
13    id: &'static str,
14    reason: UnsupportedReason,
15    summary: &'static str,
16    doc: &'static str,
17) -> Unsupported {
18    Unsupported {
19        id,
20        reason,
21        summary,
22        doc,
23    }
24}
25
26static CONTROLLED_PUMP: ComponentCapabilities = ComponentCapabilities {
27    component: ComponentId::ControlledPump,
28    contract: Some(CONTROLLED_PUMP_CONTRACT_VERSION),
29    snapshot_schema: Some(CONTROLLED_PUMP_SNAPSHOT_SCHEMA),
30    precision: &[Precision::F64],
31    arithmetic: &[
32        ArithmeticRequirement::F64Ieee754Basic,
33        ArithmeticRequirement::NearestEvenGradualUnderflow,
34        ArithmeticRequirement::FusedMulAdd,
35        ArithmeticRequirement::CorrectlyRoundedElementary,
36    ],
37    runtimes: &[
38        RuntimeSupport {
39            runtime: RuntimeKind::Cpu,
40            status: RuntimeStatus::Reference,
41            evidence: "ideal_response_applies_selected_stopped_and_running_operations_on_the_decision_right",
42        },
43        RuntimeSupport {
44            runtime: RuntimeKind::Cuda,
45            status: RuntimeStatus::Executed,
46            evidence: "selected_cuda_client_executes_controlled_pump_operations_and_complete_restart",
47        },
48        RuntimeSupport {
49            runtime: RuntimeKind::Wgpu,
50            status: RuntimeStatus::RejectedLacksF64,
51            evidence: "selected_wgpu_rejects_controlled_pump_f64_without_fallback",
52        },
53    ],
54    endpoints: &[],
55    regimes: &[],
56    sources: &[],
57    options: &[OptionSet {
58        id: "pump-response-model",
59        values: &["ideal-instantaneous"],
60        default: None,
61    }],
62    nested: &[ComponentId::OperatingControl],
63    attachable_to: &[ComponentId::SurfaceChannels],
64    unsupported: &[
65        unsupported(
66            "incomplete-response-definitions",
67            UnsupportedReason::RejectedByAdmission,
68            "Response definitions that do not match every controlled pump once, in order, reject.",
69            CONTROLLED_PUMP_DOC,
70        ),
71        unsupported(
72            "missing-response-evidence",
73            UnsupportedReason::RejectedByAdmission,
74            "Empty response provenance or ideal-response applicability rejects.",
75            CONTROLLED_PUMP_DOC,
76        ),
77        unsupported(
78            "non-pump-controller",
79            UnsupportedReason::RejectedByAdmission,
80            "A controller bound to a non-pump structure rejects.",
81            CONTROLLED_PUMP_DOC,
82        ),
83        unsupported(
84            "motor-dynamics",
85            UnsupportedReason::OutsideModel,
86            "No acceleration, startup delay, coast-down or independent response memory.",
87            CONTROLLED_PUMP_DOC,
88        ),
89        unsupported(
90            "native-control-authority",
91            UnsupportedReason::OutsideModel,
92            "No native SWMM control authority or parity.",
93            CONTROLLED_PUMP_DOC,
94        ),
95        unsupported(
96            "accepted-transfer",
97            UnsupportedReason::NotAttached,
98            "Operation feeds instantaneous proposals through operating sources; no donor budget or accepted transfer.",
99            CONTROLLED_PUMP_DOC,
100        ),
101        unsupported(
102            "gpu-numerical-qualification",
103            UnsupportedReason::Unqualified,
104            "CUDA runs execute, but only the CPU reference qualifies numerical accuracy.",
105            CONTROLLED_PUMP_DOC,
106        ),
107        unsupported(
108            "measured-event-accuracy",
109            UnsupportedReason::Unqualified,
110            "No measured-event assessment establishes field accuracy.",
111            "docs/acceptance.md",
112        ),
113    ],
114    limits: &[
115        Limit {
116            id: "memoryless-response",
117            summary: "The response holds no state, so it adopts advanced checked controls unchanged.",
118            doc: CONTROLLED_PUMP_DOC,
119        },
120        Limit {
121            id: "right-side-operation",
122            summary: "Actual operation equals the accepted command on each decision's right side.",
123            doc: CONTROLLED_PUMP_DOC,
124        },
125    ],
126    summary: Summary {
127        equations: "actual pump operation equal to the accepted sampled command",
128        method: "latch-selected original stopped or running literals, nested control trials, no response state",
129        assessment: "selected analytical qualification, operation and restart cases; field accuracy remains unestablished",
130    },
131};
132
133/// Returns the controlled pump's declared scope, independent of application eligibility.
134///
135/// Execution success establishes no field accuracy.
136pub fn controlled_pump_capabilities() -> &'static ComponentCapabilities {
137    &CONTROLLED_PUMP
138}