示例#1
0
   void RinexClockData::reallyGetRecord(FFStream& ffs)
      throw(exception, FFStreamError, StringException)
   {
      // cast the stream to be an RinexClockStream
      RinexClockStream& strm = dynamic_cast<RinexClockStream&>(ffs);

      clear();

      string line;
      strm.formattedGetLine(line,true);      // true means 'expect possible EOF'
      stripTrailing(line);
      if(line.length() < 59) {
         FFStreamError e("Short line : " + line);
         GPSTK_THROW(e);
      }

      //cout << "Data Line: /" << line << "/" << endl;
      datatype = line.substr(0,2);
      site = line.substr(3,4);
      if(datatype == string("AS")) {
         strip(site);
         int prn(asInt(site.substr(1,2)));
         if(site[0] == 'G') sat = RinexSatID(prn,RinexSatID::systemGPS);
         else if(site[0] == 'R') sat = RinexSatID(prn,RinexSatID::systemGlonass);
         else {
            FFStreamError e("Invalid sat : /" + site + "/");
            GPSTK_THROW(e);
         }
         site = string();
      }

      time = CivilTime(asInt(line.substr( 8,4)),
                     asInt(line.substr(12,3)),
                     asInt(line.substr(15,3)),
                     asInt(line.substr(18,3)),
                     asInt(line.substr(21,3)),
                     asDouble(line.substr(24,10)),
                     TimeSystem::Any);

      int n(asInt(line.substr(34,3)));
      bias = asDouble(line.substr(40,19));
      if(n > 1 && line.length() >= 59) sig_bias = asDouble(line.substr(60,19));

      if(n > 2) {
         strm.formattedGetLine(line,true);
         stripTrailing(line);
         if(int(line.length()) < (n-2)*20-1) {
            FFStreamError e("Short line : " + line);
            GPSTK_THROW(e);
         }
         drift =     asDouble(line.substr( 0,19));
         if(n > 3) sig_drift = asDouble(line.substr(20,19));
         if(n > 4) accel     = asDouble(line.substr(40,19));
         if(n > 5) sig_accel = asDouble(line.substr(60,19));
      }

   }   // end reallyGetRecord()
示例#2
0
      /* Generates the PRN/epoch line and outputs it to strm
       *  @param strm RINEX Nav stream
       */
   void Rinex3NavData::putPRNEpoch(Rinex3NavStream& strm) const
      throw(StringException)
   {
      string line;
      CivilTime civtime(time);

      if(strm.header.version >= 3) {                                 // version 3
         line = sat.toString();
         line += " ";
         line += rightJustify(asString<short>(civtime.year), 4);
         line += " ";
         line += rightJustify(asString<short>(civtime.month), 2, '0');
         line += " ";
         line += rightJustify(asString<short>(civtime.day), 2, '0');
         line += " ";
         line += rightJustify(asString<short>(civtime.hour), 2, '0');
         line += " ";
         line += rightJustify(asString<short>(civtime.minute), 2, '0');
         line += " ";
         line += rightJustify(asString<short>(civtime.second), 2, '0');
      }
      else {                                                         // version 2
         line = rightJustify(asString<short>(PRNID), 2);
         line += " ";
         line += rightJustify(asString<short>(civtime.year), 2, '0');
         line += " ";
         line += rightJustify(asString<short>(civtime.month), 2);
         line += " ";
         line += rightJustify(asString<short>(civtime.day), 2);
         line += " ";
         line += rightJustify(asString<short>(civtime.hour), 2);
         line += " ";
         line += rightJustify(asString<short>(civtime.minute), 2);
         line += " ";
         line += rightJustify(asString(civtime.second,1), 4);
      }

      if(satSys == "R" || satSys == "S") {
         line += doubleToScientific(TauN,19,12,2);
         line += doubleToScientific(GammaN,19,12,2);
         line += doubleToScientific((double)MFtime,19,12,2);
      }
      else if(satSys == "G" || satSys == "E" || satSys == "J" || satSys == "C") {
         line += doubleToScientific(af0,19,12,2);
         line += doubleToScientific(af1,19,12,2);
         line += doubleToScientific(af2,19,12,2);
      }

      strm << stripTrailing(line) << endl;
      strm.lineNumber++;

   }  // End of 'Rinex3NavData::putPRNEpoch(Rinex3NavStream& strm)'
