1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-16 05:00:35 +00:00

Improve handling of data types

This commit is contained in:
Carles Fernandez 2018-08-13 00:54:23 +02:00
parent d29befa7e3
commit 4a2ba1cff0
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
40 changed files with 611 additions and 609 deletions

View File

@ -80,7 +80,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
gr::io_signature::make(0, 0, sizeof(gr_complex))) gr::io_signature::make(0, 0, sizeof(gr_complex)))
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_fs_in = fs_in; d_fs_in = fs_in;
@ -383,7 +383,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_test_statistics = 0.0; d_test_statistics = 0.0;
d_state = 1; d_state = 1;
} }
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
break; break;
@ -407,7 +407,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_state = 2; d_state = 2;
} }
d_buffer_count += buff_increment; d_buffer_count += buff_increment;
d_sample_counter += buff_increment; // sample counter d_sample_counter += static_cast<uint64_t>(buff_increment); // sample counter
consume_each(buff_increment); consume_each(buff_increment);
break; break;
} }
@ -419,7 +419,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
{ {
memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * (d_fft_size - d_buffer_count)); memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * (d_fft_size - d_buffer_count));
} }
d_sample_counter += (d_fft_size - d_buffer_count); // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size - d_buffer_count); // sample counter
// initialize acquisition algorithm // initialize acquisition algorithm
int doppler; int doppler;
@ -806,7 +806,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
acquisition_message = 1; acquisition_message = 1;
this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message)); this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message));
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
break; break;
} }
@ -826,7 +826,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
acquisition_message = 2; acquisition_message = 2;
this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message)); this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message));

View File

@ -60,7 +60,7 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc(
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms)) gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_fs_in = fs_in; d_fs_in = fs_in;
@ -228,7 +228,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
d_state = 1; d_state = 1;
} }
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
break; break;
@ -249,7 +249,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
d_input_power = 0.0; d_input_power = 0.0;
d_mag = 0.0; d_mag = 0.0;
d_sample_counter += d_fft_size; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size); // sample counter
d_well_count++; d_well_count++;
@ -404,7 +404,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
acquisition_message = 2; acquisition_message = 2;

View File

@ -58,12 +58,12 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
acq_parameters = conf_; acq_parameters = conf_;
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_positive_acq = 0; d_positive_acq = 0;
d_state = 0; d_state = 0;
d_old_freq = 0; d_old_freq = 0LL;
d_num_noncoherent_integrations_counter = 0; d_num_noncoherent_integrations_counter = 0U;
d_consumed_samples = acq_parameters.sampled_ms * acq_parameters.samples_per_ms * (acq_parameters.bit_transition_flag ? 2 : 1); d_consumed_samples = acq_parameters.sampled_ms * acq_parameters.samples_per_ms * (acq_parameters.bit_transition_flag ? 2 : 1);
if (acq_parameters.sampled_ms == acq_parameters.ms_per_code) if (acq_parameters.sampled_ms == acq_parameters.ms_per_code)
{ {
@ -76,12 +76,12 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
// d_fft_size = next power of two? //// // d_fft_size = next power of two? ////
d_mag = 0; d_mag = 0;
d_input_power = 0.0; d_input_power = 0.0;
d_num_doppler_bins = 0; d_num_doppler_bins = 0U;
d_threshold = 0.0; d_threshold = 0.0;
d_doppler_step = 0; d_doppler_step = 0U;
d_doppler_center_step_two = 0.0; d_doppler_center_step_two = 0.0;
d_test_statistics = 0.0; d_test_statistics = 0.0;
d_channel = 0; d_channel = 0U;
if (conf_.it_size == sizeof(gr_complex)) if (conf_.it_size == sizeof(gr_complex))
{ {
d_cshort = false; d_cshort = false;
@ -136,10 +136,10 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acqu
narrow_grid_ = arma::fmat(); narrow_grid_ = arma::fmat();
d_step_two = false; d_step_two = false;
d_num_doppler_bins_step2 = acq_parameters.num_doppler_bins_step2; d_num_doppler_bins_step2 = acq_parameters.num_doppler_bins_step2;
d_dump_number = 0; d_dump_number = 0LL;
d_dump_channel = acq_parameters.dump_channel; d_dump_channel = acq_parameters.dump_channel;
d_samplesPerChip = acq_parameters.samples_per_chip; d_samplesPerChip = acq_parameters.samples_per_chip;
d_buffer_count = 0; d_buffer_count = 0U;
// todo: CFAR statistic not available for non-coherent integration // todo: CFAR statistic not available for non-coherent integration
if (acq_parameters.max_dwells == 1) if (acq_parameters.max_dwells == 1)
{ {
@ -189,7 +189,7 @@ pcps_acquisition::~pcps_acquisition()
void pcps_acquisition::set_local_code(std::complex<float>* code) void pcps_acquisition::set_local_code(std::complex<float>* code)
{ {
// reset the intermediate frequency // reset the intermediate frequency
d_old_freq = 0; d_old_freq = 0LL;
// This will check if it's fdma, if yes will update the intermediate frequency and the doppler grid // This will check if it's fdma, if yes will update the intermediate frequency and the doppler grid
if (is_fdma()) if (is_fdma())
{ {
@ -250,7 +250,7 @@ void pcps_acquisition::update_local_carrier(gr_complex* carrier_vector, int32_t
{ {
float phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in); float phase_step_rad = GPS_TWO_PI * freq / static_cast<float>(acq_parameters.fs_in);
float _phase[1]; float _phase[1];
_phase[0] = 0; _phase[0] = 0.0;
volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples); volk_gnsssdr_s32f_sincos_32fc(carrier_vector, -phase_step_rad, _phase, correlator_length_samples);
} }
@ -264,7 +264,7 @@ void pcps_acquisition::init()
d_gnss_synchro->Acq_delay_samples = 0.0; d_gnss_synchro->Acq_delay_samples = 0.0;
d_gnss_synchro->Acq_doppler_hz = 0.0; d_gnss_synchro->Acq_doppler_hz = 0.0;
d_gnss_synchro->Acq_samplestamp_samples = 0; d_gnss_synchro->Acq_samplestamp_samples = 0ULL;
d_mag = 0.0; d_mag = 0.0;
d_input_power = 0.0; d_input_power = 0.0;
@ -333,7 +333,7 @@ void pcps_acquisition::set_state(int32_t state)
{ {
d_gnss_synchro->Acq_delay_samples = 0.0; d_gnss_synchro->Acq_delay_samples = 0.0;
d_gnss_synchro->Acq_doppler_hz = 0.0; d_gnss_synchro->Acq_doppler_hz = 0.0;
d_gnss_synchro->Acq_samplestamp_samples = 0; d_gnss_synchro->Acq_samplestamp_samples = 0ULL;
d_mag = 0.0; d_mag = 0.0;
d_input_power = 0.0; d_input_power = 0.0;
d_test_statistics = 0.0; d_test_statistics = 0.0;
@ -491,9 +491,9 @@ void pcps_acquisition::dump_results(int32_t effective_fft_size)
float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step) float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t& doppler, float input_power, uint32_t num_doppler_bins, int32_t doppler_max, int32_t doppler_step)
{ {
float grid_maximum = 0.0; float grid_maximum = 0.0;
uint32_t index_doppler = 0; uint32_t index_doppler = 0U;
uint32_t tmp_intex_t = 0; uint32_t tmp_intex_t = 0U;
uint32_t index_time = 0; uint32_t index_time = 0U;
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size); float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
// Find the correlation peak and the carrier frequency // Find the correlation peak and the carrier frequency
@ -529,9 +529,9 @@ float pcps_acquisition::first_vs_second_peak_statistic(uint32_t& indext, int32_t
// The second peak is chosen not closer than 1 chip to the highest peak // The second peak is chosen not closer than 1 chip to the highest peak
float firstPeak = 0.0; float firstPeak = 0.0;
uint32_t index_doppler = 0; uint32_t index_doppler = 0U;
uint32_t tmp_intex_t = 0; uint32_t tmp_intex_t = 0U;
uint32_t index_time = 0; uint32_t index_time = 0U;
// Find the correlation peak and the carrier frequency // Find the correlation peak and the carrier frequency
for (uint32_t i = 0; i < num_doppler_bins; i++) for (uint32_t i = 0; i < num_doppler_bins; i++)
@ -594,7 +594,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
// Initialize acquisition algorithm // Initialize acquisition algorithm
int32_t doppler = 0; int32_t doppler = 0;
uint32_t indext = 0; uint32_t indext = 0U;
int32_t effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size); int32_t effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size);
if (d_cshort) if (d_cshort)
{ {
@ -785,7 +785,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
else else
{ {
d_step_two = true; // Clear input buffer and make small grid acquisition d_step_two = true; // Clear input buffer and make small grid acquisition
d_num_noncoherent_integrations_counter = 0; d_num_noncoherent_integrations_counter = 0U;
d_state = 0; d_state = 0;
} }
} }
@ -811,7 +811,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count)
{ {
pcps_acquisition::dump_results(effective_fft_size); pcps_acquisition::dump_results(effective_fft_size);
} }
d_num_noncoherent_integrations_counter = 0; d_num_noncoherent_integrations_counter = 0U;
d_positive_acq = 0; d_positive_acq = 0;
// Reset grid // Reset grid
for (uint32_t i = 0; i < d_num_doppler_bins; i++) for (uint32_t i = 0; i < d_num_doppler_bins; i++)
@ -864,12 +864,12 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
// Restart acquisition variables // Restart acquisition variables
d_gnss_synchro->Acq_delay_samples = 0.0; d_gnss_synchro->Acq_delay_samples = 0.0;
d_gnss_synchro->Acq_doppler_hz = 0.0; d_gnss_synchro->Acq_doppler_hz = 0.0;
d_gnss_synchro->Acq_samplestamp_samples = 0; d_gnss_synchro->Acq_samplestamp_samples = 0ULL;
d_mag = 0.0; d_mag = 0.0;
d_input_power = 0.0; d_input_power = 0.0;
d_test_statistics = 0.0; d_test_statistics = 0.0;
d_state = 1; d_state = 1;
d_buffer_count = 0; d_buffer_count = 0U;
if (!acq_parameters.blocking_on_standby) if (!acq_parameters.blocking_on_standby)
{ {
d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
@ -931,7 +931,7 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)),
d_worker_active = true; d_worker_active = true;
} }
consume_each(0); consume_each(0);
d_buffer_count = 0; d_buffer_count = 0U;
break; break;
} }
} }

View File

@ -59,7 +59,7 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(const Acq_Con
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
acq_parameters = conf_; acq_parameters = conf_;
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_fs_in = conf_.fs_in; d_fs_in = conf_.fs_in;
d_samples_per_ms = conf_.samples_per_ms; d_samples_per_ms = conf_.samples_per_ms;
@ -447,7 +447,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler()
// Called by gnuradio to enable drivers, etc for i/o devices. // Called by gnuradio to enable drivers, etc for i/o devices.
bool pcps_acquisition_fine_doppler_cc::start() bool pcps_acquisition_fine_doppler_cc::start()
{ {
d_sample_counter = 0; d_sample_counter = 0ULL;
return true; return true;
} }
@ -507,7 +507,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
} }
if (!acq_parameters.blocking_on_standby) if (!acq_parameters.blocking_on_standby)
{ {
d_sample_counter += d_fft_size; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size); // sample counter
consume_each(d_fft_size); consume_each(d_fft_size);
} }
break; break;
@ -520,7 +520,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
{ {
d_state = 2; d_state = 2;
} }
d_sample_counter += d_fft_size; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size); // sample counter
consume_each(d_fft_size); consume_each(d_fft_size);
break; break;
case 2: // Compute test statistics and decide case 2: // Compute test statistics and decide
@ -543,7 +543,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
{ {
memcpy(&d_10_ms_buffer[d_n_samples_in_buffer], reinterpret_cast<const gr_complex *>(input_items[0]), noutput_items * sizeof(gr_complex)); memcpy(&d_10_ms_buffer[d_n_samples_in_buffer], reinterpret_cast<const gr_complex *>(input_items[0]), noutput_items * sizeof(gr_complex));
d_n_samples_in_buffer += noutput_items; d_n_samples_in_buffer += noutput_items;
d_sample_counter += noutput_items; // sample counter d_sample_counter += static_cast<uint64_t>(noutput_items); // sample counter
consume_each(noutput_items); consume_each(noutput_items);
} }
else else
@ -551,7 +551,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
if (samples_remaining > 0) if (samples_remaining > 0)
{ {
memcpy(&d_10_ms_buffer[d_n_samples_in_buffer], reinterpret_cast<const gr_complex *>(input_items[0]), samples_remaining * sizeof(gr_complex)); memcpy(&d_10_ms_buffer[d_n_samples_in_buffer], reinterpret_cast<const gr_complex *>(input_items[0]), samples_remaining * sizeof(gr_complex));
d_sample_counter += samples_remaining; // sample counter d_sample_counter += static_cast<uint64_t>(samples_remaining); // sample counter
consume_each(samples_remaining); consume_each(samples_remaining);
} }
estimate_Doppler(); //disabled in repo estimate_Doppler(); //disabled in repo
@ -579,7 +579,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
d_state = 0; d_state = 0;
if (!acq_parameters.blocking_on_standby) if (!acq_parameters.blocking_on_standby)
{ {
d_sample_counter += noutput_items; // sample counter d_sample_counter += static_cast<uint64_t>(noutput_items); // sample counter
consume_each(noutput_items); consume_each(noutput_items);
} }
break; break;
@ -603,7 +603,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
d_state = 0; d_state = 0;
if (!acq_parameters.blocking_on_standby) if (!acq_parameters.blocking_on_standby)
{ {
d_sample_counter += noutput_items; // sample counter d_sample_counter += static_cast<uint64_t>(noutput_items); // sample counter
consume_each(noutput_items); consume_each(noutput_items);
} }
break; break;
@ -611,7 +611,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
d_state = 0; d_state = 0;
if (!acq_parameters.blocking_on_standby) if (!acq_parameters.blocking_on_standby)
{ {
d_sample_counter += noutput_items; // sample counter d_sample_counter += static_cast<uint64_t>(noutput_items); // sample counter
consume_each(noutput_items); consume_each(noutput_items);
} }
break; break;

View File

@ -62,18 +62,18 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block(
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
acq_parameters = conf_; acq_parameters = conf_;
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_state = 0; d_state = 0;
//d_fft_size = acq_parameters.sampled_ms * acq_parameters.samples_per_ms; //d_fft_size = acq_parameters.sampled_ms * acq_parameters.samples_per_ms;
d_fft_size = acq_parameters.samples_per_code; d_fft_size = acq_parameters.samples_per_code;
d_mag = 0; d_mag = 0;
d_input_power = 0.0; d_input_power = 0.0;
d_num_doppler_bins = 0; d_num_doppler_bins = 0U;
d_threshold = 0.0; d_threshold = 0.0;
d_doppler_step = 0; d_doppler_step = 0U;
d_test_statistics = 0.0; d_test_statistics = 0.0;
d_channel = 0; d_channel = 0U;
d_gnss_synchro = 0; d_gnss_synchro = 0;
//printf("zzzz acq_parameters.code_length = %d\n", acq_parameters.code_length); //printf("zzzz acq_parameters.code_length = %d\n", acq_parameters.code_length);
@ -207,7 +207,7 @@ void pcps_acquisition_fpga::set_active(bool active)
d_active = active; d_active = active;
// initialize acquisition algorithm // initialize acquisition algorithm
uint32_t indext = 0; uint32_t indext = 0U;
float magt = 0.0; float magt = 0.0;
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size); float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);

View File

