1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-18 21:23:02 +00:00

Minor, misc. fixes

This commit is contained in:
Carles Fernandez 2020-07-21 14:31:45 +02:00
parent 945c86a4c4
commit 5d4dbf3ce7
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 17 additions and 30 deletions

View File

@ -23,6 +23,7 @@
#include "Galileo_E1.h"
#include "gnss_signal_processing.h"
#include <cmath>
#include <cstddef> // for size_t
#include <memory>
#include <string>
#include <utility>
@ -112,22 +113,20 @@ void galileo_e1_code_gen_sinboc11_float(own::span<float> _dest, const std::array
void galileo_e1_gen_float(own::span<float> _dest, own::span<int> _prn, const std::array<char, 3>& _Signal)
{
constexpr uint32_t _codeLength = 12 * GALILEO_E1_B_CODE_LENGTH_CHIPS;
const auto _codeLength = _dest.size();
const float alpha = std::sqrt(10.0F / 11.0F);
const float beta = std::sqrt(1.0F / 11.0F);
const std::string _galileo_signal = _Signal.data();
std::array<int32_t, 12 * 4092> sinboc_11{};
std::array<int32_t, 12 * 4092> sinboc_61{};
own::span<int32_t> sinboc_11_(sinboc_11.data(), _codeLength);
own::span<int32_t> sinboc_61_(sinboc_61.data(), _codeLength);
std::vector<int32_t> sinboc_11(_codeLength);
std::vector<int32_t> sinboc_61(_codeLength);
galileo_e1_sinboc_11_gen_int(sinboc_11_, _prn); // generate sinboc(1,1) 12 samples per chip
galileo_e1_sinboc_61_gen_int(sinboc_61_, _prn); // generate sinboc(6,1) 12 samples per chip
galileo_e1_sinboc_11_gen_int(sinboc_11, _prn); // generate sinboc(1,1) 12 samples per chip
galileo_e1_sinboc_61_gen_int(sinboc_61, _prn); // generate sinboc(6,1) 12 samples per chip
if (_galileo_signal.rfind("1B") != std::string::npos && _galileo_signal.length() >= 2)
{
for (uint32_t i = 0; i < _codeLength; i++)
for (size_t i = 0; i < _codeLength; i++)
{
_dest[i] = alpha * static_cast<float>(sinboc_11[i]) +
beta * static_cast<float>(sinboc_61[i]);
@ -135,7 +134,7 @@ void galileo_e1_gen_float(own::span<float> _dest, own::span<int> _prn, const std
}
else if (_galileo_signal.rfind("1C") != std::string::npos && _galileo_signal.length() >= 2)
{
for (uint32_t i = 0; i < _codeLength; i++)
for (size_t i = 0; i < _codeLength; i++)
{
_dest[i] = alpha * static_cast<float>(sinboc_11[i]) -
beta * static_cast<float>(sinboc_61[i]);

View File

@ -154,20 +154,14 @@ void resampler(const own::span<float> _from, own::span<float> _dest, float _fs_i
{
uint32_t _codeValueIndex;
float aux;
// --- Find time constants -------------------------------------------------
const float _t_in = 1.0F / _fs_in; // Incoming sampling period in sec
const float _t_out = 1.0F / _fs_out; // Out sampling period in sec
const float _t_out = 1.0F / _fs_out; // Output sampling period
for (size_t i = 0; i < _dest.size() - 1; i++)
{
// === Digitizing ==================================================
// --- compute index array to read sampled values ------------------
aux = (_t_out * (static_cast<float>(i) + 1.0F)) / _t_in;
aux = (_t_out * (static_cast<float>(i) + 1.0F)) * _fs_in;
_codeValueIndex = AUX_CEIL2(aux) - 1;
// if repeat the chip -> upsample by nearest neighborhood interpolation
_dest[i] = _from[_codeValueIndex];
}
// --- Correct the last index (due to number rounding issues) -----------
// Correct the last index (due to number rounding issues)
_dest[_dest.size() - 1] = _from[_from.size() - 1];
}
@ -177,19 +171,13 @@ void resampler(own::span<const std::complex<float>> _from, own::span<std::comple
{
uint32_t _codeValueIndex;
float aux;
// --- Find time constants -------------------------------------------------
const float _t_in = 1.0F / _fs_in; // Incoming sampling period in sec
const float _t_out = 1.0F / _fs_out; // Out sampling period in sec
const float _t_out = 1.0F / _fs_out; // Output sampling period
for (size_t i = 0; i < _dest.size() - 1; i++)
{
// === Digitizing ==================================================
// --- compute index array to read sampled values ------------------
aux = (_t_out * (static_cast<float>(i) + 1.0F)) / _t_in;
aux = (_t_out * (static_cast<float>(i) + 1.0F)) * _fs_in;
_codeValueIndex = AUX_CEIL2(aux) - 1;
// if repeat the chip -> upsample by nearest neighborhood interpolation
_dest[i] = _from[_codeValueIndex];
}
// --- Correct the last index (due to number rounding issues) -----------
// Correct the last index (due to number rounding issues)
_dest[_dest.size() - 1] = _from[_from.size() - 1];
}

View File

@ -274,19 +274,19 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
if (d_nav.satellite_validation() == true)
{
// get ephemeris object for this SV (mandatory)
std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(d_nav.get_ephemeris());
const std::shared_ptr<Gps_Ephemeris> tmp_obj = std::make_shared<Gps_Ephemeris>(d_nav.get_ephemeris());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
break;
case 4: // Possible IONOSPHERE and UTC model update (page 18)
if (d_nav.get_flag_iono_valid() == true)
{
std::shared_ptr<Gps_Iono> tmp_obj = std::make_shared<Gps_Iono>(d_nav.get_iono());
const std::shared_ptr<Gps_Iono> tmp_obj = std::make_shared<Gps_Iono>(d_nav.get_iono());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
if (d_nav.get_flag_utc_model_valid() == true)
{
std::shared_ptr<Gps_Utc_Model> tmp_obj = std::make_shared<Gps_Utc_Model>(d_nav.get_utc_model());
const std::shared_ptr<Gps_Utc_Model> tmp_obj = std::make_shared<Gps_Utc_Model>(d_nav.get_utc_model());
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
break;