示例#3
0
      // Construct and write the nth record after the epoch record
      //  @param int n                 Record number (1-7), for nth record
      //                               after the epoch line.
      //  @param Rinex3NavStream strm  Stream to read from.
   void Rinex3NavData::putRecord(const int& nline, Rinex3NavStream& strm) const
      throw(StringException, FFStreamError)
   {

      if(nline < 1 || nline > 7) {
         FFStreamError fse(string("Invalid line number ") + asString(nline));
         GPSTK_THROW(fse);
      }

      try {
         string line;

         if(strm.header.version < 3) line += string(3, ' ');
         else                        line += string(4, ' ');

         if(nline == 1) {
            if(satSys == "R" || satSys == "S") {     // GLO and GEO
               line += doubleToScientific(px,19,12,2);
               line += doubleToScientific(vx,19,12,2);
               line += doubleToScientific(ax,19,12,2);
               line += doubleToScientific((double)health,19,12,2);
            }
            else if(satSys == "G" || satSys == "C" || satSys == "J") {// GPS,BDS,QZS
               line += doubleToScientific(IODE,19,12,2);
               line += doubleToScientific(Crs,19,12,2);
               line += doubleToScientific(dn,19,12,2);
               line += doubleToScientific(M0,19,12,2);
            }
            else if(satSys == "E") {                  // GAL
               line += doubleToScientific(IODnav,19,12,2);
               line += doubleToScientific(Crs,19,12,2);
               line += doubleToScientific(dn,19,12,2);
               line += doubleToScientific(M0,19,12,2);
            }
         }

         else if(nline == 2) {
            if(satSys == "R" || satSys == "S") {      // GLO and GEO
               line += doubleToScientific(py,19,12,2);
               line += doubleToScientific(vy,19,12,2);
               line += doubleToScientific(ay,19,12,2);
               if(satSys == "R")
                  line += doubleToScientific((double)freqNum,19,12,2);
               else
                  line += doubleToScientific(accCode,19,12,2);
            }
            else {                                    // GPS,GAL,BDS,QZS
               line += doubleToScientific(Cuc,19,12,2);
               line += doubleToScientific(ecc,19,12,2);
               line += doubleToScientific(Cus,19,12,2);
               line += doubleToScientific(Ahalf,19,12,2);
            }
         }

         else if(nline == 3) {
            if(satSys == "R" || satSys == "S") {      // GLO GEO
               line += doubleToScientific(pz,19,12,2);
               line += doubleToScientific(vz,19,12,2);
               line += doubleToScientific(az,19,12,2);
               if(satSys == "R")
                  line += doubleToScientific(ageOfInfo,19,12,2);
               else                             // GEO
                  line += doubleToScientific(IODN,19,12,2);
            }
            else {                                    // GPS,GAL,BDS,QZS
               line += doubleToScientific(Toe,19,12,2);
               line += doubleToScientific(Cic,19,12,2);
               line += doubleToScientific(OMEGA0,19,12,2);
               line += doubleToScientific(Cis,19,12,2);
            }
         }

         // SBAS and GLO end here

         else if(nline == 4) {                        // GPS,GAL,BDS,QZS
            line += doubleToScientific(i0,19,12,2);
            line += doubleToScientific(Crc,19,12,2);
            line += doubleToScientific(w,19,12,2);
            line += doubleToScientific(OMEGAdot,19,12,2);
         }

         else if(nline == 5) {
            // Internally (Rinex3NavData), weeknum=week of HOW
            // In RINEX 3 *files*, weeknum is the week of TOE.
            double wk = double(weeknum);
            if(HOWtime - Toe > HALFWEEK)
               wk++;
            else if(HOWtime - Toe < -(HALFWEEK))
               wk--;

            if(satSys == "G" || satSys == "J") {      // GPS QZS
               line += doubleToScientific(idot,19,12,2);
               line += doubleToScientific((double)codeflgs,19,12,2);
               line += doubleToScientific(wk,19,12,2);
               line += doubleToScientific((double)L2Pdata,19,12,2);
            }
            else if(satSys == "E") {                  // GAL
               line += doubleToScientific(idot,19,12,2);
               line += doubleToScientific((double)datasources,19,12,2);
               line += doubleToScientific(wk,19,12,2);
               line += doubleToScientific((double) 0,19,12,2);
            }
            else if(satSys == "C") {                  // BDS
               line += doubleToScientific(idot,19,12,2);
               line += doubleToScientific((double) 0,19,12,2);
               line += doubleToScientific(wk,19,12,2);
               line += doubleToScientific((double) 0,19,12,2);
            }
         }

         else if(nline == 6) {
            line += doubleToScientific(accuracy,19,12,2);
            line += doubleToScientific((double)health,19,12,2);

            if(satSys == "G" || satSys == "J") {       // GPS, QZS
               line += doubleToScientific(Tgd,19,12,2);
               line += doubleToScientific(IODC,19,12,2);
            }
            else if(satSys == "E" || satSys == "C") {  // GAL, BDS
               line += doubleToScientific(Tgd,19,12,2);
               line += doubleToScientific(Tgd2,19,12,2);
            }
         }

         else if(nline == 7) {
            line += doubleToScientific(HOWtime,19,12,2);

            if(satSys == "G" || satSys == "J") {
               line += doubleToScientific(fitint,19,12,2);
            }
            else if(satSys == "E") {
               ;
            }
            else if(satSys == "C") {
               line += doubleToScientific(IODC,19,12,2);
            }
         }

         strm << stripTrailing(line) << endl;
         strm.lineNumber++;
      }
      catch (std::exception &e) {
         FFStreamError err("std::exception: " + string(e.what()));
         GPSTK_THROW(err);
      }

   }  // End of method 'Rinex3NavData::putRecord(const int& nline,...'