predict_rs/predict.rs
1use crate::math::Vec3;
2use sgp4::{Constants, Elements};
3
4/// Predicted orbital values for satellite at a given time.
5#[derive(Debug)]
6pub struct PredictPosition {
7 /// Timestamp for last call to `orbit_predict`
8 pub time: f64,
9 /// Whether the orbit has decayed
10 pub decayed: bool,
11 /// ECI position in km
12 pub position: Vec3,
13 /// ECI velocity in km/s
14 pub velocity: Vec3,
15 /// Latitude in radians, northing/easting
16 pub latitude: f64,
17 /// Longitude in radians, northing/easting
18 pub longitude: f64,
19 /// Altitude in km
20 pub altitude: f64,
21 /// Footprint diameter in km
22 pub footprint: f64,
23 /// Whether satellite is eclipsed by the earth
24 pub eclipsed: bool,
25 /// Eclipse depth
26 pub eclipse_depth: f64,
27 /// Number of revolutions
28 pub revolutions: f64,
29 /*
30 /// Orbital phase (mean anomaly)
31 pub phase: f64,
32 /// The current number of revolutions around Earth
33
34 /// Current inclination (from xinck within sgp4/sdp4)
35 pub inclination: f64,
36 /// Current right ascension of the ascending node (from xnodek within sgp4/sdp4)
37 pub right_ascension: f64,
38 /// Current argument of perigee (from omgadf within sgp4/sdp4)
39 pub argument_of_perigee: f64,
40 */
41}
42
43/// Observation point/ground station (QTH)
44#[derive(Debug)]
45pub struct PredictObserver {
46 /// Observatory name
47 pub name: String,
48 /// Latitude (WGS84, radians)
49 pub latitude: f64,
50 /// Longitude (WGS84, radians)
51 pub longitude: f64,
52 /// Altitude (WGS84, meters)
53 pub altitude: f64,
54 /// Minimum elevation (WGS84, radians)
55 pub min_elevation: f64,
56}
57
58/// Data relevant for a relative observation of an orbit or similar with respect to an observation point
59#[derive(Debug)]
60pub struct PredictObservation {
61 /// UTC time
62 pub time: f64,
63 /// Azimuth angle (rad)
64 pub azimuth: f64,
65 /// Azimuth angle rate (rad/s)
66 pub azimuth_rate: f64,
67 /// Elevation angle (rad)
68 pub elevation: f64,
69 /// Elevation angle rate (rad/s)
70 pub elevation_rate: f64,
71 /// Range (km)
72 pub range: f64,
73 /// Range x component
74 pub range_x: f64,
75 /// Range y component
76 pub range_y: f64,
77 /// Range z component
78 pub range_z: f64,
79 /// Range velocity (km/s)
80 pub range_rate: f64,
81 /// Number of revolutions
82 pub revolutions: f64,
83 /// Visibility status, whether satellite can be seen by optical means.
84 /// The satellite is defined to be visible if:
85 /// - The satellite is in sunlight
86 /// - The satellite is above the horizon
87 /// - The sky is dark enough (sun elevation is below a fixed threshold)
88 pub visible: bool,
89}
90
91/// A pass of a satellite over an observation point
92#[derive(Debug)]
93pub struct Pass {
94 /// acquisiton of signal
95 pub aos: Option<PredictObservation>,
96 /// satellite position at acquisiton of signal
97 pub satellite_position_at_aos: Option<PredictPosition>,
98 /// loss of signal
99 pub los: Option<PredictObservation>,
100 /// satellite position at loss of signal
101 pub satellite_position_at_los: Option<PredictPosition>,
102 /// max elevation for this pass
103 pub max_elevation: Option<f64>,
104}
105
106/// Container for a number of passes
107#[derive(Debug)]
108pub struct Passes {
109 pub passes: Vec<Pass>,
110}
111
112/// Container for an observer, the orbital elements of a satellite and the constants
113pub struct ObserverElements<'a> {
114 pub observer: &'a PredictObserver,
115 pub elements: &'a Elements,
116 pub constants: &'a Constants,
117}