hydr_structures/structures/actuator/state.rs
1//! Explicit finite-rate actuator state contracts.
2
3use super::*;
4/// Bounded old-target left-state evidence and changed-target activation.
5#[derive(Clone, Debug, PartialEq)]
6pub struct GateActuatorTargetChangeReceipt {
7 /// Original target-calendar index associated with this event or change.
8 pub target_index: usize,
9 /// Original accepted or retained event time in seconds.
10 pub time_s: f64,
11 /// Original active target before this actual change.
12 pub previous_target_opening_m: f64,
13 /// Complete old-target anchor retained for left-state recomputation.
14 pub previous_anchor: GateActuatorAnchor,
15 /// Bounded prior completion proof, retained independently of newer episodes.
16 pub previous_completion: Option<GateActuatorCompletionReceipt>,
17 /// Original causal packet installing this changed target.
18 pub update: GateTargetUpdate,
19 /// Complete old-target endpoint position before any target change.
20 pub left_position: GateActuatorPosition,
21 /// Changed-target anchor carrying the complete admitted left-position interval.
22 pub new_anchor: GateActuatorAnchor,
23 /// Count of actual target changes identifying the active target bits.
24 pub target_generation: usize,
25 /// New active episode identity, absent when the changed target begins an exact hold.
26 pub new_episode_index: Option<usize>,
27}
28
29/// Complete current continuation with bounded target and completion receipts.
30#[derive(Clone, Debug, PartialEq)]
31pub struct GateActuatorState {
32 /// Exact actuator identity in immutable definition order.
33 pub actuator_id: String,
34 /// Retained original epoch and complete position interval for this target episode.
35 pub anchor: GateActuatorAnchor,
36 /// Original active target in metres, inside the actual gate range.
37 pub target_opening_m: f64,
38 /// Complete represented opening and inherited certified uncertainty.
39 pub position: GateActuatorPosition,
40 /// Current arrival/completion classification within declared support.
41 pub phase: GateActuatorPhase,
42 /// Original current-target arrival certificate, absent without a finite all-position window.
43 pub arrival: Option<GateActuatorArrivalCertificate>,
44 /// Number of accepted numerically unequal target changes.
45 pub target_change_count: usize,
46 /// Number of activated non-hold episodes, including an initial active episode.
47 pub episode_count: usize,
48 /// Number of active episodes completing in accepted trials, without duplicate holds or proofs.
49 pub arrival_count: usize,
50 /// Current active episode identity, absent for an exact target hold.
51 pub active_episode_index: Option<usize>,
52 /// Latest raw causal packet, retaining original bits even for repeated numerical targets.
53 pub latest_update: Option<GateTargetUpdate>,
54 /// One bounded receipt for the latest actual target change.
55 pub last_target_change: Option<GateActuatorTargetChangeReceipt>,
56 /// One bounded proof for the latest completed active episode.
57 pub last_completion: Option<GateActuatorCompletionReceipt>,
58}
59
60/// Immediate before/left/after state for one accepted candidate lane.
61#[derive(Clone, Debug, PartialEq)]
62pub struct GateActuatorStepReceipt {
63 /// Index in the complete original structure context, never a compact subset index.
64 pub element: usize,
65 /// Exact actuator identity in immutable definition order.
66 pub actuator_id: String,
67 /// Complete immediate accepted state before this candidate interval.
68 pub before: GateActuatorState,
69 /// Complete old-target endpoint position before any target change.
70 pub left_position: GateActuatorPosition,
71 /// Old-target forward evidence before installing an endpoint target.
72 pub left_forward: Option<GateActuatorForwardReceipt>,
73 /// Original causal target packet, when supplied at this endpoint.
74 pub update: Option<GateTargetUpdate>,
75 /// Whether this accepted interval first completes an active episode.
76 pub completed_episode: bool,
77 /// Whether this endpoint installs a numerically unequal target.
78 pub target_changed: bool,
79 /// Complete immediate candidate state after old-target evaluation and target installation.
80 pub after: GateActuatorState,
81}
82
83/// Original interval, endpoint event, and ordered complete lane receipts.
84#[derive(Clone, Debug, PartialEq)]
85pub struct GateActuatorStepDiagnostics {
86 /// Original accepted interval start time in seconds.
87 pub start_s: f64,
88 /// Original candidate interval endpoint in seconds.
89 pub end_s: f64,
90 /// Exact endpoint event summary, absent for a substep ending before the next event.
91 pub event: Option<GateActuatorEvent>,
92 /// Ordered bounded receipts for the controlled gate subset.
93 pub receipts: Vec<GateActuatorStepReceipt>,
94}