1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*!
* Event detection for numerical propagation
*
* This module provides infrastructure for detecting and handling events during
* numerical integration, including:
*
* - Zero-crossing detection with bisection refinement
* - Pre-defined event detectors (time, altitude)
* - Value event detectors (continuous value comparisons)
* - Binary event detectors (boolean condition transitions)
* - Event callbacks with side effects
* - Terminal events that stop propagation
*
* # Event Detection Process
*
* 1. **Monitoring**: During propagation, event detectors are evaluated at each step
* 2. **Detection**: When a zero-crossing is detected, bisection search refines the event time
* 3. **Callback**: Optional callbacks can modify state, parameters, or trigger actions
* 4. **Continuation**: Propagation continues unless event is terminal
*
* # Examples
*
* ## Time-based Event
* ```
* use brahe::events::STimeEvent;
* use brahe::time::{Epoch, TimeSystem};
*
* let target = Epoch::from_jd(2451545.5, TimeSystem::UTC);
* let event = STimeEvent::<6, 0>::new(target, "Maneuver")
* .with_time_tolerance(1e-6); // Optional: customize tolerance (default: 1e-6 s)
* ```
*
* ## Altitude Event
* ```
* use brahe::events::{SAltitudeEvent, EventDirection};
*
* // Detect when geodetic altitude drops below 500 km (6D state)
* // Note: Requires EOP initialization for ECI->ECEF transformation
* let event = SAltitudeEvent::<6, 0>::new(
* 500e3,
* "Low Altitude Warning",
* EventDirection::Decreasing
* );
* ```
*
* ## Value Event
* ```
* use brahe::events::{SValueEvent, EventDirection};
* use nalgebra::SVector;
*
* // Detect when mass (state[6]) drops below 100 kg
* let event = SValueEvent::<7, 4>::new(
* "Low Fuel",
* |_t, state: &SVector<f64, 7>, _params| state[6],
* 100.0,
* EventDirection::Decreasing
* );
* ```
*
* ## Binary Event
* ```
* use brahe::events::{SBinaryEvent, EdgeType};
* use nalgebra::SVector;
*
* # fn is_sunlit(_pos: nalgebra::Vector3<f64>) -> bool { true }
* // Detect entering eclipse (sunlit → shadow)
* let event = SBinaryEvent::<7, 4>::new(
* "Enter Eclipse",
* |_t, state: &SVector<f64, 7>, _params| {
* // Returns true if sunlit, false if in shadow
* is_sunlit(state.fixed_rows::<3>(0).into())
* },
* EdgeType::FallingEdge
* );
* ```
*/
// Re-export main types
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;