1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2019-09-13 20:31:03 +02:00
commit f2fddb51e5
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
21 changed files with 234 additions and 75 deletions

View File

@ -11,6 +11,11 @@
- New PVT parameter enable_rx_clock_correction parameter allows to enable or disable the application of the Time solution correction to the computation of Observables. - New PVT parameter enable_rx_clock_correction parameter allows to enable or disable the application of the Time solution correction to the computation of Observables.
### Improvements in Interoperability:
- Added triple-band configurations RINEX outputs.
### Improvements in Maintainability: ### Improvements in Maintainability:
- New CMake option ENABLE_ARMA_NO_DEBUG defines the macro ARMA_NO_DEBUG, which disables all run-time checks, such as bounds checking, in the Armadillo library. This will result in faster code. This option is disabled by default during development, but automatically set to ON if the option ENABLE_PACKAGING is set to ON. - New CMake option ENABLE_ARMA_NO_DEBUG defines the macro ARMA_NO_DEBUG, which disables all run-time checks, such as bounds checking, in the Armadillo library. This will result in faster code. This option is disabled by default during development, but automatically set to ON if the option ENABLE_PACKAGING is set to ON.
@ -37,6 +42,7 @@
### Improvements in Usability: ### Improvements in Usability:
- A new parameter allows to process raw sample files containing signals dated before year 2009.
- Improved DLL-PLL binary dump MATLAB/Octave plot script. Old versions removed. - Improved DLL-PLL binary dump MATLAB/Octave plot script. Old versions removed.
- Simplified RTKLIB error log. - Simplified RTKLIB error log.
- Added a Python 3 plotting script to show relative performance of generic volk_gnsssdr kernels wrt SIMD fastest versions. - Added a Python 3 plotting script to show relative performance of generic volk_gnsssdr kernels wrt SIMD fastest versions.

View File

@ -68,6 +68,9 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", default_dump_filename);
pvt_output_parameters.dump_mat = configuration->property(role + ".dump_mat", true); pvt_output_parameters.dump_mat = configuration->property(role + ".dump_mat", true);
//OPTIONAL: specify a custom year to override the system time in order to postprocess old gnss records and avoid wrong week rollover
pvt_output_parameters.custom_year = configuration->property("GNSS-SDR.custom_year", 0);
// output rate // output rate
pvt_output_parameters.output_rate_ms = bc::lcm(20, configuration->property(role + ".output_rate_ms", 500)); pvt_output_parameters.output_rate_ms = bc::lcm(20, configuration->property(role + ".output_rate_ms", 500));
@ -380,6 +383,14 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration,
{ {
pvt_output_parameters.type_of_receiver = 603; // Beidou B3I + GPS L2C + GLONASS L2 C/A pvt_output_parameters.type_of_receiver = 603; // Beidou B3I + GPS L2C + GLONASS L2 C/A
} }
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count != 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 1000; // GPS L1 + GPS L2C + GPS L5
}
if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count != 0) && (gal_1B_count != 0) && (gal_E5a_count != 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0) && (bds_B1_count == 0) && (bds_B3_count == 0))
{
pvt_output_parameters.type_of_receiver = 1001; // GPS L1 + Galileo E1B + GPS L2C + GPS L5 + Galileo E5a
}
// RTKLIB PVT solver options // RTKLIB PVT solver options
// Settings 1 // Settings 1

View File

