mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-08-05 05:13:48 +00:00
Release candidate of the GPS L1 C/A telemetry decoder supporting variable tracking correlation length
This commit is contained in:
parent
083350bd61
commit
500dc59516
@ -244,14 +244,14 @@ Tracking_1C.dump_filename=../data/epl_tracking_ch_
|
|||||||
;# Valid values are: [1,2,4,5,10,20] (integer divisors of the GPS L1 CA bit period (20 ms) )
|
;# Valid values are: [1,2,4,5,10,20] (integer divisors of the GPS L1 CA bit period (20 ms) )
|
||||||
;# Longer integration period require more stable front-end LO
|
;# Longer integration period require more stable front-end LO
|
||||||
|
|
||||||
Tracking_1C.extend_correlation_ms=5
|
Tracking_1C.extend_correlation_ms=10
|
||||||
|
|
||||||
;#pll_bw_hz: PLL loop filter bandwidth [Hz]
|
;#pll_bw_hz: PLL loop filter bandwidth [Hz]
|
||||||
Tracking_1C.pll_bw_hz=20;
|
Tracking_1C.pll_bw_hz=40;
|
||||||
Tracking_1C.pll_bw_narrow_hz=10;
|
Tracking_1C.pll_bw_narrow_hz=25;
|
||||||
|
|
||||||
;#dll_bw_hz: DLL loop filter bandwidth [Hz]
|
;#dll_bw_hz: DLL loop filter bandwidth [Hz]
|
||||||
Tracking_1C.dll_bw_hz=3.0;
|
Tracking_1C.dll_bw_hz=2.0;
|
||||||
|
|
||||||
Tracking_1C.dll_bw_narrow_hz=2.0;
|
Tracking_1C.dll_bw_narrow_hz=2.0;
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ Tracking_1C.item_type=gr_complex
|
|||||||
Tracking_1C.if=0
|
Tracking_1C.if=0
|
||||||
|
|
||||||
;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false]
|
;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false]
|
||||||
Tracking_1C.dump=true
|
Tracking_1C.dump=false
|
||||||
|
|
||||||
;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number.
|
;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number.
|
||||||
Tracking_1C.dump_filename=../data/epl_tracking_ch_
|
Tracking_1C.dump_filename=../data/epl_tracking_ch_
|
||||||
@ -251,7 +251,7 @@ Tracking_1C.extend_correlation_ms=1
|
|||||||
|
|
||||||
;#pll_bw_hz: PLL loop filter bandwidth [Hz]
|
;#pll_bw_hz: PLL loop filter bandwidth [Hz]
|
||||||
Tracking_1C.pll_bw_hz=40;
|
Tracking_1C.pll_bw_hz=40;
|
||||||
Tracking_1C.pll_bw_narrow_hz=20;
|
Tracking_1C.pll_bw_narrow_hz=40;
|
||||||
|
|
||||||
;#dll_bw_hz: DLL loop filter bandwidth [Hz]
|
;#dll_bw_hz: DLL loop filter bandwidth [Hz]
|
||||||
Tracking_1C.dll_bw_hz=2.0;
|
Tracking_1C.dll_bw_hz=2.0;
|
||||||
|
@ -126,7 +126,7 @@ void Channel::connect(gr::top_block_sptr top_block)
|
|||||||
top_block->connect(trk_->get_right_block(), 0, nav_->get_left_block(), 0);
|
top_block->connect(trk_->get_right_block(), 0, nav_->get_left_block(), 0);
|
||||||
DLOG(INFO) << "tracking -> telemetry_decoder";
|
DLOG(INFO) << "tracking -> telemetry_decoder";
|
||||||
|
|
||||||
top_block->msg_connect(nav_->get_left_block(),pmt::mp("preamble_index"),trk_->get_right_block(),pmt::mp("preamble_index"));
|
top_block->msg_connect(nav_->get_left_block(),pmt::mp("preamble_timestamp_s"),trk_->get_right_block(),pmt::mp("preamble_timestamp_s"));
|
||||||
DLOG(INFO) << "MSG FEEDBACK CHANNEL telemetry_decoder -> tracking";
|
DLOG(INFO) << "MSG FEEDBACK CHANNEL telemetry_decoder -> tracking";
|
||||||
|
|
||||||
connected_ = true;
|
connected_ = true;
|
||||||
|
@ -29,17 +29,10 @@
|
|||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
* \todo Clean this code and move the telemetry definitions to GPS_L1_CA system definitions file
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "gps_l1_ca_telemetry_decoder_cc.h"
|
#include "gps_l1_ca_telemetry_decoder_cc.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <bitset>
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
#include <pmt/pmt.h>
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "control_message_factory.h"
|
#include "control_message_factory.h"
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
@ -49,15 +42,17 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
/*!
|
|
||||||
* \todo name and move the magic numbers to GPS_L1_CA.h
|
|
||||||
*/
|
|
||||||
gps_l1_ca_telemetry_decoder_cc_sptr
|
gps_l1_ca_telemetry_decoder_cc_sptr
|
||||||
gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr<gr::msg_queue> queue, bool dump)
|
gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr<gr::msg_queue> queue, bool dump)
|
||||||
{
|
{
|
||||||
return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, queue, dump));
|
return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, queue, dump));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gps_l1_ca_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
|
||||||
|
{
|
||||||
|
ninput_items_required[0] = GPS_CA_PREAMBLE_LENGTH_SYMBOLS; //set the required sample history
|
||||||
|
}
|
||||||
|
|
||||||
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
||||||
Gnss_Satellite satellite,
|
Gnss_Satellite satellite,
|
||||||
@ -66,29 +61,25 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
|||||||
gr::block("gps_navigation_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
gr::block("gps_navigation_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||||
{
|
{
|
||||||
// create asynchronous message ports
|
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||||
this->message_port_register_out(pmt::mp("preamble_index"));
|
|
||||||
|
|
||||||
// initialize internal vars
|
// initialize internal vars
|
||||||
d_queue = queue;
|
d_queue = queue;
|
||||||
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());
|
||||||
d_samples_per_bit = ( GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS ) / GPS_CA_TELEMETRY_RATE_BITS_SECOND;
|
|
||||||
//d_preamble_duration_seconds = (1.0 / GPS_CA_TELEMETRY_RATE_BITS_SECOND) * GPS_CA_PREAMBLE_LENGTH_BITS;
|
|
||||||
//std::cout<<"d_preamble_duration_seconds="<<d_preamble_duration_seconds<<"\r\n";
|
|
||||||
// set the preamble
|
// set the preamble
|
||||||
unsigned short int preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS] = GPS_PREAMBLE;
|
unsigned short int preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS] = GPS_PREAMBLE;
|
||||||
|
|
||||||
memcpy((unsigned short int*)this->d_preambles_bits, (unsigned short int*)preambles_bits, GPS_CA_PREAMBLE_LENGTH_BITS*sizeof(unsigned short int));
|
memcpy((unsigned short int*)this->d_preambles_bits, (unsigned short int*)preambles_bits, GPS_CA_PREAMBLE_LENGTH_BITS*sizeof(unsigned short int));
|
||||||
|
|
||||||
// preamble bits to sampled symbols (reversed)
|
// preamble bits to sampled symbols
|
||||||
d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_BITS * d_samples_per_bit);
|
d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_SYMBOLS);
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (int i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
|
for (int i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < d_samples_per_bit; j++)
|
for (unsigned int j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
||||||
{
|
{
|
||||||
if (d_preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS-i-1] == 1)
|
if (d_preambles_bits[i] == 1)
|
||||||
{
|
{
|
||||||
d_preambles_symbols[n] = 1;
|
d_preambles_symbols[n] = 1;
|
||||||
}
|
}
|
||||||
@ -99,10 +90,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d_sample_counter = 0;
|
|
||||||
//d_preamble_code_phase_seconds = 0;
|
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
d_preamble_index = 0;
|
|
||||||
d_symbol_accumulator = 0;
|
d_symbol_accumulator = 0;
|
||||||
d_symbol_accumulator_counter = 0;
|
d_symbol_accumulator_counter = 0;
|
||||||
d_frame_bit_index = 0;
|
d_frame_bit_index = 0;
|
||||||
@ -121,7 +109,6 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
|||||||
d_channel = 0;
|
d_channel = 0;
|
||||||
Prn_timestamp_at_preamble_ms = 0.0;
|
Prn_timestamp_at_preamble_ms = 0.0;
|
||||||
flag_PLL_180_deg_phase_locked = false;
|
flag_PLL_180_deg_phase_locked = false;
|
||||||
//set_history(d_samples_per_bit*8); // At least a history of 8 bits are needed to correlate with the preamble
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,8 +118,6 @@ gps_l1_ca_telemetry_decoder_cc::~gps_l1_ca_telemetry_decoder_cc()
|
|||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
|
bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
|
||||||
{
|
{
|
||||||
unsigned int d1, d2, d3, d4, d5, d6, d7, t, parity;
|
unsigned int d1, d2, d3, d4, d5, d6, d7, t, parity;
|
||||||
@ -160,52 +145,29 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
|
|||||||
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)
|
||||||
{
|
{
|
||||||
int corr_value = 0;
|
int corr_value = 0;
|
||||||
int preamble_diff = 0;
|
int preamble_diff_ms = 0;
|
||||||
|
|
||||||
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
|
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
|
||||||
d_sample_counter++; //count for the processed samples
|
|
||||||
|
|
||||||
// ########### Output the tracking data to navigation and PVT ##########
|
// ########### Output the tracking data to navigation and PVT ##########
|
||||||
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
|
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
|
||||||
|
|
||||||
// record last symbols (clipped to +1,-1) and its correlation length to perform preamble correlation
|
//******* preamble correlation ********
|
||||||
if (in[0]->Flag_valid_symbol_output==true)
|
for (unsigned int i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++)
|
||||||
{
|
|
||||||
d_symbol_history.push_front(in[0]->Prompt_I);
|
|
||||||
d_correlation_length_ms_history.push_front(in[0]->correlation_length_ms);
|
|
||||||
if (static_cast<int>(d_symbol_history.size())>GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
|
||||||
{
|
{
|
||||||
d_symbol_history.pop_back();
|
if (in[0][i].Flag_valid_symbol_output==true)
|
||||||
d_correlation_length_ms_history.pop_back();
|
{
|
||||||
}
|
if (in[0][i].Prompt_I < 0) // symbols clipping
|
||||||
|
|
||||||
if (d_symbol_history.size()==GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
|
||||||
{
|
|
||||||
|
|
||||||
//******* preamble correlation (in reverse order due to the variable correlator length)
|
|
||||||
int input_symbol_index=0;
|
|
||||||
int preamble_index=0;
|
|
||||||
do{
|
|
||||||
if (d_symbol_history.at(input_symbol_index) < 0) // symbols clipping
|
|
||||||
{
|
{
|
||||||
//symbol weight expansion using its tracking correlation length
|
corr_value -= d_preambles_symbols[i]*in[0][i].correlation_length_ms;
|
||||||
corr_value -= d_preambles_symbols[preamble_index]*d_correlation_length_ms_history.at(input_symbol_index);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//symbol weight expansion using its tracking correlation length
|
corr_value += d_preambles_symbols[i]*in[0][i].correlation_length_ms;
|
||||||
corr_value += d_preambles_symbols[preamble_index]*d_correlation_length_ms_history.at(input_symbol_index);
|
|
||||||
}
|
}
|
||||||
preamble_index+=d_correlation_length_ms_history.at(input_symbol_index);
|
}
|
||||||
input_symbol_index++;
|
if (corr_value>=GPS_CA_PREAMBLE_LENGTH_SYMBOLS) break;
|
||||||
}while(preamble_index<GPS_CA_PREAMBLE_LENGTH_SYMBOLS);
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
consume_each(1); //always consume one by one tracking output
|
|
||||||
|
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
|
|
||||||
//******* frame sync ******************
|
//******* frame sync ******************
|
||||||
@ -214,30 +176,28 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
|
|||||||
if (d_stat == 0)
|
if (d_stat == 0)
|
||||||
{
|
{
|
||||||
d_GPS_FSM.Event_gps_word_preamble();
|
d_GPS_FSM.Event_gps_word_preamble();
|
||||||
d_preamble_index = d_sample_counter;//record the preamble sample stamp
|
d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs;//record the preamble sample stamp
|
||||||
DLOG(INFO) << "Preamble detection for SAT " << this->d_satellite <<" d_sample_counter="<<d_sample_counter<<std::endl;
|
DLOG(INFO) << "Preamble detection for SAT " << this->d_satellite << "in[0][0].Tracking_timestamp_secs="<<round(in[0][0].Tracking_timestamp_secs * 1000.0) <<std::endl;
|
||||||
d_symbol_accumulator = 0; //sync the symbol to bits integrator
|
//sync the symbol to bits integrator
|
||||||
d_symbol_accumulator_counter = GPS_CA_TELEMETRY_SYMBOLS_PER_BIT-in[0]->correlation_length_ms;
|
d_symbol_accumulator = 0;
|
||||||
d_frame_bit_index = 7;
|
d_symbol_accumulator_counter = 0;
|
||||||
|
d_frame_bit_index = 0;
|
||||||
d_stat = 1; // enter into frame pre-detection status
|
d_stat = 1; // enter into frame pre-detection status
|
||||||
}
|
}
|
||||||
else if (d_stat == 1) //check 6 seconds of preamble separation
|
else if (d_stat == 1) //check 6 seconds of preamble separation
|
||||||
{
|
{
|
||||||
preamble_diff = d_sample_counter - d_preamble_index;
|
preamble_diff_ms = round((in[0][0].Tracking_timestamp_secs - d_preamble_time_seconds)*1000.0);
|
||||||
if (abs(preamble_diff - GPS_SUBFRAME_MS) < 1)
|
if (abs(preamble_diff_ms - GPS_SUBFRAME_MS) < 1)
|
||||||
{
|
{
|
||||||
//DLOG(INFO)<<"preamble! corr lenght="<<in[0]->correlation_length_ms<<" d_sample_counter="<<d_sample_counter<<std::endl;
|
DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite << "in[0][0].Tracking_timestamp_secs="<<round(in[0][0].Tracking_timestamp_secs * 1000.0) <<std::endl;
|
||||||
d_GPS_FSM.Event_gps_word_preamble();
|
d_GPS_FSM.Event_gps_word_preamble();
|
||||||
d_flag_preamble = true;
|
d_flag_preamble = true;
|
||||||
d_preamble_index = d_sample_counter; //record the preamble sample stamp (t_P)
|
d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs;//record the PRN start sample index associated to the preamble
|
||||||
d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs;// - d_preamble_duration_seconds; //record the PRN start sample index associated to the preamble
|
|
||||||
d_symbol_accumulator_counter = GPS_CA_TELEMETRY_SYMBOLS_PER_BIT-in[0]->correlation_length_ms;
|
|
||||||
d_frame_bit_index = 7;
|
|
||||||
if (!d_flag_frame_sync)
|
if (!d_flag_frame_sync)
|
||||||
{
|
{
|
||||||
//send asynchronous message to tracking to inform of frame sync and extend correlation time
|
//send asynchronous message to tracking to inform of frame sync and extend correlation time
|
||||||
pmt::pmt_t value = pmt::from_long(d_preamble_index-1);
|
pmt::pmt_t value = pmt::from_double(d_preamble_time_seconds-0.001);
|
||||||
this->message_port_pub(pmt::mp("preamble_index"),value);
|
this->message_port_pub(pmt::mp("preamble_timestamp_s"),value);
|
||||||
|
|
||||||
d_flag_frame_sync = true;
|
d_flag_frame_sync = true;
|
||||||
if (corr_value < 0)
|
if (corr_value < 0)
|
||||||
@ -252,9 +212,9 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
|
|||||||
DLOG(INFO) << " Frame sync SAT " << this->d_satellite << " with preamble start at " << d_preamble_time_seconds << " [s]";
|
DLOG(INFO) << " Frame sync SAT " << this->d_satellite << " with preamble start at " << d_preamble_time_seconds << " [s]";
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if (preamble_diff > GPS_SUBFRAME_MS+1)
|
if (preamble_diff_ms > GPS_SUBFRAME_MS+1)
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff<<" d_sample_counter="<<d_sample_counter<<std::endl;
|
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff_ms= " << preamble_diff_ms<<std::endl;
|
||||||
d_stat = 0; //lost of frame sync
|
d_stat = 0; //lost of frame sync
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
flag_TOW_set = false;
|
flag_TOW_set = false;
|
||||||
@ -264,26 +224,25 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
|
|||||||
}
|
}
|
||||||
|
|
||||||
//******* SYMBOL TO BIT *******
|
//******* SYMBOL TO BIT *******
|
||||||
if (in[0]->Flag_valid_symbol_output==true)
|
|
||||||
|
if (in[0][0].Flag_valid_symbol_output==true)
|
||||||
{
|
{
|
||||||
// extended correlation to bit period is enabled in tracking!
|
// extended correlation to bit period is enabled in tracking!
|
||||||
d_symbol_accumulator += in[0]->Prompt_I; // accumulate the input value in d_symbol_accumulator
|
d_symbol_accumulator += in[0][0].Prompt_I; // accumulate the input value in d_symbol_accumulator
|
||||||
d_symbol_accumulator_counter+=in[0]->correlation_length_ms;
|
d_symbol_accumulator_counter+=in[0][0].correlation_length_ms;
|
||||||
}
|
}
|
||||||
|
if (d_symbol_accumulator_counter == 20)
|
||||||
if (d_symbol_accumulator_counter >= GPS_CA_TELEMETRY_SYMBOLS_PER_BIT )
|
|
||||||
{
|
{
|
||||||
if (d_symbol_accumulator > 0)
|
if (d_symbol_accumulator > 0)
|
||||||
{ //symbol to bit
|
{ //symbol to bit
|
||||||
d_GPS_frame_4bytes += 1; //insert the telemetry bit in LSB
|
d_GPS_frame_4bytes += 1; //insert the telemetry bit in LSB
|
||||||
}
|
}
|
||||||
d_symbol_accumulator = 0;
|
d_symbol_accumulator = 0;
|
||||||
d_symbol_accumulator_counter = 0;
|
d_symbol_accumulator_counter = 0;
|
||||||
//******* bits to words ******
|
//******* bits to words ******
|
||||||
d_frame_bit_index++;
|
d_frame_bit_index++;
|
||||||
if (d_frame_bit_index == GPS_WORD_BITS)
|
if (d_frame_bit_index == 30)
|
||||||
{
|
{
|
||||||
//std::cout<<"word bits = "<<std::bitset<32>(d_GPS_frame_4bytes)<<std::endl;
|
|
||||||
d_frame_bit_index = 0;
|
d_frame_bit_index = 0;
|
||||||
// parity check
|
// parity check
|
||||||
// Each word in wordbuff is composed of:
|
// Each word in wordbuff is composed of:
|
||||||
@ -325,6 +284,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// output the frame
|
// output the frame
|
||||||
|
consume_each(1); //one by one
|
||||||
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
|
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
|
||||||
//1. Copy the current tracking output
|
//1. Copy the current tracking output
|
||||||
current_synchro_data = in[0][0];
|
current_synchro_data = in[0][0];
|
||||||
@ -359,8 +319,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
|
|||||||
|
|
||||||
if (flag_PLL_180_deg_phase_locked == true)
|
if (flag_PLL_180_deg_phase_locked == true)
|
||||||
{
|
{
|
||||||
//correct the accumulated phase for the costas loop phase shift, if required
|
//correct the accumulated phase for the costas loop phase shift, if required
|
||||||
current_synchro_data.Carrier_phase_rads += GPS_PI;
|
current_synchro_data.Carrier_phase_rads += GPS_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(d_dump == true)
|
if(d_dump == true)
|
||||||
@ -376,7 +336,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i
|
|||||||
tmp_double = d_TOW_at_Preamble;
|
tmp_double = d_TOW_at_Preamble;
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
||||||
}
|
}
|
||||||
catch (std::ifstream::failure e)
|
catch (const std::ifstream::failure & e)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception writing observables dump file " << e.what();
|
LOG(WARNING) << "Exception writing observables dump file " << e.what();
|
||||||
}
|
}
|
||||||
@ -412,7 +372,7 @@ void gps_l1_ca_telemetry_decoder_cc::set_decimation(int decimation)
|
|||||||
void gps_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
void gps_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
||||||
{
|
{
|
||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
LOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
||||||
d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN();
|
d_GPS_FSM.i_satellite_PRN = d_satellite.get_PRN();
|
||||||
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
|
DLOG(INFO) << "Navigation Satellite set to " << d_satellite;
|
||||||
}
|
}
|
||||||
@ -435,7 +395,7 @@ void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel)
|
|||||||
d_dump_filename.append(".dat");
|
d_dump_filename.append(".dat");
|
||||||
d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit );
|
d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit );
|
||||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
||||||
DLOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
|
LOG(INFO) << "Telemetry decoder dump enabled on channel " << d_channel
|
||||||
<< " Log file: " << d_dump_filename.c_str();
|
<< " Log file: " << d_dump_filename.c_str();
|
||||||
}
|
}
|
||||||
catch (std::ifstream::failure e)
|
catch (std::ifstream::failure e)
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
* \brief Function which tells the scheduler how many input items
|
* \brief Function which tells the scheduler how many input items
|
||||||
* are required to produce noutput_items output items.
|
* are required to produce noutput_items output items.
|
||||||
*/
|
*/
|
||||||
//void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend gps_l1_ca_telemetry_decoder_cc_sptr
|
friend gps_l1_ca_telemetry_decoder_cc_sptr
|
||||||
@ -100,9 +100,6 @@ private:
|
|||||||
// class private vars
|
// class private vars
|
||||||
|
|
||||||
int *d_preambles_symbols;
|
int *d_preambles_symbols;
|
||||||
unsigned int d_samples_per_bit;
|
|
||||||
long unsigned int d_sample_counter;
|
|
||||||
long unsigned int d_preamble_index;
|
|
||||||
unsigned int d_stat;
|
unsigned int d_stat;
|
||||||
bool d_flag_frame_sync;
|
bool d_flag_frame_sync;
|
||||||
|
|
||||||
@ -134,8 +131,6 @@ private:
|
|||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
int d_channel;
|
int d_channel;
|
||||||
|
|
||||||
//std::deque<double> d_prn_start_sample_history;
|
|
||||||
|
|
||||||
double d_preamble_time_seconds;
|
double d_preamble_time_seconds;
|
||||||
|
|
||||||
double d_TOW_at_Preamble;
|
double d_TOW_at_Preamble;
|
||||||
|
@ -93,7 +93,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pmt_t
|
|||||||
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)<< std::endl;
|
DLOG(INFO) << "Extended correlation enabled for Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)<< std::endl;
|
||||||
if (d_enable_extended_integration==false) //avoid re-setting preamble indicator
|
if (d_enable_extended_integration==false) //avoid re-setting preamble indicator
|
||||||
{
|
{
|
||||||
d_preamble_index=pmt::to_long(msg);
|
d_preamble_timestamp_s=pmt::to_double(msg);
|
||||||
d_enable_extended_integration=true;
|
d_enable_extended_integration=true;
|
||||||
d_preamble_synchronized=false;
|
d_preamble_synchronized=false;
|
||||||
}
|
}
|
||||||
@ -117,9 +117,9 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
|
|||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||||
{
|
{
|
||||||
// create asynchronous message ports
|
// create asynchronous message ports
|
||||||
this->message_port_register_in(pmt::mp("preamble_index"));
|
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||||
|
|
||||||
this->set_msg_handler(pmt::mp("preamble_index"),
|
this->set_msg_handler(pmt::mp("preamble_timestamp_s"),
|
||||||
boost::bind(&gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index, this, _1));
|
boost::bind(&gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index, this, _1));
|
||||||
|
|
||||||
|
|
||||||
@ -173,8 +173,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
|
|||||||
|
|
||||||
// sample synchronization
|
// sample synchronization
|
||||||
d_sample_counter = 0; //(from trk to tlm)
|
d_sample_counter = 0; //(from trk to tlm)
|
||||||
// symbol synchronization (from tlm to trk)
|
|
||||||
d_symbol_counter =0;
|
|
||||||
//d_sample_counter_seconds = 0;
|
//d_sample_counter_seconds = 0;
|
||||||
d_acq_sample_stamp = 0;
|
d_acq_sample_stamp = 0;
|
||||||
|
|
||||||
@ -351,7 +350,6 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec
|
|||||||
current_synchro_data.Flag_valid_symbol_output = false;
|
current_synchro_data.Flag_valid_symbol_output = false;
|
||||||
*out[0] = current_synchro_data;
|
*out[0] = current_synchro_data;
|
||||||
consume_each(samples_offset); //shift input to perform alignment with local replica
|
consume_each(samples_offset); //shift input to perform alignment with local replica
|
||||||
d_symbol_counter++;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +377,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec
|
|||||||
bool enable_dll_pll;
|
bool enable_dll_pll;
|
||||||
if (d_enable_extended_integration==true)
|
if (d_enable_extended_integration==true)
|
||||||
{
|
{
|
||||||
long int symbol_diff=d_symbol_counter-d_preamble_index;
|
long int symbol_diff=round(1000.0*((static_cast<double>(d_sample_counter) + d_rem_code_phase_samples) / static_cast<double>(d_fs_in)-d_preamble_timestamp_s));
|
||||||
if (symbol_diff>0 and symbol_diff % d_extend_correlation_ms == 0)
|
if (symbol_diff>0 and symbol_diff % d_extend_correlation_ms == 0)
|
||||||
{
|
{
|
||||||
// compute coherent integration and enable tracking loop
|
// compute coherent integration and enable tracking loop
|
||||||
@ -638,6 +636,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec
|
|||||||
|
|
||||||
current_synchro_data.System = {'G'};
|
current_synchro_data.System = {'G'};
|
||||||
current_synchro_data.Flag_valid_pseudorange = false;
|
current_synchro_data.Flag_valid_pseudorange = false;
|
||||||
|
current_synchro_data.correlation_length_ms=1;
|
||||||
*out[0] = current_synchro_data;
|
*out[0] = current_synchro_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -703,7 +702,6 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec
|
|||||||
{
|
{
|
||||||
LOG(WARNING) << "noutput_items = 0";
|
LOG(WARNING) << "noutput_items = 0";
|
||||||
}
|
}
|
||||||
d_symbol_counter++;
|
|
||||||
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
|
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,8 +174,7 @@ private:
|
|||||||
std::deque<gr_complex> d_E_history;
|
std::deque<gr_complex> d_E_history;
|
||||||
std::deque<gr_complex> d_P_history;
|
std::deque<gr_complex> d_P_history;
|
||||||
std::deque<gr_complex> d_L_history;
|
std::deque<gr_complex> d_L_history;
|
||||||
long int d_preamble_index;
|
double d_preamble_timestamp_s;
|
||||||
long int d_symbol_counter;
|
|
||||||
int d_extend_correlation_ms;
|
int d_extend_correlation_ms;
|
||||||
bool d_enable_extended_integration;
|
bool d_enable_extended_integration;
|
||||||
bool d_preamble_synchronized;
|
bool d_preamble_synchronized;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user