void MPSim::process() { IonoModel spsIonoCorr; // Read nav file and store unique list of ephemeredes if (navOption.getCount()>0) { EphReader ephs; for (size_t i=0; i<navOption.getCount(); i++) { ephs.read(navOption.getValue()[i].c_str()); } logStream << "Read these input files for ephemeris or almanac: " << endl; for (size_t i=0; i<ephs.filesRead.size(); i++) logStream << " " << ephs.filesRead[i] << endl; } if (rateOption.getCount()>0) { outputRate = StringUtils::asFloat(rateOption.getValue().front()); } logStream << "Observation interval set to " << outputRate << " s" << endl; }
void NavDump::process() { ofstream out; out.open(outputFileOption.getValue()[0].c_str()); if (out.fail()) { cout << "Opening output file " << outputFileOption.getValue()[0] << " failed." << endl << " navdump is ending..." << endl << endl; return; } if (!isRinexInput) { // filter the data... first by block number, then by PRN FileFilterFrame<FICStream, FICData> data(inputFileOption.getValue()[0]); if (!blockFilterList.empty()) data.filter(FICDataFilterBlock(blockFilterList)); if (!prnFilterList.empty()) data.filter(FICDataFilterPRN(prnFilterList)); list<FICData>& ficlist = data.getData(); list<FICData>::iterator itr = ficlist.begin(); while (itr != ficlist.end()) { (*itr).prettyDump(out); itr++; } } else // Rinex navigation message data { FileFilterFrame<RinexNavStream, RinexNavData> data(inputFileOption.getValue()[0]); if (!prnFilterList.empty()) data.filter(RinexNavDataFilterPRN(prnFilterList)); list<RinexNavData>& rnavlist = data.getData(); list<RinexNavData>::iterator itr = rnavlist.begin(); while (itr!=rnavlist.end()) { RinexNavData& r = *itr; EngEphemeris ee(r); ee.dump(out); itr++; } } }
bool MPSim::initialize(int argc, char *argv[]) throw() { if(!BasicFramework::initialize(argc, argv)) return false; if (logfileOption.getCount()>0) { logFileName = StringUtils::asString(logfileOption.getValue().front()); } logStream.open( logFileName.c_str() ); logStream << "mpsim log file" << endl; logStream << "Execution started at: " << startTime.printf(epochFormat) << endl; return true; }
bool EphDiff::initialize(int argc, char* argv[]) throw() { if(!BasicFramework::initialize(argc, argv)) { return false; } // check the command options for 2 input files int ficCount = ficFileOption.getCount(); int rinexCount = rinexFileOption.getCount(); if ( ((ficCount == 2) && (rinexCount != 0)) || ((ficCount == 1) && (rinexCount != 1)) || ((ficCount == 0) && (rinexCount != 2)) ) { cout << "Exactly two input files must be specified on the command line" << endl << " ephdiff is ending..." << endl << endl; return false; } // open the files // in the case of 1 FIC and 1 rinex file, make sure the first file // is chosen correctly... if ( (ficCount == 1) && (rinexCount == 1) ) { string ficname = ficFileOption.getValue()[0]; string rinexname = rinexFileOption.getValue()[0]; FileFilterFrame<FICStream, FICData> ficdata(ficname); FileFilterFrame<RinexNavStream, RinexNavData> rinexdata(rinexname); if (ficFileOption.getOrder() < rinexFileOption.getOrder()) { file1 = ficname; file2 = rinexname; fillFIC(ficdata, file1list); fillRINEX(rinexdata, file2list); } else { file1 = rinexname; file2 = ficname; fillRINEX(rinexdata, file1list); fillFIC(ficdata, file2list); } } else if (ficCount == 2) { file1 = ficFileOption.getValue()[0]; FileFilterFrame<FICStream, FICData> fic1(file1); file2 = ficFileOption.getValue()[1]; FileFilterFrame<FICStream, FICData> fic2(file2); fillFIC(fic1, file1list); fillFIC(fic2, file2list); } else // if (rinexCount == 2) { file1 = rinexFileOption.getValue()[0]; FileFilterFrame<RinexNavStream, RinexNavData> rn1(file1); file2 = rinexFileOption.getValue()[1]; FileFilterFrame<RinexNavStream, RinexNavData> rn2(file2); fillRINEX(rn1, file1list); fillRINEX(rn2, file2list); } return true; }
bool DOPCalc::initialize(int argc, char *argv[]) throw() { if (!BasicFramework::initialize(argc,argv)) return false; // if specified, get the elevation mask if (minElevOpt.getCount()) minElev = StringUtils::asDouble((minElevOpt.getValue())[0]); // set verbose level ephReader.verboseLevel = verboseLevel; // set debug level FFIdentifier::debugLevel = debugLevel; // read in ephemeris data for (int i=0; i<ephFileOpt.getCount(); i++) ephReader.read(ephFileOpt.getValue()[i]); // grab the station number (needed to process smooth data) if (msidOpt.getCount()) msid = StringUtils::asUnsigned(msidOpt.getValue()[0]); // read in observation data readObsFile(obsFileOpt, obsEpochMap); // get the antenna position (if RINEX was given, this will overwrite pos.) if (rxPosOpt.getCount()) { // get the position from the command line option double x,y,z; sscanf(rxPosOpt.getValue().front().c_str(),"%lf %lf %lf", &x, &y, &z); rxPos[0] = x; rxPos[1] = y; rxPos[2] = z; } else if (msidOpt.getCount() && mscFileOpt.getCount()) { // get the position from the MSC file string fn = mscFileOpt.getValue()[0]; MSCStream mscs(fn.c_str(), ios::in); MSCData mscd; while (mscs >> mscd) { if (mscd.station == msid) { rxPos = mscd.coordinates; if (debugLevel || verboseLevel) cout << "Read position from MSC file: " << fn << endl; break; } } }
void NavSum::process() { try { ofstream out; out.open(outputFileOption.getValue()[0].c_str()); if (out.fail()) { cout << "Opening output file " << outputFileOption.getValue()[0] << " failed." << endl << " navsum is ending..." << endl << endl; return; } // filter the data... first by block number, then by PRN FileFilterFrame<FICStream, FICData> data(inputFileOption.getValue()[0]); if (!blockFilterList.empty()) data.filter(FICDataFilterBlock(blockFilterList)); if (!prnFilterList.empty()) data.filter(FICDataFilterPRN(prnFilterList)); out << "Block# PRN or Transmit ! Toe/Toa" << endl; out << "in set Type SVID mm/dd/yy DOY hh:mm:ss Week SOW ! mm/dd/yy DOY HH:MM:SS" << endl; std::string xmitFmt("%02m/%02d/%02y %03j %02H:%02M:%02S %4F %6.0g"); std::string epochFmt("%02m/%02d/%02y %03j %02H:%02M:%02S"); DayTime XMitT; DayTime EpochT; uint32_t temp; int PRNID; int xmitPRN; int xMitWeek; int EpochWeek; char line[100]; string linestr; int count = 0; list<FICData>& ficlist = data.getData(); list<FICData>::iterator itr = ficlist.begin(); while (itr != ficlist.end()) { FICData& r = *itr; count++; int blockType = r.blockNum; double diff = 0.0; double Toe = 0.0; double HOW = 0.0; double xMitSOW = 0.0; double iMitSOW = 0; long IODC = 0; int fit = 0; switch (blockType) { case 9: PRNID = (short) r.f[19]; HOW = r.f[2]; Toe = r.f[33]; xMitWeek = (int) r.f[5]; IODC = ((long) r.f[9]) / 2048; fit = (int) r.f[34]; EpochWeek = xMitWeek; diff = Toe - HOW; if (diff < -1.0 * (double) DayTime::HALFWEEK) EpochWeek++; if (diff > (double) DayTime::HALFWEEK) xMitWeek--; XMitT = DayTime( xMitWeek, HOW-6.0 ); EpochT = DayTime( EpochWeek, Toe ); sprintf(line," %5d %3d %02d %s ! %s 0x%03lX %1d", count,blockType,PRNID, XMitT.printf(xmitFmt).c_str(), EpochT.printf(epochFmt).c_str(), IODC, fit); linestr = string(line); out << linestr << endl; totalsByBlock[BLK9]++; totalsByPRN[PRNID][BLK9]++; break; case 109: PRNID = (int) r.i[1]; xMitWeek = (int) r.i[0]; temp = (uint32_t) r.i[3]; XMitT = buildXMitTime( temp, xMitWeek ); sprintf(line," %5d %3d %02d %s !", count,blockType,PRNID, XMitT.printf(xmitFmt).c_str() ); linestr = string(line); out << linestr << endl; totalsByBlock[BLK109]++; totalsByPRN[PRNID][BLK109]++; break; case 62: PRNID = r.i[3]; xMitWeek = (int) r.i[5]; EpochWeek = (int) r.i[0]; iMitSOW = r.i[1]; if (iMitSOW<0) { iMitSOW += gpstk::DayTime::FULLWEEK; xMitWeek--; } xMitSOW = (double) iMitSOW; XMitT = DayTime( xMitWeek, xMitSOW ); if (PRNID>0 && PRNID<33) { EpochT = DayTime( EpochWeek, r.f[8] ); sprintf(line," %5d %3d %02d %s ! %s", count,blockType,PRNID, XMitT.printf(xmitFmt).c_str(), EpochT.printf(epochFmt).c_str() ); } else { sprintf(line," %5d %3d %02d %s !", count,blockType,PRNID, XMitT.printf(xmitFmt).c_str() ); } linestr = string(line); out << linestr << endl; totalsByBlock[BLK62]++; totalsBySVID[PRNID][BLK62]++; break; case 162: PRNID = r.i[0]; xMitWeek = r.i[14]; EpochWeek = r.i[13]; temp = (uint32_t) r.i[2]; xmitPRN = r.i[11]; XMitT = buildXMitTime( temp, xMitWeek ); sprintf(line," %5d %3d %02d %s ! %02d", count,blockType,PRNID, XMitT.printf(xmitFmt).c_str(), xmitPRN); linestr = string(line); out << linestr << endl; totalsByBlock[BLK162]++; totalsBySVID[PRNID][BLK162]++; break; } itr++; } printSummary( out ); } catch (Exception& exc) { cerr << exc; exit(1); } catch (...) { cerr << "Caught unknown exception" << endl; exit(1); } }
void TimCvt::process() { CommonTime ct; CommandOption *whichOpt = mutexOption.whichOne(); if (whichOpt) { CommandOptionWithCommonTimeArg *cta = dynamic_cast<CommandOptionWithCommonTimeArg *>(whichOpt); if (cta) { ct = cta->getTime().front(); } else // whichOpt == &inputFormatAndTimeOption { mixedScanTime( ct, inputTimeOption.getValue().front(), inputFormatOption.getValue().front() ); } } else { ct = SystemTime(); } int i; int addOptions = addOption.getCount(); int subOptions = subOption.getCount(); for (i = 0; i < addOptions; i++) ct += StringUtils::asDouble(addOption.getValue()[i]); for (i = 0; i < subOptions; i++) ct -= StringUtils::asDouble(subOption.getValue()[i]); if (formatOption.getCount()) { cout << printTime(ct, formatOption.getValue()[0]) << endl; } else { using StringUtils::leftJustify; string eight(8, ' '); // eight spaces GPSWeekZcount wz(ct); CivilTime civ(ct); cout << endl << eight << leftJustify("Month/Day/Year H:M:S", 32) << CivilTime(ct) << endl << eight << leftJustify("Modified Julian Date", 32) << setprecision(15) << MJD(ct) << endl << eight << leftJustify("GPSweek DayOfWeek SecOfWeek", 32) << GPSWeekSecond(ct).printf("%G %w % 13.6g") << endl << eight << leftJustify("FullGPSweek Zcount", 32) << wz.printf("%F % 6z") << endl << eight << leftJustify("Year DayOfYear SecondOfDay", 32) << YDSTime(ct).printf("%Y %03j % 12.6s") << endl << eight << leftJustify("Unix: Second Microsecond", 32) << UnixTime(ct).printf("%U % 6u") << endl << eight << leftJustify("Zcount: 29-bit (32-bit)", 32) << wz.printf("%c (%C)") << endl << endl << endl; } return; }