@ -347,6 +347,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
if (b_rinex_output_enabled) if (b_rinex_output_enabled)
{ {
rp = std::make_shared<Rinex_Printer>(d_rinex_version, conf_.rinex_output_path); rp = std::make_shared<Rinex_Printer>(d_rinex_version, conf_.rinex_output_path);
rp->set_custom_year(conf_.custom_year);
} }
else else
{ {
@ -467,18 +468,21 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
// user PVT solver // user PVT solver
d_user_pvt_solver = std::make_shared<Rtklib_Solver>(static_cast<int32_t>(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); d_user_pvt_solver = std::make_shared<Rtklib_Solver>(static_cast<int32_t>(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk);
d_user_pvt_solver->set_averaging_depth(1); d_user_pvt_solver->set_averaging_depth(1);
d_user_pvt_solver->set_custom_year(conf_.custom_year);
// internal PVT solver, mainly used to estimate the receiver clock // internal PVT solver, mainly used to estimate the receiver clock
rtk_t internal_rtk = rtk; rtk_t internal_rtk = rtk;
internal_rtk.opt.mode = PMODE_SINGLE; // use single positioning mode in internal PVT solver internal_rtk.opt.mode = PMODE_SINGLE; // use single positioning mode in internal PVT solver
d_internal_pvt_solver = std::make_shared<Rtklib_Solver>(static_cast<int32_t>(nchannels), dump_ls_pvt_filename, false, false, internal_rtk); d_internal_pvt_solver = std::make_shared<Rtklib_Solver>(static_cast<int32_t>(nchannels), dump_ls_pvt_filename, false, false, internal_rtk);
d_internal_pvt_solver->set_averaging_depth(1); d_internal_pvt_solver->set_averaging_depth(1);
d_internal_pvt_solver->set_custom_year(conf_.custom_year);
} }
else else
{ {
// only one solver, customized by the user options // only one solver, customized by the user options
d_internal_pvt_solver = std::make_shared<Rtklib_Solver>(static_cast<int32_t>(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); d_internal_pvt_solver = std::make_shared<Rtklib_Solver>(static_cast<int32_t>(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk);
d_internal_pvt_solver->set_averaging_depth(1); d_internal_pvt_solver->set_averaging_depth(1);
d_internal_pvt_solver->set_custom_year(conf_.custom_year);
d_user_pvt_solver = d_internal_pvt_solver; d_user_pvt_solver = d_internal_pvt_solver;
} }
@ -1107,6 +1111,12 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
case 33: // L1+E1+E5a case 33: // L1+E1+E5a
rp->log_rinex_nav(rp->navMixFile, new_eph, new_gal_eph); rp->log_rinex_nav(rp->navMixFile, new_eph, new_gal_eph);
break; break;
case 1000: // L1+L2+L5
rp->log_rinex_nav(rp->navFile, new_eph);
break;
case 1001: // L1+E1+L2+L5+E5a
rp->log_rinex_nav(rp->navMixFile, new_eph, new_gal_eph);
break;
default: default:
break; break;
} }
@ -1297,6 +1307,9 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg)
case 33: // L1+E1+E5a case 33: // L1+E1+E5a
rp->log_rinex_nav(rp->navMixFile, new_eph, new_gal_eph); rp->log_rinex_nav(rp->navMixFile, new_eph, new_gal_eph);
break; break;
case 1001: // L1+E1+L2+L5+E5a
rp->log_rinex_nav(rp->navMixFile, new_eph, new_gal_eph);
break;
default: default:
break; break;
} }
@ -2235,6 +2248,8 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
* 608 | BeiDou B3I + GPS L1 C/A + Galileo E1B + BeiDou B1I * 608 | BeiDou B3I + GPS L1 C/A + Galileo E1B + BeiDou B1I
* 609 | BeiDou B3I + GPS L1 C/A + Galileo E1B + GLONASS L1 C/A * 609 | BeiDou B3I + GPS L1 C/A + Galileo E1B + GLONASS L1 C/A
* 610 | BeiDou B3I + GPS L1 C/A + Galileo E1B + GLONASS L1 C/A + BeiDou B1I * 610 | BeiDou B3I + GPS L1 C/A + Galileo E1B + GLONASS L1 C/A + BeiDou B1I
* 1000 | GPS L1 C/A + GPS L2C + GPS L5
* 1001 | GPS L1 C/A + Galileo E1B + GPS L2C + GPS L5 + Galileo E5a
*/ */
// ####################### RINEX FILES ################# // ####################### RINEX FILES #################
@ -2288,6 +2303,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
{ {
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time);
rp->rinex_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); rp->rinex_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model);
rp->log_rinex_nav(rp->navGalFile, d_user_pvt_solver->galileo_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
break; break;
@ -2297,6 +2313,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
std::string signal("5X"); std::string signal("5X");
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, signal); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, signal);
rp->rinex_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); rp->rinex_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model);
rp->log_rinex_nav(rp->navGalFile, d_user_pvt_solver->galileo_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
break; break;
@ -2375,6 +2392,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
std::string gal_signal("1B 5X"); std::string gal_signal("1B 5X");
rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gal_signal); rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gal_signal);
rp->rinex_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); rp->rinex_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model);
rp->log_rinex_nav(rp->navGalFile, d_user_pvt_solver->galileo_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore b_rinex_header_written = true; // do not write header anymore
} }
break; break;
@ -2629,6 +2647,30 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
} }
break; break;
case 1000: // GPS L1 C/A + GPS L2C + GPS L5
if ((gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and
(gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()))
{
std::string gps_signal("1C 2S L5");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, gps_signal);
rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second);
rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
break;
case 1001: // GPS L1 C/A + Galileo E1B + GPS L2C + GPS L5 + Galileo E5a
if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and
(gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and
(gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()))
{
std::string gal_signal("1B 5X");
std::string gps_signal("1C 2S L5");
rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gps_signal, gal_signal);
rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model);
rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_ephemeris_map, d_user_pvt_solver->galileo_ephemeris_map);
b_rinex_header_written = true; // do not write header anymore
}
break;
default: default:
break; break;
} }
@ -2950,6 +2992,33 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
b_rinex_header_updated = true; b_rinex_header_updated = true;
} }
break; break;
case 1000: // GPS L1 C/A + GPS L2C + GPS L5
if ((gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and
(gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_user_pvt_solver->gps_utc_model.d_A0 != 0))
{
rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navFile, d_user_pvt_solver->gps_utc_model, d_user_pvt_solver->gps_iono, gps_ephemeris_iter->second);
b_rinex_header_updated = true;
}
break;
case 1001: // GPS L1 C/A + Galileo E1B + GPS L2C + GPS L5 + Galileo E5a
if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and
(gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and
(gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()))
{
rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map);
}
if (!b_rinex_header_updated and (d_user_pvt_solver->gps_utc_model.d_A0 != 0) and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0))
{
rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_utc_model);
rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model);
b_rinex_header_updated = true;
}
break;
default: default:
break; break;
} }

View File

@ -76,6 +76,6 @@ Pvt_Conf::Pvt_Conf()
monitor_enabled = false; monitor_enabled = false;
protobuf_enabled = true; protobuf_enabled = true;
udp_port = 0; udp_port = 0;
custom_year = 0;
show_local_time_zone = false; show_local_time_zone = false;
} }

View File

@ -91,6 +91,7 @@ public:
bool enable_rx_clock_correction; bool enable_rx_clock_correction;
bool show_local_time_zone; bool show_local_time_zone;
int custom_year;
Pvt_Conf(); Pvt_Conf();
}; };

