diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index 0f5418d0c..e4ef3dde5 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -16,6 +16,8 @@ # along with GNSS-SDR. If not, see . # +add_definitions( -DGNSS_SDR_VERSION="${VERSION}" ) + set(PVT_LIB_SOURCES gps_l1_ca_ls_pvt.cc galileo_e1_ls_pvt.cc diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 0fe257f0c..6a83c8875 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -393,6 +393,15 @@ void Rinex_Printer::rinex_nav_header(std::ofstream& out, Galileo_Iono iono, Gali Rinex_Printer::lengthCheck(line); out << line << std::endl; + // -------- Line COMMENT + line.clear(); + std::string gnss_sdr_version(GNSS_SDR_VERSION); + line += "GNSS-SDR VERSION "; + line += Rinex_Printer::leftJustify(gnss_sdr_version, 43); + line += Rinex_Printer::leftJustify("COMMENT", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + // -------- Line COMMENT line.clear(); line += Rinex_Printer::leftJustify("See http://gnss-sdr.org", 60); @@ -444,10 +453,10 @@ void Rinex_Printer::rinex_nav_header(std::ofstream& out, Galileo_Iono iono, Gali // -------- Line 6 leap seconds // For leap second information, see http://www.endruntechnologies.com/leap.htm line.clear(); - line += Rinex_Printer::rightJustify(boost::lexical_cast(utc_model.Delta_tLS_6), 6); - line += Rinex_Printer::rightJustify(boost::lexical_cast(utc_model.Delta_tLSF_6), 6); - line += Rinex_Printer::rightJustify(boost::lexical_cast(utc_model.WN_LSF_6), 6); - line += Rinex_Printer::rightJustify(boost::lexical_cast(utc_model.DN_6), 6); + line += Rinex_Printer::rightJustify(boost::lexical_cast(static_cast(utc_model.Delta_tLS_6)), 6); + line += Rinex_Printer::rightJustify(boost::lexical_cast(static_cast(utc_model.Delta_tLSF_6)), 6); + line += Rinex_Printer::rightJustify(boost::lexical_cast(static_cast(utc_model.WN_LSF_6)), 6); + line += Rinex_Printer::rightJustify(boost::lexical_cast(static_cast(utc_model.DN_6)), 6); line += std::string(36, ' '); line += Rinex_Printer::leftJustify("LEAP SECONDS", 20); Rinex_Printer::lengthCheck(line); @@ -507,6 +516,15 @@ void Rinex_Printer::rinex_nav_header(std::ofstream& out, Gps_Iono iono, Gps_Utc_ Rinex_Printer::lengthCheck(line); out << line << std::endl; + // -------- Line COMMENT + line.clear(); + std::string gnss_sdr_version(GNSS_SDR_VERSION); + line += "GNSS-SDR VERSION "; + line += Rinex_Printer::leftJustify(gnss_sdr_version, 43); + line += Rinex_Printer::leftJustify("COMMENT", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + // -------- Line COMMENT line.clear(); line += Rinex_Printer::leftJustify("See http://gnss-sdr.org", 60); @@ -704,6 +722,15 @@ void Rinex_Printer::rinex_sbs_header(std::ofstream& out) Rinex_Printer::lengthCheck(line); out << line << std::endl; + // -------- Line COMMENT + line.clear(); + std::string gnss_sdr_version(GNSS_SDR_VERSION); + line += "GNSS-SDR VERSION "; + line += Rinex_Printer::leftJustify(gnss_sdr_version, 43); + line += Rinex_Printer::leftJustify("COMMENT", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + // -------- Line COMMENT 2 line.clear(); line += Rinex_Printer::leftJustify("See http://gnss-sdr.org", 60); @@ -1216,6 +1243,15 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Ephemeris eph, doub Rinex_Printer::lengthCheck(line); out << line << std::endl; + // -------- Line COMMENT + line.clear(); + std::string gnss_sdr_version(GNSS_SDR_VERSION); + line += "GNSS-SDR VERSION "; + line += Rinex_Printer::leftJustify(gnss_sdr_version, 43); + line += Rinex_Printer::leftJustify("COMMENT", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + // -------- Line COMMENT line.clear(); line += Rinex_Printer::leftJustify("See http://gnss-sdr.org", 60); @@ -1252,7 +1288,8 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Ephemeris eph, doub line += Rinex_Printer::leftJustify("GNSS-SDR", 20); // add flag and property line += Rinex_Printer::leftJustify("Software Receiver", 20); // add flag and property //line += Rinex_Printer::leftJustify(google::VersionString(), 20); // add flag and property - line += Rinex_Printer::leftJustify("0.1", 20); + if(gnss_sdr_version.length() > 20) gnss_sdr_version.resize(9, ' '); + line += Rinex_Printer::leftJustify(gnss_sdr_version, 20); line += Rinex_Printer::leftJustify("REC # / TYPE / VERS", 20); lengthCheck(line); out << line << std::endl; @@ -1453,6 +1490,15 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Galileo_Ephemeris eph, Rinex_Printer::lengthCheck(line); out << line << std::endl; + // -------- Line COMMENT + line.clear(); + std::string gnss_sdr_version(GNSS_SDR_VERSION); + line += "GNSS-SDR VERSION "; + line += Rinex_Printer::leftJustify(gnss_sdr_version, 43); + line += Rinex_Printer::leftJustify("COMMENT", 20); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + // -------- Line COMMENT line.clear(); line += Rinex_Printer::leftJustify("See http://gnss-sdr.org", 60); @@ -1489,7 +1535,8 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Galileo_Ephemeris eph, line += Rinex_Printer::leftJustify("GNSS-SDR", 20); // add flag and property line += Rinex_Printer::leftJustify("Software Receiver", 20); // add flag and property //line += Rinex_Printer::leftJustify(google::VersionString(), 20); // add flag and property - line += Rinex_Printer::leftJustify("0.0.4", 20); + if(gnss_sdr_version.length() > 20) gnss_sdr_version.resize(9, ' '); + line += Rinex_Printer::leftJustify(gnss_sdr_version, 20); line += Rinex_Printer::leftJustify("REC # / TYPE / VERS", 20); lengthCheck(line); out << line << std::endl; @@ -1796,7 +1843,8 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Ephemeris eph, double void Rinex_Printer::log_rinex_obs(std::ofstream& out, Galileo_Ephemeris eph, double obs_time, std::map pseudoranges) { - // RINEX observations timestamps are Galileo timestamps. + // RINEX observations timestamps are Galileo timestamps. + // See http://gage14.upc.es/gLAB/HTML/Observation_Rinex_v3.01.html std::string line; @@ -1811,83 +1859,82 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Galileo_Ephemeris eph, dou std::string hour (timestring, 9, 2); std::string minutes (timestring, 11, 2); - - std::string year (timestring, 0, 4); - line += std::string(1, '>'); - line += std::string(1, ' '); - line += year; - line += std::string(1, ' '); - line += month; - line += std::string(1, ' '); - line += day; - line += std::string(1, ' '); - line += hour; - line += std::string(1, ' '); - line += minutes; - line += std::string(1, ' '); - double seconds=fmod(galileo_t, 60); - // Add extra 0 if seconds are < 10 - if (seconds<10) - { - line +=std::string(1, '0'); - } - line += Rinex_Printer::asString(seconds, 7); - line += std::string(2, ' '); - // Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event - line += std::string(1, '0'); + std::string year (timestring, 0, 4); + line += std::string(1, '>'); + line += std::string(1, ' '); + line += year; + line += std::string(1, ' '); + line += month; + line += std::string(1, ' '); + line += day; + line += std::string(1, ' '); + line += hour; + line += std::string(1, ' '); + line += minutes; - //Number of satellites observed in current epoch - int numSatellitesObserved = 0; - std::map::iterator pseudoranges_iter; - for(pseudoranges_iter = pseudoranges.begin(); - pseudoranges_iter != pseudoranges.end(); - pseudoranges_iter++) + line += std::string(1, ' '); + double seconds = fmod(galileo_t, 60); + // Add extra 0 if seconds are < 10 + if (seconds < 10) + { + line +=std::string(1, '0'); + } + line += Rinex_Printer::asString(seconds, 7); + line += std::string(2, ' '); + // Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event + line += std::string(1, '0'); + + //Number of satellites observed in current epoch + int numSatellitesObserved = 0; + std::map::iterator pseudoranges_iter; + for(pseudoranges_iter = pseudoranges.begin(); + pseudoranges_iter != pseudoranges.end(); + pseudoranges_iter++) + { + numSatellitesObserved++; + } + line += Rinex_Printer::rightJustify(boost::lexical_cast(numSatellitesObserved), 3); + + + // Receiver clock offset (optional) + //line += rightJustify(asString(clockOffset, 12), 15); + + line += std::string(80 - line.size(), ' '); + Rinex_Printer::lengthCheck(line); + out << line << std::endl; + + for(pseudoranges_iter = pseudoranges.begin(); + pseudoranges_iter != pseudoranges.end(); + pseudoranges_iter++) + { + std::string lineObs; + lineObs.clear(); + lineObs += satelliteSystem["Galileo"]; + if ((int)pseudoranges_iter->first < 10) lineObs += std::string(1, '0'); + lineObs += boost::lexical_cast((int)pseudoranges_iter->first); + //lineObs += std::string(2, ' '); + lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Pseudorange_m, 3), 14); + + //Loss of lock indicator (LLI) + int lli = 0; // Include in the observation!! + if (lli == 0) { - numSatellitesObserved++; + lineObs += std::string(1, ' '); } - line += Rinex_Printer::rightJustify(boost::lexical_cast(numSatellitesObserved), 3); - - - // Receiver clock offset (optional) - //line += rightJustify(asString(clockOffset, 12), 15); - - line += std::string(80 - line.size(), ' '); - Rinex_Printer::lengthCheck(line); - out << line << std::endl; - - for(pseudoranges_iter = pseudoranges.begin(); - pseudoranges_iter != pseudoranges.end(); - pseudoranges_iter++) + else { - std::string lineObs; - lineObs.clear(); - lineObs += satelliteSystem["Galileo"]; - if ((int)pseudoranges_iter->first < 10) lineObs += std::string(1, '0'); - lineObs += boost::lexical_cast((int)pseudoranges_iter->first); - //lineObs += std::string(2, ' '); - lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Pseudorange_m, 3), 14); - - //Loss of lock indicator (LLI) - int lli = 0; // Include in the observation!! - if (lli == 0) - { - lineObs += std::string(1, ' '); - } - else - { - lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString(lli), 1); - } - // Galileo E1B PHASE - lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Carrier_phase_rads/(2*GALILEO_PI), 3), 14); - // Galileo E1B DOPPLER - lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Carrier_Doppler_hz, 3), 14); - // Galileo E1B SIGNAL STRENGTH - lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.CN0_dB_hz, 3), 14); - if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' '); - out << lineObs << std::endl; + lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString(lli), 1); } - // } + // Galileo E1B PHASE + lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Carrier_phase_rads / (2 * GALILEO_PI), 3), 14); + // Galileo E1B DOPPLER + lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.Carrier_Doppler_hz, 3), 14); + // Galileo E1B SIGNAL STRENGTH + lineObs += Rinex_Printer::rightJustify(asString(pseudoranges_iter->second.CN0_dB_hz, 3), 14); + if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' '); + out << lineObs << std::endl; + } }