@ -64,7 +64,7 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc(
gr::io_signature::make(0, 0, sizeof(gr_complex))) gr::io_signature::make(0, 0, sizeof(gr_complex)))
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_fs_in = fs_in; d_fs_in = fs_in;
d_samples_per_ms = samples_per_ms; d_samples_per_ms = samples_per_ms;
@ -380,14 +380,14 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
{ {
case 0: // S0. StandBy case 0: // S0. StandBy
if (d_active == true) d_state = 1; if (d_active == true) d_state = 1;
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
break; break;
case 1: // S1. GetAssist case 1: // S1. GetAssist
get_assistance(); get_assistance();
redefine_grid(); redefine_grid();
reset_grid(); reset_grid();
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
d_state = 2; d_state = 2;
break; break;
@ -399,7 +399,7 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
{ {
d_state = 3; d_state = 3;
} }
d_sample_counter += consumed_samples; d_sample_counter += static_cast<uint64_t>(consumed_samples);
consume_each(consumed_samples); consume_each(consumed_samples);
break; break;
case 3: // Compute test statistics and decide case 3: // Compute test statistics and decide
@ -422,14 +422,14 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
d_state = 6; d_state = 6;
} }
} }
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
break; break;
case 4: // RedefineGrid case 4: // RedefineGrid
free_grid_memory(); free_grid_memory();
redefine_grid(); redefine_grid();
reset_grid(); reset_grid();
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
d_state = 2; d_state = 2;
break; break;
@ -447,7 +447,7 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
this->message_port_pub(pmt::mp("events"), pmt::from_long(1)); this->message_port_pub(pmt::mp("events"), pmt::from_long(1));
free_grid_memory(); free_grid_memory();
// consume samples to not block the GNU Radio flowgraph // consume samples to not block the GNU Radio flowgraph
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
d_state = 0; d_state = 0;
break; break;
@ -465,7 +465,7 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items,
this->message_port_pub(pmt::mp("events"), pmt::from_long(2)); this->message_port_pub(pmt::mp("events"), pmt::from_long(2));
free_grid_memory(); free_grid_memory();
// consume samples to not block the GNU Radio flowgraph // consume samples to not block the GNU Radio flowgraph
d_sample_counter += ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
d_state = 0; d_state = 0;
break; break;

View File

@ -67,7 +67,7 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc(
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms)) gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_fs_in = fs_in; d_fs_in = fs_in;
@ -243,7 +243,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
d_state = 1; d_state = 1;
} }
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
break; break;
@ -262,7 +262,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]); //Get the input samples pointer
float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size); float fft_normalization_factor = static_cast<float>(d_fft_size) * static_cast<float>(d_fft_size);
d_sample_counter += d_fft_size; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size); // sample counter
d_well_count++; d_well_count++;
@ -406,7 +406,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
acquisition_message = 1; acquisition_message = 1;
@ -431,7 +431,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
acquisition_message = 2; acquisition_message = 2;

View File

@ -93,7 +93,7 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms)) gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_core_working = false; d_core_working = false;
@ -719,7 +719,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
d_state = 1; d_state = 1;
} }
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
break; break;
} }
@ -736,20 +736,20 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
{ {
memcpy(d_in_buffer[d_in_dwell_count++], static_cast<const gr_complex *>(input_items[i]), memcpy(d_in_buffer[d_in_dwell_count++], static_cast<const gr_complex *>(input_items[i]),
sizeof(gr_complex) * d_fft_size); sizeof(gr_complex) * d_fft_size);
d_sample_counter += d_fft_size; d_sample_counter += static_cast<uint64_t>(d_fft_size);
d_sample_counter_buffer.push_back(d_sample_counter); d_sample_counter_buffer.push_back(d_sample_counter);
} }
if (ninput_items[0] > static_cast<int>(num_dwells)) if (ninput_items[0] > static_cast<int>(num_dwells))
{ {
d_sample_counter += d_fft_size * (ninput_items[0] - num_dwells); d_sample_counter += static_cast<uint64_t>(d_fft_size * (ninput_items[0] - num_dwells));
} }
} }
else else
{ {
// We already have d_max_dwells consecutive blocks in the internal buffer, // We already have d_max_dwells consecutive blocks in the internal buffer,
// just skip input blocks. // just skip input blocks.
d_sample_counter += d_fft_size * ninput_items[0]; d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]);
} }
// We create a new thread to process next block if the following // We create a new thread to process next block if the following
@ -793,7 +793,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
acquisition_message = 1; acquisition_message = 1;
this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message)); this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message));
@ -817,7 +817,7 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
acquisition_message = 2; acquisition_message = 2;
this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message)); this->message_port_pub(pmt::mp("events"), pmt::from_long(acquisition_message));

View File

@ -73,7 +73,7 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc(
gr::io_signature::make(0, 0, (sizeof(gr_complex) * sampled_ms * samples_per_ms))) gr::io_signature::make(0, 0, (sizeof(gr_complex) * sampled_ms * samples_per_ms)))
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_fs_in = fs_in; d_fs_in = fs_in;
@ -288,7 +288,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
d_state = 1; d_state = 1;
} }
d_sample_counter += d_sampled_ms * d_samples_per_ms * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_sampled_ms * d_samples_per_ms * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
//DLOG(INFO) << "END CASE 0"; //DLOG(INFO) << "END CASE 0";
break; break;
@ -324,7 +324,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
d_test_statistics = 0.0; d_test_statistics = 0.0;
d_noise_floor_power = 0.0; d_noise_floor_power = 0.0;
d_sample_counter += d_sampled_ms * d_samples_per_ms; // sample counter d_sample_counter += static_cast<uint64_t>(d_sampled_ms * d_samples_per_ms); // sample counter
d_well_count++; d_well_count++;
@ -536,7 +536,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_sampled_ms * d_samples_per_ms * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_sampled_ms * d_samples_per_ms * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
acquisition_message = 1; acquisition_message = 1;
@ -565,7 +565,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_sampled_ms * d_samples_per_ms * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_sampled_ms * d_samples_per_ms * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
acquisition_message = 2; acquisition_message = 2;

View File

@ -82,7 +82,7 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc(
gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms)) gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms))
{ {
this->message_port_register_out(pmt::mp("events")); this->message_port_register_out(pmt::mp("events"));
d_sample_counter = 0; // SAMPLE COUNTER d_sample_counter = 0ULL; // SAMPLE COUNTER
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_fs_in = fs_in; d_fs_in = fs_in;
@ -268,7 +268,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
d_state = 1; d_state = 1;
} }
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
break; break;
@ -285,7 +285,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
d_input_power = 0.0; d_input_power = 0.0;
d_mag = 0.0; d_mag = 0.0;
d_sample_counter += d_fft_size; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size); // sample counter
d_dwell_count++; d_dwell_count++;
@ -407,7 +407,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
acquisition_message = 1; acquisition_message = 1;
@ -432,7 +432,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
d_active = false; d_active = false;
d_state = 0; d_state = 0;
d_sample_counter += d_fft_size * ninput_items[0]; // sample counter d_sample_counter += static_cast<uint64_t>(d_fft_size * ninput_items[0]); // sample counter
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
acquisition_message = 2; acquisition_message = 2;

View File

@ -34,14 +34,14 @@
Acq_Conf::Acq_Conf() Acq_Conf::Acq_Conf()
{ {
/* PCPS acquisition configuration */ /* PCPS acquisition configuration */
sampled_ms = 0; sampled_ms = 0U;
ms_per_code = 0; ms_per_code = 0U;
max_dwells = 0; max_dwells = 0U;
samples_per_chip = 0; samples_per_chip = 0U;
doppler_max = 0; doppler_max = 0U;
num_doppler_bins_step2 = 0; num_doppler_bins_step2 = 0U;
doppler_step2 = 0.0; doppler_step2 = 0.0;
fs_in = 0; fs_in = 0LL;
samples_per_ms = 0.0; samples_per_ms = 0.0;
samples_per_code = 0.0; samples_per_code = 0.0;
bit_transition_flag = false; bit_transition_flag = false;
@ -50,7 +50,7 @@ Acq_Conf::Acq_Conf()
blocking = false; blocking = false;
make_2_steps = false; make_2_steps = false;
dump_filename = ""; dump_filename = "";
dump_channel = 0; dump_channel = 0U;
it_size = sizeof(char); it_size = sizeof(char);
blocking_on_standby = false; blocking_on_standby = false;
} }

View File

@ -62,7 +62,7 @@ hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in,
d_nchannels_out = nchannels_out; d_nchannels_out = nchannels_out;
d_nchannels_in = nchannels_in; d_nchannels_in = nchannels_in;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
T_rx_clock_step_samples = 0; T_rx_clock_step_samples = 0U;
d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(500, d_nchannels_out); d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(500, d_nchannels_out);
// ############# ENABLE DATA FILE LOG ################# // ############# ENABLE DATA FILE LOG #################
@ -83,8 +83,8 @@ hybrid_observables_cc::hybrid_observables_cc(uint32_t nchannels_in,
} }
} }
} }
T_rx_TOW_ms = 0; T_rx_TOW_ms = 0U;
T_rx_TOW_offset_ms = 0; T_rx_TOW_offset_ms = 0U;
T_rx_TOW_set = false; T_rx_TOW_set = false;
// rework // rework
@ -134,7 +134,7 @@ int32_t hybrid_observables_cc::save_matfile()
return 1; return 1;
} }
// count number of epochs and rewind // count number of epochs and rewind
int64_t num_epoch = 0; int64_t num_epoch = 0LL;
if (dump_file.is_open()) if (dump_file.is_open())
{ {
size = dump_file.tellg(); size = dump_file.tellg();
@ -215,7 +215,7 @@ int32_t hybrid_observables_cc::save_matfile()
double *Pseudorange_m_aux = new double[d_nchannels_out * num_epoch]; double *Pseudorange_m_aux = new double[d_nchannels_out * num_epoch];
double *PRN_aux = new double[d_nchannels_out * num_epoch]; double *PRN_aux = new double[d_nchannels_out * num_epoch];
double *Flag_valid_pseudorange_aux = new double[d_nchannels_out * num_epoch]; double *Flag_valid_pseudorange_aux = new double[d_nchannels_out * num_epoch];
uint32_t k = 0; uint32_t k = 0U;
for (int64_t j = 0; j < num_epoch; j++) for (int64_t j = 0; j < num_epoch; j++)
{ {
for (uint32_t i = 0; i < d_nchannels_out; i++) for (uint32_t i = 0; i < d_nchannels_out; i++)
@ -316,11 +316,11 @@ bool hybrid_observables_cc::interp_trk_obs(Gnss_Synchro &interpolated_obs, const
int64_t old_abs_diff = std::numeric_limits<int64_t>::max(); int64_t old_abs_diff = std::numeric_limits<int64_t>::max();
for (uint32_t i = 0; i < d_gnss_synchro_history->size(ch); i++) for (uint32_t i = 0; i < d_gnss_synchro_history->size(ch); i++)
{ {
abs_diff = labs(static_cast<int64_t>(rx_clock) - static_cast<int64_t>(d_gnss_synchro_history->at(ch, i).Tracking_sample_counter)); abs_diff = llabs(static_cast<int64_t>(rx_clock) - static_cast<int64_t>(d_gnss_synchro_history->at(ch, i).Tracking_sample_counter));
if (old_abs_diff > abs_diff) if (old_abs_diff > abs_diff)
{ {
old_abs_diff = abs_diff; old_abs_diff = abs_diff;
nearest_element = i; nearest_element = static_cast<int32_t>(i);
} }
} }
@ -419,7 +419,7 @@ void hybrid_observables_cc::update_TOW(std::vector<Gnss_Synchro> &data)
// if (!T_rx_TOW_set) // if (!T_rx_TOW_set)
// { // {
//uint32_t TOW_ref = std::numeric_limits<uint32_t>::max(); //uint32_t TOW_ref = std::numeric_limits<uint32_t>::max();
uint32_t TOW_ref = 0; uint32_t TOW_ref = 0U;
for (it = data.begin(); it != data.end(); it++) for (it = data.begin(); it != data.end(); it++)
{ {
if (it->Flag_valid_word) if (it->Flag_valid_word)

View File

@ -72,7 +72,7 @@ void dll_pll_veml_tracking::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(trk_parameters.vector_length) * 2; ninput_items_required[0] = static_cast<int32_t>(trk_parameters.vector_length) * 2;
} }
} }
@ -92,7 +92,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_veml = false; d_veml = false;
d_cloop = true; d_cloop = true;
d_code_chip_rate = 0.0; d_code_chip_rate = 0.0;
d_secondary_code_length = 0; d_secondary_code_length = 0U;
d_secondary_code_string = nullptr; d_secondary_code_string = nullptr;
d_gps_l1ca_preambles_symbols = nullptr; d_gps_l1ca_preambles_symbols = nullptr;
signal_type = std::string(trk_parameters.signal); signal_type = std::string(trk_parameters.signal);
@ -197,8 +197,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
interchange_iq = false; interchange_iq = false;
d_signal_carrier_freq = 0.0; d_signal_carrier_freq = 0.0;
d_code_period = 0.0; d_code_period = 0.0;
d_code_length_chips = 0; d_code_length_chips = 0U;
d_code_samples_per_chip = 0; d_code_samples_per_chip = 0U;
d_symbols_per_bit = 0; d_symbols_per_bit = 0;
} }
} }
@ -262,8 +262,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
interchange_iq = false; interchange_iq = false;
d_signal_carrier_freq = 0.0; d_signal_carrier_freq = 0.0;
d_code_period = 0.0; d_code_period = 0.0;
d_code_length_chips = 0; d_code_length_chips = 0U;
d_code_samples_per_chip = 0; d_code_samples_per_chip = 0U;
d_symbols_per_bit = 0; d_symbols_per_bit = 0;
} }
} }
@ -276,8 +276,8 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
interchange_iq = false; interchange_iq = false;
d_signal_carrier_freq = 0.0; d_signal_carrier_freq = 0.0;
d_code_period = 0.0; d_code_period = 0.0;
d_code_length_chips = 0; d_code_length_chips = 0U;
d_code_samples_per_chip = 0; d_code_samples_per_chip = 0U;
d_symbols_per_bit = 0; d_symbols_per_bit = 0;
} }
T_chip_seconds = 0.0; T_chip_seconds = 0.0;
@ -286,7 +286,6 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
K_blk_samples = 0.0; K_blk_samples = 0.0;
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_code_loop_filter.set_DLL_BW(trk_parameters.dll_bw_hz); d_code_loop_filter.set_DLL_BW(trk_parameters.dll_bw_hz);
d_carrier_loop_filter.set_PLL_BW(trk_parameters.pll_bw_hz); d_carrier_loop_filter.set_PLL_BW(trk_parameters.pll_bw_hz);
d_code_loop_filter = Tracking_2nd_DLL_filter(static_cast<float>(d_code_period)); d_code_loop_filter = Tracking_2nd_DLL_filter(static_cast<float>(d_code_period));
@ -310,7 +309,6 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment())); d_local_code_shift_chips = static_cast<float *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment()));
// map memory pointers of correlator outputs // map memory pointers of correlator outputs
if (d_veml) if (d_veml)
{ {
@ -373,10 +371,10 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::bl
d_rem_carr_phase_rad = 0.0; d_rem_carr_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; d_sample_counter = 0ULL;
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0ULL;
d_current_prn_length_samples = static_cast<int>(trk_parameters.vector_length); d_current_prn_length_samples = static_cast<int32_t>(trk_parameters.vector_length);
// CN0 estimation and lock detector buffers // CN0 estimation and lock detector buffers
d_cn0_estimation_counter = 0; d_cn0_estimation_counter = 0;
@ -640,7 +638,7 @@ bool dll_pll_veml_tracking::acquire_secondary()
} }
} }
if (abs(corr_value) == static_cast<int>(d_secondary_code_length)) if (abs(corr_value) == static_cast<int32_t>(d_secondary_code_length))
{ {
return true; return true;
} }
@ -788,8 +786,8 @@ void dll_pll_veml_tracking::update_tracking_vars()
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation // Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
T_prn_samples = T_prn_seconds * trk_parameters.fs_in; T_prn_samples = T_prn_seconds * trk_parameters.fs_in;
K_blk_samples = T_prn_samples + d_rem_code_phase_samples; K_blk_samples = T_prn_samples + d_rem_code_phase_samples;
//d_current_prn_length_samples = static_cast<int>(round(K_blk_samples)); // round to a discrete number of samples //d_current_prn_length_samples = static_cast<int32_t>(round(K_blk_samples)); // round to a discrete number of samples
d_current_prn_length_samples = static_cast<int>(std::floor(K_blk_samples)); // round to a discrete number of samples d_current_prn_length_samples = static_cast<int32_t>(std::floor(K_blk_samples)); // round to a discrete number of samples
//################### PLL COMMANDS ################################################# //################### PLL COMMANDS #################################################
// carrier phase step (NCO phase increment per sample) [rads/sample] // carrier phase step (NCO phase increment per sample) [rads/sample]
@ -937,7 +935,7 @@ void dll_pll_veml_tracking::log_data(bool integrating)
d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float)); d_dump_file.write(reinterpret_cast<char *>(&prompt_I), sizeof(float));
d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float)); d_dump_file.write(reinterpret_cast<char *>(&prompt_Q), sizeof(float));
// PRN start sample stamp // PRN start sample stamp
tmp_long_int = d_sample_counter + d_current_prn_length_samples; tmp_long_int = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_long_int), sizeof(uint64_t)); d_dump_file.write(reinterpret_cast<char *>(&tmp_long_int), sizeof(uint64_t));
// accumulated carrier phase // accumulated carrier phase
tmp_float = d_acc_carrier_phase_rad; tmp_float = d_acc_carrier_phase_rad;
@ -1248,7 +1246,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
{ {
case 0: // Standby - Consume samples at full throttle, do nothing case 0: // Standby - Consume samples at full throttle, do nothing
{ {
d_sample_counter += ninput_items[0]; d_sample_counter += static_cast<uint64_t>(ninput_items[0]);
consume_each(ninput_items[0]); consume_each(ninput_items[0]);
return 0; return 0;
break; break;
@ -1256,7 +1254,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
case 1: // Pull-in case 1: // Pull-in
{ {
// Signal alignment (skip samples until the incoming signal is aligned with local replica) // Signal alignment (skip samples until the incoming signal is aligned with local replica)
uint64_t acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; uint64_t acq_to_trk_delay_samples = static_cast<uint64_t>(d_sample_counter - d_acq_sample_stamp);
double acq_trk_shif_correction_samples = static_cast<double>(d_current_prn_length_samples) - std::fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_current_prn_length_samples)); double acq_trk_shif_correction_samples = static_cast<double>(d_current_prn_length_samples) - std::fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_current_prn_length_samples));
int32_t samples_offset = std::round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); int32_t samples_offset = std::round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
if (samples_offset < 0) if (samples_offset < 0)
@ -1265,7 +1263,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
} }
d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * d_acq_code_phase_samples; d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * d_acq_code_phase_samples;
d_state = 2; d_state = 2;
d_sample_counter += samples_offset; // count for the processed samples d_sample_counter += static_cast<uint64_t>(samples_offset); // count for the processed samples
consume_each(samples_offset); // shift input to perform alignment with local replica consume_each(samples_offset); // shift input to perform alignment with local replica
return 0; return 0;
} }
@ -1410,10 +1408,10 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
d_carrier_loop_filter.set_pdi(new_correlation_time); d_carrier_loop_filter.set_pdi(new_correlation_time);
d_code_loop_filter.set_pdi(new_correlation_time); d_code_loop_filter.set_pdi(new_correlation_time);
d_state = 3; // next state is the extended correlator integrator d_state = 3; // next state is the extended correlator integrator
LOG(INFO) << "Enabled " << trk_parameters.extend_correlation_symbols * static_cast<int>(d_code_period * 1000.0) << " ms extended correlator in channel " LOG(INFO) << "Enabled " << trk_parameters.extend_correlation_symbols * static_cast<int32_t>(d_code_period * 1000.0) << " ms extended correlator in channel "
<< d_channel << d_channel
<< " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN); << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN);
std::cout << "Enabled " << trk_parameters.extend_correlation_symbols * static_cast<int>(d_code_period * 1000.0) << " ms extended correlator in channel " std::cout << "Enabled " << trk_parameters.extend_correlation_symbols * static_cast<int32_t>(d_code_period * 1000.0) << " ms extended correlator in channel "
<< d_channel << d_channel
<< " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl; << " for satellite " << Gnss_Satellite(systemName, d_acquisition_gnss_synchro->PRN) << std::endl;
// Set narrow taps delay values [chips] // Set narrow taps delay values [chips]

