mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-03-13 15:08:16 +00:00
bds: Add unified trk startegy to deliver 1 symbol per sample
This works builds up upon J. Arribas work for unified symbol dec in tracking. Fixes a couple of bugs with PVT code and adds new code for RINEX functions. Adds cosmetic fixes to the code with unused variables.
This commit is contained in:
parent
c2f4b39bb2
commit
b262c58aa8
@ -16,7 +16,7 @@ ControlThread.wait_for_flowgraph=false
|
|||||||
|
|
||||||
;######### SIGNAL_SOURCE CONFIG ############
|
;######### SIGNAL_SOURCE CONFIG ############
|
||||||
SignalSource.implementation=File_Signal_Source
|
SignalSource.implementation=File_Signal_Source
|
||||||
SignalSource.filename=/home/dmiralles/Documents/gnss-metadata-standard/install/BdsB1IStr01.dat
|
SignalSource.filename=/archive/BDS3_datasets/BdsB1IStr01.dat
|
||||||
SignalSource.item_type=byte
|
SignalSource.item_type=byte
|
||||||
SignalSource.sampling_frequency=25000000
|
SignalSource.sampling_frequency=25000000
|
||||||
SignalSource.samples=0
|
SignalSource.samples=0
|
||||||
|
@ -16,7 +16,7 @@ ControlThread.wait_for_flowgraph=false
|
|||||||
|
|
||||||
;######### SIGNAL_SOURCE CONFIG ############
|
;######### SIGNAL_SOURCE CONFIG ############
|
||||||
SignalSource.implementation=File_Signal_Source
|
SignalSource.implementation=File_Signal_Source
|
||||||
SignalSource.filename=/home/dmiralles/Documents/gnss-metadata-standard/install/BdsB3IStr01.dat
|
SignalSource.filename=/archive/BDS3_datasets/BdsB3IStr01.dat
|
||||||
SignalSource.item_type=byte
|
SignalSource.item_type=byte
|
||||||
SignalSource.sampling_frequency=50000000
|
SignalSource.sampling_frequency=50000000
|
||||||
SignalSource.samples=0
|
SignalSource.samples=0
|
||||||
|
@ -29,8 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rinex_printer.h"
|
#include "rinex_printer.h"
|
||||||
#include "Beidou_B1I.h"
|
#include "Beidou_DNAV.h"
|
||||||
#include "Beidou_B3I.h"
|
|
||||||
#include "GLONASS_L1_L2_CA.h"
|
#include "GLONASS_L1_L2_CA.h"
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "Galileo_E1.h"
|
#include "Galileo_E1.h"
|
||||||
@ -11572,7 +11571,7 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris
|
|||||||
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int32_t>(ssi), 1);
|
lineObs += Rinex_Printer::rightJustify(Rinex_Printer::asString<int32_t>(ssi), 1);
|
||||||
|
|
||||||
// CARRIER PHASE
|
// CARRIER PHASE
|
||||||
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Carrier_phase_rads / (BEIDOU_TWO_PI), 3), 14);
|
lineObs += Rinex_Printer::rightJustify(asString(iter->second.Carrier_phase_rads / (BEIDOU_DNAV_TWO_PI), 3), 14);
|
||||||
if (lli == 0)
|
if (lli == 0)
|
||||||
{
|
{
|
||||||
lineObs += std::string(1, ' ');
|
lineObs += std::string(1, ' ');
|
||||||
|
@ -29,11 +29,10 @@
|
|||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "beidou_b1i_telemetry_decoder_gs.h"
|
#include "beidou_b1i_telemetry_decoder_gs.h"
|
||||||
#include "Beidou_B1I.h"
|
#include "Beidou_B1I.h"
|
||||||
#include "Beidou_DNAV.h"
|
#include "Beidou_DNAV.h"
|
||||||
|
#include "beidou_dnav_almanac.h"
|
||||||
#include "beidou_dnav_ephemeris.h"
|
#include "beidou_dnav_ephemeris.h"
|
||||||
#include "beidou_dnav_iono.h"
|
#include "beidou_dnav_iono.h"
|
||||||
#include "beidou_dnav_utc_model.h"
|
#include "beidou_dnav_utc_model.h"
|
||||||
@ -58,7 +57,6 @@ beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump)
|
|||||||
return beidou_b1i_telemetry_decoder_gs_sptr(new beidou_b1i_telemetry_decoder_gs(satellite, dump));
|
return beidou_b1i_telemetry_decoder_gs_sptr(new beidou_b1i_telemetry_decoder_gs(satellite, dump));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
|
beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
|
||||||
const Gnss_Satellite &satellite,
|
const Gnss_Satellite &satellite,
|
||||||
bool dump) : gr::block("beidou_b1i_telemetry_decoder_gs",
|
bool dump) : gr::block("beidou_b1i_telemetry_decoder_gs",
|
||||||
@ -76,63 +74,38 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
|
|||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
LOG(INFO) << "Initializing BeiDou B1I Telemetry Decoding for satellite " << this->d_satellite;
|
LOG(INFO) << "Initializing BeiDou B1I Telemetry Decoding for satellite " << this->d_satellite;
|
||||||
|
|
||||||
d_samples_per_symbol = (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS) / BEIDOU_D1NAV_SYMBOL_RATE_SPS;
|
d_symbol_duration_ms = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
|
||||||
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol;
|
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
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_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_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
|
||||||
|
|
||||||
// Setting samples of secondary code
|
|
||||||
for (int32_t i = 0; i < BEIDOU_B1I_SECONDARY_CODE_LENGTH; i++)
|
|
||||||
{
|
|
||||||
if (BEIDOU_B1I_SECONDARY_CODE.at(i) == '1')
|
|
||||||
{
|
|
||||||
d_secondary_code_symbols[i] = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d_secondary_code_symbols[i] = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setting samples of preamble code
|
// Setting samples of preamble code
|
||||||
int32_t n = 0;
|
|
||||||
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
{
|
{
|
||||||
int32_t m = 0;
|
|
||||||
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
d_preamble_samples[i] = 1;
|
||||||
{
|
|
||||||
d_preamble_samples[n] = d_secondary_code_symbols[m];
|
|
||||||
n++;
|
|
||||||
m++;
|
|
||||||
m = m % BEIDOU_B1I_SECONDARY_CODE_LENGTH;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
d_preamble_samples[i] = -1;
|
||||||
{
|
|
||||||
d_preamble_samples[n] = -d_secondary_code_symbols[m];
|
|
||||||
n++;
|
|
||||||
m++;
|
|
||||||
m = m % BEIDOU_B1I_SECONDARY_CODE_LENGTH;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment()));
|
d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol + d_samples_per_preamble;
|
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
|
||||||
d_symbol_history.set_capacity(d_required_symbols + 1);
|
d_symbol_history.set_capacity(d_required_symbols);
|
||||||
|
|
||||||
|
d_last_valid_preamble = 0;
|
||||||
|
d_sent_tlm_failed_msg = false;
|
||||||
|
d_flag_valid_word = false;
|
||||||
// Generic settings
|
// Generic settings
|
||||||
d_sample_counter = 0;
|
d_sample_counter = 0;
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
d_preamble_index = 0;
|
d_preamble_index = 0;
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
d_TOW_at_current_symbol_ms = 0;
|
d_TOW_at_current_symbol_ms = 0U;
|
||||||
d_TOW_at_Preamble_ms = 0U;
|
d_TOW_at_Preamble_ms = 0U;
|
||||||
Flag_valid_word = false;
|
Flag_valid_word = false;
|
||||||
d_CRC_error_counter = 0;
|
d_CRC_error_counter = 0;
|
||||||
@ -145,7 +118,6 @@ beidou_b1i_telemetry_decoder_gs::beidou_b1i_telemetry_decoder_gs(
|
|||||||
beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs()
|
beidou_b1i_telemetry_decoder_gs::~beidou_b1i_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
volk_gnsssdr_free(d_preamble_samples);
|
volk_gnsssdr_free(d_preamble_samples);
|
||||||
volk_gnsssdr_free(d_secondary_code_symbols);
|
|
||||||
volk_gnsssdr_free(d_subframe_symbols);
|
volk_gnsssdr_free(d_subframe_symbols);
|
||||||
|
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
@ -193,7 +165,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits, in
|
|||||||
|
|
||||||
void beidou_b1i_telemetry_decoder_gs::decode_word(
|
void beidou_b1i_telemetry_decoder_gs::decode_word(
|
||||||
int32_t word_counter,
|
int32_t word_counter,
|
||||||
const double *enc_word_symbols,
|
const float *enc_word_symbols,
|
||||||
int32_t *dec_word_symbols)
|
int32_t *dec_word_symbols)
|
||||||
{
|
{
|
||||||
int32_t bitsbch[30], first_branch[15], second_branch[15];
|
int32_t bitsbch[30], first_branch[15], second_branch[15];
|
||||||
@ -233,7 +205,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_word(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void beidou_b1i_telemetry_decoder_gs::decode_subframe(double *frame_symbols)
|
void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||||
{
|
{
|
||||||
// 1. Transform from symbols to bits
|
// 1. Transform from symbols to bits
|
||||||
std::string data_bits;
|
std::string data_bits;
|
||||||
@ -264,11 +236,13 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(double *frame_symbols)
|
|||||||
// 3. Check operation executed correctly
|
// 3. Check operation executed correctly
|
||||||
if (d_nav.flag_crc_test == true)
|
if (d_nav.flag_crc_test == true)
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "BeiDou DNAV CRC correct in channel " << d_channel << " from satellite " << d_satellite;
|
DLOG(INFO) << "BeiDou DNAV CRC correct in channel " << d_channel
|
||||||
|
<< " from satellite " << d_satellite;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "BeiDou DNAV CRC error in channel " << d_channel << " from satellite " << d_satellite;
|
DLOG(INFO) << "BeiDou DNAV CRC error in channel " << d_channel
|
||||||
|
<< " from satellite " << d_satellite;
|
||||||
}
|
}
|
||||||
// 4. Push the new navigation data to the queues
|
// 4. Push the new navigation data to the queues
|
||||||
if (d_nav.have_new_ephemeris() == true)
|
if (d_nav.have_new_ephemeris() == true)
|
||||||
@ -323,41 +297,59 @@ void beidou_b1i_telemetry_decoder_gs::set_satellite(const Gnss_Satellite &satell
|
|||||||
{
|
{
|
||||||
// Clear values from previous declaration
|
// Clear values from previous declaration
|
||||||
volk_gnsssdr_free(d_preamble_samples);
|
volk_gnsssdr_free(d_preamble_samples);
|
||||||
volk_gnsssdr_free(d_secondary_code_symbols);
|
|
||||||
volk_gnsssdr_free(d_subframe_symbols);
|
volk_gnsssdr_free(d_subframe_symbols);
|
||||||
|
|
||||||
d_samples_per_symbol = (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS) / BEIDOU_D2NAV_SYMBOL_RATE_SPS;
|
|
||||||
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol;
|
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
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_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_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
|
||||||
|
|
||||||
// Setting samples of preamble code
|
// Setting samples of preamble code
|
||||||
int32_t n = 0;
|
|
||||||
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
{
|
{
|
||||||
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
d_preamble_samples[i] = 1;
|
||||||
{
|
|
||||||
d_preamble_samples[n] = 1;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
d_preamble_samples[i] = -1;
|
||||||
{
|
|
||||||
d_preamble_samples[n] = -1;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double), volk_gnsssdr_get_alignment()));
|
d_symbol_duration_ms = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
|
||||||
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol + d_samples_per_preamble;
|
d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
d_symbol_history.set_capacity(d_required_symbols + 1);
|
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
|
||||||
|
d_symbol_history.set_capacity(d_required_symbols);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Clear values from previous declaration
|
||||||
|
volk_gnsssdr_free(d_preamble_samples);
|
||||||
|
volk_gnsssdr_free(d_subframe_symbols);
|
||||||
|
//back to normal satellites
|
||||||
|
d_symbol_duration_ms = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
|
||||||
|
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
|
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
|
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;
|
||||||
|
|
||||||
|
// Setting samples of preamble code
|
||||||
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
|
{
|
||||||
|
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
||||||
|
{
|
||||||
|
d_preamble_samples[i] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_preamble_samples[i] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
|
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
|
||||||
|
d_symbol_history.set_capacity(d_required_symbols);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -388,6 +380,15 @@ void beidou_b1i_telemetry_decoder_gs::set_channel(int32_t channel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void beidou_b1i_telemetry_decoder_gs::reset()
|
||||||
|
{
|
||||||
|
d_last_valid_preamble = d_sample_counter;
|
||||||
|
d_TOW_at_current_symbol_ms = 0;
|
||||||
|
d_sent_tlm_failed_msg = false;
|
||||||
|
d_flag_valid_word = false;
|
||||||
|
DLOG(INFO) << "Beidou B1I Telemetry decoder reset for satellite " << d_satellite;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
@ -404,10 +405,9 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue
|
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_sample_counter++; // count for the processed samples
|
||||||
consume_each(1);
|
consume_each(1);
|
||||||
|
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
|
|
||||||
if (d_symbol_history.size() > d_required_symbols)
|
if (d_symbol_history.size() >= d_required_symbols)
|
||||||
{
|
{
|
||||||
//******* preamble correlation ********
|
//******* preamble correlation ********
|
||||||
for (int32_t i = 0; i < d_samples_per_preamble; i++)
|
for (int32_t i = 0; i < d_samples_per_preamble; i++)
|
||||||
@ -422,7 +422,6 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******* frame sync ******************
|
//******* frame sync ******************
|
||||||
if (d_stat == 0) // no preamble information
|
if (d_stat == 0) // no preamble information
|
||||||
{
|
{
|
||||||
@ -430,7 +429,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
{
|
{
|
||||||
// Record the preamble sample stamp
|
// Record the preamble sample stamp
|
||||||
d_preamble_index = d_sample_counter;
|
d_preamble_index = d_sample_counter;
|
||||||
LOG(INFO) << "Preamble detection for BEIDOU B1I SAT " << this->d_satellite;
|
DLOG(INFO) << "Preamble detection for BEIDOU B1I SAT " << this->d_satellite;
|
||||||
// Enter into frame pre-detection status
|
// Enter into frame pre-detection status
|
||||||
d_stat = 1;
|
d_stat = 1;
|
||||||
}
|
}
|
||||||
@ -444,9 +443,54 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
if (abs(preamble_diff - d_preamble_period_samples) == 0)
|
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;
|
DLOG(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_preamble_index = d_sample_counter; //record the preamble sample stamp
|
||||||
|
|
||||||
|
|
||||||
d_stat = 2;
|
d_stat = 2;
|
||||||
|
|
||||||
|
// ******* SAMPLES TO SYMBOLS *******
|
||||||
|
if (corr_value > 0) //normal PLL lock
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
||||||
|
{
|
||||||
|
d_subframe_symbols[i] = d_symbol_history.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // 180 deg. inverted carrier phase PLL lock
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
||||||
|
{
|
||||||
|
d_subframe_symbols[i] = -d_symbol_history.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
if (!d_flag_frame_sync)
|
||||||
|
{
|
||||||
|
d_flag_frame_sync = true;
|
||||||
|
DLOG(INFO) << "BeiDou DNAV frame sync found for SAT " << this->d_satellite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_CRC_error_counter++;
|
||||||
|
d_preamble_index = d_sample_counter; // record the preamble sample stamp
|
||||||
|
if (d_CRC_error_counter > CRC_ERROR_LIMIT)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite;
|
||||||
|
d_flag_frame_sync = false;
|
||||||
|
d_stat = 0;
|
||||||
|
flag_SOW_set = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -465,50 +509,16 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
// ******* SAMPLES TO SYMBOLS *******
|
// ******* SAMPLES TO SYMBOLS *******
|
||||||
if (corr_value > 0) //normal PLL lock
|
if (corr_value > 0) //normal PLL lock
|
||||||
{
|
{
|
||||||
int32_t k = 0;
|
|
||||||
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
||||||
{
|
{
|
||||||
d_subframe_symbols[i] = 0;
|
d_subframe_symbols[i] = d_symbol_history.at(i);
|
||||||
// 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)
|
|
||||||
{
|
|
||||||
// because last symbol of the preamble is just received now!
|
|
||||||
d_subframe_symbols[i] += d_symbol_history.at(i * d_samples_per_symbol + m);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// because last symbol of the preamble is just received now!
|
|
||||||
d_subframe_symbols[i] += static_cast<float>(d_secondary_code_symbols[k]) * d_symbol_history.at(i * d_samples_per_symbol + m);
|
|
||||||
k++;
|
|
||||||
k = k % BEIDOU_B1I_SECONDARY_CODE_LENGTH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // 180 deg. inverted carrier phase PLL lock
|
else // 180 deg. inverted carrier phase PLL lock
|
||||||
{
|
{
|
||||||
int32_t k = 0;
|
|
||||||
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
||||||
{
|
{
|
||||||
d_subframe_symbols[i] = 0;
|
d_subframe_symbols[i] = -d_symbol_history.at(i);
|
||||||
// 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)
|
|
||||||
{
|
|
||||||
// because last symbol of the preamble is just received now!
|
|
||||||
d_subframe_symbols[i] -= d_symbol_history.at(i * d_samples_per_symbol + m);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// because last symbol of the preamble is just received now!
|
|
||||||
d_subframe_symbols[i] -= static_cast<float>(d_secondary_code_symbols[k]) * d_symbol_history.at(i * d_samples_per_symbol + m);
|
|
||||||
k++;
|
|
||||||
k = k % BEIDOU_B1I_SECONDARY_CODE_LENGTH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +542,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
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)
|
if (d_CRC_error_counter > CRC_ERROR_LIMIT)
|
||||||
{
|
{
|
||||||
LOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite;
|
DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT " << this->d_satellite;
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
flag_SOW_set = false;
|
flag_SOW_set = false;
|
||||||
@ -540,7 +550,6 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE GNSS SYNCHRO DATA
|
// 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)
|
if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true)
|
||||||
@ -548,52 +557,67 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
|||||||
{
|
{
|
||||||
// Reporting sow as gps time of week
|
// Reporting sow as gps time of week
|
||||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
||||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * BEIDOU_B1I_CODE_PERIOD_MS);
|
//check TOW update consistency
|
||||||
|
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||||
|
//compute new TOW
|
||||||
|
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
|
||||||
flag_SOW_set = true;
|
flag_SOW_set = true;
|
||||||
d_nav.flag_new_SOW_available = false;
|
d_nav.flag_new_SOW_available = false;
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (last_d_TOW_at_current_symbol_ms != 0 and abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > d_symbol_duration_ms)
|
||||||
|
{
|
||||||
|
LOG(INFO) << "Warning: BEIDOU B1I TOW update in ch " << d_channel
|
||||||
|
<< " does not match the TLM TOW counter " << static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms) << " ms \n";
|
||||||
|
|
||||||
if (d_flag_frame_sync == true and flag_SOW_set == true)
|
d_TOW_at_current_symbol_ms = 0;
|
||||||
{
|
d_flag_valid_word = false;
|
||||||
current_symbol.Flag_valid_word = true;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_last_valid_preamble = d_sample_counter;
|
||||||
|
d_flag_valid_word = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
current_symbol.Flag_valid_word = false;
|
if (d_flag_valid_word)
|
||||||
|
{
|
||||||
|
d_TOW_at_current_symbol_ms += d_symbol_duration_ms;
|
||||||
|
if (current_symbol.Flag_valid_symbol_output == false)
|
||||||
|
{
|
||||||
|
d_flag_valid_word = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
current_symbol.PRN = this->d_satellite.get_PRN();
|
if (d_flag_valid_word == true)
|
||||||
current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
|
||||||
|
|
||||||
if (d_dump == true)
|
|
||||||
{
|
{
|
||||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||||
try
|
current_symbol.Flag_valid_word = d_flag_valid_word;
|
||||||
|
|
||||||
|
if (d_dump == true)
|
||||||
{
|
{
|
||||||
double tmp_double;
|
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||||
uint64_t tmp_ulong_int;
|
try
|
||||||
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms);
|
{
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
double tmp_double;
|
||||||
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
uint64_t tmp_ulong_int;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
||||||
tmp_double = d_nav.d_SOW;
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
||||||
tmp_ulong_int = static_cast<uint64_t>(d_required_symbols);
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
||||||
}
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
catch (const std::ifstream::failure &e)
|
}
|
||||||
{
|
catch (const std::ifstream::failure &e)
|
||||||
LOG(WARNING) << "Exception writing observables dump file " << e.what();
|
{
|
||||||
|
LOG(WARNING) << "Exception writing Telemetry GPS L5 dump file " << e.what();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
|
||||||
|
*out[0] = current_symbol;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
|
|
||||||
*out[0] = current_symbol;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
#include <boost/circular_buffer.hpp>
|
#include <boost/circular_buffer.hpp>
|
||||||
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
#include <boost/shared_ptr.hpp> // for boost::shared_ptr
|
||||||
#include <gnuradio/block.h> // for block
|
#include <gnuradio/block.h> // for block
|
||||||
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -62,10 +62,8 @@ public:
|
|||||||
~beidou_b1i_telemetry_decoder_gs(); //!< Class destructor
|
~beidou_b1i_telemetry_decoder_gs(); //!< Class destructor
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int channel); //!< Set receiver's channel
|
||||||
inline void reset()
|
void reset();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
*/
|
*/
|
||||||
@ -77,19 +75,17 @@ private:
|
|||||||
beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
beidou_b1i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||||
beidou_b1i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
beidou_b1i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
void decode_subframe(double *symbols);
|
void decode_subframe(float *symbols);
|
||||||
void decode_word(int32_t word_counter, const double *enc_word_symbols, int32_t *dec_word_symbols);
|
void decode_word(int32_t word_counter, const float *enc_word_symbols, int32_t *dec_word_symbols);
|
||||||
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
|
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
|
||||||
|
|
||||||
|
|
||||||
// Preamble decoding
|
// Preamble decoding
|
||||||
int32_t *d_preamble_samples;
|
int32_t *d_preamble_samples;
|
||||||
int32_t *d_secondary_code_symbols;
|
|
||||||
uint32_t d_samples_per_symbol;
|
|
||||||
int32_t d_symbols_per_preamble;
|
int32_t d_symbols_per_preamble;
|
||||||
int32_t d_samples_per_preamble;
|
int32_t d_samples_per_preamble;
|
||||||
int32_t d_preamble_period_samples;
|
int32_t d_preamble_period_samples;
|
||||||
double *d_subframe_symbols;
|
float *d_subframe_symbols;
|
||||||
uint32_t d_required_symbols;
|
uint32_t d_required_symbols;
|
||||||
|
|
||||||
// Storage for incoming data
|
// Storage for incoming data
|
||||||
@ -107,12 +103,16 @@ private:
|
|||||||
//!< Navigation Message variable
|
//!< Navigation Message variable
|
||||||
Beidou_Dnav_Navigation_Message d_nav;
|
Beidou_Dnav_Navigation_Message d_nav;
|
||||||
|
|
||||||
//!< Values to populate gnss synchronization structure
|
// Values to populate gnss synchronization structure
|
||||||
|
uint32_t d_symbol_duration_ms;
|
||||||
uint32_t d_TOW_at_Preamble_ms;
|
uint32_t d_TOW_at_Preamble_ms;
|
||||||
uint32_t d_TOW_at_current_symbol_ms;
|
uint32_t d_TOW_at_current_symbol_ms;
|
||||||
|
uint64_t d_last_valid_preamble;
|
||||||
|
bool d_flag_valid_word;
|
||||||
|
bool d_sent_tlm_failed_msg;
|
||||||
bool Flag_valid_word;
|
bool Flag_valid_word;
|
||||||
|
|
||||||
//!< Satellite Information and logging capacity
|
// Satellite Information and logging capacity
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
int32_t d_channel;
|
int32_t d_channel;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
|
@ -53,8 +53,7 @@ beidou_b3i_telemetry_decoder_gs_sptr
|
|||||||
beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite,
|
beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite,
|
||||||
bool dump)
|
bool dump)
|
||||||
{
|
{
|
||||||
return beidou_b3i_telemetry_decoder_gs_sptr(
|
return beidou_b3i_telemetry_decoder_gs_sptr(new beidou_b3i_telemetry_decoder_gs(satellite, dump));
|
||||||
new beidou_b3i_telemetry_decoder_gs(satellite, dump));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -70,74 +69,37 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
|
|||||||
this->message_port_register_out(pmt::mp("telemetry"));
|
this->message_port_register_out(pmt::mp("telemetry"));
|
||||||
// Control messages to tracking block
|
// Control messages to tracking block
|
||||||
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
|
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
|
||||||
|
|
||||||
// initialize internal vars
|
// initialize internal vars
|
||||||
d_dump = dump;
|
d_dump = dump;
|
||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
LOG(INFO) << "Initializing BeiDou B3I Telemetry Decoding for satellite "
|
LOG(INFO) << "Initializing BeiDou B3I Telemetry Decoding for satellite " << this->d_satellite;
|
||||||
<< this->d_satellite;
|
|
||||||
|
|
||||||
d_samples_per_symbol =
|
d_symbol_duration_ms = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
|
||||||
(BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS) /
|
|
||||||
BEIDOU_D1NAV_SYMBOL_RATE_SPS;
|
|
||||||
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
d_samples_per_preamble =
|
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol;
|
d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
d_secondary_code_symbols = static_cast<int32_t *>(
|
d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
|
||||||
volk_gnsssdr_malloc(BEIDOU_B3I_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;
|
|
||||||
|
|
||||||
// Setting samples of secondary code
|
|
||||||
for (int32_t i = 0; i < BEIDOU_B3I_SECONDARY_CODE_LENGTH; i++)
|
|
||||||
{
|
|
||||||
if (BEIDOU_B3I_SECONDARY_CODE.at(i) == '1')
|
|
||||||
{
|
|
||||||
d_secondary_code_symbols[i] = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d_secondary_code_symbols[i] = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setting samples of preamble code
|
// Setting samples of preamble code
|
||||||
int32_t n = 0;
|
|
||||||
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
{
|
{
|
||||||
int32_t m = 0;
|
|
||||||
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
d_preamble_samples[i] = 1;
|
||||||
{
|
|
||||||
d_preamble_samples[n] = d_secondary_code_symbols[m];
|
|
||||||
n++;
|
|
||||||
m++;
|
|
||||||
m = m % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
d_preamble_samples[i] = -1;
|
||||||
{
|
|
||||||
d_preamble_samples[n] = -d_secondary_code_symbols[m];
|
|
||||||
n++;
|
|
||||||
m++;
|
|
||||||
m = m % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d_subframe_symbols = static_cast<double *>(
|
d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double),
|
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
|
||||||
volk_gnsssdr_get_alignment()));
|
d_symbol_history.set_capacity(d_required_symbols);
|
||||||
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol +
|
|
||||||
d_samples_per_preamble;
|
|
||||||
d_symbol_history.set_capacity(d_required_symbols + 1);
|
|
||||||
|
|
||||||
|
d_last_valid_preamble = 0;
|
||||||
|
d_sent_tlm_failed_msg = false;
|
||||||
|
d_flag_valid_word = false;
|
||||||
// Generic settings
|
// Generic settings
|
||||||
d_sample_counter = 0;
|
d_sample_counter = 0;
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
@ -156,7 +118,6 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs(
|
|||||||
beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
|
beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
|
||||||
{
|
{
|
||||||
volk_gnsssdr_free(d_preamble_samples);
|
volk_gnsssdr_free(d_preamble_samples);
|
||||||
volk_gnsssdr_free(d_secondary_code_symbols);
|
|
||||||
volk_gnsssdr_free(d_subframe_symbols);
|
volk_gnsssdr_free(d_subframe_symbols);
|
||||||
|
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
@ -167,8 +128,7 @@ beidou_b3i_telemetry_decoder_gs::~beidou_b3i_telemetry_decoder_gs()
|
|||||||
}
|
}
|
||||||
catch (const std::exception &ex)
|
catch (const std::exception &ex)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file "
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
<< ex.what();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -205,7 +165,8 @@ void beidou_b3i_telemetry_decoder_gs::decode_bch15_11_01(const int32_t *bits,
|
|||||||
|
|
||||||
|
|
||||||
void beidou_b3i_telemetry_decoder_gs::decode_word(
|
void beidou_b3i_telemetry_decoder_gs::decode_word(
|
||||||
int32_t word_counter, const double *enc_word_symbols,
|
int32_t word_counter,
|
||||||
|
const float *enc_word_symbols,
|
||||||
int32_t *dec_word_symbols)
|
int32_t *dec_word_symbols)
|
||||||
{
|
{
|
||||||
int32_t bitsbch[30], first_branch[15], second_branch[15];
|
int32_t bitsbch[30], first_branch[15], second_branch[15];
|
||||||
@ -214,8 +175,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_word(
|
|||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < 30; j++)
|
for (uint32_t j = 0; j < 30; j++)
|
||||||
{
|
{
|
||||||
dec_word_symbols[j] =
|
dec_word_symbols[j] = static_cast<int32_t>(enc_word_symbols[j] > 0) ? (1) : (-1);
|
||||||
static_cast<int32_t>(enc_word_symbols[j] > 0) ? (1) : (-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -224,8 +184,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_word(
|
|||||||
{
|
{
|
||||||
for (uint32_t c = 0; c < 15; c++)
|
for (uint32_t c = 0; c < 15; c++)
|
||||||
{
|
{
|
||||||
bitsbch[r * 15 + c] =
|
bitsbch[r * 15 + c] = static_cast<int32_t>(enc_word_symbols[c * 2 + r] > 0) ? (1) : (-1);
|
||||||
static_cast<int32_t>(enc_word_symbols[c * 2 + r] > 0) ? (1) : (-1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,7 +206,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_word(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void beidou_b3i_telemetry_decoder_gs::decode_subframe(double *frame_symbols)
|
void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||||
{
|
{
|
||||||
// 1. Transform from symbols to bits
|
// 1. Transform from symbols to bits
|
||||||
std::string data_bits;
|
std::string data_bits;
|
||||||
@ -356,50 +315,62 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite(
|
|||||||
{
|
{
|
||||||
// Clear values from previous declaration
|
// Clear values from previous declaration
|
||||||
volk_gnsssdr_free(d_preamble_samples);
|
volk_gnsssdr_free(d_preamble_samples);
|
||||||
volk_gnsssdr_free(d_secondary_code_symbols);
|
|
||||||
volk_gnsssdr_free(d_subframe_symbols);
|
volk_gnsssdr_free(d_subframe_symbols);
|
||||||
|
|
||||||
d_samples_per_symbol =
|
|
||||||
(BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS) /
|
|
||||||
BEIDOU_D2NAV_SYMBOL_RATE_SPS;
|
|
||||||
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
d_samples_per_preamble =
|
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS * d_samples_per_symbol;
|
d_preamble_samples = static_cast<int32_t *>(volk_gnsssdr_malloc(d_samples_per_preamble * sizeof(int32_t),
|
||||||
d_secondary_code_symbols = nullptr;
|
volk_gnsssdr_get_alignment()));
|
||||||
d_preamble_samples = static_cast<int32_t *>(
|
d_preamble_period_samples = BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS;
|
||||||
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;
|
|
||||||
|
|
||||||
// Setting samples of preamble code
|
// Setting samples of preamble code
|
||||||
int32_t n = 0;
|
|
||||||
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
{
|
{
|
||||||
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
d_preamble_samples[i] = 1;
|
||||||
{
|
|
||||||
d_preamble_samples[n] = 1;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
d_preamble_samples[i] = -1;
|
||||||
{
|
}
|
||||||
d_preamble_samples[n] = -1;
|
}
|
||||||
n++;
|
d_symbol_duration_ms = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
|
||||||
}
|
d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(
|
||||||
|
BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float),
|
||||||
|
volk_gnsssdr_get_alignment()));
|
||||||
|
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
|
||||||
|
d_symbol_history.set_capacity(d_required_symbols);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Clear values from previous declaration
|
||||||
|
volk_gnsssdr_free(d_preamble_samples);
|
||||||
|
volk_gnsssdr_free(d_subframe_symbols);
|
||||||
|
//back to normal satellites
|
||||||
|
d_symbol_duration_ms = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
|
||||||
|
d_symbols_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
|
d_samples_per_preamble = BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
|
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;
|
||||||
|
|
||||||
|
// Setting samples of preamble code
|
||||||
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
|
{
|
||||||
|
if (BEIDOU_DNAV_PREAMBLE.at(i) == '1')
|
||||||
|
{
|
||||||
|
d_preamble_samples[i] = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_preamble_samples[i] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d_subframe_symbols = static_cast<double *>(volk_gnsssdr_malloc(
|
d_subframe_symbols = static_cast<float *>(volk_gnsssdr_malloc(BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(float), volk_gnsssdr_get_alignment()));
|
||||||
BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS * sizeof(double),
|
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS + d_samples_per_preamble;
|
||||||
volk_gnsssdr_get_alignment()));
|
d_symbol_history.set_capacity(d_required_symbols);
|
||||||
d_required_symbols = BEIDOU_DNAV_SUBFRAME_SYMBOLS * d_samples_per_symbol +
|
|
||||||
d_samples_per_preamble;
|
|
||||||
d_symbol_history.set_capacity(d_required_symbols + 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -434,6 +405,15 @@ void beidou_b3i_telemetry_decoder_gs::set_channel(int32_t channel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void beidou_b3i_telemetry_decoder_gs::reset()
|
||||||
|
{
|
||||||
|
d_last_valid_preamble = d_sample_counter;
|
||||||
|
d_TOW_at_current_symbol_ms = 0;
|
||||||
|
d_sent_tlm_failed_msg = false;
|
||||||
|
d_flag_valid_word = false;
|
||||||
|
DLOG(INFO) << "Beidou B3I Telemetry decoder reset for satellite " << d_satellite;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int beidou_b3i_telemetry_decoder_gs::general_work(
|
int beidou_b3i_telemetry_decoder_gs::general_work(
|
||||||
int noutput_items __attribute__((unused)),
|
int noutput_items __attribute__((unused)),
|
||||||
@ -454,10 +434,9 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
d_symbol_history.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue
|
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_sample_counter++; // count for the processed samples
|
||||||
consume_each(1);
|
consume_each(1);
|
||||||
|
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
|
|
||||||
if (d_symbol_history.size() > d_required_symbols)
|
if (d_symbol_history.size() >= d_required_symbols)
|
||||||
{
|
{
|
||||||
//******* preamble correlation ********
|
//******* preamble correlation ********
|
||||||
for (int32_t i = 0; i < d_samples_per_preamble; i++)
|
for (int32_t i = 0; i < d_samples_per_preamble; i++)
|
||||||
@ -472,7 +451,6 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//******* frame sync ******************
|
//******* frame sync ******************
|
||||||
if (d_stat == 0) // no preamble information
|
if (d_stat == 0) // no preamble information
|
||||||
{
|
{
|
||||||
@ -480,8 +458,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
{
|
{
|
||||||
// Record the preamble sample stamp
|
// Record the preamble sample stamp
|
||||||
d_preamble_index = d_sample_counter;
|
d_preamble_index = d_sample_counter;
|
||||||
LOG(INFO) << "Preamble detection for BEIDOU B3I SAT "
|
DLOG(INFO) << "Preamble detection for BEIDOU B3I SAT " << this->d_satellite;
|
||||||
<< this->d_satellite;
|
|
||||||
// Enter into frame pre-detection status
|
// Enter into frame pre-detection status
|
||||||
d_stat = 1;
|
d_stat = 1;
|
||||||
}
|
}
|
||||||
@ -495,10 +472,55 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
if (abs(preamble_diff - d_preamble_period_samples) == 0)
|
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 B3I SAT "
|
DLOG(INFO) << "Starting BeiDou DNAV frame decoding for BeiDou B3I SAT "
|
||||||
<< this->d_satellite;
|
<< this->d_satellite;
|
||||||
d_preamble_index = d_sample_counter; // record the preamble sample stamp
|
d_preamble_index = d_sample_counter; // record the preamble sample stamp
|
||||||
d_stat = 2;
|
d_stat = 2;
|
||||||
|
|
||||||
|
// ******* SAMPLES TO SYMBOLS *******
|
||||||
|
if (corr_value > 0) //normal PLL lock
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
||||||
|
{
|
||||||
|
d_subframe_symbols[i] = d_symbol_history.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // 180 deg. inverted carrier phase PLL lock
|
||||||
|
{
|
||||||
|
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
||||||
|
{
|
||||||
|
d_subframe_symbols[i] = -d_symbol_history.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
if (!d_flag_frame_sync)
|
||||||
|
{
|
||||||
|
d_flag_frame_sync = true;
|
||||||
|
DLOG(INFO) << "BeiDou DNAV frame sync found for SAT "
|
||||||
|
<< this->d_satellite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_CRC_error_counter++;
|
||||||
|
d_preamble_index = d_sample_counter; // record the preamble sample stamp
|
||||||
|
if (d_CRC_error_counter > CRC_ERROR_LIMIT)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT "
|
||||||
|
<< this->d_satellite;
|
||||||
|
d_flag_frame_sync = false;
|
||||||
|
d_stat = 0;
|
||||||
|
flag_SOW_set = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -513,62 +535,21 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
}
|
}
|
||||||
else if (d_stat == 2) // preamble acquired
|
else if (d_stat == 2) // preamble acquired
|
||||||
{
|
{
|
||||||
if (d_sample_counter ==
|
if (d_sample_counter == d_preamble_index + static_cast<uint64_t>(d_preamble_period_samples))
|
||||||
d_preamble_index + static_cast<uint64_t>(d_preamble_period_samples))
|
|
||||||
{
|
{
|
||||||
//******* SAMPLES TO SYMBOLS *******
|
// ******* SAMPLES TO SYMBOLS *******
|
||||||
if (corr_value > 0) // normal PLL lock
|
if (corr_value > 0) //normal PLL lock
|
||||||
{
|
{
|
||||||
int32_t k = 0;
|
|
||||||
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
||||||
{
|
{
|
||||||
d_subframe_symbols[i] = 0;
|
d_subframe_symbols[i] = d_symbol_history.at(i);
|
||||||
// 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)
|
|
||||||
{
|
|
||||||
// because last symbol of the preamble is just received now!
|
|
||||||
d_subframe_symbols[i] +=
|
|
||||||
d_symbol_history.at(i * d_samples_per_symbol + m);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// because last symbol of the preamble is just received now!
|
|
||||||
d_subframe_symbols[i] +=
|
|
||||||
static_cast<float>(d_secondary_code_symbols[k]) *
|
|
||||||
d_symbol_history.at(i * d_samples_per_symbol + m);
|
|
||||||
k++;
|
|
||||||
k = k % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // 180 deg. inverted carrier phase PLL lock
|
else // 180 deg. inverted carrier phase PLL lock
|
||||||
{
|
{
|
||||||
int32_t k = 0;
|
|
||||||
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
for (uint32_t i = 0; i < BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS; i++)
|
||||||
{
|
{
|
||||||
d_subframe_symbols[i] = 0;
|
d_subframe_symbols[i] = -d_symbol_history.at(i);
|
||||||
// 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)
|
|
||||||
{
|
|
||||||
// because last symbol of the preamble is just received now!
|
|
||||||
d_subframe_symbols[i] -=
|
|
||||||
d_symbol_history.at(i * d_samples_per_symbol + m);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// because last symbol of the preamble is just received now!
|
|
||||||
d_subframe_symbols[i] -=
|
|
||||||
static_cast<float>(d_secondary_code_symbols[k]) *
|
|
||||||
d_symbol_history.at(i * d_samples_per_symbol + m);
|
|
||||||
k++;
|
|
||||||
k = k % BEIDOU_B3I_SECONDARY_CODE_LENGTH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,10 +559,8 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
if (d_nav.flag_crc_test == true)
|
if (d_nav.flag_crc_test == true)
|
||||||
{
|
{
|
||||||
d_CRC_error_counter = 0;
|
d_CRC_error_counter = 0;
|
||||||
d_flag_preamble = true; // valid preamble indicator (initialized to
|
d_flag_preamble = true; // valid preamble indicator (initialized to false every work())
|
||||||
// false every work())
|
d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P)
|
||||||
d_preamble_index =
|
|
||||||
d_sample_counter; // record the preamble sample stamp (t_P)
|
|
||||||
if (!d_flag_frame_sync)
|
if (!d_flag_frame_sync)
|
||||||
{
|
{
|
||||||
d_flag_frame_sync = true;
|
d_flag_frame_sync = true;
|
||||||
@ -595,8 +574,8 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
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)
|
if (d_CRC_error_counter > CRC_ERROR_LIMIT)
|
||||||
{
|
{
|
||||||
LOG(INFO) << "BeiDou DNAV frame sync lost for SAT "
|
DLOG(INFO) << "BeiDou DNAV frame sync lost for SAT "
|
||||||
<< this->d_satellite;
|
<< this->d_satellite;
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
flag_SOW_set = false;
|
flag_SOW_set = false;
|
||||||
@ -604,7 +583,6 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UPDATE GNSS SYNCHRO DATA
|
// 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)
|
if (this->d_flag_preamble == true and d_nav.flag_new_SOW_available == true)
|
||||||
@ -612,55 +590,67 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
|||||||
{
|
{
|
||||||
// Reporting sow as gps time of week
|
// Reporting sow as gps time of week
|
||||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.d_SOW + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
||||||
d_TOW_at_current_symbol_ms =
|
//check TOW update consistency
|
||||||
d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) *
|
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||||
BEIDOU_B3I_CODE_PERIOD_MS);
|
//compute new TOW
|
||||||
|
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
|
||||||
flag_SOW_set = true;
|
flag_SOW_set = true;
|
||||||
d_nav.flag_new_SOW_available = false;
|
d_nav.flag_new_SOW_available = false;
|
||||||
}
|
|
||||||
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_B3I_CODE_PERIOD_MS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d_flag_frame_sync == true and flag_SOW_set == true)
|
if (last_d_TOW_at_current_symbol_ms != 0 and abs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms)) > d_symbol_duration_ms)
|
||||||
{
|
{
|
||||||
current_symbol.Flag_valid_word = true;
|
LOG(INFO) << "Warning: BEIDOU B3I TOW update in ch " << d_channel
|
||||||
|
<< " does not match the TLM TOW counter " << static_cast<int64_t>(d_TOW_at_current_symbol_ms) - int64_t(last_d_TOW_at_current_symbol_ms) << " ms \n";
|
||||||
|
|
||||||
|
d_TOW_at_current_symbol_ms = 0;
|
||||||
|
d_flag_valid_word = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_last_valid_preamble = d_sample_counter;
|
||||||
|
d_flag_valid_word = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
current_symbol.Flag_valid_word = false;
|
if (d_flag_valid_word)
|
||||||
|
{
|
||||||
|
d_TOW_at_current_symbol_ms += d_symbol_duration_ms;
|
||||||
|
if (current_symbol.Flag_valid_symbol_output == false)
|
||||||
|
{
|
||||||
|
d_flag_valid_word = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
current_symbol.PRN = this->d_satellite.get_PRN();
|
if (d_flag_valid_word == true)
|
||||||
current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
|
||||||
|
|
||||||
if (d_dump == true)
|
|
||||||
{
|
{
|
||||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||||
try
|
current_symbol.Flag_valid_word = d_flag_valid_word;
|
||||||
|
|
||||||
|
if (d_dump == true)
|
||||||
{
|
{
|
||||||
double tmp_double;
|
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||||
uint64_t tmp_ulong_int;
|
try
|
||||||
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms);
|
{
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
double tmp_double;
|
||||||
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
uint64_t tmp_ulong_int;
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
tmp_double = static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0;
|
||||||
tmp_double = d_nav.d_SOW;
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
tmp_ulong_int = current_symbol.Tracking_sample_counter;
|
||||||
tmp_ulong_int = static_cast<uint64_t>(d_required_symbols);
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
||||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_ulong_int), sizeof(uint64_t));
|
tmp_double = static_cast<double>(d_TOW_at_Preamble_ms) / 1000.0;
|
||||||
}
|
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||||
catch (const std::ifstream::failure &e)
|
}
|
||||||
{
|
catch (const std::ifstream::failure &e)
|
||||||
LOG(WARNING) << "Exception writing observables dump file " << e.what();
|
{
|
||||||
|
LOG(WARNING) << "Exception writing Telemetry GPS L5 dump file " << e.what();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
|
||||||
|
*out[0] = current_symbol;
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
|
|
||||||
*out[0] = current_symbol;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
@ -60,10 +60,8 @@ public:
|
|||||||
~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor
|
~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int channel); //!< Set receiver's channel
|
||||||
inline void reset()
|
void reset();
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
*/
|
*/
|
||||||
@ -77,27 +75,24 @@ private:
|
|||||||
bool dump);
|
bool dump);
|
||||||
beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
beidou_b3i_telemetry_decoder_gs(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
void decode_subframe(double *symbols);
|
void decode_subframe(float *symbols);
|
||||||
void decode_word(int32_t word_counter, const double *enc_word_symbols,
|
void decode_word(int32_t word_counter, const float *enc_word_symbols,
|
||||||
int32_t *dec_word_symbols);
|
int32_t *dec_word_symbols);
|
||||||
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
|
void decode_bch15_11_01(const int32_t *bits, int32_t *decbits);
|
||||||
|
|
||||||
// Preamble decoding
|
// Preamble decoding
|
||||||
int32_t *d_preamble_samples;
|
int32_t *d_preamble_samples;
|
||||||
int32_t *d_secondary_code_symbols;
|
|
||||||
uint32_t d_samples_per_symbol;
|
|
||||||
int32_t d_symbols_per_preamble;
|
int32_t d_symbols_per_preamble;
|
||||||
int32_t d_samples_per_preamble;
|
int32_t d_samples_per_preamble;
|
||||||
int32_t d_preamble_period_samples;
|
int32_t d_preamble_period_samples;
|
||||||
double *d_subframe_symbols;
|
float *d_subframe_symbols;
|
||||||
uint32_t d_required_symbols;
|
uint32_t d_required_symbols;
|
||||||
|
|
||||||
// Storage for incoming data
|
// Storage for incoming data
|
||||||
boost::circular_buffer<float> d_symbol_history;
|
boost::circular_buffer<float> d_symbol_history;
|
||||||
|
|
||||||
// Variables for internal functionality
|
// Variables for internal functionality
|
||||||
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc)
|
uint64_t d_sample_counter; // Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||||
// indicating number of samples processed
|
|
||||||
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
uint64_t d_preamble_index; // Index of sample number where preamble was found
|
||||||
uint32_t d_stat; // Status of decoder
|
uint32_t d_stat; // Status of decoder
|
||||||
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
bool d_flag_frame_sync; // Indicate when a frame sync is achieved
|
||||||
@ -109,8 +104,12 @@ private:
|
|||||||
Beidou_Dnav_Navigation_Message d_nav;
|
Beidou_Dnav_Navigation_Message d_nav;
|
||||||
|
|
||||||
// Values to populate gnss synchronization structure
|
// Values to populate gnss synchronization structure
|
||||||
|
uint32_t d_symbol_duration_ms;
|
||||||
uint32_t d_TOW_at_Preamble_ms;
|
uint32_t d_TOW_at_Preamble_ms;
|
||||||
uint32_t d_TOW_at_current_symbol_ms;
|
uint32_t d_TOW_at_current_symbol_ms;
|
||||||
|
uint64_t d_last_valid_preamble;
|
||||||
|
bool d_flag_valid_word;
|
||||||
|
bool d_sent_tlm_failed_msg;
|
||||||
bool Flag_valid_word;
|
bool Flag_valid_word;
|
||||||
|
|
||||||
// Satellite Information and logging capacity
|
// Satellite Information and logging capacity
|
||||||
|
@ -286,17 +286,16 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
|
|||||||
d_code_period = BEIDOU_B1I_CODE_PERIOD;
|
d_code_period = BEIDOU_B1I_CODE_PERIOD;
|
||||||
d_code_chip_rate = BEIDOU_B1I_CODE_RATE_HZ;
|
d_code_chip_rate = BEIDOU_B1I_CODE_RATE_HZ;
|
||||||
d_code_length_chips = static_cast<uint32_t>(BEIDOU_B1I_CODE_LENGTH_CHIPS);
|
d_code_length_chips = static_cast<uint32_t>(BEIDOU_B1I_CODE_LENGTH_CHIPS);
|
||||||
//d_symbols_per_bit = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
d_symbols_per_bit = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
||||||
d_symbols_per_bit = 1;
|
|
||||||
d_correlation_length_ms = 1;
|
d_correlation_length_ms = 1;
|
||||||
d_code_samples_per_chip = 1;
|
d_code_samples_per_chip = 1;
|
||||||
d_secondary = false;
|
d_secondary = true;
|
||||||
trk_parameters.track_pilot = false;
|
trk_parameters.track_pilot = false;
|
||||||
// synchronize and remove data secondary code
|
// synchronize and remove data secondary code
|
||||||
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
|
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
|
||||||
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
|
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
|
||||||
//d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
|
d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
|
||||||
//d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
|
d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
|
||||||
}
|
}
|
||||||
else if (signal_type == "B3")
|
else if (signal_type == "B3")
|
||||||
{
|
{
|
||||||
@ -305,16 +304,15 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
|
|||||||
d_code_period = BEIDOU_B3I_CODE_PERIOD;
|
d_code_period = BEIDOU_B3I_CODE_PERIOD;
|
||||||
d_code_chip_rate = BEIDOU_B3I_CODE_RATE_HZ;
|
d_code_chip_rate = BEIDOU_B3I_CODE_RATE_HZ;
|
||||||
d_code_length_chips = static_cast<uint32_t>(BEIDOU_B3I_CODE_LENGTH_CHIPS);
|
d_code_length_chips = static_cast<uint32_t>(BEIDOU_B3I_CODE_LENGTH_CHIPS);
|
||||||
//d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
||||||
d_symbols_per_bit = 1;
|
|
||||||
d_correlation_length_ms = 1;
|
d_correlation_length_ms = 1;
|
||||||
d_code_samples_per_chip = 1;
|
d_code_samples_per_chip = 1;
|
||||||
d_secondary = false;
|
d_secondary = false;
|
||||||
trk_parameters.track_pilot = false;
|
trk_parameters.track_pilot = false;
|
||||||
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
|
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
|
||||||
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
|
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
|
||||||
//d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
|
d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
|
||||||
//d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
|
d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -651,8 +649,7 @@ void dll_pll_veml_tracking::start_tracking()
|
|||||||
// GEO Satellites use different secondary code
|
// GEO Satellites use different secondary code
|
||||||
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
|
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
|
||||||
{
|
{
|
||||||
//d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT;//todo: enable after fixing beidou symbol synchronization
|
d_symbols_per_bit = BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
||||||
d_symbols_per_bit = 1;
|
|
||||||
d_correlation_length_ms = 1;
|
d_correlation_length_ms = 1;
|
||||||
d_code_samples_per_chip = 1;
|
d_code_samples_per_chip = 1;
|
||||||
d_secondary = false;
|
d_secondary = false;
|
||||||
@ -665,8 +662,7 @@ void dll_pll_veml_tracking::start_tracking()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//d_symbols_per_bit = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT;//todo: enable after fixing beidou symbol synchronization
|
d_symbols_per_bit = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
||||||
d_symbols_per_bit = 1;
|
|
||||||
d_correlation_length_ms = 1;
|
d_correlation_length_ms = 1;
|
||||||
d_code_samples_per_chip = 1;
|
d_code_samples_per_chip = 1;
|
||||||
d_secondary = false;
|
d_secondary = false;
|
||||||
@ -674,8 +670,8 @@ void dll_pll_veml_tracking::start_tracking()
|
|||||||
// synchronize and remove data secondary code
|
// synchronize and remove data secondary code
|
||||||
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
|
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
|
||||||
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
|
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
|
||||||
//d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
|
d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B1I_SECONDARY_CODE_LENGTH);
|
||||||
//d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
|
d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B1I_SECONDARY_CODE_STR);
|
||||||
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
|
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,11 +682,10 @@ void dll_pll_veml_tracking::start_tracking()
|
|||||||
// Update secondary code settings for geo satellites
|
// Update secondary code settings for geo satellites
|
||||||
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
|
if (d_acquisition_gnss_synchro->PRN > 0 and d_acquisition_gnss_synchro->PRN < 6)
|
||||||
{
|
{
|
||||||
//d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT;//todo: enable after fixing beidou symbol synchronization
|
d_symbols_per_bit = BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
||||||
d_symbols_per_bit = 1;
|
|
||||||
d_correlation_length_ms = 1;
|
d_correlation_length_ms = 1;
|
||||||
d_code_samples_per_chip = 1;
|
d_code_samples_per_chip = 1;
|
||||||
d_secondary = false;
|
d_secondary = true;
|
||||||
trk_parameters.track_pilot = false;
|
trk_parameters.track_pilot = false;
|
||||||
// set the preamble in the secondary code acquisition
|
// set the preamble in the secondary code acquisition
|
||||||
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_GEO_PREAMBLE_LENGTH_SYMBOLS);
|
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_GEO_PREAMBLE_LENGTH_SYMBOLS);
|
||||||
@ -700,17 +695,16 @@ void dll_pll_veml_tracking::start_tracking()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
d_symbols_per_bit = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //todo: enable after fixing beidou symbol synchronization
|
||||||
d_symbols_per_bit = 1;
|
|
||||||
d_correlation_length_ms = 1;
|
d_correlation_length_ms = 1;
|
||||||
d_code_samples_per_chip = 1;
|
d_code_samples_per_chip = 1;
|
||||||
d_secondary = false;
|
d_secondary = true;
|
||||||
trk_parameters.track_pilot = false;
|
trk_parameters.track_pilot = false;
|
||||||
// synchronize and remove data secondary code
|
// synchronize and remove data secondary code
|
||||||
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
|
d_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
|
||||||
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
|
d_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
|
||||||
//d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
|
d_data_secondary_code_length = static_cast<uint32_t>(BEIDOU_B3I_SECONDARY_CODE_LENGTH);
|
||||||
//d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
|
d_data_secondary_code_string = const_cast<std::string *>(&BEIDOU_B3I_SECONDARY_CODE_STR);
|
||||||
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
|
d_Prompt_circular_buffer.set_capacity(d_secondary_code_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,22 +42,20 @@ const double BEIDOU_B1I_CODE_RATE_HZ = 2.046e6; //!< Beidou B1I code rate [
|
|||||||
const double BEIDOU_B1I_CODE_LENGTH_CHIPS = 2046.0; //!< Beidou B1I code length [chips]
|
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 double BEIDOU_B1I_CODE_PERIOD = 0.001; //!< Beidou B1I code period [seconds]
|
||||||
const uint32_t BEIDOU_B1I_CODE_PERIOD_MS = 1; //!< Beidou B1I code period [ms]
|
const uint32_t BEIDOU_B1I_CODE_PERIOD_MS = 1; //!< Beidou B1I code period [ms]
|
||||||
const double BEIDOU_B1I_CHIP_PERIOD = 4.8875e-07; //!< Beidou B1I chip period [seconds]
|
|
||||||
const int32_t BEIDOU_B1I_SECONDARY_CODE_LENGTH = 20;
|
const int32_t BEIDOU_B1I_SECONDARY_CODE_LENGTH = 20;
|
||||||
const std::string BEIDOU_B1I_SECONDARY_CODE_STR = "00000100110101001110";
|
const std::string BEIDOU_B1I_SECONDARY_CODE_STR = "00000100110101001110";
|
||||||
const std::string BEIDOU_B1I_GEO_PREAMBLE_SYMBOLS_STR = {"1111110000001100001100"};
|
const std::string BEIDOU_B1I_GEO_PREAMBLE_SYMBOLS_STR = {"1111110000001100001100"};
|
||||||
const int32_t BEIDOU_B1I_GEO_PREAMBLE_LENGTH_SYMBOLS = 22;
|
const int32_t BEIDOU_B1I_GEO_PREAMBLE_LENGTH_SYMBOLS = 22;
|
||||||
|
|
||||||
const std::string BEIDOU_B1I_D2_SECONDARY_CODE_STR = "00";
|
const std::string BEIDOU_B1I_D2_SECONDARY_CODE_STR = "00";
|
||||||
const int BEIDOU_B1I_PREAMBLE_LENGTH_BITS = 11;
|
const uint32_t BEIDOU_B1I_PREAMBLE_LENGTH_BITS = 11;
|
||||||
const int BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS = 220;
|
const uint32_t BEIDOU_B1I_PREAMBLE_LENGTH_SYMBOLS = 220;
|
||||||
const double BEIDOU_B1I_PREAMBLE_DURATION_S = 0.220;
|
const double BEIDOU_B1I_PREAMBLE_DURATION_S = 0.220;
|
||||||
const int BEIDOU_B1I_PREAMBLE_DURATION_MS = 220;
|
const int32_t BEIDOU_B1I_PREAMBLE_DURATION_MS = 220;
|
||||||
const int BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND = 50;
|
const int32_t BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND = 50;
|
||||||
const int BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT = 20;
|
const int32_t BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT = 20;
|
||||||
const int BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2;
|
const int32_t BEIDOU_B1I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2;
|
||||||
const int BEIDOU_B1I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
|
const int32_t BEIDOU_B1I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B1I_CODE_PERIOD_MS;
|
||||||
const int BEIDOU_B1I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT;
|
const int32_t BEIDOU_B1I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B1I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B1I_TELEMETRY_SYMBOLS_PER_BIT;
|
||||||
|
|
||||||
|
|
||||||
#endif /* GNSS_SDR_BEIDOU_B1I_H_ */
|
#endif /* GNSS_SDR_BEIDOU_B1I_H_ */
|
||||||
|
@ -52,7 +52,9 @@ const double BEIDOU_B3I_PREAMBLE_DURATION_S = 0.220;
|
|||||||
const int32_t BEIDOU_B3I_PREAMBLE_DURATION_MS = 220;
|
const int32_t BEIDOU_B3I_PREAMBLE_DURATION_MS = 220;
|
||||||
const int32_t BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s]
|
const int32_t BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND = 50; //!< D1 NAV message bit rate [bits/s]
|
||||||
const int32_t BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT = 20;
|
const int32_t BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT = 20;
|
||||||
const int32_t BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2; // *************
|
const int32_t BEIDOU_B3I_GEO_TELEMETRY_SYMBOLS_PER_BIT = 2; // *************
|
||||||
const int32_t BEIDOU_B3I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT; //************!< NAV message bit rate [symbols/s]
|
const int32_t BEIDOU_B3I_TELEMETRY_SYMBOL_PERIOD_MS = BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT * BEIDOU_B3I_CODE_PERIOD_MS;
|
||||||
|
const int32_t BEIDOU_B3I_TELEMETRY_RATE_SYMBOLS_SECOND = BEIDOU_B3I_TELEMETRY_RATE_BITS_SECOND * BEIDOU_B3I_TELEMETRY_SYMBOLS_PER_BIT;
|
||||||
|
|
||||||
|
|
||||||
#endif /* GNSS_SDR_BEIDOU_B3I_H_ */
|
#endif /* GNSS_SDR_BEIDOU_B3I_H_ */
|
||||||
|
@ -36,15 +36,19 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
const double BEIDOU_DNAV_C_M_S = 299792458.0; //!< The speed of light, [m/s]
|
const double BEIDOU_DNAV_C_M_S = 299792458.0; //!< The speed of light, [m/s]
|
||||||
const double BEIDOU_DNAV_C_M_MS = 299792.4580; //!< The speed of light, [m/ms]
|
const double BEIDOU_DNAV_C_M_MS = 299792.4580; //!< The speed of light, [m/ms]
|
||||||
const double BEIDOU_DNAV_PI = 3.1415926535898; //!< Pi
|
const double BEIDOU_DNAV_PI = 3.1415926535898; //!< BeiDou DNAV Pi
|
||||||
const double BEIDOU_DNAV_TWO_PI = 6.283185307179586; //!< 2Pi
|
const double BEIDOU_DNAV_TWO_PI = 6.2831853071796; //!< BeiDou DNAV 2Pi
|
||||||
|
const double BEIDOU_DNAV_OMEGA_EARTH_DOT = 7.2921150e-5; //!< Earth rotation rate, [rad/s] as defined in CGCS2000
|
||||||
|
const double BEIDOU_DNAV_GM = 3.986004418e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2] as defined in CGCS2000
|
||||||
|
const double BEIDOU_DNAV_F = -4.442807309e-10; //!< Constant, [s/(m)^(1/2)] F=-2(GM)^.5/C^2
|
||||||
|
|
||||||
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11;
|
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_BITS = 11;
|
||||||
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // **************
|
const int32_t BEIDOU_DNAV_PREAMBLE_LENGTH_SYMBOLS = 11; // **************
|
||||||
const double BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300;
|
const double BEIDOU_DNAV_PREAMBLE_PERIOD_SYMBOLS = 300;
|
||||||
const double BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300;
|
const double BEIDOU_DNAV_SUBFRAME_SYMBOLS = 300;
|
||||||
const double BEIDOU_DNAV_DATA_BITS = 300;
|
const int32_t BEIDOU_DNAV_SUBFRAME_DATA_BITS = 300; //!< Number of bits per subframe in the NAV message [bits]
|
||||||
const double BEIDOU_DNAV_WORDS_SUBFRAME = 10;
|
const double BEIDOU_DNAV_WORDS_SUBFRAME = 10;
|
||||||
const double BEIDOU_DNAV_WORD_LENGTH_BITS = 30;
|
const double BEIDOU_DNAV_WORD_LENGTH_BITS = 30;
|
||||||
const double BEIDOU_D1NAV_SYMBOL_RATE_SPS = 50;
|
const double BEIDOU_D1NAV_SYMBOL_RATE_SPS = 50;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "beidou_dnav_ephemeris.h"
|
#include "beidou_dnav_ephemeris.h"
|
||||||
#include "Beidou_B1I.h"
|
#include "Beidou_DNAV.h"
|
||||||
#include "gnss_satellite.h"
|
#include "gnss_satellite.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
@ -148,14 +148,14 @@ double Beidou_Dnav_Ephemeris::sv_clock_relativistic_term(double transmitTime)
|
|||||||
tk = check_t(transmitTime - d_Toe);
|
tk = check_t(transmitTime - d_Toe);
|
||||||
|
|
||||||
// Computed mean motion
|
// Computed mean motion
|
||||||
n0 = sqrt(BEIDOU_GM / (a * a * a));
|
n0 = sqrt(BEIDOU_DNAV_GM / (a * a * a));
|
||||||
// Corrected mean motion
|
// Corrected mean motion
|
||||||
n = n0 + d_Delta_n;
|
n = n0 + d_Delta_n;
|
||||||
// Mean anomaly
|
// Mean anomaly
|
||||||
M = d_M_0 + n * tk;
|
M = d_M_0 + n * tk;
|
||||||
|
|
||||||
// Reduce mean anomaly to between 0 and 2pi
|
// Reduce mean anomaly to between 0 and 2pi
|
||||||
M = fmod((M + 2.0 * BEIDOU_PI), (2.0 * BEIDOU_PI));
|
M = fmod((M + 2.0 * BEIDOU_DNAV_PI), (2.0 * BEIDOU_DNAV_PI));
|
||||||
|
|
||||||
// Initial guess of eccentric anomaly
|
// Initial guess of eccentric anomaly
|
||||||
E = M;
|
E = M;
|
||||||
@ -165,7 +165,7 @@ double Beidou_Dnav_Ephemeris::sv_clock_relativistic_term(double transmitTime)
|
|||||||
{
|
{
|
||||||
E_old = E;
|
E_old = E;
|
||||||
E = M + d_eccentricity * sin(E);
|
E = M + d_eccentricity * sin(E);
|
||||||
dE = fmod(E - E_old, 2.0 * BEIDOU_PI);
|
dE = fmod(E - E_old, 2.0 * BEIDOU_DNAV_PI);
|
||||||
if (fabs(dE) < 1e-12)
|
if (fabs(dE) < 1e-12)
|
||||||
{
|
{
|
||||||
//Necessary precision is reached, exit from the loop
|
//Necessary precision is reached, exit from the loop
|
||||||
@ -174,7 +174,7 @@ double Beidou_Dnav_Ephemeris::sv_clock_relativistic_term(double transmitTime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute relativistic correction term
|
// Compute relativistic correction term
|
||||||
d_dtr = BEIDOU_F * d_eccentricity * d_sqrt_A * sin(E);
|
d_dtr = BEIDOU_DNAV_F * d_eccentricity * d_sqrt_A * sin(E);
|
||||||
return d_dtr;
|
return d_dtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ double Beidou_Dnav_Ephemeris::satellitePosition(double transmitTime)
|
|||||||
tk = check_t(transmitTime - d_Toe);
|
tk = check_t(transmitTime - d_Toe);
|
||||||
|
|
||||||
// Computed mean motion
|
// Computed mean motion
|
||||||
n0 = sqrt(BEIDOU_GM / (a * a * a));
|
n0 = sqrt(BEIDOU_DNAV_GM / (a * a * a));
|
||||||
|
|
||||||
// Corrected mean motion
|
// Corrected mean motion
|
||||||
n = n0 + d_Delta_n;
|
n = n0 + d_Delta_n;
|
||||||
@ -214,7 +214,7 @@ double Beidou_Dnav_Ephemeris::satellitePosition(double transmitTime)
|
|||||||
M = d_M_0 + n * tk;
|
M = d_M_0 + n * tk;
|
||||||
|
|
||||||
// Reduce mean anomaly to between 0 and 2pi
|
// Reduce mean anomaly to between 0 and 2pi
|
||||||
M = fmod((M + 2.0 * BEIDOU_PI), (2.0 * BEIDOU_PI));
|
M = fmod((M + 2.0 * BEIDOU_DNAV_PI), (2.0 * BEIDOU_DNAV_PI));
|
||||||
|
|
||||||
// Initial guess of eccentric anomaly
|
// Initial guess of eccentric anomaly
|
||||||
E = M;
|
E = M;
|
||||||
@ -224,7 +224,7 @@ double Beidou_Dnav_Ephemeris::satellitePosition(double transmitTime)
|
|||||||
{
|
{
|
||||||
E_old = E;
|
E_old = E;
|
||||||
E = M + d_eccentricity * sin(E);
|
E = M + d_eccentricity * sin(E);
|
||||||
dE = fmod(E - E_old, 2.0 * BEIDOU_PI);
|
dE = fmod(E - E_old, 2.0 * BEIDOU_DNAV_PI);
|
||||||
if (fabs(dE) < 1e-12)
|
if (fabs(dE) < 1e-12)
|
||||||
{
|
{
|
||||||
//Necessary precision is reached, exit from the loop
|
//Necessary precision is reached, exit from the loop
|
||||||
@ -241,7 +241,7 @@ double Beidou_Dnav_Ephemeris::satellitePosition(double transmitTime)
|
|||||||
phi = nu + d_OMEGA;
|
phi = nu + d_OMEGA;
|
||||||
|
|
||||||
// Reduce phi to between 0 and 2*pi rad
|
// Reduce phi to between 0 and 2*pi rad
|
||||||
phi = fmod((phi), (2.0 * BEIDOU_PI));
|
phi = fmod((phi), (2.0 * BEIDOU_DNAV_PI));
|
||||||
|
|
||||||
// Correct argument of latitude
|
// Correct argument of latitude
|
||||||
u = phi + d_Cuc * cos(2.0 * phi) + d_Cus * sin(2.0 * phi);
|
u = phi + d_Cuc * cos(2.0 * phi) + d_Cus * sin(2.0 * phi);
|
||||||
@ -253,10 +253,10 @@ double Beidou_Dnav_Ephemeris::satellitePosition(double transmitTime)
|
|||||||
i = d_i_0 + d_IDOT * tk + d_Cic * cos(2.0 * phi) + d_Cis * sin(2.0 * phi);
|
i = d_i_0 + d_IDOT * tk + d_Cic * cos(2.0 * phi) + d_Cis * sin(2.0 * phi);
|
||||||
|
|
||||||
// Compute the angle between the ascending node and the Greenwich meridian
|
// Compute the angle between the ascending node and the Greenwich meridian
|
||||||
Omega = d_OMEGA0 + (d_OMEGA_DOT - BEIDOU_OMEGA_EARTH_DOT) * tk - BEIDOU_OMEGA_EARTH_DOT * d_Toe;
|
Omega = d_OMEGA0 + (d_OMEGA_DOT - BEIDOU_DNAV_OMEGA_EARTH_DOT) * tk - BEIDOU_DNAV_OMEGA_EARTH_DOT * d_Toe;
|
||||||
|
|
||||||
// Reduce to between 0 and 2*pi rad
|
// Reduce to between 0 and 2*pi rad
|
||||||
Omega = fmod((Omega + 2.0 * BEIDOU_PI), (2.0 * BEIDOU_PI));
|
Omega = fmod((Omega + 2.0 * BEIDOU_DNAV_PI), (2.0 * BEIDOU_DNAV_PI));
|
||||||
|
|
||||||
// --- Compute satellite coordinates in Earth-fixed coordinates
|
// --- Compute satellite coordinates in Earth-fixed coordinates
|
||||||
d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega);
|
d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega);
|
||||||
@ -264,7 +264,7 @@ double Beidou_Dnav_Ephemeris::satellitePosition(double transmitTime)
|
|||||||
d_satpos_Z = sin(u) * r * sin(i);
|
d_satpos_Z = sin(u) * r * sin(i);
|
||||||
|
|
||||||
// Satellite's velocity. Can be useful for Vector Tracking loops
|
// Satellite's velocity. Can be useful for Vector Tracking loops
|
||||||
double Omega_dot = d_OMEGA_DOT - BEIDOU_OMEGA_EARTH_DOT;
|
double Omega_dot = d_OMEGA_DOT - BEIDOU_DNAV_OMEGA_EARTH_DOT;
|
||||||
d_satvel_X = -Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega);
|
d_satvel_X = -Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega);
|
||||||
d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega);
|
d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega);
|
||||||
d_satvel_Z = d_satpos_Y * sin(i);
|
d_satvel_Z = d_satpos_Y * sin(i);
|
||||||
@ -275,7 +275,7 @@ double Beidou_Dnav_Ephemeris::satellitePosition(double transmitTime)
|
|||||||
double dtr_s = d_A_f0 + d_A_f1 * tk + d_A_f2 * tk * tk;
|
double dtr_s = d_A_f0 + d_A_f1 * tk + d_A_f2 * tk * tk;
|
||||||
|
|
||||||
/* relativity correction */
|
/* relativity correction */
|
||||||
dtr_s -= 2.0 * sqrt(BEIDOU_GM * a) * d_eccentricity * sin(E) / (BEIDOU_C_M_S * BEIDOU_C_M_S);
|
dtr_s -= 2.0 * sqrt(BEIDOU_DNAV_GM * a) * d_eccentricity * sin(E) / (BEIDOU_DNAV_C_M_S * BEIDOU_DNAV_C_M_S);
|
||||||
|
|
||||||
return dtr_s;
|
return dtr_s;
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
tk = check_t(transmitTime - d_Toe_sf2);
|
tk = check_t(transmitTime - d_Toe_sf2);
|
||||||
|
|
||||||
// Computed mean motion
|
// Computed mean motion
|
||||||
n0 = sqrt(BEIDOU_GM / (a * a * a));
|
n0 = sqrt(BEIDOU_DNAV_GM / (a * a * a));
|
||||||
|
|
||||||
// Corrected mean motion
|
// Corrected mean motion
|
||||||
n = n0 + d_Delta_n;
|
n = n0 + d_Delta_n;
|
||||||
@ -391,7 +391,7 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
M = d_M_0 + n * tk;
|
M = d_M_0 + n * tk;
|
||||||
|
|
||||||
// Reduce mean anomaly to between 0 and 2pi
|
// Reduce mean anomaly to between 0 and 2pi
|
||||||
M = fmod((M + 2 * BEIDOU_PI), (2 * BEIDOU_PI));
|
M = fmod((M + 2 * BEIDOU_DNAV_PI), (2 * BEIDOU_DNAV_PI));
|
||||||
|
|
||||||
// Initial guess of eccentric anomaly
|
// Initial guess of eccentric anomaly
|
||||||
E = M;
|
E = M;
|
||||||
@ -401,7 +401,7 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
{
|
{
|
||||||
E_old = E;
|
E_old = E;
|
||||||
E = M + d_eccentricity * sin(E);
|
E = M + d_eccentricity * sin(E);
|
||||||
dE = fmod(E - E_old, 2 * BEIDOU_PI);
|
dE = fmod(E - E_old, 2 * BEIDOU_DNAV_PI);
|
||||||
if (fabs(dE) < 1e-12)
|
if (fabs(dE) < 1e-12)
|
||||||
{
|
{
|
||||||
//Necessary precision is reached, exit from the loop
|
//Necessary precision is reached, exit from the loop
|
||||||
@ -410,7 +410,7 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Compute relativistic correction term
|
// Compute relativistic correction term
|
||||||
d_dtr = BEIDOU_F * d_eccentricity * d_sqrt_A * sin(E);
|
d_dtr = BEIDOU_DNAV_F * d_eccentricity * d_sqrt_A * sin(E);
|
||||||
|
|
||||||
// Compute the true anomaly
|
// Compute the true anomaly
|
||||||
double tmp_Y = sqrt(1.0 - d_eccentricity * d_eccentricity) * sin(E);
|
double tmp_Y = sqrt(1.0 - d_eccentricity * d_eccentricity) * sin(E);
|
||||||
@ -421,7 +421,7 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
phi = nu + d_OMEGA;
|
phi = nu + d_OMEGA;
|
||||||
|
|
||||||
// Reduce phi to between 0 and 2*pi rad
|
// Reduce phi to between 0 and 2*pi rad
|
||||||
phi = fmod((phi), (2 * BEIDOU_PI));
|
phi = fmod((phi), (2 * BEIDOU_DNAV_PI));
|
||||||
|
|
||||||
// Correct argument of latitude
|
// Correct argument of latitude
|
||||||
u = phi + d_Cuc * cos(2 * phi) + d_Cus * sin(2 * phi);
|
u = phi + d_Cuc * cos(2 * phi) + d_Cus * sin(2 * phi);
|
||||||
@ -433,10 +433,10 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
i = d_i_0 + d_IDOT * tk + d_Cic * cos(2 * phi) + d_Cis * sin(2 * phi);
|
i = d_i_0 + d_IDOT * tk + d_Cic * cos(2 * phi) + d_Cis * sin(2 * phi);
|
||||||
|
|
||||||
// Compute the angle between the ascending node and the Greenwich meridian
|
// Compute the angle between the ascending node and the Greenwich meridian
|
||||||
Omega = d_OMEGA0 + (d_OMEGA_DOT - BEIDOU_OMEGA_EARTH_DOT) * tk - BEIDOU_OMEGA_EARTH_DOT * d_Toe_sf2;
|
Omega = d_OMEGA0 + (d_OMEGA_DOT - BEIDOU_DNAV_OMEGA_EARTH_DOT) * tk - BEIDOU_DNAV_OMEGA_EARTH_DOT * d_Toe_sf2;
|
||||||
|
|
||||||
// Reduce to between 0 and 2*pi rad
|
// Reduce to between 0 and 2*pi rad
|
||||||
Omega = fmod((Omega + 2 * BEIDOU_PI), (2 * BEIDOU_PI));
|
Omega = fmod((Omega + 2 * BEIDOU_DNAV_PI), (2 * BEIDOU_DNAV_PI));
|
||||||
|
|
||||||
// --- Compute satellite coordinates in Earth-fixed coordinates
|
// --- Compute satellite coordinates in Earth-fixed coordinates
|
||||||
d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega);
|
d_satpos_X = cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega);
|
||||||
@ -444,7 +444,7 @@ void Beidou_Dnav_Navigation_Message::satellitePosition(double transmitTime)
|
|||||||
d_satpos_Z = sin(u) * r * sin(i);
|
d_satpos_Z = sin(u) * r * sin(i);
|
||||||
|
|
||||||
// Satellite's velocity. Can be useful for Vector Tracking loops
|
// Satellite's velocity. Can be useful for Vector Tracking loops
|
||||||
double Omega_dot = d_OMEGA_DOT - BEIDOU_OMEGA_EARTH_DOT;
|
double Omega_dot = d_OMEGA_DOT - BEIDOU_DNAV_OMEGA_EARTH_DOT;
|
||||||
d_satvel_X = -Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega);
|
d_satvel_X = -Omega_dot * (cos(u) * r + sin(u) * r * cos(i)) + d_satpos_X * cos(Omega) - d_satpos_Y * cos(i) * sin(Omega);
|
||||||
d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega);
|
d_satvel_Y = Omega_dot * (cos(u) * r * cos(Omega) - sin(u) * r * cos(i) * sin(Omega)) + d_satpos_X * sin(Omega) + d_satpos_Y * cos(i) * cos(Omega);
|
||||||
d_satvel_Z = d_satpos_Y * sin(i);
|
d_satvel_Z = d_satpos_Y * sin(i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user