// Casts Rinex3NavData to a QZSEphemeris object. Rinex3NavData::operator QZSEphemeris() const throw() { QZSEphemeris qzse; // fill the OrbitEph parts castTo(dynamic_cast<OrbitEph*>(&qzse)); // is it right? if(qzse.satID.system != SatID::systemQZSS) qzse.dataLoadedFlag = false; if(!qzse.dataLoadedFlag) return qzse; // throw? // get the epochs right CommonTime ct = time; unsigned int year = static_cast<CivilTime>(ct).year; // Get week for clock, to build Toc double dt = Toc - HOWtime; int week = weeknum; if(dt < -HALFWEEK) week++; else if(dt > HALFWEEK) week--; QZSWeekSecond qzsws = QZSWeekSecond(week, Toc, TimeSystem::QZS); qzsws.adjustToYear(year); qzse.ctToc = CommonTime(qzsws); //MGEX NB MGEX data has GPS week numbers in all systems except BeiDou, //MGEX so must implement temporary fixes: use GPS Toc for QZS and QZSS CommonTime gpstoc = GPSWeekSecond(week, Toc, TimeSystem::GPS); //MGEX qzse.ctToc = gpstoc; //MGEX qzse.ctToc.setTimeSystem(TimeSystem::QZS); // now load the QZSS-specific parts qzse.satID = SatID(qzse.satID.id + 192, SatID::systemQZSS); qzse.IODC = IODC; qzse.IODE = IODE; qzse.health = health; qzse.accuracy = accuracy; qzse.Tgd = Tgd; qzse.HOWtime = HOWtime; week = static_cast<QZSWeekSecond>(qzse.ctToe).getWeek(); qzse.transmitTime = QZSWeekSecond(week, static_cast<double>(HOWtime), TimeSystem::QZS); qzse.codeflags = codeflgs; qzse.L2Pdata = L2Pdata; // NB IODC must be set first... qzse.fitint = fitint; qzse.setFitIntervalFlag(int(fitint)); // calls adjustValidity(); return qzse; }
/// Change the file system, keeping fileType, fileSys, and fileSysSat /// consistent. /// @param string str beginning with system character or "M" for mixed void setFileSystem(const std::string& str) throw(Exception) { try { if(str[0] == 'M' || str[0] == 'm') { if(version < 3) { Exception e("RINEX version 2 'Mixed' Nav files do not exist"); GPSTK_THROW(e); } fileType = "NAVIGATION"; fileSys = "MIXED"; fileSysSat = SatID(-1, SatID::systemMixed); } else { RinexSatID sat(std::string(1,str[0])); fileSysSat = SatID(sat); fileSys = StringUtils::asString(sat.systemChar()) + ": (" + sat.systemString3()+")"; if(version >= 3) { fileType = "NAVIGATION"; } else { // RINEX 2 if(sat.system == SatID::systemGPS) fileType = "N (GPS Nav)"; else if(sat.system == SatID::systemGlonass) fileType = "G (GLO Nav)"; else if(sat.system == SatID::systemGeosync) fileType = "H (GEO Nav)"; else { Exception e( std::string("RINEX version 2 ") + sat.systemString3() + std::string(" Nav files do not exist") ); GPSTK_THROW(e); } } } } catch(Exception& e) { GPSTK_RETHROW(e); } }
// Private helper routine for casts from this to OrbitEph-based Ephemerides void Rinex3NavData::castTo(OrbitEph *oeptr) const { try { // Glonass and Geosync do not have a orbit-based ephemeris if(satSys == "R" || satSys == "S") { oeptr->dataLoadedFlag = false; return; } // Overhead RinexSatID sat; sat.fromString(satSys + StringUtils::asString(PRNID)); oeptr->satID = SatID(sat); //obsID = ?? ObsID obsID; // Defines carrier and tracking code oeptr->ctToe = time; // clock model oeptr->af0 = af0; oeptr->af1 = af1; oeptr->af2 = af2; // Major orbit parameters oeptr->M0 = M0; oeptr->dn = dn; oeptr->ecc = ecc; oeptr->A = Ahalf * Ahalf; oeptr->OMEGA0 = OMEGA0; oeptr->i0 = i0; oeptr->w = w; oeptr->OMEGAdot = OMEGAdot; oeptr->idot = idot; // modern nav msg oeptr->dndot = 0.; oeptr->Adot = 0.; // Harmonic perturbations oeptr->Cuc = Cuc; oeptr->Cus = Cus; oeptr->Crc = Crc; oeptr->Crs = Crs; oeptr->Cic = Cic; oeptr->Cis = Cis; oeptr->dataLoadedFlag = true; } catch(Exception& e) { GPSTK_RETHROW(e); } }
//----------------------------------------------------------------------------- // Add all ephemerides to an existing list<QZSEphemeris> for given satellite // If sat.id is -1 (the default), all ephemerides are added. // @return the number of ephemerides added. int QZSEphemerisStore::addToList(list<QZSEphemeris>& qzslist, SatID sat) const { // get the list from OrbitEphStore list<OrbitEph*> oelst; OrbitEphStore::addToList(oelst,SatID(-1,SatID::systemQZSS)); int n(0); list<OrbitEph*>::const_iterator it; for(it = oelst.begin(); it != oelst.end(); ++it) { OrbitEph *ptr = *it; QZSEphemeris *qzsptr = dynamic_cast<QZSEphemeris*>(ptr); QZSEphemeris qzseph(*qzsptr); qzslist.push_back(qzseph); n++; } return n; }
P0CodeGenerator(const int prn) : CodeGenerator(ObsID::tcP, SatID(prn, SatID::systemGPS)) {setIndex(0);}
// Method to store load ocean tide harmonics data in this class' // data map void DCBDataReader::loadData() throw( FFStreamError, gpstk::StringUtils::StringException ) { try { allDCB.satDCB.clear(); allDCB.gpsDCB.clear(); allDCB.glonassDCB.clear(); // a buffer string line; // read first line formattedGetLine(line, true); // Let's skip 6 lines for(int i=0; i<6; i++) formattedGetLine(line, true); // Now, let's read data while(1) { formattedGetLine(line, true); if(line.length() < 46) continue; string sysFlag = line.substr(0,1); int satPRN = StringUtils::asInt(line.substr(1,2)); string station = StringUtils::strip(line.substr(6,4)); const double dcbVal = StringUtils::asDouble(line.substr(26,9)); //const double dcbRms = StringUtils::asDouble(line.substr(38,9)); if(station.length() < 4) // this is satellite DCB data { SatID sat; if(sysFlag == "G") { sat = SatID(satPRN,SatID::systemGPS); } else if(sysFlag == "R") { sat = SatID(satPRN,SatID::systemGlonass); } else { // Unexpected and we do nothing here } allDCB.satDCB[sat] = dcbVal; } else // this is receiver DCB data { if(sysFlag == "G") { allDCB.gpsDCB[station] = dcbVal; } else if(sysFlag == "R") { allDCB.glonassDCB[station] = dcbVal; } else { // Unexpected and we do nothing here } } } // End of 'while(1)' } // End of try block catch (EndOfFile& e) { // We should close this data stream before returning (*this).close(); return; } catch (...) { // We should close this data stream before returning (*this).close(); return; } } // End of 'DCBDataReader::loadData()'
CACodeGenerator(int prn) : CodeGenerator(ObsID::tcCA, SatID(prn, SatID::systemGPS)), g2Offset(getG2Delay(prn)) {setIndex(0);}
// Convert this RinexNavData to a GPSEphemeris object. // for backward compatibility only - use Rinex3NavData RinexNavData::operator GPSEphemeris() const { GPSEphemeris gpse; try { // Overhead gpse.satID = SatID(PRNID, SatID::systemGPS); gpse.ctToe = time; // clock model gpse.af0 = af0; gpse.af1 = af1; gpse.af2 = af2; // Major orbit parameters gpse.M0 = M0; gpse.dn = dn; gpse.ecc = ecc; gpse.A = Ahalf * Ahalf; gpse.OMEGA0 = OMEGA0; gpse.i0 = i0; gpse.w = w; gpse.OMEGAdot = OMEGAdot; gpse.idot = idot; // modern nav msg gpse.dndot = 0.; gpse.Adot = 0.; // Harmonic perturbations gpse.Cuc = Cuc; gpse.Cus = Cus; gpse.Crc = Crc; gpse.Crs = Crs; gpse.Cic = Cic; gpse.Cis = Cis; gpse.dataLoadedFlag = true; // get the epochs right CommonTime ct = time; //unsigned int year = static_cast<CivilTime>(ct).year; // Get week for clock, to build Toc double dt = Toc - HOWtime; int week = weeknum; if(dt < -HALFWEEK) week++; else if(dt > HALFWEEK) week--; gpse.ctToc = GPSWeekSecond(week, Toc, TimeSystem::GPS); gpse.ctToc.setTimeSystem(TimeSystem::GPS); // now load the GPS-specific parts gpse.IODC = IODC; gpse.IODE = IODE; gpse.health = health; gpse.accuracyFlag = accuracy; gpse.Tgd = Tgd; gpse.HOWtime = HOWtime; week = static_cast<GPSWeekSecond>(gpse.ctToe).getWeek(); gpse.transmitTime = GPSWeekSecond(week, static_cast<double>(HOWtime), TimeSystem::GPS); gpse.codeflags = codeflgs; gpse.L2Pdata = L2Pdata; // NB IODC must be set first... gpse.fitint = fitint; gpse.setFitIntervalFlag(int(fitint)); // calls adjustValidity(); } catch(Exception& e) { GPSTK_RETHROW(e); } return gpse; }