diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 8b1a37eb1..9d52df333 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -438,8 +438,8 @@ void Rinex_Printer::rinex_nav_header(std::ofstream& out, Galileo_Iono iono, Gal line += std::string("GPGA"); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_0G_10, 16, 2), 18); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_1G_10, 15, 2), 16); - line += Rinex_Printer::rightJustify(boost::lexical_cast(utc_model.t0t_6), 7); - line += Rinex_Printer::rightJustify(boost::lexical_cast(utc_model.WNot_6), 5); + line += Rinex_Printer::rightJustify(boost::lexical_cast(galileo_almanac.t_0G_10), 7); + line += Rinex_Printer::rightJustify(boost::lexical_cast(galileo_almanac.WN_0G_10), 5); line += std::string(10, ' '); line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); Rinex_Printer::lengthCheck(line); @@ -1147,12 +1147,17 @@ void Rinex_Printer::log_rinex_nav(std::ofstream& out, std::mapsecond.iDot_2, 18, 2); line += std::string(1, ' '); - double zero = 0.0; - line += Rinex_Printer::doub2for(zero, 18, 2); + //double one = 1.0; // INAV E1-B + std::string iNAVE1B("1000000001"); + int data_source_INAV = Rinex_Printer::toInt(iNAVE1B, 10); + line += Rinex_Printer::doub2for(static_cast(data_source_INAV), 18, 2); line += std::string(1, ' '); - double Galileo_week_continuous_number = (double)(galileo_ephemeris_iter->second.WN_5); + double GST_week = (double)(galileo_ephemeris_iter->second.WN_5); + double num_GST_rollovers = floor((GST_week + 1024.0) / 4096.0 ); + double Galileo_week_continuous_number = GST_week + 1024.0 + num_GST_rollovers * 4096.0; line += Rinex_Printer::doub2for(Galileo_week_continuous_number, 18, 2); line += std::string(1, ' '); + double zero = 0.0; line += Rinex_Printer::doub2for(zero, 18, 2); Rinex_Printer::lengthCheck(line); out << line << std::endl; @@ -1161,13 +1166,29 @@ void Rinex_Printer::log_rinex_nav(std::ofstream& out, std::mapsecond.SISA_3, 18, 2); // Not read by eph! + //double minusone = -1.0; // Unknown + //line += Rinex_Printer::doub2for(minusone, 18, 2); line += std::string(1, ' '); - line += Rinex_Printer::doub2for(zero, 18, 2); // + std::string E1B_HS, E5B_HS; + if (galileo_ephemeris_iter->second.E1B_HS_5 == 0) E1B_HS = "00"; + if (galileo_ephemeris_iter->second.E1B_HS_5 == 1) E1B_HS = "01"; + if (galileo_ephemeris_iter->second.E1B_HS_5 == 2) E1B_HS = "10"; + if (galileo_ephemeris_iter->second.E1B_HS_5 == 3) E1B_HS = "11"; + if (galileo_ephemeris_iter->second.E5b_HS_5 == 0) E5B_HS = "00"; + if (galileo_ephemeris_iter->second.E5b_HS_5 == 1) E5B_HS = "01"; + if (galileo_ephemeris_iter->second.E5b_HS_5 == 2) E5B_HS = "10"; + if (galileo_ephemeris_iter->second.E5b_HS_5 == 3) E5B_HS = "11"; + std::string SVhealth_str = boost::lexical_cast(galileo_ephemeris_iter->second.E1B_DVS_5) + + E1B_HS + boost::lexical_cast(galileo_ephemeris_iter->second.E1B_DVS_5) + + "1" + "11" + boost::lexical_cast(galileo_ephemeris_iter->second.E5b_DVS_5) + + E5B_HS; + int SVhealth = Rinex_Printer::toInt(SVhealth_str, 9); + line += Rinex_Printer::doub2for(static_cast(SVhealth), 18, 2); // line += std::string(1, ' '); - line += Rinex_Printer::doub2for(zero, 18, 2); // + line += Rinex_Printer::doub2for(galileo_ephemeris_iter->second.BGD_E1E5a_5, 18, 2); // line += std::string(1, ' '); - line += Rinex_Printer::doub2for(zero, 18, 2); // + line += Rinex_Printer::doub2for(galileo_ephemeris_iter->second.BGD_E1E5b_5, 18, 2); // Rinex_Printer::lengthCheck(line); out << line << std::endl; @@ -1360,7 +1381,7 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Ephemeris eph, doub line += std::string(1, ' '); line += observationType["DOPPLER"]; line += observationCode["GPS_L1_CA"]; - // GPS L! CA SIGNAL STRENGTH + // GPS L1 CA SIGNAL STRENGTH line += std::string(1, ' '); line += observationType["SIGNAL_STRENGTH"]; line += observationCode["GPS_L1_CA"]; @@ -2115,9 +2136,8 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(Gps_Ephemeris eph, doub boost::posix_time::ptime Rinex_Printer::compute_Galileo_time(Galileo_Ephemeris eph, double obs_time) { - // The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here. - // (see Section 3 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex211.txt) - // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf) + // The RINEX v2.11 v3.00 format uses Galileo time for the observations epoch, not UTC time, thus, no leap seconds needed here. + // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf) // --??? No time correction here, since it will be done in the RINEX processor double galileo_t = obs_time; boost::posix_time::time_duration t = boost::posix_time::millisec((galileo_t + 604800*(double)(eph.WN_5))*1000); // diff --git a/src/algorithms/PVT/libs/rinex_printer.h b/src/algorithms/PVT/libs/rinex_printer.h index 94fc616bb..ca5c1ec7f 100644 --- a/src/algorithms/PVT/libs/rinex_printer.h +++ b/src/algorithms/PVT/libs/rinex_printer.h @@ -333,6 +333,9 @@ private: inline double asDouble(const std::string& s) { return strtod(s.c_str(), 0); } + + inline int toInt(std::string bitString, int sLength); + /* * Convert a string to an integer. * @param s string containing a number. @@ -342,7 +345,6 @@ private: { return strtol(s.c_str(), 0, 10); } - /* * Convert a double to a string in fixed notation. * @param x double. @@ -580,6 +582,22 @@ inline std::string Rinex_Printer::asFixWidthString(const int x, const int width, return ss.str().substr(ss.str().size() - width); } +inline long asInt(const std::string& s) + { return strtol(s.c_str(), 0, 10); } + + +inline int Rinex_Printer::toInt(std::string bitString, int sLength) +{ + int tempInt; + int num = 0; + for(int i=0; i < sLength; i++) + { + tempInt = bitString[i]-'0'; + num |= (1 << (sLength-1-i)) * tempInt; + } + return num; +} + template inline std::string Rinex_Printer::asString(const X x) diff --git a/src/core/system_parameters/galileo_ephemeris.cc b/src/core/system_parameters/galileo_ephemeris.cc index 1fa53edbc..5b9be9681 100644 --- a/src/core/system_parameters/galileo_ephemeris.cc +++ b/src/core/system_parameters/galileo_ephemeris.cc @@ -61,6 +61,14 @@ Galileo_Ephemeris::Galileo_Ephemeris() /*GST*/ WN_5 = 0; TOW_5 = 0; + // SV status + SISA_3 = 0; + E5b_HS_5 = 0; + E1B_HS_5 = 0; + E5b_DVS_5 = 0; + E1B_DVS_5 = 0; + BGD_E1E5a_5 = 0; //!< E1-E5a Broadcast Group Delay [s] + BGD_E1E5b_5 = 0; //!< E1-E5b Broadcast Group Delay [s] } diff --git a/src/core/system_parameters/galileo_ephemeris.h b/src/core/system_parameters/galileo_ephemeris.h index 62d3c032b..64d2f12d4 100644 --- a/src/core/system_parameters/galileo_ephemeris.h +++ b/src/core/system_parameters/galileo_ephemeris.h @@ -83,6 +83,16 @@ public: double Galileo_satClkDrift; double Galileo_dtr; //!< relativistic clock correction term + // SV status + double SISA_3; + double E5b_HS_5; //!< E5b Signal Health Status + double E1B_HS_5; //!< E1B Signal Health Status + double E5b_DVS_5; //!< E5b Data Validity Status + double E1B_DVS_5; //!< E1B Data Validity Status + + double BGD_E1E5a_5; //!< E1-E5a Broadcast Group Delay [s] + double BGD_E1E5b_5; //!< E1-E5b Broadcast Group Delay [s] + // satellite positions double d_satpos_X; //!< Earth-fixed coordinate x of the satellite [m]. Intersection of the IERS Reference Meridian (IRM) and the plane passing through the origin and normal to the Z-axis. double d_satpos_Y; //!< Earth-fixed coordinate y of the satellite [m]. Completes a right-handed, Earth-Centered, Earth-Fixed orthogonal coordinate system. diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index b9d014924..3e703fbc8 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -545,6 +545,16 @@ Galileo_Ephemeris Galileo_Navigation_Message::get_ephemeris() /*GST*/ ephemeris.WN_5 = WN_5; // Week number ephemeris.TOW_5 = TOW_5; // Time of Week + + ephemeris.SISA_3 = SISA_3; + ephemeris.E5b_HS_5 = E5b_HS_5; // E5b Signal Health Status + ephemeris.E1B_HS_5 = E1B_HS_5; // E1B Signal Health Status + ephemeris.E5b_DVS_5 = E5b_DVS_5; // E5b Data Validity Status + ephemeris.E1B_DVS_5 = E1B_DVS_5; // E1B Data Validity Status + + ephemeris.BGD_E1E5a_5 = BGD_E1E5a_5; // E1-E5a Broadcast Group Delay [s] + ephemeris.BGD_E1E5b_5 = BGD_E1E5b_5; // E1-E5b Broadcast Group Delay [s] + return ephemeris; }