libpredict  2.0.0
A satellite orbit prediction library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
predict.h
Go to the documentation of this file.
1 #ifndef _PREDICT_H_
2 #define _PREDICT_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <time.h>
9 #include <stdbool.h>
10 
11 #define PREDICT_VERSION_MAJOR 2
12 #define PREDICT_VERSION_MINOR 0
13 #define PREDICT_VERSION_PATCH 0
14 #define PREDICT_VERSION (PREDICT_VERSION_MAJOR * 100 * 100 + PREDICT_VERSION_MINOR * 100 + PREDICT_VERSION_PATCH)
15 #define PREDICT_VERSION_STRING "2.0.0"
16 
23 
30 
37 
43 int predict_version();
44 
51 
55 typedef double predict_julian_date_t;
56 
63 predict_julian_date_t predict_to_julian(time_t time);
64 
71 time_t predict_from_julian(predict_julian_date_t date);
72 
81 };
82 
86 typedef struct {
92  char designator[10];
96  double epoch_day;
98  double inclination;
102  double eccentricity;
106  double mean_anomaly;
108  double mean_motion;
117 
119  enum predict_ephemeris ephemeris;
123 
132 predict_orbital_elements_t* predict_parse_tle(const char *tle_line_1, const char *tle_line_2);
133 
139 
145  predict_julian_date_t time;
146 
148  bool decayed;
149 
151  double position[3];
153  double velocity[3];
154 
156  double latitude;
158  double longitude;
160  double altitude;
162  double footprint;
164  int eclipsed;
168  double phase;
171 
173  double inclination;
178 };
179 
188 int predict_orbit(const predict_orbital_elements_t *orbital_elements, struct predict_position *x, predict_julian_date_t time);
189 
209 bool predict_is_geosynchronous(const predict_orbital_elements_t *orbital_elements);
210 
219 
228 
237 bool predict_aos_happens(const predict_orbital_elements_t *x, double latitude);
238 
242 typedef struct {
244  char name[128];
246  double latitude;
248  double longitude;
250  double altitude;
252 
258  predict_julian_date_t time;
260  double azimuth;
262  double azimuth_rate;
264  double elevation;
268  double range;
272  double range_rate;
275  // - The satellite is in sunlight
276  // - The satellite is above the horizon
277  // - The sky is dark enough (sun elevation is below a fixed threshold)
278  bool visible;
279 };
280 
290 predict_observer_t *predict_create_observer(const char *name, double lat, double lon, double alt);
291 
298 
307 void predict_observe_orbit(const predict_observer_t *observer, const struct predict_position *orbit, struct predict_observation *obs);
308 
317 void predict_observe_moon(const predict_observer_t *observer, predict_julian_date_t time, struct predict_observation *obs);
318 
325 double predict_moon_ra(predict_julian_date_t time);
326 
333 double predict_moon_declination(predict_julian_date_t time);
334 
342 double predict_moon_gha(predict_julian_date_t time);
343 
352 void predict_observe_sun(const predict_observer_t *observer, predict_julian_date_t time, struct predict_observation *obs);
353 
361 double predict_sun_ra(predict_julian_date_t time);
362 
370 double predict_sun_declination(predict_julian_date_t time);
371 
379 double predict_sun_gha(predict_julian_date_t time);
380 
390 struct predict_observation predict_next_aos(const predict_observer_t *observer, const predict_orbital_elements_t *orbital_elements, predict_julian_date_t start_time);
391 
401 struct predict_observation predict_next_los(const predict_observer_t *observer, const predict_orbital_elements_t *orbital_elements, predict_julian_date_t start_time);
402 
411 struct predict_observation predict_at_max_elevation(const predict_observer_t *observer, const predict_orbital_elements_t *orbital_elements, predict_julian_date_t start_time);
412 
421 double predict_doppler_shift(const struct predict_observation *observation, double downlink_frequency);
422 
433 double predict_squint_angle(const predict_observer_t *observer, const struct predict_position *orbit, double alon, double alat);
434 
444 double predict_refraction(double el);
445 
457 double predict_refraction_ext(double el, double pressure, double temp);
458 
468 double predict_refraction_from_apparent(double apparent_el);
469 
481 double predict_refraction_from_apparent_ext(double apparent_el, double pressure, double temp);
482 
491 double predict_refraction_rate(double el, double el_rate);
492 
505 double predict_refraction_rate_ext(double el, double el_rate, double pressure, double temp);
506 
514 double predict_apparent_elevation(double el);
515 
527 double predict_apparent_elevation_ext(double el, double pressure, double temp);
528 
537 double predict_apparent_elevation_rate(double el, double el_rate);
538 
551 double predict_apparent_elevation_rate_ext(double el, double el_rate, double pressure, double temp);
552 
553 #ifdef __cplusplus
554 }
555 #endif
556 
557 #endif //_PREDICT_H_
double altitude
Altitude in km.
Definition: predict.h:160
double predict_refraction_rate_ext(double el, double el_rate, double pressure, double temp)
Calculate refraction rate of change.
Definition: predict.h:79
Predicted orbital values for satellite at a given time.
Definition: predict.h:143
double bstar_drag_term
BSTAR drag term (decimal point assumed, line 1, field 11)
Definition: predict.h:114
double mean_anomaly
Mean Anomaly [Degrees] (line 2, field 7)
Definition: predict.h:106
double predict_sun_declination(predict_julian_date_t time)
Calculate declination of the sun.
double right_ascension
Current right ascension of the ascending node (from xnodek within sgp4/sdp4)
Definition: predict.h:175
void predict_observe_orbit(const predict_observer_t *observer, const struct predict_position *orbit, struct predict_observation *obs)
Find relative position of satellite with respect to an observer.
predict_orbital_elements_t * predict_parse_tle(const char *tle_line_1, const char *tle_line_2)
Create predict_orbital_elements_t from TLE strings.
double longitude
Longitude (WGS84, radians)
Definition: predict.h:248
bool visible
Visibility status, whether satellite can be seen by optical means.
Definition: predict.h:278
double predict_sun_gha(predict_julian_date_t time)
Calculate the greenwich hour angle (longitude) of the sun.
void predict_destroy_observer(predict_observer_t *obs)
Free observer.
double right_ascension
Right Ascension of the Ascending Node [Degrees] (line 2, field 4)
Definition: predict.h:100
double inclination
Inclination (line 2, field 3)
Definition: predict.h:98
double footprint
Footprint diameter in km.
Definition: predict.h:162
double predict_apparent_elevation_rate_ext(double el, double el_rate, double pressure, double temp)
Calculate apparent elevation rate.
bool decayed
Whether the orbit has decayed.
Definition: predict.h:148
int predict_version_patch()
Get the patch version number of the library.
double range_x
Range vector.
Definition: predict.h:270
long revolutions
The current number of revolutions around Earth.
Definition: predict.h:170
double mean_motion
Mean Motion [Revs per day] (line 2, field 8)
Definition: predict.h:108
double elevation
Elevation angle (rad)
Definition: predict.h:264
predict_julian_date_t predict_to_julian(time_t time)
Convert time_t in UTC to Julian date in UTC.
double range
Range (km)
Definition: predict.h:268
predict_observer_t * predict_create_observer(const char *name, double lat, double lon, double alt)
Create observation point (QTH).
double predict_apparent_elevation_rate(double el, double el_rate)
Calculate apparent elevation rate.
double predict_moon_ra(predict_julian_date_t time)
Calculate right ascension of the moon.
double second_derivative_mean_motion
Second Time Derivative of Mean Motion divided by six (line 1, field 10)
Definition: predict.h:112
double eclipse_depth
Eclipse depth.
Definition: predict.h:166
double predict_refraction(double el)
Calculate refraction angle.
int predict_version()
Get the version number of the library.
time_t predict_from_julian(predict_julian_date_t date)
Convert Julian date in UTC back to a time_t in UTC.
predict_ephemeris
Simplified perturbation models used in modeling the satellite orbits.
Definition: predict.h:76
int revolutions_at_epoch
Number of revolutions around Earth at epoch (line 2, field 9)
Definition: predict.h:116
double azimuth_rate
Azimuth angle rate (rad/s)
Definition: predict.h:262
Definition: predict.h:77
void predict_observe_moon(const predict_observer_t *observer, predict_julian_date_t time, struct predict_observation *obs)
Estimate relative position of the moon.
predict_julian_date_t time
Timestamp for last call to orbit_predict.
Definition: predict.h:145
double predict_sun_ra(predict_julian_date_t time)
Calculate right ascension of the sun.
Definition: predict.h:80
predict_julian_date_t time
UTC time.
Definition: predict.h:258
struct predict_observation predict_next_aos(const predict_observer_t *observer, const predict_orbital_elements_t *orbital_elements, predict_julian_date_t start_time)
Find next acquisition of signal (AOS) of satellite (when the satellite rises above the horizon)...
bool predict_is_geosynchronous(const predict_orbital_elements_t *orbital_elements)
Find whether an orbit is geosynchronous.
Definition: predict.h:78
double latitude
Latitude in radians, northing/easting.
Definition: predict.h:156
double predict_julian_date_t
The representation of time used by libpredict: The number of days since 31Dec79 00:00:00 UTC...
Definition: predict.h:55
int predict_orbit(const predict_orbital_elements_t *orbital_elements, struct predict_position *x, predict_julian_date_t time)
Main prediction function.
void * ephemeris_data
Ephemeris data structure pointer.
Definition: predict.h:121
struct predict_observation predict_next_los(const predict_observer_t *observer, const predict_orbital_elements_t *orbital_elements, predict_julian_date_t start_time)
Find next loss of signal (LOS) of satellite (when the satellite goes below the horizon).
Container for processed TLE data from TLE strings.
Definition: predict.h:86
double velocity[3]
ECI velocity in km/s.
Definition: predict.h:153
bool predict_aos_happens(const predict_orbital_elements_t *x, double latitude)
Find whether an AOS can ever happen on the given latitude.
double predict_refraction_from_apparent(double apparent_el)
Calculate refraction angle from apparent elevation.
double predict_apogee(const predict_orbital_elements_t *x)
Get apogee of satellite orbit.
double predict_apparent_elevation_ext(double el, double pressure, double temp)
Calculate apparent elevation from true elevation.
double predict_refraction_from_apparent_ext(double apparent_el, double pressure, double temp)
Calculate refraction angle from apparent elevation.
double predict_doppler_shift(const struct predict_observation *observation, double downlink_frequency)
Calculate doppler shift of a given downlink frequency with respect to an observer.
long element_number
Element number (line 1, field 13)
Definition: predict.h:90
double longitude
Longitude in radians, northing/easting.
Definition: predict.h:158
double altitude
Altitude (WGS84, meters)
Definition: predict.h:250
Data relevant for a relative observation of an orbit or similar with respect to an observation point...
Definition: predict.h:256
double latitude
Latitude (WGS84, radians)
Definition: predict.h:246
int predict_version_major()
Get the major version number of the library.
double epoch_day
Epoch day (day of year and fractional portion of day, line 1, field 8)
Definition: predict.h:96
int predict_version_minor()
Get the minor version number of the library.
double argument_of_perigee
Argument of Perigee [Degrees] (line 2, field 6)
Definition: predict.h:104
double predict_moon_declination(predict_julian_date_t time)
Calculate declination of the moon.
struct predict_observation predict_at_max_elevation(const predict_observer_t *observer, const predict_orbital_elements_t *orbital_elements, predict_julian_date_t start_time)
Find maximum elevation of next or current pass.
double azimuth
Azimuth angle (rad)
Definition: predict.h:260
double predict_apparent_elevation(double el)
Calculate apparent elevation from true elevation.
int satellite_number
Satellite number (line 1, field 2)
Definition: predict.h:88
double range_z
Definition: predict.h:270
double argument_of_perigee
Current argument of perigee (from omgadf within sgp4/sdp4)
Definition: predict.h:177
double derivative_mean_motion
First Time Derivative of the Mean Motion divided by two (line 1, field 9)
Definition: predict.h:110
int epoch_year
Epoch year (last two digits) (line 1, field 7)
Definition: predict.h:94
void predict_observe_sun(const predict_observer_t *observer, predict_julian_date_t time, struct predict_observation *obs)
Estimate relative position of the sun.
double position[3]
ECI position in km.
Definition: predict.h:151
double predict_moon_gha(predict_julian_date_t time)
Calculate the greenwich hour angle (longitude) of the moon.
void predict_destroy_orbital_elements(predict_orbital_elements_t *orbital_elements)
Free memory allocated in orbital elements structure.
int eclipsed
Whether satellite is eclipsed by the earth.
Definition: predict.h:164
double predict_squint_angle(const predict_observer_t *observer, const struct predict_position *orbit, double alon, double alat)
Calculate squint angle for satellite, i.e.
double range_y
Definition: predict.h:270
double inclination
Current inclination (from xinck within sgp4/sdp4)
Definition: predict.h:173
Observation point/ground station (QTH).
Definition: predict.h:242
char * predict_version_string()
Get the version number string of the library.
double range_rate
Range velocity (km/s)
Definition: predict.h:272
double phase
Orbital phase (mean anomaly)
Definition: predict.h:168
double predict_refraction_ext(double el, double pressure, double temp)
Calculate refraction angle.
double eccentricity
Eccentricity (line 2, field 5)
Definition: predict.h:102
double predict_perigee(const predict_orbital_elements_t *x)
Get perigee of satellite orbit.
double predict_refraction_rate(double el, double el_rate)
Calculate refraction rate of change.
double elevation_rate
Elevation angle rate (rad/s)
Definition: predict.h:266