View File

@ -97,7 +97,6 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
signal_pretty_name = map_signal_pretty_name[signal_type]; signal_pretty_name = map_signal_pretty_name[signal_type];
d_prompt_data_shift = nullptr; d_prompt_data_shift = nullptr;
if (trk_parameters.system == 'G') if (trk_parameters.system == 'G')
@ -281,7 +280,6 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
K_blk_samples = 0.0; K_blk_samples = 0.0;
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_code_loop_filter = Tracking_2nd_DLL_filter(static_cast<float>(d_code_period)); d_code_loop_filter = Tracking_2nd_DLL_filter(static_cast<float>(d_code_period));
d_carrier_loop_filter = Tracking_2nd_PLL_filter(static_cast<float>(d_code_period)); d_carrier_loop_filter = Tracking_2nd_PLL_filter(static_cast<float>(d_code_period));
d_carrier_loop_filter.set_PLL_BW(trk_parameters.pll_bw_hz); d_carrier_loop_filter.set_PLL_BW(trk_parameters.pll_bw_hz);
@ -372,9 +370,9 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
d_rem_carr_phase_rad = 0.0; d_rem_carr_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; d_sample_counter = 0ULL;
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0ULL;
d_absolute_samples_offset = 0; d_absolute_samples_offset = 0ULL;
d_current_prn_length_samples = static_cast<int32_t>(trk_parameters.vector_length); d_current_prn_length_samples = static_cast<int32_t>(trk_parameters.vector_length);
d_next_prn_length_samples = d_current_prn_length_samples; d_next_prn_length_samples = d_current_prn_length_samples;
@ -424,6 +422,7 @@ dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(const Dll_Pll_Conf_Fpga &
d_pull_in = 0; d_pull_in = 0;
} }
void dll_pll_veml_tracking_fpga::start_tracking() void dll_pll_veml_tracking_fpga::start_tracking()
{ {
// correct the code phase according to the delay between acq and trk // correct the code phase according to the delay between acq and trk
@ -565,6 +564,7 @@ void dll_pll_veml_tracking_fpga::start_tracking()
d_state = 1; d_state = 1;
} }
dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga() dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga()
{ {
if (signal_type.compare("1C") == 0) if (signal_type.compare("1C") == 0)
@ -646,7 +646,6 @@ bool dll_pll_veml_tracking_fpga::acquire_secondary()
// if (abs(corr_value) == d_secondary_code_length) // if (abs(corr_value) == d_secondary_code_length)
if (abs(corr_value) == static_cast<int32_t>(d_secondary_code_length)) if (abs(corr_value) == static_cast<int32_t>(d_secondary_code_length))
{ {
return true; return true;
} }
@ -851,7 +850,7 @@ void dll_pll_veml_tracking_fpga::log_data(bool integrating)
float tmp_VE, tmp_E, tmp_P, tmp_L, tmp_VL; float tmp_VE, tmp_E, tmp_P, tmp_L, tmp_VL;
float tmp_float; float tmp_float;
double tmp_double; double tmp_double;
int64_t tmp_long_int; uint64_t tmp_long_int;
if (trk_parameters.track_pilot) if (trk_parameters.track_pilot)
{ {
if (interchange_iq) if (interchange_iq)
@ -1182,6 +1181,7 @@ int32_t dll_pll_veml_tracking_fpga::save_matfile()
return 0; return 0;
} }
void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel) void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
@ -1208,6 +1208,7 @@ void dll_pll_veml_tracking_fpga::set_channel(uint32_t channel)
} }
} }
void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro) void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro *p_gnss_synchro)
{ {
d_acquisition_gnss_synchro = p_gnss_synchro; d_acquisition_gnss_synchro = p_gnss_synchro;
@ -1235,7 +1236,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
current_synchro_data.Tracking_sample_counter = 0; // in order to reduce computational workload do not read the sample counter until we start tracking d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = 0ULL; // in order to reduce computational workload do not read the sample counter until we start tracking d_sample_counter + d_current_prn_length_samples;
current_synchro_data.System = {'G'}; current_synchro_data.System = {'G'};
current_synchro_data.correlation_length_ms = 1; current_synchro_data.correlation_length_ms = 1;
break; break;
@ -1251,7 +1252,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
//printf("333333 d_correlation_length_samples = %d\n", d_correlation_length_samples); //printf("333333 d_correlation_length_samples = %d\n", d_correlation_length_samples);
uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples - current_synchro_data.Acq_delay_samples) / d_correlation_length_samples); uint32_t num_frames = ceil((counter_value - current_synchro_data.Acq_samplestamp_samples - current_synchro_data.Acq_delay_samples) / d_correlation_length_samples);
//printf("333333 num_frames = %d\n", num_frames); //printf("333333 num_frames = %d\n", num_frames);
uint64_t absolute_samples_offset = current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples; uint64_t absolute_samples_offset = static_cast<uint64_t>(current_synchro_data.Acq_delay_samples + current_synchro_data.Acq_samplestamp_samples + num_frames * d_correlation_length_samples);
//printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset); //printf("333333 absolute_samples_offset = %llu\n", absolute_samples_offset);
multicorrelator_fpga->set_initial_sample(absolute_samples_offset); multicorrelator_fpga->set_initial_sample(absolute_samples_offset);
d_absolute_samples_offset = absolute_samples_offset; d_absolute_samples_offset = absolute_samples_offset;
@ -1266,7 +1267,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
case 2: case 2:
{ {
d_sample_counter = d_sample_counter_next; d_sample_counter = d_sample_counter_next;
d_sample_counter_next = d_sample_counter + d_current_prn_length_samples; d_sample_counter_next = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
// ################# CARRIER WIPEOFF AND CORRELATORS ############################## // ################# CARRIER WIPEOFF AND CORRELATORS ##############################
// perform carrier wipe-off and compute Early, Prompt and Late correlation // perform carrier wipe-off and compute Early, Prompt and Late correlation
@ -1424,7 +1425,6 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
current_synchro_data.Flag_valid_symbol_output = true; current_synchro_data.Flag_valid_symbol_output = true;
current_synchro_data.correlation_length_ms = d_correlation_length_ms; current_synchro_data.correlation_length_ms = d_correlation_length_ms;
if (next_state) if (next_state)
{ // reset extended correlator { // reset extended correlator
d_VE_accu = gr_complex(0.0, 0.0); d_VE_accu = gr_complex(0.0, 0.0);
@ -1540,7 +1540,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
case 4: // narrow tracking case 4: // narrow tracking
{ {
d_sample_counter = d_sample_counter_next; d_sample_counter = d_sample_counter_next;
d_sample_counter_next = d_sample_counter + d_current_prn_length_samples; d_sample_counter_next = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
// perform a correlation step // perform a correlation step
//do_correlation_step(in); //do_correlation_step(in);
@ -1616,13 +1616,14 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un
if (current_synchro_data.Flag_valid_symbol_output) if (current_synchro_data.Flag_valid_symbol_output)
{ {
current_synchro_data.fs = static_cast<int64_t>(trk_parameters.fs_in); current_synchro_data.fs = static_cast<int64_t>(trk_parameters.fs_in);
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
*out[0] = current_synchro_data; *out[0] = current_synchro_data;
return 1; return 1;
} }
return 0; return 0;
} }
void dll_pll_veml_tracking_fpga::reset(void) void dll_pll_veml_tracking_fpga::reset(void)
{ {
multicorrelator_fpga->unlock_channel(); multicorrelator_fpga->unlock_channel();

View File

@ -61,7 +61,7 @@ using google::LogMessage;
galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -80,14 +80,14 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; // set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; // set the required available samples in each call
} }
} }
Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz __attribute__((unused)), float pll_bw_hz __attribute__((unused)),
@ -123,7 +123,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 5; // Very-Early, Early, Prompt, Late, Very-Late d_n_correlator_taps = 5; // Very-Early, Early, Prompt, Late, Very-Late
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -155,13 +155,13 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
d_rem_carr_phase_rad = 0.0; d_rem_carr_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; d_sample_counter = 0ULL;
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
d_current_prn_length_samples = static_cast<int>(d_vector_length); d_current_prn_length_samples = static_cast<int32_t>(d_vector_length);
// CN0 estimation and lock detector buffers // CN0 estimation and lock detector buffers
d_cn0_estimation_counter = 0; d_cn0_estimation_counter = 0;
@ -199,8 +199,8 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking()
2 * Galileo_E1_CODE_CHIP_RATE_HZ, 2 * Galileo_E1_CODE_CHIP_RATE_HZ,
0); 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(2 * Galileo_E1_B_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(2 * Galileo_E1_B_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -258,7 +258,7 @@ Galileo_E1_Tcp_Connector_Tracking_cc::~Galileo_E1_Tcp_Connector_Tracking_cc()
} }
void Galileo_E1_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel) void Galileo_E1_Tcp_Connector_Tracking_cc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -319,16 +319,16 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri
/* /*
* Signal alignment (skip samples until the incoming signal is aligned with local replica) * Signal alignment (skip samples until the incoming signal is aligned with local replica)
*/ */
int samples_offset; int32_t samples_offset;
float acq_trk_shif_correction_samples; float acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples)); acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples d_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset); //count for the processed samples
d_pull_in = false; d_pull_in = false;
consume_each(samples_offset); //shift input to perform alignment with local replica consume_each(samples_offset); //shift input to perform alignment with local replica
return 1; return 1;
@ -444,7 +444,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri
current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt).real()); current_synchro_data.Prompt_I = static_cast<double>((*d_Prompt).real());
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag()); current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag());
// Tracking_timestamp_secs is aligned with the PRN start sample // Tracking_timestamp_secs is aligned with the PRN start sample
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
current_synchro_data.Carrier_phase_rads = static_cast<double>(d_acc_carrier_phase_rad); current_synchro_data.Carrier_phase_rads = static_cast<double>(d_acc_carrier_phase_rad);
@ -458,7 +458,7 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri
*d_Early = gr_complex(0, 0); *d_Early = gr_complex(0, 0);
*d_Prompt = gr_complex(0, 0); *d_Prompt = gr_complex(0, 0);
*d_Late = gr_complex(0, 0); *d_Late = gr_complex(0, 0);
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
//! When tracking is disabled an array of 1's is sent to maintain the TCP connection //! When tracking is disabled an array of 1's is sent to maintain the TCP connection
boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> tx_variables_array = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}}; boost::array<float, NUM_TX_VARIABLES_GALILEO_E1> tx_variables_array = {{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0}};
d_tcp_com.send_receive_tcp_packet_galileo_e1(tx_variables_array, &tcp_data); d_tcp_com.send_receive_tcp_packet_galileo_e1(tx_variables_array, &tcp_data);
@ -528,8 +528,8 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure &e) catch (const std::ifstream::failure &e)
{ {

View File

@ -55,7 +55,7 @@ typedef boost::shared_ptr<Galileo_E1_Tcp_Connector_Tracking_cc> galileo_e1_tcp_c
galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_tracking_cc_sptr
galileo_e1_tcp_connector_make_tracking_cc( galileo_e1_tcp_connector_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -73,7 +73,7 @@ class Galileo_E1_Tcp_Connector_Tracking_cc : public gr::block
public: public:
~Galileo_E1_Tcp_Connector_Tracking_cc(); ~Galileo_E1_Tcp_Connector_Tracking_cc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -85,7 +85,7 @@ public:
private: private:
friend galileo_e1_tcp_connector_tracking_cc_sptr friend galileo_e1_tcp_connector_tracking_cc_sptr
galileo_e1_tcp_connector_make_tracking_cc( galileo_e1_tcp_connector_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -95,7 +95,7 @@ private:
size_t port_ch0); size_t port_ch0);
Galileo_E1_Tcp_Connector_Tracking_cc( Galileo_E1_Tcp_Connector_Tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -109,16 +109,16 @@ private:
void update_local_carrier(); void update_local_carrier();
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro *d_acquisition_gnss_synchro; Gnss_Synchro *d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
int d_correlation_length_samples; int32_t d_correlation_length_samples;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
float d_early_late_spc_chips; float d_early_late_spc_chips;
float d_very_early_late_spc_chips; float d_very_early_late_spc_chips;
@ -152,25 +152,25 @@ private:
float d_code_phase_samples; float d_code_phase_samples;
size_t d_port_ch0; size_t d_port_ch0;
size_t d_port; size_t d_port;
int d_listen_connection; int32_t d_listen_connection;
float d_control_id; float d_control_id;
tcp_communication d_tcp_com; tcp_communication d_tcp_com;
//PRN period in samples //PRN period in samples
int d_current_prn_length_samples; int32_t d_current_prn_length_samples;
int d_next_prn_length_samples; int32_t d_next_prn_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex *d_Prompt_buffer; gr_complex *d_Prompt_buffer;
float d_carrier_lock_test; float d_carrier_lock_test;
float d_CN0_SNV_dB_Hz; float d_CN0_SNV_dB_Hz;
float d_carrier_lock_threshold; float d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;

View File

@ -63,14 +63,14 @@ using google::LogMessage;
glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr
glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) float early_late_space_chips)
{ {
return glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_cc( return glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_cc(
@ -83,7 +83,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
@ -103,14 +103,14 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm
glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc( glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) : gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), float early_late_space_chips) : gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
{ {
@ -126,7 +126,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc
d_fs_in = fs_in; d_fs_in = fs_in;
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_correlation_length_samples = static_cast<int>(d_vector_length); d_correlation_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_pll_bw_hz = pll_bw_hz; d_pll_bw_hz = pll_bw_hz;
@ -142,12 +142,12 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc
// Initialization of local code replica // Initialization of local code replica
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -168,7 +168,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc
d_rem_carrier_phase_rad = 0.0; d_rem_carrier_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; //(from trk to tlm) d_sample_counter = 0ULL; //(from trk to tlm)
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
@ -274,8 +274,8 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
glonass_l1_ca_code_gen_complex(d_ca_code, 0); glonass_l1_ca_code_gen_complex(d_ca_code, 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -348,14 +348,14 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::~glonass_l1_ca_dll_pll_c_aid_tracking_c
} }
int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() int32_t glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
std::ifstream::pos_type size; std::ifstream::pos_type size;
int number_of_double_vars = 11; int32_t number_of_double_vars = 11;
int number_of_float_vars = 5; int32_t number_of_float_vars = 5;
int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(unsigned int); sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file; std::ifstream dump_file;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try try
@ -396,7 +396,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
double *carrier_lock_test = new double[num_epoch]; double *carrier_lock_test = new double[num_epoch];
double *aux1 = new double[num_epoch]; double *aux1 = new double[num_epoch];
double *aux2 = new double[num_epoch]; double *aux2 = new double[num_epoch];
unsigned int *PRN = new unsigned int[num_epoch]; uint32_t *PRN = new uint32_t[num_epoch];
try try
{ {
@ -421,7 +421,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(unsigned int)); dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(uint32_t));
} }
} }
dump_file.close(); dump_file.close();
@ -555,7 +555,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
} }
void glonass_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(unsigned int channel) void glonass_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -609,14 +609,14 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples)); acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
d_sample_counter += samples_offset; // count for the processed samples d_sample_counter += static_cast<uint64_t>(samples_offset); // count for the processed samples
d_pull_in = false; d_pull_in = false;
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI; d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI; current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI;
@ -642,7 +642,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
d_P_history.push_back(d_correlator_outs[1]); // save prompt output d_P_history.push_back(d_correlator_outs[1]); // save prompt output
d_L_history.push_back(d_correlator_outs[2]); // save late output d_L_history.push_back(d_correlator_outs[2]); // save late output
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms) if (static_cast<int32_t>(d_P_history.size()) > d_extend_correlation_ms)
{ {
d_E_history.pop_front(); d_E_history.pop_front();
d_P_history.pop_front(); d_P_history.pop_front();
@ -661,7 +661,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
d_correlator_outs[0] = gr_complex(0.0, 0.0); d_correlator_outs[0] = gr_complex(0.0, 0.0);
d_correlator_outs[1] = gr_complex(0.0, 0.0); d_correlator_outs[1] = gr_complex(0.0, 0.0);
d_correlator_outs[2] = gr_complex(0.0, 0.0); d_correlator_outs[2] = gr_complex(0.0, 0.0);
for (int n = 0; n < d_extend_correlation_ms; n++) for (int32_t n = 0; n < d_extend_correlation_ms; n++)
{ {
d_correlator_outs[0] += d_E_history.at(n); d_correlator_outs[0] += d_E_history.at(n);
d_correlator_outs[1] += d_P_history.at(n); d_correlator_outs[1] += d_P_history.at(n);
@ -691,7 +691,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
double T_chip_seconds = 1.0 / d_code_freq_chips; double T_chip_seconds = 1.0 / d_code_freq_chips;
double T_prn_seconds = T_chip_seconds * GLONASS_L1_CA_CODE_LENGTH_CHIPS; double T_prn_seconds = T_chip_seconds * GLONASS_L1_CA_CODE_LENGTH_CHIPS;
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in); double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
int K_prn_samples = round(T_prn_samples); int32_t K_prn_samples = round(T_prn_samples);
double K_T_prn_error_samples = K_prn_samples - T_prn_samples; double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples; d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
@ -815,7 +815,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -834,7 +834,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
{ {
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
@ -843,13 +843,13 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
current_synchro_data.System = {'R'}; current_synchro_data.System = {'R'};
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
} }
//assign the GNURadio block output data //assign the GNURadio block output data
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
@ -910,8 +910,8 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure *e) catch (const std::ifstream::failure *e)
{ {

View File

@ -58,14 +58,14 @@ typedef boost::shared_ptr<glonass_l1_ca_dll_pll_c_aid_tracking_cc>
glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr
glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
@ -77,7 +77,7 @@ class glonass_l1_ca_dll_pll_c_aid_tracking_cc : public gr::block
public: public:
~glonass_l1_ca_dll_pll_c_aid_tracking_cc(); ~glonass_l1_ca_dll_pll_c_aid_tracking_cc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -89,39 +89,39 @@ public:
private: private:
friend glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr friend glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr
glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
glonass_l1_ca_dll_pll_c_aid_tracking_cc( glonass_l1_ca_dll_pll_c_aid_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro* d_acquisition_gnss_synchro; Gnss_Synchro* d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
double d_glonass_freq_ch; double d_glonass_freq_ch;
double d_early_late_spc_chips; double d_early_late_spc_chips;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
gr_complex* d_ca_code; gr_complex* d_ca_code;
float* d_local_code_shift_chips; float* d_local_code_shift_chips;
@ -132,7 +132,7 @@ private:
double d_rem_code_phase_samples; double d_rem_code_phase_samples;
double d_rem_code_phase_chips; double d_rem_code_phase_chips;
double d_rem_carrier_phase_rad; double d_rem_carrier_phase_rad;
int d_rem_code_phase_integer_samples; int32_t d_rem_code_phase_integer_samples;
// PLL and DLL filter library // PLL and DLL filter library
//Tracking_2nd_DLL_filter d_code_loop_filter; //Tracking_2nd_DLL_filter d_code_loop_filter;
@ -167,25 +167,25 @@ private:
std::deque<gr_complex> d_P_history; std::deque<gr_complex> d_P_history;
std::deque<gr_complex> d_L_history; std::deque<gr_complex> d_L_history;
double d_preamble_timestamp_s; double d_preamble_timestamp_s;
int d_extend_correlation_ms; int32_t d_extend_correlation_ms;
bool d_enable_extended_integration; bool d_enable_extended_integration;
bool d_preamble_synchronized; bool d_preamble_synchronized;
void msg_handler_preamble_index(pmt::pmt_t msg); void msg_handler_preamble_index(pmt::pmt_t msg);
//Integration period in samples //Integration period in samples
int d_correlation_length_samples; int32_t d_correlation_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex* d_Prompt_buffer; gr_complex* d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;
@ -198,7 +198,7 @@ private:
std::map<std::string, std::string> systemName; std::map<std::string, std::string> systemName;
std::string sys; std::string sys;
int save_matfile(); int32_t save_matfile();
}; };
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H #endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H

View File

@ -61,14 +61,14 @@ using google::LogMessage;
glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) float early_late_space_chips)
{ {
return glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_sc( return glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_sc(
@ -81,7 +81,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
@ -100,14 +100,14 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm
glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc( glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) : gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), float early_late_space_chips) : gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
{ {
@ -121,7 +121,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
d_fs_in = fs_in; d_fs_in = fs_in;
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_correlation_length_samples = static_cast<int>(d_vector_length); d_correlation_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_pll_bw_hz = pll_bw_hz; d_pll_bw_hz = pll_bw_hz;
@ -137,14 +137,14 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
// Initialization of local code replica // Initialization of local code replica
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment())); d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment())); d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_cmake(0, 0); d_correlator_outs_16sc[n] = lv_cmake(0, 0);
} }
@ -166,7 +166,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc
d_rem_carrier_phase_rad = 0.0; d_rem_carrier_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; //(from trk to tlm) d_sample_counter = 0ULL; //(from trk to tlm)
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
@ -267,10 +267,10 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
glonass_l1_ca_code_gen_complex(d_ca_code, 0); glonass_l1_ca_code_gen_complex(d_ca_code, 0);
volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc, d_ca_code, static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS)); volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc, d_ca_code, static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS));
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips); multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_16sc_t(0, 0); d_correlator_outs_16sc[n] = lv_16sc_t(0, 0);
} }
@ -302,14 +302,14 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
} }
int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() int32_t glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
std::ifstream::pos_type size; std::ifstream::pos_type size;
int number_of_double_vars = 11; int32_t number_of_double_vars = 11;
int number_of_float_vars = 5; int32_t number_of_float_vars = 5;
int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(unsigned int); sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file; std::ifstream dump_file;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try try
@ -350,7 +350,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
double *carrier_lock_test = new double[num_epoch]; double *carrier_lock_test = new double[num_epoch];
double *aux1 = new double[num_epoch]; double *aux1 = new double[num_epoch];
double *aux2 = new double[num_epoch]; double *aux2 = new double[num_epoch];
unsigned int *PRN = new unsigned int[num_epoch]; uint32_t *PRN = new uint32_t[num_epoch];
try try
{ {
@ -375,7 +375,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(unsigned int)); dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(uint32_t));
} }
} }
dump_file.close(); dump_file.close();
@ -546,7 +546,7 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::~glonass_l1_ca_dll_pll_c_aid_tracking_s
} }
void glonass_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(unsigned int channel) void glonass_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -600,14 +600,14 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples)); acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
d_sample_counter += samples_offset; // count for the processed samples d_sample_counter += static_cast<uint64_t>(samples_offset); // count for the processed samples
d_pull_in = false; d_pull_in = false;
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI; d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI; current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI;
@ -633,7 +633,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms) if (static_cast<int32_t>(d_P_history.size()) > d_extend_correlation_ms)
{ {
d_E_history.pop_front(); d_E_history.pop_front();
d_P_history.pop_front(); d_P_history.pop_front();
@ -652,7 +652,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
d_correlator_outs_16sc[0] = lv_cmake(0, 0); d_correlator_outs_16sc[0] = lv_cmake(0, 0);
d_correlator_outs_16sc[1] = lv_cmake(0, 0); d_correlator_outs_16sc[1] = lv_cmake(0, 0);
d_correlator_outs_16sc[2] = lv_cmake(0, 0); d_correlator_outs_16sc[2] = lv_cmake(0, 0);
for (int n = 0; n < d_extend_correlation_ms; n++) for (int32_t n = 0; n < d_extend_correlation_ms; n++)
{ {
d_correlator_outs_16sc[0] += d_E_history.at(n); d_correlator_outs_16sc[0] += d_E_history.at(n);
d_correlator_outs_16sc[1] += d_P_history.at(n); d_correlator_outs_16sc[1] += d_P_history.at(n);
@ -681,7 +681,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
double T_chip_seconds = 1.0 / d_code_freq_chips; double T_chip_seconds = 1.0 / d_code_freq_chips;
double T_prn_seconds = T_chip_seconds * GLONASS_L1_CA_CODE_LENGTH_CHIPS; double T_prn_seconds = T_chip_seconds * GLONASS_L1_CA_CODE_LENGTH_CHIPS;
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in); double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
int K_prn_samples = round(T_prn_samples); int32_t K_prn_samples = round(T_prn_samples);
double K_T_prn_error_samples = K_prn_samples - T_prn_samples; double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples; d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
@ -805,7 +805,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag());
// Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!) // Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!)
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -824,7 +824,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
{ {
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
@ -833,13 +833,13 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_cmake(0, 0); d_correlator_outs_16sc[n] = lv_cmake(0, 0);
} }
current_synchro_data.System = {'R'}; current_synchro_data.System = {'R'};
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
} }
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;
@ -899,8 +899,8 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure *e) catch (const std::ifstream::failure *e)
{ {

View File

@ -59,14 +59,14 @@ typedef boost::shared_ptr<glonass_l1_ca_dll_pll_c_aid_tracking_sc>
glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
@ -78,7 +78,7 @@ class glonass_l1_ca_dll_pll_c_aid_tracking_sc : public gr::block
public: public:
~glonass_l1_ca_dll_pll_c_aid_tracking_sc(); ~glonass_l1_ca_dll_pll_c_aid_tracking_sc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -90,39 +90,39 @@ public:
private: private:
friend glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr friend glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr
glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
glonass_l1_ca_dll_pll_c_aid_tracking_sc( glonass_l1_ca_dll_pll_c_aid_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro* d_acquisition_gnss_synchro; Gnss_Synchro* d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
int64_t d_glonass_freq_ch; int64_t d_glonass_freq_ch;
double d_early_late_spc_chips; double d_early_late_spc_chips;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
gr_complex* d_ca_code; gr_complex* d_ca_code;
lv_16sc_t* d_ca_code_16sc; lv_16sc_t* d_ca_code_16sc;
@ -136,7 +136,7 @@ private:
double d_rem_code_phase_samples; double d_rem_code_phase_samples;
double d_rem_code_phase_chips; double d_rem_code_phase_chips;
double d_rem_carrier_phase_rad; double d_rem_carrier_phase_rad;
int d_rem_code_phase_integer_samples; int32_t d_rem_code_phase_integer_samples;
// PLL and DLL filter library // PLL and DLL filter library
Tracking_2nd_DLL_filter d_code_loop_filter; Tracking_2nd_DLL_filter d_code_loop_filter;
@ -163,7 +163,7 @@ private:
double d_carr_phase_error_secs_Ti; double d_carr_phase_error_secs_Ti;
double d_code_error_chips_Ti; double d_code_error_chips_Ti;
double d_preamble_timestamp_s; double d_preamble_timestamp_s;
int d_extend_correlation_ms; int32_t d_extend_correlation_ms;
bool d_enable_extended_integration; bool d_enable_extended_integration;
bool d_preamble_synchronized; bool d_preamble_synchronized;
double d_code_error_filt_chips_s; double d_code_error_filt_chips_s;
@ -176,19 +176,19 @@ private:
std::deque<lv_16sc_t> d_L_history; std::deque<lv_16sc_t> d_L_history;
//Integration period in samples //Integration period in samples
int d_correlation_length_samples; int32_t d_correlation_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex* d_Prompt_buffer; gr_complex* d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;
@ -201,7 +201,7 @@ private:
std::map<std::string, std::string> systemName; std::map<std::string, std::string> systemName;
std::string sys; std::string sys;
int save_matfile(); int32_t save_matfile();
}; };
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H #endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H

View File

@ -60,7 +60,7 @@ using google::LogMessage;
glonass_l1_ca_dll_pll_tracking_cc_sptr glonass_l1_ca_dll_pll_tracking_cc_sptr
glonass_l1_ca_dll_pll_make_tracking_cc( glonass_l1_ca_dll_pll_make_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -77,14 +77,14 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -100,7 +100,7 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_current_prn_length_samples = static_cast<int>(d_vector_length); d_current_prn_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_code_loop_filter.set_DLL_BW(dll_bw_hz); d_code_loop_filter.set_DLL_BW(dll_bw_hz);
@ -111,12 +111,12 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
// Initialization of local code replica // Initialization of local code replica
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -137,7 +137,7 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
d_rem_carr_phase_rad = 0.0; d_rem_carr_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; d_sample_counter = 0ULL;
//d_sample_counter_seconds = 0; //d_sample_counter_seconds = 0;
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
@ -229,8 +229,8 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
glonass_l1_ca_code_gen_complex(d_ca_code, 0); glonass_l1_ca_code_gen_complex(d_ca_code, 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -300,14 +300,14 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::~Glonass_L1_Ca_Dll_Pll_Tracking_cc()
} }
int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile() int32_t Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
std::ifstream::pos_type size; std::ifstream::pos_type size;
int number_of_double_vars = 11; int32_t number_of_double_vars = 11;
int number_of_float_vars = 5; int32_t number_of_float_vars = 5;
int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(unsigned int); sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file; std::ifstream dump_file;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try try
@ -348,7 +348,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
double *carrier_lock_test = new double[num_epoch]; double *carrier_lock_test = new double[num_epoch];
double *aux1 = new double[num_epoch]; double *aux1 = new double[num_epoch];
double *aux2 = new double[num_epoch]; double *aux2 = new double[num_epoch];
unsigned int *PRN = new unsigned int[num_epoch]; uint32_t *PRN = new uint32_t[num_epoch];
try try
{ {
@ -373,7 +373,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(unsigned int)); dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(uint32_t));
} }
} }
dump_file.close(); dump_file.close();
@ -507,7 +507,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::save_matfile()
} }
void Glonass_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel) void Glonass_L1_Ca_Dll_Pll_Tracking_cc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -562,14 +562,14 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples)); acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples d_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset); // count for the processed samples
d_pull_in = false; d_pull_in = false;
// take into account the carrier cycles accumulated in the pull in signal alignment // take into account the carrier cycles accumulated in the pull in signal alignment
d_acc_carrier_phase_rad -= d_carrier_doppler_phase_step_rad * samples_offset; d_acc_carrier_phase_rad -= d_carrier_doppler_phase_step_rad * samples_offset;
@ -673,7 +673,7 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad; current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -683,12 +683,12 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
current_synchro_data.System = {'R'}; current_synchro_data.System = {'R'};
current_synchro_data.correlation_length_ms = 1; current_synchro_data.correlation_length_ms = 1;
} }
@ -752,8 +752,8 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
double tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure &e) catch (const std::ifstream::failure &e)
{ {

View File

@ -55,7 +55,7 @@ typedef boost::shared_ptr<Glonass_L1_Ca_Dll_Pll_Tracking_cc>
glonass_l1_ca_dll_pll_tracking_cc_sptr glonass_l1_ca_dll_pll_tracking_cc_sptr
glonass_l1_ca_dll_pll_make_tracking_cc( glonass_l1_ca_dll_pll_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -71,7 +71,7 @@ class Glonass_L1_Ca_Dll_Pll_Tracking_cc : public gr::block
public: public:
~Glonass_L1_Ca_Dll_Pll_Tracking_cc(); ~Glonass_L1_Ca_Dll_Pll_Tracking_cc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -83,7 +83,7 @@ public:
private: private:
friend glonass_l1_ca_dll_pll_tracking_cc_sptr friend glonass_l1_ca_dll_pll_tracking_cc_sptr
glonass_l1_ca_dll_pll_make_tracking_cc( glonass_l1_ca_dll_pll_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -91,7 +91,7 @@ private:
float early_late_space_chips); float early_late_space_chips);
Glonass_L1_Ca_Dll_Pll_Tracking_cc( Glonass_L1_Ca_Dll_Pll_Tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -99,11 +99,11 @@ private:
float early_late_space_chips); float early_late_space_chips);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro* d_acquisition_gnss_synchro; Gnss_Synchro* d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
int64_t d_glonass_freq_ch; int64_t d_glonass_freq_ch;
@ -123,7 +123,7 @@ private:
double d_acq_code_phase_samples; double d_acq_code_phase_samples;
double d_acq_carrier_doppler_hz; double d_acq_carrier_doppler_hz;
// correlator // correlator
int d_n_correlator_taps; int32_t d_n_correlator_taps;
gr_complex* d_ca_code; gr_complex* d_ca_code;
float* d_local_code_shift_chips; float* d_local_code_shift_chips;
gr_complex* d_correlator_outs; gr_complex* d_correlator_outs;
@ -141,19 +141,19 @@ private:
double d_code_phase_samples; double d_code_phase_samples;
//PRN period in samples //PRN period in samples
int d_current_prn_length_samples; int32_t d_current_prn_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex* d_Prompt_buffer; gr_complex* d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;
@ -166,7 +166,7 @@ private:
std::map<std::string, std::string> systemName; std::map<std::string, std::string> systemName;
std::string sys; std::string sys;
int save_matfile(); int32_t save_matfile();
}; };
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_CC_H #endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_TRACKING_CC_H

