Skip to main content

hydr_structures/structures/control/
command.rs

1//! Explicit commands without hydraulic consumption or actuator response.
2
3/// Current side of one sampled hysteresis relay.
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum ControlLatch {
6    /// Lower relay state.
7    Low,
8    /// Upper relay state.
9    High,
10}
11/// Requested device operation. Gate targets never assert actual opening.
12#[derive(Clone, Copy, Debug, PartialEq)]
13pub enum ControlCommand {
14    /// Explicit stopped pump isolation command.
15    PumpStoppedIsolated,
16    /// Explicit running speed command without inferred response dynamics.
17    PumpRunning {
18        /// Positive supported speed ratio.
19        speed_ratio: f64,
20    },
21    /// Desired relative gate position, distinct from actual aperture opening.
22    GateTarget {
23        /// Requested opening in metres.
24        opening_m: f64,
25    },
26}
27/// Explicit command projection for one controlled structure.
28#[derive(Clone, Debug, PartialEq)]
29pub struct ControlCommandOutput {
30    /// Complete structure-batch index.
31    pub element: usize,
32    /// Original controller identity.
33    pub controller_id: String,
34    /// Original structure identity.
35    pub structure_id: String,
36    /// Supported command time in seconds.
37    pub time_s: f64,
38    /// Current relay latch.
39    pub latch: ControlLatch,
40    /// Selected original command.
41    pub command: ControlCommand,
42}