View File

@ -53,6 +53,7 @@ Pvt_Solution::Pvt_Solution()
d_valid_observations = 0; d_valid_observations = 0;
d_rx_pos = arma::zeros(3, 1); d_rx_pos = arma::zeros(3, 1);
d_rx_dt_s = 0.0; d_rx_dt_s = 0.0;
d_custom_year = 0; //disabled by default
} }
@ -431,3 +432,8 @@ void Pvt_Solution::set_num_valid_observations(int num)
{ {
d_valid_observations = num; d_valid_observations = num;
} }
void Pvt_Solution::set_custom_year(int custom_year)
{
d_custom_year = custom_year;
}

View File

@ -49,7 +49,7 @@ class Pvt_Solution
{ {
public: public:
Pvt_Solution(); Pvt_Solution();
void set_custom_year(int custom_year); //!< Set a custom year for the week rollover computation instead of using the system clock, useful in post processing mode
double get_time_offset_s() const; //!< Get RX time offset [s] double get_time_offset_s() const; //!< Get RX time offset [s]
void set_time_offset_s(double offset); //!< Set RX time offset [s] void set_time_offset_s(double offset); //!< Set RX time offset [s]
@ -129,6 +129,8 @@ public:
*/ */
int tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km); int tropo(double *ddr_m, double sinel, double hsta_km, double p_mb, double t_kel, double hum, double hp_km, double htkel_km, double hhum_km);
protected:
int d_custom_year; //custom year to guess the correct week rollover in post processing mode
private: private:
double d_rx_dt_s; // RX time offset [s] double d_rx_dt_s; // RX time offset [s]

View File

@ -88,6 +88,7 @@ namespace errorlib = boost::system;
Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path) Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path)
{ {
custom_year_ = 0;
std::string base_rinex_path = base_path; std::string base_rinex_path = base_path;
fs::path full_path(fs::current_path()); fs::path full_path(fs::current_path());
const fs::path p(base_rinex_path); const fs::path p(base_rinex_path);
@ -11780,13 +11781,24 @@ boost::posix_time::ptime Rinex_Printer::compute_UTC_time(const Gps_Navigation_Me
// idea: resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm // idea: resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm
const double utc_t = nav_msg.utc_time(nav_msg.d_TOW); const double utc_t = nav_msg.utc_time(nav_msg.d_TOW);
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((utc_t + 604800 * static_cast<double>(nav_msg.i_GPS_week)) * 1000)); boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<int64_t>((utc_t + 604800 * static_cast<double>(nav_msg.i_GPS_week)) * 1000));
if (nav_msg.i_GPS_week < 512) // Handle week rollover
if (custom_year_ == 0 or custom_year_ >= 2009)
{ {
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); // Handle week rollover (valid from 2009 to 2029)
if (nav_msg.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
else
{
//assume receiver operating in between 1999 to 2008
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time; return p_time;
} }
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
} }
@ -11815,15 +11827,25 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep
{ {
t += boost::posix_time::seconds(604800); t += boost::posix_time::seconds(604800);
} }
// Handle week rollover (valid from 2009 to 2029)
if (eph.i_GPS_week < 512) // Handle week rollover
if (custom_year_ == 0 or custom_year_ >= 2009)
{ {
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t); // Handle week rollover (valid from 2009 to 2029)
if (eph.i_GPS_week < 512)
{
boost::posix_time::ptime p_time(boost::gregorian::date(2019, 4, 7), t);
return p_time;
}
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
else
{
//assume receiver operating in between 1999 to 2008
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time; return p_time;
} }
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
} }
@ -11933,6 +11955,11 @@ double Rinex_Printer::get_leap_second(const Glonass_Gnav_Ephemeris& eph, const d
return leap_second; return leap_second;
} }
void Rinex_Printer::set_custom_year(int custom_year)
{
custom_year_ = custom_year;
}
/* /*

View File

@ -448,9 +448,12 @@ public:
std::string navBdsfilename; std::string navBdsfilename;
std::string navMixfilename; std::string navMixfilename;
void set_custom_year(int custom_year);
private: private:
int version; // RINEX version (2 for 2.10/2.11 and 3 for 3.01) int version; // RINEX version (2 for 2.10/2.11 and 3 for 3.01)
int numberTypesObservations; // Number of available types of observable in the system. Should be public? int numberTypesObservations; // Number of available types of observable in the system. Should be public?
int custom_year_;
/* /*
* Generation of RINEX signal strength indicators * Generation of RINEX signal strength indicators
*/ */

View File

