📄 rescor.cpp
字号:
if(pos==0) subfield.push_back(" "); else subfield.push_back(argbias.substr(0,pos)); if(pos >= argbias.size()) break; argbias.erase(0,pos+1); } RinexObsHeader::RinexObsType OT; OT = RinexObsHeader::convertObsType(subfield[0]); double limit=asDouble(subfield[1]); int iret=setBiasLimit(OT,limit); if(iret) { cout << "Error: '--debias <OT,lim>' input is invalid: " << values[i] << endl; cerr << "Error: '--debias <OT,lim>' input is invalid: " << values[i] << endl; } else if(Debug) cout << "Set bias limit for " << RinexObsHeader::convertObsType(OT) << " to " << fixed << setprecision(3) << limit << " (" << values[i] << ")" << endl; } } if(dashca.getCount()) { Callow = true; if(help) cout << "Allow C1 to be P1 when P1 not available\n"; } if(dashcf.getCount()) { Cforce = true; if(help) cout << "Force C1 to replace P1 when C1 available\n"; } if(dashih.getCount()) { values = dashih.getValue(); IonoHt = asDouble(values[0]); if(help) cout << "Set ionosphere height to " << values[0] << " km" << endl; } if(dashSV.getCount()) { values = dashSV.getValue(); SVonly.fromString(values[0]); if(help) cout << "Process only satellite : " << SVonly << endl; } if(dashLog.getCount()) { values = dashLog.getValue(); LogFile = values[0]; if(help) cout << "Log file is " << LogFile << endl; } if(Rest.getCount() && help) { cout << "Remaining options:" << endl; values = Rest.getValue(); for (i=0; i<values.size(); i++) cout << values[i] << endl; } //if(Verbose && help) { // cout << "\nTokens on command line (" << Args.size() << ") are:" << endl; // for(j=0; j<Args.size(); j++) cout << Args[j] << endl; //} // ------------------------------------------------- // now process some of the input try { logof.clear(); logof.exceptions(ios_base::badbit | ios_base::failbit); logof.open(LogFile.c_str(),ios::out); if(logof.fail()) { cout << "Failed to open log file " << LogFile << endl; return -1; } else { cout << "Opened log file (for all output, including debug) " << LogFile << endl; logof << Title; } REC.oflog = &logof; } catch(ios_base::failure& e) { cout << "Exception " << e.what() << endl; return -1; } // check for multiple inputs if(KnownPosInput || !RefPosFile.empty() || doRAIM || RefPosInput) { i = 0; if(KnownPosInput) i++; if(!RefPosFile.empty()) i++; if(doRAIM) i++; if(RefPosInput) i++; if(i > 1) { ostringstream stst; stst << "ERROR: multiple inputs inconsistent:"; if(KnownPosInput) stst << (KnownLLH ? " --RxLLH" : " --RxXYZ"); if(!RefPosFile.empty()) stst << (RefPosFlat ? " --RxFlat" : " --RxRinex"); if(doRAIM) stst << " --RAIM"; if(RefPosInput) stst << " --RxHere"; stst << endl; logof << stst.str(); cerr << stst.str(); return -1; // fail? or take default } else if(help) logof << "Position input ok\n"; } // print config to log if(Verbose) { logof << "-------- Here is the program configuration:\n"; logof << "Input Rinex observation file name is: " << REC.InputFileName() << endl; logof << "Input Directory is " << REC.InputDirectory() << endl; logof << "Output Rinex obs file name is: " << REC.OutputFileName() << endl; logof << "Output Directory is " << REC.OutputDirectory() << endl; if(REC.BeginTimeLimit() > DayTime::BEGINNING_OF_TIME) logof << "Begin time limit is " << REC.BeginTimeLimit() << endl; if(REC.EndTimeLimit() < DayTime::END_OF_TIME) logof << "End time limit is " << REC.EndTimeLimit() << endl; if(REC.Decimation() != 0) logof << "Decmimation time interval is " << setprecision(2) << REC.Decimation() << " seconds." << endl; logof << "Tolerance in time-comparisions is " << setprecision(8) << REC.Tolerance() << " seconds." << endl; logof << "Log file name is " << LogFile << " (this file)" << endl; if(SVonly.id > 0) logof << "Process only satellite : " << SVonly << endl; if(!NavDir.empty()) logof << "Nav Directory is " << NavDir << endl; if(NavFiles.size()) { logof << "Nav files:"; for(i=0; i<NavFiles.size(); i++) logof << " " << NavFiles[i]; logof << endl; } if(KnownPosInput) logof << "Get reference position from explicit input (" << (KnownLLH ? "LLH" : "XYZ") << ") : " << KnownPos << endl; if(doRAIM) logof << "Compute a RAIM solution" << endl; if(minElev > 0.0) logof << "Minimum elevation angle limit " << fixed << setprecision(2) << minElev << " degrees." << endl; if(RefPosInput) logof << "Get reference position from in-line headers in " << "the input Rinex file" << endl; if(!RefPosFile.empty()) logof << "Get reference position from a " << (RefPosFlat ? "flat" : "Rinex") << " file: " << RefPosFile << endl; if(!editRAIM) logof << "Do not "; logof << "Edit data based on RAIM solution" << endl; if(!outRef) logof << "Do not "; logof << "Output Reference solution to Rinex" << endl; if(!headRAIM) logof << "Do not "; logof << "Output average RAIM solution to header" << endl; if(Callow) logof << "Allow C1 to be P1 when P1 not available\n"; if(Cforce) logof << "Force C1 to replace P1 when C1 available\n"; logof << "Ionosphere height is " << IonoHt << " km" << endl; if(AllBiases.size()) { logof << "The list of de-biasing limits is:\n"; map<RinexObsHeader::RinexObsType,map<RinexSatID,double> >::iterator it; for(it=AllBiases.begin(); it!=AllBiases.end(); it++) { map<RinexSatID,double>::iterator jt; for(jt=it->second.begin(); jt!=it->second.end(); jt++) { logof << " Bias limit(" << RinexObsHeader::convertObsType(it->first) << ") = " << fixed << setprecision(3) << jt->second << endl; } } } logof << "-------- End of the program configuration.\n"; logof << endl; } if(help) return 1; return 0;}catch(Exception& e) { GPSTK_RETHROW(e); }catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); }catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); } return -1;}//------------------------------------------------------------------------------------// Initialize, read ephemerides, set flags and prepare for processingint PrepareInput(void) throw(Exception){try { int iret,i; // set all input/output indexes to 'undefined' inC1 = inP1 = inP2 = inL1 = inL2 = inEP = inPS = inD1 = inD2 = inS1 = inS2 = -1; otC1 = otP1 = otP2 = otL1 = otL2 = otD1 = otD2 = otS1 = otS2 = -1; // -------------------------------------------------------------------- // ephemeris // add Nav directory to nav file names if(!NavDir.empty() && NavFiles.size()>0) { for(i=0; i<NavFiles.size(); i++) NavFiles[i] = NavDir + string("/") + NavFiles[i]; } // open nav files and read EphemerisStore -- set inEP and inPS iret = FillEphemerisStore(NavFiles, SP3EphList, BCEphList); if(SP3EphList.size()) { if(Verbose) SP3EphList.dump(1,logof); inEP = 1; } else if(Verbose) logof << "SP3 Ephemeris list is empty\n"; if(BCEphList.size()) { BCEphList.SearchNear(); if(Verbose) BCEphList.dump(0,logof); inEP = 1; } else if(Verbose) logof << "BC Ephemeris list is empty\n"; // -------------------------------------------------------------------- // position: // if KnownPosInput, position is input // if !RefPosFile.empty(), open file // if RefPosInput, use the aux headers in input file // if(doRAIM) set up RAIMsolution - including input of RMS, etc? if(KnownPosInput) { // parse the string to get position vector<string> subfield; string::size_type pos; while(KnownPos.size() > 0) { pos = KnownPos.find(","); if(pos==string::npos) pos=KnownPos.size(); if(pos==0) subfield.push_back(" "); else subfield.push_back(KnownPos.substr(0,pos)); if(pos >= KnownPos.size()) break; KnownPos.erase(0,pos+1); }; CurrRef.valid = true; CurrRef.clk = 0; CurrRef.NPRN = 0; CurrRef.PDOP = 0; CurrRef.GDOP = 0; CurrRef.RMS = 0; if(KnownLLH) { CurrRef.RxPos.setGeodetic(asDouble(subfield[0]), asDouble(subfield[1]), asDouble(subfield[2])); CurrRef.RxPos.transformTo(Position::Cartesian); } else { CurrRef.RxPos.setECEF(asDouble(subfield[0]), asDouble(subfield[1]), asDouble(subfield[2])); } // output logof << "Reference position comes from explicit input of " << "position components:\n"; logof << " " << subfield[0] << " " << subfield[1] << " " << subfield[2] << endl; logof << " =" << fixed << " " << setw(13) << setprecision(3) << CurrRef.RxPos.X() << " " << setw(13) << setprecision(3) << CurrRef.RxPos.Y() << " " << setw(13) << setprecision(3) << CurrRef.RxPos.Z() << endl; logof << " = " << fixed << setw(12) << setprecision(8) << CurrRef.RxPos.geodeticLatitude() << "N " << setw(12) << setprecision(8) << CurrRef.RxPos.longitude() << "E " << setw(9) << setprecision(3) << CurrRef.RxPos.height() << "m" << endl; inPS = 1; } else if(!RefPosFile.empty()) { DayTime timetag; //logof << "Reference position from a file (" << RefPosFile << ")\n"; // make sure it exists first ifstream inf(RefPosFile.c_str()); if(!inf) { logof << "Error: could not open positions file " << RefPosFile << endl; oferr << "Error: could not open positions file " << RefPosFile << endl; return -1; } // fill the map<DayTime,RefPosData> RefPosMap; RefPosMap.clear(); if(isRinexObsFile(RefPosFile)) { if(Verbose) { logof << "Reference position will come from input Rinex obs file " << RefPosFile << endl; if(RefPosFlat) logof << " WARNING -- Reference position file is Rinex, not flat!\n"; } inf.close(); RinexObsHeader header; RinexObsData robs; RinexObsStream rostream(RefPosFile.c_str()); rostream.exceptions(fstream::failbit); rostream >> header; //timetag = header.firstObs; while(rostream >> robs) { if(robs.epochFlag == 4) { // TD: check this; often the in-line header has a bad epoch // But if it has XYZT and DIAG, then GPSTk probably wrote it.... timetag = robs.time; CurrRef.NPRN = 0; CurrRef.valid = true; CurrRef.clk = CurrRef.PDOP = CurrRef.GDOP = CurrRef.RMS = 0.0; for(i=0; i<robs.auxHeader.commentList.size(); i++) { string s=robs.auxHeader.commentList[i]; string t=stripFirstWord(s); if(t == string("XYZT")) { double x=asDouble(stripFirstWord(s)); double y=asDouble(stripFirstWord(s)); double z=asDouble(stripFirstWord(s)); CurrRef.RxPos.setECEF(x,y,z); CurrRef.clk = asDouble(stripFirstWord(s)); } else if(t==string("DIAG")) { CurrRef.NPRN = asInt(stripFirstWord(s)); CurrRef.PDOP = asDouble(stripFirstWord(s)); CurrRef.GDOP = asDouble(stripFirstWord(s)); CurrRef.RMS = asDouble(stripFirstWord(s)); } } RefPosMap[timetag] = CurrRef; } } rostream.close(); inPS = 1; } else { // flat file input if(Verbose) { logof << "Reference position will come from input flat file " << RefPosFile << endl; if(!RefPosFlat) logof << " WARNING -- Reference position file is flat, not Rinex!\n"; } bool ok,have=false,havefmt=false,havepat=false; string line,format,pattern,lineT,lineP,word,fword,fmtT,fmtP; Position pos; CurrRef.NPRN = 0; CurrRef.clk = CurrRef.PDOP = CurrRef.GDOP = CurrRef.RMS = 0.0; while(!inf.eof() && inf.good()) { ok = true; while(line.size() > 0) { if(Debug) logof << "echo: " << line << endl; if(line[0] == '#') break; // skip comments if(!have) { if(!havefmt) { format = line; havefmt = true; if(Debug) logof << "Format is " << format << endl; } else if(!havepat) { pattern = line; havepat = true; if(Debug) logof << "Pattern is " << pattern << endl; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -