1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-06 01:56:25 +00:00

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

This commit is contained in:
Carles Fernandez 2019-06-06 18:45:14 +02:00
commit fe16e2443d
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 55 additions and 53 deletions

View File

@ -32,13 +32,10 @@
#include "gps_l5_signal.h" #include "gps_l5_signal.h"
#include "GPS_L5.h" #include "GPS_L5.h"
#include <cinttypes>
#include <cmath>
#include <complex>
#include <deque> #include <deque>
std::deque<bool> l5i_xa_shift(std::deque<bool> xa) std::deque<bool> l5i_xa_shift(std::deque<bool> xa) // GPS-IS-705E Figure 3-4 pp. 15
{ {
if (xa == std::deque<bool>{true, true, true, true, true, true, true, true, true, true, true, false, true}) if (xa == std::deque<bool>{true, true, true, true, true, true, true, true, true, true, true, false, true})
{ {
@ -62,7 +59,7 @@ std::deque<bool> l5q_xa_shift(std::deque<bool> xa)
} }
std::deque<bool> l5i_xb_shift(std::deque<bool> xb) std::deque<bool> l5i_xb_shift(std::deque<bool> xb) // GPS-IS-705E Figure 3-5 pp. 16
{ {
std::deque<bool> out(xb.begin(), xb.end() - 1); std::deque<bool> out(xb.begin(), xb.end() - 1);
out.push_front(xb[12] xor xb[11] xor xb[7] xor xb[6] xor xb[5] xor xb[3] xor xb[2] xor xb[0]); out.push_front(xb[12] xor xb[11] xor xb[7] xor xb[6] xor xb[5] xor xb[3] xor xb[2] xor xb[0]);
@ -146,7 +143,7 @@ void make_l5i(int32_t* _dest, int32_t prn)
{ {
xb_shift[n] = xb[(xb_offset + n) % GPS_L5I_CODE_LENGTH_CHIPS]; xb_shift[n] = xb[(xb_offset + n) % GPS_L5I_CODE_LENGTH_CHIPS];
} }
std::deque<bool> out_code(GPS_L5I_CODE_LENGTH_CHIPS, false);
for (int32_t n = 0; n < GPS_L5I_CODE_LENGTH_CHIPS; n++) for (int32_t n = 0; n < GPS_L5I_CODE_LENGTH_CHIPS; n++)
{ {
_dest[n] = xa[n] xor xb_shift[n]; _dest[n] = xa[n] xor xb_shift[n];
@ -166,7 +163,7 @@ void make_l5q(int32_t* _dest, int32_t prn)
{ {
xb_shift[n] = xb[(xb_offset + n) % GPS_L5Q_CODE_LENGTH_CHIPS]; xb_shift[n] = xb[(xb_offset + n) % GPS_L5Q_CODE_LENGTH_CHIPS];
} }
std::deque<bool> out_code(GPS_L5Q_CODE_LENGTH_CHIPS, false);
for (int32_t n = 0; n < GPS_L5Q_CODE_LENGTH_CHIPS; n++) for (int32_t n = 0; n < GPS_L5Q_CODE_LENGTH_CHIPS; n++)
{ {
_dest[n] = xa[n] xor xb_shift[n]; _dest[n] = xa[n] xor xb_shift[n];
@ -231,28 +228,24 @@ void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn,
//--- Find time constants -------------------------------------------------- //--- Find time constants --------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(GPS_L5I_CODE_RATE_HZ); // C/A chip period in sec _tc = 1.0 / static_cast<float>(GPS_L5I_CODE_RATE_HZ); // L5I primary chip period in sec
//float aux;
for (int32_t i = 0; i < _samplesPerCode; i++) for (int32_t i = 0; i < _samplesPerCode; i++)
{ {
//=== Digitizing ======================================================= //=== Digitizing =======================================================
//--- Make index array to read L5 code values ------------------------- //--- Make index array to read L5 code values -------------------------
//TODO: Check this formula! Seems to start with an extra sample _codeValueIndex = static_cast<int32_t>(std::ceil(_ts * static_cast<float>(i + 1) / _tc)) - 1;
_codeValueIndex = std::ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
//aux = (_ts * (i + 1)) / _tc;
//_codeValueIndex = static_cast<int32_t> (static_cast<long>(aux)) - 1;
//--- Make the digitized version of the L2C code ----------------------- //--- Make the digitized version of the L5I code -----------------------
if (i == _samplesPerCode - 1) if (i == _samplesPerCode - 1)
{ {
//--- Correct the last index (due to number rounding issues) ----------- //--- Correct the last index (due to number rounding issues) -----------
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeLength - 1], 0); _dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeLength - 1], 0.0);
} }
else else
{ {
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0); //repeat the chip -> upsample _dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0.0); // repeat the chip -> upsample
} }
} }
delete[] _code; delete[] _code;
@ -296,7 +289,7 @@ void gps_l5q_code_gen_float(float* _dest, uint32_t _prn)
/* /*
* Generates complex GPS L5i code for the desired SV ID and sampled to specific sampling frequency * Generates complex GPS L5Q code for the desired SV ID and sampled to specific sampling frequency
*/ */
void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs) void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs)
{ {
@ -316,7 +309,7 @@ void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn,
//--- Find time constants -------------------------------------------------- //--- Find time constants --------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec _ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(GPS_L5Q_CODE_RATE_HZ); // C/A chip period in sec _tc = 1.0 / static_cast<float>(GPS_L5Q_CODE_RATE_HZ); // L5Q chip period in sec
//float aux; //float aux;
for (int32_t i = 0; i < _samplesPerCode; i++) for (int32_t i = 0; i < _samplesPerCode; i++)
@ -324,12 +317,9 @@ void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn,
//=== Digitizing ======================================================= //=== Digitizing =======================================================
//--- Make index array to read L5 code values ------------------------- //--- Make index array to read L5 code values -------------------------
//TODO: Check this formula! Seems to start with an extra sample _codeValueIndex = static_cast<int32_t>(std::ceil(_ts * static_cast<float>(i + 1) / _tc)) - 1;
_codeValueIndex = std::ceil((_ts * (static_cast<float>(i) + 1)) / _tc) - 1;
//aux = (_ts * (i + 1)) / _tc;
//_codeValueIndex = static_cast<int32_t> (static_cast<long>(aux)) - 1;
//--- Make the digitized version of the L2C code ----------------------- //--- Make the digitized version of the L5Q code -----------------------
if (i == _samplesPerCode - 1) if (i == _samplesPerCode - 1)
{ {
//--- Correct the last index (due to number rounding issues) ----------- //--- Correct the last index (due to number rounding issues) -----------
@ -337,7 +327,7 @@ void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn,
} }
else else
{ {
_dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0); //repeat the chip -> upsample _dest[i] = std::complex<float>(1.0 - 2.0 * _code[_codeValueIndex], 0); // repeat the chip -> upsample
} }
} }
delete[] _code; delete[] _code;