@ -496,13 +496,14 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
if (galileo_ephemeris_iter != galileo_ephemeris_map.cend()) if (galileo_ephemeris_iter != galileo_ephemeris_map.cend())
{ {
// convert ephemeris from GNSS-SDR class to RTKLIB structure // convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second, d_custom_year);
// convert observation from GNSS-SDR class to RTKLIB structure // convert observation from GNSS-SDR class to RTKLIB structure
obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}}; obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}};
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
galileo_ephemeris_iter->second.WN_5, galileo_ephemeris_iter->second.WN_5,
0); 0,
d_custom_year);
valid_obs++; valid_obs++;
} }
else // the ephemeris are not available for this SV else // the ephemeris are not available for this SV
@ -526,7 +527,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs], obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs],
gnss_observables_iter->second, gnss_observables_iter->second,
galileo_ephemeris_iter->second.WN_5, galileo_ephemeris_iter->second.WN_5,
2); // Band 3 (L5/E5) 2, // Band 3 (L5/E5)
d_custom_year);
found_E1_obs = true; found_E1_obs = true;
break; break;
} }
@ -535,7 +537,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{ {
// insert Galileo E5 obs as new obs and also insert its ephemeris // insert Galileo E5 obs as new obs and also insert its ephemeris
// convert ephemeris from GNSS-SDR class to RTKLIB structure // convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second, d_custom_year);
// convert observation from GNSS-SDR class to RTKLIB structure // convert observation from GNSS-SDR class to RTKLIB structure
auto default_code_ = static_cast<unsigned char>(CODE_NONE); auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {}, obsd_t newobs = {{0, 0}, '0', '0', {}, {},
@ -544,7 +546,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
galileo_ephemeris_iter->second.WN_5, galileo_ephemeris_iter->second.WN_5,
2); // Band 3 (L5/E5) 2, // Band 3 (L5/E5)
d_custom_year);
valid_obs++; valid_obs++;
} }
} }
@ -566,13 +569,14 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
if (gps_ephemeris_iter != gps_ephemeris_map.cend()) if (gps_ephemeris_iter != gps_ephemeris_map.cend())
{ {
// convert ephemeris from GNSS-SDR class to RTKLIB structure // convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(gps_ephemeris_iter->second); eph_data[valid_obs] = eph_to_rtklib(gps_ephemeris_iter->second, d_custom_year);
// convert observation from GNSS-SDR class to RTKLIB structure // convert observation from GNSS-SDR class to RTKLIB structure
obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}}; obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}};
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
gps_ephemeris_iter->second.i_GPS_week, gps_ephemeris_iter->second.i_GPS_week,
0); 0,
d_custom_year);
valid_obs++; valid_obs++;
} }
else // the ephemeris are not available for this SV else // the ephemeris are not available for this SV
@ -611,7 +615,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{ {
// 3. If not found, insert the GPS L2 ephemeris and the observation // 3. If not found, insert the GPS L2 ephemeris and the observation
// convert ephemeris from GNSS-SDR class to RTKLIB structure // convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second, d_custom_year);
// convert observation from GNSS-SDR class to RTKLIB structure // convert observation from GNSS-SDR class to RTKLIB structure
auto default_code_ = static_cast<unsigned char>(CODE_NONE); auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {}, obsd_t newobs = {{0, 0}, '0', '0', {}, {},
@ -620,7 +624,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
gps_cnav_ephemeris_iter->second.i_GPS_week, gps_cnav_ephemeris_iter->second.i_GPS_week,
1); // Band 2 (L2) 1, // Band 2 (L2)
d_custom_year);
valid_obs++; valid_obs++;
} }
} }
@ -645,11 +650,12 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{ {
if (eph_data[i].sat == static_cast<int>(gnss_observables_iter->second.PRN)) if (eph_data[i].sat == static_cast<int>(gnss_observables_iter->second.PRN))
{ {
eph_data[i] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); eph_data[i] = eph_to_rtklib(gps_cnav_ephemeris_iter->second, d_custom_year);
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i], obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i],
gnss_observables_iter->second, gnss_observables_iter->second,
gps_cnav_ephemeris_iter->second.i_GPS_week, gps_cnav_ephemeris_iter->second.i_GPS_week,
2); // Band 3 (L5) 2, // Band 3 (L5)
d_custom_year);
break; break;
} }
} }
@ -658,7 +664,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
{ {
// 3. If not found, insert the GPS L5 ephemeris and the observation // 3. If not found, insert the GPS L5 ephemeris and the observation
// convert ephemeris from GNSS-SDR class to RTKLIB structure // convert ephemeris from GNSS-SDR class to RTKLIB structure
eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second, d_custom_year);
// convert observation from GNSS-SDR class to RTKLIB structure // convert observation from GNSS-SDR class to RTKLIB structure
auto default_code_ = static_cast<unsigned char>(CODE_NONE); auto default_code_ = static_cast<unsigned char>(CODE_NONE);
obsd_t newobs = {{0, 0}, '0', '0', {}, {}, obsd_t newobs = {{0, 0}, '0', '0', {}, {},
@ -667,7 +673,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
gps_cnav_ephemeris_iter->second.i_GPS_week, gps_cnav_ephemeris_iter->second.i_GPS_week,
2); // Band 3 (L5) 2, // Band 3 (L5)
d_custom_year);
valid_obs++; valid_obs++;
} }
} }
@ -695,7 +702,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
glonass_gnav_ephemeris_iter->second.d_WN, glonass_gnav_ephemeris_iter->second.d_WN,
0); // Band 0 (L1) 0, // Band 0 (L1)
d_custom_year);
glo_valid_obs++; glo_valid_obs++;
} }
else // the ephemeris are not available for this SV else // the ephemeris are not available for this SV
@ -718,7 +726,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[i + valid_obs] = insert_obs_to_rtklib(obs_data[i + valid_obs], obs_data[i + valid_obs] = insert_obs_to_rtklib(obs_data[i + valid_obs],
gnss_observables_iter->second, gnss_observables_iter->second,
glonass_gnav_ephemeris_iter->second.d_WN, glonass_gnav_ephemeris_iter->second.d_WN,
1); // Band 1 (L2) 1, // Band 1 (L2)
d_custom_year);
found_L1_obs = true; found_L1_obs = true;
break; break;
} }
@ -733,7 +742,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
glonass_gnav_ephemeris_iter->second.d_WN, glonass_gnav_ephemeris_iter->second.d_WN,
1); // Band 1 (L2) 1, // Band 1 (L2)
d_custom_year);
glo_valid_obs++; glo_valid_obs++;
} }
} }
@ -761,7 +771,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET, beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
0); 0,
d_custom_year);
valid_obs++; valid_obs++;
} }
else // the ephemeris are not available for this SV else // the ephemeris are not available for this SV
@ -783,7 +794,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs], obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs],
gnss_observables_iter->second, gnss_observables_iter->second,
beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET, beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
2); // Band 3 (L2/G2/B3) 2, // Band 3 (L2/G2/B3)
d_custom_year);
found_B1I_obs = true; found_B1I_obs = true;
break; break;
} }
@ -801,7 +813,8 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs,
gnss_observables_iter->second, gnss_observables_iter->second,
beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET, beidou_ephemeris_iter->second.i_BEIDOU_week + BEIDOU_DNAV_BDT2GPST_WEEK_NUM_OFFSET,
2); // Band 2 (L2/G2) 2, // Band 2 (L2/G2)
d_custom_year);
valid_obs++; valid_obs++;
} }
} }
@ -1025,7 +1038,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
// TOW // TOW
monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms; monitor_pvt.TOW_at_current_symbol_ms = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms;
// WEEK // WEEK
monitor_pvt.week = adjgpsweek(nav_data.eph[0].week); monitor_pvt.week = adjgpsweek(nav_data.eph[0].week, d_custom_year);
// PVT GPS time // PVT GPS time
monitor_pvt.RX_time = gnss_observables_map.begin()->second.RX_time; monitor_pvt.RX_time = gnss_observables_map.begin()->second.RX_time;
// User clock offset [s] // User clock offset [s]
@ -1083,7 +1096,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
tmp_uint32 = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms; tmp_uint32 = gnss_observables_map.begin()->second.TOW_at_current_symbol_ms;
d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t)); d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t));
// WEEK // WEEK
tmp_uint32 = adjgpsweek(nav_data.eph[0].week); tmp_uint32 = adjgpsweek(nav_data.eph[0].week, d_custom_year);
d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t)); d_dump_file.write(reinterpret_cast<char *>(&tmp_uint32), sizeof(uint32_t));
// PVT GPS time // PVT GPS time
tmp_double = gnss_observables_map.begin()->second.RX_time; tmp_double = gnss_observables_map.begin()->second.RX_time;

