1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00
This commit is contained in:
Carles Fernandez 2019-02-10 14:10:53 +01:00
commit 125b4cefa7
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
15 changed files with 380 additions and 356 deletions

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -32,26 +32,26 @@
#include "beidou_b1i_signal_processing.h"
auto auxCeil = [](float x) { return static_cast<int>(static_cast<long>((x) + 1)); };
auto auxCeil = [](float x) { return static_cast<int32_t>(static_cast<int64_t>((x) + 1)); };
void beidou_b1i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shift)
void beidou_b1i_code_gen_int(int32_t* _dest, int32_t _prn, uint32_t _chip_shift)
{
const unsigned int _code_length = 2046;
const uint32_t _code_length = 2046;
bool G1[_code_length];
bool G2[_code_length];
bool G1_register[11] = {false, true, false, true, false, true, false, true, false, true, false};
bool G2_register[11] = {false, true, false, true, false, true, false, true, false, true, false};
bool feedback1, feedback2;
bool aux;
unsigned int lcv, lcv2;
unsigned int delay;
signed int prn_idx;
uint32_t lcv, lcv2;
uint32_t delay;
int32_t prn_idx;
/* G2 Delays as defined in GPS-ISD-200D */
const signed int delays[33] = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547,
const int32_t delays[33] = {712 /*PRN1*/, 1581, 1414, 1550, 581, 771, 1311, 1043, 1549, 359, 710, 1579, 1548, 1103, 579, 769, 358, 709, 1411, 1547,
1102, 578, 357, 1577, 1410, 1546, 1101, 707, 1576, 1409, 1545, 354 /*PRN32*/,
705};
const signed int phase1[37] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10};
const signed int phase2[37] = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11};
const int32_t phase1[37] = {1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 8, 8, 8, 9, 9, 10};
const int32_t phase2[37] = {3, 4, 5, 6, 8, 9, 10, 11, 7, 4, 5, 6, 8, 9, 10, 11, 5, 6, 8, 9, 10, 11, 6, 8, 9, 10, 11, 8, 9, 10, 11, 9, 10, 11, 10, 11, 11};
// compute delay array index for given PRN number
prn_idx = _prn - 1;
@ -110,28 +110,28 @@ void beidou_b1i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shi
}
void beidou_b1i_code_gen_float(float* _dest, signed int _prn, unsigned int _chip_shift)
void beidou_b1i_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift)
{
unsigned int _code_length = 2046;
int b1i_code_int[_code_length];
uint32_t _code_length = 2046;
int32_t b1i_code_int[_code_length];
beidou_b1i_code_gen_int(b1i_code_int, _prn, _chip_shift);
for (unsigned int ii = 0; ii < _code_length; ++ii)
for (uint32_t ii = 0; ii < _code_length; ++ii)
{
_dest[ii] = static_cast<float>(b1i_code_int[ii]);
}
}
void beidou_b1i_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift)
void beidou_b1i_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift)
{
unsigned int _code_length = 2046;
int b1i_code_int[_code_length];
uint32_t _code_length = 2046;
int32_t b1i_code_int[_code_length];
beidou_b1i_code_gen_int(b1i_code_int, _prn, _chip_shift);
for (unsigned int ii = 0; ii < _code_length; ++ii)
for (uint32_t ii = 0; ii < _code_length; ++ii)
{
_dest[ii] = std::complex<float>(static_cast<float>(b1i_code_int[ii]), 0.0f);
}
@ -141,26 +141,26 @@ void beidou_b1i_code_gen_complex(std::complex<float>* _dest, signed int _prn, un
/*
* Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency
*/
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int _fs, unsigned int _chip_shift)
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift)
{
// This function is based on the GNU software GPS for MATLAB in the Kay Borre book
std::complex<float> _code[2046];
signed int _samplesPerCode, _codeValueIndex;
int32_t _samplesPerCode, _codeValueIndex;
float _ts;
float _tc;
float aux;
const signed int _codeFreqBasis = 2046000; //Hz
const signed int _codeLength = 2046;
const int32_t _codeFreqBasis = 2046000; //Hz
const int32_t _codeLength = 2046;
//--- Find number of samples per spreading code ----------------------------
_samplesPerCode = static_cast<signed int>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
_samplesPerCode = static_cast<int32_t>(static_cast<double>(_fs) / static_cast<double>(_codeFreqBasis / _codeLength));
//--- Find time constants --------------------------------------------------
_ts = 1.0 / static_cast<float>(_fs); // Sampling period in sec
_tc = 1.0 / static_cast<float>(_codeFreqBasis); // C/A chip period in sec
beidou_b1i_code_gen_complex(_code, _prn, _chip_shift); //generate C/A code 1 sample per chip
for (signed int i = 0; i < _samplesPerCode; i++)
for (int32_t i = 0; i < _samplesPerCode; i++)
{
//=== Digitizing =======================================================

View File

@ -7,7 +7,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -30,25 +30,26 @@
* -------------------------------------------------------------------------
*/
#ifndef BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_
#define BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_
#ifndef GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_
#define GNSS_SDR_BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_
#include <complex>
#include <iostream>
#include <cstdint>
//!Generates int GPS L1 C/A code for the desired SV ID and code shift
void beidou_b1i_code_gen_int(int* _dest, signed int _prn, unsigned int _chip_shift);
//! Generates int32_t GPS L1 C/A code for the desired SV ID and code shift
void beidou_b1i_code_gen_int(int32_t* _dest, int32_t _prn, uint32_t _chip_shift);
//!Generates float GPS L1 C/A code for the desired SV ID and code shift
void beidou_b1i_code_gen_float(float* _dest, signed int _prn, unsigned int _chip_shift);
//! Generates float GPS L1 C/A code for the desired SV ID and code shift
void beidou_b1i_code_gen_float(float* _dest, int32_t _prn, uint32_t _chip_shift);
//!Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
void beidou_b1i_code_gen_complex(std::complex<float>* _dest, signed int _prn, unsigned int _chip_shift);
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift, and sampled to specific sampling frequency
void beidou_b1i_code_gen_complex(std::complex<float>* _dest, int32_t _prn, uint32_t _chip_shift);
//! Generates N complex GPS L1 C/A codes for the desired SV ID and code shift
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int _fs, unsigned int _chip_shift, unsigned int _ncodes);
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift, uint32_t _ncodes);
//! Generates complex GPS L1 C/A code for the desired SV ID and code shift
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, unsigned int _prn, int _fs, unsigned int _chip_shift);
void beidou_b1i_code_gen_complex_sampled(std::complex<float>* _dest, uint32_t _prn, int32_t _fs, uint32_t _chip_shift);
#endif /* BEIDOU_B1I_SDR_SIGNAL_PROCESSING_H_ */

View File

