diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc index 92466e159..41f4fe24f 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.cc @@ -41,6 +41,8 @@ #include #include "control_message_factory.h" #include "GPS_L1_CA.h" //GPS_TWO_PI +#include "Glonass_L1_CA.h" //GLONASS_TWO_PI + using google::LogMessage; @@ -159,6 +161,11 @@ pcps_acquisition_sc::~pcps_acquisition_sc() void pcps_acquisition_sc::set_local_code(std::complex * code) { + // This will check if it's fdma, if yes will update the intermediate frequency and the doppler grid + if( is_fdma() ) + { + update_grid_doppler_wipeoffs(); + } // COD // Here we want to create a buffer that looks like this: // [ 0 0 0 ... 0 c_0 c_1 ... c_L] @@ -175,6 +182,22 @@ void pcps_acquisition_sc::set_local_code(std::complex * code) } +bool pcps_acquisition_sc::is_fdma() +{ + // Dealing with FDMA system + if( strcmp(d_gnss_synchro->Signal,"1G") == 0 ) + { + d_freq += DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN); + LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN) << " in Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl; + return true; + } + else + { + return false; + } +} + + void pcps_acquisition_sc::update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq) { float phase_step_rad = GPS_TWO_PI * freq / static_cast(d_fs_in); @@ -211,6 +234,19 @@ void pcps_acquisition_sc::init() } +void pcps_acquisition_sc::update_grid_doppler_wipeoffs() +{ + // Create the carrier Doppler wipeoff signals + d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins]; + + for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) + { + d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; + update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_freq + doppler); + } +} + void pcps_acquisition_sc::set_state(int state) { diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.h index bc13941f3..10d5aefa4 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_sc.h @@ -97,6 +97,9 @@ private: int correlator_length_samples, float freq); + void update_grid_doppler_wipeoffs(); + bool is_fdma(); + long d_fs_in; long d_freq; int d_samples_per_ms;