hydr_structures/structures/operating_source/definition.rs
1//! Explicit source ownership and borrowed fresh response frames.
2
3use crate::structures::{ControlledPumpBatch, GateActuatorBatch, GateTrajectoryBatch};
4use numr::dtype::DType;
5use numr::runtime::Runtime;
6
7/// One explicit writer for a nonempty ordered subset of the complete actual structure batch.
8#[derive(Clone, Debug)]
9pub enum OperatingSourceBinding<'a, R: Runtime<DType = DType>> {
10 /// Original manual operation packets supplied afresh at every query.
11 Manual {
12 /// Unique nonempty source identity, retained in registration order.
13 source_id: String,
14 /// Nonempty unique original element identities in complete structure order.
15 structure_ids: Vec<String>,
16 },
17 /// Immutable prescribed gate trajectories, restricted to their actual assigned subset.
18 Prescribed {
19 /// Unique nonempty source identity.
20 source_id: String,
21 /// Complete immutable trajectory binding cloned by the registry.
22 trajectory: &'a GateTrajectoryBatch<R>,
23 },
24 /// Actual gate positions supplied through a fresh accepted frame at each query.
25 Actuated {
26 /// Unique nonempty source identity.
27 source_id: String,
28 /// Only this batch's immutable context is captured during registration.
29 actuator: &'a GateActuatorBatch<R>,
30 },
31 /// Explicit ideal instantaneous pump response supplied through a fresh accepted frame.
32 ControlledPump {
33 /// Unique nonempty source identity.
34 source_id: String,
35 /// Only immutable control and response definitions are captured during registration.
36 pump: &'a ControlledPumpBatch<R>,
37 },
38}
39/// Fresh accepted response borrowed for one exact numerical query time.
40#[derive(Debug)]
41pub enum OperatingSourceFrame<'a, R: Runtime<DType = DType>> {
42 /// Accepted actual gate response without implicit advancement or interpolation.
43 ActuatedGate {
44 /// Registered source identity in dynamic-group registration order.
45 source_id: &'a str,
46 /// Accepted ideal finite-rate response.
47 actuator: &'a GateActuatorBatch<R>,
48 },
49 /// Accepted sampled pump response under its explicit instantaneous assumption.
50 ControlledPump {
51 /// Registered source identity in dynamic-group registration order.
52 source_id: &'a str,
53 /// Accepted sampled commands and immutable response assumptions.
54 pump: &'a ControlledPumpBatch<R>,
55 },
56}
57/// Closed common support of every bounded source. A singleton remains a valid point.
58#[derive(Clone, Copy, Debug, PartialEq)]
59pub struct OperatingSourceSupport {
60 /// First common supported time in seconds.
61 pub start_s: f64,
62 /// Last common supported time in seconds.
63 pub end_s: f64,
64}
65
66impl<R: Runtime<DType = DType>> Copy for OperatingSourceFrame<'_, R> {}
67impl<R: Runtime<DType = DType>> Clone for OperatingSourceFrame<'_, R> {
68 fn clone(&self) -> Self {
69 *self
70 }
71}