[Gpredict-svn] SF.net SVN: gpredict:[792] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
From: <aa...@us...> - 2011-03-26 00:55:07
|
Revision: 792 http://gpredict.svn.sourceforge.net/gpredict/?rev=792&view=rev Author: aa1vs Date: 2011-03-26 00:55:01 +0000 (Sat, 26 Mar 2011) Log Message: ----------- Unify get_pass and get_pass_no_min_el with same code. Modified Paths: -------------- trunk/ChangeLog trunk/NEWS trunk/src/predict-tools.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-03-24 23:38:54 UTC (rev 791) +++ trunk/ChangeLog 2011-03-26 00:55:01 UTC (rev 792) @@ -1,3 +1,29 @@ +2011-03-24 Charles Suprin <hamaa1vs at gmail.com> + + * src/predict-tools.c + Unify get_pass and get_pass_no_min_el to use common pass generator. + + +2011-03-22 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-sat-map.c + Remove decayed satellites from map view. + +2011-03-21 Charles Suprin <hamaa1vs at gmail.com> + + * src/gtk-event-list-popup.c + * src/gtk-polar-view-popup.c + * src/gtk-sat-list-popup.c + * src/gtk-sat-list.c + * src/gtk-sat-map-ground-track.c + * src/gtk-sat-map-popup.c + * src/gtk-sat-module.c + * src/gtk-single-sat.c + * src/orbit-tools.c + * src/predict-tools.c + Include geo and decayed orbits in has_aos and make dynamic calls to + decayed instead of static orbit type check. + 2011-03-20 Charles Suprin <hamaa1vs at gmail.com> Merged gpsd_testing branch into trunk. Modified: trunk/NEWS =================================================================== --- trunk/NEWS 2011-03-24 23:38:54 UTC (rev 791) +++ trunk/NEWS 2011-03-26 00:55:01 UTC (rev 792) @@ -1,6 +1,7 @@ Changes in version 1.4 (TBD) - Feature request 3141555: gpsd support. +- Improve handling of decayed satellites. Changes in version 1.3 (1 Mar 2011) Modified: trunk/src/predict-tools.c =================================================================== --- trunk/src/predict-tools.c 2011-03-24 23:38:54 UTC (rev 791) +++ trunk/src/predict-tools.c 2011-03-26 00:55:01 UTC (rev 792) @@ -43,6 +43,8 @@ #include "sat-log.h" +static pass_t * get_pass_engine (sat_t *sat_in, qth_t *qth, gdouble start, gdouble maxdt, gdouble min_el); + /** \brief SGP4SDP4 driver for doing AOS/LOS calculations. * \param sat Pointer to the satellite data. * \param qth Pointer to the QTH data. @@ -420,6 +422,38 @@ * \param maxdt The maximum number of days to look ahead (0 for no limit). * \return Pointer to a newly allocated pass_t structure or NULL if * there was an error. + * This function assumes that you want a pass that achieves the + * minimum elevation of is configured for. + */ + +pass_t * +get_pass (sat_t *sat_in, qth_t *qth, gdouble start, gdouble maxdt) { + return get_pass_engine (sat_in, qth, start, maxdt, 1.0*sat_cfg_get_int (SAT_CFG_INT_PRED_MIN_EL)); +} + +/** \brief Predict first pass after a certain time ignoring the min elevation. + * \param sat Pointer to the satellite data. + * \param qth Pointer to the location data. + * \param start Starting time. + * \param maxdt The maximum number of days to look ahead (0 for no limit). + * \return Pointer to a newly allocated pass_t structure or NULL if + * there was an error. + * This function assumes that you want a pass that achieves the + * minimum elevation of is configured for. + */ +pass_t * +get_pass_no_min_el (sat_t *sat_in, qth_t *qth, gdouble start, gdouble maxdt) { + return get_pass_engine (sat_in, qth, start, maxdt, 0.0); +} + + +/** \brief Predict first pass after a certain time. + * \param sat Pointer to the satellite data. + * \param qth Pointer to the location data. + * \param start Starting time. + * \param maxdt The maximum number of days to look ahead (0 for no limit). + * \return Pointer to a newly allocated pass_t structure or NULL if + * there was an error. * * This function will find the first upcoming pass with AOS no earlier than * t = start and no later than t = (start+maxdt). @@ -434,8 +468,9 @@ * Therefore, the elements are prepended whereafter the GSList is * reversed */ -pass_t * -get_pass (sat_t *sat_in, qth_t *qth, gdouble start, gdouble maxdt) + +static pass_t * +get_pass_engine (sat_t *sat_in, qth_t *qth, gdouble start, gdouble maxdt, gdouble min_el) { gdouble aos = 0.0; /* time of AOS */ gdouble tca = 0.0; /* time of TCA */ @@ -601,7 +636,7 @@ pass->tca = tca; /* check whether this pass is good */ - if (max_el >= sat_cfg_get_int (SAT_CFG_INT_PRED_MIN_EL)) { + if (max_el >= min_el) { done = TRUE; } else { @@ -858,187 +893,6 @@ details = NULL; } - - -/** \brief Predict first pass after a certain time disergarding any minimum El setting. - * \param sat Pointer to the satellite data. - * \param qth Pointer to the location data. - * \param start Starting time. - * \param maxdt The maximum number of days to look ahead (0 for no limit). - * \return Pointer to a newly allocated pass_t structure or NULL if - * there was an error. - * - * This function will find the first upcoming pass with AOS no earlier than - * t = start and no later than t = (start+maxdt). Since the intented use of this - * function is to get the details of the current pass of a satellite, this function - * does not care of the minimum elevation setting in sat-cfg. - * - * \note For no time limit use maxdt = 0.0 - * - * \note the data in sat will be corrupt (future) and must be refreshed - * by the caller, if the caller will need it later on (eg. if the caller - * is GtkSatList). - * - * \note Prepending to a singly linked list is much faster than appending. - * Therefore, the elements are prepended whereafter the GSList is - * reversed - */ -pass_t * -get_pass_no_min_el (sat_t *sat_in, qth_t *qth, gdouble start, gdouble maxdt) -{ - gdouble aos = 0.0; /* time of AOS */ - gdouble tca = 0.0; /* time of TCA */ - gdouble los = 0.0; /* time of LOS */ - gdouble dt = 0.0; /* time diff */ - gdouble step = 0.0; /* time step */ - gdouble t0 = start; - gdouble t; /* current time counter */ - gdouble tres = 0.0; /* required time resolution */ - gdouble max_el = 0.0; /* maximum elevation */ - pass_t *pass = NULL; - pass_detail_t *detail = NULL; - gboolean done = FALSE; - sat_t *sat,sat_working; - - /* FIXME: watchdog */ - - /*copy sat_in to a working structure*/ - sat = memcpy(&sat_working,sat_in,sizeof(sat_t)); - - /* get time resolution; sat-cfg stores it in seconds */ - tres = sat_cfg_get_int (SAT_CFG_INT_PRED_RESOLUTION) / 86400.0; - - - aos = find_aos (sat, qth, t0, maxdt); - - - /* aos = 0.0 means no aos */ - if (aos == 0.0) { - done = TRUE; - } - - /* check whether we are within time limits; - maxdt = 0 mean no time limit. - */ - else if ((maxdt > 0.0) && (aos > (start + maxdt))) { - done = TRUE; - } - else { - los = find_los (sat, qth, aos + 0.001, maxdt); // +1.5 min later - dt = los - aos; - - /* get time step, which will give us the max number of entries */ - step = dt / sat_cfg_get_int (SAT_CFG_INT_PRED_NUM_ENTRIES); - - /* but if this is smaller than the required resolution - we go with the resolution - */ - if (step < tres) - step = tres; - - /* create a pass_t entry; FIXME: g_try_new in 2.8 */ - pass = g_new (pass_t, 1); - - pass->aos = aos; - pass->los = los; - pass->max_el = 0.0; - pass->aos_az = 0.0; - pass->los_az = 0.0; - pass->maxel_az = 0.0; - pass->vis[0] = '-'; - pass->vis[1] = '-'; - pass->vis[2] = '-'; - pass->vis[3] = 0; - pass->satname = g_strdup (sat->nickname); - pass->details = NULL; - /*copy qth data into the pass for later comparisons*/ - qth_small_save(qth,&(pass->qth_comp)); - - /* iterate over each time step */ - for (t = pass->aos; t <= pass->los; t += step) { - - /* calculate satellite data */ - predict_calc (sat, qth, t); - - /* in the first iter we want to store - pass->aos_az - */ - if (t == pass->aos) { - pass->aos_az = sat->az; - pass->orbit = sat->orbit; - } - - /* append details to sat->details */ - detail = g_new (pass_detail_t, 1); - detail->time = t; - detail->pos.x = sat->pos.x; - detail->pos.y = sat->pos.y; - detail->pos.z = sat->pos.z; - detail->pos.w = sat->pos.w; - detail->vel.x = sat->vel.x; - detail->vel.y = sat->vel.y; - detail->vel.z = sat->vel.z; - detail->vel.w = sat->vel.w; - detail->velo = sat->velo; - detail->az = sat->az; - detail->el = sat->el; - detail->range = sat->range; - detail->range_rate = sat->range_rate; - detail->lat = sat->ssplat; - detail->lon = sat->ssplon; - detail->alt = sat->alt; - detail->ma = sat->ma; - detail->phase = sat->phase; - detail->footprint = sat->footprint; - detail->orbit = sat->orbit; - detail->vis = get_sat_vis (sat, qth, t); - - /* also store visibility "bit" */ - switch (detail->vis) { - case SAT_VIS_VISIBLE: - pass->vis[0] = 'V'; - break; - case SAT_VIS_DAYLIGHT: - pass->vis[1] = 'D'; - break; - case SAT_VIS_ECLIPSED: - pass->vis[2] = 'E'; - break; - default: - break; - } - - pass->details = g_slist_prepend (pass->details, detail); - - /* store elevation if greater than the - previously stored one - */ - if (sat->el > max_el) { - max_el = sat->el; - tca = t; - pass->maxel_az = sat->az; - } - - /* g_print ("TIME: %f\tAZ: %f\tEL: %f (MAX: %f)\n", */ - /* t, sat->az, sat->el, max_el); */ - } - - pass->details = g_slist_reverse (pass->details); - - /* calculate satellite data */ - predict_calc (sat, qth, pass->los); - /* store los_az, max_el and tca */ - pass->los_az = sat->az; - pass->max_el = max_el; - pass->tca = tca; - - } - - return pass; -} - - - /** \brief Get current pass. * \param sat Pointer to the satellite data. * \param qth Pointer to the QTH data. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |