示例#1
0
 static int getSerialNumber(int mjd)
 throw(Exception)
 {
     CommonTime t;
     t=MJD(double(mjd));
     return getSerialNumber(t);
 }
示例#2
0
/*
** The HAE to HEEQ transformation is given by the matrix
**
** 	S2 = <theta0,Z>*<i,X>*<Omega,Z>
**
** where the rotation angle theta0 is the the longitude of the Sun's
** central meridian, i is the the inclination of the Sun's equator and
** Omega is the the ecliptic longitude of the ascending node of the Sun's
** equator. This transformation comprises a rotation in the plane of the
** ecliptic from the First Point of Aries to the ascending node of the
** solar equator, then a rotation from the plane of the ecliptic to the 
** plane of the equator and finally a rotation in the plane of the solar
** equator from the ascending node to the central meridian. 
**
** Implemented by Kristi Keller on 2/2/2004
*/
void
mat_S2(const double et, Mat mat)
{
  Mat mat_tmp;
  double Omega = 73.6667+0.013958*(MJD(et)+3242)/365.25;
  double theta0 = atand(cosd(7.25) * tand(lambda0(et)-Omega));
  double angle_1 = lambda0(et)-Omega;
  angle_1=fmod(angle_1,360.0);
  if (angle_1 < 0.0) angle_1+=360.0;

  theta0=fmod(theta0,360.0);
  if (theta0 < 0.0) theta0+=360.0;
  if (angle_1 < 180.0) {
      if (theta0 < 180.0) theta0+=180.0;
       }
  if (angle_1 > 180.0) {
      if (theta0 > 180.0) theta0-=180.0;
       }
  hapgood_matrix(theta0, Z, mat);

  hapgood_matrix(7.25, X, mat_tmp);
  mat_times_mat(mat, mat_tmp, mat);

  hapgood_matrix(Omega, Z, mat_tmp);
  mat_times_mat(mat, mat_tmp, mat);
}
示例#3
0
      /** Add EOPs to the store via a flat STK file. 
       *  EOP-v1.1.txt
       *  http://celestrak.com/SpaceData/EOP-format.asp
       *
       *  @param stkFile  Name of file to read, including path.
       */
   void EOPDataStore::loadSTKFile(std::string stkFile)
      throw(FileMissingException)
   {
      std::ifstream fstk(stkFile.c_str());

      int  numData = 0;
      bool bData = false;

      std::string buf;
      while(getline(fstk,buf))
      {   
         if(buf.substr(0,19) == "NUM_OBSERVED_POINTS")
         {
            numData = StringUtils::asInt(buf.substr(20));
            continue;
         }
         else if(buf.substr(0,14) == "BEGIN OBSERVED")
         {
            bData = true;
            continue;
         }
         else if(buf.substr(0,13) == "END PREDICTED")
         {
            bData = false;
            break;
         }
         if(!StringUtils::isDigitString(buf.substr(0,4)))
         {
            // for observed data and predicted data
            continue;
         }

         if(bData)
         {
            // # FORMAT(I4,I3,I3,I6,2F10.6,2F11.7,4F10.6,I4)
            //int year = StringUtils::asInt(buf.substr(0,4));
            //int month = StringUtils::asInt(buf.substr(4,3));
            //int day = StringUtils::asInt(buf.substr(7,3));
            double mjd = StringUtils::asInt(buf.substr(10,6));

            double xp = StringUtils::asDouble(buf.substr(16,10));
            double yp = StringUtils::asDouble(buf.substr(26,10));
            double UT1mUTC = StringUtils::asDouble(buf.substr(36,11));
            double dPsi = 0.0;
            double dEps = 0.0;

            addEOPData(MJD(mjd,TimeSystem::UTC), EOPData(xp,yp,UT1mUTC,dPsi,dEps));
         }

      }  // End of 'while'

      fstk.close();
   }
