Esempio n. 1
0
//---------------------------------------------------------------------------
bool TOEEqAxes::Initialize()
{
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("Entering TOEEq::Initialize ..........\n"));
   #endif
   InertialAxes::Initialize();
   InitializeFK5();
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("Completed IA:Init and InitFK5  ..........\n"));
   #endif
   
   Real dPsi             = 0.0;
   Real longAscNodeLunar = 0.0;
   Real cosEpsbar        = 0.0;

   // convert epoch (A1 MJD) to TT MJD (for calculations)
   // 20.02.06 - arg: changed to use enum types instead of strings
//   Real mjdTT = TimeConverterUtil::Convert(epoch.Get(),
//                 "A1Mjd", "TtMjd", GmatTimeConstants::JD_JAN_5_1941);      
   Real mjdTT = TimeConverterUtil::Convert(epoch.Get(),
                 TimeConverterUtil::A1MJD, TimeConverterUtil::TTMJD, 
                 GmatTimeConstants::JD_JAN_5_1941);      
   //Real jdTT  = mjdTT + GmatTimeConstants::JD_JAN_5_1941;
   // Compute Julian centuries of TDB from the base epoch (J2000) 
   //Real tTDB  = (jdTT -GmatTimeConstants::JD_OF_J2000) / GmatTimeConstants::DAYS_PER_JULIAN_CENTURY;
   Real offset = GmatTimeConstants::JD_JAN_5_1941 - GmatTimeConstants::JD_OF_J2000;
   Real tTDB  = (mjdTT + offset) / GmatTimeConstants::DAYS_PER_JULIAN_CENTURY;
   
   if (overrideOriginInterval) updateIntervalToUse = 
                               ((Planet*) origin)->GetNutationUpdateInterval();
   else                        updateIntervalToUse = updateInterval;
//   Rmatrix33  PREC      = ComputePrecessionMatrix(tTDB, epoch);
//   Rmatrix33  NUT       = ComputeNutationMatrix(tTDB, epoch, dPsi,
//                                                longAscNodeLunar, cosEpsbar);
   
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("About to call ComputePrecession/Nutation ..........\n"));
   #endif
   ComputePrecessionMatrix(tTDB, epoch);
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("Called ComputePrecession ..........\n"));
   #endif
   ComputeNutationMatrix(tTDB, epoch, dPsi, longAscNodeLunar, cosEpsbar, true);
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("Called ComputeNutation ..........\n"));
      if (precData == NULL)
         MessageInterface::ShowMessage(wxT("precData is NULL!!!!\n"));
      if (nutData == NULL)
         MessageInterface::ShowMessage(wxT("nutData is NULL!!!!\n"));
   #endif
   
   Real PrecT[9] = {precData[0], precData[3], precData[6],
                    precData[1], precData[4], precData[7],
                    precData[2], precData[5], precData[8]};
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("PrecT omputed  ..........\n"));
   #endif
   Real NutT[9] =  {nutData[0], nutData[3], nutData[6],
                    nutData[1], nutData[4], nutData[7],
                    nutData[2], nutData[5], nutData[8]};
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("NutT computed  ..........\n"));
   #endif

   Integer p3 = 0;
   Real res[3][3];
   for (Integer p = 0; p < 3; ++p)
   {
      p3 = 3*p;
      for (Integer q = 0; q < 3; ++q)
      {
         res[p][q] = PrecT[p3]   * NutT[q]   + 
                     PrecT[p3+1] * NutT[q+3] + 
                     PrecT[p3+2] * NutT[q+6];
      }
   }     
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("About to set rotMatrix ..........\n"));
   #endif
   rotMatrix.Set(res[0][0],res[0][1],res[0][2],
                 res[1][0],res[1][1],res[1][2],
                 res[2][0],res[2][1],res[2][2]); 
   
   //rotMatrix = PREC.Transpose() * NUT.Transpose();
   //rotMatrix = PREC * NUT;

   // rotDotMatrix is still the default zero matrix
   
   #ifdef DEBUG_TOEEQ
      MessageInterface::ShowMessage(wxT("EXITing TOEEq::Initialize ..........\n"));
   #endif
   return true;
}
Esempio n. 2
0
//---------------------------------------------------------------------------
bool TOEEcAxes::Initialize()
{
   InertialAxes::Initialize();
   InitializeFK5();
   
   Real dPsi             = 0.0;
   Real longAscNodeLunar = 0.0;
   Real cosEpsbar        = 0.0;

   // convert epoch (A1 MJD) to TT MJD (for calculations)
   Real mjdTT = TimeConverterUtil::Convert(epoch.Get(),
                 TimeConverterUtil::A1MJD, TimeConverterUtil::TTMJD, 
                 GmatTimeConstants::JD_JAN_5_1941);      

   // Compute Julian centuries of TDB from the base epoch (J2000) 
   Real offset = GmatTimeConstants::JD_JAN_5_1941 - GmatTimeConstants::JD_OF_J2000;
   Real tTDB  = (mjdTT + offset) / GmatTimeConstants::DAYS_PER_JULIAN_CENTURY;
   Real tTDB2 = tTDB * tTDB;
   Real tTDB3 = tTDB * tTDB2;
   
   // Vallado Eq. 3-52
   Real Epsbar  = (84381.448 - 46.8150*tTDB - 0.00059*tTDB2 + 0.001813*tTDB3)
      * GmatMathConstants::RAD_PER_ARCSEC;
   Real R1EpsT[9] = { 1.0,                      0.0,                       0.0,
                      0.0,GmatMathUtil::Cos(Epsbar),-GmatMathUtil::Sin(Epsbar),
                      0.0,GmatMathUtil::Sin(Epsbar), GmatMathUtil::Cos(Epsbar)};
   
   
   if (overrideOriginInterval) updateIntervalToUse = 
                               ((Planet*) origin)->GetNutationUpdateInterval();
   else                        updateIntervalToUse = updateInterval;

   ComputePrecessionMatrix(tTDB, epoch);
   ComputeNutationMatrix(tTDB, epoch, dPsi, longAscNodeLunar, cosEpsbar, true);

   Real R3PsiT[3][3] = { { GmatMathUtil::Cos(-dPsi),-GmatMathUtil::Sin(-dPsi), 0.0},
                         { GmatMathUtil::Sin(-dPsi), GmatMathUtil::Cos(-dPsi), 0.0},
                         {                      0.0,                     0.0,  1.0}};
   Real PrecT[9] = {precData[0], precData[3], precData[6],
                    precData[1], precData[4], precData[7],
                    precData[2], precData[5], precData[8]};
   
   
   Real res[3][3], tmp[3][3];
   Integer p3 = 0;
   for (Integer p = 0; p < 3; ++p)
   {
      p3 = 3*p;
      for (Integer q = 0; q < 3; ++q)
      {
         tmp[p][q] = R1EpsT[p3]   * R3PsiT[0][q] + 
                     R1EpsT[p3+1] * R3PsiT[1][q] + 
                     R1EpsT[p3+2] * R3PsiT[2][q];
      }
   }     
    for (Integer p = 0; p < 3; ++p)
   {
      p3 = 3*p;
      for (Integer q = 0; q < 3; ++q)
      {
         res[p][q] = PrecT[p3]   * tmp[0][q] + 
                     PrecT[p3+1] * tmp[1][q] + 
                     PrecT[p3+2] * tmp[2][q];
      }
   }     
   rotMatrix.Set(res[0][0],res[0][1],res[0][2],
                 res[1][0],res[1][1],res[1][2],
                 res[2][0],res[2][1],res[2][2]); 

   // rotDotMatrix is still the default zero matrix
   
   return true;
}