From 2a2344d5015e5e12ddb3ed1204c23456579bf69f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 11 Aug 2016 13:13:30 +0200 Subject: [PATCH] Add maximum number of dwells in the Tong algorithm --- ...ileo_e1_pcps_tong_ambiguous_acquisition.cc | 3 ++- ...lileo_e1_pcps_tong_ambiguous_acquisition.h | 1 + .../gps_l1_ca_pcps_tong_acquisition.cc | 3 ++- .../gps_l1_ca_pcps_tong_acquisition.h | 1 + .../pcps_tong_acquisition_cc.cc | 22 +++++++++++-------- .../pcps_tong_acquisition_cc.h | 9 ++++---- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 042ba27e9..dae111573 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -70,6 +70,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( tong_init_val_ = configuration->property(role + ".tong_init_val", 1); tong_max_val_ = configuration->property(role + ".tong_max_val", 2); + tong_max_dwells_ = configuration->property(role + ".tong_max_dwells", tong_max_val_ + 1); dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); @@ -92,7 +93,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_, if_, fs_in_, samples_per_ms, code_length_, tong_init_val_, - tong_max_val_, dump_, dump_filename_); + tong_max_val_, tong_max_dwells_, dump_, dump_filename_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); DLOG(INFO) << "stream_to_vector(" diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h index 821bab60e..dd7b7db34 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h @@ -143,6 +143,7 @@ private: unsigned int sampled_ms_; unsigned int tong_init_val_; unsigned int tong_max_val_; + unsigned int tong_max_dwells_; long fs_in_; long if_; bool dump_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index 3490c0cec..e7a4bdb65 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -60,6 +60,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( tong_init_val_ = configuration->property(role + ".tong_init_val", 1); tong_max_val_ = configuration->property(role + ".tong_max_val", 2); + tong_max_dwells_ = configuration->property(role + ".tong_max_dwells", tong_max_val_ + 1); dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); @@ -75,7 +76,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( { item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_, if_, fs_in_, - code_length_, code_length_, tong_init_val_, tong_max_val_, + code_length_, code_length_, tong_init_val_, tong_max_val_, tong_max_dwells_, dump_, dump_filename_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h index deec6d712..a43dd3e99 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h @@ -143,6 +143,7 @@ private: unsigned int sampled_ms_; unsigned int tong_init_val_; unsigned int tong_max_val_; + unsigned int tong_max_dwells_; long fs_in_; long if_; bool dump_; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc index ada08ce96..15d69010d 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -63,19 +63,19 @@ pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc( unsigned int sampled_ms, unsigned int doppler_max, long freq, long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, - unsigned int tong_max_val, + unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename) { return pcps_tong_acquisition_cc_sptr( new pcps_tong_acquisition_cc(sampled_ms, doppler_max, freq, fs_in, samples_per_ms, samples_per_code, - tong_init_val, tong_max_val, dump, dump_filename)); + tong_init_val, tong_max_val, tong_max_dwells, dump, dump_filename)); } pcps_tong_acquisition_cc::pcps_tong_acquisition_cc( unsigned int sampled_ms, unsigned int doppler_max, long freq, long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, - unsigned int tong_max_val, + unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename) : gr::block("pcps_tong_acquisition_cc", gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms), @@ -90,8 +90,9 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc( d_samples_per_ms = samples_per_ms; d_samples_per_code = samples_per_code; d_sampled_ms = sampled_ms; - d_well_count = 0; + d_dwell_count = 0; d_tong_max_val = tong_max_val; + d_tong_max_dwells = tong_max_dwells; d_tong_init_val = tong_init_val; d_tong_count = d_tong_init_val; d_doppler_max = doppler_max; @@ -213,8 +214,7 @@ void pcps_tong_acquisition_cc::set_state(int state) d_gnss_synchro->Acq_delay_samples = 0.0; d_gnss_synchro->Acq_doppler_hz = 0.0; d_gnss_synchro->Acq_samplestamp_samples = 0; - d_well_count = 0; - d_well_count = 0; + d_dwell_count = 0; d_tong_count = d_tong_init_val; d_mag = 0.0; d_input_power = 0.0; @@ -252,7 +252,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, d_gnss_synchro->Acq_delay_samples = 0.0; d_gnss_synchro->Acq_doppler_hz = 0.0; d_gnss_synchro->Acq_samplestamp_samples = 0; - d_well_count = 0; + d_dwell_count = 0; d_tong_count = d_tong_init_val; d_mag = 0.0; d_input_power = 0.0; @@ -292,7 +292,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, d_sample_counter += d_fft_size; // sample counter - d_well_count++; + d_dwell_count++; DLOG(INFO) << "Channel: " << d_channel << " , doing acquisition of satellite: " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN @@ -370,7 +370,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, // 5- Compute the test statistics and compare to the threshold d_test_statistics = d_mag; - if (d_test_statistics > d_threshold*d_well_count) + if (d_test_statistics > d_threshold * d_dwell_count) { d_tong_count++; if (d_tong_count == d_tong_max_val) @@ -387,6 +387,10 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, } } + if(d_dwell_count >= d_tong_max_dwells) + { + d_state = 3; // Negative acquisition + } consume_each(1); break; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h index bc7c416cc..03b20b372 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h @@ -66,7 +66,7 @@ pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max, long freq, long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, - unsigned int tong_max_val, + unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename); /*! @@ -80,13 +80,13 @@ private: pcps_tong_make_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max, long freq, long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, - unsigned int tong_max_val, + unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename); pcps_tong_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max, long freq, long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, - unsigned int tong_max_val, + unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename); void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift, @@ -102,10 +102,11 @@ private: unsigned int d_doppler_max; unsigned int d_doppler_step; unsigned int d_sampled_ms; - unsigned int d_well_count; + unsigned int d_dwell_count; unsigned int d_tong_count; unsigned int d_tong_init_val; unsigned int d_tong_max_val; + unsigned int d_tong_max_dwells; unsigned int d_fft_size; unsigned long int d_sample_counter; gr_complex** d_grid_doppler_wipeoffs;