示例#4
0
char *TimeFormat(dword DateTime, byte Sec, eTimeStampFormat TimeStampFormat)
{
  static char           sTimeStamp [25];      //Log adds a SPACE to sTimeStamp. Do not make it too small!
  word                  Mjd, Year;
  byte                  Month, Day, WeekDay, Hour, Min;

  Mjd  = MJD    (DateTime);
  Hour = HOUR   (DateTime);
  Min  = MINUTE (DateTime);
  TAP_ExtractMjd (Mjd, &Year, &Month, &Day, &WeekDay);

  switch (TimeStampFormat)
  {
    case TIMESTAMP_HM     : TAP_SPrint (sTimeStamp, "%02d:%02d", Hour, Min); break;
    case TIMESTAMP_HMS    : TAP_SPrint (sTimeStamp, "%02d:%02d:%02d", Hour, Min, Sec); break;
    case TIMESTAMP_YMD    : TAP_SPrint (sTimeStamp, "%02d-%02d-%02d", Year, Month, Day); break;
    case TIMESTAMP_YMDHM  : TAP_SPrint (sTimeStamp, "%04d-%02d-%02d %02d:%02d", Year, Month, Day, Hour, Min); break;
    case TIMESTAMP_YMDHMS : TAP_SPrint (sTimeStamp, "%04d-%02d-%02d %02d:%02d:%02d", Year, Month, Day, Hour, Min, Sec); break;
    case TIMESTAMP_FNYMDHM: TAP_SPrint (sTimeStamp, "%04d%02d%02d_%02d%02d", Year, Month, Day, Hour, Min); break;
    default               : sTimeStamp [0] = '\0';
  }

  return sTimeStamp;
}
示例#5
0
char *TimeFormat(dword DateTime, byte Sec, eTimeStampFormat TimeStampFormat, char *Result)
{
  TRACEENTER();

  word                  Mjd, Year;
  byte                  Month, Day, WeekDay, Hour, Min;

  if(Result)
  {
    Mjd  = MJD    (DateTime);
    Hour = HOUR   (DateTime);
    Min  = MINUTE (DateTime);
    TAP_ExtractMjd(Mjd, &Year, &Month, &Day, &WeekDay);
    if(Mjd == 0)
    {
      Year = 0;
      Month = 0;
      Day = 0;
      WeekDay = 0;
    }

    switch(TimeStampFormat)
    {
      case TIMESTAMP_HM     : TAP_SPrint(Result, "%02d:%02d", Hour, Min); break;
      case TIMESTAMP_HMS    : TAP_SPrint(Result, "%02d:%02d:%02d", Hour, Min, Sec); break;
      case TIMESTAMP_YMD    : TAP_SPrint(Result, "%02d-%02d-%02d", Year, Month, Day); break;
      case TIMESTAMP_YMDHM  : TAP_SPrint(Result, "%04d-%02d-%02d %02d:%02d", Year, Month, Day, Hour, Min); break;
      case TIMESTAMP_YMDHMS : TAP_SPrint(Result, "%04d-%02d-%02d %02d:%02d:%02d", Year, Month, Day, Hour, Min, Sec); break;
      case TIMESTAMP_FNYMDHM: TAP_SPrint(Result, "%04d%02d%02d_%02d%02d", Year, Month, Day, Hour, Min); break;
      default               : Result[0] = '\0'; break;
    }
  }

  TRACEEXIT();
  return Result;
}
示例#6
0
   void EOPDataStore::loadIGSFile(std::string igsFile)
      throw(FileMissingException)
   {
      ifstream inpf(igsFile.c_str());
      if(!inpf) 
      {
         FileMissingException fme("Could not open IERS file " + igsFile);
         GPSTK_THROW(fme);
      }

      clear();

      // first we skip the header section
      // skip the header

      //version 2
      //EOP  SOLUTION
      //  MJD         X        Y     UT1-UTC    LOD   Xsig   Ysig   UTsig LODsig  Nr Nf Nt     Xrt    Yrt  Xrtsig Yrtsig   dpsi    deps
      //               10**-6"        .1us    .1us/d    10**-6"     .1us  .1us/d                10**-6"/d    10**-6"/d        10**-6

      string temp;
      getline(inpf,temp);	
      getline(inpf,temp);  
      getline(inpf,temp);  
      getline(inpf,temp);  

      bool ok (true);
      while(!inpf.eof() && inpf.good()) 
      {
         string line;
         getline(inpf,line);
         StringUtils::stripTrailing(line,'\r');
         if(inpf.eof()) break;

         // line length is actually 185
         if(inpf.bad() || line.size() < 120) { ok = false; break; }

         istringstream istrm(line);
         
         double mjd(0.0),xp(0.0),yp(0.0),UT1mUTC(0.0),dPsi(0.0),dEps(0.0);
         
         istrm >> mjd >> xp >> yp >> UT1mUTC;

         for(int i=0;i<12;i++) istrm >> temp;

         istrm >> dPsi >> dEps;
         
         xp *= 1e-6;
         yp *= 1e-6;
         UT1mUTC *= 1e-7;
         
         dPsi *= 1e-6;
         dEps *= 1e-6;

         addEOPData(MJD(mjd,TimeSystem::UTC), EOPData(xp,yp,UT1mUTC,dPsi,dEps));
      };
      inpf.close();

      if(!ok) 
      {
         FileMissingException fme("IERS File " + igsFile
                                  + " is corrupted or wrong format");
         GPSTK_THROW(fme);
      }
   }
示例#7
0
 /** Edit the store by deleting all entries before(after)
  *  the given min(max) times. If tmin is later than tmax,
  *  the two times are switched.
  *  @param tmin DayTime desired earliest store time.
  *  @param tmax DayTime desired latest store time.
  */
 void edit(const CommonTime& tmin,
           const CommonTime& tmax)
 throw()
 {
     edit(int(MJD(tmin).mjd+0.5),int(MJD(tmax).mjd+1.5));
 }