gpstk::CommonTime compSatVis::setStartTime() { CommonTime retDT = GPSWeekSecond( 621, 0.0 ); // 12/1/1991 CommonTime initialTime; CommonTime finalTime; switch(navFileType) { case FIC_EPH: case RINEX_NAV: initialTime = BCEphList.getInitialTime(); finalTime = BCEphList.getFinalTime(); break; case FIC_ALM: initialTime = BCAlmList.getInitialTime(); finalTime = BCAlmList.getFinalTime(); break; case Yuma_ALM: initialTime = YumaAlmStore.getInitialTime(); finalTime = YumaAlmStore.getFinalTime(); break; case SEM_ALM: initialTime = SEMAlmStore.getInitialTime(); finalTime = SEMAlmStore.getFinalTime(); break; // If loading "day at a time" files, will need // three days to cover middle day. We need to // find the middle of whatever period was loaded // and back up to the beginning of that day. case SP3: { initialTime = SP3EphList.getInitialTime(); finalTime = SP3EphList.getFinalTime(); break; } } double diff = finalTime - initialTime; retDT = initialTime; retDT += diff/2.0; retDT = YDSTime( static_cast<YDSTime>(retDT).year, static_cast<YDSTime>(retDT).doy, 0.0 ); return(retDT); }
//============================================================================= // Test for getFinalTime // Tests getFinalTime method in SP3EphemerisStore by ensuring that // the method outputs the final time stamp in an SP3 file //============================================================================= int getFinalTimeTest (void) { TUDEF( "SP3EphemerisStore", "getFinalTime" ); try { SP3EphemerisStore store; store.loadFile(inputSP3Data); CommonTime computedFinalTime = store.getFinalTime(); CivilTime knownFinalTime_civ(1997,4,6,23,45,0); CommonTime knownFinalTime = knownFinalTime_civ.convertToCommonTime(); // Check that the function returns the initial time from the file TUASSERTE(CommonTime, knownFinalTime, computedFinalTime); } catch (...) { TUFAIL("Unexpected exception"); } return testFramework.countFails(); }
void compSatVis::printNavFileReferenceTime(FILE* logfp) { string tform2 = "%02m/%02d/%02y DOY %03j, GPS Week %F, DOW %w, %02H:%02M:%02S"; CommonTime t; // If the user did not specify a start time for the evaulation, find the // epoch time of the navigation data set and work from that. // In the case of almanac data, the "initial time" is derived from the // earliest almanac reference time minus a half week. Therefore, we // add the halfweek back in. switch(navFileType) { // For ephemeris, initial time is earliest beginning of effectivty. case FIC_EPH: case RINEX_NAV: t = BCEphList.getInitialTime(); t += HALFWEEK; fprintf(logfp," Ephemeris effectivity\n"); fprintf(logfp," Earliest : %s\n", printTime(t,tform2).c_str()); t = BCEphList.getFinalTime(); t -= HALFWEEK; fprintf(logfp," Latest : %s\n", printTime(t,tform2).c_str()); break; case FIC_ALM: t = BCAlmList.getInitialTime(); t += HALFWEEK; fprintf(logfp," Almanac reference time\n"); fprintf(logfp," Earliest : %s\n", printTime(t,tform2).c_str()); t = BCAlmList.getFinalTime(); t -= HALFWEEK; fprintf(logfp," Latest : %s\n", printTime(t,tform2).c_str()); break; case Yuma_ALM: t = YumaAlmStore.getInitialTime(); t += HALFWEEK; fprintf(logfp," Almanac reference time\n"); fprintf(logfp," Earliest : %s\n", printTime(t,tform2).c_str()); t = YumaAlmStore.getFinalTime(); t -= HALFWEEK; fprintf(logfp," Latest : %s\n", printTime(t,tform2).c_str()); break; case SEM_ALM: t = SEMAlmStore.getInitialTime(); t += HALFWEEK; fprintf(logfp," Almanac reference time\n"); fprintf(logfp," Earliest : %s\n", printTime(t,tform2).c_str()); t = SEMAlmStore.getFinalTime(); t -= HALFWEEK; fprintf(logfp," Latest : %s\n", printTime(t,tform2).c_str()); break; case SP3: { CommonTime begin = SP3EphList.getInitialTime(); CommonTime end = SP3EphList.getFinalTime(); fprintf(logfp," Ephemeris effectivity\n"); fprintf(logfp," Earliest : %s\n", printTime(begin,tform2).c_str()); fprintf(logfp," Latest : %s\n", printTime(end,tform2).c_str()); break; } } return; }