Skip to main content

hydr_structures/structures/operating_source/
output.rs

1//! Mandatory source provenance and gate-opening uncertainty paired with constitutive output.
2
3use crate::structures::{
4    ControlLatch, GateActuatorPhase, GateActuatorPosition, GateActuatorSupport, PumpResponseModel,
5    StructureOperatingPoint, StructureOutput,
6};
7
8/// An instantaneous hydraulic result with its responsible operating source.
9#[derive(Clone, Debug, PartialEq)]
10pub struct OperatingSourceOutput {
11    /// Hydraulic law evaluated from the admitted actual operation and supplied heads.
12    pub hydraulic: StructureOutput,
13    /// Source ownership, point support, and source-specific operation or opening evidence.
14    pub source: OperatingSourceReceipt,
15}
16/// Identity and original point time attached to every hydraulic output row.
17#[derive(Clone, Debug, PartialEq)]
18pub struct OperatingSourceReceipt {
19    /// Registered unique source identity.
20    pub source_id: String,
21    /// Original complete structure index.
22    pub element: usize,
23    /// Original complete structure identity.
24    pub structure_id: String,
25    /// Original query time, preserving its F64 bits.
26    pub time_s: f64,
27    /// Original source semantics, actual operation, and applicable opening evidence.
28    pub detail: OperatingSourceDetail,
29}
30/// Source-specific evidence. Position bounds imply no ideal-flow or integrated-volume enclosure.
31#[derive(Clone, Debug, PartialEq)]
32pub enum OperatingSourceDetail {
33    /// Original manual packet, without an inferred measurement-error model.
34    Manual,
35    /// Original-time prescribed gate support and interpolation error.
36    PrescribedGate {
37        /// Solvr absolute opening-error enclosure in metres.
38        absolute_opening_error_m: f64,
39        /// Original right-sided segment, except at the final knot.
40        segment_index: usize,
41        /// Exact original knot index when represented time equality holds.
42        exact_knot_index: Option<usize>,
43        /// Original zero knot or zero hold certifies closure at this point.
44        closed_by_definition: bool,
45    },
46    /// Actual accepted ideal actuator response with complete positional uncertainty.
47    ActuatedGate {
48        /// Original actuator identity in the registered ordered subset.
49        actuator_id: String,
50        /// Accepted original interval count at this frame.
51        accepted_steps: usize,
52        /// Original frame accepted time, preserving its bits independently of the query time.
53        accepted_time_s: f64,
54        /// Admitted actual opening center, interval, and absolute error in metres.
55        position: GateActuatorPosition,
56        /// Admitted current motion/completion phase.
57        phase: GateActuatorPhase,
58        /// Canonical closed, certainly positive, or unresolved closure support.
59        support: GateActuatorSupport,
60    },
61    /// Accepted sampled command under an explicit ideal instantaneous response model.
62    ControlledPump {
63        /// Original controller identity in the registered ordered pump subset.
64        controller_id: String,
65        /// Accepted original control interval count at this frame.
66        accepted_steps: usize,
67        /// Original frame accepted time, preserving its bits independently of the query time.
68        accepted_time_s: f64,
69        /// Accepted sampled relay latch selecting the original command.
70        latch: ControlLatch,
71        /// Explicit assumed response model, without inferred motor dynamics.
72        response_model: PumpResponseModel,
73        /// Actual stopped isolation or original running speed under the declared model.
74        operating_point: StructureOperatingPoint,
75    },
76}