View File

@ -71,7 +71,7 @@ pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc(
int samples_per_ms, int samples_per_code, int samples_per_ms, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
std::string dump_filename) const std::string &dump_filename)
{ {
return pcps_opencl_acquisition_cc_sptr( return pcps_opencl_acquisition_cc_sptr(
new pcps_opencl_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms, new pcps_opencl_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms,
@ -88,9 +88,9 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
int samples_per_code, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
std::string dump_filename) : gr::block("pcps_opencl_acquisition_cc", const std::string &dump_filename) : gr::block("pcps_opencl_acquisition_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms), gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms),
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms)) gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0ULL; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER

View File

@ -78,7 +78,7 @@ pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc(
int samples_per_code, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
std::string dump_filename); const std::string& dump_filename);
/*! /*!
* \brief This class implements a Parallel Code Phase Search Acquisition. * \brief This class implements a Parallel Code Phase Search Acquisition.
@ -213,14 +213,14 @@ private:
int samples_per_ms, int samples_per_code, int samples_per_ms, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
std::string dump_filename); const std::string& dump_filename);
pcps_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells, pcps_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
uint32_t doppler_max, int64_t fs_in, uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code, int samples_per_ms, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
std::string dump_filename); const std::string& dump_filename);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift, void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset); int doppler_offset);

View File

@ -45,7 +45,7 @@
#include <cstdint> #include <cstdint>
#include <string> #include <string>
obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro, int week, int band) obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro, int week, int band, int custom_year)
{ {
// Get signal type info to adjust code type based on constellation // Get signal type info to adjust code type based on constellation
std::string sig_ = gnss_synchro.Signal; std::string sig_ = gnss_synchro.Signal;
@ -118,7 +118,7 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro
// rtklib_obs.time = gpst2time(adjgpsweek(week), gnss_synchro.RX_time); // rtklib_obs.time = gpst2time(adjgpsweek(week), gnss_synchro.RX_time);
// } // }
// //
rtklib_obs.time = gpst2time(adjgpsweek(week), gnss_synchro.RX_time); rtklib_obs.time = gpst2time(adjgpsweek(week, custom_year), gnss_synchro.RX_time);
// account for the TOW crossover transitory in the first 18 seconds where the week is not yet updated! // account for the TOW crossover transitory in the first 18 seconds where the week is not yet updated!
if (gnss_synchro.RX_time < 18.0) if (gnss_synchro.RX_time < 18.0)
{ {
@ -158,19 +158,19 @@ geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glona
// Time expressed in GPS Time but using RTKLib format // Time expressed in GPS Time but using RTKLib format
glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_t_b, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec); glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_t_b, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec);
adj_week = adjgpsweek(static_cast<int>(week)); adj_week = adjgpsweek(static_cast<int>(week), 0);
rtklib_sat.toe = gpst2time(adj_week, sec); rtklib_sat.toe = gpst2time(adj_week, sec);
// Time expressed in GPS Time but using RTKLib format // Time expressed in GPS Time but using RTKLib format
glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_t_k, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec); glonass_gnav_eph.glot_to_gpst(glonass_gnav_eph.d_t_k, gnav_clock_model.d_tau_c, gnav_clock_model.d_tau_gps, &week, &sec);
adj_week = adjgpsweek(static_cast<int>(week)); adj_week = adjgpsweek(static_cast<int>(week), 0);
rtklib_sat.tof = gpst2time(adj_week, sec); rtklib_sat.tof = gpst2time(adj_week, sec);
return rtklib_sat; return rtklib_sat;
} }
eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph) eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph, int custom_year)
{ {
eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0, eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0}; 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0};
@ -188,7 +188,7 @@ eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph)
rtklib_sat.Adot = 0; // only in CNAV; rtklib_sat.Adot = 0; // only in CNAV;
rtklib_sat.ndot = 0; // only in CNAV; rtklib_sat.ndot = 0; // only in CNAV;
rtklib_sat.week = adjgpsweek(gal_eph.WN_5); /* week of tow */ rtklib_sat.week = adjgpsweek(gal_eph.WN_5, custom_year); /* week of tow */
rtklib_sat.cic = gal_eph.C_ic_4; rtklib_sat.cic = gal_eph.C_ic_4;
rtklib_sat.cis = gal_eph.C_is_4; rtklib_sat.cis = gal_eph.C_is_4;
rtklib_sat.cuc = gal_eph.C_uc_3; rtklib_sat.cuc = gal_eph.C_uc_3;
@ -229,7 +229,7 @@ eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph)
} }
eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph) eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph, int custom_year)
{ {
eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0, eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0}; 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0};
@ -246,7 +246,7 @@ eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph)
rtklib_sat.Adot = 0; // only in CNAV; rtklib_sat.Adot = 0; // only in CNAV;
rtklib_sat.ndot = 0; // only in CNAV; rtklib_sat.ndot = 0; // only in CNAV;
rtklib_sat.week = adjgpsweek(gps_eph.i_GPS_week); /* week of tow */ rtklib_sat.week = adjgpsweek(gps_eph.i_GPS_week, custom_year); /* week of tow */
rtklib_sat.cic = gps_eph.d_Cic; rtklib_sat.cic = gps_eph.d_Cic;
rtklib_sat.cis = gps_eph.d_Cis; rtklib_sat.cis = gps_eph.d_Cis;
rtklib_sat.cuc = gps_eph.d_Cuc; rtklib_sat.cuc = gps_eph.d_Cuc;
@ -356,7 +356,7 @@ eph_t eph_to_rtklib(const Beidou_Dnav_Ephemeris& bei_eph)
} }
eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph) eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph, int custom_year)
{ {
eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0, eph_t rtklib_sat = {0, 0, 0, 0, 0, 0, 0, 0, {0, 0}, {0, 0}, {0, 0}, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0}; 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, {}, {}, 0.0, 0.0};
@ -377,7 +377,7 @@ eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph)
rtklib_sat.Adot = gps_cnav_eph.d_A_DOT; // only in CNAV; rtklib_sat.Adot = gps_cnav_eph.d_A_DOT; // only in CNAV;
rtklib_sat.ndot = gps_cnav_eph.d_DELTA_DOT_N; // only in CNAV; rtklib_sat.ndot = gps_cnav_eph.d_DELTA_DOT_N; // only in CNAV;
rtklib_sat.week = adjgpsweek(gps_cnav_eph.i_GPS_week); /* week of tow */ rtklib_sat.week = adjgpsweek(gps_cnav_eph.i_GPS_week, custom_year); /* week of tow */
rtklib_sat.cic = gps_cnav_eph.d_Cic; rtklib_sat.cic = gps_cnav_eph.d_Cic;
rtklib_sat.cis = gps_cnav_eph.d_Cis; rtklib_sat.cis = gps_cnav_eph.d_Cis;
rtklib_sat.cuc = gps_cnav_eph.d_Cuc; rtklib_sat.cuc = gps_cnav_eph.d_Cuc;

