gps.h

Go to the documentation of this file.
00001 /**
00002 \file    gps.h
00003 \brief   GNSS core 'c' function library: GPS specific functions.
00004 \author  Glenn D. MacGougan (GDM)
00005 \date    2005-08-14
00006 \since   2005-07-31
00007 
00008 \b "LICENSE INFORMATION" \n
00009 Copyright (c) 2007, refer to 'author' doxygen tags \n
00010 All rights reserved. \n
00011 
00012 Redistribution and use in source and binary forms, with or without
00013 modification, are permitted provided the following conditions are met: \n
00014 
00015 - Redistributions of source code must retain the above copyright
00016   notice, this list of conditions and the following disclaimer. \n
00017 - Redistributions in binary form must reproduce the above copyright
00018   notice, this list of conditions and the following disclaimer in the
00019   documentation and/or other materials provided with the distribution. \n
00020 - The name(s) of the contributor(s) may not be used to endorse or promote 
00021   products derived from this software without specific prior written 
00022   permission. \n
00023 
00024 THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRESS 
00025 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
00026 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00027 DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00028 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00029 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
00030 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
00031 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
00032 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
00033 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
00034 SUCH DAMAGE.
00035 */
00036 
00037 #ifndef _C_GPS_H_
00038 #define _C_GPS_H_
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00044 #include "basictypes.h"
00045 
00046 
00047 /// \brief    A set of satellite orbit parameters that is used 
00048 /// to calculate GPS satellite positions and velocities. In the ephemeris 
00049 /// structure below, the parameters for computing satellite clock corrections
00050 /// are also included.
00051 /// 
00052 /// \author   Glenn D. MacGougan (GDM)
00053 /// \date     2005-08-14
00054 /// \since    2005-08-14
00055 /// 
00056 /// \remarks
00057 /// (1) struct packaging: compatible with 4 and 8 byte packing \n
00058 /// 
00059 /// \b REFERENCES \n
00060 /// [1] ICD-GPS-200C, p. 93-102
00061 /// 
00062 typedef struct
00063 {
00064   unsigned       toe;                //!< reference time ephemeris (0-604800)                                           [s]
00065   unsigned       toc;                //!< reference time (clock)   (0-604800)                                           [s]    
00066 
00067   unsigned short prn;                //!< GPS PRN number
00068   unsigned short week;               //!< 10 bit gps week 0-1023 (user must account for week rollover )                 [week]    
00069   unsigned short iodc;               //!< 10 bit issue of data (clock)                                                  []    
00070   unsigned short reserved1;          //!< reserved bytes    
00071   
00072   unsigned char  iode;               //!< 8 bit  issue of data (ephemeris)                                              []  
00073   unsigned char  health;             //!< 6 bit health parameter, 0 if healthy, unhealth othersize                      [0=healthy]    
00074   unsigned char  alert_flag;         //!< 1 = URA may be worse than indicated                                           [0,1]
00075   unsigned char  anti_spoof;         //!< anti-spoof flag from 0=off, 1=on                                              [0,1]    
00076   unsigned char  code_on_L2;         //!< 0=reserved, 1=P code on L2, 2=C/A on L2                                       [0,1,2]
00077   unsigned char  L2_P_data_flag;     //!< flag indicating if P is on L2 1=true                                          [0,1]
00078   unsigned char  fit_interval_flag;  //!< fit interval flag (four hour interval or longer) 0=4 fours, 1=greater         [0,1]
00079   unsigned char  ura;                //!< User Range Accuracy lookup code, 0 is excellent, 15 is use at own risk        [0-15], see p. 83 GPSICD200C  
00080   unsigned short age_of_data_offset; //!< age of data offset                                                            [s]
00081   unsigned short tow_week;           //!< The week corresponding to tow (0-1024+). Can be one week larger than week.    [week]
00082   unsigned       tow;                //!< The time of week derived formt the Z-count in the Hand Over Word (HOW)        [s]
00083   
00084   // clock parameters
00085   double         tgd;        //!< group delay                                                                   [s]
00086   double         af2;        //!< polynomial clock correction coefficient (rate of clock drift)                 [s/s^2]
00087   double         af1;        //!< polynomial clock correction coefficient (clock drift)                         [s/s] Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
00088   double         af0;        //!< polynomial clock correction coefficient (clock bias)                          [s]   Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
00089   
00090   // ephemeris parameters
00091   double         m0;         //!< mean anomaly at reference time                                                [rad]
00092   double         delta_n;    //!< mean motion difference from computed value                                    [rad/s]
00093   double         ecc;        //!< eccentricity                                                                  []
00094   double         sqrta;      //!< square root of the semi-major axis                                            [m^(1/2)]
00095   double         omega0;     //!< longitude of ascending node of orbit plane at weekly epoch                    [rad]
00096   double         i0;         //!< inclination angle at reference time                                           [rad]
00097   double         w;          //!< argument of perigee                                                           [rad]
00098   double         omegadot;   //!< rate of right ascension                                                       [rad/s]
00099   double         idot;       //!< rate of inclination angle                                                     [rad/s]
00100   double         cuc;        //!< amplitude of the cosine harmonic correction term to the argument of latitude  [rad]
00101   double         cus;        //!< amplitude of the sine harmonic correction term to the argument of latitude    [rad]
00102   double         crc;        //!< amplitude of the cosine harmonic correction term to the orbit radius          [m]
00103   double         crs;        //!< amplitude of the sine harmonic correction term to the orbit radius            [m]
00104   double         cic;        //!< amplitude of the cosine harmonic correction term to the angle of inclination  [rad]
00105   double         cis;        //!< amplitude of the sine harmonic correction term to the angle of inclination    [rad]
00106 
00107 } GPS_structEphemeris;
00108 
00109 
00110 /// \brief    A limited set of satellite orbit parameters that is used to 
00111 /// calculate rough GPS satellite positions and velocities. The parameters 
00112 /// for computing rough satellite clock corrections are also included.
00113 /// 
00114 /// \author   Glenn D. MacGougan (GDM)
00115 /// \date     2005-08-18
00116 /// \since    2005-08-18
00117 /// 
00118 /// \remarks
00119 /// (1) struct packaging: compatible with 4 and 8 byte packing
00120 /// 
00121 /// \b REFERENCES \n
00122 /// [1] ICD-GPS-200C, p. 108
00123 /// 
00124 typedef struct
00125 {
00126   unsigned toa;       //!< almanac time of applicability                               [s]
00127   unsigned reserved;  //!< reserved                                                    []
00128   double   ecc;       //!< eccentricity                                                []
00129   double   i0;        //!< inclination angle at reference time                         [rad]
00130   double   omegadot;  //!< rate of right ascension                                     [rad/s]
00131   double   sqrta;     //!< square root of the semi-major axis                          [m^(1/2)]
00132   double   omega0;    //!< longitude of ascending node of orbit plane at weekly epoch  [rad]
00133   double   w;         //!< argument of perigee                                         [rad]
00134   double   m0;        //!< mean anomaly at reference time                              [rad]
00135   double   af0;       //!< polynomial clock correction coefficient (clock bias)        [s]   Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
00136   double   af1;       //!< polynomial clock correction coefficient (clock drift)       [s/s] Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
00137 } GPS_structAlmanac;
00138 
00139 
00140 
00141 
00142 /// Computes the satellite clock and clock dirft corrections given the clock model and ephemeris 
00143 /// information.
00144 /// 
00145 /// \author   Glenn D. MacGougan (GDM)
00146 /// \date     2005-08-12
00147 /// \since    2005-08-12
00148 /// 
00149 /// \remarks
00150 /// (1) The clock correction parameter is sensitive to the polynomial coefficient source which is
00151 ///     either ephemeris related from subframe 1 or from the gps almanac (subframes 4,5). The 
00152 ///     ephemeris parameters have higher precision 22 & 16 vs 11 & 11 bits. \n
00153 /// (2) User must compensate for the GPS week rollover \n
00154 /// 
00155 /// \b REFERENCES \n
00156 /// [1] ICD-GPS-200C, p. 88-101 \n
00157 /// [2] Teunissen, P. J. G. & A. Kleusberg (editors) (1998). GPS for Geodesy, 2nd Edition. pp. 43-107
00158 /// [3] Hofmann-Wellenhof, B. & J. Collins (1994). GPS Theory and Practice, 3rd Edition. \n
00159 ///     Springer-Verlag Wien New York, pp. 43-74 \n
00160 /// [4] Wong, R.V.C & K.P. Schwarz (1985). Dynamic Positioning with an Integrated GPS-INS. Formulae and 
00161 ///     Baseline Tests. University of Calgary. UCSE Report #30003. pp. 22 \n
00162 /// 
00163 void GPS_ComputeSatelliteClockCorrectionAndDrift(
00164   const unsigned short transmission_gpsweek,   //!< GPS week when signal was transmit (0-1024+)            [weeks]
00165   const double         transmission_gpstow,    //!< GPS time of week when signal was transmit              [s]  
00166   const unsigned short ephem_week,             //!< ephemeris: GPS week (0-1024+)                          [weeks]
00167   const unsigned       toe,                    //!< ephemeris: time of week                                [s]
00168   const unsigned       toc,                    //!< ephemeris: clock reference time of week                [s]
00169   const double         af0,                    //!< ephemeris: polynomial clock correction coefficient     [s],   Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
00170   const double         af1,                    //!< ephemeris: polynomial clock correction coefficient     [s/s], Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
00171   const double         af2,                    //!< ephemeris: polynomial clock correction coefficient     [s/s^2]  
00172   const double         ecc,                    //!< ephemeris: eccentricity of satellite orbit             []
00173   const double         sqrta,                  //!< ephemeris: square root of the semi-major axis of orbit [m^(1/2)]
00174   const double         delta_n,                //!< ephemeris: mean motion difference from computed value  [rad]
00175   const double         m0,                     //!< ephemeris: mean anomaly at reference time              [rad]
00176   const double         tgd,                    //!< ephemeris: group delay differential between L1 and L2  [s]
00177   const unsigned char  mode,                   //!< 0=L1 only, 1=L2 only (see p. 90, ICD-GPS-200C)
00178   double*  clock_correction,  //!< satellite clock correction       [m]
00179   double*  clock_drift        //!< satellite clock drift correction [m/s]
00180   );
00181 
00182 
00183 /// Computes the satellite position and velocity in WGS84 based on the supplied ephemeris/almanac
00184 /// parameters. 
00185 /// 
00186 /// \author   Glenn D. MacGougan (GDM)
00187 /// \date     2005-07-31
00188 /// \since    2005-07-31
00189 ///   
00190 /// \b REFERENCES \n
00191 /// [1] ICD-GPS-200C, p. 94-101 \n
00192 /// [2] Teunissen, P. J. G. & A. Kleusberg (editors) (1998). GPS for Geodesy, 2nd Edition. pp. 43-107 \n
00193 /// [3] Hofmann-Wellenhof, B. & J. Collins (1994). GPS Theory and Practice, 3rd Edition. 
00194 ///     Springer-Verlag Wien New York, pp. 43-74 \n
00195 /// [4] Wong, R.V.C & K.P. Schwarz (1985). Dynamic Positioning with an Integrated GPS-INS. Formulae and 
00196 ///     Baseline Tests. University of Calgary. UCSE Report #30003. pp. 22 \n
00197 /// 
00198 void GPS_ComputeSatellitePositionAndVelocity( 
00199   const unsigned short transmission_gpsweek,   //!< GPS week when signal was transmit (0-1024+)                                              [weeks]
00200   const double         transmission_gpstow,    //!< GPS time of week when signal was transmit                                                [s]  
00201   const unsigned short ephem_week,             //!< ephemeris: GPS week (0-1024+)                                                            [weeks]
00202   const unsigned       toe,                    //!< ephemeris: time of week                                                                  [s]
00203   const double         m0,                     //!< ephemeris: mean anomaly at reference time                                                [rad]
00204   const double         delta_n,                //!< ephemeris: mean motion difference from computed value                                    [rad]
00205   const double         ecc,                    //!< ephemeris: eccentricity                                                                  []
00206   const double         sqrta,                  //!< ephemeris: square root of the semi-major axis                                            [m^(1/2)]
00207   const double         omega0,                 //!< ephemeris: longitude of ascending node of orbit plane at weekly epoch                    [rad]
00208   const double         i0,                     //!< ephemeris: inclination angle at reference time                                           [rad]
00209   const double         w,                      //!< ephemeris: argument of perigee                                                           [rad]
00210   const double         omegadot,               //!< ephemeris: rate of right ascension                                                       [rad/s]
00211   const double         idot,                   //!< ephemeris: rate of inclination angle                                                     [rad/s]
00212   const double         cuc,                    //!< ephemeris: amplitude of the cosine harmonic correction term to the argument of latitude  [rad]
00213   const double         cus,                    //!< ephemeris: amplitude of the sine   harmonic correction term to the argument of latitude  [rad]
00214   const double         crc,                    //!< ephemeris: amplitude of the cosine harmonic correction term to the orbit radius          [m]
00215   const double         crs,                    //!< ephemeris: amplitude of the sine   harmonic correction term to the orbit radius          [m]
00216   const double         cic,                    //!< ephemeris: amplitude of the cosine harmonic correction term to the angle of inclination  [rad]
00217   const double         cis,                    //!< ephemeris: amplitude of the sine   harmonic correction term to the angle of inclination  [rad]
00218   const double         estimateOfTrueRange,    //!< best estimate of the signal propagation time (in m) for Sagnac effect compensation       [m]
00219   const double         estimteOfRangeRate,     //!< best estimate of the true signal Doppler (in m/s)   for Sagnac effect compensation       [m/s]
00220   double* x,  //!< satellite x            [m]
00221   double* y,  //!< satellite y            [m]
00222   double* z,  //!< satellite z            [m] 
00223   double* vx, //!< satellite velocity x   [m/s]
00224   double* vy, //!< satellite velocity y   [m/s]
00225   double* vz  //!< satellite velocity z   [m/s]
00226   );
00227 
00228 
00229 /// Computes the user to satellite range given the user and 
00230 /// satellite position.
00231 /// 
00232 /// \author   Glenn D. MacGougan (GDM)
00233 /// \date     2006-11-23
00234 /// \since    2006-11-23
00235 /// 
00236 void GPS_ComputeUserToSatelliteRange( 
00237   const double userX,    //!< user X position WGS84 ECEF         [m]
00238   const double userY,    //!< user Y position WGS84 ECEF         [m]
00239   const double userZ,    //!< user Z position WGS84 ECEF         [m]
00240   const double satX,     //!< satellite X position WGS84 ECEF    [m]
00241   const double satY,     //!< satellite Y positoin WGS84 ECEF    [m]
00242   const double satZ,     //!< satellite Z position WGS84 ECEF    [m] 
00243   double* range          //!< user to satellite range            [m]
00244   );
00245 
00246 
00247 /// Computes the user to satellite range and range rate given the user and satellite
00248 /// position and velocities.
00249 /// 
00250 /// \author   Glenn D. MacGougan (GDM)
00251 /// \date     2005-08-15
00252 /// \since    2005-08-15
00253 /// 
00254 void GPS_ComputeUserToSatelliteRangeAndRangeRate( 
00255   const double userX,    //!< user X position WGS84 ECEF         [m]
00256   const double userY,    //!< user Y position WGS84 ECEF         [m]
00257   const double userZ,    //!< user Z position WGS84 ECEF         [m]
00258   const double userVx,   //!< user X velocity WGS84 ECEF         [m/s]
00259   const double userVy,   //!< user Y velocity WGS84 ECEF         [m/s]
00260   const double userVz,   //!< user Z velocity WGS84 ECEF         [m/s]
00261   const double satX,     //!< satellite X position WGS84 ECEF    [m]
00262   const double satY,     //!< satellite Y positoin WGS84 ECEF    [m]
00263   const double satZ,     //!< satellite Z position WGS84 ECEF    [m] 
00264   const double satVx,    //!< satellite X velocity WGS84 ECEF    [m/s]
00265   const double satVy,    //!< satellite Y velocity WGS84 ECEF    [m/s]
00266   const double satVz,    //!< satellite Z velocity WGS84 ECEF    [m/s]
00267   double* range,         //!< user to satellite range            [m]
00268   double* range_rate     //!< user to satellite range rate       [m/s]
00269   );
00270 
00271 
00272 /// Computes the satellite position and velocity in WGS84 based on almanac data.
00273 /// 
00274 /// \author   Glenn D. MacGougan (GDM)
00275 /// \date     2005-08-15
00276 /// \since    2005-08-15
00277 /// 
00278 /// \remarks
00279 /// (1) Assumes L1 for the clock correction mode \n
00280 /// (2) This calculation solves for the satellite position at the true GPS time of week specified. 
00281 ///     It includes compensation for the satellite clock correction and the Saganc effect, which
00282 ///     is a function of the user position. \n
00283 /// 
00284 /// \b REFERENCES \n
00285 /// [1] ICD-GPS-200C
00286 /// 
00287 void GPS_ComputeSatellitePositionVelocityAzimuthElevationDoppler_BasedOnAlmanacData(
00288   const double         userX,        //!< user X position WGS84 ECEF                                   [m]
00289   const double         userY,        //!< user Y position WGS84 ECEF                                   [m]
00290   const double         userZ,        //!< user Z position WGS84 ECEF                                   [m]
00291   const unsigned short gpsweek,      //!< user gps week (0-1024+)                                      [week]
00292   const double         gpstow,       //!< user time of week                                            [s]
00293   const double         toa,          //!< time of applicability                                        [s]  
00294   const unsigned short almanac_week, //!< gps week of almanac (0-1024+)                                [week]
00295   const unsigned short prn,          //!< GPS prn number                                               []
00296   const double         ecc,          //!< eccentricity                                                 []
00297   const double         i0,           //!< orbital inclination at reference time                        [rad]
00298   const double         omegadot,     //!< rate of right ascension                                      [rad/s]
00299   const double         sqrta,        //!< square root of the semi-major axis                           [m^(1/2)]
00300   const double         omega0,       //!< longitude of ascending node of orbit plane at weekly epoch   [rad]
00301   const double         w,            //!< argument of perigee                                          [rad]
00302   const double         m0,           //!< mean anomaly at reference time                               [rad]
00303   const double         af0,          //!< polynomial clock correction coefficient (clock bias)         [s],   Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
00304   const double         af1,          //!< polynomial clock correction coefficient (clock drift)        [s/s], Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
00305   double* clock_correction,  //!< clock correction for this satellite for this epoch           [m]
00306   double* clock_drift,       //!< clock drift correction for this satellite for this epoch     [m/s]
00307   double* satX,              //!< satellite X position WGS84 ECEF                              [m]
00308   double* satY,              //!< satellite Y position WGS84 ECEF                              [m]
00309   double* satZ,              //!< satellite Z position WGS84 ECEF                              [m]
00310   double* satVx,             //!< satellite X velocity WGS84 ECEF                              [m/s]
00311   double* satVy,             //!< satellite Y velocity WGS84 ECEF                              [m/s]
00312   double* satVz,             //!< satellite Z velocity WGS84 ECEF                              [m/s]
00313   double* azimuth,           //!< satelilte azimuth                                            [rad]
00314   double* elevation,         //!< satelilte elevation                                          [rad]
00315   double* doppler            //!< satellite doppler with respect to the user position          [m/s], Note: User must convert to Hz
00316   );
00317 
00318 
00319 /// Computes the satellite position and velocity in WGS84 based on ephemeris data.
00320 /// 
00321 /// \author   Glenn D. MacGougan (GDM)
00322 /// \date     2005-08-15
00323 /// \since    2005-08-15
00324 /// 
00325 /// \remarks
00326 /// (1) Assumes L1 for the clock correction mode \n
00327 /// (2) This calculation solves for the satellite position at the true GPS time of week specified. 
00328 ///     It includes compensation for the satellite clock correction and the Saganc effect, which
00329 ///     is a function of the user position. \n
00330 /// (3) This function can be called with almanac data by inputting the almanac information and 
00331 ///     zero for the terms not available. toe and toc are the toa in that case. \n
00332 /// 
00333 /// \b REFERENCES \n
00334 /// [1] ICD-GPS-200C
00335 /// 
00336 void GPS_ComputeSatellitePositionVelocityAzimuthElevationDoppler_BasedOnEphmerisData(
00337   const double         userX,        //!< user X position WGS84 ECEF  [m]
00338   const double         userY,        //!< user Y position WGS84 ECEF  [m]
00339   const double         userZ,        //!< user Z position WGS84 ECEF  [m]
00340   const unsigned short gpsweek,      //!< gps week of signal transmission (0-1024+)                              [week]
00341   const double         gpstow,       //!< time of week of signal transmission  (gpstow-psr/c)                    [s]
00342   const unsigned short ephem_week,   //!< ephemeris: GPS week (0-1024+)                                          [weeks]
00343   const unsigned       toe,          //!< ephemeris: time of week                                                [s]
00344   const unsigned       toc,          //!< ephemeris: clock reference time of week                                [s]
00345   const double         af0,          //!< ephemeris: polynomial clock correction coefficient                     [s],   Note: parameters from ephemeris preferred vs almanac (22 vs 11 bits)
00346   const double         af1,          //!< ephemeris: polynomial clock correction coefficient                     [s/s], Note: parameters from ephemeris preferred vs almanac (16 vs 11 bits)
00347   const double         af2,          //!< ephemeris: polynomial clock correction coefficient                     [s/s^2]  
00348   const double         tgd,          //!< ephemeris: group delay differential between L1 and L2                  [s]
00349   const double         m0,           //!< ephemeris: mean anomaly at reference time                              [rad]
00350   const double         delta_n,      //!< ephemeris: mean motion difference from computed value                  [rad/s]
00351   const double         ecc,          //!< ephemeris: eccentricity                                                []
00352   const double         sqrta,        //!< ephemeris: square root of the semi-major axis                          [m^(1/2)]
00353   const double         omega0,       //!< ephemeris: longitude of ascending node of orbit plane at weekly epoch  [rad]
00354   const double         i0,           //!< ephemeris: inclination angle at reference time                         [rad]
00355   const double         w,            //!< ephemeris: argument of perigee                                         [rad]
00356   const double         omegadot,     //!< ephemeris: rate of right ascension                                     [rad/s]
00357   const double         idot,         //!< ephemeris: rate of inclination angle                                   [rad/s]
00358   const double         cuc,          //!< ephemeris: amplitude of the cosine harmonic correction term to the argument of latitude  [rad]
00359   const double         cus,          //!< ephemeris: amplitude of the sine   harmonic correction term to the argument of latitude  [rad]
00360   const double         crc,          //!< ephemeris: amplitude of the cosine harmonic correction term to the orbit radius          [m]
00361   const double         crs,          //!< ephemeris: amplitude of the sine   harmonic correction term to the orbit radius          [m]
00362   const double         cic,          //!< ephemeris: amplitude of the cosine harmonic correction term to the angle of inclination  [rad]
00363   const double         cis,          //!< ephemeris: amplitude of the sine   harmonic correction term to the angle of inclination  [rad]
00364   double* clock_correction,  //!< clock correction for this satellite for this epoch           [m]
00365   double* clock_drift,       //!< clock drift correction for this satellite for this epoch     [m/s]
00366   double* satX,              //!< satellite X position WGS84 ECEF                              [m]
00367   double* satY,              //!< satellite Y position WGS84 ECEF                              [m]
00368   double* satZ,              //!< satellite Z position WGS84 ECEF                              [m]
00369   double* satVx,             //!< satellite X velocity WGS84 ECEF                              [m/s]
00370   double* satVy,             //!< satellite Y velocity WGS84 ECEF                              [m/s]
00371   double* satVz,             //!< satellite Z velocity WGS84 ECEF                              [m/s]
00372   double* azimuth,           //!< satelilte azimuth                                            [rad]
00373   double* elevation,         //!< satelilte elevation                                          [rad]
00374   double* doppler            //!< satellite doppler with respect to the user position          [m/s], Note: User must convert to Hz
00375   );
00376 
00377 
00378 
00379 /// Decodes the raw gps ephemeris (note, with the parity bits removed).
00380 /// 
00381 /// \author   Glenn D. MacGougan (GDM)
00382 /// \date     2005-08-15
00383 /// \since    2005-08-15
00384 /// 
00385 /// \returns  TRUE(1) if successful, FALSE(0) otherwise
00386 /// 
00387 /// \remarks
00388 /// (1) Parity bits must be removed from the input subframe data \n
00389 /// (2) Returns TRUE(1) if data is successfully decoded \n
00390 /// (3) Returns FALSE(0) if the subframe id's are incorrect, i.e. must be subframe1, subframe2, subframe3 in that order \n
00391 /// (4) Returns FALSE(0) if the iode's are not consistent for all subframes, note 8 LSB bits of the iodc should equal  
00392 ///     subframe2 and subframe3 iode \n
00393 /// (5) Uses IBM PC format byte alignment \n
00394 /// 
00395 /// \b REFERENCES \n
00396 /// [1] ICD-GPS-200C
00397 /// 
00398 BOOL GPS_DecodeRawGPSEphemeris( 
00399   const unsigned char subframe1[30],  //!< subframe 1 data, 30 bytes * 8bits/byte = 240 bits, thus parity bits have been removed
00400   const unsigned char subframe2[30],  //!< subframe 2 data, 30 bytes * 8bits/byte = 240 bits, thus parity bits have been removed
00401   const unsigned char subframe3[30],  //!< subframe 3 data, 30 bytes * 8bits/byte = 240 bits, thus parity bits have been removed
00402   unsigned short  prn,                //!< GPS PRN number (helps with debugging)
00403   unsigned*       tow,                //!< time of week in subframe1, the time of the leading bit edge of subframe 2     [s]
00404   unsigned short* iodc,               //!< 10 bit issue of data (clock), 8 LSB bits will match the iode                  []    
00405   unsigned char*  iode,               //!< 8 bit  issue of data (ephemeris)                                              []
00406   unsigned*       toe,                //!< reference time ephemeris (0-604800)                                           [s]
00407   unsigned*       toc,                //!< reference time (clock)   (0-604800)                                           [s]      
00408   unsigned short* week,               //!< 10 bit gps week 0-1023 (user must account for week rollover )                 [week]    
00409   unsigned char*  health,             //!< 6 bit health parameter, 0 if healthy, unhealth othersize                      [0=healthy]    
00410   unsigned char*  alert_flag,         //!< 1 = URA may be worse than indicated                                           [0,1]
00411   unsigned char*  anti_spoof,         //!< anti-spoof flag from 0=off, 1=on                                              [0,1]    
00412   unsigned char*  code_on_L2,         //!< 0=reserved, 1=P code on L2, 2=C/A on L2                                       [0,1,2]
00413   unsigned char*  ura,                //!< User Range Accuracy lookup code, 0 is excellent, 15 is use at own risk        [0-15], see p. 83 GPSICD200C
00414   unsigned char*  L2_P_data_flag,     //!< flag indicating if P is on L2 1=true                                          [0,1]
00415   unsigned char*  fit_interval_flag,  //!< fit interval flag (four hour interval or longer) 0=4 fours, 1=greater         [0,1]
00416   unsigned short* age_of_data_offset, //!< age of data offset                                                            [s]
00417   double* tgd,                //!< group delay                                                                   [s]
00418   double* af2,                //!< polynomial clock correction coefficient (rate of clock drift)                 [s/s^2]
00419   double* af1,                //!< polynomial clock correction coefficient (clock drift)                         [s/s]
00420   double* af0,                //!< polynomial clock correction coefficient (clock bias)                          [s]    
00421   double* m0,                 //!< mean anomaly at reference time                                                [rad]
00422   double* delta_n,            //!< mean motion difference from computed value                                    [rad/s]
00423   double* ecc,                //!< eccentricity                                                                  []
00424   double* sqrta,              //!< square root of the semi-major axis                                            [m^(1/2)]
00425   double* omega0,             //!< longitude of ascending node of orbit plane at weekly epoch                    [rad]
00426   double* i0,                 //!< inclination angle at reference time                                           [rad]
00427   double* w,                  //!< argument of perigee                                                           [rad]
00428   double* omegadot,           //!< rate of right ascension                                                       [rad/s]
00429   double* idot,               //!< rate of inclination angle                                                     [rad/s]
00430   double* cuc,                //!< amplitude of the cosine harmonic correction term to the argument of latitude  [rad]
00431   double* cus,                //!< amplitude of the sine harmonic correction term to the argument of latitude    [rad]
00432   double* crc,                //!< amplitude of the cosine harmonic correction term to the orbit radius          [m]
00433   double* crs,                //!< amplitude of the sine harmonic correction term to the orbit radius            [m]
00434   double* cic,                //!< amplitude of the cosine harmonic correction term to the angle of inclination  [rad]
00435   double* cis                 //!< amplitude of the sine harmonic correction term to the angle of inclination    [rad]
00436   );
00437 
00438 
00439 #ifdef __cplusplus
00440 }
00441 #endif
00442 
00443 
00444 #endif // _C_GPS_H_