From 91e83dfa1a9b79d07e5303a81a73f8b2a558f8be Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Thu, 23 May 2013 17:05:06 +0000 Subject: [PATCH] Fixed the bug BG03 (problems in the RINEX 2.11 generator) git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@358 64b25241-fba3-4117-9849-534c7e92360d --- src/algorithms/PVT/libs/rinex_printer.cc | 104 ++++++++++++++++------- 1 file changed, 75 insertions(+), 29 deletions(-) diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index f43925758..f2fbf29c5 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -65,6 +65,7 @@ Rinex_Printer::Rinex_Printer() Rinex_Printer::navFile.open(navfilename, std::ios::out | std::ios::app); Rinex_Printer::obsFile.open(obsfilename, std::ios::out | std::ios::app); + // RINEX v3.00 codes satelliteSystem["GPS"] = "G"; satelliteSystem["GLONASS"] = "R"; satelliteSystem["SBAS payload"] = "S"; @@ -132,6 +133,15 @@ Rinex_Printer::Rinex_Printer() observationType["DOPPLER"] = "D"; observationType["SIGNAL_STRENGTH"] = "S"; + // RINEX v2.10 and v2.11 codes + observationType["PSEUDORANGE_CA_v2"] = "C"; + observationType["PSEUDORANGE_P_v2"] = "P"; + observationType["DOPPLER_v2"] = "D"; + observationType["SIGNAL_STRENGTH_v2"] = "S"; + observationCode["GPS_L1_CA_v2"] = "1"; + + + if ( FLAGS_RINEX_version.compare("3.01") == 0 ) { version = 3; @@ -936,36 +946,73 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Ephemeris eph, doub Rinex_Printer::lengthCheck(line); out << line << std::endl; - // -------- SYS / OBS TYPES + if (version==2) + { + // --------- WAVELENGHT FACTOR + // put here real data! + line.clear(); + line +=Rinex_Printer::rightJustify("1",6); + line +=Rinex_Printer::rightJustify("1",6); + line += std::string(48, ' '); + line += Rinex_Printer::leftJustify("WAVELENGTH FACT L1/2", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } - // one line per available system - line.clear(); - line += satelliteSystem["GPS"]; - line += std::string(2, ' '); - //int numberTypesObservations=2; // Count the number of available types of observable in the system - std::stringstream strm; - strm << numberTypesObservations; - line += Rinex_Printer::rightJustify(strm.str(), 3); - // per type of observation - line += std::string(1, ' '); - line += observationType["PSEUDORANGE"]; - line += observationCode["GPS_L1_CA"]; - line += std::string(1, ' '); - line += observationType["SIGNAL_STRENGTH"]; - line += observationCode["GPS_L1_CA"]; + if (version==3) + { + // -------- SYS / OBS TYPES + // one line per available system + line.clear(); + line += satelliteSystem["GPS"]; + line += std::string(2, ' '); + //int numberTypesObservations=2; // Count the number of available types of observable in the system + std::stringstream strm; + strm << numberTypesObservations; + line += Rinex_Printer::rightJustify(strm.str(), 3); + // per type of observation + line += std::string(1, ' '); + line += observationType["PSEUDORANGE"]; + line += observationCode["GPS_L1_CA"]; + line += std::string(1, ' '); + line += observationType["SIGNAL_STRENGTH"]; + line += observationCode["GPS_L1_CA"]; - line += std::string(60-line.size(), ' '); - line += Rinex_Printer::leftJustify("SYS / # / OBS TYPES", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + line += std::string(60-line.size(), ' '); + line += Rinex_Printer::leftJustify("SYS / # / OBS TYPES", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } - // -------- Signal Strength units - line.clear(); - line += Rinex_Printer::leftJustify("DBHZ", 20); - line += std::string(40, ' '); - line += Rinex_Printer::leftJustify("SIGNAL STRENGTH UNIT", 20); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; + if (version==2) + { + // -------- SYS / OBS TYPES + line.clear(); + std::stringstream strm; + strm << numberTypesObservations; + line += Rinex_Printer::rightJustify(strm.str(), 6); + // per type of observation + line += Rinex_Printer::rightJustify(observationType["PSEUDORANGE_CA_v2"], 5); + line += observationCode["GPS_L1_CA_v2"]; + line += std::string(1, ' '); + line += observationType["SIGNAL_STRENGTH_v2"]; + line += observationCode["GPS_L1_CA_v2"]; + line += std::string(60-line.size(), ' '); + line += Rinex_Printer::leftJustify("# / TYPES OF OBSERV", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } + + if (version==3) + { + // -------- Signal Strength units + line.clear(); + line += Rinex_Printer::leftJustify("DBHZ", 20); + line += std::string(40, ' '); + line += Rinex_Printer::leftJustify("SIGNAL STRENGTH UNIT", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + } // -------- TIME OF FIRST OBS line.clear(); @@ -1054,7 +1101,6 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Ephemeris eph, double line += std::string(2, ' '); // Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event line += std::string(1, '0'); - line += std::string(2, ' '); //Number of satellites observed in current epoch int numSatellitesObserved = 0; std::map::iterator pseudoranges_iter; @@ -1064,7 +1110,7 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Ephemeris eph, double { numSatellitesObserved++; } - line += Rinex_Printer::rightJustify(boost::lexical_cast(numSatellitesObserved), 3); + line += Rinex_Printer::rightJustify(boost::lexical_cast(numSatellitesObserved), 2); for(pseudoranges_iter = pseudoranges.begin(); pseudoranges_iter != pseudoranges.end(); pseudoranges_iter++)