mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-11-04 01:03:04 +00:00 
			
		
		
		
	Add FDMA protocol to pcps algorithm
This commit is contained in:
		@@ -36,14 +36,8 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition(
 | 
				
			|||||||
    //--- Find number of samples per spreading code -------------------------
 | 
					    //--- Find number of samples per spreading code -------------------------
 | 
				
			||||||
    code_length_ = round(fs_in_ / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS));
 | 
					    code_length_ = round(fs_in_ / (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    LOG(ERROR) << "fs_in_ " << fs_in_;
 | 
					 | 
				
			||||||
    LOG(ERROR) << "code_length_ " << code_length_;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    vector_length_ = code_length_ * sampled_ms_;
 | 
					    vector_length_ = code_length_ * sampled_ms_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    LOG(ERROR) << "vector_length_ " << vector_length_;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if( bit_transition_flag_ )
 | 
					    if( bit_transition_flag_ )
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            vector_length_ *= 2;
 | 
					            vector_length_ *= 2;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,6 +34,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "pcps_acquisition_cc.h"
 | 
					#include "pcps_acquisition_cc.h"
 | 
				
			||||||
#include <sstream>
 | 
					#include <sstream>
 | 
				
			||||||
 | 
					#include <cstring>
 | 
				
			||||||
#include <boost/filesystem.hpp>
 | 
					#include <boost/filesystem.hpp>
 | 
				
			||||||
#include <gnuradio/io_signature.h>
 | 
					#include <gnuradio/io_signature.h>
 | 
				
			||||||
#include <glog/logging.h>
 | 
					#include <glog/logging.h>
 | 
				
			||||||
@@ -159,6 +160,11 @@ pcps_acquisition_cc::~pcps_acquisition_cc()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void pcps_acquisition_cc::set_local_code(std::complex<float> * code)
 | 
					void pcps_acquisition_cc::set_local_code(std::complex<float> * 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
 | 
					    // COD
 | 
				
			||||||
    // Here we want to create a buffer that looks like this:
 | 
					    // Here we want to create a buffer that looks like this:
 | 
				
			||||||
    // [ 0 0 0 ... 0 c_0 c_1 ... c_L]
 | 
					    // [ 0 0 0 ... 0 c_0 c_1 ... c_L]
 | 
				
			||||||
@@ -179,6 +185,21 @@ void pcps_acquisition_cc::set_local_code(std::complex<float> * code)
 | 
				
			|||||||
    volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size);
 | 
					    volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool pcps_acquisition_cc::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_cc::update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq)
 | 
					void pcps_acquisition_cc::update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -203,7 +224,10 @@ void pcps_acquisition_cc::init()
 | 
				
			|||||||
    d_input_power = 0.0;
 | 
					    d_input_power = 0.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    d_num_doppler_bins = ceil( static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step));
 | 
					    d_num_doppler_bins = ceil( static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void pcps_acquisition_cc::update_grid_doppler_wipeoffs()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
    // Create the carrier Doppler wipeoff signals
 | 
					    // Create the carrier Doppler wipeoff signals
 | 
				
			||||||
    d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
 | 
					    d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -216,6 +240,7 @@ void pcps_acquisition_cc::init()
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pcps_acquisition_cc::set_state(int state)
 | 
					void pcps_acquisition_cc::set_state(int state)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
 | 
					    gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,6 +95,8 @@ private:
 | 
				
			|||||||
            std::string dump_filename);
 | 
					            std::string dump_filename);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq);
 | 
					    void update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq);
 | 
				
			||||||
 | 
					    void update_grid_doppler_wipeoffs();
 | 
				
			||||||
 | 
					    bool is_fdma();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void send_negative_acquisition();
 | 
					    void send_negative_acquisition();
 | 
				
			||||||
    void send_positive_acquisition();
 | 
					    void send_positive_acquisition();
 | 
				
			||||||
@@ -148,12 +150,6 @@ public:
 | 
				
			|||||||
     {
 | 
					     {
 | 
				
			||||||
         gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
 | 
					         gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
 | 
				
			||||||
         d_gnss_synchro = p_gnss_synchro;
 | 
					         d_gnss_synchro = p_gnss_synchro;
 | 
				
			||||||
         // Dealing with FDMA system
 | 
					 | 
				
			||||||
         if(d_gnss_synchro->System == 'R')
 | 
					 | 
				
			||||||
          {
 | 
					 | 
				
			||||||
            d_freq += 0.5625e6 * GLONASS_PRN[d_gnss_synchro->PRN+1];
 | 
					 | 
				
			||||||
            std::cout << "d_freq " << d_freq << std::endl;
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     /*!
 | 
					     /*!
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user