1 /*
2     Gpredict: Real-time satellite tracking and orbit prediction program
3 
4     Copyright (C)  2001-2009  Alexandru Csete, OZ9AEC.
5 
6     Authors: Alexandru Csete <oz9aec@gmail.com>
7     Charles Suprin <hamaa1vs@gmail.com>
8 
9     Comments, questions and bugreports should be submitted via
10     http://sourceforge.net/projects/gpredict/
11     More details can be found at the project home page:
12 
13             http://gpredict.oz9aec.net/
14 
15     This program is free software; you can redistribute it and/or modify
16     it under the terms of the GNU General Public License as published by
17     the Free Software Foundation; either version 2 of the License, or
18     (at your option) any later version.
19 
20     This program is distributed in the hope that it will be useful,
21     but WITHOUT ANY WARRANTY; without even the implied warranty of
22     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23     GNU General Public License for more details.
24 
25     You should have received a copy of the GNU General Public License
26     along with this program; if not, visit http://www.fsf.org/
27 */
28 #ifndef PREDICT_TOOLS_H
29 #define PREDICT_TOOLS_H 1
30 
31 #include <glib.h>
32 #include "gtk-sat-data.h"
33 #include "sat-vis.h"
34 #include "sgpsdp/sgp4sdp4.h"
35 
36 
37 /** \brief Brief satellite pass info. */
38 typedef struct {
39     gchar      *satname;  /*!< satellite name */
40     gdouble     aos;      /*!< AOS time in "jul_utc" */
41     gdouble     tca;      /*!< TCA time in "jul_utc" */
42     gdouble     los;      /*!< LOS time in "jul_utc" */
43     gdouble     max_el;   /*!< Maximum elevation during pass */
44     gdouble     aos_az;   /*!< Azimuth at AOS */
45     gdouble     los_az;   /*!< Azimuth at LOS */
46     gint        orbit;    /*!< Orbit number */
47     gdouble     maxel_az; /*!< Azimuth at maximum elevation */
48     gchar       vis[4];   /*!< Visibility string, e.g. VSE, -S-, V-- */
49     GSList     *details;  /*!< List of pass_detail_t entries */
50     qth_small_t qth_comp; /*!< Short version of qth at time computed */
51 } pass_t;
52 
53 /**
54  * \brief Pass detail entry.
55  *
56  * In order to ensure maximum flexibility at a minimal effort, only the
57  * raw position and velocity is calculated. Calculations of the
58  * "human readable" parameters are the responsibility of the consumer.
59  * This way we can use the same prediction engine for various consumers
60  * without having too much overhead and complexity in the low level code.
61  */
62 typedef struct {
63     gdouble   time;   /*!< time in "jul_utc" */
64     vector_t  pos;    /*!< Raw unprocessed position at time */
65     vector_t  vel;    /*!< Raw unprocessed velocity at time */
66     gdouble   velo;
67     gdouble   az;
68     gdouble   el;
69     gdouble   range;
70     gdouble   range_rate;
71     gdouble   lat;
72     gdouble   lon;
73     gdouble   alt;
74     gdouble   ma;
75     gdouble   phase;
76     gdouble   footprint;
77     sat_vis_t vis;
78     gint      orbit;
79 } pass_detail_t;
80 
81 /* type casting macros */
82 #define PASS(x) ((pass_t *) x)
83 #define PASS_DETAIL(x) ((pass_detail_t *) x)
84 
85 /* SGP4/SDP4 driver */
86 void predict_calc (sat_t *sat, qth_t *qth, gdouble t);
87 
88 /* AOS/LOS time calculators */
89 gdouble find_aos           (sat_t *sat, qth_t *qth, gdouble start, gdouble maxdt);
90 gdouble find_los           (sat_t *sat, qth_t *qth, gdouble start, gdouble maxdt);
91 gdouble find_prev_aos      (sat_t *sat, qth_t *qth, gdouble start);
92 
93 /* next events */
94 pass_t *get_next_pass      (sat_t *sat, qth_t *qth, gdouble maxdt);
95 GSList *get_next_passes    (sat_t *sat, qth_t *qth, gdouble maxdt, guint num);
96 
97 /* future events */
98 pass_t *get_pass           (sat_t *sat, qth_t *qth, gdouble start, gdouble maxdt);
99 GSList *get_passes         (sat_t *sat, qth_t *qth, gdouble start, gdouble maxdt, guint num);
100 pass_t *get_current_pass   (sat_t *sat, qth_t *qth, gdouble start);
101 pass_t *get_pass_no_min_el (sat_t *sat, qth_t *qth, gdouble start, gdouble maxdt);
102 
103 /* copying */
104 pass_t        *copy_pass         (pass_t *pass);
105 GSList        *copy_pass_details (GSList *details);
106 pass_detail_t *copy_pass_detail  (pass_detail_t *detail);
107 
108 /* memory cleaning */
109 void free_pass         (pass_t *pass);
110 void free_passes       (GSList *passes);
111 void free_pass_detail  (pass_detail_t *detail);
112 void free_pass_details (GSList *details);
113 
114 #endif
115