View File

@ -60,14 +60,14 @@ using google::LogMessage;
glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr
glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( glonass_l2_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) float early_late_space_chips)
{ {
return glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_cc( return glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_cc(
@ -80,7 +80,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
@ -100,14 +100,14 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm
glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc( glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) : gr::block("glonass_l2_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), float early_late_space_chips) : gr::block("glonass_l2_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
{ {
@ -123,7 +123,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc
d_fs_in = fs_in; d_fs_in = fs_in;
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_correlation_length_samples = static_cast<int>(d_vector_length); d_correlation_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_pll_bw_hz = pll_bw_hz; d_pll_bw_hz = pll_bw_hz;
@ -139,12 +139,12 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc
// Initialization of local code replica // Initialization of local code replica
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -165,7 +165,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc
d_rem_carrier_phase_rad = 0.0; d_rem_carrier_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; //(from trk to tlm) d_sample_counter = 0ULL; //(from trk to tlm)
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
@ -271,8 +271,8 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
glonass_l2_ca_code_gen_complex(d_ca_code, 0); glonass_l2_ca_code_gen_complex(d_ca_code, 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -345,14 +345,14 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::~glonass_l2_ca_dll_pll_c_aid_tracking_c
} }
int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile() int32_t glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
std::ifstream::pos_type size; std::ifstream::pos_type size;
int number_of_double_vars = 11; int32_t number_of_double_vars = 11;
int number_of_float_vars = 5; int32_t number_of_float_vars = 5;
int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(unsigned int); sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file; std::ifstream dump_file;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try try
@ -393,7 +393,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile()
double *carrier_lock_test = new double[num_epoch]; double *carrier_lock_test = new double[num_epoch];
double *aux1 = new double[num_epoch]; double *aux1 = new double[num_epoch];
double *aux2 = new double[num_epoch]; double *aux2 = new double[num_epoch];
unsigned int *PRN = new unsigned int[num_epoch]; uint32_t *PRN = new uint32_t[num_epoch];
try try
{ {
@ -418,7 +418,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(unsigned int)); dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(uint32_t));
} }
} }
dump_file.close(); dump_file.close();
@ -552,7 +552,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::save_matfile()
} }
void glonass_l2_ca_dll_pll_c_aid_tracking_cc::set_channel(unsigned int channel) void glonass_l2_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -606,14 +606,14 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples)); acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
d_sample_counter += samples_offset; // count for the processed samples d_sample_counter += static_cast<uint64_t>(samples_offset); // count for the processed samples
d_pull_in = false; d_pull_in = false;
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI; d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI; current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI;
@ -639,7 +639,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
d_P_history.push_back(d_correlator_outs[1]); // save prompt output d_P_history.push_back(d_correlator_outs[1]); // save prompt output
d_L_history.push_back(d_correlator_outs[2]); // save late output d_L_history.push_back(d_correlator_outs[2]); // save late output
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms) if (static_cast<int32_t>(d_P_history.size()) > d_extend_correlation_ms)
{ {
d_E_history.pop_front(); d_E_history.pop_front();
d_P_history.pop_front(); d_P_history.pop_front();
@ -658,7 +658,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
d_correlator_outs[0] = gr_complex(0.0, 0.0); d_correlator_outs[0] = gr_complex(0.0, 0.0);
d_correlator_outs[1] = gr_complex(0.0, 0.0); d_correlator_outs[1] = gr_complex(0.0, 0.0);
d_correlator_outs[2] = gr_complex(0.0, 0.0); d_correlator_outs[2] = gr_complex(0.0, 0.0);
for (int n = 0; n < d_extend_correlation_ms; n++) for (int32_t n = 0; n < d_extend_correlation_ms; n++)
{ {
d_correlator_outs[0] += d_E_history.at(n); d_correlator_outs[0] += d_E_history.at(n);
d_correlator_outs[1] += d_P_history.at(n); d_correlator_outs[1] += d_P_history.at(n);
@ -688,7 +688,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
double T_chip_seconds = 1.0 / d_code_freq_chips; double T_chip_seconds = 1.0 / d_code_freq_chips;
double T_prn_seconds = T_chip_seconds * GLONASS_L2_CA_CODE_LENGTH_CHIPS; double T_prn_seconds = T_chip_seconds * GLONASS_L2_CA_CODE_LENGTH_CHIPS;
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in); double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
int K_prn_samples = round(T_prn_samples); int32_t K_prn_samples = round(T_prn_samples);
double K_T_prn_error_samples = K_prn_samples - T_prn_samples; double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples; d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
@ -812,7 +812,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -831,7 +831,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
{ {
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
@ -840,13 +840,13 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
current_synchro_data.System = {'R'}; current_synchro_data.System = {'R'};
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
} }
//assign the GNURadio block output data //assign the GNURadio block output data
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
@ -907,8 +907,8 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure *e) catch (const std::ifstream::failure *e)
{ {

View File

@ -56,14 +56,14 @@ typedef boost::shared_ptr<glonass_l2_ca_dll_pll_c_aid_tracking_cc>
glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr
glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( glonass_l2_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
@ -75,7 +75,7 @@ class glonass_l2_ca_dll_pll_c_aid_tracking_cc : public gr::block
public: public:
~glonass_l2_ca_dll_pll_c_aid_tracking_cc(); ~glonass_l2_ca_dll_pll_c_aid_tracking_cc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -87,39 +87,39 @@ public:
private: private:
friend glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr friend glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr
glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( glonass_l2_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
glonass_l2_ca_dll_pll_c_aid_tracking_cc( glonass_l2_ca_dll_pll_c_aid_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro* d_acquisition_gnss_synchro; Gnss_Synchro* d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
double d_glonass_freq_ch; double d_glonass_freq_ch;
double d_early_late_spc_chips; double d_early_late_spc_chips;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
gr_complex* d_ca_code; gr_complex* d_ca_code;
float* d_local_code_shift_chips; float* d_local_code_shift_chips;
@ -130,7 +130,7 @@ private:
double d_rem_code_phase_samples; double d_rem_code_phase_samples;
double d_rem_code_phase_chips; double d_rem_code_phase_chips;
double d_rem_carrier_phase_rad; double d_rem_carrier_phase_rad;
int d_rem_code_phase_integer_samples; int32_t d_rem_code_phase_integer_samples;
// PLL and DLL filter library // PLL and DLL filter library
//Tracking_2nd_DLL_filter d_code_loop_filter; //Tracking_2nd_DLL_filter d_code_loop_filter;
@ -165,25 +165,25 @@ private:
std::deque<gr_complex> d_P_history; std::deque<gr_complex> d_P_history;
std::deque<gr_complex> d_L_history; std::deque<gr_complex> d_L_history;
double d_preamble_timestamp_s; double d_preamble_timestamp_s;
int d_extend_correlation_ms; int32_t d_extend_correlation_ms;
bool d_enable_extended_integration; bool d_enable_extended_integration;
bool d_preamble_synchronized; bool d_preamble_synchronized;
void msg_handler_preamble_index(pmt::pmt_t msg); void msg_handler_preamble_index(pmt::pmt_t msg);
//Integration period in samples //Integration period in samples
int d_correlation_length_samples; int32_t d_correlation_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex* d_Prompt_buffer; gr_complex* d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;
@ -196,7 +196,7 @@ private:
std::map<std::string, std::string> systemName; std::map<std::string, std::string> systemName;
std::string sys; std::string sys;
int save_matfile(); int32_t save_matfile();
}; };
#endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H #endif //GNSS_SDR_GLONASS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H

View File

@ -59,14 +59,14 @@ using google::LogMessage;
glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr
glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( glonass_l2_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) float early_late_space_chips)
{ {
return glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_sc( return glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_sc(
@ -79,7 +79,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
@ -96,16 +96,17 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm
} }
} }
glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc( glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) : gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), float early_late_space_chips) : gr::block("glonass_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
{ {
@ -119,7 +120,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
d_fs_in = fs_in; d_fs_in = fs_in;
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_correlation_length_samples = static_cast<int>(d_vector_length); d_correlation_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_pll_bw_hz = pll_bw_hz; d_pll_bw_hz = pll_bw_hz;
@ -135,14 +136,14 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
// Initialization of local code replica // Initialization of local code replica
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment())); d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment())); d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_cmake(0, 0); d_correlator_outs_16sc[n] = lv_cmake(0, 0);
} }
@ -164,7 +165,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc
d_rem_carrier_phase_rad = 0.0; d_rem_carrier_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; //(from trk to tlm) d_sample_counter = 0ULL; //(from trk to tlm)
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
@ -265,10 +266,10 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
glonass_l2_ca_code_gen_complex(d_ca_code, 0); glonass_l2_ca_code_gen_complex(d_ca_code, 0);
volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc, d_ca_code, static_cast<int>(GLONASS_L2_CA_CODE_LENGTH_CHIPS)); volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc, d_ca_code, static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS));
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips); multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_16sc_t(0, 0); d_correlator_outs_16sc[n] = lv_16sc_t(0, 0);
} }
@ -300,14 +301,14 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking()
} }
int glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile() int32_t glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
std::ifstream::pos_type size; std::ifstream::pos_type size;
int number_of_double_vars = 11; int32_t number_of_double_vars = 11;
int number_of_float_vars = 5; int32_t number_of_float_vars = 5;
int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(unsigned int); sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file; std::ifstream dump_file;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try try
@ -348,7 +349,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile()
double *carrier_lock_test = new double[num_epoch]; double *carrier_lock_test = new double[num_epoch];
double *aux1 = new double[num_epoch]; double *aux1 = new double[num_epoch];
double *aux2 = new double[num_epoch]; double *aux2 = new double[num_epoch];
unsigned int *PRN = new unsigned int[num_epoch]; uint32_t *PRN = new uint32_t[num_epoch];
try try
{ {
@ -373,7 +374,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(unsigned int)); dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(uint32_t));
} }
} }
dump_file.close(); dump_file.close();
@ -544,7 +545,7 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::~glonass_l2_ca_dll_pll_c_aid_tracking_s
} }
void glonass_l2_ca_dll_pll_c_aid_tracking_sc::set_channel(unsigned int channel) void glonass_l2_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -598,14 +599,14 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples)); acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
d_sample_counter += samples_offset; // count for the processed samples d_sample_counter += static_cast<uint64_t>(samples_offset); // count for the processed samples
d_pull_in = false; d_pull_in = false;
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI; d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GLONASS_TWO_PI;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI; current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GLONASS_TWO_PI;
@ -631,7 +632,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms) if (static_cast<int32_t>(d_P_history.size()) > d_extend_correlation_ms)
{ {
d_E_history.pop_front(); d_E_history.pop_front();
d_P_history.pop_front(); d_P_history.pop_front();
@ -650,7 +651,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
d_correlator_outs_16sc[0] = lv_cmake(0, 0); d_correlator_outs_16sc[0] = lv_cmake(0, 0);
d_correlator_outs_16sc[1] = lv_cmake(0, 0); d_correlator_outs_16sc[1] = lv_cmake(0, 0);
d_correlator_outs_16sc[2] = lv_cmake(0, 0); d_correlator_outs_16sc[2] = lv_cmake(0, 0);
for (int n = 0; n < d_extend_correlation_ms; n++) for (int32_t n = 0; n < d_extend_correlation_ms; n++)
{ {
d_correlator_outs_16sc[0] += d_E_history.at(n); d_correlator_outs_16sc[0] += d_E_history.at(n);
d_correlator_outs_16sc[1] += d_P_history.at(n); d_correlator_outs_16sc[1] += d_P_history.at(n);
@ -679,7 +680,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
double T_chip_seconds = 1.0 / d_code_freq_chips; double T_chip_seconds = 1.0 / d_code_freq_chips;
double T_prn_seconds = T_chip_seconds * GLONASS_L2_CA_CODE_LENGTH_CHIPS; double T_prn_seconds = T_chip_seconds * GLONASS_L2_CA_CODE_LENGTH_CHIPS;
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in); double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
int K_prn_samples = round(T_prn_samples); int32_t K_prn_samples = round(T_prn_samples);
double K_T_prn_error_samples = K_prn_samples - T_prn_samples; double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples; d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
@ -803,7 +804,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag());
// Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!) // Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!)
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -822,7 +823,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
{ {
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GLONASS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
@ -831,13 +832,13 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_cmake(0, 0); d_correlator_outs_16sc[n] = lv_cmake(0, 0);
} }
current_synchro_data.System = {'R'}; current_synchro_data.System = {'R'};
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
} }
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;
@ -897,8 +898,8 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure *e) catch (const std::ifstream::failure *e)
{ {

View File

@ -57,14 +57,14 @@ typedef boost::shared_ptr<glonass_l2_ca_dll_pll_c_aid_tracking_sc>
glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr
glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( glonass_l2_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
@ -76,7 +76,7 @@ class glonass_l2_ca_dll_pll_c_aid_tracking_sc : public gr::block
public: public:
~glonass_l2_ca_dll_pll_c_aid_tracking_sc(); ~glonass_l2_ca_dll_pll_c_aid_tracking_sc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -88,39 +88,39 @@ public:
private: private:
friend glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr friend glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr
glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( glonass_l2_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
glonass_l2_ca_dll_pll_c_aid_tracking_sc( glonass_l2_ca_dll_pll_c_aid_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro* d_acquisition_gnss_synchro; Gnss_Synchro* d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
int64_t d_glonass_freq_ch; int64_t d_glonass_freq_ch;
double d_early_late_spc_chips; double d_early_late_spc_chips;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
gr_complex* d_ca_code; gr_complex* d_ca_code;
lv_16sc_t* d_ca_code_16sc; lv_16sc_t* d_ca_code_16sc;
@ -134,7 +134,7 @@ private:
double d_rem_code_phase_samples; double d_rem_code_phase_samples;
double d_rem_code_phase_chips; double d_rem_code_phase_chips;
double d_rem_carrier_phase_rad; double d_rem_carrier_phase_rad;
int d_rem_code_phase_integer_samples; int32_t d_rem_code_phase_integer_samples;
// PLL and DLL filter library // PLL and DLL filter library
Tracking_2nd_DLL_filter d_code_loop_filter; Tracking_2nd_DLL_filter d_code_loop_filter;
@ -161,7 +161,7 @@ private:
double d_carr_phase_error_secs_Ti; double d_carr_phase_error_secs_Ti;
double d_code_error_chips_Ti; double d_code_error_chips_Ti;
double d_preamble_timestamp_s; double d_preamble_timestamp_s;
int d_extend_correlation_ms; int32_t d_extend_correlation_ms;
bool d_enable_extended_integration; bool d_enable_extended_integration;
bool d_preamble_synchronized; bool d_preamble_synchronized;
double d_code_error_filt_chips_s; double d_code_error_filt_chips_s;
@ -174,19 +174,19 @@ private:
std::deque<lv_16sc_t> d_L_history; std::deque<lv_16sc_t> d_L_history;
//Integration period in samples //Integration period in samples
int d_correlation_length_samples; int32_t d_correlation_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex* d_Prompt_buffer; gr_complex* d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;
@ -199,7 +199,7 @@ private:
std::map<std::string, std::string> systemName; std::map<std::string, std::string> systemName;
std::string sys; std::string sys;
int save_matfile(); int32_t save_matfile();
}; };
#endif //GNSS_SDR_GLONASS_L2_CA_DLL_PLL_C_AID_TRACKING_SC_H #endif //GNSS_SDR_GLONASS_L2_CA_DLL_PLL_C_AID_TRACKING_SC_H

View File

@ -60,7 +60,7 @@ using google::LogMessage;
glonass_l2_ca_dll_pll_tracking_cc_sptr glonass_l2_ca_dll_pll_tracking_cc_sptr
glonass_l2_ca_dll_pll_make_tracking_cc( glonass_l2_ca_dll_pll_make_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -77,14 +77,14 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -100,7 +100,7 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc(
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_current_prn_length_samples = static_cast<int>(d_vector_length); d_current_prn_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_code_loop_filter.set_DLL_BW(dll_bw_hz); d_code_loop_filter.set_DLL_BW(dll_bw_hz);
@ -111,12 +111,12 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc(
// Initialization of local code replica // Initialization of local code replica
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -137,7 +137,7 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc(
d_rem_carr_phase_rad = 0.0; d_rem_carr_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; d_sample_counter = 0ULL;
//d_sample_counter_seconds = 0; //d_sample_counter_seconds = 0;
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
@ -229,8 +229,8 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
glonass_l2_ca_code_gen_complex(d_ca_code, 0); glonass_l2_ca_code_gen_complex(d_ca_code, 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GLONASS_L2_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -300,14 +300,14 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::~Glonass_L2_Ca_Dll_Pll_Tracking_cc()
} }
int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile() int32_t Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
std::ifstream::pos_type size; std::ifstream::pos_type size;
int number_of_double_vars = 11; int32_t number_of_double_vars = 11;
int number_of_float_vars = 5; int32_t number_of_float_vars = 5;
int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(unsigned int); sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file; std::ifstream dump_file;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try try
@ -348,7 +348,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile()
double *carrier_lock_test = new double[num_epoch]; double *carrier_lock_test = new double[num_epoch];
double *aux1 = new double[num_epoch]; double *aux1 = new double[num_epoch];
double *aux2 = new double[num_epoch]; double *aux2 = new double[num_epoch];
unsigned int *PRN = new unsigned int[num_epoch]; uint32_t *PRN = new uint32_t[num_epoch];
try try
{ {
@ -373,7 +373,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(unsigned int)); dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(uint32_t));
} }
} }
dump_file.close(); dump_file.close();
@ -507,7 +507,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::save_matfile()
} }
void Glonass_L2_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel) void Glonass_L2_Ca_Dll_Pll_Tracking_cc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -562,14 +562,14 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples)); acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_current_prn_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples d_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset); // count for the processed samples
d_pull_in = false; d_pull_in = false;
// take into account the carrier cycles accumulated in the pull in signal alignment // take into account the carrier cycles accumulated in the pull in signal alignment
d_acc_carrier_phase_rad -= d_carrier_doppler_phase_step_rad * samples_offset; d_acc_carrier_phase_rad -= d_carrier_doppler_phase_step_rad * samples_offset;
@ -673,7 +673,7 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad; current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -683,12 +683,12 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
current_synchro_data.System = {'R'}; current_synchro_data.System = {'R'};
current_synchro_data.correlation_length_ms = 1; current_synchro_data.correlation_length_ms = 1;
} }
@ -752,8 +752,8 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut
double tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_current_prn_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure &e) catch (const std::ifstream::failure &e)
{ {

View File

@ -53,7 +53,7 @@ typedef boost::shared_ptr<Glonass_L2_Ca_Dll_Pll_Tracking_cc>
glonass_l2_ca_dll_pll_tracking_cc_sptr glonass_l2_ca_dll_pll_tracking_cc_sptr
glonass_l2_ca_dll_pll_make_tracking_cc( glonass_l2_ca_dll_pll_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -69,7 +69,7 @@ class Glonass_L2_Ca_Dll_Pll_Tracking_cc : public gr::block
public: public:
~Glonass_L2_Ca_Dll_Pll_Tracking_cc(); ~Glonass_L2_Ca_Dll_Pll_Tracking_cc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -81,7 +81,7 @@ public:
private: private:
friend glonass_l2_ca_dll_pll_tracking_cc_sptr friend glonass_l2_ca_dll_pll_tracking_cc_sptr
glonass_l2_ca_dll_pll_make_tracking_cc( glonass_l2_ca_dll_pll_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -89,7 +89,7 @@ private:
float early_late_space_chips); float early_late_space_chips);
Glonass_L2_Ca_Dll_Pll_Tracking_cc( Glonass_L2_Ca_Dll_Pll_Tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -97,11 +97,11 @@ private:
float early_late_space_chips); float early_late_space_chips);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro* d_acquisition_gnss_synchro; Gnss_Synchro* d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
int64_t d_glonass_freq_ch; int64_t d_glonass_freq_ch;
@ -121,7 +121,7 @@ private:
double d_acq_code_phase_samples; double d_acq_code_phase_samples;
double d_acq_carrier_doppler_hz; double d_acq_carrier_doppler_hz;
// correlator // correlator
int d_n_correlator_taps; int32_t d_n_correlator_taps;
gr_complex* d_ca_code; gr_complex* d_ca_code;
float* d_local_code_shift_chips; float* d_local_code_shift_chips;
gr_complex* d_correlator_outs; gr_complex* d_correlator_outs;
@ -139,19 +139,19 @@ private:
double d_code_phase_samples; double d_code_phase_samples;
//PRN period in samples //PRN period in samples
int d_current_prn_length_samples; int32_t d_current_prn_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex* d_Prompt_buffer; gr_complex* d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;
@ -164,7 +164,7 @@ private:
std::map<std::string, std::string> systemName; std::map<std::string, std::string> systemName;
std::string sys; std::string sys;
int save_matfile(); int32_t save_matfile();
}; };
#endif //GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H #endif //GNSS_SDR_GLONASS_L2_CA_DLL_PLL_TRACKING_CC_H