View File

@ -43,9 +43,9 @@ class Gps_Almanac;
class Gps_CNAV_Ephemeris; class Gps_CNAV_Ephemeris;
class Gps_Ephemeris; class Gps_Ephemeris;
eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph); eph_t eph_to_rtklib(const Galileo_Ephemeris& gal_eph, int custom_year);
eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph); eph_t eph_to_rtklib(const Gps_Ephemeris& gps_eph, int custom_year);
eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph); eph_t eph_to_rtklib(const Gps_CNAV_Ephemeris& gps_cnav_eph, int custom_year);
eph_t eph_to_rtklib(const Beidou_Dnav_Ephemeris& bei_eph); eph_t eph_to_rtklib(const Beidou_Dnav_Ephemeris& bei_eph);
alm_t alm_to_rtklib(const Gps_Almanac& gps_alm); alm_t alm_to_rtklib(const Gps_Almanac& gps_alm);
@ -58,6 +58,6 @@ alm_t alm_to_rtklib(const Galileo_Almanac& gal_alm);
*/ */
geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& gnav_clock_model); geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& gnav_clock_model);
obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro, int week, int band); obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro, int week, int band, int custom_year);
#endif /* GNSS_SDR_RTKLIB_CONVERSIONS_H_ */ #endif /* GNSS_SDR_RTKLIB_CONVERSIONS_H_ */

