[hamradio-commits] [gnss-sdr] 123/236: Release candidate of the GPS L1 C/A telemetry decoder supporting variable tracking correlation length

Carles Fernandez carles_fernandez-guest at moszumanska.debian.org
Tue Apr 26 16:02:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

carles_fernandez-guest pushed a commit to branch next
in repository gnss-sdr.

commit 500dc59516a64448fecf0fabea2fd1c7fcfbe8ae
Author: Javier Arribas <javiarribas at gmail.com>
Date:   Tue Mar 22 18:07:12 2016 +0100

    Release candidate of the GPS L1 C/A telemetry decoder supporting variable tracking correlation length
---
 conf/gnss-sdr_Hybrid_gr_complex.conf               |   8 +-
 conf/gnss-sdr_Hybrid_nsr.conf                      |   4 +-
 src/algorithms/channel/adapters/channel.cc         |   2 +-
 .../gps_l1_ca_telemetry_decoder_cc.cc              | 148 ++++++++-------------
 .../gps_l1_ca_telemetry_decoder_cc.h               |   7 +-
 .../gps_l1_ca_dll_pll_c_aid_tracking_cc.cc         |  14 +-
 .../gps_l1_ca_dll_pll_c_aid_tracking_cc.h          |   3 +-
 7 files changed, 69 insertions(+), 117 deletions(-)

diff --git a/conf/gnss-sdr_Hybrid_gr_complex.conf b/conf/gnss-sdr_Hybrid_gr_complex.conf
index bb5b403..213710e 100644
--- a/conf/gnss-sdr_Hybrid_gr_complex.conf
+++ b/conf/gnss-sdr_Hybrid_gr_complex.conf
@@ -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) )
 ;# 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]
-Tracking_1C.pll_bw_hz=20;
-Tracking_1C.pll_bw_narrow_hz=10;
+Tracking_1C.pll_bw_hz=40;
+Tracking_1C.pll_bw_narrow_hz=25;
 
 ;#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;
 
diff --git a/conf/gnss-sdr_Hybrid_nsr.conf b/conf/gnss-sdr_Hybrid_nsr.conf
index 6cbe056..b9dcfeb 100644
--- a/conf/gnss-sdr_Hybrid_nsr.conf
+++ b/conf/gnss-sdr_Hybrid_nsr.conf
@@ -238,7 +238,7 @@ Tracking_1C.item_type=gr_complex
 Tracking_1C.if=0
 
 ;#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.
 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]
 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]
 Tracking_1C.dll_bw_hz=2.0;
diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc
index 30d8515..34eb971 100644
--- a/src/algorithms/channel/adapters/channel.cc
+++ b/src/algorithms/channel/adapters/channel.cc
@@ -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);
     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";
 
     connected_ = true;
diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc
index 8fa708d..e66fe7e 100644
--- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc
+++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc
@@ -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 <iostream>
-#include <bitset>
 #include <boost/lexical_cast.hpp>
 #include <gnuradio/io_signature.h>
-#include <pmt/pmt.h>
 #include <glog/logging.h>
 #include "control_message_factory.h"
 #include "gnss_synchro.h"
@@ -49,15 +42,17 @@
 #endif
 
 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_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));
 }
 
+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(
         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::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
 {
-	// create asynchronous message ports
-	this->message_port_register_out(pmt::mp("preamble_index"));
-
+	this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
     // initialize internal vars
     d_queue = queue;
     d_dump = dump;
     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
     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));
 
-    // preamble bits to sampled symbols (reversed)
-    d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_BITS * d_samples_per_bit);
+    // preamble bits to sampled symbols
+    d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_SYMBOLS);
     int n = 0;
     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;
                         }
@@ -99,10 +90,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
                     n++;
                 }
         }
-    d_sample_counter = 0;
-    //d_preamble_code_phase_seconds = 0;
     d_stat = 0;
-    d_preamble_index = 0;
     d_symbol_accumulator = 0;
     d_symbol_accumulator_counter = 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;
     Prn_timestamp_at_preamble_ms = 0.0;
     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();
 }
 