View File

@ -52,14 +52,14 @@ using google::LogMessage;
gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr
gps_l1_ca_dll_pll_c_aid_make_tracking_cc( gps_l1_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) float early_late_space_chips)
{ {
return gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_cc( return gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_cc(
@ -72,7 +72,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
@ -92,14 +92,14 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pmt_t
gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) : gr::block("gps_l1_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), float early_late_space_chips) : gr::block("gps_l1_ca_dll_pll_c_aid_tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
{ {
@ -115,7 +115,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
d_fs_in = fs_in; d_fs_in = fs_in;
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_correlation_length_samples = static_cast<int>(d_vector_length); d_correlation_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_pll_bw_hz = pll_bw_hz; d_pll_bw_hz = pll_bw_hz;
@ -131,12 +131,12 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
// Initialization of local code replica // Initialization of local code replica
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -157,7 +157,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc(
d_rem_carrier_phase_rad = 0.0; d_rem_carrier_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; //(from trk to tlm) d_sample_counter = 0ULL; //(from trk to tlm)
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
@ -253,8 +253,8 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0); gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -327,14 +327,14 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::~gps_l1_ca_dll_pll_c_aid_tracking_cc()
} }
int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile() int32_t gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
std::ifstream::pos_type size; std::ifstream::pos_type size;
int number_of_double_vars = 11; int32_t number_of_double_vars = 11;
int number_of_float_vars = 5; int32_t number_of_float_vars = 5;
int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(unsigned int); sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file; std::ifstream dump_file;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try try
@ -375,7 +375,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
double *carrier_lock_test = new double[num_epoch]; double *carrier_lock_test = new double[num_epoch];
double *aux1 = new double[num_epoch]; double *aux1 = new double[num_epoch];
double *aux2 = new double[num_epoch]; double *aux2 = new double[num_epoch];
unsigned int *PRN = new unsigned int[num_epoch]; uint32_t *PRN = new uint32_t[num_epoch];
try try
{ {
@ -400,7 +400,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(unsigned int)); dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(uint32_t));
} }
} }
dump_file.close(); dump_file.close();
@ -534,7 +534,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::save_matfile()
} }
void gps_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(unsigned int channel) void gps_l1_ca_dll_pll_c_aid_tracking_cc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -588,14 +588,14 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples)); acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
d_sample_counter += samples_offset; // count for the processed samples d_sample_counter += static_cast<uint64_t>(samples_offset); // count for the processed samples
d_pull_in = false; d_pull_in = false;
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GPS_TWO_PI; d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GPS_TWO_PI;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GPS_TWO_PI; current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GPS_TWO_PI;
@ -621,7 +621,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
d_P_history.push_back(d_correlator_outs[1]); // save prompt output d_P_history.push_back(d_correlator_outs[1]); // save prompt output
d_L_history.push_back(d_correlator_outs[2]); // save late output d_L_history.push_back(d_correlator_outs[2]); // save late output
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms) if (static_cast<int32_t>(d_P_history.size()) > d_extend_correlation_ms)
{ {
d_E_history.pop_front(); d_E_history.pop_front();
d_P_history.pop_front(); d_P_history.pop_front();
@ -640,7 +640,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
d_correlator_outs[0] = gr_complex(0.0, 0.0); d_correlator_outs[0] = gr_complex(0.0, 0.0);
d_correlator_outs[1] = gr_complex(0.0, 0.0); d_correlator_outs[1] = gr_complex(0.0, 0.0);
d_correlator_outs[2] = gr_complex(0.0, 0.0); d_correlator_outs[2] = gr_complex(0.0, 0.0);
for (int n = 0; n < d_extend_correlation_ms; n++) for (int32_t n = 0; n < d_extend_correlation_ms; n++)
{ {
d_correlator_outs[0] += d_E_history.at(n); d_correlator_outs[0] += d_E_history.at(n);
d_correlator_outs[1] += d_P_history.at(n); d_correlator_outs[1] += d_P_history.at(n);
@ -670,7 +670,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
double T_chip_seconds = 1.0 / d_code_freq_chips; double T_chip_seconds = 1.0 / d_code_freq_chips;
double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in); double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
int K_prn_samples = round(T_prn_samples); int32_t K_prn_samples = round(T_prn_samples);
double K_T_prn_error_samples = K_prn_samples - T_prn_samples; double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples; d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
@ -793,7 +793,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -812,7 +812,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
{ {
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
@ -821,13 +821,13 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
current_synchro_data.System = {'G'}; current_synchro_data.System = {'G'};
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
} }
//assign the GNURadio block output data //assign the GNURadio block output data
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
@ -888,8 +888,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __attrib
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure *e) catch (const std::ifstream::failure *e)
{ {

View File

@ -56,14 +56,14 @@ typedef boost::shared_ptr<gps_l1_ca_dll_pll_c_aid_tracking_cc>
gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr
gps_l1_ca_dll_pll_c_aid_make_tracking_cc( gps_l1_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
@ -75,7 +75,7 @@ class gps_l1_ca_dll_pll_c_aid_tracking_cc : public gr::block
public: public:
~gps_l1_ca_dll_pll_c_aid_tracking_cc(); ~gps_l1_ca_dll_pll_c_aid_tracking_cc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -87,37 +87,37 @@ public:
private: private:
friend gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr friend gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr
gps_l1_ca_dll_pll_c_aid_make_tracking_cc( gps_l1_ca_dll_pll_c_aid_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
gps_l1_ca_dll_pll_c_aid_tracking_cc( gps_l1_ca_dll_pll_c_aid_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro* d_acquisition_gnss_synchro; Gnss_Synchro* d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
double d_early_late_spc_chips; double d_early_late_spc_chips;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
gr_complex* d_ca_code; gr_complex* d_ca_code;
float* d_local_code_shift_chips; float* d_local_code_shift_chips;
@ -128,7 +128,7 @@ private:
double d_rem_code_phase_samples; double d_rem_code_phase_samples;
double d_rem_code_phase_chips; double d_rem_code_phase_chips;
double d_rem_carrier_phase_rad; double d_rem_carrier_phase_rad;
int d_rem_code_phase_integer_samples; int32_t d_rem_code_phase_integer_samples;
// PLL and DLL filter library // PLL and DLL filter library
//Tracking_2nd_DLL_filter d_code_loop_filter; //Tracking_2nd_DLL_filter d_code_loop_filter;
@ -161,25 +161,25 @@ private:
std::deque<gr_complex> d_P_history; std::deque<gr_complex> d_P_history;
std::deque<gr_complex> d_L_history; std::deque<gr_complex> d_L_history;
double d_preamble_timestamp_s; double d_preamble_timestamp_s;
int d_extend_correlation_ms; int32_t d_extend_correlation_ms;
bool d_enable_extended_integration; bool d_enable_extended_integration;
bool d_preamble_synchronized; bool d_preamble_synchronized;
void msg_handler_preamble_index(pmt::pmt_t msg); void msg_handler_preamble_index(pmt::pmt_t msg);
//Integration period in samples //Integration period in samples
int d_correlation_length_samples; int32_t d_correlation_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex* d_Prompt_buffer; gr_complex* d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;
@ -192,7 +192,7 @@ private:
std::map<std::string, std::string> systemName; std::map<std::string, std::string> systemName;
std::string sys; std::string sys;
int save_matfile(); int32_t save_matfile();
}; };
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H #endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_CC_H

View File

@ -52,14 +52,14 @@ using google::LogMessage;
gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr
gps_l1_ca_dll_pll_c_aid_make_tracking_sc( gps_l1_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) float early_late_space_chips)
{ {
return gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_sc( return gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_sc(
@ -72,7 +72,7 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
@ -91,14 +91,14 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pmt_t
gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc( gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips) : gr::block("gps_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), float early_late_space_chips) : gr::block("gps_l1_ca_dll_pll_c_aid_tracking_sc", gr::io_signature::make(1, 1, sizeof(lv_16sc_t)),
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
{ {
@ -112,7 +112,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc(
d_fs_in = fs_in; d_fs_in = fs_in;
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_correlation_length_samples = static_cast<int>(d_vector_length); d_correlation_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_pll_bw_hz = pll_bw_hz; d_pll_bw_hz = pll_bw_hz;
@ -128,14 +128,14 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc(
// Initialization of local code replica // Initialization of local code replica
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_ca_code = static_cast<gr_complex *>(volk_gnsssdr_malloc(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment())); d_ca_code_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment())); d_correlator_outs_16sc = static_cast<lv_16sc_t *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(lv_16sc_t), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_cmake(0, 0); d_correlator_outs_16sc[n] = lv_cmake(0, 0);
} }
@ -157,7 +157,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc(
d_rem_carrier_phase_rad = 0.0; d_rem_carrier_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; //(from trk to tlm) d_sample_counter = 0ULL; //(from trk to tlm)
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
@ -251,10 +251,10 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0); gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc, d_ca_code, static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS)); volk_gnsssdr_32fc_convert_16ic(d_ca_code_16sc, d_ca_code, static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS));
multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips); multicorrelator_cpu_16sc.set_local_code_and_taps(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code_16sc, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_16sc_t(0, 0); d_correlator_outs_16sc[n] = lv_16sc_t(0, 0);
} }
@ -329,14 +329,14 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::~gps_l1_ca_dll_pll_c_aid_tracking_sc()
} }
int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile() int32_t gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
{ {
// READ DUMP FILE // READ DUMP FILE
std::ifstream::pos_type size; std::ifstream::pos_type size;
int number_of_double_vars = 11; int32_t number_of_double_vars = 11;
int number_of_float_vars = 5; int32_t number_of_float_vars = 5;
int epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars + int32_t epoch_size_bytes = sizeof(uint64_t) + sizeof(double) * number_of_double_vars +
sizeof(float) * number_of_float_vars + sizeof(unsigned int); sizeof(float) * number_of_float_vars + sizeof(uint32_t);
std::ifstream dump_file; std::ifstream dump_file;
dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit);
try try
@ -377,7 +377,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
double *carrier_lock_test = new double[num_epoch]; double *carrier_lock_test = new double[num_epoch];
double *aux1 = new double[num_epoch]; double *aux1 = new double[num_epoch];
double *aux2 = new double[num_epoch]; double *aux2 = new double[num_epoch];
unsigned int *PRN = new unsigned int[num_epoch]; uint32_t *PRN = new uint32_t[num_epoch];
try try
{ {
@ -402,7 +402,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&carrier_lock_test[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux1[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double)); dump_file.read(reinterpret_cast<char *>(&aux2[i]), sizeof(double));
dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(unsigned int)); dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(uint32_t));
} }
} }
dump_file.close(); dump_file.close();
@ -536,7 +536,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::save_matfile()
} }
void gps_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(unsigned int channel) void gps_l1_ca_dll_pll_c_aid_tracking_sc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -590,14 +590,14 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples)); acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
d_sample_counter += samples_offset; // count for the processed samples d_sample_counter += static_cast<uint64_t>(samples_offset); // count for the processed samples
d_pull_in = false; d_pull_in = false;
d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GPS_TWO_PI; d_acc_carrier_phase_cycles -= d_carrier_phase_step_rad * samples_offset / GPS_TWO_PI;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GPS_TWO_PI; current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_cycles * GPS_TWO_PI;
@ -623,7 +623,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output d_P_history.push_back(d_correlator_outs_16sc[1]); // save prompt output
d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output d_L_history.push_back(d_correlator_outs_16sc[2]); // save late output
if (static_cast<int>(d_P_history.size()) > d_extend_correlation_ms) if (static_cast<int32_t>(d_P_history.size()) > d_extend_correlation_ms)
{ {
d_E_history.pop_front(); d_E_history.pop_front();
d_P_history.pop_front(); d_P_history.pop_front();
@ -642,7 +642,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
d_correlator_outs_16sc[0] = lv_cmake(0, 0); d_correlator_outs_16sc[0] = lv_cmake(0, 0);
d_correlator_outs_16sc[1] = lv_cmake(0, 0); d_correlator_outs_16sc[1] = lv_cmake(0, 0);
d_correlator_outs_16sc[2] = lv_cmake(0, 0); d_correlator_outs_16sc[2] = lv_cmake(0, 0);
for (int n = 0; n < d_extend_correlation_ms; n++) for (int32_t n = 0; n < d_extend_correlation_ms; n++)
{ {
d_correlator_outs_16sc[0] += d_E_history.at(n); d_correlator_outs_16sc[0] += d_E_history.at(n);
d_correlator_outs_16sc[1] += d_P_history.at(n); d_correlator_outs_16sc[1] += d_P_history.at(n);
@ -671,7 +671,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
double T_chip_seconds = 1.0 / d_code_freq_chips; double T_chip_seconds = 1.0 / d_code_freq_chips;
double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in); double T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
int K_prn_samples = round(T_prn_samples); int32_t K_prn_samples = round(T_prn_samples);
double K_T_prn_error_samples = K_prn_samples - T_prn_samples; double K_T_prn_error_samples = K_prn_samples - T_prn_samples;
d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples; d_rem_code_phase_samples = d_rem_code_phase_samples - K_T_prn_error_samples;
@ -795,7 +795,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag());
// Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!) // Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!)
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -814,7 +814,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
{ {
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs_16sc[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs_16sc[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; // todo: project the carrier doppler
@ -823,13 +823,13 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs_16sc[n] = lv_cmake(0, 0); d_correlator_outs_16sc[n] = lv_cmake(0, 0);
} }
current_synchro_data.System = {'G'}; current_synchro_data.System = {'G'};
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
} }
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;
@ -889,8 +889,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __attrib
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure *e) catch (const std::ifstream::failure *e)
{ {

View File

@ -57,14 +57,14 @@ typedef boost::shared_ptr<gps_l1_ca_dll_pll_c_aid_tracking_sc>
gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr
gps_l1_ca_dll_pll_c_aid_make_tracking_sc( gps_l1_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
@ -76,7 +76,7 @@ class gps_l1_ca_dll_pll_c_aid_tracking_sc : public gr::block
public: public:
~gps_l1_ca_dll_pll_c_aid_tracking_sc(); ~gps_l1_ca_dll_pll_c_aid_tracking_sc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -88,38 +88,38 @@ public:
private: private:
friend gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr friend gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr
gps_l1_ca_dll_pll_c_aid_make_tracking_sc( gps_l1_ca_dll_pll_c_aid_make_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
gps_l1_ca_dll_pll_c_aid_tracking_sc( gps_l1_ca_dll_pll_c_aid_tracking_sc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
float dll_bw_hz, float dll_bw_hz,
float pll_bw_narrow_hz, float pll_bw_narrow_hz,
float dll_bw_narrow_hz, float dll_bw_narrow_hz,
int extend_correlation_ms, int32_t extend_correlation_ms,
float early_late_space_chips); float early_late_space_chips);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro* d_acquisition_gnss_synchro; Gnss_Synchro* d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
double d_early_late_spc_chips; double d_early_late_spc_chips;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
gr_complex* d_ca_code; gr_complex* d_ca_code;
lv_16sc_t* d_ca_code_16sc; lv_16sc_t* d_ca_code_16sc;
@ -133,7 +133,7 @@ private:
double d_rem_code_phase_samples; double d_rem_code_phase_samples;
double d_rem_code_phase_chips; double d_rem_code_phase_chips;
double d_rem_carrier_phase_rad; double d_rem_carrier_phase_rad;
int d_rem_code_phase_integer_samples; int32_t d_rem_code_phase_integer_samples;
// PLL and DLL filter library // PLL and DLL filter library
Tracking_2nd_DLL_filter d_code_loop_filter; Tracking_2nd_DLL_filter d_code_loop_filter;
@ -158,7 +158,7 @@ private:
double d_carr_phase_error_secs_Ti; double d_carr_phase_error_secs_Ti;
double d_code_error_chips_Ti; double d_code_error_chips_Ti;
double d_preamble_timestamp_s; double d_preamble_timestamp_s;
int d_extend_correlation_ms; int32_t d_extend_correlation_ms;
bool d_enable_extended_integration; bool d_enable_extended_integration;
bool d_preamble_synchronized; bool d_preamble_synchronized;
double d_code_error_filt_chips_s; double d_code_error_filt_chips_s;
@ -171,19 +171,19 @@ private:
std::deque<lv_16sc_t> d_L_history; std::deque<lv_16sc_t> d_L_history;
//Integration period in samples //Integration period in samples
int d_correlation_length_samples; int32_t d_correlation_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex* d_Prompt_buffer; gr_complex* d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;
@ -196,7 +196,7 @@ private:
std::map<std::string, std::string> systemName; std::map<std::string, std::string> systemName;
std::string sys; std::string sys;
int save_matfile(); int32_t save_matfile();
}; };
#endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H #endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_C_AID_TRACKING_SC_H

View File

@ -50,7 +50,7 @@ using google::LogMessage;
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
gps_l1_ca_dll_pll_make_tracking_gpu_cc( gps_l1_ca_dll_pll_make_tracking_gpu_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -67,14 +67,14 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -90,7 +90,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
d_fs_in = fs_in; d_fs_in = fs_in;
d_vector_length = vector_length; d_vector_length = vector_length;
d_dump_filename = dump_filename; d_dump_filename = dump_filename;
d_correlation_length_samples = static_cast<int>(d_vector_length); d_correlation_length_samples = static_cast<int32_t>(d_vector_length);
// Initialize tracking ========================================== // Initialize tracking ==========================================
d_code_loop_filter.set_DLL_BW(dll_bw_hz); d_code_loop_filter.set_DLL_BW(dll_bw_hz);
@ -105,7 +105,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
//pinned memory mode - use special function to get OS-pinned memory //pinned memory mode - use special function to get OS-pinned memory
d_n_correlator_taps = 3; // Early, Prompt, and Late d_n_correlator_taps = 3; // Early, Prompt, and Late
// Get space for a vector with the C/A code replica sampled 1x/chip // Get space for a vector with the C/A code replica sampled 1x/chip
cudaHostAlloc((void **)&d_ca_code, (static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), cudaHostAllocMapped || cudaHostAllocWriteCombined); cudaHostAlloc((void **)&d_ca_code, (static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), cudaHostAllocMapped || cudaHostAllocWriteCombined);
// Get space for the resampled early / prompt / late local replicas // Get space for the resampled early / prompt / late local replicas
cudaHostAlloc((void **)&d_local_code_shift_chips, d_n_correlator_taps * sizeof(float), cudaHostAllocMapped || cudaHostAllocWriteCombined); cudaHostAlloc((void **)&d_local_code_shift_chips, d_n_correlator_taps * sizeof(float), cudaHostAllocMapped || cudaHostAllocWriteCombined);
cudaHostAlloc((void **)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped || cudaHostAllocWriteCombined); cudaHostAlloc((void **)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped || cudaHostAllocWriteCombined);
@ -131,7 +131,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
d_rem_carrier_phase_rad = 0.0; d_rem_carrier_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; d_sample_counter = 0ULL;
//d_sample_counter_seconds = 0; //d_sample_counter_seconds = 0;
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0;
@ -221,9 +221,9 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0); gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
multicorrelator_gpu->set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips, d_n_correlator_taps); multicorrelator_gpu->set_local_code_and_taps(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips, d_n_correlator_taps);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -283,7 +283,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::~Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc()
} }
void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::set_channel(unsigned int channel) void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -341,17 +341,17 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut
// Receiver signal alignment // Receiver signal alignment
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
double acq_trk_shif_correction_samples; double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples)); acq_trk_shif_correction_samples = d_correlation_length_samples - fmod(static_cast<double>(acq_to_trk_delay_samples), static_cast<double>(d_correlation_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
current_synchro_data.correlation_length_ms = 1; current_synchro_data.correlation_length_ms = 1;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;
d_sample_counter += samples_offset; //count for the processed samples d_sample_counter += static_cast<uint64_t>(samples_offset); //count for the processed samples
d_pull_in = false; d_pull_in = false;
consume_each(samples_offset); //shift input to perform alignment with local replica consume_each(samples_offset); //shift input to perform alignment with local replica
return 1; return 1;
@ -466,7 +466,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut
// ########### Output the tracking data to navigation and PVT ########## // ########### Output the tracking data to navigation and PVT ##########
current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real()); current_synchro_data.Prompt_I = static_cast<double>((d_correlator_outs[1]).real());
current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag()); current_synchro_data.Prompt_Q = static_cast<double>((d_correlator_outs[1]).imag());
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles; current_synchro_data.Carrier_phase_rads = GPS_TWO_PI * d_acc_carrier_phase_cycles;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
@ -476,14 +476,14 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut
} }
else else
{ {
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
current_synchro_data.System = {'G'}; current_synchro_data.System = {'G'};
current_synchro_data.correlation_length_ms = 1; current_synchro_data.correlation_length_ms = 1;
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
} }
//assign the GNURadio block output data //assign the GNURadio block output data
@ -546,8 +546,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure *e) catch (const std::ifstream::failure *e)
{ {

View File

@ -54,7 +54,7 @@ typedef boost::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc>
gps_l1_ca_dll_pll_tracking_gpu_cc_sptr gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
gps_l1_ca_dll_pll_make_tracking_gpu_cc( gps_l1_ca_dll_pll_make_tracking_gpu_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -70,7 +70,7 @@ class Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc : public gr::block
public: public:
~Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(); ~Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -83,7 +83,7 @@ private:
friend gps_l1_ca_dll_pll_tracking_gpu_cc_sptr friend gps_l1_ca_dll_pll_tracking_gpu_cc_sptr
gps_l1_ca_dll_pll_make_tracking_gpu_cc( gps_l1_ca_dll_pll_make_tracking_gpu_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -92,7 +92,7 @@ private:
Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float pll_bw_hz, float pll_bw_hz,
@ -102,18 +102,17 @@ private:
void update_local_carrier(); void update_local_carrier();
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro *d_acquisition_gnss_synchro; Gnss_Synchro *d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_if_freq; int64_t d_if_freq;
int64_t d_fs_in; int64_t d_fs_in;
double d_early_late_spc_chips; double d_early_late_spc_chips;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
//GPU HOST PINNED MEMORY IN/OUT VECTORS //GPU HOST PINNED MEMORY IN/OUT VECTORS
gr_complex *in_gpu; gr_complex *in_gpu;
@ -150,19 +149,19 @@ private:
double d_pll_to_dll_assist_secs_Ti; double d_pll_to_dll_assist_secs_Ti;
//Integration period in samples //Integration period in samples
int d_correlation_length_samples; int32_t d_correlation_length_samples;
//processing samples counters //processing samples counters
uint64_t d_sample_counter; uint64_t d_sample_counter;
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex *d_Prompt_buffer; gr_complex *d_Prompt_buffer;
double d_carrier_lock_test; double d_carrier_lock_test;
double d_CN0_SNV_dB_Hz; double d_CN0_SNV_dB_Hz;
double d_carrier_lock_threshold; double d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;

View File

@ -59,7 +59,7 @@ using google::LogMessage;
gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_tracking_cc_sptr
gps_l1_ca_tcp_connector_make_tracking_cc( gps_l1_ca_tcp_connector_make_tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float early_late_space_chips, float early_late_space_chips,
@ -75,14 +75,14 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::forecast(int noutput_items,
{ {
if (noutput_items != 0) if (noutput_items != 0)
{ {
ninput_items_required[0] = static_cast<int>(d_vector_length) * 2; //set the required available samples in each call ninput_items_required[0] = static_cast<int32_t>(d_vector_length) * 2; //set the required available samples in each call
} }
} }
Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
int64_t fs_in, int64_t fs_in,
unsigned int vector_length, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float early_late_space_chips, float early_late_space_chips,
@ -112,7 +112,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
// correlator outputs (scalar) // correlator outputs (scalar)
d_n_correlator_taps = 3; // Very-Early, Early, Prompt, Late, Very-Late d_n_correlator_taps = 3; // Very-Early, Early, Prompt, Late, Very-Late
d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_correlator_outs = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -140,14 +140,14 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
d_rem_carr_phase_rad = 0.0; d_rem_carr_phase_rad = 0.0;
// sample synchronization // sample synchronization
d_sample_counter = 0; d_sample_counter = 0ULL;
d_sample_counter_seconds = 0; d_sample_counter_seconds = 0;
d_acq_sample_stamp = 0; d_acq_sample_stamp = 0ULL;
d_enable_tracking = false; d_enable_tracking = false;
d_pull_in = false; d_pull_in = false;
d_current_prn_length_samples = static_cast<int>(d_vector_length); d_current_prn_length_samples = static_cast<int32_t>(d_vector_length);
// CN0 estimation and lock detector buffers // CN0 estimation and lock detector buffers
d_cn0_estimation_counter = 0; d_cn0_estimation_counter = 0;
@ -227,8 +227,8 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
// generate local reference ALWAYS starting at chip 1 (1 sample per chip) // generate local reference ALWAYS starting at chip 1 (1 sample per chip)
gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0); gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0);
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); multicorrelator_cpu.set_local_code_and_taps(static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++) for (int32_t n = 0; n < d_n_correlator_taps; n++)
{ {
d_correlator_outs[n] = gr_complex(0, 0); d_correlator_outs[n] = gr_complex(0, 0);
} }
@ -288,7 +288,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::~Gps_L1_Ca_Tcp_Connector_Tracking_cc()
} }
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel) void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
LOG(INFO) << "Tracking Channel set to " << d_channel; LOG(INFO) << "Tracking Channel set to " << d_channel;
@ -352,19 +352,19 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib
*/ */
if (d_pull_in == true) if (d_pull_in == true)
{ {
int samples_offset; int32_t samples_offset;
// 28/11/2011 ACQ to TRK transition BUG CORRECTION // 28/11/2011 ACQ to TRK transition BUG CORRECTION
float acq_trk_shif_correction_samples; float acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples; int32_t acq_to_trk_delay_samples;
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_next_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_next_prn_length_samples)); acq_trk_shif_correction_samples = d_next_prn_length_samples - fmod(static_cast<float>(acq_to_trk_delay_samples), static_cast<float>(d_next_prn_length_samples));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset);
current_synchro_data.fs = d_fs_in; current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data; *out[0] = current_synchro_data;
d_sample_counter_seconds = d_sample_counter_seconds + (static_cast<double>(samples_offset) / static_cast<double>(d_fs_in)); d_sample_counter_seconds = d_sample_counter_seconds + (static_cast<double>(samples_offset) / static_cast<double>(d_fs_in));
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples d_sample_counter = d_sample_counter + static_cast<uint64_t>(samples_offset); //count for the processed samples
d_pull_in = false; d_pull_in = false;
consume_each(samples_offset); //shift input to perform alignment with local replica consume_each(samples_offset); //shift input to perform alignment with local replica
return 1; return 1;
@ -480,7 +480,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib
current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag()); current_synchro_data.Prompt_Q = static_cast<double>((*d_Prompt).imag());
//compute remnant code phase samples AFTER the Tracking timestamp //compute remnant code phase samples AFTER the Tracking timestamp
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_current_prn_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_current_prn_length_samples);
current_synchro_data.Code_phase_samples = d_rem_code_phase_samples; current_synchro_data.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = static_cast<double>(d_acc_carrier_phase_rad); current_synchro_data.Carrier_phase_rads = static_cast<double>(d_acc_carrier_phase_rad);
current_synchro_data.Carrier_Doppler_hz = static_cast<double>(d_carrier_doppler_hz); current_synchro_data.Carrier_Doppler_hz = static_cast<double>(d_carrier_doppler_hz);
@ -494,7 +494,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib
*d_Prompt = gr_complex(0, 0); *d_Prompt = gr_complex(0, 0);
*d_Late = gr_complex(0, 0); *d_Late = gr_complex(0, 0);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
current_synchro_data.Tracking_sample_counter = d_sample_counter + d_correlation_length_samples; current_synchro_data.Tracking_sample_counter = d_sample_counter + static_cast<uint64_t>(d_correlation_length_samples);
//! When tracking is disabled an array of 1's is sent to maintain the TCP connection //! When tracking is disabled an array of 1's is sent to maintain the TCP connection
boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> tx_variables_array = {{1, 1, 1, 1, 1, 1, 1, 1, 0}}; boost::array<float, NUM_TX_VARIABLES_GPS_L1_CA> tx_variables_array = {{1, 1, 1, 1, 1, 1, 1, 1, 0}};
d_tcp_com.send_receive_tcp_packet_gps_l1_ca(tx_variables_array, &tcp_data); d_tcp_com.send_receive_tcp_packet_gps_l1_ca(tx_variables_array, &tcp_data);
@ -565,8 +565,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib
double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples); double tmp_double = static_cast<double>(d_sample_counter + d_correlation_length_samples);
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double)); d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
// PRN // PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN; uint32_t prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(unsigned int)); d_dump_file.write(reinterpret_cast<char *>(&prn_), sizeof(uint32_t));
} }
catch (const std::ifstream::failure &e) catch (const std::ifstream::failure &e)
{ {

View File

@ -52,7 +52,7 @@ typedef boost::shared_ptr<Gps_L1_Ca_Tcp_Connector_Tracking_cc> gps_l1_ca_tcp_con
gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_tracking_cc_sptr
gps_l1_ca_tcp_connector_make_tracking_cc( gps_l1_ca_tcp_connector_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float early_late_space_chips, float early_late_space_chips,
@ -67,7 +67,7 @@ class Gps_L1_Ca_Tcp_Connector_Tracking_cc : public gr::block
public: public:
~Gps_L1_Ca_Tcp_Connector_Tracking_cc(); ~Gps_L1_Ca_Tcp_Connector_Tracking_cc();
void set_channel(unsigned int channel); void set_channel(uint32_t channel);
void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro); void set_gnss_synchro(Gnss_Synchro *p_gnss_synchro);
void start_tracking(); void start_tracking();
@ -84,29 +84,29 @@ public:
private: private:
friend gps_l1_ca_tcp_connector_tracking_cc_sptr friend gps_l1_ca_tcp_connector_tracking_cc_sptr
gps_l1_ca_tcp_connector_make_tracking_cc( gps_l1_ca_tcp_connector_make_tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float early_late_space_chips, float early_late_space_chips,
size_t port_ch0); size_t port_ch0);
Gps_L1_Ca_Tcp_Connector_Tracking_cc( Gps_L1_Ca_Tcp_Connector_Tracking_cc(
int64_t fs_in, unsigned int vector_length, int64_t fs_in, uint32_t vector_length,
bool dump, bool dump,
std::string dump_filename, std::string dump_filename,
float early_late_space_chips, float early_late_space_chips,
size_t port_ch0); size_t port_ch0);
// tracking configuration vars // tracking configuration vars
unsigned int d_vector_length; uint32_t d_vector_length;
bool d_dump; bool d_dump;
Gnss_Synchro *d_acquisition_gnss_synchro; Gnss_Synchro *d_acquisition_gnss_synchro;
unsigned int d_channel; uint32_t d_channel;
int64_t d_fs_in; int64_t d_fs_in;
int d_correlation_length_samples; int32_t d_correlation_length_samples;
int d_n_correlator_taps; int32_t d_n_correlator_taps;
double d_early_late_spc_chips; double d_early_late_spc_chips;
double d_code_phase_step_chips; double d_code_phase_step_chips;
@ -137,13 +137,13 @@ private:
double d_code_phase_samples; double d_code_phase_samples;
size_t d_port_ch0; size_t d_port_ch0;
size_t d_port; size_t d_port;
int d_listen_connection; int32_t d_listen_connection;
float d_control_id; float d_control_id;
tcp_communication d_tcp_com; tcp_communication d_tcp_com;
//PRN period in samples //PRN period in samples
int d_current_prn_length_samples; int32_t d_current_prn_length_samples;
int d_next_prn_length_samples; int32_t d_next_prn_length_samples;
double d_sample_counter_seconds; double d_sample_counter_seconds;
//processing samples counters //processing samples counters
@ -151,12 +151,12 @@ private:
uint64_t d_acq_sample_stamp; uint64_t d_acq_sample_stamp;
// CN0 estimation and lock detector // CN0 estimation and lock detector
int d_cn0_estimation_counter; int32_t d_cn0_estimation_counter;
gr_complex *d_Prompt_buffer; gr_complex *d_Prompt_buffer;
float d_carrier_lock_test; float d_carrier_lock_test;
float d_CN0_SNV_dB_Hz; float d_CN0_SNV_dB_Hz;
float d_carrier_lock_threshold; float d_carrier_lock_threshold;
int d_carrier_lock_fail_counter; int32_t d_carrier_lock_fail_counter;
// control vars // control vars
bool d_enable_tracking; bool d_enable_tracking;

View File

@ -38,7 +38,7 @@ Dll_Pll_Conf::Dll_Pll_Conf()
/* DLL/PLL tracking configuration */ /* DLL/PLL tracking configuration */
use_fast_resampler = true; use_fast_resampler = true;
fs_in = 0.0; fs_in = 0.0;
vector_length = 0; vector_length = 0U;
dump = false; dump = false;
dump_filename = "./dll_pll_dump.dat"; dump_filename = "./dll_pll_dump.dat";
pll_pull_in_bw_hz = 50.0; pll_pull_in_bw_hz = 50.0;

View File

@ -33,6 +33,7 @@
#ifndef GNSS_SDR_DLL_PLL_CONF_H_ #ifndef GNSS_SDR_DLL_PLL_CONF_H_
#define GNSS_SDR_DLL_PLL_CONF_H_ #define GNSS_SDR_DLL_PLL_CONF_H_
#include <cstdint>
#include <string> #include <string>
class Dll_Pll_Conf class Dll_Pll_Conf
@ -41,7 +42,7 @@ private:
public: public:
/* DLL/PLL tracking configuration */ /* DLL/PLL tracking configuration */
double fs_in; double fs_in;
unsigned int vector_length; uint32_t vector_length;
bool dump; bool dump;
std::string dump_filename; std::string dump_filename;
float pll_pull_in_bw_hz; float pll_pull_in_bw_hz;
@ -54,12 +55,12 @@ public:
float very_early_late_space_chips; float very_early_late_space_chips;
float early_late_space_narrow_chips; float early_late_space_narrow_chips;
float very_early_late_space_narrow_chips; float very_early_late_space_narrow_chips;
int extend_correlation_symbols; int32_t extend_correlation_symbols;
bool use_fast_resampler; bool use_fast_resampler;
int cn0_samples; int32_t cn0_samples;
int carrier_lock_det_mav_samples; int32_t carrier_lock_det_mav_samples;
int cn0_min; int32_t cn0_min;
int max_lock_fail; int32_t max_lock_fail;
double carrier_lock_th; double carrier_lock_th;
bool track_pilot; bool track_pilot;
char system; char system;

View File

@ -61,7 +61,7 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
/* DLL/PLL tracking configuration */ /* DLL/PLL tracking configuration */
fs_in = 0.0; fs_in = 0.0;
vector_length = 0; vector_length = 0U;
dump = false; dump = false;
dump_filename = "./dll_pll_dump.dat"; dump_filename = "./dll_pll_dump.dat";
pll_bw_hz = 40.0; pll_bw_hz = 40.0;
@ -82,10 +82,10 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
char sig_[3] = "1C"; char sig_[3] = "1C";
std::memcpy(signal, sig_, 3); std::memcpy(signal, sig_, 3);
device_name = "/dev/uio"; device_name = "/dev/uio";
device_base = 1; device_base = 1U;
multicorr_type = 0; multicorr_type = 0U;
code_length_chips = 0; code_length_chips = 0U;
code_samples_per_chip = 0; code_samples_per_chip = 0U;
//int32_t* ca_codes; //int32_t* ca_codes;
//int32_t* data_codes; //int32_t* data_codes;
} }

