00001 #pragma ident "$Id: SunForce.cpp 2457 2010-08-18 14:20:12Z coandrei $"
00002
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "SunForce.hpp"
00033 #include "ASConstant.hpp"
00034 #include "DayTime.hpp"
00035 #include "IERS.hpp"
00036 #include "ReferenceFrames.hpp"
00037
00038 namespace gpstk
00039 {
00040
00041 SunForce::SunForce()
00042 : mu(ASConstant::GM_Sun)
00043 { }
00044
00045
00046
00047
00048
00049
00050
00051
00052 void SunForce::doCompute(UTCTime utc, EarthBody& rb, Spacecraft& sc)
00053 {
00054
00055
00056
00057
00058
00059
00060 Vector<double> r_sun = ReferenceFrames::getJ2kPosition(utc.asTDB(), SolarSystem::Sun);
00061
00062 r_sun = r_sun * 1000.0;
00063
00064 Vector<double> d = sc.R() - r_sun;
00065 double dmag = norm(d);
00066 double dcubed = dmag * dmag *dmag;
00067
00068 Vector<double> temp1 = d / dcubed;
00069
00070 double smag = norm(r_sun);
00071 double scubed = smag * smag * smag;
00072
00073 Vector<double> temp2 = r_sun / scubed;
00074
00075 Vector<double> sum = temp1 + temp2;
00076 a = sum * (-mu);
00077
00078
00079 da_dr.resize(3,3,0.0);
00080 double muod3 = mu / dcubed;
00081 double jk = 3.0 * muod3/dmag/dmag;
00082
00083 double xx = d(0);
00084 double yy = d(1);
00085 double zz = d(2);
00086
00087 da_dr(0,0) = jk * xx * xx - muod3;
00088 da_dr(0,1) = jk * xx * yy;
00089 da_dr(0,2) = jk * xx * zz;
00090
00091 da_dr(1,0) = da_dr(0,1);
00092 da_dr(1,1) = jk * yy * yy - muod3;
00093 da_dr(1,2) = jk * yy * zz;
00094
00095 da_dr(2,0) = da_dr(0,2);
00096 da_dr(2,1) = da_dr(1,2);
00097 da_dr(2,2) = jk * zz * zz - muod3;
00098
00099
00100 da_dv.resize(3,3,0.0);
00101
00102
00103
00104 }
00105
00106
00107 void SunForce::test()
00108 {
00109
00110 ReferenceFrames::setJPLEphFile("InputData\\DE405\\jplde405");
00111
00112 DayTime time(2000,1,1,0,0,0.0);
00113 double mjd = time.MJD();
00114
00115 Vector<double> posSun = ReferenceFrames::getJ2kPosition(time,SolarSystem::Sun);
00116
00117 cout << posSun << endl;
00118
00119 int a =0;
00120 }
00121
00122 }
00123