From 589788d2e314075c2db58532ea33ac4c128bf3f0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 6 Sep 2019 17:31:31 +0200 Subject: [PATCH 01/10] Modernize code for Viterbi decoder --- .../galileo_telemetry_decoder_gs.cc | 12 +-- .../galileo_telemetry_decoder_gs.h | 10 +-- .../telemetry_decoder/libs/CMakeLists.txt | 2 + .../telemetry_decoder/libs/convolutional.h | 78 +++++++------------ .../galileo_fnav_inav_decoder_test.cc | 18 ++--- 5 files changed, 48 insertions(+), 72 deletions(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc index 0158dad0f..50674bbb6 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.cc @@ -207,14 +207,14 @@ galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs() } -void galileo_telemetry_decoder_gs::viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits) +void galileo_telemetry_decoder_gs::viterbi_decoder(float *page_part_symbols, int32_t *page_part_bits) { Viterbi(page_part_bits, out0.data(), state0.data(), out1.data(), state1.data(), page_part_symbols, KK, nn, DataLength); } -void galileo_telemetry_decoder_gs::deinterleaver(int32_t rows, int32_t cols, const double *in, double *out) +void galileo_telemetry_decoder_gs::deinterleaver(int32_t rows, int32_t cols, const float *in, float *out) { for (int32_t r = 0; r < rows; r++) { @@ -226,10 +226,10 @@ void galileo_telemetry_decoder_gs::deinterleaver(int32_t rows, int32_t cols, con } -void galileo_telemetry_decoder_gs::decode_INAV_word(double *page_part_symbols, int32_t frame_length) +void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, int32_t frame_length) { // 1. De-interleave - std::vector page_part_symbols_deint(frame_length); + std::vector page_part_symbols_deint(frame_length); deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_deint.data()); // 2. Viterbi decoder @@ -318,10 +318,10 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(double *page_part_symbols, i } -void galileo_telemetry_decoder_gs::decode_FNAV_word(double *page_symbols, int32_t frame_length) +void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t frame_length) { // 1. De-interleave - std::vector page_symbols_deint(frame_length); + std::vector page_symbols_deint(frame_length); deinterleaver(GALILEO_FNAV_INTERLEAVER_ROWS, GALILEO_FNAV_INTERLEAVER_COLS, page_symbols, page_symbols_deint.data()); // 2. Viterbi decoder diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h index fe042c321..d6b81b658 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_telemetry_decoder_gs.h @@ -81,12 +81,12 @@ private: galileo_telemetry_decoder_gs(const Gnss_Satellite &satellite, int frame_type, bool dump); - void viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits); + void viterbi_decoder(float *page_part_symbols, int32_t *page_part_bits); - void deinterleaver(int32_t rows, int32_t cols, const double *in, double *out); + void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out); - void decode_INAV_word(double *page_part_symbols, int32_t frame_length); - void decode_FNAV_word(double *page_symbols, int32_t frame_length); + void decode_INAV_word(float *page_part_symbols, int32_t frame_length); + void decode_FNAV_word(float *page_symbols, int32_t frame_length); int d_frame_type; int32_t d_bits_per_preamble; @@ -96,7 +96,7 @@ private: uint32_t d_PRN_code_period_ms; uint32_t d_required_symbols; uint32_t d_frame_length_symbols; - std::vector d_page_part_symbols; + std::vector d_page_part_symbols; boost::circular_buffer d_symbol_history; diff --git a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt index a802b970c..6bddd2c8c 100644 --- a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt @@ -39,6 +39,8 @@ add_library(telemetry_decoder_libs ) target_link_libraries(telemetry_decoder_libs + PUBLIC + Volkgnsssdr::volkgnsssdr PRIVATE Gflags::gflags Glog::glog diff --git a/src/algorithms/telemetry_decoder/libs/convolutional.h b/src/algorithms/telemetry_decoder/libs/convolutional.h index cc775110b..b1b599715 100644 --- a/src/algorithms/telemetry_decoder/libs/convolutional.h +++ b/src/algorithms/telemetry_decoder/libs/convolutional.h @@ -41,7 +41,9 @@ #ifndef GNSS_SDR_CONVOLUTIONAL_H_ #define GNSS_SDR_CONVOLUTIONAL_H_ -#include // for calloc +#include +#include +#include /* define constants used throughout the library */ const float MAXLOG = 1e7; /* Define infinity */ @@ -57,7 +59,7 @@ const float MAXLOG = 1e7; /* Define infinity */ * * This function is used by nsc_enc_bit(), rsc_enc_bit(), and rsc_tail() */ -inline static int parity_counter(int symbol, int length) +inline int parity_counter(int symbol, int length) { int counter; int temp_parity = 0; @@ -85,7 +87,7 @@ inline static int parity_counter(int symbol, int length) * * This function is used by nsc_transit() */ -inline static int nsc_enc_bit(int state_out_p[], +inline int nsc_enc_bit(int state_out_p[], int input, int state_in, const int g[], @@ -115,7 +117,7 @@ inline static int nsc_enc_bit(int state_out_p[], /*! * \brief Function that creates the transit and output vectors */ -inline static void nsc_transit(int output_p[], +inline void nsc_transit(int output_p[], int trans_p[], int input, int g[], @@ -144,7 +146,7 @@ inline static void nsc_transit(int output_p[], * \param[in] nn The length of the received vector * */ -inline static float Gamma(const float rec_array[], +inline float Gamma(const float rec_array[], int symbol, int nn) { @@ -176,24 +178,20 @@ inline static float Gamma(const float rec_array[], * \param[out] output_u_int[] Hard decisions on the data bits * */ -inline static void Viterbi(int output_u_int[], +inline void Viterbi(int output_u_int[], const int out0[], const int state0[], const int out1[], const int state1[], - const double input_c[], + const float input_c[], int KK, int nn, int LL) { int i, t, state, mm, states; int number_symbols; + uint32_t max_index; float metric; - float *prev_section, *next_section; - int *prev_bit; - int *prev_state; - float *metric_c; /* Set of all possible branch metrics */ - float *rec_array; /* Received values for one trellis section */ float max_val; /* some derived constants */ @@ -201,34 +199,24 @@ inline static void Viterbi(int output_u_int[], states = 1 << mm; /* 2^mm */ number_symbols = 1 << nn; /* 2^nn */ - /* dynamically allocate memory */ - prev_section = static_cast(calloc(states, sizeof(float))); - next_section = static_cast(calloc(states, sizeof(float))); - prev_bit = static_cast(calloc(states * (LL + mm), sizeof(int))); - prev_state = static_cast(calloc(states * (LL + mm), sizeof(int))); - rec_array = static_cast(calloc(nn, sizeof(float))); - metric_c = static_cast(calloc(number_symbols, sizeof(float))); + std::vector prev_section(states, -MAXLOG); + std::vector next_section(states, -MAXLOG); + std::vector prev_bit(states * (LL + mm), 0); + std::vector prev_state(states * (LL + mm), 0); + std::vector rec_array(nn); + std::vector metric_c(number_symbols); - /* initialize trellis */ - for (state = 0; state < states; state++) - { - prev_section[state] = -MAXLOG; - next_section[state] = -MAXLOG; - } - prev_section[0] = 0; /* start in all-zeros state */ + prev_section[0] = 0.0; /* start in all-zeros state */ /* go through trellis */ for (t = 0; t < LL + mm; t++) { - for (i = 0; i < nn; i++) - { - rec_array[i] = static_cast(input_c[nn * t + i]); - } + rec_array.assign(input_c + nn * t, input_c + nn * t + (nn - 1)); /* precompute all possible branch metrics */ for (i = 0; i < number_symbols; i++) { - metric_c[i] = Gamma(rec_array, i, nn); + metric_c[i] = Gamma(rec_array.data(), i, nn); } /* step through all states */ @@ -258,19 +246,13 @@ inline static void Viterbi(int output_u_int[], } /* normalize */ - max_val = 0; - for (state = 0; state < states; state++) - { - if (next_section[state] > max_val) - { - max_val = next_section[state]; - } - } - for (state = 0; state < states; state++) - { - prev_section[state] = next_section[state] - max_val; - next_section[state] = -MAXLOG; - } + volk_gnsssdr_32f_index_max_32u(&max_index, next_section.data(), states); + max_val = next_section[max_index]; + prev_section = next_section; + std::transform(prev_section.begin(), prev_section.end(), prev_section.begin(), + [&max_val](const auto& prev_ele) { return (prev_ele - max_val); }); + + std::fill(next_section.begin(), next_section.end(), -MAXLOG); } /* trace-back operation */ @@ -287,14 +269,6 @@ inline static void Viterbi(int output_u_int[], output_u_int[t] = prev_bit[t * states + state]; state = prev_state[t * states + state]; } - - /* free the dynamically allocated memory */ - free(prev_section); - free(next_section); - free(prev_bit); - free(prev_state); - free(rec_array); - free(metric_c); } diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc index c3d901676..43c71ff17 100644 --- a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc @@ -54,14 +54,14 @@ public: const int32_t KK = 7; // Constraint Length int32_t mm = KK - 1; int32_t flag_even_word_arrived; - void viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits, int32_t _datalength) + void viterbi_decoder(float *page_part_symbols, int32_t *page_part_bits, int32_t _datalength) { Viterbi(page_part_bits, out0, state0, out1, state1, page_part_symbols, KK, nn, _datalength); } - void deinterleaver(int32_t rows, int32_t cols, const double *in, double *out) + void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out) { for (int32_t r = 0; r < rows; r++) { @@ -73,10 +73,10 @@ public: } - bool decode_INAV_word(double *page_part_symbols, int32_t frame_length) + bool decode_INAV_word(float *page_part_symbols, int32_t frame_length) { // 1. De-interleave - auto *page_part_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment())); + auto *page_part_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(float), volk_gnsssdr_get_alignment())); deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_deint); // 2. Viterbi decoder @@ -134,10 +134,10 @@ public: return crc_ok; } - bool decode_FNAV_word(double *page_symbols, int32_t frame_length) + bool decode_FNAV_word(float *page_symbols, int32_t frame_length) { // 1. De-interleave - auto *page_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(double), volk_gnsssdr_get_alignment())); + auto *page_symbols_deint = static_cast(volk_gnsssdr_malloc(frame_length * sizeof(float), volk_gnsssdr_get_alignment())); deinterleaver(GALILEO_FNAV_INTERLEAVER_ROWS, GALILEO_FNAV_INTERLEAVER_COLS, page_symbols, page_symbols_deint); // 2. Viterbi decoder @@ -215,7 +215,7 @@ TEST_F(Galileo_FNAV_INAV_test, ValidationOfResults) start = std::chrono::system_clock::now(); int repetitions = 10; // FNAV FULLY ENCODED FRAME - double FNAV_frame[488] = {-1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + float FNAV_frame[488] = {-1, 1, -1, -1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, -1, -1, 1, -1, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, -1, -1, -1, -1, @@ -240,7 +240,7 @@ TEST_F(Galileo_FNAV_INAV_test, ValidationOfResults) // INAV FULLY ENCODED FRAME - double INAV_frame_even[240] = {-1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + float INAV_frame_even[240] = {-1, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, 1, -1, -1, -1, 1, -1, @@ -256,7 +256,7 @@ TEST_F(Galileo_FNAV_INAV_test, ValidationOfResults) -1, -1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1}; - double INAV_frame_odd[240] = {1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + float INAV_frame_odd[240] = {1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, 1, -1, -1, 1, From 889e7b9695e7369c5577b8c3cd50b1407788e6e2 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Fri, 6 Sep 2019 18:02:40 +0200 Subject: [PATCH 02/10] Adding configuration option to disable PVT observables clock correction --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 2 + .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 3738 +++++++++-------- .../PVT/gnuradio_blocks/rtklib_pvt_gs.h | 1 + src/algorithms/PVT/libs/pvt_conf.cc | 1 + src/algorithms/PVT/libs/pvt_conf.h | 1 + 5 files changed, 1927 insertions(+), 1816 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index dff7a9f15..bb07aade0 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -769,6 +769,8 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration, // Show time in local zone pvt_output_parameters.show_local_time_zone = configuration->property(role + ".show_local_time_zone", false); + //enable or disable rx clock corection in observables + pvt_output_parameters.enable_rx_clock_correction = configuration->property(role + ".enable_rx_clock_correction", true); // make PVT object pvt_ = rtklib_make_pvt_gs(in_streams_, pvt_output_parameters, rtk); DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")"; diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index a93b63a1e..c00144f6b 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -457,18 +457,32 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_local_time_str = std::string(" ") + time_zone_abrv + " (UTC " + utc_diff_str.substr(0, 3) + ":" + utc_diff_str.substr(3, 2) + ")"; } - // user PVT solver - d_user_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); - d_user_pvt_solver->set_averaging_depth(1); - - // internal PVT solver, mainly used to estimate the receiver clock - rtk_t internal_rtk = rtk; - internal_rtk.opt.mode = PMODE_SINGLE; // use single positioning mode in internal PVT solver - d_internal_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, false, false, internal_rtk); - d_internal_pvt_solver->set_averaging_depth(1); d_waiting_obs_block_rx_clock_offset_correction_msg = false; + d_enable_rx_clock_correction = conf_.enable_rx_clock_correction; + + if (d_enable_rx_clock_correction == true) + { + //setup two PVT solvers: internal solver for rx clock and user solver + // user PVT solver + d_user_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); + d_user_pvt_solver->set_averaging_depth(1); + + // internal PVT solver, mainly used to estimate the receiver clock + rtk_t internal_rtk = rtk; + internal_rtk.opt.mode = PMODE_SINGLE; // use single positioning mode in internal PVT solver + d_internal_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, false, false, internal_rtk); + d_internal_pvt_solver->set_averaging_depth(1); + } + else + { + //only one solver, customized by the user options + d_internal_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); + d_internal_pvt_solver->set_averaging_depth(1); + d_user_pvt_solver = d_internal_pvt_solver; + } + start = std::chrono::system_clock::now(); } @@ -1100,7 +1114,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) } } d_internal_pvt_solver->gps_ephemeris_map[gps_eph->i_satellite_PRN] = *gps_eph; - d_user_pvt_solver->gps_ephemeris_map[gps_eph->i_satellite_PRN] = *gps_eph; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->gps_ephemeris_map[gps_eph->i_satellite_PRN] = *gps_eph; + } } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) { @@ -1108,7 +1125,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr gps_iono; gps_iono = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->gps_iono = *gps_iono; - d_user_pvt_solver->gps_iono = *gps_iono; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->gps_iono = *gps_iono; + } DLOG(INFO) << "New IONO record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1117,7 +1137,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr gps_utc_model; gps_utc_model = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->gps_utc_model = *gps_utc_model; - d_user_pvt_solver->gps_utc_model = *gps_utc_model; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->gps_utc_model = *gps_utc_model; + } DLOG(INFO) << "New UTC record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1173,7 +1196,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) } } d_internal_pvt_solver->gps_cnav_ephemeris_map[gps_cnav_ephemeris->i_satellite_PRN] = *gps_cnav_ephemeris; - d_user_pvt_solver->gps_cnav_ephemeris_map[gps_cnav_ephemeris->i_satellite_PRN] = *gps_cnav_ephemeris; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->gps_cnav_ephemeris_map[gps_cnav_ephemeris->i_satellite_PRN] = *gps_cnav_ephemeris; + } DLOG(INFO) << "New GPS CNAV ephemeris record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1182,7 +1208,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr gps_cnav_iono; gps_cnav_iono = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->gps_cnav_iono = *gps_cnav_iono; - d_user_pvt_solver->gps_cnav_iono = *gps_cnav_iono; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->gps_cnav_iono = *gps_cnav_iono; + } DLOG(INFO) << "New CNAV IONO record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1191,7 +1220,9 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr gps_cnav_utc_model; gps_cnav_utc_model = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->gps_cnav_utc_model = *gps_cnav_utc_model; - d_user_pvt_solver->gps_cnav_utc_model = *gps_cnav_utc_model; + { + d_user_pvt_solver->gps_cnav_utc_model = *gps_cnav_utc_model; + } DLOG(INFO) << "New CNAV UTC record has arrived "; } @@ -1201,7 +1232,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr gps_almanac; gps_almanac = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->gps_almanac_map[gps_almanac->i_satellite_PRN] = *gps_almanac; - d_user_pvt_solver->gps_almanac_map[gps_almanac->i_satellite_PRN] = *gps_almanac; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->gps_almanac_map[gps_almanac->i_satellite_PRN] = *gps_almanac; + } DLOG(INFO) << "New GPS almanac record has arrived "; } @@ -1270,7 +1304,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) } } d_internal_pvt_solver->galileo_ephemeris_map[galileo_eph->i_satellite_PRN] = *galileo_eph; - d_user_pvt_solver->galileo_ephemeris_map[galileo_eph->i_satellite_PRN] = *galileo_eph; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->galileo_ephemeris_map[galileo_eph->i_satellite_PRN] = *galileo_eph; + } } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) { @@ -1278,7 +1315,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr galileo_iono; galileo_iono = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->galileo_iono = *galileo_iono; - d_user_pvt_solver->galileo_iono = *galileo_iono; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->galileo_iono = *galileo_iono; + } DLOG(INFO) << "New IONO record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1287,7 +1327,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr galileo_utc_model; galileo_utc_model = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->galileo_utc_model = *galileo_utc_model; - d_user_pvt_solver->galileo_utc_model = *galileo_utc_model; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->galileo_utc_model = *galileo_utc_model; + } DLOG(INFO) << "New UTC record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1303,17 +1346,26 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) if (sv1.i_satellite_PRN != 0) { d_internal_pvt_solver->galileo_almanac_map[sv1.i_satellite_PRN] = sv1; - d_user_pvt_solver->galileo_almanac_map[sv1.i_satellite_PRN] = sv1; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->galileo_almanac_map[sv1.i_satellite_PRN] = sv1; + } } if (sv2.i_satellite_PRN != 0) { d_internal_pvt_solver->galileo_almanac_map[sv2.i_satellite_PRN] = sv2; - d_user_pvt_solver->galileo_almanac_map[sv2.i_satellite_PRN] = sv2; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->galileo_almanac_map[sv2.i_satellite_PRN] = sv2; + } } if (sv3.i_satellite_PRN != 0) { d_internal_pvt_solver->galileo_almanac_map[sv3.i_satellite_PRN] = sv3; - d_user_pvt_solver->galileo_almanac_map[sv3.i_satellite_PRN] = sv3; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->galileo_almanac_map[sv3.i_satellite_PRN] = sv3; + } } DLOG(INFO) << "New Galileo Almanac data have arrived "; } @@ -1324,7 +1376,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) galileo_alm = boost::any_cast>(pmt::any_ref(msg)); // update/insert new almanac record to the global almanac map d_internal_pvt_solver->galileo_almanac_map[galileo_alm->i_satellite_PRN] = *galileo_alm; - d_user_pvt_solver->galileo_almanac_map[galileo_alm->i_satellite_PRN] = *galileo_alm; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->galileo_almanac_map[galileo_alm->i_satellite_PRN] = *galileo_alm; + } } // **************** GLONASS GNAV Telemetry ************************** @@ -1405,7 +1460,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) } } d_internal_pvt_solver->glonass_gnav_ephemeris_map[glonass_gnav_eph->i_satellite_PRN] = *glonass_gnav_eph; - d_user_pvt_solver->glonass_gnav_ephemeris_map[glonass_gnav_eph->i_satellite_PRN] = *glonass_gnav_eph; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->glonass_gnav_ephemeris_map[glonass_gnav_eph->i_satellite_PRN] = *glonass_gnav_eph; + } } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) { @@ -1413,7 +1471,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr glonass_gnav_utc_model; glonass_gnav_utc_model = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->glonass_gnav_utc_model = *glonass_gnav_utc_model; - d_user_pvt_solver->glonass_gnav_utc_model = *glonass_gnav_utc_model; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->glonass_gnav_utc_model = *glonass_gnav_utc_model; + } DLOG(INFO) << "New GLONASS GNAV UTC record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1422,7 +1483,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr glonass_gnav_almanac; glonass_gnav_almanac = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->glonass_gnav_almanac = *glonass_gnav_almanac; - d_user_pvt_solver->glonass_gnav_almanac = *glonass_gnav_almanac; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->glonass_gnav_almanac = *glonass_gnav_almanac; + } DLOG(INFO) << "New GLONASS GNAV Almanac has arrived " << ", GLONASS GNAV Slot Number =" << glonass_gnav_almanac->d_n_A; } @@ -1469,7 +1533,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) } } d_internal_pvt_solver->beidou_dnav_ephemeris_map[bds_dnav_eph->i_satellite_PRN] = *bds_dnav_eph; - d_user_pvt_solver->beidou_dnav_ephemeris_map[bds_dnav_eph->i_satellite_PRN] = *bds_dnav_eph; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->beidou_dnav_ephemeris_map[bds_dnav_eph->i_satellite_PRN] = *bds_dnav_eph; + } } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) { @@ -1477,7 +1544,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr bds_dnav_iono; bds_dnav_iono = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->beidou_dnav_iono = *bds_dnav_iono; - d_user_pvt_solver->beidou_dnav_iono = *bds_dnav_iono; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->beidou_dnav_iono = *bds_dnav_iono; + } DLOG(INFO) << "New BeiDou DNAV IONO record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1486,7 +1556,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr bds_dnav_utc_model; bds_dnav_utc_model = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->beidou_dnav_utc_model = *bds_dnav_utc_model; - d_user_pvt_solver->beidou_dnav_utc_model = *bds_dnav_utc_model; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->beidou_dnav_utc_model = *bds_dnav_utc_model; + } DLOG(INFO) << "New BeiDou DNAV UTC record has arrived "; } else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) @@ -1495,7 +1568,10 @@ void rtklib_pvt_gs::msg_handler_telemetry(const pmt::pmt_t& msg) std::shared_ptr bds_dnav_almanac; bds_dnav_almanac = boost::any_cast>(pmt::any_ref(msg)); d_internal_pvt_solver->beidou_dnav_almanac_map[bds_dnav_almanac->i_satellite_PRN] = *bds_dnav_almanac; - d_user_pvt_solver->beidou_dnav_almanac_map[bds_dnav_almanac->i_satellite_PRN] = *bds_dnav_almanac; + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->beidou_dnav_almanac_map[bds_dnav_almanac->i_satellite_PRN] = *bds_dnav_almanac; + } DLOG(INFO) << "New BeiDou DNAV almanac record has arrived "; } else @@ -1554,13 +1630,15 @@ void rtklib_pvt_gs::clear_ephemeris() d_internal_pvt_solver->galileo_almanac_map.clear(); d_internal_pvt_solver->beidou_dnav_ephemeris_map.clear(); d_internal_pvt_solver->beidou_dnav_almanac_map.clear(); - - d_user_pvt_solver->gps_ephemeris_map.clear(); - d_user_pvt_solver->gps_almanac_map.clear(); - d_user_pvt_solver->galileo_ephemeris_map.clear(); - d_user_pvt_solver->galileo_almanac_map.clear(); - d_user_pvt_solver->beidou_dnav_ephemeris_map.clear(); - d_user_pvt_solver->beidou_dnav_almanac_map.clear(); + if (d_enable_rx_clock_correction == true) + { + d_user_pvt_solver->gps_ephemeris_map.clear(); + d_user_pvt_solver->gps_almanac_map.clear(); + d_user_pvt_solver->galileo_ephemeris_map.clear(); + d_user_pvt_solver->galileo_almanac_map.clear(); + d_user_pvt_solver->beidou_dnav_ephemeris_map.clear(); + d_user_pvt_solver->beidou_dnav_almanac_map.clear(); + } } @@ -1648,16 +1726,33 @@ bool rtklib_pvt_gs::get_latest_PVT(double* longitude_deg, double* course_over_ground_deg, time_t* UTC_time) const { - if (d_user_pvt_solver->is_valid_position()) + if (d_enable_rx_clock_correction == true) { - *latitude_deg = d_user_pvt_solver->get_latitude(); - *longitude_deg = d_user_pvt_solver->get_longitude(); - *height_m = d_user_pvt_solver->get_height(); - *ground_speed_kmh = d_user_pvt_solver->get_speed_over_ground() * 3600.0 / 1000.0; - *course_over_ground_deg = d_user_pvt_solver->get_course_over_ground(); - *UTC_time = convert_to_time_t(d_user_pvt_solver->get_position_UTC_time()); + if (d_user_pvt_solver->is_valid_position()) + { + *latitude_deg = d_user_pvt_solver->get_latitude(); + *longitude_deg = d_user_pvt_solver->get_longitude(); + *height_m = d_user_pvt_solver->get_height(); + *ground_speed_kmh = d_user_pvt_solver->get_speed_over_ground() * 3600.0 / 1000.0; + *course_over_ground_deg = d_user_pvt_solver->get_course_over_ground(); + *UTC_time = convert_to_time_t(d_user_pvt_solver->get_position_UTC_time()); - return true; + return true; + } + } + else + { + if (d_internal_pvt_solver->is_valid_position()) + { + *latitude_deg = d_internal_pvt_solver->get_latitude(); + *longitude_deg = d_internal_pvt_solver->get_longitude(); + *height_m = d_internal_pvt_solver->get_height(); + *ground_speed_kmh = d_internal_pvt_solver->get_speed_over_ground() * 3600.0 / 1000.0; + *course_over_ground_deg = d_internal_pvt_solver->get_course_over_ground(); + *UTC_time = convert_to_time_t(d_internal_pvt_solver->get_position_UTC_time()); + + return true; + } } return false; @@ -1890,6 +1985,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } // ############ 2 COMPUTE THE PVT ################################ + bool flag_pvt_valid = false; if (gnss_observables_map.empty() == false) { // LOG(INFO) << "diff raw obs time: " << gnss_observables_map.cbegin()->second.RX_time * 1000.0 - old_time_debug; @@ -1910,33 +2006,41 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } else { - d_waiting_obs_block_rx_clock_offset_correction_msg = false; - gnss_observables_map_t0 = gnss_observables_map_t1; - apply_rx_clock_offset(gnss_observables_map, Rx_clock_offset_s); - gnss_observables_map_t1 = gnss_observables_map; - - // ### select the rx_time and interpolate observables at that time - if (!gnss_observables_map_t0.empty()) + if (d_enable_rx_clock_correction == true) { - uint32_t t0_int_ms = static_cast(gnss_observables_map_t0.cbegin()->second.RX_time * 1000.0); - uint32_t adjust_next_20ms = 20 - t0_int_ms % 20; - current_RX_time_ms = t0_int_ms + adjust_next_20ms; + d_waiting_obs_block_rx_clock_offset_correction_msg = false; + gnss_observables_map_t0 = gnss_observables_map_t1; + apply_rx_clock_offset(gnss_observables_map, Rx_clock_offset_s); + gnss_observables_map_t1 = gnss_observables_map; - if (current_RX_time_ms % d_output_rate_ms == 0) + // ### select the rx_time and interpolate observables at that time + if (!gnss_observables_map_t0.empty()) { - d_rx_time = static_cast(current_RX_time_ms) / 1000.0; - // std::cout << " obs time t0: " << gnss_observables_map_t0.cbegin()->second.RX_time - // << " t1: " << gnss_observables_map_t1.cbegin()->second.RX_time - // << " interp time: " << d_rx_time << std::endl; - gnss_observables_map = interpolate_observables(gnss_observables_map_t0, - gnss_observables_map_t1, - d_rx_time); - flag_compute_pvt_output = true; - // d_rx_time = current_RX_time; - // std::cout.precision(17); - // std::cout << "current_RX_time: " << current_RX_time << " map time: " << gnss_observables_map.begin()->second.RX_time << std::endl; + uint32_t t0_int_ms = static_cast(gnss_observables_map_t0.cbegin()->second.RX_time * 1000.0); + uint32_t adjust_next_20ms = 20 - t0_int_ms % 20; + current_RX_time_ms = t0_int_ms + adjust_next_20ms; + + if (current_RX_time_ms % d_output_rate_ms == 0) + { + d_rx_time = static_cast(current_RX_time_ms) / 1000.0; + // std::cout << " obs time t0: " << gnss_observables_map_t0.cbegin()->second.RX_time + // << " t1: " << gnss_observables_map_t1.cbegin()->second.RX_time + // << " interp time: " << d_rx_time << std::endl; + gnss_observables_map = interpolate_observables(gnss_observables_map_t0, + gnss_observables_map_t1, + d_rx_time); + flag_compute_pvt_output = true; + // d_rx_time = current_RX_time; + // std::cout.precision(17); + // std::cout << "current_RX_time: " << current_RX_time << " map time: " << gnss_observables_map.begin()->second.RX_time << std::endl; + } } } + else + { + flag_compute_pvt_output = false; + flag_pvt_valid = true; + } } } // debug code @@ -1948,130 +2052,133 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item // compute on the fly PVT solution if (flag_compute_pvt_output == true) { - if (d_user_pvt_solver->get_PVT(gnss_observables_map, false)) + flag_pvt_valid = d_user_pvt_solver->get_PVT(gnss_observables_map, false); + } + + if (flag_pvt_valid == true) + { + double Rx_clock_offset_s = d_user_pvt_solver->get_time_offset_s(); + if (d_enable_rx_clock_correction == true and fabs(Rx_clock_offset_s) > 0.000001) // 1us !! { - double Rx_clock_offset_s = d_user_pvt_solver->get_time_offset_s(); - if (fabs(Rx_clock_offset_s) > 0.000001) // 1us !! + LOG(INFO) << "Warning: Rx clock offset at interpolated RX time: " << Rx_clock_offset_s * 1000.0 << "[ms]" + << " at RX time: " << static_cast(d_rx_time * 1000.0) << " [ms]"; + } + else + { + DLOG(INFO) << "Rx clock offset at interpolated RX time: " << Rx_clock_offset_s * 1000.0 << "[s]" + << " at RX time: " << static_cast(d_rx_time * 1000.0) << " [ms]"; + // Optional debug code: export observables snapshot for rtklib unit testing + // std::cout << "step 1: save gnss_synchro map" << std::endl; + // save_gnss_synchro_map_xml("./gnss_synchro_map.xml"); + // getchar(); // stop the execution + // end debug + if (d_display_rate_ms != 0) { - LOG(INFO) << "Warning: Rx clock offset at interpolated RX time: " << Rx_clock_offset_s * 1000.0 << "[ms]" - << " at RX time: " << static_cast(d_rx_time * 1000.0) << " [ms]"; + if (current_RX_time_ms % d_display_rate_ms == 0) + { + flag_display_pvt = true; + } } - else + if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 { - DLOG(INFO) << "Rx clock offset at interpolated RX time: " << Rx_clock_offset_s * 1000.0 << "[s]" - << " at RX time: " << static_cast(d_rx_time * 1000.0) << " [ms]"; - // Optional debug code: export observables snapshot for rtklib unit testing - // std::cout << "step 1: save gnss_synchro map" << std::endl; - // save_gnss_synchro_map_xml("./gnss_synchro_map.xml"); - // getchar(); // stop the execution - // end debug - if (d_display_rate_ms != 0) + if (current_RX_time_ms % d_rtcm_MT1019_rate_ms == 0) { - if (current_RX_time_ms % d_display_rate_ms == 0) - { - flag_display_pvt = true; - } + flag_write_RTCM_1019_output = true; } - if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + } + if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + if (current_RX_time_ms % d_rtcm_MT1020_rate_ms == 0) { - if (current_RX_time_ms % d_rtcm_MT1019_rate_ms == 0) - { - flag_write_RTCM_1019_output = true; - } + flag_write_RTCM_1020_output = true; } - if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + } + if (d_rtcm_MT1045_rate_ms != 0) + { + if (current_RX_time_ms % d_rtcm_MT1045_rate_ms == 0) { - if (current_RX_time_ms % d_rtcm_MT1020_rate_ms == 0) - { - flag_write_RTCM_1020_output = true; - } + flag_write_RTCM_1045_output = true; } - if (d_rtcm_MT1045_rate_ms != 0) + } + // TODO: RTCM 1077, 1087 and 1097 are not used, so, disable the output rates + // if (current_RX_time_ms % d_rtcm_MT1077_rate_ms==0 and d_rtcm_MT1077_rate_ms != 0) + // { + // last_RTCM_1077_output_time = current_RX_time; + // } + // if (current_RX_time_ms % d_rtcm_MT1087_rate_ms==0 and d_rtcm_MT1087_rate_ms != 0) + // { + // last_RTCM_1087_output_time = current_RX_time; + // } + // if (current_RX_time_ms % d_rtcm_MT1097_rate_ms==0 and d_rtcm_MT1097_rate_ms != 0) + // { + // last_RTCM_1097_output_time = current_RX_time; + // } + if (d_rtcm_MSM_rate_ms != 0) + { + if (current_RX_time_ms % d_rtcm_MSM_rate_ms == 0) { - if (current_RX_time_ms % d_rtcm_MT1045_rate_ms == 0) - { - flag_write_RTCM_1045_output = true; - } + flag_write_RTCM_MSM_output = true; } - // TODO: RTCM 1077, 1087 and 1097 are not used, so, disable the output rates - // if (current_RX_time_ms % d_rtcm_MT1077_rate_ms==0 and d_rtcm_MT1077_rate_ms != 0) - // { - // last_RTCM_1077_output_time = current_RX_time; - // } - // if (current_RX_time_ms % d_rtcm_MT1087_rate_ms==0 and d_rtcm_MT1087_rate_ms != 0) - // { - // last_RTCM_1087_output_time = current_RX_time; - // } - // if (current_RX_time_ms % d_rtcm_MT1097_rate_ms==0 and d_rtcm_MT1097_rate_ms != 0) - // { - // last_RTCM_1097_output_time = current_RX_time; - // } - if (d_rtcm_MSM_rate_ms != 0) + } + if (d_rinexobs_rate_ms != 0) + { + if (current_RX_time_ms % static_cast(d_rinexobs_rate_ms) == 0) { - if (current_RX_time_ms % d_rtcm_MSM_rate_ms == 0) - { - flag_write_RTCM_MSM_output = true; - } - } - if (d_rinexobs_rate_ms != 0) - { - if (current_RX_time_ms % static_cast(d_rinexobs_rate_ms) == 0) - { - flag_write_RINEX_obs_output = true; - } + flag_write_RINEX_obs_output = true; } + } - if (first_fix == true) + if (first_fix == true) + { + if (d_show_local_time_zone) { - if (d_show_local_time_zone) - { - boost::posix_time::ptime time_first_solution = d_user_pvt_solver->get_position_UTC_time() + d_utc_diff_time; - std::cout << "First position fix at " << time_first_solution << d_local_time_str; - } - else - { - std::cout << "First position fix at " << d_user_pvt_solver->get_position_UTC_time() << " UTC"; - } - std::cout << " is Lat = " << d_user_pvt_solver->get_latitude() << " [deg], Long = " << d_user_pvt_solver->get_longitude() - << " [deg], Height= " << d_user_pvt_solver->get_height() << " [m]" << std::endl; - ttff_msgbuf ttff; - ttff.mtype = 1; - end = std::chrono::system_clock::now(); - std::chrono::duration elapsed_seconds = end - start; - ttff.ttff = elapsed_seconds.count(); - send_sys_v_ttff_msg(ttff); - first_fix = false; + boost::posix_time::ptime time_first_solution = d_user_pvt_solver->get_position_UTC_time() + d_utc_diff_time; + std::cout << "First position fix at " << time_first_solution << d_local_time_str; } - if (d_kml_output_enabled) + else { - if (current_RX_time_ms % d_kml_rate_ms == 0) - { - d_kml_dump->print_position(d_user_pvt_solver, false); - } + std::cout << "First position fix at " << d_user_pvt_solver->get_position_UTC_time() << " UTC"; } - if (d_gpx_output_enabled) + std::cout << " is Lat = " << d_user_pvt_solver->get_latitude() << " [deg], Long = " << d_user_pvt_solver->get_longitude() + << " [deg], Height= " << d_user_pvt_solver->get_height() << " [m]" << std::endl; + ttff_msgbuf ttff; + ttff.mtype = 1; + end = std::chrono::system_clock::now(); + std::chrono::duration elapsed_seconds = end - start; + ttff.ttff = elapsed_seconds.count(); + send_sys_v_ttff_msg(ttff); + first_fix = false; + } + if (d_kml_output_enabled) + { + if (current_RX_time_ms % d_kml_rate_ms == 0) { - if (current_RX_time_ms % d_gpx_rate_ms == 0) - { - d_gpx_dump->print_position(d_user_pvt_solver, false); - } + d_kml_dump->print_position(d_user_pvt_solver, false); } - if (d_geojson_output_enabled) + } + if (d_gpx_output_enabled) + { + if (current_RX_time_ms % d_gpx_rate_ms == 0) { - if (current_RX_time_ms % d_geojson_rate_ms == 0) - { - d_geojson_printer->print_position(d_user_pvt_solver, false); - } + d_gpx_dump->print_position(d_user_pvt_solver, false); } - if (d_nmea_output_file_enabled) + } + if (d_geojson_output_enabled) + { + if (current_RX_time_ms % d_geojson_rate_ms == 0) { - if (current_RX_time_ms % d_nmea_rate_ms == 0) - { - d_nmea_printer->Print_Nmea_Line(d_user_pvt_solver, false); - } + d_geojson_printer->print_position(d_user_pvt_solver, false); } + } + if (d_nmea_output_file_enabled) + { + if (current_RX_time_ms % d_nmea_rate_ms == 0) + { + d_nmea_printer->Print_Nmea_Line(d_user_pvt_solver, false); + } + } - /* + /* * TYPE | RECEIVER * 0 | Unknown * 1 | GPS L1 C/A @@ -2124,1791 +2231,1790 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item * 610 | BeiDou B3I + GPS L1 C/A + Galileo E1B + GLONASS L1 C/A + BeiDou B1I */ - // ####################### RINEX FILES ################# - if (b_rinex_output_enabled) + // ####################### RINEX FILES ################# + if (b_rinex_output_enabled) + { + std::map::const_iterator galileo_ephemeris_iter; + std::map::const_iterator gps_ephemeris_iter; + std::map::const_iterator gps_cnav_ephemeris_iter; + std::map::const_iterator glonass_gnav_ephemeris_iter; + std::map::const_iterator beidou_dnav_ephemeris_iter; + if (!b_rinex_header_written) // & we have utc data in nav message! { - std::map::const_iterator galileo_ephemeris_iter; - std::map::const_iterator gps_ephemeris_iter; - std::map::const_iterator gps_cnav_ephemeris_iter; - std::map::const_iterator glonass_gnav_ephemeris_iter; - std::map::const_iterator beidou_dnav_ephemeris_iter; - if (!b_rinex_header_written) // & we have utc data in nav message! + galileo_ephemeris_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + gps_ephemeris_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + gps_cnav_ephemeris_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); + glonass_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + beidou_dnav_ephemeris_iter = d_user_pvt_solver->beidou_dnav_ephemeris_map.cbegin(); + switch (type_of_rx) + { + case 1: // GPS L1 C/A only + if (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, d_rx_time); + 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 2: // GPS L2C only + if (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) + { + std::string signal("2S"); + rp->rinex_obs_header(rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, signal); + rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model); + rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_cnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 3: // GPS L5 only + if (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) + { + std::string signal("L5"); + rp->rinex_obs_header(rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, signal); + rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model); + rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_cnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 4: // Galileo E1B only + if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + 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); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 5: // Galileo E5a only + if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + std::string signal("5X"); + 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); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 6: // Galileo E5b only + if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + std::string signal("7X"); + 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->log_rinex_nav(rp->navGalFile, d_user_pvt_solver->galileo_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 7: // GPS L1 C/A + GPS L2C + 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 signal("1C 2S"); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, 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_cnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 8: // GPS L1 + 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 signal("1C L5"); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, 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 9: // GPS L1 C/A + Galileo E1B + if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) + { + std::string gal_signal("1B"); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, 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); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 10: // GPS L1 C/A + 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())) + { + std::string gal_signal("5X"); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, 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); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 11: // GPS L1 C/A + Galileo E5b + if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) + { + std::string gal_signal("7X"); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, 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; + case 13: // L5+E5a + if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) + { + std::string gal_signal("5X"); + std::string gps_signal("L5"); + rp->rinex_obs_header(rp->obsFile, 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_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); + rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_cnav_ephemeris_map, d_user_pvt_solver->galileo_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 14: // Galileo E1B + Galileo E5a + if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + { + std::string gal_signal("1B 5X"); + 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); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 15: // Galileo E1B + Galileo E5b + if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + { + std::string gal_signal("1B 7X"); + 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->log_rinex_nav(rp->navGalFile, d_user_pvt_solver->galileo_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 23: // GLONASS L1 C/A only + if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + std::string signal("1G"); + rp->rinex_obs_header(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, signal); + rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 24: // GLONASS L2 C/A only + if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + std::string signal("2G"); + rp->rinex_obs_header(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, signal); + rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 25: // GLONASS L1 C/A + GLONASS L2 C/A + if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + std::string signal("1G 2G"); + rp->rinex_obs_header(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, signal); + rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); + rp->log_rinex_nav(rp->navGloFile, d_user_pvt_solver->glonass_gnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 26: // GPS L1 C/A + GLONASS L1 C/A + if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) + { + std::string glo_signal("1G"); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal); + if (d_rinex_version == 3) + { + 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->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); + } + if (d_rinex_version == 2) + { + rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second); + rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); + rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_ephemeris_map); + rp->log_rinex_nav(rp->navGloFile, d_user_pvt_solver->glonass_gnav_ephemeris_map); + } + b_rinex_header_written = true; // do not write header anymore + } + break; + case 27: // Galileo E1B + GLONASS L1 C/A + if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + { + std::string glo_signal("1G"); + std::string gal_signal("1B"); + rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal, gal_signal); + rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->galileo_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 28: // GPS L2C + GLONASS L1 C/A + if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) + { + std::string glo_signal("1G"); + rp->rinex_obs_header(rp->obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal); + rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_cnav_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 29: // GPS L1 C/A + GLONASS L2 C/A + if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) + { + std::string glo_signal("2G"); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal); + if (d_rinex_version == 3) + { + 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->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); + } + if (d_rinex_version == 2) + { + rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second); + rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); + rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_ephemeris_map); + rp->log_rinex_nav(rp->navGloFile, d_user_pvt_solver->glonass_gnav_ephemeris_map); + } + b_rinex_header_written = true; // do not write header anymore + } + break; + case 30: // Galileo E1B + GLONASS L2 C/A + if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + { + std::string glo_signal("2G"); + std::string gal_signal("1B"); + rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal, gal_signal); + rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->galileo_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 31: // GPS L2C + GLONASS L2 C/A + if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) + { + std::string glo_signal("2G"); + rp->rinex_obs_header(rp->obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal); + rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_cnav_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + break; + case 32: // L1+E1+L5+E5a + 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()) and + (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + { + std::string gal_signal("1B 5X"); + std::string gps_signal("1C 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; + case 33: // L1+E1+E5a + if ((gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and + (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + { + std::string gal_signal("1B 5X"); + rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, 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; + case 500: // BDS B1I only + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); + rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 501: // BeiDou B1I + GPS L1 C/A + if ((gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())) + { + std::string bds_signal("B1"); + // rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, beidou_dnav_ephemeris_iter->second, d_rx_time, bds_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->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 502: // BeiDou B1I + Galileo E1B + if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())) + { + std::string bds_signal("B1"); + std::string gal_signal("1B"); + // rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, beidou_dnav_ephemeris_iter->second, d_rx_time, gal_signal, bds_signal); + // rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 503: // BeiDou B1I + GLONASS L1 C/A + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + // rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); + // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + // rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 504: // BeiDou B1I + GPS L1 C/A + Galileo E1B + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + // rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); + // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + // rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 505: // BeiDou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + // rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); + // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + // rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 506: // BeiDou B1I + Beidou B3I + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + // rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); + // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + // rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 600: // BDS B3I only + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); + rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 601: // BeiDou B3I + GPS L2C + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); + // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 602: // BeiDou B3I + GLONASS L2 C/A + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); + // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + b_rinex_header_written = true; // do not write header anymore + } + + break; + case 603: // BeiDou B3I + GPS L2C + GLONASS L2 C/A + if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) + { + rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); + // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); + b_rinex_header_written = true; // do not write header anymore + } + + break; + default: + break; + } + } + if (b_rinex_header_written) // The header is already written, we can now log the navigation message data + { + galileo_ephemeris_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + gps_ephemeris_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + gps_cnav_ephemeris_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); + glonass_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + beidou_dnav_ephemeris_iter = d_user_pvt_solver->beidou_dnav_ephemeris_map.cbegin(); + + // Log observables into the RINEX file + if (flag_write_RINEX_obs_output) { - galileo_ephemeris_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - gps_ephemeris_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - gps_cnav_ephemeris_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); - glonass_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - beidou_dnav_ephemeris_iter = d_user_pvt_solver->beidou_dnav_ephemeris_map.cbegin(); switch (type_of_rx) { case 1: // GPS L1 C/A only if (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) { - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, d_rx_time); - 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 + rp->log_rinex_obs(rp->obsFile, gps_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 2: // GPS L2C only if (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) { - std::string signal("2S"); - rp->rinex_obs_header(rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, signal); - rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model); - rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_cnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0)) + { + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); + rp->update_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono); + b_rinex_header_updated = true; } break; - case 3: // GPS L5 only + case 3: // GPS L5 if (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) { - std::string signal("L5"); - rp->rinex_obs_header(rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, signal); - rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model); - rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_cnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0)) + { + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); + rp->update_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono); + b_rinex_header_updated = true; } break; case 4: // Galileo E1B only if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) { - 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); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B"); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) + { + rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); + b_rinex_header_updated = true; } break; case 5: // Galileo E5a only if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) { - std::string signal("5X"); - 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); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "5X"); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) + { + rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); + b_rinex_header_updated = true; } break; case 6: // Galileo E5b only if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) { - std::string signal("7X"); - 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->log_rinex_nav(rp->navGalFile, d_user_pvt_solver->galileo_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "7X"); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) + { + rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); + b_rinex_header_updated = true; } break; case 7: // GPS L1 C/A + GPS L2C 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 signal("1C 2S"); - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, 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_cnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + 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 8: // GPS L1 + GPS L5 + case 8: // L1+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 signal("1C L5"); - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, d_rx_time, 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 + 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_cnav_utc_model.d_A0 != 0) or (d_user_pvt_solver->gps_utc_model.d_A0 != 0))) + { + if (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0) + { + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); + rp->update_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono); + } + else + { + 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 9: // GPS L1 C/A + Galileo E1B if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) { - std::string gal_signal("1B"); - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, 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); - b_rinex_header_written = true; // do not write header anymore - } - break; - case 10: // GPS L1 C/A + 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())) - { - std::string gal_signal("5X"); - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, 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); - b_rinex_header_written = true; // do not write header anymore - } - break; - case 11: // GPS L1 C/A + Galileo E5b - if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) - { - std::string gal_signal("7X"); - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, 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 + rp->log_rinex_obs(rp->obsFile, gps_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)) + { + 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; case 13: // L5+E5a - if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) + if ((gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) { - std::string gal_signal("5X"); - std::string gps_signal("L5"); - rp->rinex_obs_header(rp->obsFile, 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_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); - rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_cnav_ephemeris_map, d_user_pvt_solver->galileo_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, 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_cnav_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_cnav_utc_model); + rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); + b_rinex_header_updated = true; // do not write header anymore } break; - case 14: // Galileo E1B + Galileo E5a - if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + case 14: // Galileo E1B + Galileo E5a + if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) { - std::string gal_signal("1B 5X"); - 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); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B 5X"); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) + { + rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); + b_rinex_header_updated = true; } break; - case 15: // Galileo E1B + Galileo E5b - if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + case 15: // Galileo E1B + Galileo E5b + if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) { - std::string gal_signal("1B 7X"); - 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->log_rinex_nav(rp->navGalFile, d_user_pvt_solver->galileo_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B 7X"); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) + { + rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); + b_rinex_header_updated = true; } break; case 23: // GLONASS L1 C/A only if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) { - std::string signal("1G"); - rp->rinex_obs_header(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, signal); - rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1C"); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) + { + rp->update_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->glonass_gnav_utc_model); + b_rinex_header_updated = true; } break; case 24: // GLONASS L2 C/A only if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) { - std::string signal("2G"); - rp->rinex_obs_header(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, signal); - rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "2C"); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) + { + rp->update_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->glonass_gnav_utc_model); + b_rinex_header_updated = true; } break; case 25: // GLONASS L1 C/A + GLONASS L2 C/A if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) { - std::string signal("1G 2G"); - rp->rinex_obs_header(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, signal); - rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); - rp->log_rinex_nav(rp->navGloFile, d_user_pvt_solver->glonass_gnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1C 2C"); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) + { + rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->glonass_gnav_utc_model); + b_rinex_header_updated = true; } break; case 26: // GPS L1 C/A + GLONASS L1 C/A if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) { - std::string glo_signal("1G"); - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal); - if (d_rinex_version == 3) + rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_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->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->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); + 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->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + b_rinex_header_updated = true; // do not write header anymore } - if (d_rinex_version == 2) - { - rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second); - rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); - rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_ephemeris_map); - rp->log_rinex_nav(rp->navGloFile, d_user_pvt_solver->glonass_gnav_ephemeris_map); - } - b_rinex_header_written = true; // do not write header anymore } break; - case 27: // Galileo E1B + GLONASS L1 C/A + case 27: // Galileo E1B + GLONASS L1 C/A if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) { - std::string glo_signal("1G"); - std::string gal_signal("1B"); - rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal, gal_signal); - rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->galileo_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) + { + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); + rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + b_rinex_header_updated = true; // do not write header anymore } break; case 28: // GPS L2C + GLONASS L1 C/A if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) { - std::string glo_signal("1G"); - rp->rinex_obs_header(rp->obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal); - rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_cnav_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0)) + { + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); + rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + b_rinex_header_updated = true; // do not write header anymore } break; case 29: // GPS L1 C/A + GLONASS L2 C/A if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) { - std::string glo_signal("2G"); - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal); - if (d_rinex_version == 3) + rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_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->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->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); + 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->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + b_rinex_header_updated = true; // do not write header anymore } - if (d_rinex_version == 2) - { - rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second); - rp->rinex_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, glonass_gnav_ephemeris_iter->second); - rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->gps_ephemeris_map); - rp->log_rinex_nav(rp->navGloFile, d_user_pvt_solver->glonass_gnav_ephemeris_map); - } - b_rinex_header_written = true; // do not write header anymore } break; - case 30: // Galileo E1B + GLONASS L2 C/A + case 30: // Galileo E1B + GLONASS L2 C/A if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) { - std::string glo_signal("2G"); - std::string gal_signal("1B"); - rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal, gal_signal); - rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->galileo_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) + { + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); + rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + b_rinex_header_updated = true; // do not write header anymore } break; case 31: // GPS L2C + GLONASS L2 C/A if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) { - std::string glo_signal("2G"); - rp->rinex_obs_header(rp->obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, glo_signal); - rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->log_rinex_nav(rp->navMixFile, d_user_pvt_solver->gps_cnav_ephemeris_map, d_user_pvt_solver->glonass_gnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); + } + if (!b_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0)) + { + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); + rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); + b_rinex_header_updated = true; // do not write header anymore } break; case 32: // L1+E1+L5+E5a - 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()) and - (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + 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()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) { - std::string gal_signal("1B 5X"); - std::string gps_signal("1C 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 + 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_cnav_utc_model.d_A0 != 0) or (d_user_pvt_solver->gps_utc_model.d_A0 != 0)) and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) + { + if (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0) + { + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); + rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); + } + else + { + 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; // do not write header anymore + } } break; case 33: // L1+E1+E5a - if ((gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and - (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) + if ((gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) { - std::string gal_signal("1B 5X"); - rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, galileo_ephemeris_iter->second, d_rx_time, 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 + rp->log_rinex_obs(rp->obsFile, gps_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; // do not write header anymore + } } break; case 500: // BDS B1I only if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) { - rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); - rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore + rp->log_rinex_obs(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "B1"); } - - break; - case 501: // BeiDou B1I + GPS L1 C/A - if ((gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())) + if (!b_rinex_header_updated and (d_user_pvt_solver->beidou_dnav_utc_model.d_A0_UTC != 0)) { - std::string bds_signal("B1"); - // rp->rinex_obs_header(rp->obsFile, gps_ephemeris_iter->second, beidou_dnav_ephemeris_iter->second, d_rx_time, bds_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->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 502: // BeiDou B1I + Galileo E1B - if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend())) - { - std::string bds_signal("B1"); - std::string gal_signal("1B"); - // rp->rinex_obs_header(rp->obsFile, galileo_ephemeris_iter->second, beidou_dnav_ephemeris_iter->second, d_rx_time, gal_signal, bds_signal); - // rp->rinex_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 503: // BeiDou B1I + GLONASS L1 C/A - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - // rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); - // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - // rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 504: // BeiDou B1I + GPS L1 C/A + Galileo E1B - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - // rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); - // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - // rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 505: // BeiDou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - // rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); - // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - // rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 506: // BeiDou B1I + Beidou B3I - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - // rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B1"); - // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - // rp->log_rinex_nav(rp->navFile, d_user_pvt_solver->beidou_dnav_ephemeris_map); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 600: // BDS B3I only - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); - rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 601: // BeiDou B3I + GPS L2C - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); - // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 602: // BeiDou B3I + GLONASS L2 C/A - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); - // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - b_rinex_header_written = true; // do not write header anymore - } - - break; - case 603: // BeiDou B3I + GPS L2C + GLONASS L2 C/A - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - rp->rinex_obs_header(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, "B3"); - // rp->rinex_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_iono, d_user_pvt_solver->beidou_dnav_utc_model); - b_rinex_header_written = true; // do not write header anymore - } - - break; - default: - break; - } - } - if (b_rinex_header_written) // The header is already written, we can now log the navigation message data - { - galileo_ephemeris_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - gps_ephemeris_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - gps_cnav_ephemeris_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); - glonass_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - beidou_dnav_ephemeris_iter = d_user_pvt_solver->beidou_dnav_ephemeris_map.cbegin(); - - // Log observables into the RINEX file - if (flag_write_RINEX_obs_output) - { - switch (type_of_rx) - { - case 1: // GPS L1 C/A only - if (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, gps_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 2: // GPS L2C only - if (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0)) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); - rp->update_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono); - b_rinex_header_updated = true; - } - break; - case 3: // GPS L5 - if (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, gps_cnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0)) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); - rp->update_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono); - b_rinex_header_updated = true; - } - break; - case 4: // Galileo E1B only - if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) - { - rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); - b_rinex_header_updated = true; - } - break; - case 5: // Galileo E5a only - if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "5X"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) - { - rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); - b_rinex_header_updated = true; - } - break; - case 6: // Galileo E5b only - if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "7X"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) - { - rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); - b_rinex_header_updated = true; - } - break; - case 7: // GPS L1 C/A + GPS L2C - 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 8: // L1+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_cnav_utc_model.d_A0 != 0) or (d_user_pvt_solver->gps_utc_model.d_A0 != 0))) - { - if (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); - rp->update_nav_header(rp->navFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono); - } - else - { - 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 9: // GPS L1 C/A + Galileo E1B - if ((galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, gps_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)) - { - 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; - case 13: // L5+E5a - if ((gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, 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_cnav_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_cnav_utc_model); - rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); - b_rinex_header_updated = true; // do not write header anymore - } - break; - case 14: // Galileo E1B + Galileo E5a - if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B 5X"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) - { - rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); - b_rinex_header_updated = true; - } - break; - case 15: // Galileo E1B + Galileo E5b - if (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1B 7X"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) - { - rp->update_nav_header(rp->navGalFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); - b_rinex_header_updated = true; - } - break; - case 23: // GLONASS L1 C/A only - if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1C"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) - { - rp->update_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->glonass_gnav_utc_model); - b_rinex_header_updated = true; - } - break; - case 24: // GLONASS L2 C/A only - if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "2C"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) - { - rp->update_nav_header(rp->navGloFile, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->glonass_gnav_utc_model); - b_rinex_header_updated = true; - } - break; - case 25: // GLONASS L1 C/A + GLONASS L2 C/A - if (glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "1C 2C"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->glonass_gnav_utc_model.d_tau_c != 0)) - { - rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->glonass_gnav_utc_model); - b_rinex_header_updated = true; - } - break; - case 26: // GPS L1 C/A + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_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->navMixFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - b_rinex_header_updated = true; // do not write header anymore - } - } - break; - case 27: // Galileo E1B + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); - rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - b_rinex_header_updated = true; // do not write header anymore - } - break; - case 28: // GPS L2C + GLONASS L1 C/A - if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0)) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); - rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - b_rinex_header_updated = true; // do not write header anymore - } - break; - case 29: // GPS L1 C/A + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, glonass_gnav_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->navMixFile, d_user_pvt_solver->gps_iono, d_user_pvt_solver->gps_utc_model, gps_ephemeris_iter->second, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - b_rinex_header_updated = true; // do not write header anymore - } - } - break; - case 30: // Galileo E1B + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, galileo_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->galileo_utc_model); - rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - b_rinex_header_updated = true; // do not write header anymore - } - break; - case 31: // GPS L2C + GLONASS L2 C/A - if ((glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) and (gps_cnav_ephemeris_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, gps_cnav_ephemeris_iter->second, glonass_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0)) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); - rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->glonass_gnav_utc_model, d_user_pvt_solver->glonass_gnav_almanac); - b_rinex_header_updated = true; // do not write header anymore - } - break; - case 32: // L1+E1+L5+E5a - 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()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_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_cnav_utc_model.d_A0 != 0) or (d_user_pvt_solver->gps_utc_model.d_A0 != 0)) and (d_user_pvt_solver->galileo_utc_model.A0_6 != 0)) - { - if (d_user_pvt_solver->gps_cnav_utc_model.d_A0 != 0) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->gps_cnav_utc_model); - rp->update_nav_header(rp->navMixFile, d_user_pvt_solver->gps_cnav_utc_model, d_user_pvt_solver->gps_cnav_iono, d_user_pvt_solver->galileo_iono, d_user_pvt_solver->galileo_utc_model); - } - else - { - 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; // do not write header anymore - } - } - break; - case 33: // L1+E1+E5a - if ((gps_ephemeris_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (galileo_ephemeris_iter != d_user_pvt_solver->galileo_ephemeris_map.cend())) - { - rp->log_rinex_obs(rp->obsFile, gps_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; // do not write header anymore - } - } - break; - case 500: // BDS B1I only - if (beidou_dnav_ephemeris_iter != d_user_pvt_solver->beidou_dnav_ephemeris_map.cend()) - { - rp->log_rinex_obs(rp->obsFile, beidou_dnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, "B1"); - } - if (!b_rinex_header_updated and (d_user_pvt_solver->beidou_dnav_utc_model.d_A0_UTC != 0)) - { - rp->update_obs_header(rp->obsFile, d_user_pvt_solver->beidou_dnav_utc_model); - rp->update_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_utc_model, d_user_pvt_solver->beidou_dnav_iono); - b_rinex_header_updated = true; - } - break; - default: - break; - } - } - } - } - - // ####################### RTCM MESSAGES ################# - try - { - if (b_rtcm_writing_started and b_rtcm_enabled) - { - switch (type_of_rx) - { - case 1: // GPS L1 C/A - if (flag_write_RTCM_1019_output == true) - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 4: - case 5: - case 6: - if (flag_write_RTCM_1045_output == true) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 7: // GPS L1 C/A + GPS L2C - if (flag_write_RTCM_1019_output == true) - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); - if ((gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 8: // L1+L5 - if (flag_write_RTCM_1019_output == true) - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); - if ((gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 9: // GPS L1 C/A + Galileo E1B - if (flag_write_RTCM_1019_output == true) - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (flag_write_RTCM_1045_output == true) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - std::map::const_iterator gnss_observables_iter; - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - int gps_channel = 0; - int gal_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gps_channel == 0) - { - if (system == "G") - { - // This is a channel with valid GPS signal - gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - if (gal_channel == 0) - { - if (system == "E") - { - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - } - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 13: // L5+E5a - if (flag_write_RTCM_1045_output == true) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - - if (flag_write_RTCM_MSM_output and d_rtcm_MSM_rate_ms != 0) - { - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); - int gal_channel = 0; - int gps_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gps_channel == 0) - { - if (system == "G") - { - // This is a channel with valid GPS signal - gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - if (gal_channel == 0) - { - if (system == "E") - { - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - } - - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend() and (d_rtcm_MT1097_rate_ms != 0)) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend() and (d_rtcm_MT1077_rate_ms != 0)) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 14: - case 15: - if (flag_write_RTCM_1045_output == true) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 23: - case 24: - case 25: - if (flag_write_RTCM_1020_output == true) - { - for (auto glonass_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (flag_write_RTCM_MSM_output == true) - { - auto glo_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - if (glo_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glo_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 26: // GPS L1 C/A + GLONASS L1 C/A - if (flag_write_RTCM_1019_output == true) - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (flag_write_RTCM_1020_output == true) - { - for (auto glonass_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (flag_write_RTCM_MSM_output == true) - { - std::map::const_iterator gnss_observables_iter; - auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - int gps_channel = 0; - int glo_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gps_channel == 0) - { - if (system == "G") - { - // This is a channel with valid GPS signal - gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - if (glo_channel == 0) - { - if (system == "R") - { - glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - glo_channel = 1; - } - } - } - } - - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 27: // GLONASS L1 C/A + Galileo E1B - if (flag_write_RTCM_1020_output == true) - { - for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (flag_write_RTCM_1045_output == true) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - int gal_channel = 0; - int glo_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gal_channel == 0) - { - if (system == "E") - { - // This is a channel with valid GPS signal - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - if (glo_channel == 0) - { - if (system == "R") - { - glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - glo_channel = 1; - } - } - } - } - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 29: // GPS L1 C/A + GLONASS L2 C/A - if (flag_write_RTCM_1019_output == true) - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (flag_write_RTCM_1020_output == true) - { - for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (flag_write_RTCM_MSM_output == true) - { - std::map::const_iterator gnss_observables_iter; - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - int gps_channel = 0; - int glo_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gps_channel == 0) - { - if (system == "G") - { - // This is a channel with valid GPS signal - gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - if (glo_channel == 0) - { - if (system == "R") - { - glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - glo_channel = 1; - } - } - } - } - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 30: // GLONASS L2 C/A + Galileo E1B - if (flag_write_RTCM_1020_output == true) - { - for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (flag_write_RTCM_1045_output == true) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - int gal_channel = 0; - int glo_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gal_channel == 0) - { - if (system == "E") - { - // This is a channel with valid GPS signal - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - if (glo_channel == 0) - { - if (system == "R") - { - glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - glo_channel = 1; - } - } - } - } - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - break; - case 32: // L1+E1+L5+E5a - if (flag_write_RTCM_1019_output == true) - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (flag_write_RTCM_1045_output == true) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (flag_write_RTCM_MSM_output == true) - { - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - int gal_channel = 0; - int gps_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gal_channel == 0) - { - if (system == "E") - { - // This is a channel with valid GPS signal - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - if (gps_channel == 0) - { - if (system == "G") - { - gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - } - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } + rp->update_obs_header(rp->obsFile, d_user_pvt_solver->beidou_dnav_utc_model); + rp->update_nav_header(rp->navFile, d_user_pvt_solver->beidou_dnav_utc_model, d_user_pvt_solver->beidou_dnav_iono); + b_rinex_header_updated = true; } break; default: break; } } + } + } - if (!b_rtcm_writing_started and b_rtcm_enabled) // the first time + // ####################### RTCM MESSAGES ################# + try + { + if (b_rtcm_writing_started and b_rtcm_enabled) + { + switch (type_of_rx) { - switch (type_of_rx) + case 1: // GPS L1 C/A + if (flag_write_RTCM_1019_output == true) { - case 1: // GPS L1 C/A - if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); } - if (d_rtcm_MSM_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 4: - case 5: - case 6: - if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 7: // GPS L1 C/A + GPS L2C - if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); - if ((gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 8: // L1+L5 - if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); - if ((gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 9: // GPS L1 C/A + Galileo E1B - if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (d_rtcm_MT1045_rate_ms != 0) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - int gps_channel = 0; - int gal_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gps_channel == 0) - { - if (system == "G") - { - // This is a channel with valid GPS signal - gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - if (gal_channel == 0) - { - if (system == "E") - { - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - } - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - - case 13: // L5+E5a - if (d_rtcm_MT1045_rate_ms != 0) - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - int gal_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gal_channel == 0) - { - if (system == "E") - { - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - } - - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend() and (d_rtcm_MT1097_rate_ms != 0)) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 14: - case 15: - if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 23: - case 24: - case 25: - if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - auto glo_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - if (glo_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glo_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 26: // GPS L1 C/A + GLONASS L1 C/A - if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - std::map::const_iterator gnss_observables_iter; - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - int gps_channel = 0; - int glo_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gps_channel == 0) - { - if (system == "G") - { - // This is a channel with valid GPS signal - gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - if (glo_channel == 0) - { - if (system == "R") - { - glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - glo_channel = 1; - } - } - } - } - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 27: // GLONASS L1 C/A + Galileo E1B - if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - int gal_channel = 0; - int glo_channel = 0; - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gal_channel == 0) - { - if (system == "E") - { - // This is a channel with valid GPS signal - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - if (glo_channel == 0) - { - if (system == "R") - { - glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - glo_channel = 1; - } - } - } - } - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 29: // GPS L1 C/A + GLONASS L2 C/A - if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - std::map::const_iterator gnss_observables_iter; - int gps_channel = 0; - int glo_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gps_channel == 0) - { - if (system == "G") - { - // This is a channel with valid GPS signal - gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - if (glo_channel == 0) - { - if (system == "R") - { - glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - glo_channel = 1; - } - } - } - } - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 30: // GLONASS L2 C/A + Galileo E1B - if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) - { - d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); - } - } - if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - int gal_channel = 0; - int glo_channel = 0; - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gal_channel == 0) - { - if (system == "E") - { - // This is a channel with valid GPS signal - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - if (glo_channel == 0) - { - if (system == "R") - { - glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - glo_channel = 1; - } - } - } - } - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - case 32: // L1+E1+L5+E5a - if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); - } - } - if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 - { - for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) - { - d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); - } - } - if (d_rtcm_MSM_rate_ms != 0) - { - std::map::const_iterator gnss_observables_iter; - auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); - auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); - int gps_channel = 0; - int gal_channel = 0; - for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) - { - std::string system(&gnss_observables_iter->second.System, 1); - if (gps_channel == 0) - { - if (system == "G") - { - // This is a channel with valid GPS signal - gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - gps_channel = 1; - } - } - } - if (gal_channel == 0) - { - if (system == "E") - { - gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - gal_channel = 1; - } - } - } - } - if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) - { - d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); - } - } - b_rtcm_writing_started = true; - break; - default: - break; } + if (flag_write_RTCM_MSM_output == true) + { + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 4: + case 5: + case 6: + if (flag_write_RTCM_1045_output == true) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (flag_write_RTCM_MSM_output == true) + { + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 7: // GPS L1 C/A + GPS L2C + if (flag_write_RTCM_1019_output == true) + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (flag_write_RTCM_MSM_output == true) + { + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); + if ((gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 8: // L1+L5 + if (flag_write_RTCM_1019_output == true) + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (flag_write_RTCM_MSM_output == true) + { + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); + if ((gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 9: // GPS L1 C/A + Galileo E1B + if (flag_write_RTCM_1019_output == true) + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (flag_write_RTCM_1045_output == true) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (flag_write_RTCM_MSM_output == true) + { + std::map::const_iterator gnss_observables_iter; + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + int gps_channel = 0; + int gal_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gps_channel == 0) + { + if (system == "G") + { + // This is a channel with valid GPS signal + gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + if (gal_channel == 0) + { + if (system == "E") + { + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + } + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 13: // L5+E5a + if (flag_write_RTCM_1045_output == true) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + + if (flag_write_RTCM_MSM_output and d_rtcm_MSM_rate_ms != 0) + { + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); + int gal_channel = 0; + int gps_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gps_channel == 0) + { + if (system == "G") + { + // This is a channel with valid GPS signal + gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + if (gal_channel == 0) + { + if (system == "E") + { + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + } + + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend() and (d_rtcm_MT1097_rate_ms != 0)) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend() and (d_rtcm_MT1077_rate_ms != 0)) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 14: + case 15: + if (flag_write_RTCM_1045_output == true) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (flag_write_RTCM_MSM_output == true) + { + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 23: + case 24: + case 25: + if (flag_write_RTCM_1020_output == true) + { + for (auto glonass_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (flag_write_RTCM_MSM_output == true) + { + auto glo_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + if (glo_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glo_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 26: // GPS L1 C/A + GLONASS L1 C/A + if (flag_write_RTCM_1019_output == true) + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (flag_write_RTCM_1020_output == true) + { + for (auto glonass_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_ephemeris_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_ephemeris_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (flag_write_RTCM_MSM_output == true) + { + std::map::const_iterator gnss_observables_iter; + auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + int gps_channel = 0; + int glo_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gps_channel == 0) + { + if (system == "G") + { + // This is a channel with valid GPS signal + gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + if (glo_channel == 0) + { + if (system == "R") + { + glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = 1; + } + } + } + } + + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 27: // GLONASS L1 C/A + Galileo E1B + if (flag_write_RTCM_1020_output == true) + { + for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (flag_write_RTCM_1045_output == true) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (flag_write_RTCM_MSM_output == true) + { + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + int gal_channel = 0; + int glo_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gal_channel == 0) + { + if (system == "E") + { + // This is a channel with valid GPS signal + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + if (glo_channel == 0) + { + if (system == "R") + { + glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = 1; + } + } + } + } + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 29: // GPS L1 C/A + GLONASS L2 C/A + if (flag_write_RTCM_1019_output == true) + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (flag_write_RTCM_1020_output == true) + { + for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (flag_write_RTCM_MSM_output == true) + { + std::map::const_iterator gnss_observables_iter; + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + int gps_channel = 0; + int glo_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gps_channel == 0) + { + if (system == "G") + { + // This is a channel with valid GPS signal + gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + if (glo_channel == 0) + { + if (system == "R") + { + glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = 1; + } + } + } + } + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 30: // GLONASS L2 C/A + Galileo E1B + if (flag_write_RTCM_1020_output == true) + { + for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (flag_write_RTCM_1045_output == true) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (flag_write_RTCM_MSM_output == true) + { + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + int gal_channel = 0; + int glo_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gal_channel == 0) + { + if (system == "E") + { + // This is a channel with valid GPS signal + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + if (glo_channel == 0) + { + if (system == "R") + { + glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = 1; + } + } + } + } + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + case 32: // L1+E1+L5+E5a + if (flag_write_RTCM_1019_output == true) + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (flag_write_RTCM_1045_output == true) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (flag_write_RTCM_MSM_output == true) + { + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + int gal_channel = 0; + int gps_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gal_channel == 0) + { + if (system == "E") + { + // This is a channel with valid GPS signal + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + if (gps_channel == 0) + { + if (system == "G") + { + gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + } + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + break; + default: + break; } } - catch (const boost::exception& ex) + + if (!b_rtcm_writing_started and b_rtcm_enabled) // the first time { - std::cout << "RTCM boost exception: " << boost::diagnostic_information(ex) << std::endl; - LOG(ERROR) << "RTCM boost exception: " << boost::diagnostic_information(ex); - } - catch (const std::exception& ex) - { - std::cout << "RTCM std exception: " << ex.what() << std::endl; - LOG(ERROR) << "RTCM std exception: " << ex.what(); + switch (type_of_rx) + { + case 1: // GPS L1 C/A + if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 4: + case 5: + case 6: + if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 7: // GPS L1 C/A + GPS L2C + if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); + if ((gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 8: // L1+L5 + if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + auto gps_cnav_eph_iter = d_user_pvt_solver->gps_cnav_ephemeris_map.cbegin(); + if ((gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) and (gps_cnav_eph_iter != d_user_pvt_solver->gps_cnav_ephemeris_map.cend())) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, gps_cnav_eph_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 9: // GPS L1 C/A + Galileo E1B + if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (d_rtcm_MT1045_rate_ms != 0) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + int gps_channel = 0; + int gal_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gps_channel == 0) + { + if (system == "G") + { + // This is a channel with valid GPS signal + gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + if (gal_channel == 0) + { + if (system == "E") + { + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + } + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + + case 13: // L5+E5a + if (d_rtcm_MT1045_rate_ms != 0) + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + int gal_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gal_channel == 0) + { + if (system == "E") + { + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + } + + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend() and (d_rtcm_MT1097_rate_ms != 0)) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 14: + case 15: + if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 23: + case 24: + case 25: + if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + auto glo_gnav_ephemeris_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + if (glo_gnav_ephemeris_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glo_gnav_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 26: // GPS L1 C/A + GLONASS L1 C/A + if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + std::map::const_iterator gnss_observables_iter; + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + int gps_channel = 0; + int glo_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gps_channel == 0) + { + if (system == "G") + { + // This is a channel with valid GPS signal + gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + if (glo_channel == 0) + { + if (system == "R") + { + glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = 1; + } + } + } + } + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 27: // GLONASS L1 C/A + Galileo E1B + if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + int gal_channel = 0; + int glo_channel = 0; + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gal_channel == 0) + { + if (system == "E") + { + // This is a channel with valid GPS signal + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + if (glo_channel == 0) + { + if (system == "R") + { + glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = 1; + } + } + } + } + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 29: // GPS L1 C/A + GLONASS L2 C/A + if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + std::map::const_iterator gnss_observables_iter; + int gps_channel = 0; + int glo_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gps_channel == 0) + { + if (system == "G") + { + // This is a channel with valid GPS signal + gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + if (glo_channel == 0) + { + if (system == "R") + { + glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = 1; + } + } + } + } + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 30: // GLONASS L2 C/A + Galileo E1B + if (d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend(); glonass_gnav_eph_iter++) + { + d_rtcm_printer->Print_Rtcm_MT1020(glonass_gnav_eph_iter->second, d_user_pvt_solver->glonass_gnav_utc_model); + } + } + if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + int gal_channel = 0; + int glo_channel = 0; + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + auto glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.cbegin(); + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gal_channel == 0) + { + if (system == "E") + { + // This is a channel with valid GPS signal + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + if (glo_channel == 0) + { + if (system == "R") + { + glonass_gnav_eph_iter = d_user_pvt_solver->glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + glo_channel = 1; + } + } + } + } + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (glonass_gnav_eph_iter != d_user_pvt_solver->glonass_gnav_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, {}, glonass_gnav_eph_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + case 32: // L1+E1+L5+E5a + if (d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gps_eph_iter : d_user_pvt_solver->gps_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1019(gps_eph_iter.second); + } + } + if (d_rtcm_MT1045_rate_ms != 0) // allows deactivating messages by setting rate = 0 + { + for (const auto& gal_eph_iter : d_user_pvt_solver->galileo_ephemeris_map) + { + d_rtcm_printer->Print_Rtcm_MT1045(gal_eph_iter.second); + } + } + if (d_rtcm_MSM_rate_ms != 0) + { + std::map::const_iterator gnss_observables_iter; + auto gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.cbegin(); + auto gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.cbegin(); + int gps_channel = 0; + int gal_channel = 0; + for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) + { + std::string system(&gnss_observables_iter->second.System, 1); + if (gps_channel == 0) + { + if (system == "G") + { + // This is a channel with valid GPS signal + gps_eph_iter = d_user_pvt_solver->gps_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + gps_channel = 1; + } + } + } + if (gal_channel == 0) + { + if (system == "E") + { + gal_eph_iter = d_user_pvt_solver->galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + gal_channel = 1; + } + } + } + } + if (gps_eph_iter != d_user_pvt_solver->gps_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, gps_eph_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + if (gal_eph_iter != d_user_pvt_solver->galileo_ephemeris_map.cend()) + { + d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_eph_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, false, false); + } + } + b_rtcm_writing_started = true; + break; + default: + break; + } } } + catch (const boost::exception& ex) + { + std::cout << "RTCM boost exception: " << boost::diagnostic_information(ex) << std::endl; + LOG(ERROR) << "RTCM boost exception: " << boost::diagnostic_information(ex); + } + catch (const std::exception& ex) + { + std::cout << "RTCM std exception: " << ex.what() << std::endl; + LOG(ERROR) << "RTCM std exception: " << ex.what(); + } } } diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index e9d379521..1956923a7 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -213,6 +213,7 @@ private: int32_t max_obs_block_rx_clock_offset_ms; bool d_waiting_obs_block_rx_clock_offset_correction_msg; + bool d_enable_rx_clock_correction; std::map gnss_observables_map; std::map gnss_observables_map_t0; std::map gnss_observables_map_t1; diff --git a/src/algorithms/PVT/libs/pvt_conf.cc b/src/algorithms/PVT/libs/pvt_conf.cc index 589941658..70b9e6af8 100644 --- a/src/algorithms/PVT/libs/pvt_conf.cc +++ b/src/algorithms/PVT/libs/pvt_conf.cc @@ -72,6 +72,7 @@ Pvt_Conf::Pvt_Conf() xml_output_path = std::string("."); rtcm_output_file_path = std::string("."); + enable_rx_clock_correction=true; monitor_enabled = false; protobuf_enabled = true; udp_port = 0; diff --git a/src/algorithms/PVT/libs/pvt_conf.h b/src/algorithms/PVT/libs/pvt_conf.h index 7f11baeae..ea67a178f 100644 --- a/src/algorithms/PVT/libs/pvt_conf.h +++ b/src/algorithms/PVT/libs/pvt_conf.h @@ -89,6 +89,7 @@ public: std::string udp_addresses; int udp_port; + bool enable_rx_clock_correction; bool show_local_time_zone; Pvt_Conf(); From 6fe7ec9d713e5352fb5fe0fc0e0f2651976ca244 Mon Sep 17 00:00:00 2001 From: Javier Arribas Date: Fri, 6 Sep 2019 18:19:40 +0200 Subject: [PATCH 03/10] Fix last commit --- src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index c00144f6b..8bf80913e 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -2038,7 +2038,14 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } else { - flag_compute_pvt_output = false; + d_rx_time = gnss_observables_map.begin()->second.RX_time; + current_RX_time_ms = static_cast(d_rx_time * 1000.0); + if (current_RX_time_ms % d_output_rate_ms == 0) + { + flag_compute_pvt_output = true; + // std::cout.precision(17); + // std::cout << "current_RX_time: " << current_RX_time << " map time: " << gnss_observables_map.begin()->second.RX_time << std::endl; + } flag_pvt_valid = true; } } From 9cb1beffa47bf375557e4b0c899d3315a0242a50 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 6 Sep 2019 18:39:03 +0200 Subject: [PATCH 04/10] Clean formatting --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 3 +- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 107 +++++++++--------- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index bb07aade0..6f0e37454 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -769,8 +769,9 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration, // Show time in local zone pvt_output_parameters.show_local_time_zone = configuration->property(role + ".show_local_time_zone", false); - //enable or disable rx clock corection in observables + // Enable or disable rx clock corection in observables pvt_output_parameters.enable_rx_clock_correction = configuration->property(role + ".enable_rx_clock_correction", true); + // make PVT object pvt_ = rtklib_make_pvt_gs(in_streams_, pvt_output_parameters, rtk); DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")"; diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 8bf80913e..aeb6734e4 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -457,14 +457,13 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_local_time_str = std::string(" ") + time_zone_abrv + " (UTC " + utc_diff_str.substr(0, 3) + ":" + utc_diff_str.substr(3, 2) + ")"; } - d_waiting_obs_block_rx_clock_offset_correction_msg = false; d_enable_rx_clock_correction = conf_.enable_rx_clock_correction; if (d_enable_rx_clock_correction == true) { - //setup two PVT solvers: internal solver for rx clock and user solver + // setup two PVT solvers: internal solver for rx clock and user solver // user PVT solver d_user_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); d_user_pvt_solver->set_averaging_depth(1); @@ -477,7 +476,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, } else { - //only one solver, customized by the user options + // only one solver, customized by the user options d_internal_pvt_solver = std::make_shared(static_cast(nchannels), dump_ls_pvt_filename, d_dump, d_dump_mat, rtk); d_internal_pvt_solver->set_averaging_depth(1); d_user_pvt_solver = d_internal_pvt_solver; @@ -2186,57 +2185,57 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } /* - * TYPE | RECEIVER - * 0 | Unknown - * 1 | GPS L1 C/A - * 2 | GPS L2C - * 3 | GPS L5 - * 4 | Galileo E1B - * 5 | Galileo E5a - * 6 | Galileo E5b - * 7 | GPS L1 C/A + GPS L2C - * 8 | GPS L1 C/A + GPS L5 - * 9 | GPS L1 C/A + Galileo E1B - * 10 | GPS L1 C/A + Galileo E5a - * 11 | GPS L1 C/A + Galileo E5b - * 12 | Galileo E1B + GPS L2C - * 13 | Galileo E5a + GPS L5 - * 14 | Galileo E1B + Galileo E5a - * 15 | Galileo E1B + Galileo E5b - * 16 | GPS L2C + GPS L5 - * 17 | GPS L2C + Galileo E5a - * 18 | GPS L2C + Galileo E5b - * 21 | GPS L1 C/A + Galileo E1B + GPS L2C - * 22 | GPS L1 C/A + Galileo E1B + GPS L5 - * 23 | GLONASS L1 C/A - * 24 | GLONASS L2 C/A - * 25 | GLONASS L1 C/A + GLONASS L2 C/A - * 26 | GPS L1 C/A + GLONASS L1 C/A - * 27 | Galileo E1B + GLONASS L1 C/A - * 28 | GPS L2C + GLONASS L1 C/A - * 29 | GPS L1 C/A + GLONASS L2 C/A - * 30 | Galileo E1B + GLONASS L2 C/A - * 31 | GPS L2C + GLONASS L2 C/A - * 32 | GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a - * 500 | BeiDou B1I - * 501 | BeiDou B1I + GPS L1 C/A - * 502 | BeiDou B1I + Galileo E1B - * 503 | BeiDou B1I + GLONASS L1 C/A - * 504 | BeiDou B1I + GPS L1 C/A + Galileo E1B - * 505 | BeiDou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B - * 506 | BeiDou B1I + Beidou B3I - * 600 | BeiDou B3I - * 601 | BeiDou B3I + GPS L2C - * 602 | BeiDou B3I + GLONASS L2 C/A - * 603 | BeiDou B3I + GPS L2C + GLONASS L2 C/A - * 604 | BeiDou B3I + GPS L1 C/A - * 605 | BeiDou B3I + Galileo E1B - * 606 | BeiDou B3I + GLONASS L1 C/A - * 607 | BeiDou B3I + GPS L1 C/A + Galileo E1B - * 608 | BeiDou B3I + GPS L1 C/A + Galileo E1B + BeiDou B1I - * 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 - */ + * TYPE | RECEIVER + * 0 | Unknown + * 1 | GPS L1 C/A + * 2 | GPS L2C + * 3 | GPS L5 + * 4 | Galileo E1B + * 5 | Galileo E5a + * 6 | Galileo E5b + * 7 | GPS L1 C/A + GPS L2C + * 8 | GPS L1 C/A + GPS L5 + * 9 | GPS L1 C/A + Galileo E1B + * 10 | GPS L1 C/A + Galileo E5a + * 11 | GPS L1 C/A + Galileo E5b + * 12 | Galileo E1B + GPS L2C + * 13 | Galileo E5a + GPS L5 + * 14 | Galileo E1B + Galileo E5a + * 15 | Galileo E1B + Galileo E5b + * 16 | GPS L2C + GPS L5 + * 17 | GPS L2C + Galileo E5a + * 18 | GPS L2C + Galileo E5b + * 21 | GPS L1 C/A + Galileo E1B + GPS L2C + * 22 | GPS L1 C/A + Galileo E1B + GPS L5 + * 23 | GLONASS L1 C/A + * 24 | GLONASS L2 C/A + * 25 | GLONASS L1 C/A + GLONASS L2 C/A + * 26 | GPS L1 C/A + GLONASS L1 C/A + * 27 | Galileo E1B + GLONASS L1 C/A + * 28 | GPS L2C + GLONASS L1 C/A + * 29 | GPS L1 C/A + GLONASS L2 C/A + * 30 | Galileo E1B + GLONASS L2 C/A + * 31 | GPS L2C + GLONASS L2 C/A + * 32 | GPS L1 C/A + Galileo E1B + GPS L5 + Galileo E5a + * 500 | BeiDou B1I + * 501 | BeiDou B1I + GPS L1 C/A + * 502 | BeiDou B1I + Galileo E1B + * 503 | BeiDou B1I + GLONASS L1 C/A + * 504 | BeiDou B1I + GPS L1 C/A + Galileo E1B + * 505 | BeiDou B1I + GPS L1 C/A + GLONASS L1 C/A + Galileo E1B + * 506 | BeiDou B1I + Beidou B3I + * 600 | BeiDou B3I + * 601 | BeiDou B3I + GPS L2C + * 602 | BeiDou B3I + GLONASS L2 C/A + * 603 | BeiDou B3I + GPS L2C + GLONASS L2 C/A + * 604 | BeiDou B3I + GPS L1 C/A + * 605 | BeiDou B3I + Galileo E1B + * 606 | BeiDou B3I + GLONASS L1 C/A + * 607 | BeiDou B3I + GPS L1 C/A + Galileo E1B + * 608 | BeiDou B3I + GPS L1 C/A + Galileo E1B + BeiDou B1I + * 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 + */ // ####################### RINEX FILES ################# if (b_rinex_output_enabled) From 4248edc4f3bb5cc2a18f5161518b65f6eb0b7fe7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 6 Sep 2019 18:49:22 +0200 Subject: [PATCH 05/10] Fix for old compilers --- .../telemetry_decoder/libs/convolutional.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/algorithms/telemetry_decoder/libs/convolutional.h b/src/algorithms/telemetry_decoder/libs/convolutional.h index b1b599715..48095b93f 100644 --- a/src/algorithms/telemetry_decoder/libs/convolutional.h +++ b/src/algorithms/telemetry_decoder/libs/convolutional.h @@ -42,7 +42,6 @@ #define GNSS_SDR_CONVOLUTIONAL_H_ #include -#include #include /* define constants used throughout the library */ @@ -248,11 +247,17 @@ inline void Viterbi(int output_u_int[], /* normalize */ volk_gnsssdr_32f_index_max_32u(&max_index, next_section.data(), states); max_val = next_section[max_index]; - prev_section = next_section; - std::transform(prev_section.begin(), prev_section.end(), prev_section.begin(), - [&max_val](const auto& prev_ele) { return (prev_ele - max_val); }); - std::fill(next_section.begin(), next_section.end(), -MAXLOG); + // In modern C++ (not supported by old GCC versions): + // prev_section = next_section; + // std::transform(prev_section.begin(), prev_section.end(), prev_section.begin(), + // [&max_val](const auto& prev_ele) { return (prev_ele - max_val); }); + // std::fill(next_section.begin(), next_section.end(), -MAXLOG); + for (state = 0; state < states; state++) + { + prev_section[state] = next_section[state] - max_val; + next_section[state] = -MAXLOG; + } } /* trace-back operation */ From 345646ad7d8a4590ac3f3b023fe3d7ddadac12f1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 7 Sep 2019 09:33:48 +0200 Subject: [PATCH 06/10] Clean file --- src/algorithms/telemetry_decoder/libs/convolutional.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/algorithms/telemetry_decoder/libs/convolutional.h b/src/algorithms/telemetry_decoder/libs/convolutional.h index 48095b93f..09c735525 100644 --- a/src/algorithms/telemetry_decoder/libs/convolutional.h +++ b/src/algorithms/telemetry_decoder/libs/convolutional.h @@ -1,11 +1,13 @@ /*! * \file convolutional.h * \brief General functions used to implement convolutional encoding. - * \author Matthew C. Valenti + * \author Matthew C. Valenti, 2006-2008. + * \author C. Fernandez-Prades, 2019. * * ------------------------------------------------------------------------- * * Copyright (C) 2006-2008 Matthew C. Valenti + * Copyright (C) 2019 C. Fernandez-Prades * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -19,8 +21,6 @@ * * This file is a derived work of the original file, which had this note: * - * Last updated on May 22, 2008 - * * The functions in this file are part of the Iterative Solutions * Coded Modulation Library. The Iterative Solutions Coded Modulation * Library is free software; you can redistribute it and/or modify it @@ -248,11 +248,6 @@ inline void Viterbi(int output_u_int[], volk_gnsssdr_32f_index_max_32u(&max_index, next_section.data(), states); max_val = next_section[max_index]; - // In modern C++ (not supported by old GCC versions): - // prev_section = next_section; - // std::transform(prev_section.begin(), prev_section.end(), prev_section.begin(), - // [&max_val](const auto& prev_ele) { return (prev_ele - max_val); }); - // std::fill(next_section.begin(), next_section.end(), -MAXLOG); for (state = 0; state < states; state++) { prev_section[state] = next_section[state] - max_val; From d652903cb6140cf16e0f45b98f4fa8482abf6b0e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 7 Sep 2019 09:38:05 +0200 Subject: [PATCH 07/10] Apply formatting --- .../include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h | 9 ++++++--- .../adapters/galileo_e1_dll_pll_veml_tracking.cc | 3 +-- .../adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc | 3 +-- .../tracking/adapters/galileo_e5a_dll_pll_tracking.cc | 3 +-- .../adapters/galileo_e5a_dll_pll_tracking_fpga.cc | 3 +-- .../tracking/adapters/gps_l1_ca_dll_pll_tracking.cc | 2 +- .../tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc | 3 +-- .../tracking/adapters/gps_l2_m_dll_pll_tracking.cc | 3 +-- .../tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc | 4 ++++ .../tracking/adapters/gps_l5_dll_pll_tracking.cc | 2 +- .../tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc | 2 +- src/algorithms/tracking/libs/dll_pll_conf.h | 3 --- 12 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h index 7a73e483d..158d1abdc 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h @@ -53,16 +53,18 @@ static inline float32x4_t vsqrtq_f32(float32x4_t q_x) return vmulq_f32(q_x, q_step_2); } + /* Magnitude squared for float32x4x2_t */ static inline float32x4_t _vmagnitudesquaredq_f32(float32x4x2_t cmplxValue) { float32x4_t iValue, qValue, result; - iValue = vmulq_f32(cmplxValue.val[0], cmplxValue.val[0]); // Square the values - qValue = vmulq_f32(cmplxValue.val[1], cmplxValue.val[1]); // Square the values - result = vaddq_f32(iValue, qValue); // Add the I2 and Q2 values + iValue = vmulq_f32(cmplxValue.val[0], cmplxValue.val[0]); // Square the values + qValue = vmulq_f32(cmplxValue.val[1], cmplxValue.val[1]); // Square the values + result = vaddq_f32(iValue, qValue); // Add the I2 and Q2 values return result; } + /* Inverse square root for float32x4_t */ static inline float32x4_t _vinvsqrtq_f32(float32x4_t x) { @@ -73,6 +75,7 @@ static inline float32x4_t _vinvsqrtq_f32(float32x4_t x) return sqrt_reciprocal; } + /* Complex multiplication for float32x4x2_t */ static inline float32x4x2_t _vmultiply_complexq_f32(float32x4x2_t a_val, float32x4x2_t b_val) { diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc index 2343d10b6..b0c088ff1 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc @@ -171,13 +171,12 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); trk_param.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param.carrier_lock_test_smoother_alpha); - // ################# MAKE TRACKING GNURadio object ################### if (item_type == "gr_complex") { diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index 352f1cb09..124afcedd 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -255,13 +255,12 @@ GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( trk_param_fpga.extend_fpga_integration_periods = 1; // (number of FPGA integrations that are combined in the SW) trk_param_fpga.fpga_integration_period = 1; // (number of symbols that are effectively integrated in the FPGA) - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); - //################# MAKE TRACKING GNURadio object ################### tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); channel_ = 0; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc index 73f95f62b..abc7c8898 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -166,13 +166,12 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); trk_param.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param.carrier_lock_test_smoother_alpha); - // ################# MAKE TRACKING GNURadio object ################### if (item_type == "gr_complex") { diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index c68c86f0a..ca0d65d8d 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -262,13 +262,12 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( } } - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); - // ################# MAKE TRACKING GNURadio object ################### tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); channel_ = 0; diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index ad34c0a72..83048c07b 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -172,7 +172,7 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index 7e2d6d4b0..2ac5679b8 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -216,13 +216,12 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( } } - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); - // ################# MAKE TRACKING GNURadio object ################### tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); channel_ = 0; diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc index a27442d97..8fe63646d 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc @@ -148,13 +148,12 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); trk_param.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param.carrier_lock_test_smoother_alpha); - // ################# MAKE TRACKING GNURadio object ################### if (item_type == "gr_complex") { diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index 1e3c4aa05..310667eb7 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -102,6 +102,10 @@ GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( trk_param_fpga.max_code_lock_fail = configuration->property(role + ".max_lock_fail", trk_param_fpga.max_code_lock_fail); trk_param_fpga.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param_fpga.max_carrier_lock_fail); trk_param_fpga.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param_fpga.carrier_lock_th); + trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); + trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); + trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); + trk_param_fpga.carrier_lock_test_smoother_alpha = configuration->property(role + ".carrier_lock_test_smoother_alpha", trk_param_fpga.carrier_lock_test_smoother_alpha); // int32_t max_lock_fail = configuration->property(role + ".max_lock_fail", 50); // if (FLAGS_max_lock_fail != 50) diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc index 3ba5968b1..4f60a432e 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -168,7 +168,7 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( trk_param.max_carrier_lock_fail = configuration->property(role + ".max_carrier_lock_fail", trk_param.max_carrier_lock_fail); trk_param.carrier_lock_th = configuration->property(role + ".carrier_lock_th", trk_param.carrier_lock_th); - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param.cn0_smoother_samples); trk_param.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param.cn0_smoother_alpha); trk_param.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param.carrier_lock_test_smoother_samples); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 22096b7f1..977806c01 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -286,7 +286,7 @@ GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( } } - //tracking lock tests smoother parameters + // tracking lock tests smoother parameters trk_param_fpga.cn0_smoother_samples = configuration->property(role + ".cn0_smoother_samples", trk_param_fpga.cn0_smoother_samples); trk_param_fpga.cn0_smoother_alpha = configuration->property(role + ".cn0_smoother_alpha", trk_param_fpga.cn0_smoother_alpha); trk_param_fpga.carrier_lock_test_smoother_samples = configuration->property(role + ".carrier_lock_test_smoother_samples", trk_param_fpga.carrier_lock_test_smoother_samples); diff --git a/src/algorithms/tracking/libs/dll_pll_conf.h b/src/algorithms/tracking/libs/dll_pll_conf.h index febaa219c..9b2b6a773 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf.h +++ b/src/algorithms/tracking/libs/dll_pll_conf.h @@ -40,7 +40,6 @@ class Dll_Pll_Conf { public: /* DLL/PLL tracking configuration */ - int fll_filter_order; bool enable_fll_pull_in; bool enable_fll_steady_state; @@ -48,7 +47,6 @@ public: unsigned int bit_synchronization_time_limit_s; int pll_filter_order; int dll_filter_order; - double fs_in; uint32_t vector_length; bool dump; @@ -72,7 +70,6 @@ public: float cn0_smoother_alpha; int32_t carrier_lock_test_smoother_samples; float carrier_lock_test_smoother_alpha; - //int32_t carrier_lock_det_mav_samples; int32_t cn0_min; int32_t max_code_lock_fail; int32_t max_carrier_lock_fail; From 7f18fce958144bd6e0fc36e368618258b1113008 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 7 Sep 2019 10:08:29 +0200 Subject: [PATCH 08/10] Fix typo --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 6f0e37454..603dd3b6a 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -769,7 +769,7 @@ Rtklib_Pvt::Rtklib_Pvt(ConfigurationInterface* configuration, // Show time in local zone pvt_output_parameters.show_local_time_zone = configuration->property(role + ".show_local_time_zone", false); - // Enable or disable rx clock corection in observables + // Enable or disable rx clock correction in observables pvt_output_parameters.enable_rx_clock_correction = configuration->property(role + ".enable_rx_clock_correction", true); // make PVT object From 6e44d77e3d35aa02ab7f5f6dc4cfc4bf1f452558 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 7 Sep 2019 11:17:29 +0200 Subject: [PATCH 09/10] Update changelog --- docs/changelog | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/changelog b/docs/changelog index 57a0bc242..94815d7e1 100644 --- a/docs/changelog +++ b/docs/changelog @@ -1,5 +1,16 @@ ## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next) +### Improvements in Efficiency: + +- Improved implementation of the Viterbi decoder for Galileo navigation messages. + + +### Improvements in Flexibility: + +- New Tracking parameters allow the configuration of the C/N0 and lock detector smoothers, as well as the activation of the FLL in pull-in and steady state stages. +- 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 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. From 38a987607e9e2016ba4d2e19fd627a83f30d58ff Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 7 Sep 2019 12:36:19 +0200 Subject: [PATCH 10/10] Make use of the new Boost::headers target introduced in CMake 3.15 --- CMakeLists.txt | 5 +++++ src/algorithms/acquisition/adapters/CMakeLists.txt | 2 +- src/algorithms/channel/libs/CMakeLists.txt | 2 +- .../data_type_adapter/gnuradio_blocks/CMakeLists.txt | 2 +- src/algorithms/libs/CMakeLists.txt | 2 +- src/algorithms/observables/gnuradio_blocks/CMakeLists.txt | 2 +- src/algorithms/signal_source/adapters/CMakeLists.txt | 2 +- src/algorithms/signal_source/libs/CMakeLists.txt | 2 +- .../telemetry_decoder/gnuradio_blocks/CMakeLists.txt | 2 +- src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt | 2 +- src/algorithms/tracking/libs/CMakeLists.txt | 2 +- src/core/libs/CMakeLists.txt | 2 +- src/core/receiver/CMakeLists.txt | 2 +- src/main/CMakeLists.txt | 2 +- src/tests/system-tests/libs/CMakeLists.txt | 2 +- .../unit-tests/signal-processing-blocks/libs/CMakeLists.txt | 2 +- src/utils/front-end-cal/CMakeLists.txt | 4 ++-- 17 files changed, 22 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index deb3a7ff9..20f6935ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -762,6 +762,11 @@ if(CMAKE_VERSION VERSION_LESS 3.5) endif() endif() endif() +if(CMAKE_VERSION VERSION_LESS 3.15) + if(NOT TARGET Boost::headers) + add_library(Boost::headers ALIAS Boost::boost) + endif() +endif() # Fix for Boost Asio < 1.70 when using Clang in macOS if(Boost_VERSION_STRING VERSION_LESS 1.70.0) diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index 745e134b4..303fc7f59 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -104,7 +104,7 @@ target_link_libraries(acquisition_adapters Gnuradio::blocks Volk::volk PRIVATE - Boost::boost + Boost::headers Gflags::gflags Glog::glog Gnuradio::fft diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index 1411013a9..2b8a2d53c 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -40,7 +40,7 @@ target_link_libraries(channel_libs Gnuradio::pmt PRIVATE core_libs - Boost::boost + Boost::headers Gflags::gflags Glog::glog ) diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt index 9090d9c43..815f88e0d 100644 --- a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt @@ -42,7 +42,7 @@ add_library(data_type_gr_blocks target_link_libraries(data_type_gr_blocks PUBLIC Gnuradio::runtime - Boost::boost + Boost::headers algorithms_libs PRIVATE Volk::volk diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index 7689c7ed0..88b3ddad7 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -100,7 +100,7 @@ target_include_directories(algorithms_libs target_link_libraries(algorithms_libs PUBLIC Armadillo::armadillo - Boost::boost + Boost::headers Gflags::gflags Gnuradio::runtime Gnuradio::blocks diff --git a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt index 85edd75a9..d9847d844 100644 --- a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt @@ -45,7 +45,7 @@ target_include_directories(obs_gr_blocks target_link_libraries(obs_gr_blocks PUBLIC - Boost::boost + Boost::headers Gnuradio::blocks PRIVATE algorithms_libs diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 1cb23518b..50e794d72 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -170,7 +170,7 @@ target_include_directories(signal_source_adapters target_link_libraries(signal_source_adapters PUBLIC - Boost::boost + Boost::headers Gnuradio::runtime Gnuradio::blocks signal_source_gr_blocks diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 7bcf53893..1f968cab6 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -69,7 +69,7 @@ add_library(signal_source_libs ${SIGNAL_SOURCE_LIB_SOURCES} ${SIGNAL_SOURCE_LIB_ target_link_libraries(signal_source_libs PUBLIC - Boost::boost + Boost::headers Gnuradio::runtime PRIVATE Gflags::gflags diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index 1ad718a41..eb7ef306a 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -56,7 +56,7 @@ target_link_libraries(telemetry_decoder_gr_blocks telemetry_decoder_libs core_system_parameters Gnuradio::runtime - Boost::boost + Boost::headers PRIVATE Gflags::gflags Glog::glog diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index fdba427c0..ec7118094 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -88,7 +88,7 @@ endif() target_link_libraries(tracking_gr_blocks PUBLIC - Boost::boost + Boost::headers Armadillo::armadillo Gnuradio::blocks Matio::matio diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 1a5d30c1c..db940802a 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -88,7 +88,7 @@ add_library(tracking_libs ${TRACKING_LIB_SOURCES} ${TRACKING_LIB_HEADERS}) target_link_libraries(tracking_libs PUBLIC Armadillo::armadillo - Boost::boost + Boost::headers Gnuradio::runtime Volkgnsssdr::volkgnsssdr core_system_parameters diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index a108368ae..9b25e5fc7 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -62,7 +62,7 @@ add_library(core_libs ${CORE_LIBS_SOURCES} ${CORE_LIBS_HEADERS}) target_link_libraries(core_libs PUBLIC - Boost::boost + Boost::headers Gnuradio::runtime core_libs_supl core_system_parameters diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 9c2acfaaf..814afed30 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -148,7 +148,7 @@ target_link_libraries(core_receiver telemetry_decoder_adapters obs_adapters pvt_adapters - Boost::boost + Boost::headers Gflags::gflags Glog::glog Armadillo::armadillo diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index ded24273d..d01fe9258 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -32,7 +32,7 @@ endif() target_link_libraries(gnss-sdr PUBLIC core_receiver - Boost::boost + Boost::headers Boost::thread Gflags::gflags Glog::glog diff --git a/src/tests/system-tests/libs/CMakeLists.txt b/src/tests/system-tests/libs/CMakeLists.txt index d29962cdf..6daf33514 100644 --- a/src/tests/system-tests/libs/CMakeLists.txt +++ b/src/tests/system-tests/libs/CMakeLists.txt @@ -37,7 +37,7 @@ target_link_libraries(system_testing_lib Armadillo::armadillo Gflags::gflags PRIVATE - Boost::boost + Boost::headers Matio::matio ) diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index 4509e2ef2..8fa765095 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -43,7 +43,7 @@ target_link_libraries(signal_processing_testing_lib Gflags::gflags Gnuradio::runtime PRIVATE - Boost::boost + Boost::headers Matio::matio Glog::glog ) diff --git a/src/utils/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index 2a8df2820..c06626915 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -34,7 +34,7 @@ target_link_libraries(front_end_cal_lib core_receiver core_libs PRIVATE - Boost::boost + Boost::headers Gflags::gflags Glog::glog Gnuradio::blocks @@ -68,7 +68,7 @@ target_link_libraries(front-end-cal core_receiver front_end_cal_lib gnss_sdr_flags - Boost::boost + Boost::headers PRIVATE Gflags::gflags Glog::glog