View File

@ -29,6 +29,7 @@
* *
* ------------------------------------------------------------------------- * -------------------------------------------------------------------------
*/ */
#ifndef GNSS_SDR_GNSS_SYNCHRO_H_ #ifndef GNSS_SDR_GNSS_SYNCHRO_H_
#define GNSS_SDR_GNSS_SYNCHRO_H_ #define GNSS_SDR_GNSS_SYNCHRO_H_
@ -47,12 +48,14 @@ public:
char Signal[3]; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) char Signal[3]; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal)
uint32_t PRN; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal) uint32_t PRN; //!< Set by Channel::set_signal(Gnss_Signal gnss_signal)
int32_t Channel_ID; //!< Set by Channel constructor int32_t Channel_ID; //!< Set by Channel constructor
// Acquisition // Acquisition
double Acq_delay_samples; //!< Set by Acquisition processing block double Acq_delay_samples; //!< Set by Acquisition processing block
double Acq_doppler_hz; //!< Set by Acquisition processing block double Acq_doppler_hz; //!< Set by Acquisition processing block
uint64_t Acq_samplestamp_samples; //!< Set by Acquisition processing block uint64_t Acq_samplestamp_samples; //!< Set by Acquisition processing block
bool Flag_valid_acquisition; //!< Set by Acquisition processing block bool Flag_valid_acquisition; //!< Set by Acquisition processing block
//Tracking
// Tracking
int64_t fs; //!< Set by Tracking processing block int64_t fs; //!< Set by Tracking processing block
double Prompt_I; //!< Set by Tracking processing block double Prompt_I; //!< Set by Tracking processing block
double Prompt_Q; //!< Set by Tracking processing block double Prompt_Q; //!< Set by Tracking processing block
@ -61,11 +64,10 @@ public:
double Carrier_phase_rads; //!< Set by Tracking processing block double Carrier_phase_rads; //!< Set by Tracking processing block
double Code_phase_samples; //!< Set by Tracking processing block double Code_phase_samples; //!< Set by Tracking processing block
uint64_t Tracking_sample_counter; //!< Set by Tracking processing block uint64_t Tracking_sample_counter; //!< Set by Tracking processing block
bool Flag_valid_symbol_output; //!< Set by Tracking processing block bool Flag_valid_symbol_output; //!< Set by Tracking processing block
int32_t correlation_length_ms; //!< Set by Tracking processing block int32_t correlation_length_ms; //!< Set by Tracking processing block
//Telemetry Decoder // Telemetry Decoder
bool Flag_valid_word; //!< Set by Telemetry Decoder processing block bool Flag_valid_word; //!< Set by Telemetry Decoder processing block
uint32_t TOW_at_current_symbol_ms; //!< Set by Telemetry Decoder processing block uint32_t TOW_at_current_symbol_ms; //!< Set by Telemetry Decoder processing block
@ -75,9 +77,8 @@ public:
bool Flag_valid_pseudorange; //!< Set by Observables processing block bool Flag_valid_pseudorange; //!< Set by Observables processing block
double interp_TOW_ms; //!< Set by Observables processing block double interp_TOW_ms; //!< Set by Observables processing block
/*! /*!
* \brief This member function is necessary to serialize and restore * \brief This member function serializes and restores
* Gnss_Synchro objects from a byte stream. * Gnss_Synchro objects from a byte stream.
*/ */
template <class Archive> template <class Archive>
@ -91,11 +92,12 @@ public:
ar& Signal; ar& Signal;
ar& PRN; ar& PRN;
ar& Channel_ID; ar& Channel_ID;
// Acquisition
ar& Acq_delay_samples; ar& Acq_delay_samples;
ar& Acq_doppler_hz; ar& Acq_doppler_hz;
ar& Acq_samplestamp_samples; ar& Acq_samplestamp_samples;
ar& Flag_valid_acquisition; ar& Flag_valid_acquisition;
//Tracking // Tracking
ar& fs; ar& fs;
ar& Prompt_I; ar& Prompt_I;
ar& Prompt_Q; ar& Prompt_Q;
@ -106,7 +108,7 @@ public:
ar& Tracking_sample_counter; ar& Tracking_sample_counter;
ar& Flag_valid_symbol_output; ar& Flag_valid_symbol_output;
ar& correlation_length_ms; ar& correlation_length_ms;
//Telemetry Decoder // Telemetry Decoder
ar& Flag_valid_word; ar& Flag_valid_word;
ar& TOW_at_current_symbol_ms; ar& TOW_at_current_symbol_ms;
// Observables // Observables