GNSSconstants.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: GNSSconstants.hpp 3342 2013-01-30 02:21:06Z ocibu $"
00002 
00008 #ifndef GPSTK_GNSS_CONSTANTS_HPP
00009 #define GPSTK_GNSS_CONSTANTS_HPP
00010 
00011 //============================================================================
00012 //
00013 //  This file is part of GPSTk, the GPS Toolkit.
00014 //
00015 //  The GPSTk is free software; you can redistribute it and/or modify
00016 //  it under the terms of the GNU Lesser General Public License as published
00017 //  by the Free Software Foundation; either version 2.1 of the License, or
00018 //  any later version.
00019 //
00020 //  The GPSTk is distributed in the hope that it will be useful,
00021 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 //  GNU Lesser General Public License for more details.
00024 //
00025 //  You should have received a copy of the GNU Lesser General Public
00026 //  License along with GPSTk; if not, write to the Free Software Foundation,
00027 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00028 //  
00029 //  Copyright 2004, The University of Texas at Austin
00030 //
00031 //============================================================================
00032 
00033 //============================================================================
00034 //
00035 // This software developed by Applied Research Laboratories at the University
00036 // of Texas at Austin, under contract to an agency or agencies within the U.S. 
00037 // Department of Defense. The U.S. Government retains all rights to use,
00038 // duplicate, distribute, disclose, or release this software. 
00039 //
00040 // Pursuant to DoD Directive 523024 
00041 //
00042 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00043 //                           release, distribution is unlimited.
00044 //
00045 //=============================================================================
00046 
00047 #include "Exception.hpp"
00048 #include "SatID.hpp"
00049 
00050 namespace gpstk
00051 {
00058 
00059    // ---------------- independent of GNSS ----------------------
00061    const double PI        = 3.1415926535898;
00063    const double TWO_PI    = 6.2831853071796;
00065    const double SQRT_PI   = 1.7724539;
00067    const double REL_CONST = -4.442807633e-10;
00069    const double C_MPS = 2.99792458e8;
00070 
00071    // ---------------- GPS --------------------------------------
00073    const double OSC_FREQ_GPS  = 10.23e6;
00075    const double PY_CHIP_FREQ_GPS = OSC_FREQ_GPS;
00077    const double CA_CHIP_FREQ_GPS = OSC_FREQ_GPS / 10.0;
00079    const double RSVCLK_GPS    = 10.22999999543e6;
00081    const double L1_FREQ_GPS   = 1575.42e6;
00083    const double L2_FREQ_GPS   = 1227.60e6;
00085    const double L5_FREQ_GPS   = 1176.45e6;
00087    const double L1_WAVELENGTH_GPS  = 0.190293672798;
00089    const double L2_WAVELENGTH_GPS  = 0.244210213425;
00091    const double L5_WAVELENGTH_GPS  = 0.254828049;
00093    const double L1_MULT_GPS   = 154.0;
00095    const double L2_MULT_GPS   = 120.0;
00097    const double L5_MULT_GPS   = 115.0;
00099    const double GAMMA_GPS = 1.646944444;
00101    const double A_REF_GPS = 26559710.0;
00103    const double OMEGADOT_REF_GPS = -2.6e-9 * PI;
00104 
00105    inline
00106    short getLegacyFitInterval(const short iodc, const short fiti)
00107       throw(gpstk::InvalidRequest )
00108    {
00109          /* check the IODC */
00110       if (iodc < 0 || iodc > 1023)
00111       {
00112             /* error in iodc, return minimum fit */
00113          return 4;
00114       }
00115 
00116       if ( ( ( (fiti == 0) && (iodc & 0xFF) < 240 )
00117              || (iodc & 0xFF) > 255 ) )
00118       {
00119             /* fit interval of 4 hours */
00120          return 4;
00121       }
00122       else if (fiti == 1)
00123       {
00124          if( ((iodc & 0xFF) < 240 || (iodc & 0xFF) > 255))
00125          {
00126                /* fit interval of 6 hours */
00127             return 6;
00128          }
00129          else if(iodc >=240 && iodc <=247)
00130          {
00131                /* fit interval of 8 hours */
00132             return 8;
00133          }
00134          else if( ( (iodc >= 248) && (iodc <= 255) ) || iodc == 496 )
00135          {
00136                /* fit interval of 14 hours */
00137             return 14;
00138          }
00139          else if((iodc >= 497 && iodc <=503) || (iodc >= 1021 && iodc <= 1023))
00140          {
00141                /* fit interval of 26 hours */
00142             return 26;
00143          }
00144          else if(iodc >= 504 && iodc <=510)
00145          {
00146                /* fit interval of 50 hours */
00147             return 50;
00148          }
00149          else if( iodc == 511 || ( (iodc >= 752) && (iodc <= 756) ) )
00150          {
00151                /* fit interval of 74 hours */
00152             return 74;
00153          }
00154          else if(iodc == 757)
00155          {
00156                /* fit interval of 98 hours */
00157             return 98;
00158          }
00159          else
00160          {
00161             InvalidRequest exc("Invalid IODC Value For sv Block");
00162             GPSTK_THROW(exc);
00163          }
00164       }
00165       else
00166       {
00167             /* error in ephemeris/iodc, return minimum fit */
00168          return 4;
00169       }
00170 
00171       return 0; // never reached
00172    }
00173 
00174    // ---------------- GLONASS ----------------------------------
00176    const double OSC_FREQ_GLO  = 5.11e6;
00178    const double PY_CHIP_FREQ_GLO = OSC_FREQ_GLO;
00180    const double CA_CHIP_FREQ_GLO = OSC_FREQ_GLO / 10.0;
00181 
00183    const double PSC_FREQ_GLO  = 5.00e6;
00185    const double RSVCLK_GLO    = 4.99999999782e6;
00186 
00187       // GLO Frequency(Hz) f1 is 1602.0e6 + n*562.5e3 Hz = 9 * (178 + n*0.0625) MHz
00188       //                   f2    1246.0e6 + n*437.5e3 Hz = 7 * (178 + n*0.0625) MHz
00189       // where n is the time- and satellite-dependent 'frequency channel' -7 <= n <= 7
00191    const double L1_FREQ_GLO       = 1602.0e6;
00193    const double L1_FREQ_STEP_GLO  = 562.5e3;
00195    const double L1_WAVELENGTH_GLO = 0.187136365793;
00197    const double L2_FREQ_GLO       = 1246.0e6;
00199    const double L2_FREQ_STEP_GLO  = 437.5e3;
00201    const double L2_WAVELENGTH_GLO = 0.240603898876;
00203    const double L1_MULT_GLO   = 320.4;
00205    const double L2_MULT_GLO   = 249.2;
00206       // GLO Gamma multiplier.
00207    //const double GAMMA_GLO = 1.653061224490;      // obsolete: getAlpha(GLO,1,2)
00208 
00210    const int SV_ACCURACY_GLO_INDEX_MAX = 15;
00213    const double SV_ACCURACY_GLO_INDEX[] = { 1.0,  2.0,   2.5,   4.0,   5.0,
00214                                             7.0, 10.0,  12.0,  14.0,  16.0,
00215                                            32.0, 64.0, 128.0, 256.0, 512.0,
00216                                            9.999999999999e99               };
00217 
00218    // ---------------- Galileo ----------------------------------
00220    const double L1_FREQ_GAL   = L1_FREQ_GPS;
00222    const double L5_FREQ_GAL   = L5_FREQ_GPS;
00224    const double L6_FREQ_GAL   = 1278.75e6;
00226    const double L7_FREQ_GAL   = 1207.140e6;
00228    const double L8_FREQ_GAL   = 1191.795e6;
00230    const double L1_WAVELENGTH_GAL  = L1_WAVELENGTH_GPS;
00232    const double L5_WAVELENGTH_GAL  = L5_WAVELENGTH_GPS;
00234    const double L6_WAVELENGTH_GAL  = 0.234441805;
00236    const double L7_WAVELENGTH_GAL  = 0.24834937;
00238    const double L8_WAVELENGTH_GAL  = 0.251547001;
00239 
00240    // ---------------- Geostationary (SBAS) ---------------------
00242    const double L1_FREQ_GEO   = L1_FREQ_GPS;
00244    const double L5_FREQ_GEO   = L5_FREQ_GPS;
00246    const double L1_WAVELENGTH_GEO  = L1_WAVELENGTH_GPS;
00248    const double L5_WAVELENGTH_GEO  = L5_WAVELENGTH_GPS;
00249 
00250    // ---------------- COMPASS ----------------------------------
00252    const double L1_FREQ_COM   = 1589.74e6;
00254    const double L2_FREQ_COM   = 1561.098e6;
00256    const double L6_FREQ_COM   = 1268.52e6;
00258    const double L7_FREQ_COM   = L7_FREQ_GAL;
00260    const double L1_WAVELENGTH_COM  = 0.188579552631247;
00262    const double L2_WAVELENGTH_COM  = 0.192039486310276;
00264    const double L6_WAVELENGTH_COM  = 0.236332464604421;
00266    const double L7_WAVELENGTH_COM  = L7_WAVELENGTH_GAL;
00267 
00268 
00269    // ---------------- Convenience routines ---------------------
00274    inline double getWavelength(const SatID& sat, const int& n, const int N=0)
00275       throw()
00276    {
00277       switch(sat.system) {
00278          case SatID::systemGPS:
00279                  if(n == 1) return L1_WAVELENGTH_GPS;
00280             else if(n == 2) return L2_WAVELENGTH_GPS;
00281             else if(n == 5) return L5_WAVELENGTH_GPS;
00282             break;
00283          case SatID::systemGlonass:
00284                  if(n == 1) return (C_MPS/(L1_FREQ_GLO + N*L1_FREQ_STEP_GLO));
00285             else if(n == 2) return (C_MPS/(L2_FREQ_GLO + N*L2_FREQ_STEP_GLO));
00286             break;
00287          case SatID::systemGalileo:
00288                  if(n == 1) return L1_WAVELENGTH_GAL;
00289             else if(n == 5) return L5_WAVELENGTH_GAL;
00290             else if(n == 6) return L6_WAVELENGTH_GAL;
00291             else if(n == 7) return L7_WAVELENGTH_GAL;
00292             else if(n == 8) return L8_WAVELENGTH_GAL;
00293             break;
00294          case SatID::systemGeosync:
00295                  if(n == 1) return L1_WAVELENGTH_GEO;
00296             else if(n == 5) return L5_WAVELENGTH_GEO;
00297             break;
00298          case SatID::systemCompass:
00299                  if(n == 1) return L1_WAVELENGTH_COM;
00300             else if(n == 2) return L2_WAVELENGTH_COM;
00301             else if(n == 6) return L6_WAVELENGTH_COM;
00302             else if(n == 7) return L7_WAVELENGTH_COM;
00303             break;
00304          default:
00305             break;
00306       }
00307 
00308       return 0.0;
00309    }
00310 
00311 
00315    inline double getBeta(const SatID& sat, const int& na, const int& nb) throw()
00316    {
00317       static const double GPSbeta12=L1_MULT_GPS/L2_MULT_GPS;
00318       static const double GPSbeta21=L2_MULT_GPS/L1_MULT_GPS;
00319       static const double GPSbeta15=L1_MULT_GPS/L5_MULT_GPS;
00320       static const double GPSbeta51=L5_MULT_GPS/L1_MULT_GPS;
00321       static const double GPSbeta25=L2_MULT_GPS/L5_MULT_GPS;
00322       static const double GPSbeta52=L5_MULT_GPS/L2_MULT_GPS;
00323       static const double GLObeta12=L1_MULT_GLO/L2_MULT_GLO;   // 9/7
00324       static const double GLObeta21=L2_MULT_GLO/L1_MULT_GLO;   // 7/9
00325 
00326       if(na < 1 || na > 8 || nb < 1 || nb > 8) return 0.0;
00327 
00328       switch(sat.system) {
00329          case SatID::systemGPS:
00330                  if(na==1 && nb==2) return GPSbeta12;
00331             else if(na==2 && nb==1) return GPSbeta21;
00332             else if(na==1 && nb==5) return GPSbeta15;
00333             else if(na==5 && nb==1) return GPSbeta51;
00334             else if(na==2 && nb==5) return GPSbeta25;
00335             else if(na==5 && nb==2) return GPSbeta52;
00336             break;
00337          case SatID::systemGalileo:
00338             if(na > 1 && na < 5) break;
00339             if(nb > 1 && nb < 5) break;
00340             return (getWavelength(sat,nb)/getWavelength(sat,na));
00341             break;
00342          case SatID::systemGlonass:
00343             // NB. this is independent of the frequency channel
00344                  if(na==1 && nb==2) return GLObeta12;
00345             else if(na==2 && nb==1) return GLObeta21;
00346             break;
00347          case SatID::systemGeosync:
00348                  if(na==1 && nb==5) return GPSbeta15;
00349             else if(na==5 && nb==1) return GPSbeta51;
00350             break;
00351          case SatID::systemCompass:
00352             if(na==5 || na==8 || nb==5 || nb==8) break;
00353             return (getWavelength(sat,nb)/getWavelength(sat,na));
00354             break;
00355          default:
00356             break;
00357       }
00358       return 0.0;
00359    }
00360 
00365    inline double getAlpha(const SatID& sat, const int& na, const int& nb) throw()
00366    {
00367       double beta(getBeta(sat,na,nb));
00368       if(beta == 0.0) return 0.0;
00369       return (beta*beta-1.0);
00370    }
00371 
00373    
00374 } // namespace
00375 
00376 #endif //GPSTK_GNSS_CONSTANTS_HPP
00377 

Generated on Mon May 20 03:31:06 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1