1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-17 04:33:03 +00:00

Fixes CNAV message files

This commit is contained in:
Carles Fernandez 2016-10-29 12:41:51 +02:00
parent 25a57d5b88
commit 5e24e3d486
2 changed files with 167 additions and 196 deletions

View File

@ -601,7 +601,6 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& gal
} }
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Utc_Model& utc_model, const Gps_Iono& iono) void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Utc_Model& utc_model, const Gps_Iono& iono)
{ {
std::vector<std::string> data; std::vector<std::string> data;
@ -752,6 +751,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Utc_Model& ut
std::cout << "The RINEX Navigation file header has been updated with UTC and IONO info." << std::endl; std::cout << "The RINEX Navigation file header has been updated with UTC and IONO info." << std::endl;
} }
void Rinex_Printer::update_nav_header(std::fstream & out, const Gps_CNAV_Utc_Model & utc_model, const Gps_CNAV_Iono & iono ) void Rinex_Printer::update_nav_header(std::fstream & out, const Gps_CNAV_Utc_Model & utc_model, const Gps_CNAV_Iono & iono )
{ {
std::vector<std::string> data; std::vector<std::string> data;
@ -772,8 +772,6 @@ void Rinex_Printer::update_nav_header(std::fstream & out, const Gps_CNAV_Utc_Mod
{ {
line_aux.clear(); line_aux.clear();
if (version == 3)
{
if (line_str.find("GPSA", 0) != std::string::npos) if (line_str.find("GPSA", 0) != std::string::npos)
{ {
line_aux += std::string("GPSA"); line_aux += std::string("GPSA");
@ -829,7 +827,6 @@ void Rinex_Printer::update_nav_header(std::fstream & out, const Gps_CNAV_Utc_Mod
data.push_back(line_str); data.push_back(line_str);
} }
} }
}
else else
{ {
data.push_back(line_str); data.push_back(line_str);
@ -849,6 +846,7 @@ void Rinex_Printer::update_nav_header(std::fstream & out, const Gps_CNAV_Utc_Mod
std::cout << "The RINEX Navigation file header has been updated with UTC and IONO info." << std::endl; std::cout << "The RINEX Navigation file header has been updated with UTC and IONO info." << std::endl;
} }
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono & iono, const Gps_CNAV_Utc_Model & utc_model) void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono & iono, const Gps_CNAV_Utc_Model & utc_model)
{ {
std::string line; std::string line;
@ -1849,7 +1847,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_Ephe
} }
} }
/*
void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_CNAV_Ephemeris>& eph_map) void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_CNAV_Ephemeris>& eph_map)
{ {
std::string line; std::string line;
@ -1896,15 +1894,9 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_CNAV
// -------- BROADCAST ORBIT - 1 // -------- BROADCAST ORBIT - 1
line.clear(); line.clear();
line += std::string(5, ' '); line += std::string(5, ' ');
// If there is a discontinued reception the ephemeris is not validated // If there is no IODE in CNAV, so we set it to zero
if (gps_ephemeris_iter->second.d_IODE_SF2 == gps_ephemeris_iter->second.d_IODE_SF3) double my_zero = 0.0;
{ line += Rinex_Printer::doub2for(my_zero, 18, 2);
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_IODE_SF2, 18, 2);
}
else
{
LOG(WARNING) << "Discontinued reception of Frame 2 and 3";
}
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_Crs, 18, 2); line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_Crs, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
@ -1934,7 +1926,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_CNAV
// -------- BROADCAST ORBIT - 3 // -------- BROADCAST ORBIT - 3
line.clear(); line.clear();
line += std::string(5, ' '); line += std::string(5, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_Toe, 18, 2); line += Rinex_Printer::doub2for(std::max(gps_ephemeris_iter->second.d_Toe1, gps_ephemeris_iter->second.d_Toe2), 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_Cic, 18, 2); line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_Cic, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
@ -1954,25 +1946,25 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_CNAV
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_OMEGA, 18, 2); line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_OMEGA, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
const double OMEGA_DOT_REF = -2.6 * 10^(-9); // semicircles / s, see IS-GPS-200H pp. 164 const double OMEGA_DOT_REF = -2.6e-9; // semicircles / s, see IS-GPS-200H pp. 164
double OMEGA_DOT = OMEGA_DOT_REF + gps_ephemeris_iter->second.d_DELTA_OMEGA_DOT; double OMEGA_DOT = OMEGA_DOT_REF + gps_ephemeris_iter->second.d_DELTA_OMEGA_DOT;
line += Rinex_Printer::doub2for(OMEGA_DOT, 18, 2); line += Rinex_Printer::doub2for(OMEGA_DOT, 18, 2);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- BROADCAST ORBIT - 5 // -------- BROADCAST ORBIT - 5
line.clear(); line.clear();
line += std::string(5, ' '); line += std::string(5, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_IDOT, 18, 2); line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_IDOT, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_code_on_L2), 18, 2); // No data flag for L2 P code
line += Rinex_Printer::doub2for(my_zero, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
double GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm) double GPS_week_continuous_number = static_cast<double>(gps_ephemeris_iter->second.i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2); line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_code_on_L2), 18, 2); line += Rinex_Printer::doub2for(my_zero, 18, 2);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
@ -1980,13 +1972,14 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_CNAV
// -------- BROADCAST ORBIT - 6 // -------- BROADCAST ORBIT - 6
line.clear(); line.clear();
line += std::string(5, ' '); line += std::string(5, ' ');
line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_SV_accuracy), 18, 2); line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_URA), 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_SV_health), 18, 2); line += Rinex_Printer::doub2for(static_cast<double>(gps_ephemeris_iter->second.i_signal_health), 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_TGD, 18, 2); line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_TGD, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_IODC, 18, 2); // no IODC in CNAV, so we set it to zero
line += Rinex_Printer::doub2for(my_zero, 18, 2);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
@ -1996,29 +1989,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_CNAV
line += std::string(5, ' '); line += std::string(5, ' ');
line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_TOW, 18, 2); line += Rinex_Printer::doub2for(gps_ephemeris_iter->second.d_TOW, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
double curve_fit_interval = 4; double curve_fit_interval = 3; /// ?? Not defined in CNAV
if (gps_ephemeris_iter->second.satelliteBlock.at(gps_ephemeris_iter->second.i_satellite_PRN).compare("IIA"))
{
// Block II/IIA (Table 20-XI IS-GPS-200E )
if ( (gps_ephemeris_iter->second.d_IODC > 239) && (gps_ephemeris_iter->second.d_IODC < 248) ) curve_fit_interval = 8;
if ( ( (gps_ephemeris_iter->second.d_IODC > 247) && (gps_ephemeris_iter->second.d_IODC < 256) ) || (gps_ephemeris_iter->second.d_IODC == 496) ) curve_fit_interval = 14;
if ( (gps_ephemeris_iter->second.d_IODC > 496) && (gps_ephemeris_iter->second.d_IODC < 504) ) curve_fit_interval = 26;
if ( (gps_ephemeris_iter->second.d_IODC > 503) && (gps_ephemeris_iter->second.d_IODC < 511) ) curve_fit_interval = 50;
if ( ( (gps_ephemeris_iter->second.d_IODC > 751) && (gps_ephemeris_iter->second.d_IODC < 757) ) || (gps_ephemeris_iter->second.d_IODC == 511) ) curve_fit_interval = 74;
if ( gps_ephemeris_iter->second.d_IODC == 757 ) curve_fit_interval = 98;
}
if ((gps_ephemeris_iter->second.satelliteBlock.at(gps_ephemeris_iter->second.i_satellite_PRN).compare("IIR") == 0) ||
(gps_ephemeris_iter->second.satelliteBlock.at(gps_ephemeris_iter->second.i_satellite_PRN).compare("IIR-M") == 0) ||
(gps_ephemeris_iter->second.satelliteBlock.at(gps_ephemeris_iter->second.i_satellite_PRN).compare("IIF") == 0) ||
(gps_ephemeris_iter->second.satelliteBlock.at(gps_ephemeris_iter->second.i_satellite_PRN).compare("IIIA") == 0) )
{
// Block IIR/IIR-M/IIF/IIIA (Table 20-XII IS-GPS-200E )
if ( (gps_ephemeris_iter->second.d_IODC > 239) && (gps_ephemeris_iter->second.d_IODC < 248)) curve_fit_interval = 8;
if ( ( (gps_ephemeris_iter->second.d_IODC > 247) && (gps_ephemeris_iter->second.d_IODC < 256)) || (gps_ephemeris_iter->second.d_IODC == 496) ) curve_fit_interval = 14;
if ( ( (gps_ephemeris_iter->second.d_IODC > 496) && (gps_ephemeris_iter->second.d_IODC < 504)) || ( (gps_ephemeris_iter->second.d_IODC > 1020) && (gps_ephemeris_iter->second.d_IODC < 1024) ) ) curve_fit_interval = 26;
}
line += Rinex_Printer::doub2for(curve_fit_interval, 18, 2); line += Rinex_Printer::doub2for(curve_fit_interval, 18, 2);
line += std::string(1, ' '); line += std::string(1, ' ');
line += std::string(18, ' '); // spare line += std::string(18, ' '); // spare
@ -2028,7 +1999,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int,Gps_CNAV
out << line << std::endl; out << line << std::endl;
line.clear(); line.clear();
} }
}*/ }
void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int, Galileo_Ephemeris>& eph_map) void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int, Galileo_Ephemeris>& eph_map)

View File

@ -165,7 +165,7 @@ public:
/*! /*!
* \brief Writes data from the GPS L2 navigation message into the RINEX file * \brief Writes data from the GPS L2 navigation message into the RINEX file
*/ */
// void log_rinex_nav(std::fstream & out, const std::map<int, Gps_CNAV_Ephemeris> & eph_map); void log_rinex_nav(std::fstream & out, const std::map<int, Gps_CNAV_Ephemeris> & eph_map);
/*! /*!