View File

@ -36,18 +36,22 @@
#include <complex> #include <complex>
#include <cstdint> #include <cstdint>
//!Generates complex GPS L5i M code for the desired SV ID //! Generates complex GPS L5I code for the desired SV ID
void gps_l5i_code_gen_complex(std::complex<float>* _dest, uint32_t _prn); void gps_l5i_code_gen_complex(std::complex<float>* _dest, uint32_t _prn);
//! Generates real GPS L5I code for the desired SV ID
void gps_l5i_code_gen_float(float* _dest, uint32_t _prn); void gps_l5i_code_gen_float(float* _dest, uint32_t _prn);
//!Generates complex GPS L5q M code for the desired SV ID //! Generates complex GPS L5Q code for the desired SV ID
void gps_l5q_code_gen_complex(std::complex<float>* _dest, uint32_t _prn); void gps_l5q_code_gen_complex(std::complex<float>* _dest, uint32_t _prn);
//! Generates real GPS L5Q code for the desired SV ID
void gps_l5q_code_gen_float(float* _dest, uint32_t _prn); void gps_l5q_code_gen_float(float* _dest, uint32_t _prn);
//! Generates complex GPS L5i M code for the desired SV ID, and sampled to specific sampling frequency //! Generates complex GPS L5I code for the desired SV ID, and sampled to specific sampling frequency
void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs); void gps_l5i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs);
//! Generates complex GPS L5q M code for the desired SV ID, and sampled to specific sampling frequency //! Generates complex GPS L5Q code for the desired SV ID, and sampled to specific sampling frequency
void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs); void gps_l5q_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs);

