RelativityEffect.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: RelativityEffect.cpp 2457 2010-08-18 14:20:12Z coandrei $"
00002 
00009 //============================================================================
00010 //
00011 //  This file is part of GPSTk, the GPS Toolkit.
00012 //
00013 //  The GPSTk is free software; you can redistribute it and/or modify
00014 //  it under the terms of the GNU Lesser General Public License as published
00015 //  by the Free Software Foundation; either version 2.1 of the License, or
00016 //  any later version.
00017 //
00018 //  The GPSTk is distributed in the hope that it will be useful,
00019 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 //  GNU Lesser General Public License for more details.
00022 //
00023 //  You should have received a copy of the GNU Lesser General Public
00024 //  License along with GPSTk; if not, write to the Free Software Foundation,
00025 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 //
00027 //  Wei Yan - Chinese Academy of Sciences . 2009, 2010
00028 //
00029 //============================================================================
00030 
00031 
00032 #include "RelativityEffect.hpp"
00033 #include "ASConstant.hpp"
00034 
00035 namespace gpstk
00036 {
00037    // this is the real one
00038    void RelativityEffect::doCompute(UTCTime utc, EarthBody& rb, Spacecraft& sc)
00039    {
00040       /* reference: Jisheng,Li P110 Bernese5 GENREL.f
00041          a_rl = a_rl1 + a_rl2 + a_rl3
00042 
00043          a_rl2 and a_rl3 are ignored for precise orbit determination
00044       */
00045       const double GM = ASConstant::GM_Earth;
00046       const double C = ASConstant::SPEED_OF_LIGHT;
00047       
00048       Vector<double> r = sc.R();
00049       Vector<double> v = sc.V();
00050 
00051       double beta = 1.0;
00052       double gama = 1.0;
00053       
00054       double c2 = C * C;
00055       double r2 = dot(r,r);
00056       double v2 = dot(v,v);
00057 
00058       double r_mag = norm(r);
00059       double r3 = r2 * r_mag;
00060       
00061       double p = GM/c2/r3;
00062       
00063       // a
00064       a.resize(3,0.0);
00065       
00066       double pr = 2.0 * (beta + gama) * GM / r_mag - gama * v2;
00067       double pv = 2.0 * (1.0 + gama) * dot(r,v);
00068       
00069       a = p * ( pr * r + pv * v );
00070 
00071       // da_dr
00072       da_dr.resize(3,3,0.0);
00073 
00074       double prr = -(GM/r_mag)*(GM/r_mag)*(2.0*(beta+gama)/c2);
00075       double pvv = (GM/r3)*(2.0*(1.0+gama)/c2);
00076       double par = -3.0/r2;
00077       double ppr = (GM/r3)*((GM/r_mag)*(2.0*(beta+gama)/c2)-gama*v2/c2);
00078 
00079       for(int i=0; i<3; i++)
00080       {
00081          for(int j=0; j<3; j++)
00082          {
00083             double det = (i == j) ? 1.0 : 0.0;
00084             
00085             da_dr(i,j) = prr*r(i)*r(j)
00086                + pvv*v(i)*v(j)
00087                + par*a(i)*r(j)
00088                + ppr*det;
00089          }
00090       }
00091       
00092       // da_dv
00093       da_dv.resize(3,3,0.0);
00094       
00095       double prv = -(GM/r3)*(2.0*gama/c2);
00096       double pvr = (GM/r3)*(2.0*(1.0+gama)/c2);
00097       double ppv = pvr*dot(r,v);
00098 
00099       for(int i=0;i<3;i++)
00100       {
00101          for(int j=0;j<3;j++)
00102          {
00103             double det = (i == j) ? 1.0 : 0.0;
00104 
00105             da_dr(i,j) = prv*r(i)*v(j)
00106                + pvr*v(i)*r(j)
00107                + ppv*det;
00108          }
00109       }
00110 
00111       // da_dp  add it later...
00112       //da_GM da_dbeta da_gama
00113       
00114    }  // End of method 'RelativityEffect::doCompute()'
00115 
00116 
00117 }  // End of namespace 'gpstk'
00118 
00119 
00120 
00121 

Generated on Tue May 22 03:31:00 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1