From 3f17a207fdff8e25bb7ad61d51f4d92e1a3dccf6 Mon Sep 17 00:00:00 2001 From: piyush0411 Date: Mon, 1 Jun 2020 19:59:42 +0530 Subject: [PATCH 1/5] Modified Signal Processing Files --- .../libs/galileo_e5_signal_processing.cc | 102 +++++++++++++++++- .../libs/galileo_e5_signal_processing.h | 22 +++- 2 files changed, 122 insertions(+), 2 deletions(-) diff --git a/src/algorithms/libs/galileo_e5_signal_processing.cc b/src/algorithms/libs/galileo_e5_signal_processing.cc index ad72c085c..d4821f115 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.cc +++ b/src/algorithms/libs/galileo_e5_signal_processing.cc @@ -3,11 +3,13 @@ * \brief This library implements various functions for Galileo E5 signals such * as replica code generation * \author Marc Sales, 2014. marcsales92(at)gmail.com + * \author Piyush Gupta, 2020. piyush04111999@gmail.com + * \note Code added as part of GSoc 2020 Program. * * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -21,6 +23,7 @@ #include "galileo_e5_signal_processing.h" #include "Galileo_E5a.h" +#include "Galileo_E5b.h" #include "gnss_signal_processing.h" #include #include @@ -123,3 +126,100 @@ void galileo_e5_a_code_gen_complex_sampled(own::span> _dest, _dest[(i + delay) % _samplesPerCode] = _code[i]; } } + + +void galileo_e5_b_code_gen_complex_primary(own::span> _dest, + int32_t _prn, + const std::array& _Signal) // to differentiate between E5a and E5b signal +{ + uint32_t prn = _prn - 1; + uint32_t index = 0; + std::array a{}; + if ((_prn < 1) || (_prn > 50)) + { + return; + } + if (_Signal[0] == '5' && _Signal[1] == 'b' && _Signal[2] == 'Q') + { + for (size_t i = 0; i < GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1; i++) + { + hex_to_binary_converter(a, GALILEO_E5B_Q_PRIMARY_CODE[prn][i]); + _dest[index] = std::complex(static_cast(a[0]), 0.0); + _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); + _dest[index + 2] = std::complex(static_cast(a[2]), 0.0); + _dest[index + 3] = std::complex(static_cast(a[3]), 0.0); + index = index + 4; + } + // last 2 bits are filled up zeros + hex_to_binary_converter(a, GALILEO_E5B_Q_PRIMARY_CODE[prn][GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1]); + _dest[index] = std::complex(static_cast(a[0]), 0.0); + _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); + } + else if (_Signal[0] == '5' && _Signal[1] == 'b' && _Signal[2] == 'I') + { + for (size_t i = 0; i < GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1; i++) + { + hex_to_binary_converter(a, GALILEO_E5B_I_PRIMARY_CODE[prn][i]); + _dest[index] = std::complex(static_cast(a[0]), 0.0); + _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); + _dest[index + 2] = std::complex(static_cast(a[2]), 0.0); + _dest[index + 3] = std::complex(static_cast(a[3]), 0.0); + index = index + 4; + } + // last 2 bits are filled up zeros + hex_to_binary_converter(a, GALILEO_E5B_I_PRIMARY_CODE[prn][GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1]); + _dest[index] = std::complex(static_cast(a[0]), 0.0); + _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); + } + else if (_Signal[0] == '5' && _Signal[1] == 'b' && _Signal[2] == 'X') + { + std::array b{}; + for (size_t i = 0; i < GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1; i++) + { + hex_to_binary_converter(a, GALILEO_E5B_I_PRIMARY_CODE[prn][i]); + hex_to_binary_converter(b, GALILEO_E5B_Q_PRIMARY_CODE[prn][i]); + _dest[index] = std::complex(static_cast(a[0]), static_cast(b[0])); + _dest[index + 1] = std::complex(static_cast(a[1]), static_cast(b[1])); + _dest[index + 2] = std::complex(static_cast(a[2]), static_cast(b[2])); + _dest[index + 3] = std::complex(static_cast(a[3]), static_cast(b[3])); + index = index + 4; + } + // last 2 bits are filled up zeros + hex_to_binary_converter(a, GALILEO_E5B_I_PRIMARY_CODE[prn][GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1]); + hex_to_binary_converter(b, GALILEO_E5B_Q_PRIMARY_CODE[prn][GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1]); + _dest[index] = std::complex(static_cast(a[0]), static_cast(b[0])); + _dest[index + 1] = std::complex(static_cast(a[1]), static_cast(b[1])); + } +} + + +void galileo_e5_b_code_gen_complex_sampled(own::span> _dest, + uint32_t _prn, + const std::array& _Signal, + int32_t _fs, + uint32_t _chip_shift) +{ + uint32_t _samplesPerCode; + uint32_t delay; + const uint32_t _codeLength = GALILEO_E5B_CODE_LENGTH_CHIPS; + const int32_t _codeFreqBasis = GALILEO_E5B_CODE_CHIP_RATE_CPS; + + std::vector> _code(_codeLength); + galileo_e5_b_code_gen_complex_primary(_code, _prn, _Signal); + + _samplesPerCode = static_cast(static_cast(_fs) / (static_cast(_codeFreqBasis) / static_cast(_codeLength))); + + delay = ((_codeLength - _chip_shift) % _codeLength) * _samplesPerCode / _codeLength; + + if (_fs != _codeFreqBasis) + { + std::vector> _resampled_signal(_samplesPerCode); + resampler(_code, _resampled_signal, _codeFreqBasis, _fs); // resamples code to fs + _code = std::move(_resampled_signal); + } + + for (uint32_t i = 0; i < _samplesPerCode; i++) + { + _dest[(i + delay) % _samplesPerCode] = _code[i]; + } +} diff --git a/src/algorithms/libs/galileo_e5_signal_processing.h b/src/algorithms/libs/galileo_e5_signal_processing.h index 040b66188..ee8f6bc10 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.h +++ b/src/algorithms/libs/galileo_e5_signal_processing.h @@ -3,11 +3,13 @@ * \brief This library implements various functions for Galileo E5 signals such * as replica code generation * \author Marc Sales, 2014. marcsales92(at)gmail.com + * \author Piyush Gupta, 2020. piyush04111999@gmail.com + * \note Code added as part of GSoC 2020 Program. * * * ------------------------------------------------------------------------- * - * Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) * * GNSS-SDR is a software defined Global Navigation * Satellite Systems receiver @@ -52,4 +54,22 @@ void galileo_e5_a_code_gen_complex_sampled(own::span> _dest, uint32_t _chip_shift); +/*! + * \brief Generates Galileo E5b code at 1 sample/chip + */ +void galileo_e5_b_code_gen_complex_primary(own::span> _dest, + int32_t _prn, + const std::array& _Signal); + + +/*! + * \brief Generates Galileo E5b complex code, shifted to the desired chip and + * sampled at a frequency fs + */ +void galileo_e5_b_code_gen_complex_sampled(own::span> _dest, + uint32_t _prn, + const std::array& _Signal, + int32_t _fs, + uint32_t _chip_shift); + #endif // GNSS_SDR_GALILEO_E5_SIGNAL_PROCESSING_H From 2700c1c262816e15a58826a55d4b0799849ba8d7 Mon Sep 17 00:00:00 2001 From: piyush0411 Date: Mon, 1 Jun 2020 21:23:41 +0530 Subject: [PATCH 2/5] Fixed a typo --- src/algorithms/libs/galileo_e5_signal_processing.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/libs/galileo_e5_signal_processing.cc b/src/algorithms/libs/galileo_e5_signal_processing.cc index d4821f115..c2cd93fcc 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.cc +++ b/src/algorithms/libs/galileo_e5_signal_processing.cc @@ -195,7 +195,7 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, void galileo_e5_b_code_gen_complex_sampled(own::span> _dest, uint32_t _prn, - const std::array& _Signal, + const std::array& _Signal, int32_t _fs, uint32_t _chip_shift) { From bc0b32bc645db6bcb811fcfb2798c6176278e5f1 Mon Sep 17 00:00:00 2001 From: piyush0411 Date: Wed, 3 Jun 2020 01:33:53 +0530 Subject: [PATCH 3/5] Made the changes. --- .../libs/galileo_e5_signal_processing.cc | 16 +++++++++++----- .../libs/galileo_e5_signal_processing.h | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/algorithms/libs/galileo_e5_signal_processing.cc b/src/algorithms/libs/galileo_e5_signal_processing.cc index c2cd93fcc..8753b9ca4 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.cc +++ b/src/algorithms/libs/galileo_e5_signal_processing.cc @@ -130,7 +130,7 @@ void galileo_e5_a_code_gen_complex_sampled(own::span> _dest, void galileo_e5_b_code_gen_complex_primary(own::span> _dest, int32_t _prn, - const std::array& _Signal) // to differentiate between E5a and E5b signal + const std::array& _Signal) { uint32_t prn = _prn - 1; uint32_t index = 0; @@ -139,7 +139,7 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, { return; } - if (_Signal[0] == '5' && _Signal[1] == 'b' && _Signal[2] == 'Q') + if (_Signal[0] == '5' && _Signal[1] == 'Q') { for (size_t i = 0; i < GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1; i++) { @@ -154,8 +154,10 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(a, GALILEO_E5B_Q_PRIMARY_CODE[prn][GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), 0.0); _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); + _dest[index + 2] = std::complex(0.0, 0.0); + _dest[index + 3] = std::complex(0.0, 0.0); } - else if (_Signal[0] == '5' && _Signal[1] == 'b' && _Signal[2] == 'I') + else if (_Signal[0] == '5' && _Signal[1] == 'I') { for (size_t i = 0; i < GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1; i++) { @@ -170,8 +172,10 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(a, GALILEO_E5B_I_PRIMARY_CODE[prn][GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), 0.0); _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); + _dest[index + 2] = std::complex(0.0, 0.0); + _dest[index + 3] = std::complex(0.0, 0.0); } - else if (_Signal[0] == '5' && _Signal[1] == 'b' && _Signal[2] == 'X') + else if (_Signal[0] == '5' && _Signal[1] == 'X') { std::array b{}; for (size_t i = 0; i < GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1; i++) @@ -189,13 +193,15 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(b, GALILEO_E5B_Q_PRIMARY_CODE[prn][GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), static_cast(b[0])); _dest[index + 1] = std::complex(static_cast(a[1]), static_cast(b[1])); + _dest[index + 2] = std::complex(0.0, 0.0); + _dest[index + 3] = std::complex(0.0, 0.0); } } void galileo_e5_b_code_gen_complex_sampled(own::span> _dest, uint32_t _prn, - const std::array& _Signal, + const std::array& _Signal, int32_t _fs, uint32_t _chip_shift) { diff --git a/src/algorithms/libs/galileo_e5_signal_processing.h b/src/algorithms/libs/galileo_e5_signal_processing.h index ee8f6bc10..08426e878 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.h +++ b/src/algorithms/libs/galileo_e5_signal_processing.h @@ -59,7 +59,7 @@ void galileo_e5_a_code_gen_complex_sampled(own::span> _dest, */ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, int32_t _prn, - const std::array& _Signal); + const std::array& _Signal); /*! @@ -68,7 +68,7 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, */ void galileo_e5_b_code_gen_complex_sampled(own::span> _dest, uint32_t _prn, - const std::array& _Signal, + const std::array& _Signal, int32_t _fs, uint32_t _chip_shift); From 261d841deb8f24d6c42c19e964cbc043c700a5c2 Mon Sep 17 00:00:00 2001 From: piyush0411 Date: Wed, 3 Jun 2020 18:06:31 +0530 Subject: [PATCH 4/5] Further Modifications done --- src/algorithms/libs/galileo_e5_signal_processing.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/algorithms/libs/galileo_e5_signal_processing.cc b/src/algorithms/libs/galileo_e5_signal_processing.cc index 8753b9ca4..c1b05182f 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.cc +++ b/src/algorithms/libs/galileo_e5_signal_processing.cc @@ -57,6 +57,8 @@ void galileo_e5_a_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(a, GALILEO_E5A_Q_PRIMARY_CODE[prn][GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), 0.0); _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); + _dest[index + 2] = std::complex(0.0, 0.0); + _dest[index + 3] = std::complex(0.0, 0.0); } else if (_Signal[0] == '5' && _Signal[1] == 'I') { @@ -73,6 +75,8 @@ void galileo_e5_a_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn][GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), 0.0); _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); + _dest[index + 2] = std::complex(0.0, 0.0); + _dest[index + 3] = std::complex(0.0, 0.0); } else if (_Signal[0] == '5' && _Signal[1] == 'X') { @@ -92,6 +96,8 @@ void galileo_e5_a_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(b, GALILEO_E5A_Q_PRIMARY_CODE[prn][GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), static_cast(b[0])); _dest[index + 1] = std::complex(static_cast(a[1]), static_cast(b[1])); + _dest[index + 2] = std::complex(0.0, 0.0); + _dest[index + 3] = std::complex(0.0, 0.0); } } From 2b66cd1da286889e610a0f1385f5a678584c3a34 Mon Sep 17 00:00:00 2001 From: piyush0411 Date: Thu, 4 Jun 2020 07:51:37 +0530 Subject: [PATCH 5/5] Changed two files. --- .../libs/galileo_e5_signal_processing.cc | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/algorithms/libs/galileo_e5_signal_processing.cc b/src/algorithms/libs/galileo_e5_signal_processing.cc index c1b05182f..f3286abbd 100644 --- a/src/algorithms/libs/galileo_e5_signal_processing.cc +++ b/src/algorithms/libs/galileo_e5_signal_processing.cc @@ -57,8 +57,6 @@ void galileo_e5_a_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(a, GALILEO_E5A_Q_PRIMARY_CODE[prn][GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), 0.0); _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); - _dest[index + 2] = std::complex(0.0, 0.0); - _dest[index + 3] = std::complex(0.0, 0.0); } else if (_Signal[0] == '5' && _Signal[1] == 'I') { @@ -75,8 +73,6 @@ void galileo_e5_a_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn][GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), 0.0); _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); - _dest[index + 2] = std::complex(0.0, 0.0); - _dest[index + 3] = std::complex(0.0, 0.0); } else if (_Signal[0] == '5' && _Signal[1] == 'X') { @@ -96,8 +92,6 @@ void galileo_e5_a_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(b, GALILEO_E5A_Q_PRIMARY_CODE[prn][GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), static_cast(b[0])); _dest[index + 1] = std::complex(static_cast(a[1]), static_cast(b[1])); - _dest[index + 2] = std::complex(0.0, 0.0); - _dest[index + 3] = std::complex(0.0, 0.0); } } @@ -145,7 +139,7 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, { return; } - if (_Signal[0] == '5' && _Signal[1] == 'Q') + if (_Signal[0] == '7' && _Signal[1] == 'Q') { for (size_t i = 0; i < GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1; i++) { @@ -160,10 +154,8 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(a, GALILEO_E5B_Q_PRIMARY_CODE[prn][GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), 0.0); _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); - _dest[index + 2] = std::complex(0.0, 0.0); - _dest[index + 3] = std::complex(0.0, 0.0); } - else if (_Signal[0] == '5' && _Signal[1] == 'I') + else if (_Signal[0] == '7' && _Signal[1] == 'I') { for (size_t i = 0; i < GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1; i++) { @@ -178,10 +170,8 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(a, GALILEO_E5B_I_PRIMARY_CODE[prn][GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), 0.0); _dest[index + 1] = std::complex(static_cast(a[1]), 0.0); - _dest[index + 2] = std::complex(0.0, 0.0); - _dest[index + 3] = std::complex(0.0, 0.0); } - else if (_Signal[0] == '5' && _Signal[1] == 'X') + else if (_Signal[0] == '7' && _Signal[1] == 'X') { std::array b{}; for (size_t i = 0; i < GALILEO_E5B_I_PRIMARY_CODE[prn].length() - 1; i++) @@ -199,8 +189,6 @@ void galileo_e5_b_code_gen_complex_primary(own::span> _dest, hex_to_binary_converter(b, GALILEO_E5B_Q_PRIMARY_CODE[prn][GALILEO_E5B_Q_PRIMARY_CODE[prn].length() - 1]); _dest[index] = std::complex(static_cast(a[0]), static_cast(b[0])); _dest[index + 1] = std::complex(static_cast(a[1]), static_cast(b[1])); - _dest[index + 2] = std::complex(0.0, 0.0); - _dest[index + 3] = std::complex(0.0, 0.0); } }