View File

@ -97,7 +97,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
d_frame_length_symbols = GALILEO_INAV_PAGE_PART_SYMBOLS - GALILEO_INAV_PREAMBLE_LENGTH_BITS; d_frame_length_symbols = GALILEO_INAV_PAGE_PART_SYMBOLS - GALILEO_INAV_PREAMBLE_LENGTH_BITS;
CodeLength = GALILEO_INAV_PAGE_PART_SYMBOLS - GALILEO_INAV_PREAMBLE_LENGTH_BITS; CodeLength = GALILEO_INAV_PAGE_PART_SYMBOLS - GALILEO_INAV_PREAMBLE_LENGTH_BITS;
DataLength = (CodeLength / nn) - mm; DataLength = (CodeLength / nn) - mm;
d_max_symbols_without_valid_frame = GALILEO_INAV_PAGE_PART_SYMBOLS * 10; //rise alarm 10 seconds without valid tlm d_max_symbols_without_valid_frame = GALILEO_INAV_PAGE_PART_SYMBOLS * 30; //rise alarm 30 seconds without valid tlm
break; break;
} }
@ -127,7 +127,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
d_secondary_code_samples[i] = -1; d_secondary_code_samples[i] = -1;
} }
} }
d_max_symbols_without_valid_frame = GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_FNAV_SYMBOLS_PER_PAGE * 10; //rise alarm 10 seconds without valid tlm d_max_symbols_without_valid_frame = GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_FNAV_SYMBOLS_PER_PAGE * 30; //rise alarm 30 seconds without valid tlm
break; break;
} }
default: default:
@ -532,13 +532,14 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
corr_value += d_preamble_samples[i]; corr_value += d_preamble_samples[i];
} }
} }
if (abs(corr_value) >= d_samples_per_preamble)
{
d_preamble_index = d_sample_counter; // record the preamble sample stamp
DLOG(INFO) << "Preamble detection for Galileo satellite " << this->d_satellite;
d_stat = 1; // enter into frame pre-detection status
}
} }
if (abs(corr_value) >= d_samples_per_preamble)
{
d_preamble_index = d_sample_counter; // record the preamble sample stamp
DLOG(INFO) << "Preamble detection for Galileo satellite " << this->d_satellite;
d_stat = 1; // enter into frame pre-detection status
}
break; break;
} }
case 1: // possible preamble lock case 1: // possible preamble lock
@ -560,25 +561,32 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
corr_value += d_preamble_samples[i]; corr_value += d_preamble_samples[i];
} }
} }
} if (abs(corr_value) >= d_samples_per_preamble)
if (abs(corr_value) >= d_samples_per_preamble)
{
// check preamble separation
preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
if (abs(preamble_diff - d_preamble_period_symbols) == 0)
{ {
// try to decode frame // check preamble separation
DLOG(INFO) << "Starting page decoder for Galileo satellite " << this->d_satellite; preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
d_preamble_index = d_sample_counter; // record the preamble sample stamp if (abs(preamble_diff - d_preamble_period_symbols) == 0)
d_CRC_error_counter = 0;
if (corr_value < 0) flag_PLL_180_deg_phase_locked = true;
d_stat = 2;
}
else
{
if (preamble_diff > d_preamble_period_symbols)
{ {
d_stat = 0; // start again // try to decode frame
DLOG(INFO) << "Starting page decoder for Galileo satellite " << this->d_satellite;
d_preamble_index = d_sample_counter; // record the preamble sample stamp
d_CRC_error_counter = 0;
if (corr_value < 0)
{
flag_PLL_180_deg_phase_locked = true;
}
else
{
flag_PLL_180_deg_phase_locked = false;
}
d_stat = 2;
}
else
{
if (preamble_diff > d_preamble_period_symbols)
{
d_stat = 0; // start again
}
} }
} }
} }