From 84b5cfe0045f3d4706534b463fa0d7d402cf70b4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 28 Oct 2023 20:11:52 +0200 Subject: [PATCH 1/3] Bump local version of Matio to 1.5.24 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac275151c..13b5ae872 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -338,7 +338,7 @@ set(GNSSSDR_PYTHON3_MIN_VERSION "3.4") set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.6.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.6.0") -set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.23") +set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.24") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "24.4") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.13.0") From 3ecf1c4ef4a3b4eacb07db181d5230e47a16b7ba Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 Nov 2023 09:17:11 +0100 Subject: [PATCH 2/3] volk_gnsssdr: improve random integer generation --- .../volk_gnsssdr/lib/qa_utils.cc | 115 ++++++++++++------ 1 file changed, 75 insertions(+), 40 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc index 311122427..2257e51f0 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc @@ -33,59 +33,94 @@ void random_values(T *buf, unsigned int n, std::default_random_engine &e1) void load_random_data(void *data, volk_gnsssdr_type_t type, unsigned int n) { - std::random_device r; - std::default_random_engine e1(r()); - std::default_random_engine e2(r()); + std::random_device rnd_device; + std::default_random_engine rnd_engine(rnd_device()); if (type.is_complex) n *= 2; if (type.is_float) { if (type.size == 8) - random_values((double *)data, n, e1); + random_values((double *)data, n, rnd_engine); else - random_values((float *)data, n, e1); + random_values((float *)data, n, rnd_engine); } else { - float int_max = float(uint64_t(2) << (type.size * 8)); - if (type.is_signed) int_max /= 2.0; - std::uniform_real_distribution uniform_dist(-int_max, int_max); - for (unsigned int i = 0; i < n; i++) + switch (type.size) { - float scaled_rand = uniform_dist(e2); - - switch (type.size) + case 8: + if (type.is_signed) { - case 8: - if (type.is_signed) - ((int64_t *)data)[i] = (int64_t)scaled_rand; - else - ((uint64_t *)data)[i] = (uint64_t)scaled_rand; - break; - case 4: - if (type.is_signed) - ((int32_t *)data)[i] = (int32_t)scaled_rand; - else - ((uint32_t *)data)[i] = (uint32_t)scaled_rand; - break; - case 2: - // 16 bit multiplication saturates very fast - // we produce here only 3 bits input range - if (type.is_signed) - ((int16_t *)data)[i] = (int16_t)((int16_t)scaled_rand % 8); - else - ((uint16_t *)data)[i] = (uint16_t)(int16_t)((int16_t)scaled_rand % 8); - break; - case 1: - if (type.is_signed) - ((int8_t *)data)[i] = (int8_t)scaled_rand; - else - ((uint8_t *)data)[i] = (uint8_t)scaled_rand; - break; - default: - throw "load_random_data: no support for data size > 8 or < 1"; // no shenanigans here + std::uniform_int_distribution uniform_dist( + std::numeric_limits::min(), + std::numeric_limits::max()); + for (unsigned int i = 0; i < n; i++) + ((int64_t *)data)[i] = uniform_dist(rnd_engine); } + else + { + std::uniform_int_distribution uniform_dist( + std::numeric_limits::min(), + std::numeric_limits::max()); + for (unsigned int i = 0; i < n; i++) + ((uint64_t *)data)[i] = uniform_dist(rnd_engine); + } + break; + case 4: + if (type.is_signed) + { + std::uniform_int_distribution uniform_dist( + std::numeric_limits::min(), + std::numeric_limits::max()); + for (unsigned int i = 0; i < n; i++) + ((int32_t *)data)[i] = uniform_dist(rnd_engine); + } + else + { + std::uniform_int_distribution uniform_dist( + std::numeric_limits::min(), + std::numeric_limits::max()); + for (unsigned int i = 0; i < n; i++) + ((uint32_t *)data)[i] = uniform_dist(rnd_engine); + } + break; + case 2: + if (type.is_signed) + { + std::uniform_int_distribution uniform_dist(-7, 7); + for (unsigned int i = 0; i < n; i++) + ((int16_t *)data)[i] = uniform_dist(rnd_engine); + } + else + { + std::uniform_int_distribution uniform_dist( + std::numeric_limits::min(), + std::numeric_limits::max()); + for (unsigned int i = 0; i < n; i++) + ((uint16_t *)data)[i] = uniform_dist(rnd_engine); + } + break; + case 1: + if (type.is_signed) + { + std::uniform_int_distribution uniform_dist( + std::numeric_limits::min(), + std::numeric_limits::max()); + for (unsigned int i = 0; i < n; i++) + ((int8_t *)data)[i] = uniform_dist(rnd_engine); + } + else + { + std::uniform_int_distribution uniform_dist( + std::numeric_limits::min(), + std::numeric_limits::max()); + for (unsigned int i = 0; i < n; i++) + ((uint8_t *)data)[i] = uniform_dist(rnd_engine); + } + break; + default: + throw "load_random_data: no support for data size > 8 or < 1"; // no shenanigans here } } } From a4ea1f55716033c747399a4cb9373e9d32a43e47 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 Nov 2023 23:04:04 +0100 Subject: [PATCH 3/3] Galileo telemetry: restore default precision as soon as possible --- .../galileo_telemetry_decoder_gs.cc | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 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 dbc905c18..660564c14 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 @@ -600,9 +600,9 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); const auto default_precision{std::cout.precision()}; std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " - << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 + << d_channel << ": ephemeris from satellite " << d_satellite << " with CN0=" + << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl; - std::cout << std::setprecision(default_precision); // restore defaults } if (d_fnav_nav.have_new_iono_and_GST() == true) @@ -612,9 +612,8 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t const auto default_precision{std::cout.precision()}; std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite - << " with CN0=" << std::setprecision(2) << cn0 + << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl; - std::cout << std::setprecision(default_precision); // restore defaults } if (d_fnav_nav.have_new_utc_model() == true) @@ -624,8 +623,8 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t const auto default_precision{std::cout.precision()}; std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite + << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl; - std::cout << std::setprecision(default_precision); // restore defaults } } @@ -686,9 +685,8 @@ void galileo_telemetry_decoder_gs::decode_CNAV_word(uint64_t time_stamp, float * std::cout << TEXT_MAGENTA << "Receiving Galileo E6 CNAV dummy pages in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" - << std::setprecision(2) << cn0 << " dB-Hz" + << std::setprecision(2) << cn0 << " dB-Hz" << std::setprecision(default_precision) << TEXT_RESET << std::endl; - std::cout << std::setprecision(default_precision); // restore defaults } } else @@ -705,9 +703,9 @@ void galileo_telemetry_decoder_gs::decode_CNAV_word(uint64_t time_stamp, float * const auto default_precision{std::cout.precision()}; std::cout << TEXT_MAGENTA << "Receiving Galileo E6 HAS pages" << (d_cnav_nav.is_HAS_in_test_mode() == true ? " (test mode) " : " ") - << "in channel " << d_channel << " from satellite " << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << " dB-Hz" + << "in channel " << d_channel << " from satellite " << d_satellite + << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl; - std::cout << std::setprecision(default_precision); // restore defaults } } }