LinearCombinations.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: LinearCombinations.cpp 2939 2011-10-23 19:55:11Z yanweignss $"
00002 
00008 //============================================================================
00009 //
00010 //  This file is part of GPSTk, the GPS Toolkit.
00011 //
00012 //  The GPSTk is free software; you can redistribute it and/or modify
00013 //  it under the terms of the GNU Lesser General Public License as published
00014 //  by the Free Software Foundation; either version 2.1 of the License, or
00015 //  any later version.
00016 //
00017 //  The GPSTk is distributed in the hope that it will be useful,
00018 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //  GNU Lesser General Public License for more details.
00021 //
00022 //  You should have received a copy of the GNU Lesser General Public
00023 //  License along with GPSTk; if not, write to the Free Software Foundation,
00024 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 //
00026 //  Dagoberto Salazar - gAGE ( http://www.gage.es ). 2007, 2008, 2009
00027 //
00028 //============================================================================
00029 
00030 
00031 #include "LinearCombinations.hpp"
00032 
00033 
00034 namespace gpstk
00035 {
00036 
00037    LinearCombinations::LinearCombinations()
00038    {
00039 
00040       double a(+GAMMA_GPS/0.646944444);
00041       double b(1.0/0.646944444);
00042 
00043          // Definition to compute prefit residual of C1
00044       c1Prefit.header                     = TypeID::prefitC;
00045       c1Prefit.body[TypeID::C1]           = +1.0;
00046       c1Prefit.body[TypeID::rho]          = -1.0;
00047       c1Prefit.body[TypeID::dtSat]        = +1.0;
00048       c1Prefit.body[TypeID::rel]          = -1.0;
00049       c1Prefit.body[TypeID::gravDelay]    = -1.0;
00050       c1Prefit.body[TypeID::satPCenter]   = -1.0;
00051       c1Prefit.body[TypeID::tropoSlant]   = -1.0;
00052       c1Prefit.body[TypeID::ionoL1]       = -1.0;
00053          // The instrumental delay for C1 is not exactly TGD, but it is close
00054       c1Prefit.body[TypeID::instC1]       = -1.0;
00055       c1Prefit.body[TypeID::mpC1]         = -1.0;
00056 
00057          // Definition to compute prefit residual of P1
00058       p1Prefit.header                     = TypeID::prefitP1;
00059       p1Prefit.body[TypeID::P1]           = +1.0;
00060       p1Prefit.body[TypeID::rho]          = -1.0;
00061       p1Prefit.body[TypeID::dtSat]        = +1.0;
00062       p1Prefit.body[TypeID::rel]          = -1.0;
00063       p1Prefit.body[TypeID::gravDelay]    = -1.0;
00064       p1Prefit.body[TypeID::satPCenter]   = -1.0;
00065       p1Prefit.body[TypeID::tropoSlant]   = -1.0;
00066       p1Prefit.body[TypeID::ionoL1]       = -1.0;
00067          // Differential code biases (DCBs) for P1-P2
00068       p1Prefit.body[TypeID::instC1]       = -1.0;
00069       p1Prefit.body[TypeID::mpC1]         = -1.0;
00070 
00071          // Definition to compute prefit residual of L1
00072       l1Prefit.header                     = TypeID::prefitL1;
00073       l1Prefit.body[TypeID::L1]           = +1.0;
00074       l1Prefit.body[TypeID::rho]          = -1.0;
00075       l1Prefit.body[TypeID::dtSat]        = +1.0;
00076       l1Prefit.body[TypeID::rel]          = -1.0;
00077       l1Prefit.body[TypeID::gravDelay]    = -1.0;
00078       l1Prefit.body[TypeID::satPCenter]   = -1.0;
00079       l1Prefit.body[TypeID::tropoSlant]   = -1.0;
00080       l1Prefit.body[TypeID::ionoL1]       = +1.0;
00081          // Coefficient for L1 windUp is L1 wavelength/2*PI
00082       l1Prefit.body[TypeID::windUp]       = -L1_WAVELENGTH/TWO_PI;
00083       l1Prefit.body[TypeID::mpL1]         = -1.0;
00084 
00085          // Definition to compute PC combination
00086       pcCombination.header                = TypeID::PC;
00087       pcCombination.body[TypeID::P1]      = +a;
00088       pcCombination.body[TypeID::P2]      = -b;
00089 
00090          // Definition to compute PC combination, using C1 instead of P1
00091       pcCombWithC1.header                 = TypeID::PC;
00092       pcCombWithC1.body[TypeID::C1]       = +a;
00093       pcCombWithC1.body[TypeID::P2]       = -b;
00094 
00095          // Definition to compute prefit residual of PC
00096       pcPrefit.header                     = TypeID::prefitC;
00097       pcPrefit.body[TypeID::PC]           = +1.0;
00098       pcPrefit.body[TypeID::rho]          = -1.0;
00099       pcPrefit.body[TypeID::dtSat]        = +1.0;
00100       pcPrefit.body[TypeID::rel]          = -1.0;
00101       pcPrefit.body[TypeID::gravDelay]    = -1.0;
00102       pcPrefit.body[TypeID::satPCenter]   = -1.0;
00103       pcPrefit.body[TypeID::tropoSlant]   = -1.0;
00104 
00105          // Definition to compute LC combination
00106       lcCombination.header                = TypeID::LC;
00107       lcCombination.body[TypeID::L1]      = +a;
00108       lcCombination.body[TypeID::L2]      = -b;
00109 
00110          // Definition to compute prefit residual of LC
00111       lcPrefit.header                     = TypeID::prefitL;
00112       lcPrefit.body[TypeID::LC]           = +1.0;
00113       lcPrefit.body[TypeID::rho]          = -1.0;
00114       lcPrefit.body[TypeID::dtSat]        = +1.0;
00115       lcPrefit.body[TypeID::rel]          = -1.0;
00116       lcPrefit.body[TypeID::gravDelay]    = -1.0;
00117       lcPrefit.body[TypeID::satPCenter]   = -1.0;
00118       lcPrefit.body[TypeID::tropoSlant]   = -1.0;
00119          // Coefficient for LC windUp is LC wavelenght/2*PI
00120       lcPrefit.body[TypeID::windUp]     = -0.1069533781421467/TWO_PI;
00121 
00122          // Definition to compute PI combination
00123       piCombination.header                = TypeID::PI;
00124       piCombination.body[TypeID::P1]      = -1.0;
00125       piCombination.body[TypeID::P2]      = +1.0;
00126 
00127          // Definition to compute PI combination, using C1 instead of P1
00128       piCombWithC1.header                 = TypeID::PI;
00129       piCombWithC1.body[TypeID::C1]       = -1.0;
00130       piCombWithC1.body[TypeID::P2]       = +1.0;
00131 
00132          // Definition to compute LI combination
00133       liCombination.header                = TypeID::LI;
00134       liCombination.body[TypeID::L1]      = +1.0;
00135       liCombination.body[TypeID::L2]      = -1.0;
00136 
00137 
00138       double c( L1_FREQ/(L1_FREQ + L2_FREQ) );
00139       double d( L2_FREQ/(L1_FREQ + L2_FREQ) );
00140       double e( L1_FREQ/(L1_FREQ - L2_FREQ) );
00141       double f( L2_FREQ/(L1_FREQ - L2_FREQ) );
00142 
00143          // Definition to compute Pdelta (PW) combination
00144       pdeltaCombination.header            = TypeID::Pdelta;
00145       pdeltaCombination.body[TypeID::P1]  = +c;
00146       pdeltaCombination.body[TypeID::P2]  = +d;
00147 
00148          // Definition to compute Pdelta (PW) combination, using C1 instead
00149          // of P1
00150       pdeltaCombWithC1.header             = TypeID::Pdelta;
00151       pdeltaCombWithC1.body[TypeID::C1]   = +c;
00152       pdeltaCombWithC1.body[TypeID::P2]   = +d;
00153 
00154          // Definition to compute Ldelta (LW) combination
00155       ldeltaCombination.header            = TypeID::Ldelta;
00156       ldeltaCombination.body[TypeID::L1]  = +e;
00157       ldeltaCombination.body[TypeID::L2]  = -f;
00158 
00159          // Definition to compute the Melbourne-Wubbena (W) combination
00160       mwubbenaCombination.header           = TypeID::MWubbena;
00161       mwubbenaCombination.body[TypeID::L1] = +e;
00162       mwubbenaCombination.body[TypeID::L2] = -f;
00163       mwubbenaCombination.body[TypeID::P1] = -c;
00164       mwubbenaCombination.body[TypeID::P2] = -d;
00165 
00166 
00167          // Definition to compute the prefit residual of Melbourne-Wubbena (W) 
00168          // combination
00169       mwubbenaPrefit.header           = TypeID::prefitMWubbena;
00170       mwubbenaPrefit.body[TypeID::L1] = +e;
00171       mwubbenaPrefit.body[TypeID::L2] = -f;
00172       mwubbenaPrefit.body[TypeID::P1] = -c;
00173       mwubbenaPrefit.body[TypeID::P2] = -d;
00174 
00175          // Definition to compute the Melbourne-Wubbena (W) combination,
00176          // using C1 instead of P1
00177       mwubbenaCombWithC1.header           = TypeID::MWubbena;
00178       mwubbenaCombWithC1.body[TypeID::L1] = +e;
00179       mwubbenaCombWithC1.body[TypeID::L2] = -f;
00180       mwubbenaCombWithC1.body[TypeID::C1] = -c;
00181       mwubbenaCombWithC1.body[TypeID::P2] = -d;
00182 
00183          // Definition to compute the GRoup And PHase Ionospheric
00184          // Combination (GRAPHIC) in the L1 frequency
00185       GRAPHIC1Combination.header           = TypeID::GRAPHIC1;
00186       GRAPHIC1Combination.body[TypeID::P1] = +0.5;
00187       GRAPHIC1Combination.body[TypeID::L1] = +0.5;
00188 
00189          // Definition to compute the GRoup And PHase Ionospheric
00190          // Combination (GRAPHIC) in the L1 frequency (using C1 instead of P1)
00191       GRAPHIC1CombinationWithC1.header           = TypeID::GRAPHIC1;
00192       GRAPHIC1CombinationWithC1.body[TypeID::C1] = +0.5;
00193       GRAPHIC1CombinationWithC1.body[TypeID::L1] = +0.5;
00194 
00195          // Definition to compute the GRoup And PHase Ionospheric
00196          // Combination (GRAPHIC) in the L2 frequency
00197       GRAPHIC2Combination.header           = TypeID::GRAPHIC2;
00198       GRAPHIC2Combination.body[TypeID::P2] = +0.5;
00199       GRAPHIC2Combination.body[TypeID::L2] = +0.5;
00200 
00201          // Definition to compute the GRoup And PHase Ionospheric
00202          // Combination (GRAPHIC) in the L5 frequency
00203       GRAPHIC5Combination.header           = TypeID::GRAPHIC5;
00204       GRAPHIC5Combination.body[TypeID::C5] = +0.5;
00205       GRAPHIC5Combination.body[TypeID::L5] = +0.5;
00206 
00207          // Definition to compute the GRoup And PHase Ionospheric
00208          // Combination (GRAPHIC) in the L6 frequency
00209       GRAPHIC6Combination.header           = TypeID::GRAPHIC6;
00210       GRAPHIC6Combination.body[TypeID::C6] = +0.5;
00211       GRAPHIC6Combination.body[TypeID::L6] = +0.5;
00212 
00213          // Definition to compute the GRoup And PHase Ionospheric
00214          // Combination (GRAPHIC) in the L7 frequency
00215       GRAPHIC7Combination.header           = TypeID::GRAPHIC7;
00216       GRAPHIC7Combination.body[TypeID::C7] = +0.5;
00217       GRAPHIC7Combination.body[TypeID::L7] = +0.5;
00218 
00219          // Definition to compute the GRoup And PHase Ionospheric
00220          // Combination (GRAPHIC) in the L8 frequency
00221       GRAPHIC8Combination.header           = TypeID::GRAPHIC8;
00222       GRAPHIC8Combination.body[TypeID::C8] = +0.5;
00223       GRAPHIC8Combination.body[TypeID::L8] = +0.5;
00224 
00225 
00226          // Definition to compute WL combination
00227       wlCombination.header            = TypeID::WL;
00228       wlCombination.body[TypeID::L1]  = firstFactorOfLC(1,-1);
00229       wlCombination.body[TypeID::L2]  = secondFactorOfLC(1,-1);
00230 
00231          // Definition to compute prefit residual of WL
00232       wlPrefit.header                     = TypeID::prefitWL;
00233       wlPrefit.body[TypeID::WL]           = +1.0;
00234       wlPrefit.body[TypeID::rho]          = -1.0;
00235       wlPrefit.body[TypeID::dtSat]        = +1.0;
00236       wlPrefit.body[TypeID::rel]          = -1.0;
00237       wlPrefit.body[TypeID::gravDelay]    = -1.0;
00238       wlPrefit.body[TypeID::satPCenter]   = -1.0;
00239       wlPrefit.body[TypeID::tropoSlant]   = -1.0;
00240       wlPrefit.body[TypeID::ionoL1]       = firstFactorOfLC(1,-1)
00241                                            +secondFactorOfLC(1,-1)*GAMMA_GPS;
00242       wlPrefit.body[TypeID::windUp]       = -wavelengthOfLC(1,-1)/TWO_PI;
00243 
00244     
00245       // Definition to compute WL42combination
00246       wl2Combination.header            = TypeID::WL2;
00247       wl2Combination.body[TypeID::L1]  = firstFactorOfLC(-2,3);
00248       wl2Combination.body[TypeID::L2]  = secondFactorOfLC(-2,3);
00249 
00250       // Definition to compute prefit residual of WL2
00251       wl2Prefit.header                     = TypeID::prefitWL2;
00252       wl2Prefit.body[TypeID::WL2]           = +1.0;
00253       wl2Prefit.body[TypeID::rho]          = -1.0;
00254       wl2Prefit.body[TypeID::dtSat]        = +1.0;
00255       wl2Prefit.body[TypeID::rel]          = -1.0;
00256       wl2Prefit.body[TypeID::gravDelay]    = -1.0;
00257       wl2Prefit.body[TypeID::satPCenter]   = -1.0;
00258       wl2Prefit.body[TypeID::tropoSlant]   = -1.0;
00259       wl2Prefit.body[TypeID::ionoL1]       = firstFactorOfLC(-2,3)
00260                                              +secondFactorOfLC(-2,3)*GAMMA_GPS;
00261       wl2Prefit.body[TypeID::windUp]       = -wavelengthOfLC(-2,3)/TWO_PI;
00262 
00263          // Definition to compute WL4 combination
00264       wl4Combination.header            = TypeID::WL4;
00265       wl4Combination.body[TypeID::L1]  = firstFactorOfLC(4,-5);
00266       wl4Combination.body[TypeID::L2]  = secondFactorOfLC(4,-5);
00267 
00268       // Definition to compute prefit residual of WL4
00269       wl4Prefit.header                     = TypeID::prefitWL4;
00270       wl4Prefit.body[TypeID::WL4]           = +1.0;
00271       wl4Prefit.body[TypeID::rho]          = -1.0;
00272       wl4Prefit.body[TypeID::dtSat]        = +1.0;
00273       wl4Prefit.body[TypeID::rel]          = -1.0;
00274       wl4Prefit.body[TypeID::gravDelay]    = -1.0;
00275       wl4Prefit.body[TypeID::satPCenter]   = -1.0;
00276       wl4Prefit.body[TypeID::tropoSlant]   = -1.0;
00277       wl4Prefit.body[TypeID::ionoL1]       = firstFactorOfLC(4,-5)
00278                                             +secondFactorOfLC(4,-5)*GAMMA_GPS;
00279       wl4Prefit.body[TypeID::windUp]       = -wavelengthOfLC(4,-5)/TWO_PI;
00280 
00281    }  // End of constructor 'LinearCombinations::LinearCombinations()'
00282 
00283 
00284       // Return the frequency of the combination in cycles: i * L1 + j * L2 
00285    double LinearCombinations::freqOfLC(int i, int j, double f1 , double f2 )
00286    {
00287       return ( double(i)*f1+double(j)*f2 );
00288    }
00289 
00290       // Return the wavelength of the combination in cycles: i * L1 + j * L2 
00291    double LinearCombinations::wavelengthOfLC(int i,int j,double f1,double f2)
00292    {
00293       return C_GPS_M / freqOfLC(i,j,f1,f2);
00294    }
00295 
00297    double LinearCombinations::firstFactorOfLC(int i,int j,double f1,double f2)
00298    {
00299       return double(i)*f1/freqOfLC(i,j,f1,f2);
00300    }
00301 
00303    double LinearCombinations::secondFactorOfLC(int i,int j,double f1,double f2 )
00304    {
00305       return double(j)*f2/freqOfLC(i,j,f1,f2);
00306    }
00307 
00308 
00309 } // End of namespace gpstk
00310 
00311 

Generated on Thu Feb 9 03:30:57 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1