View File

@ -192,7 +192,7 @@ int decode_type3(rtcm_t *rtcm)
/* decode type 14: gps time of week ------------------------------------------*/ /* decode type 14: gps time of week ------------------------------------------*/
int decode_type14(rtcm_t *rtcm) int decode_type14(rtcm_t *rtcm, int custom_year)
{ {
double zcnt; double zcnt;
int i = 48; int i = 48;
@ -216,7 +216,7 @@ int decode_type14(rtcm_t *rtcm)
trace(2, "rtcm2 14 length error: len=%d\n", rtcm->len); trace(2, "rtcm2 14 length error: len=%d\n", rtcm->len);
return -1; return -1;
} }
week = adjgpsweek(week); week = adjgpsweek(week, custom_year);
rtcm->time = gpst2time(week, hour * 3600.0 + zcnt * 0.6); rtcm->time = gpst2time(week, hour * 3600.0 + zcnt * 0.6);
rtcm->nav.leaps = leaps; rtcm->nav.leaps = leaps;
return 6; return 6;
@ -244,7 +244,7 @@ int decode_type16(rtcm_t *rtcm)
/* decode type 17: gps ephemerides -------------------------------------------*/ /* decode type 17: gps ephemerides -------------------------------------------*/
int decode_type17(rtcm_t *rtcm) int decode_type17(rtcm_t *rtcm, int custom_year)
{ {
eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0, 0.0}, {0, 0.0}, {0, 0.0}, eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0, 0.0}, {0, 0.0}, {0, 0.0},
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
@ -329,7 +329,7 @@ int decode_type17(rtcm_t *rtcm)
} }
sat = satno(SYS_GPS, prn); sat = satno(SYS_GPS, prn);
eph.sat = sat; eph.sat = sat;
eph.week = adjgpsweek(week); eph.week = adjgpsweek(week, custom_year);
eph.toe = gpst2time(eph.week, eph.toes); eph.toe = gpst2time(eph.week, eph.toes);
eph.toc = gpst2time(eph.week, toc); eph.toc = gpst2time(eph.week, toc);
eph.ttr = rtcm->time; eph.ttr = rtcm->time;

View File

@ -1036,7 +1036,7 @@ int decode_type1013(rtcm_t *rtcm __attribute__((unused)))
/* decode type 1019: gps ephemerides -----------------------------------------*/ /* decode type 1019: gps ephemerides -----------------------------------------*/
int decode_type1019(rtcm_t *rtcm) int decode_type1019(rtcm_t *rtcm, int custom_year)
{ {
eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0, 0.0}, {0, 0.0}, {0, 0.0}, eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0, 0.0}, {0, 0.0}, {0, 0.0},
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
@ -1136,7 +1136,7 @@ int decode_type1019(rtcm_t *rtcm)
return -1; return -1;
} }
eph.sat = sat; eph.sat = sat;
eph.week = adjgpsweek(week); eph.week = adjgpsweek(week, custom_year);
eph.toe = gpst2time(eph.week, eph.toes); eph.toe = gpst2time(eph.week, eph.toes);
eph.toc = gpst2time(eph.week, toc); eph.toc = gpst2time(eph.week, toc);
eph.ttr = rtcm->time; eph.ttr = rtcm->time;
@ -1535,7 +1535,7 @@ int decode_type1039(rtcm_t *rtcm __attribute__((unused)))
/* decode type 1044: qzss ephemerides (ref [15]) -----------------------------*/ /* decode type 1044: qzss ephemerides (ref [15]) -----------------------------*/
int decode_type1044(rtcm_t *rtcm) int decode_type1044(rtcm_t *rtcm, int custom_year)
{ {
eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0, 0.0}, {0, 0.0}, {0, 0.0}, eph_t eph = {0, -1, -1, 0, 0, 0, 0, 0, {0, 0.0}, {0, 0.0}, {0, 0.0},
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
@ -1628,7 +1628,7 @@ int decode_type1044(rtcm_t *rtcm)
return -1; return -1;
} }
eph.sat = sat; eph.sat = sat;
eph.week = adjgpsweek(week); eph.week = adjgpsweek(week, custom_year);
eph.toe = gpst2time(eph.week, eph.toes); eph.toe = gpst2time(eph.week, eph.toes);
eph.toc = gpst2time(eph.week, toc); eph.toc = gpst2time(eph.week, toc);
eph.ttr = rtcm->time; eph.ttr = rtcm->time;

View File

@ -2114,27 +2114,45 @@ double time2doy(gtime_t t)
* args : int week I not-adjusted gps week number * args : int week I not-adjusted gps week number
* return : adjusted gps week number * return : adjusted gps week number
*-----------------------------------------------------------------------------*/ *-----------------------------------------------------------------------------*/
int adjgpsweek(int week) int adjgpsweek(int week, int custom_year)
{ {
// int w; // int w;
// if (week < 512) // if (week < 512)
// { // {
// //assume receiver date > 7 april 2019 // //assume receiver date > 7 april 2019
// w = week + 2048; //add weeks from 6-january-1980 to week rollover in 7 april 2019 // w = week + 2048; //add weeks from 6-january-1980 to week rollover in 6 april 2019
// } // }
// else // else
// { // {
// //assume receiver date < 7 april 2019 // //assume receiver date < 7 april 2019
// w = week + 1024; //add weeks from 6-january-1980 to week rollover in 22 august 2019 // w = week + 1024; //add weeks from 6-january-1980 to week rollover in 21 august 1999
// } // }
int w; int w;
(void)time2gpst(utc2gpst(timeget()), &w); if (custom_year == 0)
if (w < 1560)
{ {
w = 1560; /* use 2009/12/1 if time is earlier than 2009/12/1 */ (void)time2gpst(utc2gpst(timeget()), &w);
if (w < 1560)
{
w = 1560; /* use 2009/12/1 if time is earlier than 2009/12/1 */
}
return week + (w - week + 512) / 1024 * 1024;
}
else
{
if (custom_year >= 2019)
{
w = week + 2048; //add weeks from 6-january-1980 to week rollover in 6 april 2019
}
else if (custom_year < 2019 and custom_year >= 1999)
{
w = week + 1024; //add weeks from 6-january-1980 to week rollover in 21 august 1999
}
else
{
w = week; //no rollover
}
return w;
} }
return week + (w - week + 512) / 1024 * 1024;
// return w;
} }

