mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
Some fixes and code cleaning
This commit is contained in:
parent
4db2c6e060
commit
35f9f30441
@ -130,8 +130,8 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc(
|
||||
|
||||
// Initialization of local code replica
|
||||
// Get space for a vector with the E5a primary code replicas sampled 1x/chip
|
||||
d_codeQ = (gr_complex*)volk_malloc((Galileo_E5a_CODE_LENGTH_CHIPS + 2)* sizeof(gr_complex), volk_get_alignment());
|
||||
d_codeI = (gr_complex*)volk_malloc((Galileo_E5a_CODE_LENGTH_CHIPS + 2)* sizeof(gr_complex), volk_get_alignment());
|
||||
d_codeQ = new gr_complex[(int)Galileo_E5a_CODE_LENGTH_CHIPS + 2];
|
||||
d_codeI = new gr_complex[(int)Galileo_E5a_CODE_LENGTH_CHIPS + 2];
|
||||
|
||||
d_early_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
d_late_code = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
@ -140,11 +140,14 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc(
|
||||
d_carr_sign = (gr_complex*)volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
// correlator outputs (complex number)
|
||||
d_Early = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
d_Prompt = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
d_Late = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
d_Prompt_data = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
|
||||
//d_Early = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
//d_Prompt = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
//d_Late = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
//d_Prompt_data = (gr_complex*)volk_malloc(sizeof(gr_complex), volk_get_alignment());
|
||||
d_Early = gr_complex(0, 0);
|
||||
d_Prompt = gr_complex(0, 0);
|
||||
d_Late = gr_complex(0, 0);
|
||||
d_Prompt_data = gr_complex(0, 0);
|
||||
//--- Perform initializations ------------------------------
|
||||
// define initial code frequency basis of NCO
|
||||
d_code_freq_chips = Galileo_E5a_CODE_CHIP_RATE_HZ;
|
||||
@ -187,13 +190,8 @@ Galileo_E5a_Dll_Pll_Tracking_cc::~Galileo_E5a_Dll_Pll_Tracking_cc ()
|
||||
volk_free(d_early_code);
|
||||
volk_free(d_carr_sign);
|
||||
volk_free(d_prompt_data_code);
|
||||
volk_free(d_Prompt_data);
|
||||
volk_free(d_Early);
|
||||
volk_free(d_Prompt);
|
||||
volk_free(d_Late);
|
||||
volk_free(d_codeQ);
|
||||
volk_free(d_codeI);
|
||||
|
||||
delete[] d_codeI;
|
||||
delete[] d_codeQ;
|
||||
delete[] d_Prompt_buffer;
|
||||
}
|
||||
|
||||
@ -424,10 +422,10 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
std::cout << tmp_str_stream.rdbuf() << std::flush;
|
||||
}
|
||||
}
|
||||
*d_Early = gr_complex(0,0);
|
||||
*d_Prompt = gr_complex(0,0);
|
||||
*d_Late = gr_complex(0,0);
|
||||
*d_Prompt_data = gr_complex(0,0);
|
||||
d_Early = gr_complex(0,0);
|
||||
d_Prompt = gr_complex(0,0);
|
||||
d_Late = gr_complex(0,0);
|
||||
d_Prompt_data = gr_complex(0,0);
|
||||
|
||||
*out[0] = *d_acquisition_gnss_synchro;
|
||||
|
||||
@ -488,9 +486,9 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
update_local_code();
|
||||
update_local_carrier();
|
||||
// Reset accumulated values
|
||||
*d_Early = gr_complex(0,0);
|
||||
*d_Prompt = gr_complex(0,0);
|
||||
*d_Late = gr_complex(0,0);
|
||||
d_Early = gr_complex(0,0);
|
||||
d_Prompt = gr_complex(0,0);
|
||||
d_Late = gr_complex(0,0);
|
||||
}
|
||||
gr_complex single_early;
|
||||
gr_complex single_prompt;
|
||||
@ -508,17 +506,17 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
&single_early,
|
||||
&single_prompt,
|
||||
&single_late,
|
||||
d_Prompt_data);
|
||||
&d_Prompt_data);
|
||||
|
||||
// Accumulate results (coherent integration since there are no bit transitions in pilot signal)
|
||||
*d_Early += single_early * sec_sign_Q;
|
||||
*d_Prompt += single_prompt * sec_sign_Q;
|
||||
*d_Late += single_late * sec_sign_Q;
|
||||
*d_Prompt_data *= sec_sign_I;
|
||||
d_Early += single_early * sec_sign_Q;
|
||||
d_Prompt += single_prompt * sec_sign_Q;
|
||||
d_Late += single_late * sec_sign_Q;
|
||||
d_Prompt_data *= sec_sign_I;
|
||||
d_integration_counter++;
|
||||
|
||||
// check for samples consistency (this should be done before in the receiver / here only if the source is a file)
|
||||
if (std::isnan((*d_Prompt).real()) == true or std::isnan((*d_Prompt).imag()) == true ) // or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true)
|
||||
if (std::isnan((d_Prompt).real()) == true or std::isnan((d_Prompt).imag()) == true ) // or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true)
|
||||
{
|
||||
const int samples_available = ninput_items[0];
|
||||
d_sample_counter = d_sample_counter + samples_available;
|
||||
@ -544,11 +542,11 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
{
|
||||
if (d_secondary_lock == true)
|
||||
{
|
||||
carr_error_hz = pll_four_quadrant_atan(*d_Prompt) / (float)GALILEO_PI*2;
|
||||
carr_error_hz = pll_four_quadrant_atan(d_Prompt) / (float)GALILEO_PI*2;
|
||||
}
|
||||
else
|
||||
{
|
||||
carr_error_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / (float)GALILEO_PI*2;
|
||||
carr_error_hz = pll_cloop_two_quadrant_atan(d_Prompt) / (float)GALILEO_PI*2;
|
||||
}
|
||||
|
||||
// Carrier discriminator filter
|
||||
@ -568,7 +566,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
if (d_integration_counter == d_current_ti_ms)
|
||||
{
|
||||
// DLL discriminator
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(*d_Early, *d_Late); //[chips/Ti]
|
||||
code_error_chips = dll_nc_e_minus_l_normalized(d_Early, d_Late); //[chips/Ti]
|
||||
// Code discriminator filter
|
||||
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second]
|
||||
//Code phase accumulator
|
||||
@ -594,12 +592,12 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES-1)
|
||||
{
|
||||
// fill buffer with prompt correlator output values
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt;
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_Prompt;
|
||||
d_cn0_estimation_counter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt;
|
||||
d_Prompt_buffer[d_cn0_estimation_counter] = d_Prompt;
|
||||
// ATTEMPT SECONDARY CODE ACQUISITION
|
||||
if (d_secondary_lock == false)
|
||||
{
|
||||
@ -622,12 +620,11 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||
std::shared_ptr<ControlMessageFactory> cmf = std::make_shared<ControlMessageFactory>();
|
||||
if (d_queue != gr::msg_queue::sptr())
|
||||
{
|
||||
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
||||
}
|
||||
delete cmf;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_state = 0; // TODO: check if disabling tracking is consistent with the channel state machine
|
||||
}
|
||||
@ -652,12 +649,11 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
{
|
||||
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
|
||||
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
|
||||
ControlMessageFactory* cmf = new ControlMessageFactory();
|
||||
std::shared_ptr<ControlMessageFactory> cmf = std::make_shared<ControlMessageFactory>();
|
||||
if (d_queue != gr::msg_queue::sptr())
|
||||
{
|
||||
d_queue->handle(cmf->GetQueueMessage(d_channel, 2));
|
||||
}
|
||||
delete cmf;
|
||||
d_carrier_lock_fail_counter = 0;
|
||||
d_state = 0;
|
||||
}
|
||||
@ -673,8 +669,8 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
// The first Prompt output not equal to 0 is synchronized with the transition of a navigation data bit.
|
||||
if (d_secondary_lock && d_first_transition)
|
||||
{
|
||||
current_synchro_data.Prompt_I = (double)((*d_Prompt_data).real());
|
||||
current_synchro_data.Prompt_Q = (double)((*d_Prompt_data).imag());
|
||||
current_synchro_data.Prompt_I = (double)((d_Prompt_data).real());
|
||||
current_synchro_data.Prompt_Q = (double)((d_Prompt_data).imag());
|
||||
// Tracking_timestamp_secs is aligned with the PRN start sample
|
||||
current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter + (double)d_current_prn_length_samples + (double)d_rem_code_phase_samples)/(double)d_fs_in;
|
||||
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0
|
||||
@ -705,13 +701,13 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
|
||||
float prompt_Q;
|
||||
float tmp_float;
|
||||
double tmp_double;
|
||||
prompt_I = (*d_Prompt_data).real();
|
||||
prompt_Q = (*d_Prompt_data).imag();
|
||||
prompt_I = (d_Prompt_data).real();
|
||||
prompt_Q = (d_Prompt_data).imag();
|
||||
if (d_integration_counter == d_current_ti_ms)
|
||||
{
|
||||
tmp_E = std::abs<float>(*d_Early);
|
||||
tmp_P = std::abs<float>(*d_Prompt);
|
||||
tmp_L = std::abs<float>(*d_Late);
|
||||
tmp_E = std::abs<float>(d_Early);
|
||||
tmp_P = std::abs<float>(d_Prompt);
|
||||
tmp_L = std::abs<float>(d_Late);
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -151,10 +151,10 @@ private:
|
||||
gr_complex* d_prompt_data_code;
|
||||
gr_complex* d_carr_sign;
|
||||
|
||||
gr_complex *d_Early;
|
||||
gr_complex *d_Prompt;
|
||||
gr_complex *d_Late;
|
||||
gr_complex *d_Prompt_data;
|
||||
gr_complex d_Early;
|
||||
gr_complex d_Prompt;
|
||||
gr_complex d_Late;
|
||||
gr_complex d_Prompt_data;
|
||||
|
||||
float tmp_E;
|
||||
float tmp_P;
|
||||
|
@ -85,6 +85,7 @@ void GalileoE5aTrackingTest::init()
|
||||
gnss_synchro.System = 'E';
|
||||
std::string signal = "5Q";
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
gnss_synchro.PRN = 11;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_hz", "32000000");
|
||||
config->set_property("Tracking_Galileo.item_type", "gr_complex");
|
||||
@ -92,12 +93,12 @@ void GalileoE5aTrackingTest::init()
|
||||
config->set_property("Tracking_Galileo.dump_filename", "../data/e5a_tracking_ch_");
|
||||
config->set_property("Tracking_Galileo.implementation", "Galileo_E5a_DLL_PLL_Tracking");
|
||||
config->set_property("Tracking_Galileo.early_late_space_chips", "0.5");
|
||||
|
||||
config->set_property("Tracking_Galileo.order", "2");
|
||||
config->set_property("Tracking_Galileo.pll_bw_hz_init","20.0");
|
||||
config->set_property("Tracking_Galileo.ti_ms", "1");
|
||||
config->set_property("Tracking_Galileo.dll_bw_hz_init","2.0");
|
||||
config->set_property("Tracking_Galileo.pll_bw_hz", "5");
|
||||
config->set_property("Tracking_Galileo.dll_bw_hz_init","2.0");
|
||||
config->set_property("Tracking_Galileo.dll_bw_hz", "2");
|
||||
config->set_property("Tracking_Galileo.ti_ms", "1");
|
||||
}
|
||||
|
||||
TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
|
||||
|
Loading…
Reference in New Issue
Block a user