hydr_structures/structures/actuator/receipts.rs
1//! Explicit finite-rate actuator receipts contracts.
2
3use super::*;
4/// Original all-position arrival window derived from the complete anchor enclosure.
5#[derive(Clone, Debug, PartialEq)]
6pub struct GateActuatorArrivalCertificate {
7 /// Retained original epoch and complete position interval for this target episode.
8 pub anchor: GateActuatorAnchor,
9 /// Original active target in metres, inside the actual gate range.
10 pub target_opening_m: f64,
11 /// Original finite earliest all-position arrival bound.
12 pub lower_s: f64,
13 /// Original finite latest all-position arrival bound.
14 pub upper_s: f64,
15 /// Exact high/low expansion of the complete original arrival-window width.
16 pub width_s: GateActuatorTimeExpansion,
17}
18
19/// Selected ideal response direction toward the active target.
20#[derive(Clone, Copy, Debug, PartialEq, Eq)]
21pub enum GateActuatorDirection {
22 /// Motion increases opening toward the active target.
23 Opening,
24 /// Motion decreases opening toward the active target.
25 Closing,
26}
27
28/// Optional exact-product and finite TwoSum evidence for local fused rounding.
29#[derive(Clone, Debug, PartialEq)]
30pub struct GateActuatorBinaryWitness {
31 /// Finite exactly represented product certified by the optional binary witness.
32 pub product_m: f64,
33 /// Finite TwoSum high, matching the strict fused result.
34 pub sum_high_m: f64,
35 /// Finite TwoSum residual giving the exact local fused rounding error.
36 pub sum_low_m: f64,
37}
38
39/// One strict fused stage with original operands and independent rounding evidence.
40#[derive(Clone, Debug, PartialEq)]
41pub struct GateActuatorFmaStageReceipt {
42 /// Original selected directional rate with its exact motion sign.
43 pub signed_rate_m_per_s: f64,
44 /// Original elapsed high or signed low used by this fused stage.
45 pub time_component_s: f64,
46 /// Original anchor operand or retained primary fused result.
47 pub addend_m: f64,
48 /// Finite strict Numr fused multiply-add result.
49 pub result_m: f64,
50 /// Independent nonnegative allowance for this stage alone.
51 pub rounding_error_m: f64,
52 /// Whether the operand grid proves this stage's zero result mathematically exact.
53 pub zero_grid_certificate: bool,
54 /// Optional checked exact-product/TwoSum certificate. Absence preserves ordinary fused admission.
55 pub exact_binary_witness: Option<GateActuatorBinaryWitness>,
56}
57
58/// Signed two-stage motion evaluation and uncapped position enclosure.
59#[derive(Clone, Debug, PartialEq)]
60pub struct GateActuatorMotionReceipt {
61 /// Selected motion direction from the original anchor operand and target.
62 pub direction: GateActuatorDirection,
63 /// Original nonnegative magnitude of the selected directional rate.
64 pub rate_m_per_s: f64,
65 /// First fused evaluation using elapsed high and original anchor operand.
66 pub primary: GateActuatorFmaStageReceipt,
67 /// Second fused evaluation for nonzero signed elapsed low. None skips that operation entirely.
68 pub elapsed_low: Option<GateActuatorFmaStageReceipt>,
69 /// Outward sum of used fused-stage allowances, without duplicating elapsed-low correction.
70 pub raw_error_m: f64,
71 /// Uncapped finite lower endpoint, or None for a proved unbounded lower endpoint.
72 pub raw_lower_m: Option<f64>,
73 /// Uncapped finite upper endpoint, or None for a proved unbounded upper endpoint.
74 pub raw_upper_m: Option<f64>,
75}
76
77/// Physical response image of one retained anchor endpoint.
78#[derive(Clone, Debug, PartialEq)]
79pub struct GateActuatorEndpointReceipt {
80 /// Original anchor endpoint evaluated by this physical response map.
81 pub anchor_opening_m: f64,
82 /// Motion evidence, absent for exact-time-zero, equal-target, or selected-rate-zero holds.
83 pub motion: Option<GateActuatorMotionReceipt>,
84 /// Certified finite lower bound on ideal actual opening, in metres.
85 pub lower_opening_m: f64,
86 /// Certified finite upper bound on ideal actual opening, in metres.
87 pub upper_opening_m: f64,
88}
89
90/// Complete elapsed, endpoint, and center evidence for one original query.
91#[derive(Clone, Debug, PartialEq)]
92pub struct GateActuatorForwardReceipt {
93 /// Retained original epoch and complete position interval for this target episode.
94 pub anchor: GateActuatorAnchor,
95 /// Original supported time used for this forward proof.
96 pub query_time_s: f64,
97 /// Original active target in metres, inside the actual gate range.
98 pub target_opening_m: f64,
99 /// Complete original query-minus-anchor elapsed expansion.
100 pub elapsed_s: GateActuatorTimeExpansion,
101 /// Physical response evidence from the retained lower anchor endpoint.
102 pub lower_endpoint: GateActuatorEndpointReceipt,
103 /// Physical response evidence from the retained upper anchor endpoint.
104 pub upper_endpoint: GateActuatorEndpointReceipt,
105 /// Center evaluation, absent when an admitted hold or completion bypasses motion.
106 pub center_motion: Option<GateActuatorMotionReceipt>,
107 /// Complete represented opening and inherited certified uncertainty.
108 pub position: GateActuatorPosition,
109}
110
111/// Bounded analytic or forward-singleton proof for one completed active episode.
112#[derive(Clone, Debug, PartialEq)]
113pub struct GateActuatorCompletionReceipt {
114 /// Zero-based active episode identity retained by this completion proof.
115 pub episode_index: usize,
116 /// Count of actual target changes identifying the active target bits.
117 pub target_generation: usize,
118 /// First accepted original time proving completion of this episode.
119 pub confirmed_at_s: f64,
120 /// Unchanged original analytic arrival certificate for bounded recomputation.
121 pub original_arrival: GateActuatorArrivalCertificate,
122 /// Minimum of original analytic upper and accepted confirmation time.
123 pub effective_upper_s: f64,
124 /// Exact width from original lower to the effective completion upper.
125 pub effective_width_s: GateActuatorTimeExpansion,
126 /// Retained forward singleton proof when confirmation precedes the analytic upper.
127 pub forward: Option<GateActuatorForwardReceipt>,
128}