@ -3309,7 +3309,7 @@ std::map<std::string, int> Rtcm::galileo_signal_map = [] {
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000));
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000)); // NOLINT(google-runtime-int)
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
@ -3318,7 +3318,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double
boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const
{
const double gps_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000));
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((gps_t + 604800 * static_cast<double>(eph.i_GPS_week % 1024)) * 1000)); // NOLINT(google-runtime-int)
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
@ -3327,7 +3327,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, d
boost::posix_time::ptime Rtcm::compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const
{
double galileo_t = obs_time;
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000));
boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast<long>((galileo_t + 604800 * static_cast<double>(eph.WN_5)) * 1000)); // NOLINT(google-runtime-int)
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
return p_time;
}
@ -5233,19 +5233,19 @@ int32_t Rtcm::set_DF401(const Gnss_Synchro& gnss_synchro)
{
lambda = GPS_C_m_s / GPS_L1_FREQ_HZ;
}
if ((sig.compare("2S")) == 0 && (sys == "G"))
if ((sig == "2S") && (sys == "G"))
{
lambda = GPS_C_m_s / GPS_L2_FREQ_HZ;
}
if ((sig.compare("5X")) == 0 && (sys == "E"))
if ((sig == "5X") && (sys == "E"))
{
lambda = GPS_C_m_s / Galileo_E5a_FREQ_HZ;
}
if ((sig.compare("1B")) == 0 && (sys == "E"))
if ((sig == "1B") && (sys == "E"))
{
lambda = GPS_C_m_s / Galileo_E1_FREQ_HZ;
}
if ((sig.compare("7X")) == 0 && (sys == "E"))
if ((sig == "7X") && (sys == "E"))
{
lambda = GPS_C_m_s / 1.207140e9; // Galileo_E1b_FREQ_HZ;
}
@ -5303,7 +5303,7 @@ int32_t Rtcm::set_DF402(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& e
lock_time_period_s = Rtcm::lock_time(ephCNAV, obs_time, gnss_synchro);
}
// TODO Should add system for galileo satellites
if (sig_.compare("1B") || sig_.compare("5X") || sig_.compare("7X") || sig_.compare("8X"))
if ((sig_ == "1B") || (sig_ == "5X") || (sig_ == "7X") || (sig_ == "8X"))
{
lock_time_period_s = Rtcm::lock_time(ephFNAV, obs_time, gnss_synchro);
}
@ -5490,15 +5490,15 @@ int32_t Rtcm::set_DF407(const Gps_Ephemeris& ephNAV, const Gps_CNAV_Ephemeris& e
std::string sig_(gnss_synchro.Signal);
std::string sys_(&gnss_synchro.System, 1);
if ((sig_.compare("1C")) && (sys_ == "G"))
if ((sig_ == "1C") && (sys_ == "G"))
{
lock_time_period_s = Rtcm::lock_time(ephNAV, obs_time, gnss_synchro);
}
if ((sig_.compare("2S")) && (sys_ == "G"))
if ((sig_ == "2S") && (sys_ == "G"))
{
lock_time_period_s = Rtcm::lock_time(ephCNAV, obs_time, gnss_synchro);
}
if ((sig_.compare("1B") || sig_.compare("5X") || sig_.compare("7X") || sig_.compare("8X")) && (sys_ == "E"))
if (((sig_ == "1B") || (sig_ == "5X") || (sig_ == "7X") || (sig_ == "8X")) && (sys_ == "E"))
{
lock_time_period_s = Rtcm::lock_time(ephFNAV, obs_time, gnss_synchro);
}

View File

@ -8,7 +8,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -73,7 +73,6 @@ beidou_b1i_telemetry_decoder_cc::beidou_b1i_telemetry_decoder_cc(
d_secondary_code_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(BEIDOU_B1I_SECONDARY_CODE_LENGTH * sizeof(int32_t), volk_gnsssdr_get_alignment()));
d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment()));
d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * d_samples_per_symbol;
d_subframe_length_symbols = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
// Setting samples of secondary code
for (int32_t i = 0; i < BEIDOU_B1I_SECONDARY_CODE_LENGTH; i++)
@ -115,7 +114,7 @@ beidou_b1i_telemetry_decoder_cc::beidou_b1i_telemetry_decoder_cc(
}
}
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(d_subframe_length_symbols * sizeof(double), volk_gnsssdr_get_alignment()));
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment()));
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol + d_samples_per_preamble;
// Generic settings
@ -154,15 +153,15 @@ beidou_b1i_telemetry_decoder_cc::~beidou_b1i_telemetry_decoder_cc()
void beidou_b1i_telemetry_decoder_cc::decode_bch15_11_01(const int32_t *bits, int32_t *decbits)
{
int bit, err, reg[4] = {1, 1, 1, 1};
int errind[15] = {14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2};
int32_t bit, err, reg[4] = {1, 1, 1, 1};
int32_t errind[15] = {14, 13, 10, 12, 6, 9, 4, 11, 0, 5, 7, 8, 1, 3, 2};
for (unsigned int i = 0; i < 15; i++)
for (uint32_t i = 0; i < 15; i++)
{
decbits[i] = bits[i];
}
for (unsigned int i = 0; i < 15; i++)
for (uint32_t i = 0; i < 15; i++)
{
bit = reg[3];
reg[3] = reg[2];
@ -180,6 +179,7 @@ void beidou_b1i_telemetry_decoder_cc::decode_bch15_11_01(const int32_t *bits, in
}
}
void beidou_b1i_telemetry_decoder_cc::decode_word(
int32_t word_counter,
const double *enc_word_symbols,
@ -189,31 +189,31 @@ void beidou_b1i_telemetry_decoder_cc::decode_word(
if (word_counter == 1)
{
for (unsigned int j = 0; j < 30; j++)
for (uint32_t j = 0; j < 30; j++)
{
dec_word_symbols[j] = (int32_t)(enc_word_symbols[j] > 0) ? (1) : (-1);
dec_word_symbols[j] = static_cast<int32_t>(enc_word_symbols[j] > 0) ? (1) : (-1);
}
}
else
{
for (unsigned int r = 0; r < 2; r++)
for (uint32_t r = 0; r < 2; r++)
{
for (unsigned int c = 0; c < 15; c++)
for (uint32_t c = 0; c < 15; c++)
{
bitsbch[r * 15 + c] = (int32_t)(enc_word_symbols[c * 2 + r] > 0) ? (1) : (-1);
bitsbch[r * 15 + c] = static_cast<int32_t>(enc_word_symbols[c * 2 + r] > 0) ? (1) : (-1);
}
}
decode_bch15_11_01(&bitsbch[0], first_branch);
decode_bch15_11_01(&bitsbch[15], second_branch);
for (unsigned int j = 0; j < 11; j++)
for (uint32_t j = 0; j < 11; j++)
{
dec_word_symbols[j] = first_branch[j];
dec_word_symbols[j + 11] = second_branch[j];
}
for (unsigned int j = 0; j < 4; j++)
for (uint32_t j = 0; j < 4; j++)
{
dec_word_symbols[j + 22] = first_branch[11 + j];
dec_word_symbols[j + 26] = second_branch[11 + j];
@ -222,7 +222,7 @@ void beidou_b1i_telemetry_decoder_cc::decode_word(
}
void beidou_b1i_telemetry_decoder_cc::decode_subframe(double *frame_symbols, int32_t frame_length)
void beidou_b1i_telemetry_decoder_cc::decode_subframe(double *frame_symbols)
{
// 1. Transform from symbols to bits
std::string data_bits;
@ -287,9 +287,9 @@ void beidou_b1i_telemetry_decoder_cc::decode_subframe(double *frame_symbols, int
}
if (d_nav.have_new_almanac() == true)
{
// unsigned int slot_nbr = d_nav.i_alm_satellite_PRN;
// std::shared_ptr<Beidou_Dnav_Almanac> tmp_obj = std::make_shared<Beidou_Dnav_Almanac>(d_nav.get_almanac(slot_nbr));
// this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
// uint32_t slot_nbr = d_nav.i_alm_satellite_PRN;
// std::shared_ptr<Beidou_Dnav_Almanac> tmp_obj = std::make_shared<Beidou_Dnav_Almanac>(d_nav.get_almanac(slot_nbr));
// this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
LOG(INFO) << "BEIDOU DNAV Almanac have been received in channel" << d_channel << " from satellite " << d_satellite << std::endl;
std::cout << "New BEIDOU B1I DNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << std::endl;
}
@ -321,7 +321,6 @@ void beidou_b1i_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satell
d_secondary_code_symbols = nullptr;
d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment()));
d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * d_samples_per_symbol;
d_subframe_length_symbols = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
// Setting samples of preamble code
int32_t n = 0;
@ -345,13 +344,13 @@ void beidou_b1i_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satell
}
}
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(d_subframe_length_symbols * sizeof(double), volk_gnsssdr_get_alignment()));
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment()));
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol + d_samples_per_preamble;
}
}
void beidou_b1i_telemetry_decoder_cc::set_channel(int channel)
void beidou_b1i_telemetry_decoder_cc::set_channel(int32_t channel)
{
d_channel = channel;
LOG(INFO) << "Navigation channel set to " << channel;
@ -387,11 +386,11 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const auto **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block
// 1. Copy the current tracking output
current_symbol = in[0][0];
d_symbol_history.push_back(current_symbol.Prompt_I); //add new symbol to the symbol queue
d_sample_counter++; //count for the processed samples
d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue
d_sample_counter++; // count for the processed samples
consume_each(1);
d_flag_preamble = false;
@ -399,7 +398,7 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
if (d_symbol_history.size() > d_required_symbols)
{
//******* preamble correlation ********
for (int i = 0; i < d_samples_per_preamble; i++)
for (int32_t i = 0; i < d_samples_per_preamble; i++)
{
if (d_symbol_history.at(i) < 0) // symbols clipping
{
@ -413,7 +412,7 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
}
//******* frame sync ******************
if (d_stat == 0) //no preamble information
if (d_stat == 0) // no preamble information
{
if (abs(corr_value) >= d_samples_per_preamble)
{
@ -428,11 +427,11 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
{
if (abs(corr_value) >= d_samples_per_preamble)
{
//check preamble separation
// check preamble separation
preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
if (abs(preamble_diff - d_preamble_period_samples) == 0)
{
//try to decode frame
// try to decode frame
LOG(INFO) << "Starting BeiDou DNAV frame decoding for BeiDou B1I SAT " << this->d_satellite;
d_preamble_index = d_sample_counter; //record the preamble sample stamp
d_stat = 2;
@ -451,14 +450,14 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
{
if (d_sample_counter == d_preamble_index + static_cast<uint64_t>(d_preamble_period_samples))
{
//******* SAMPLES TO SYMBOLS *******
// ******* SAMPLES TO SYMBOLS *******
if (corr_value > 0) //normal PLL lock
{
int k = 0;
for (uint32_t i = 0; i < d_subframe_length_symbols; i++)
int32_t k = 0;
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{
d_subframe_symbols[i] = 0;
//integrate samples into symbols
// integrate samples into symbols
for (uint32_t m = 0; m < d_samples_per_symbol; m++)
{
if (d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6)
@ -476,13 +475,13 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
}
}
}
else //180 deg. inverted carrier phase PLL lock
else // 180 deg. inverted carrier phase PLL lock
{
int k = 0;
for (uint32_t i = 0; i < d_subframe_length_symbols; i++)
int32_t k = 0;
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
{
d_subframe_symbols[i] = 0;
//integrate samples into symbols
// integrate samples into symbols
for (uint32_t m = 0; m < d_samples_per_symbol; m++)
{
if (d_satellite.get_PRN() > 0 and d_satellite.get_PRN() < 6)
@ -501,14 +500,14 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
}
}
//call the decoder
decode_subframe(d_subframe_symbols, d_subframe_length_symbols);
// call the decoder
decode_subframe(d_subframe_symbols);
if (d_nav.flag_crc_test == true)
{
d_CRC_error_counter = 0;
d_flag_preamble = true; //valid preamble indicator (initialized to false every work())
d_preamble_index = d_sample_counter; //record the preamble sample stamp (t_P)
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P)
if (!d_flag_frame_sync)
{
d_flag_frame_sync = true;
@ -518,7 +517,7 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
else
{
d_CRC_error_counter++;
d_preamble_index = d_sample_counter; //record the preamble sample stamp
d_preamble_index = d_sample_counter; // record the preamble sample stamp
if (d_CRC_error_counter > CRC_ERROR_LIMIT)
{
LOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite;
@ -531,9 +530,9 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
}
// UPDATE GNSS SYNCHRO DATA
//2. Add the telemetry decoder information
// 2. Add the telemetry decoder information
if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true)
//update TOW at the preamble instant
// update TOW at the preamble instant
{
// Reporting sow as gps time of week
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + 14) * 1000.0);
@ -541,7 +540,7 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
flag_SOW_set = true;
d_nav.flag_new_SOW_available = false;
}
else //if there is not a new preamble, we define the TOW of the current symbol
else // if there is not a new preamble, we define the TOW of the current symbol
{
d_TOW_at_current_symbol_ms += static_cast<uint32_t>(BEIDOU_B1I_CODE_PERIOD_MS);
}
@ -565,11 +564,11 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
try
{
double tmp_double;
unsigned long int tmp_ulong_int;
uint64_t tmp_ulong_int;
tmp_double = d_TOW_at_current_symbol_ms;
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
tmp_ulong_int = current_symbol.Tracking_sample_counter;
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(unsigned long int));
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
tmp_double = 0;
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
}
@ -584,7 +583,7 @@ int beidou_b1i_telemetry_decoder_cc::general_work(int noutput_items __attribute_
{
d_symbol_history.pop_front();
}
//3. Make the output (copy the object contents to the GNURadio reserved memory)
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;

View File

@ -9,7 +9,7 @@
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
* Copyright (C) 2010-2019 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
@ -78,13 +78,12 @@ private:
beidou_b1i_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
beidou_b1i_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
void decode_subframe(double *symbols, int32_t frame_length);
void decode_subframe(double *symbols);
void decode_word(int32_t word_counter, const double *enc_word_symbols, int32_t *dec_word_symbols);
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
//!< Preamble decoding
unsigned short int d_preambles_symbols[BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS];
// Preamble decoding
int32_t *d_preamble_samples;
int32_t *d_secondary_code_symbols;
uint32_t d_samples_per_symbol;
@ -92,20 +91,19 @@ private:
int32_t d_samples_per_preamble;
int32_t d_preamble_period_samples;
double *d_subframe_symbols;
uint32_t d_subframe_length_symbols;
uint32_t d_required_symbols;
//!< Storage for incoming data
// Storage for incoming data
std::deque<float> d_symbol_history;
//!< Variables for internal functionality
uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed
uint64_t d_preamble_index; //!< Index of sample number where preamble was found
uint32_t d_stat; //!< Status of decoder
bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved
bool d_flag_preamble; //!< Flag indicating when preamble was found
int32_t d_CRC_error_counter; //!< Number of failed CRC operations
bool flag_SOW_set; //!< Indicates when time of week is set
// Variables for internal functionality
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
uint64_t d_preamble_index; // Index of sample number where preamble was found
uint32_t d_stat; // Status of decoder
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
bool d_flag_preamble; // Flag indicating when preamble was found
int32_t d_CRC_error_counter; // Number of failed CRC operations
bool flag_SOW_set; // Indicates when time of week is set
//!< Navigation Message variable
Beidou_Dnav_Navigation_Message d_nav;

View File

@ -45,8 +45,6 @@
#include "tcp_communication.h"
#include "tcp_packet_data.h"
#include "tracking_discriminators.h"
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk_gnsssdr/volk_gnsssdr.h>

View File

@ -43,8 +43,6 @@
#include "tcp_communication.h"
#include "tcp_packet_data.h"
#include "tracking_discriminators.h"
#include <boost/asio.hpp>
#include <boost/lexical_cast.hpp>
#include <glog/logging.h>
#include <gnuradio/io_signature.h>
#include <volk_gnsssdr/volk_gnsssdr.h>

View File

@ -78,7 +78,7 @@ using google::LogMessage;
ControlThread::ControlThread()
{
if (!FLAGS_c.compare("-"))
if (FLAGS_c == "-")
{
configuration_ = std::make_shared<FileConfiguration>(FLAGS_config_file);
}
@ -776,7 +776,7 @@ void ControlThread::read_control_messages()
// Apply the corresponding control actions
void ControlThread::process_control_messages()
{
for (auto & i : *control_messages_)
for (auto &i : *control_messages_)
{
if (stop_) break;
if (i->who == 200)
@ -881,7 +881,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
<< "UTC, assuming RX position " << LLH(0) << " [deg], " << LLH(1) << " [deg], " << LLH(2) << " [m]" << std::endl;
std::map<int, Gps_Ephemeris> gps_eph_map = pvt_ptr->get_gps_ephemeris();
for (auto & it : gps_eph_map)
for (auto &it : gps_eph_map)
{
eph_t rtklib_eph = eph_to_rtklib(it.second);
double r_sat[3];
@ -904,7 +904,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
}
std::map<int, Galileo_Ephemeris> gal_eph_map = pvt_ptr->get_galileo_ephemeris();
for (auto & it : gal_eph_map)
for (auto &it : gal_eph_map)
{
eph_t rtklib_eph = eph_to_rtklib(it.second);
double r_sat[3];
@ -927,7 +927,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
}
std::map<int, Gps_Almanac> gps_alm_map = pvt_ptr->get_gps_almanac();
for (auto & it : gps_alm_map)
for (auto &it : gps_alm_map)
{
alm_t rtklib_alm = alm_to_rtklib(it.second);
double r_sat[3];
@ -954,7 +954,7 @@ std::vector<std::pair<int, Gnss_Satellite>> ControlThread::get_visible_sats(time
}
std::map<int, Galileo_Almanac> gal_alm_map = pvt_ptr->get_galileo_almanac();
for (auto & it : gal_alm_map)
for (auto &it : gal_alm_map)
{
alm_t rtklib_alm = alm_to_rtklib(it.second);
double r_sat[3];

View File

@ -182,7 +182,7 @@ GNSSBlockFactory::~GNSSBlockFactory() = default;
std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalSource(
const std::shared_ptr<ConfigurationInterface>& configuration, gr::msg_queue::sptr queue, int ID)
const std::shared_ptr<ConfigurationInterface>& configuration, const gr::msg_queue::sptr& queue, int ID)
{
std::string default_implementation = "File_Signal_Source";
std::string role = "SignalSource"; //backwards compatibility for old conf files
@ -199,7 +199,7 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetSignalSource(
}
std::string implementation = configuration->property(role + ".implementation", default_implementation);
LOG(INFO) << "Getting SignalSource with implementation " << implementation;
return GetBlock(configuration, role, implementation, 0, 1, std::move(queue));
return GetBlock(configuration, role, implementation, 0, 1, queue);
}

View File

@ -58,7 +58,7 @@ public:
GNSSBlockFactory();
virtual ~GNSSBlockFactory();
std::unique_ptr<GNSSBlockInterface> GetSignalSource(const std::shared_ptr<ConfigurationInterface>& configuration,
gr::msg_queue::sptr queue, int ID = -1);
const gr::msg_queue::sptr& queue, int ID = -1);
std::unique_ptr<GNSSBlockInterface> GetSignalConditioner(const std::shared_ptr<ConfigurationInterface>& configuration, int ID = -1);

View File

@ -33,6 +33,7 @@
#define GNSS_SDR_BEIDOU_B1I_H_
#include "MATH_CONSTANTS.h"
#include <cstdint>
#include <utility> // std::pair
#include <vector>
@ -51,9 +52,9 @@ const double BEIDOU_B1I_FREQ_HZ = 1.561098e9; //!< b1I [Hz]
const double BEIDOU_B1I_CODE_RATE_HZ = 2.046e6; //!< beidou b1I code rate [chips/s]
const double BEIDOU_B1I_CODE_LENGTH_CHIPS = 2046.0; //!< beidou b1I code length [chips]
const double BEIDOU_B1I_CODE_PERIOD = 0.001; //!< beidou b1I code period [seconds]
const unsigned int BEIDOU_B1I_CODE_PERIOD_MS = 1; //!< GPS L1 C/A code period [ms]
const uint32_t BEIDOU_B1I_CODE_PERIOD_MS = 1; //!< beidou b1I L1 C/A code period [ms]
const double BEIDOU_B1I_CHIP_PERIOD = 4.8875e-07; //!< beidou b1I chip period [seconds]
const int BEIDOU_B1I_SECONDARY_CODE_LENGTH = 20;
const int32_t BEIDOU_B1I_SECONDARY_CODE_LENGTH = 20;
const std::string BEIDOU_B1I_SECONDARY_CODE = "00000100110101001110";
const std::string BEIDOU_B1I_SECONDARY_CODE_STR = "00000100110101001110";
const std::string BEIDOU_B1I_D2_SECONDARY_CODE_STR = "00";
@ -73,29 +74,29 @@ const double BEIDOU_STARTOFFSET_ms = 68.802; //**************[ms] Initial sign.
// OBSERVABLE HISTORY DEEP FOR INTERPOLATION
const int BEIDOU_B1I_HISTORY_DEEP = 100; // ****************
const int32_t BEIDOU_B1I_HISTORY_DEEP = 100; // ****************
// NAVIGATION MESSAGE DEMODULATION AND DECODING
const int BEIDOU_B1I_PREAMBLE_LENGTH_BITS = 11;
const int BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS = 220; // **************
const int32_t BEIDOU_B1I_PREAMBLE_LENGTH_BITS = 11;
const int32_t BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS = 220; // **************
const double BEIDOU_B1I_PREAMBLE_DURATION_S = 0.220;
const int BEIDOU_B1I_PREAMBLE_DURATION_MS = 220;
const int BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s]
const int BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT = 20; // *************
const int BEIDOU_B1I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //************!< NAV message bit rate [symbols/s]
const int BEIDOU_WORD_LENGTH = 4; //**************!< CRC + BEIDOU WORD (-2 -1 0 ... 29) Bits = 4 bytes
const int BEIDOU_SUBFRAME_LENGTH = 40; //**************!< BEIDOU_WORD_LENGTH x 10 = 40 bytes
const int BEIDOU_DNAV_SUBFRAME_DATA_BITS = 300; //!< Number of bits per subframe in the NAV message [bits]
const int BEIDOU_SUBFRAME_SECONDS = 6; //!< Subframe duration [seconds]
const int BEIDOU_SUBFRAME_MS = 6000; //!< Subframe duration [miliseconds]
const int BEIDOU_WORD_BITS = 30; //!< Number of bits per word in the NAV message [bits]
const int32_t BEIDOU_B1I_PREAMBLE_DURATION_MS = 220;
const int32_t BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s]
const int32_t BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT = 20; // *************
const int32_t BEIDOU_B1I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //************!< NAV message bit rate [symbols/s]
const int32_t BEIDOU_WORD_LENGTH = 4; //**************!< CRC + BEIDOU WORD (-2 -1 0 ... 29) Bits = 4 bytes
const int32_t BEIDOU_SUBFRAME_LENGTH = 40; //**************!< BEIDOU_WORD_LENGTH x 10 = 40 bytes
const int32_t BEIDOU_DNAV_SUBFRAME_DATA_BITS = 300; //!< Number of bits per subframe in the NAV message [bits]
const int32_t BEIDOU_SUBFRAME_SECONDS = 6; //!< Subframe duration [seconds]
const int32_t BEIDOU_SUBFRAME_MS = 6000; //!< Subframe duration [miliseconds]
const int32_t BEIDOU_WORD_BITS = 30; //!< Number of bits per word in the NAV message [bits]
const std::string BEIDOU_DNAV_PREAMBLE = "11100010010";
const int BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11;
const int BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // **************
const double BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300;
const double BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300;
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11;
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // **************
const uint32_t BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300;
const uint32_t BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300;
const double BEIDOU_DNAV_DATA_BITS = 300;
const double BEIDOU_DNAV_WORDS_SUBFRAME = 10;
const double BEIDOU_DNAV_WORD_LENGTH_BITS = 30;
@ -106,10 +107,10 @@ const double BEIDOU_B1I_PREAMBLE_PERIOD_SYMBOLS = 300;
// BEIDOU D1 NAVIGATION MESSAGE STRUCTURE
// GENERAL
const std::vector<std::pair<int, int> > D1_PRE({{1, 11}});
const std::vector<std::pair<int, int> > D1_FRAID({{16, 3}});
const std::vector<std::pair<int, int> > D1_SOW({{19, 8}, {31, 12}});
const std::vector<std::pair<int, int> > D1_PNUM({{44, 7}});
const std::vector<std::pair<int32_t, int32_t> > D1_PRE({{1, 11}});
const std::vector<std::pair<int32_t, int32_t> > D1_FRAID({{16, 3}});
const std::vector<std::pair<int32_t, int32_t> > D1_SOW({{19, 8}, {31, 12}});
const std::vector<std::pair<int32_t, int32_t> > D1_PNUM({{44, 7}});
// DNAV SCALE FACTORS
// EPH
@ -164,183 +165,183 @@ const double D1_A0UTC_LSB = TWO_N30;
const double D1_A1UTC_LSB = TWO_N50;
// SUBFRAME 1
const std::vector<std::pair<int, int> > D1_SAT_H1({{43, 1}});
const std::vector<std::pair<int, int> > D1_AODC({{44, 5}});
const std::vector<std::pair<int, int> > D1_URAI({{49, 4}});
const std::vector<std::pair<int, int> > D1_WN({{61, 13}});
const std::vector<std::pair<int, int> > D1_TOC({{74, 9}, {91, 8}});
const std::vector<std::pair<int, int> > D1_TGD1({{99, 10}});
const std::vector<std::pair<int, int> > D1_TGD2({{121, 6}});
const std::vector<std::pair<int, int> > D1_ALPHA0({{127, 8}});
const std::vector<std::pair<int, int> > D1_ALPHA1({{135, 8}});
const std::vector<std::pair<int, int> > D1_ALPHA2({{151, 8}});
const std::vector<std::pair<int, int> > D1_ALPHA3({{159, 8}});
const std::vector<std::pair<int, int> > D1_BETA0({{167, 6}, {181, 2}});
const std::vector<std::pair<int, int> > D1_BETA1({{183, 8}});
const std::vector<std::pair<int, int> > D1_BETA2({{191, 8}});
const std::vector<std::pair<int, int> > D1_BETA3({{199, 4}, {211, 4}});
const std::vector<std::pair<int, int> > D1_A2({{215, 11}});
const std::vector<std::pair<int, int> > D1_A0({{226, 7}, {241, 17}});
const std::vector<std::pair<int, int> > D1_A1({{258, 5}, {271, 17}});
const std::vector<std::pair<int, int> > D1_AODE({{288, 5}});
const std::vector<std::pair<int32_t, int32_t> > D1_SAT_H1({{43, 1}});
const std::vector<std::pair<int32_t, int32_t> > D1_AODC({{44, 5}});
const std::vector<std::pair<int32_t, int32_t> > D1_URAI({{49, 4}});
const std::vector<std::pair<int32_t, int32_t> > D1_WN({{61, 13}});
const std::vector<std::pair<int32_t, int32_t> > D1_TOC({{74, 9}, {91, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_TGD1({{99, 10}});
const std::vector<std::pair<int32_t, int32_t> > D1_TGD2({{121, 6}});
const std::vector<std::pair<int32_t, int32_t> > D1_ALPHA0({{127, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_ALPHA1({{135, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_ALPHA2({{151, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_ALPHA3({{159, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_BETA0({{167, 6}, {181, 2}});
const std::vector<std::pair<int32_t, int32_t> > D1_BETA1({{183, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_BETA2({{191, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_BETA3({{199, 4}, {211, 4}});
const std::vector<std::pair<int32_t, int32_t> > D1_A2({{215, 11}});
const std::vector<std::pair<int32_t, int32_t> > D1_A0({{226, 7}, {241, 17}});
const std::vector<std::pair<int32_t, int32_t> > D1_A1({{258, 5}, {271, 17}});
const std::vector<std::pair<int32_t, int32_t> > D1_AODE({{288, 5}});
//SUBFRAME 2
const std::vector<std::pair<int, int> > D1_DELTA_N({{43, 10}, {61, 6}});
const std::vector<std::pair<int, int> > D1_CUC({{67, 16}, {91, 2}});
const std::vector<std::pair<int, int> > D1_M0({{93, 20}, {121, 12}});
const std::vector<std::pair<int, int> > D1_E({{133, 10}, {151, 22}});
const std::vector<std::pair<int, int> > D1_CUS({{181, 18}});
const std::vector<std::pair<int, int> > D1_CRC({{199, 4}, {211, 14}});
const std::vector<std::pair<int, int> > D1_CRS({{225, 8}, {241, 10}});
const std::vector<std::pair<int, int> > D1_SQRT_A({{251, 12}, {271, 20}});
const std::vector<std::pair<int, int> > D1_TOE_SF2({{291, 2}});
const std::vector<std::pair<int32_t, int32_t> > D1_DELTA_N({{43, 10}, {61, 6}});
const std::vector<std::pair<int32_t, int32_t> > D1_CUC({{67, 16}, {91, 2}});
const std::vector<std::pair<int32_t, int32_t> > D1_M0({{93, 20}, {121, 12}});
const std::vector<std::pair<int32_t, int32_t> > D1_E({{133, 10}, {151, 22}});
const std::vector<std::pair<int32_t, int32_t> > D1_CUS({{181, 18}});
const std::vector<std::pair<int32_t, int32_t> > D1_CRC({{199, 4}, {211, 14}});
const std::vector<std::pair<int32_t, int32_t> > D1_CRS({{225, 8}, {241, 10}});
const std::vector<std::pair<int32_t, int32_t> > D1_SQRT_A({{251, 12}, {271, 20}});
const std::vector<std::pair<int32_t, int32_t> > D1_TOE_SF2({{291, 2}});
//SUBFRAME 3
const std::vector<std::pair<int, int> > D1_TOE_SF3({{43, 10}, {61, 5}});
const std::vector<std::pair<int, int> > D1_I0({{66, 17}, {91, 15}});
const std::vector<std::pair<int, int> > D1_CIC({{106, 7}, {121, 11}});
const std::vector<std::pair<int, int> > D1_OMEGA_DOT({{132, 11}, {151, 13}});
const std::vector<std::pair<int, int> > D1_CIS({{164, 9}, {181, 9}});
const std::vector<std::pair<int, int> > D1_IDOT({{190, 13}, {211, 1}});
const std::vector<std::pair<int, int> > D1_OMEGA0({{212, 21}, {241, 11}});
const std::vector<std::pair<int, int> > D1_OMEGA({{252, 11}, {271, 21}});
const std::vector<std::pair<int32_t, int32_t> > D1_TOE_SF3({{43, 10}, {61, 5}});
const std::vector<std::pair<int32_t, int32_t> > D1_I0({{66, 17}, {91, 15}});
const std::vector<std::pair<int32_t, int32_t> > D1_CIC({{106, 7}, {121, 11}});
const std::vector<std::pair<int32_t, int32_t> > D1_OMEGA_DOT({{132, 11}, {151, 13}});
const std::vector<std::pair<int32_t, int32_t> > D1_CIS({{164, 9}, {181, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_IDOT({{190, 13}, {211, 1}});
const std::vector<std::pair<int32_t, int32_t> > D1_OMEGA0({{212, 21}, {241, 11}});
const std::vector<std::pair<int32_t, int32_t> > D1_OMEGA({{252, 11}, {271, 21}});
//SUBFRAME 4 AND PAGES 1 THROUGH 6 IN SUBFRAME 5
const std::vector<std::pair<int, int> > D1_SQRT_A_ALMANAC({{51, 2}, {61, 22}});
const std::vector<std::pair<int, int> > D1_A1_ALMANAC({{91, 11}});
const std::vector<std::pair<int, int> > D1_A0_ALMANAC({{102, 11}});
const std::vector<std::pair<int, int> > D1_OMEGA0_ALMANAC({{121, 22}, {151, 2}});
const std::vector<std::pair<int, int> > D1_E_ALMANAC({{153, 17}});
const std::vector<std::pair<int, int> > D1_DELTA_I({{170, 3}, {181, 13}});
const std::vector<std::pair<int, int> > D1_TOA({{194, 8}});
const std::vector<std::pair<int, int> > D1_OMEGA_DOT_ALMANAC({{202, 1}, {211, 16}});
const std::vector<std::pair<int, int> > D1_OMEGA_ALMANAC({{227, 6}, {241, 18}});
const std::vector<std::pair<int, int> > D1_M0_ALMANAC({{259, 4}, {271, 20}});
const std::vector<std::pair<int32_t, int32_t> > D1_SQRT_A_ALMANAC({{51, 2}, {61, 22}});
const std::vector<std::pair<int32_t, int32_t> > D1_A1_ALMANAC({{91, 11}});
const std::vector<std::pair<int32_t, int32_t> > D1_A0_ALMANAC({{102, 11}});
const std::vector<std::pair<int32_t, int32_t> > D1_OMEGA0_ALMANAC({{121, 22}, {151, 2}});
const std::vector<std::pair<int32_t, int32_t> > D1_E_ALMANAC({{153, 17}});
const std::vector<std::pair<int32_t, int32_t> > D1_DELTA_I({{170, 3}, {181, 13}});
const std::vector<std::pair<int32_t, int32_t> > D1_TOA({{194, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_OMEGA_DOT_ALMANAC({{202, 1}, {211, 16}});
const std::vector<std::pair<int32_t, int32_t> > D1_OMEGA_ALMANAC({{227, 6}, {241, 18}});
const std::vector<std::pair<int32_t, int32_t> > D1_M0_ALMANAC({{259, 4}, {271, 20}});
//SUBFRAME 5 PAGE 7
const std::vector<std::pair<int, int> > D1_HEA1({{51, 2}, {61, 7}});
const std::vector<std::pair<int, int> > D1_HEA2({{68, 9}});
const std::vector<std::pair<int, int> > D1_HEA3({{77, 6}, {91, 3}});
const std::vector<std::pair<int, int> > D1_HEA4({{94, 9}});
const std::vector<std::pair<int, int> > D1_HEA5({{103, 9}});
const std::vector<std::pair<int, int> > D1_HEA6({{112, 1}, {121, 8}});
const std::vector<std::pair<int, int> > D1_HEA7({{129, 9}});
const std::vector<std::pair<int, int> > D1_HEA8({{138, 5}, {151, 4}});
const std::vector<std::pair<int, int> > D1_HEA9({{155, 9}});
const std::vector<std::pair<int, int> > D1_HEA10({{164, 9}});
const std::vector<std::pair<int, int> > D1_HEA11({{181, 9}});
const std::vector<std::pair<int, int> > D1_HEA12({{190, 9}});
const std::vector<std::pair<int, int> > D1_HEA13({{199, 4}, {211, 5}});
const std::vector<std::pair<int, int> > D1_HEA14({{216, 9}});
const std::vector<std::pair<int, int> > D1_HEA15({{225, 8}, {241, 1}});
const std::vector<std::pair<int, int> > D1_HEA16({{242, 9}});
const std::vector<std::pair<int, int> > D1_HEA17({{251, 9}});
const std::vector<std::pair<int, int> > D1_HEA18({{260, 3}, {271, 6}});
const std::vector<std::pair<int, int> > D1_HEA19({{277, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA1({{51, 2}, {61, 7}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA2({{68, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA3({{77, 6}, {91, 3}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA4({{94, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA5({{103, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA6({{112, 1}, {121, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA7({{129, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA8({{138, 5}, {151, 4}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA9({{155, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA10({{164, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA11({{181, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA12({{190, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA13({{199, 4}, {211, 5}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA14({{216, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA15({{225, 8}, {241, 1}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA16({{242, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA17({{251, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA18({{260, 3}, {271, 6}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA19({{277, 9}});
//SUBFRAME 5 PAGE 8
const std::vector<std::pair<int, int> > D1_HEA20({{51, 2}, {61, 7}});
const std::vector<std::pair<int, int> > D1_HEA21({{68, 9}});
const std::vector<std::pair<int, int> > D1_HEA22({{77, 6}, {91, 3}});
const std::vector<std::pair<int, int> > D1_HEA23({{94, 9}});
const std::vector<std::pair<int, int> > D1_HEA24({{103, 9}});
const std::vector<std::pair<int, int> > D1_HEA25({{112, 1}, {121, 8}});
const std::vector<std::pair<int, int> > D1_HEA26({{129, 9}});
const std::vector<std::pair<int, int> > D1_HEA27({{138, 5}, {151, 4}});
const std::vector<std::pair<int, int> > D1_HEA28({{155, 9}});
const std::vector<std::pair<int, int> > D1_HEA29({{164, 9}});
const std::vector<std::pair<int, int> > D1_HEA30({{181, 9}});
const std::vector<std::pair<int, int> > D1_WNA({{190, 8}});
const std::vector<std::pair<int, int> > D1_TOA2({{198, 5}, {211, 3}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA20({{51, 2}, {61, 7}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA21({{68, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA22({{77, 6}, {91, 3}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA23({{94, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA24({{103, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA25({{112, 1}, {121, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA26({{129, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA27({{138, 5}, {151, 4}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA28({{155, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA29({{164, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_HEA30({{181, 9}});
const std::vector<std::pair<int32_t, int32_t> > D1_WNA({{190, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_TOA2({{198, 5}, {211, 3}});
//SUBFRAME 5 PAGE 9
const std::vector<std::pair<int, int> > D1_A0GPS({{97, 14}});
const std::vector<std::pair<int, int> > D1_A1GPS({{111, 2}, {121, 14}});
const std::vector<std::pair<int, int> > D1_A0GAL({{135, 8}, {151, 6}});
const std::vector<std::pair<int, int> > D1_A1GAL({{157, 16}});
const std::vector<std::pair<int, int> > D1_A0GLO({{181, 14}});
const std::vector<std::pair<int, int> > D1_A1GLO({{195, 8}, {211, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_A0GPS({{97, 14}});
const std::vector<std::pair<int32_t, int32_t> > D1_A1GPS({{111, 2}, {121, 14}});
const std::vector<std::pair<int32_t, int32_t> > D1_A0GAL({{135, 8}, {151, 6}});
const std::vector<std::pair<int32_t, int32_t> > D1_A1GAL({{157, 16}});
const std::vector<std::pair<int32_t, int32_t> > D1_A0GLO({{181, 14}});
const std::vector<std::pair<int32_t, int32_t> > D1_A1GLO({{195, 8}, {211, 8}});
//SUBFRAME 5 PAGE 10
const std::vector<std::pair<int, int> > D1_DELTA_T_LS({{51, 2}, {61, 6}});
const std::vector<std::pair<int, int> > D1_DELTA_T_LSF({{67, 8}});
const std::vector<std::pair<int, int> > D1_WN_LSF({{75, 8}});
const std::vector<std::pair<int, int> > D1_A0UTC({{91, 22}, {121, 10}});
const std::vector<std::pair<int, int> > D1_A1UTC({{131, 12}, {151, 12}});
const std::vector<std::pair<int, int> > D1_DN({{163, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_DELTA_T_LS({{51, 2}, {61, 6}});
const std::vector<std::pair<int32_t, int32_t> > D1_DELTA_T_LSF({{67, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_WN_LSF({{75, 8}});
const std::vector<std::pair<int32_t, int32_t> > D1_A0UTC({{91, 22}, {121, 10}});
const std::vector<std::pair<int32_t, int32_t> > D1_A1UTC({{131, 12}, {151, 12}});
const std::vector<std::pair<int32_t, int32_t> > D1_DN({{163, 8}});
// D2 NAV Message Decoding Information
const std::vector<std::pair<int, int> > D2_PRE({{1, 11}});
const std::vector<std::pair<int, int> > D2_FRAID({{16, 3}});
const std::vector<std::pair<int, int> > D2_SOW({{19, 8}, {31, 12}});
const std::vector<std::pair<int, int> > D2_PNUM({{43, 4}});
const std::vector<std::pair<int32_t, int32_t> > D2_PRE({{1, 11}});
const std::vector<std::pair<int32_t, int32_t> > D2_FRAID({{16, 3}});
const std::vector<std::pair<int32_t, int32_t> > D2_SOW({{19, 8}, {31, 12}});
const std::vector<std::pair<int32_t, int32_t> > D2_PNUM({{43, 4}});
// D2 NAV, SUBFRAME 1, PAGE 1
const std::vector<std::pair<int, int> > D2_SAT_H1({{47, 1}});
const std::vector<std::pair<int, int> > D2_AODC({{48, 5}});
const std::vector<std::pair<int, int> > D2_URAI({{61, 4}});
const std::vector<std::pair<int, int> > D2_WN({{65, 13}});
const std::vector<std::pair<int, int> > D2_TOC({{78, 5}, {91, 12}});
const std::vector<std::pair<int, int> > D2_TGD1({{103, 10}});
const std::vector<std::pair<int, int> > D2_TGD2({{121, 10}});
const std::vector<std::pair<int32_t, int32_t> > D2_SAT_H1({{47, 1}});
const std::vector<std::pair<int32_t, int32_t> > D2_AODC({{48, 5}});
const std::vector<std::pair<int32_t, int32_t> > D2_URAI({{61, 4}});
const std::vector<std::pair<int32_t, int32_t> > D2_WN({{65, 13}});
const std::vector<std::pair<int32_t, int32_t> > D2_TOC({{78, 5}, {91, 12}});
const std::vector<std::pair<int32_t, int32_t> > D2_TGD1({{103, 10}});
const std::vector<std::pair<int32_t, int32_t> > D2_TGD2({{121, 10}});
// D2 NAV, SUBFRAME 1, PAGE 2
const std::vector<std::pair<int, int> > D2_ALPHA0({{47, 6}, {61, 2}});
const std::vector<std::pair<int, int> > D2_ALPHA1({{63, 8}});
const std::vector<std::pair<int, int> > D2_ALPHA2({{71, 8}});
const std::vector<std::pair<int, int> > D2_ALPHA3({{79, 4}, {91, 4}});
const std::vector<std::pair<int, int> > D2_BETA0({{95, 8}});
const std::vector<std::pair<int, int> > D2_BETA1({{103, 8}});
const std::vector<std::pair<int, int> > D2_BETA2({{111, 2}, {121, 6}});
const std::vector<std::pair<int, int> > D2_BETA3({{127, 8}});
const std::vector<std::pair<int32_t, int32_t> > D2_ALPHA0({{47, 6}, {61, 2}});
const std::vector<std::pair<int32_t, int32_t> > D2_ALPHA1({{63, 8}});
const std::vector<std::pair<int32_t, int32_t> > D2_ALPHA2({{71, 8}});
const std::vector<std::pair<int32_t, int32_t> > D2_ALPHA3({{79, 4}, {91, 4}});
const std::vector<std::pair<int32_t, int32_t> > D2_BETA0({{95, 8}});
const std::vector<std::pair<int32_t, int32_t> > D2_BETA1({{103, 8}});
const std::vector<std::pair<int32_t, int32_t> > D2_BETA2({{111, 2}, {121, 6}});
const std::vector<std::pair<int32_t, int32_t> > D2_BETA3({{127, 8}});
// D2 NAV, SUBFRAME 1, PAGE 3
const std::vector<std::pair<int, int> > D2_A0({{101, 12}, {121, 12}});
const std::vector<std::pair<int, int> > D2_A1_MSB({{133, 4}});
const std::vector<std::pair<int, int> > D2_A1_LSB({{47, 6}, {61, 12}});
const std::vector<std::pair<int, int> > D2_A1({{279, 22}});
const std::vector<std::pair<int32_t, int32_t> > D2_A0({{101, 12}, {121, 12}});
const std::vector<std::pair<int32_t, int32_t> > D2_A1_MSB({{133, 4}});
const std::vector<std::pair<int32_t, int32_t> > D2_A1_LSB({{47, 6}, {61, 12}});
const std::vector<std::pair<int32_t, int32_t> > D2_A1({{279, 22}});
// D2 NAV, SUBFRAME 1, PAGE 4
const std::vector<std::pair<int, int> > D2_A2({{73, 10}, {91, 1}});
const std::vector<std::pair<int, int> > D2_AODE({{92, 5}});
const std::vector<std::pair<int, int> > D2_DELTA_N({{97, 16}});
const std::vector<std::pair<int, int> > D2_CUC_MSB({{121, 14}});
const std::vector<std::pair<int, int> > D2_CUC_LSB({{47, 4}});
const std::vector<std::pair<int, int> > D2_CUC({{283, 18}});
const std::vector<std::pair<int32_t, int32_t> > D2_A2({{73, 10}, {91, 1}});
const std::vector<std::pair<int32_t, int32_t> > D2_AODE({{92, 5}});
const std::vector<std::pair<int32_t, int32_t> > D2_DELTA_N({{97, 16}});
const std::vector<std::pair<int32_t, int32_t> > D2_CUC_MSB({{121, 14}});
const std::vector<std::pair<int32_t, int32_t> > D2_CUC_LSB({{47, 4}});
const std::vector<std::pair<int32_t, int32_t> > D2_CUC({{283, 18}});
// D2 NAV, SUBFRAME 1, PAGE 5
const std::vector<std::pair<int, int> > D2_M0({{51, 2}, {61, 22}, {91, 8}});
const std::vector<std::pair<int, int> > D2_CUS({{99, 14}, {121, 4}});
const std::vector<std::pair<int, int> > D2_E_MSB({{125, 10}});
const std::vector<std::pair<int32_t, int32_t> > D2_M0({{51, 2}, {61, 22}, {91, 8}});
const std::vector<std::pair<int32_t, int32_t> > D2_CUS({{99, 14}, {121, 4}});
const std::vector<std::pair<int32_t, int32_t> > D2_E_MSB({{125, 10}});
// D2 NAV, SUBFRAME 1, PAGE 6
const std::vector<std::pair<int, int> > D2_E_LSB({{47, 6}, {61, 16}});
const std::vector<std::pair<int, int> > D2_SQRT_A({{77, 6}, {91, 22}, {121, 4}});
const std::vector<std::pair<int, int> > D2_CIC_MSB({{125, 10}});
const std::vector<std::pair<int, int> > D2_CIC_LSB({{47, 6}, {61, 2}});
const std::vector<std::pair<int, int> > D2_CIC({{283, 18}});
const std::vector<std::pair<int32_t, int32_t> > D2_E_LSB({{47, 6}, {61, 16}});
const std::vector<std::pair<int32_t, int32_t> > D2_SQRT_A({{77, 6}, {91, 22}, {121, 4}});
const std::vector<std::pair<int32_t, int32_t> > D2_CIC_MSB({{125, 10}});
const std::vector<std::pair<int32_t, int32_t> > D2_CIC_LSB({{47, 6}, {61, 2}});
const std::vector<std::pair<int32_t, int32_t> > D2_CIC({{283, 18}});
// D2 NAV, SUBFRAME 1, PAGE 7
const std::vector<std::pair<int, int> > D2_CIS({{63, 18}});
const std::vector<std::pair<int, int> > D2_TOE({{81, 2}, {91, 15}});
const std::vector<std::pair<int, int> > D2_I0_MSB({{106, 7}, {121, 14}});
const std::vector<std::pair<int, int> > D2_I0_LSB({{47, 6}, {61, 5}});
const std::vector<std::pair<int, int> > D2_I0({{269, 32}});
const std::vector<std::pair<int32_t, int32_t> > D2_CIS({{63, 18}});
const std::vector<std::pair<int32_t, int32_t> > D2_TOE({{81, 2}, {91, 15}});
const std::vector<std::pair<int32_t, int32_t> > D2_I0_MSB({{106, 7}, {121, 14}});
const std::vector<std::pair<int32_t, int32_t> > D2_I0_LSB({{47, 6}, {61, 5}});
const std::vector<std::pair<int32_t, int32_t> > D2_I0({{269, 32}});
// D2 NAV, SUBFRAME 1, PAGE 8
const std::vector<std::pair<int, int> > D2_CRC({{66, 17}, {91, 1}});
const std::vector<std::pair<int, int> > D2_CRS({{92, 18}});
const std::vector<std::pair<int, int> > D2_OMEGA_DOT_MSB({{110, 3}, {121, 16}});
const std::vector<std::pair<int, int> > D2_OMEGA_DOT_LSB({{47, 5}});
const std::vector<std::pair<int, int> > D2_OMEGA_DOT({{277, 24}});
const std::vector<std::pair<int32_t, int32_t> > D2_CRC({{66, 17}, {91, 1}});
const std::vector<std::pair<int32_t, int32_t> > D2_CRS({{92, 18}});
const std::vector<std::pair<int32_t, int32_t> > D2_OMEGA_DOT_MSB({{110, 3}, {121, 16}});
const std::vector<std::pair<int32_t, int32_t> > D2_OMEGA_DOT_LSB({{47, 5}});
const std::vector<std::pair<int32_t, int32_t> > D2_OMEGA_DOT({{277, 24}});
// D2 NAV, SUBFRAME 1, PAGE 9
const std::vector<std::pair<int, int> > D2_OMEGA0({{52, 1}, {61, 22}, {91, 9}});
const std::vector<std::pair<int, int> > D2_OMEGA_MSB({{100, 13}, {121, 14}});
const std::vector<std::pair<int, int> > D2_OMEGA_LSB({{47, 5}});
const std::vector<std::pair<int, int> > D2_OMEGA({{269, 32}});
const std::vector<std::pair<int32_t, int32_t> > D2_OMEGA0({{52, 1}, {61, 22}, {91, 9}});
const std::vector<std::pair<int32_t, int32_t> > D2_OMEGA_MSB({{100, 13}, {121, 14}});
const std::vector<std::pair<int32_t, int32_t> > D2_OMEGA_LSB({{47, 5}});
const std::vector<std::pair<int32_t, int32_t> > D2_OMEGA({{269, 32}});
// D2 NAV, SUBFRAME 1, PAGE 10
const std::vector<std::pair<int, int> > D2_IDOT({{52, 1}, {61, 13}});
const std::vector<std::pair<int32_t, int32_t> > D2_IDOT({{52, 1}, {61, 13}});
#endif /* GNSS_SDR_BEIDOU_B1I_H_ */

View File

@ -175,7 +175,7 @@ void Beidou_Dnav_Navigation_Message::reset()
//Almanac
d_Toa = 0;
i_WN_A = 0;
for (int i = 1; i < 36; i++)
for (int32_t i = 1; i < 36; i++)
{
almanacHealth[i] = 0;
}
@ -208,25 +208,30 @@ void Beidou_Dnav_Navigation_Message::reset()
auto gnss_sat = Gnss_Satellite();
std::string _system("Beidou");
for (unsigned int i = 1; i < 36; i++)
for (uint32_t i = 1; i < 36; i++)
{
satelliteBlock[i] = gnss_sat.what_block(_system, i);
}
}
Beidou_Dnav_Navigation_Message::Beidou_Dnav_Navigation_Message()
{
reset();
}
void Beidou_Dnav_Navigation_Message::print_beidou_word_bytes(unsigned int BEIDOU_word)
void Beidou_Dnav_Navigation_Message::print_beidou_word_bytes(uint32_t BEIDOU_word)
{
std::cout << " Word =";
std::cout << std::bitset<32>(BEIDOU_word);
std::cout << std::endl;
}
bool Beidou_Dnav_Navigation_Message::read_navigation_bool(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter)
bool Beidou_Dnav_Navigation_Message::read_navigation_bool(
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
const std::vector<std::pair<int32_t, int32_t>>& parameter)
{
bool value;
@ -241,15 +246,18 @@ bool Beidou_Dnav_Navigation_Message::read_navigation_bool(std::bitset<BEIDOU_DNA
return value;
}
unsigned long int Beidou_Dnav_Navigation_Message::read_navigation_unsigned(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter)
uint64_t Beidou_Dnav_Navigation_Message::read_navigation_unsigned(
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
const std::vector<std::pair<int32_t, int32_t>>& parameter)
{
unsigned long int value = 0;
int num_of_slices = parameter.size();
for (int i = 0; i < num_of_slices; i++)
uint64_t value = 0ULL;
int32_t num_of_slices = parameter.size();
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int j = 0; j < parameter[i].second; j++)
for (int32_t j = 0; j < parameter[i].second; j++)
{
value <<= 1; //shift left
value <<= 1; // shift left
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
@ -259,30 +267,33 @@ unsigned long int Beidou_Dnav_Navigation_Message::read_navigation_unsigned(std::
return value;
}
signed long int Beidou_Dnav_Navigation_Message::read_navigation_signed(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter)
int64_t Beidou_Dnav_Navigation_Message::read_navigation_signed(
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits,
const std::vector<std::pair<int32_t, int32_t>>& parameter)
{
signed long int value = 0;
int num_of_slices = parameter.size();
int64_t value = 0;
int32_t num_of_slices = parameter.size();
// Discriminate between 64 bits and 32 bits compiler
int long_int_size_bytes = sizeof(signed long int);
int32_t long_int_size_bytes = sizeof(int64_t);
if (long_int_size_bytes == 8) // if a long int takes 8 bytes, we are in a 64 bits system
{
// read the MSB and perform the sign extension
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[0].first] == 1)
{
value ^= 0xFFFFFFFFFFFFFFFF; //64 bits variable
value ^= 0xFFFFFFFFFFFFFFFF; // 64 bits variable
}
else
{
value &= 0;
}
for (int i = 0; i < num_of_slices; i++)
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int j = 0; j < parameter[i].second; j++)
for (int32_t j = 0; j < parameter[i].second; j++)
{
value <<= 1; //shift left
value &= 0xFFFFFFFFFFFFFFFE; //reset the corresponding bit (for the 64 bits variable)
value <<= 1; // shift left
value &= 0xFFFFFFFFFFFFFFFE; // reset the corresponding bit (for the 64 bits variable)
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
@ -302,12 +313,12 @@ signed long int Beidou_Dnav_Navigation_Message::read_navigation_signed(std::bits
value &= 0;
}
for (int i = 0; i < num_of_slices; i++)
for (int32_t i = 0; i < num_of_slices; i++)
{
for (int j = 0; j < parameter[i].second; j++)
for (int32_t j = 0; j < parameter[i].second; j++)
{
value <<= 1; //shift left
value &= 0xFFFFFFFE; //reset the corresponding bit
value <<= 1; // shift left
value &= 0xFFFFFFFE; // reset the corresponding bit
if (bits[BEIDOU_DNAV_SUBFRAME_DATA_BITS - parameter[i].first - j] == 1)
{
value += 1; // insert the bit
@ -318,6 +329,7 @@ signed long int Beidou_Dnav_Navigation_Message::read_navigation_signed(std::bits
return value;
}
double Beidou_Dnav_Navigation_Message::check_t(double time)
{
double corrTime;
@ -334,6 +346,7 @@ double Beidou_Dnav_Navigation_Message::check_t(double time)
return corrTime;
}
double Beidou_Dnav_Navigation_Message::sv_clock_correction(double transmitTime)
{
double dt;
@ -343,6 +356,7 @@ double Beidou_Dnav_Navigation_Message::sv_clock_correction(double transmitTime)
return correctedTime;
}
void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
{
double tk;
@ -384,7 +398,7 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
E = M;
// --- Iteratively compute eccentric anomaly ----------------------------
for (int ii = 1; ii < 20; ii++)
for (int32_t ii = 1; ii < 20; ii++)
{
E_old = E;
E = M + d_eccentricity * sin(E);
@ -437,9 +451,10 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
d_satvel_Z = d_satpos_Y * sin(i);
}
int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subframe)
int32_t Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subframe)
{
int subframe_ID = 0;
int32_t subframe_ID = 0;
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> subframe_bits(subframe);
subframe_ID = static_cast<int>(read_navigation_unsigned(subframe_bits, D1_FRAID));
@ -505,8 +520,6 @@ int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subfr
break;
case 2: // --- It is subframe 2 ---
d_SOW_SF2 = static_cast<double>(read_navigation_unsigned(subframe_bits, D1_SOW));
d_SOW = d_SOW_SF2; // Set transmission time
@ -541,7 +554,6 @@ int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subfr
break;
case 3: // --- It is subframe 3 ---
d_SOW_SF3 = static_cast<double>(read_navigation_unsigned(subframe_bits, D1_SOW));
d_SOW = d_SOW_SF3; // Set transmission time
@ -615,7 +627,7 @@ int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subfr
break;
case 5: // --- It is subframe 5 ---
int SV_page_5;
int32_t SV_page_5;
d_SOW_SF5 = static_cast<double>(read_navigation_unsigned(subframe_bits, D1_SOW));
d_SOW = d_SOW_SF5; // Set transmission time
@ -731,10 +743,11 @@ int Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& subfr
return subframe_ID;
}
int Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& subframe)
int32_t Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& subframe)
{
int subframe_ID = 0;
int page_ID = 0;
int32_t subframe_ID = 0;
int32_t page_ID = 0;
std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> subframe_bits(subframe);
@ -920,6 +933,7 @@ int Beidou_Dnav_Navigation_Message::d2_subframe_decoder(std::string const& subfr
return subframe_ID;
}
double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_corrected) const
{
double t_utc;
@ -927,12 +941,12 @@ double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_correcte
double Delta_t_UTC = d_DeltaT_LS + d_A0UTC + d_A1UTC * (beidoutime_corrected);
// Determine if the effectivity time of the leap second event is in the past
int weeksToLeapSecondEvent = i_WN_LSF - i_BEIDOU_week;
int32_t weeksToLeapSecondEvent = i_WN_LSF - i_BEIDOU_week;
if ((weeksToLeapSecondEvent) >= 0) // is not in the past
{
//Detect if the effectivity time and user's time is within six hours = 6 * 60 *60 = 21600 s
int secondOfLeapSecondEvent = i_DN * 24 * 60 * 60;
int32_t secondOfLeapSecondEvent = i_DN * 24 * 60 * 60;
if (weeksToLeapSecondEvent > 0)
{
t_utc_daytime = fmod(beidoutime_corrected - Delta_t_UTC, 86400);
@ -947,7 +961,7 @@ double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_correcte
{
if ((beidoutime_corrected - secondOfLeapSecondEvent) < (5 / 4) * 24 * 60 * 60)
{
int W = fmod(beidoutime_corrected - Delta_t_UTC - 43200, 86400) + 43200;
int32_t W = fmod(beidoutime_corrected - Delta_t_UTC - 43200, 86400) + 43200;
t_utc_daytime = fmod(W, 86400 + d_DeltaT_LSF - d_DeltaT_LS);
}
else
@ -967,6 +981,7 @@ double Beidou_Dnav_Navigation_Message::utc_time(const double beidoutime_correcte
return t_utc;
}
Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris()
{
Beidou_Dnav_Ephemeris eph;
@ -1064,6 +1079,7 @@ Beidou_Dnav_Ephemeris Beidou_Dnav_Navigation_Message::get_ephemeris()
return eph;
}
Beidou_Dnav_Iono Beidou_Dnav_Navigation_Message::get_iono()
{
Beidou_Dnav_Iono iono;
@ -1081,6 +1097,7 @@ Beidou_Dnav_Iono Beidou_Dnav_Navigation_Message::get_iono()
return iono;
}
Beidou_Dnav_Utc_Model Beidou_Dnav_Navigation_Message::get_utc_model()
{
Beidou_Dnav_Utc_Model utc_model;
@ -1105,6 +1122,7 @@ Beidou_Dnav_Utc_Model Beidou_Dnav_Navigation_Message::get_utc_model()
return utc_model;
}
bool Beidou_Dnav_Navigation_Message::have_new_ephemeris() // Check if we have a new ephemeris stored in the galileo navigation class
{
if (i_satellite_PRN > 0 and i_satellite_PRN < 6)
@ -1160,6 +1178,7 @@ bool Beidou_Dnav_Navigation_Message::have_new_ephemeris() // Check if we have a
return false;
}
bool Beidou_Dnav_Navigation_Message::have_new_iono()
{
// the condition on flag_utc_model is added to have a time stamp for iono
@ -1171,6 +1190,7 @@ bool Beidou_Dnav_Navigation_Message::have_new_iono()
return false;
}
bool Beidou_Dnav_Navigation_Message::have_new_utc_model()
{
if (flag_d1_sf5_p9 == true and flag_d1_sf5_p10 == true)
@ -1185,6 +1205,7 @@ bool Beidou_Dnav_Navigation_Message::have_new_utc_model()
return false;
}
bool Beidou_Dnav_Navigation_Message::have_new_almanac()
{
if ((flag_d1_sf4 == true) and (flag_d1_sf5 == true))
@ -1199,6 +1220,7 @@ bool Beidou_Dnav_Navigation_Message::have_new_almanac()
return false;
}
bool Beidou_Dnav_Navigation_Message::satellite_validation()
{
bool flag_data_valid = false;

View File

@ -54,10 +54,10 @@
class Beidou_Dnav_Navigation_Message
{
private:
unsigned long int read_navigation_unsigned(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter);
signed long int read_navigation_signed(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter);
bool read_navigation_bool(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int, int>>& parameter);
void print_beidou_word_bytes(unsigned int BEIDOU_word);
uint64_t read_navigation_unsigned(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
int64_t read_navigation_signed(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
bool read_navigation_bool(std::bitset<BEIDOU_DNAV_SUBFRAME_DATA_BITS> bits, const std::vector<std::pair<int32_t, int32_t>>& parameter);
void print_beidou_word_bytes(uint32_t BEIDOU_word);
/*
* Accounts for the beginning or end of week crossover
*
@ -130,15 +130,15 @@ public:
double d_OMEGA_DOT; //!< Rate of Right Ascension [semi-circles/s]
//broadcast orbit 5
double d_IDOT; //!< Rate of Inclination Angle [semi-circles/s]
int i_BEIDOU_week; //!< BeiDou week number, aka WN [week]
int32_t i_BEIDOU_week; //!< BeiDou week number, aka WN [week]
//broadcast orbit 6
int i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV
int i_SV_health;
int32_t i_SV_accuracy; //!< User Range Accuracy (URA) index of the SV
int32_t i_SV_health;
double d_TGD1; //!< Estimated Group Delay Differential in B1 [s]
double d_TGD2; //!< Estimated Group Delay Differential in B2 [s]
double d_AODC; //!< Age of Data, Clock
//broadcast orbit 7
// int i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]
// int32_t i_AODO; //!< Age of Data Offset (AODO) term for the navigation message correction table (NMCT) contained in subframe 4 (reference paragraph 20.3.3.5.1.9) [s]
bool b_fit_interval_flag; //!< indicates the curve-fit interval used by the CS (Block II/IIA/IIR/IIR-M/IIF) and SS (Block IIIA) in determining the ephemeris parameters, as follows: 0 = 4 hours, 1 = greater than 4 hours.
double d_spare1;
@ -149,29 +149,29 @@ public:
double d_A_f2; //!< Clock correction parameters. Coefficient 2 of code phase offset model [s/s^2]
// D2 NAV Message Decoding
unsigned long int d_A_f1_msb_bits; //!< Clock correction parameters, D2 NAV MSB
unsigned long int d_A_f1_lsb_bits; //!< Clock correction parameters, D2 NAV LSB
unsigned long int d_Cuc_msb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
unsigned long int d_Cuc_lsb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
unsigned long int d_eccentricity_msb; //!< Eccentricity [dimensionless]
unsigned long int d_eccentricity_lsb; //!< Eccentricity [dimensionless]
unsigned long int d_Cic_msb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
unsigned long int d_Cic_lsb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
unsigned long int d_eccentricity_msb_bits; //!< Eccentricity [dimensionless]
unsigned long int d_eccentricity_lsb_bits;
unsigned long int d_i_0_msb_bits; //!< Inclination Angle at Reference Time [semi-circles]
unsigned long int d_i_0_lsb_bits; //!< Inclination Angle at Reference Time [semi-circles]
unsigned long int d_OMEGA_msb_bits; //!< Argument of Perigee [semi-cicles]
unsigned long int d_OMEGA_lsb_bits; //!< Argument of Perigee [semi-cicles]
unsigned long int d_OMEGA_DOT_msb_bits; //!< Rate of Right Ascension [semi-circles/s]
unsigned long int d_OMEGA_DOT_lsb_bits; //!< Rate of Right Ascension [semi-circles/s]
uint64_t d_A_f1_msb_bits; //!< Clock correction parameters, D2 NAV MSB
uint64_t d_A_f1_lsb_bits; //!< Clock correction parameters, D2 NAV LSB
uint64_t d_Cuc_msb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
uint64_t d_Cuc_lsb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
uint64_t d_eccentricity_msb; //!< Eccentricity [dimensionless]
uint64_t d_eccentricity_lsb; //!< Eccentricity [dimensionless]
uint64_t d_Cic_msb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
uint64_t d_Cic_lsb_bits; //!< Amplitude of the Cosine Harmonic Correction Term to the Argument of Latitude [rad]
uint64_t d_eccentricity_msb_bits; //!< Eccentricity [dimensionless]
uint64_t d_eccentricity_lsb_bits;
uint64_t d_i_0_msb_bits; //!< Inclination Angle at Reference Time [semi-circles]
uint64_t d_i_0_lsb_bits; //!< Inclination Angle at Reference Time [semi-circles]
uint64_t d_OMEGA_msb_bits; //!< Argument of Perigee [semi-cicles]
uint64_t d_OMEGA_lsb_bits; //!< Argument of Perigee [semi-cicles]
uint64_t d_OMEGA_DOT_msb_bits; //!< Rate of Right Ascension [semi-circles/s]
uint64_t d_OMEGA_DOT_lsb_bits; //!< Rate of Right Ascension [semi-circles/s]
// Almanac
double d_Toa; //!< Almanac reference time [s]
int i_WN_A; //!< Modulo 256 of the GPS week number to which the almanac reference time (d_Toa) is referenced
std::map<int, int> almanacHealth; //!< Map that stores the health information stored in the almanac
int32_t i_WN_A; //!< Modulo 256 of the GPS week number to which the almanac reference time (d_Toa) is referenced
std::map<int32_t, int32_t> almanacHealth; //!< Map that stores the health information stored in the almanac
std::map<int, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
std::map<int32_t, std::string> satelliteBlock; //!< Map that stores to which block the PRN belongs http://www.navcen.uscg.gov/?Do=constellationStatus
// Flags
@ -201,8 +201,8 @@ public:
double d_satpos_Z; //!< Earth-fixed coordinate z of the satellite [m]. The direction of the IERS (International Earth Rotation and Reference Systems Service) Reference Pole (IRP).
// satellite identification info
int i_channel_ID;
unsigned int i_satellite_PRN;
int32_t i_channel_ID;
uint32_t i_satellite_PRN;
// time synchro
double d_subframe_timestamp_ms; //[ms]
@ -221,8 +221,8 @@ public:
double d_A1UTC; //!< 1st order term of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s/s]
double d_A0UTC; //!< Constant of a model that relates GPS and UTC time (ref. 20.3.3.5.2.4 IS-GPS-200E) [s]
double d_DeltaT_LS; //!< delta time due to leap seconds [s]. Number of leap seconds since 6-Jan-1980 as transmitted by the GPS almanac.
int i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks]
int i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days]
int32_t i_WN_LSF; //!< Week number at the end of which the leap second becomes effective [weeks]
int32_t i_DN; //!< Day number (DN) at the end of which the leap second becomes effective [days]
double d_DeltaT_LSF; //!< Scheduled future or recent past (relative to NAV message upload) value of the delta time due to leap seconds [s]
double d_A1GPS;
double d_A0GPS;
@ -241,7 +241,7 @@ public:
double d_OMEGA_DOT_ALMANAC;
double d_OMEGA_ALMANAC;
double d_M0_ALMANAC;
int almanac_WN;
int32_t almanac_WN;
double d_toa2;
// Satellite velocity
@ -272,12 +272,12 @@ public:
/*!
* \brief Decodes the BDS D1 NAV message
*/
int d1_subframe_decoder(std::string const& subframe);
int32_t d1_subframe_decoder(std::string const& subframe);
/*!
* \brief Decodes the BDS D2 NAV message
*/
int d2_subframe_decoder(std::string const& subframe);
int32_t d2_subframe_decoder(std::string const& subframe);
/*!
* \brief Computes the position of the satellite

View File

@ -615,6 +615,10 @@ if(NOT ENABLE_PACKAGING)
target_include_directories(gnss_block_test PUBLIC ${CMAKE_SOURCE_DIR}/src/algorithms/libs)
if(ENABLE_FPGA)
target_compile_definitions(gnss_block_test PUBLIC -DENABLE_FPGA=1)
endif()
add_test(gnss_block_test gnss_block_test)
set_property(TEST gnss_block_test PROPERTY TIMEOUT 60)

View File

@ -29,6 +29,9 @@ target_link_libraries(front_end_cal_lib
Threads::Threads
acq_adapters
Volkgnsssdr::volkgnsssdr ${ORC_LIBRARIES}
signal_source_adapters
signal_source_gr_blocks
signal_source_lib
rx_core_lib
gnss_sdr_flags
gnss_rx