View File

@ -189,7 +189,7 @@ double utc2gmst(gtime_t t, double ut1_utc);
void time2str(gtime_t t, char *s, int n); void time2str(gtime_t t, char *s, int n);
char *time_str(gtime_t t, int n); char *time_str(gtime_t t, int n);
double time2doy(gtime_t t); double time2doy(gtime_t t);
int adjgpsweek(int week); int adjgpsweek(int week, int custom_year);
unsigned int tickget(); unsigned int tickget();
void sleepms(int ms); void sleepms(int ms);
void deg2dms(double deg, double *dms, int ndec); void deg2dms(double deg, double *dms, int ndec);

View File

@ -82,12 +82,12 @@ FlexibandSignalSource::FlexibandSignalSource(ConfigurationInterface* configurati
// create I, Q -> gr_complex type conversion blocks // create I, Q -> gr_complex type conversion blocks
for (int n = 0; n < (n_channels_ * 2); n++) for (int n = 0; n < (n_channels_ * 2); n++)
{ {
char_to_float.push_back(gr::blocks::char_to_float::make()); char_to_float.emplace_back(gr::blocks::char_to_float::make());
} }
for (int n = 0; n < n_channels_; n++) for (int n = 0; n < n_channels_; n++)
{ {
float_to_complex_.push_back(gr::blocks::float_to_complex::make()); float_to_complex_.emplace_back(gr::blocks::float_to_complex::make());
null_sinks_.push_back(gr::blocks::null_sink::make(sizeof(gr_complex))); null_sinks_.push_back(gr::blocks::null_sink::make(sizeof(gr_complex)));
} }

View File

@ -116,6 +116,8 @@ ControlThread::ControlThread(const std::shared_ptr<ConfigurationInterface> &conf
void ControlThread::init() void ControlThread::init()
{ {
//OPTIONAL: specify a custom year to override the system time in order to postprocess old gnss records and avoid wrong week rollover
custom_year_ = configuration_->property("GNSS-SDR.custom_year", 0);
// Instantiates a control queue, a GNSS flowgraph, and a control message factory // Instantiates a control queue, a GNSS flowgraph, and a control message factory
control_queue_ = std::make_shared<Concurrent_Queue<pmt::pmt_t>>(); control_queue_ = std::make_shared<Concurrent_Queue<pmt::pmt_t>>();
cmd_interface_.set_msg_queue(control_queue_); // set also the queue pointer for the telecommand thread cmd_interface_.set_msg_queue(control_queue_); // set also the queue pointer for the telecommand thread
@ -942,7 +944,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
std::map<int, Gps_Ephemeris> gps_eph_map = pvt_ptr->get_gps_ephemeris(); std::map<int, Gps_Ephemeris> gps_eph_map = pvt_ptr->get_gps_ephemeris();
for (auto &it : gps_eph_map) for (auto &it : gps_eph_map)
{ {
eph_t rtklib_eph = eph_to_rtklib(it.second); eph_t rtklib_eph = eph_to_rtklib(it.second, custom_year_);
std::array<double, 3> r_sat{}; std::array<double, 3> r_sat{};
double clock_bias_s; double clock_bias_s;
double sat_pos_variance_m2; double sat_pos_variance_m2;
@ -967,7 +969,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
std::map<int, Galileo_Ephemeris> gal_eph_map = pvt_ptr->get_galileo_ephemeris(); std::map<int, Galileo_Ephemeris> gal_eph_map = pvt_ptr->get_galileo_ephemeris();
for (auto &it : gal_eph_map) for (auto &it : gal_eph_map)
{ {
eph_t rtklib_eph = eph_to_rtklib(it.second); eph_t rtklib_eph = eph_to_rtklib(it.second, custom_year_);
std::array<double, 3> r_sat{}; std::array<double, 3> r_sat{};
double clock_bias_s; double clock_bias_s;
double sat_pos_variance_m2; double sat_pos_variance_m2;

View File

@ -171,6 +171,7 @@ private:
std::shared_ptr<GNSSFlowgraph> flowgraph_; std::shared_ptr<GNSSFlowgraph> flowgraph_;
std::shared_ptr<ConfigurationInterface> configuration_; std::shared_ptr<ConfigurationInterface> configuration_;
std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue_; std::shared_ptr<Concurrent_Queue<pmt::pmt_t>> control_queue_;
int custom_year_; //to override the system time to postprocess old gnss records and avoid wrong week rollover
bool stop_; bool stop_;
bool restart_; bool restart_;
bool delete_configuration_; bool delete_configuration_;