-
-
 bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
 {
     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)
 {
     int corr_value = 0;
-    int preamble_diff = 0;
+    int preamble_diff_ms = 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 ##########
     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
-    if (in[0]->Flag_valid_symbol_output==true)
-    {
-    	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)
+    //******* preamble correlation ********
+    for (unsigned int i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++)
         {
-        	d_symbol_history.pop_back();
-        	d_correlation_length_ms_history.pop_back();
-        }
-
-		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
+			if (in[0][i].Flag_valid_symbol_output==true)
+			{
+				if (in[0][i].Prompt_I < 0)	// symbols clipping
 					{
-						//symbol weight expansion using its tracking correlation length
-						corr_value -= d_preambles_symbols[preamble_index]*d_correlation_length_ms_history.at(input_symbol_index);
+						corr_value -= d_preambles_symbols[i]*in[0][i].correlation_length_ms;
 					}
 				else
 					{
-						//symbol weight expansion using its tracking correlation length
-						corr_value += d_preambles_symbols[preamble_index]*d_correlation_length_ms_history.at(input_symbol_index);
+						corr_value += d_preambles_symbols[i]*in[0][i].correlation_length_ms;
 					}
-				preamble_index+=d_correlation_length_ms_history.at(input_symbol_index);
-				input_symbol_index++;
-			}while(preamble_index<GPS_CA_PREAMBLE_LENGTH_SYMBOLS);
-
-		}
-
-    }
-
-    consume_each(1); //always consume one by one tracking output
-
+			}
+        	if (corr_value>=GPS_CA_PREAMBLE_LENGTH_SYMBOLS) break;
+        }
     d_flag_preamble = false;
 
     //******* 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)
     	{
     		d_GPS_FSM.Event_gps_word_preamble();
-    		d_preamble_index = d_sample_counter;//record the preamble sample stamp
-    		DLOG(INFO)  << "Preamble detection for SAT " << this->d_satellite <<" d_sample_counter="<<d_sample_counter<<std::endl;
-    		d_symbol_accumulator = 0; //sync the symbol to bits integrator
-    		d_symbol_accumulator_counter = GPS_CA_TELEMETRY_SYMBOLS_PER_BIT-in[0]->correlation_length_ms;
-    		d_frame_bit_index = 7;
+            d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs;//record the preamble sample stamp
+    		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;
+    		 //sync the symbol to bits integrator
+    		d_symbol_accumulator = 0;
+    		d_symbol_accumulator_counter = 0;
+    		d_frame_bit_index = 0;
     		d_stat = 1; // enter into frame pre-detection status
     	}
     	else if (d_stat == 1) //check 6 seconds of preamble separation
     	{
-    		preamble_diff = d_sample_counter - d_preamble_index;
-    		if (abs(preamble_diff - GPS_SUBFRAME_MS) < 1)
+            preamble_diff_ms = round((in[0][0].Tracking_timestamp_secs - d_preamble_time_seconds)*1000.0);
+    		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_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;// - 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;
+    			d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs;//record the PRN start sample index associated to the preamble
     			if (!d_flag_frame_sync)
     			{
     				//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);
-    				this->message_port_pub(pmt::mp("preamble_index"),value);
+    				pmt::pmt_t value = pmt::from_double(d_preamble_time_seconds-0.001);
+    				this->message_port_pub(pmt::mp("preamble_timestamp_s"),value);
 
     				d_flag_frame_sync = true;
     				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]";
     			}
     		}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_flag_frame_sync = 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 *******
-    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!
-		d_symbol_accumulator += in[0]->Prompt_I; // accumulate the input value in d_symbol_accumulator
-		d_symbol_accumulator_counter+=in[0]->correlation_length_ms;
+		d_symbol_accumulator += in[0][0].Prompt_I; // accumulate the input value in d_symbol_accumulator
+		d_symbol_accumulator_counter+=in[0][0].correlation_length_ms;
     }
-
-    if (d_symbol_accumulator_counter >= GPS_CA_TELEMETRY_SYMBOLS_PER_BIT )
+    if (d_symbol_accumulator_counter == 20)
         {
-			if (d_symbol_accumulator > 0)
-				{ //symbol to bit
-					d_GPS_frame_4bytes += 1; //insert the telemetry bit in LSB
-				}
-			d_symbol_accumulator = 0;
-			d_symbol_accumulator_counter = 0;
+            if (d_symbol_accumulator > 0)
+                { //symbol to bit
+                    d_GPS_frame_4bytes += 1; //insert the telemetry bit in LSB
+                }
+            d_symbol_accumulator = 0;
+            d_symbol_accumulator_counter = 0;
             //******* bits to words ******
             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;
                     // parity check
                     // 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
+    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
     //1. Copy the current tracking output
     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)
         {
-			//correct the accumulated phase for the costas loop phase shift, if required
-			current_synchro_data.Carrier_phase_rads += GPS_PI;
+            //correct the accumulated phase for the costas loop phase shift, if required
+            current_synchro_data.Carrier_phase_rads += GPS_PI;
         }
 
     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;
                     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();
             }
@@ -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)
 {
     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();
     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_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit );
                             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();
                     }
                     catch (std::ifstream::failure e)
diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h
index 519c6be..67d270b 100644
--- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h
+++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h
@@ -85,7 +85,7 @@ public:
      * \brief Function which tells the scheduler how many input 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:
     friend gps_l1_ca_telemetry_decoder_cc_sptr
@@ -100,9 +100,6 @@ private:
     // class private vars
 
     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;
     bool d_flag_frame_sync;
 
@@ -134,8 +131,6 @@ private:
     Gnss_Satellite d_satellite;
     int d_channel;
 
-    //std::deque<double> d_prn_start_sample_history;
-
     double d_preamble_time_seconds;
 
     double d_TOW_at_Preamble;
diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc
index 79f6757..a15ec03 100644
--- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc
+++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc
@@ -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;
   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_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)))
 {
 	// 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));
 
 
@@ -173,8 +173,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
 
     // sample synchronization
     d_sample_counter = 0; //(from trk to tlm)
-    // symbol synchronization (from tlm to trk)
-    d_symbol_counter =0;
+
     //d_sample_counter_seconds = 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;
                     *out[0] = current_synchro_data;
                     consume_each(samples_offset); //shift input to perform alignment with local replica
-                    d_symbol_counter++;
                     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;
 			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)
 				{
 					// 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.Flag_valid_pseudorange = false;
+            current_synchro_data.correlation_length_ms=1;
             *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";
         }
-    d_symbol_counter++;
     return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
 }
 
diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h
index 6183a2f..c32f94e 100644
--- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h
+++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h
@@ -174,8 +174,7 @@ private:
     std::deque<gr_complex> d_E_history;
     std::deque<gr_complex> d_P_history;
     std::deque<gr_complex> d_L_history;
-    long int d_preamble_index;
-    long int d_symbol_counter;
+    double d_preamble_timestamp_s;
     int d_extend_correlation_ms;
     bool d_enable_extended_integration;
     bool d_preamble_synchronized;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git



More information about the pkg-hamradio-commits mailing list