1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 04:30:33 +00:00

Replace C-style cast by C++ casts

This commit is contained in:
Carles Fernandez 2017-08-19 02:33:54 +02:00
parent fe17181af3
commit 7ac3f282fa
36 changed files with 465 additions and 465 deletions

View File

@ -457,7 +457,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
unsigned int gal_channel = 0;
gnss_observables_map.clear();
Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
// ############ 1. READ PSEUDORANGES ####
for (unsigned int i = 0; i < d_nchannels; i++)

View File

@ -390,7 +390,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
}
case 1:
{
const gr_complex *in = (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
unsigned int buff_increment;
if (ninput_items[0] + d_buffer_count <= d_fft_size)
{
@ -414,7 +414,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
case 2:
{
// Fill last part of the buffer and reset counter
const gr_complex *in = (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
if (d_buffer_count < d_fft_size)
{
memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex)*(d_fft_size-d_buffer_count));

View File

@ -163,11 +163,11 @@ void galileo_pcps_8ms_acquisition_cc::init()
// Count the number of bins
d_num_doppler_bins = 0;
for (int doppler = static_cast<int>(-d_doppler_max);
doppler <= static_cast<int>(d_doppler_max);
doppler += d_doppler_step)
{
d_num_doppler_bins++;
}
doppler <= static_cast<int>(d_doppler_max);
doppler += d_doppler_step)
{
d_num_doppler_bins++;
}
// Create the carrier Doppler wipeoff signals
d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins];
@ -210,7 +210,6 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items __attribute__((unused)))
{
int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL
switch (d_state)
@ -247,7 +246,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
float magt = 0.0;
float magt_A = 0.0;
float magt_B = 0.0;
const gr_complex *in = (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);
d_input_power = 0.0;
d_mag = 0.0;
@ -271,7 +270,6 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{
// doppler search steps
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), in,
@ -315,15 +313,15 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items,
// Take the greater magnitude
if (magt_A >= magt_B)
{
magt = magt_A;
indext = indext_A;
}
{
magt = magt_A;
indext = indext_A;
}
else
{
magt = magt_B;
indext = indext_B;
}
{
magt = magt_B;
indext = indext_B;
}
// 4- record the maximum peak and the associated synchronization parameters
if (d_mag < magt)

View File

@ -256,6 +256,7 @@ void pcps_acquisition_cc::send_positive_acquisition()
}
void pcps_acquisition_cc::send_negative_acquisition()
{
// 6.2- Declare negative acquisition using a message port
@ -274,6 +275,7 @@ void pcps_acquisition_cc::send_negative_acquisition()
}
int pcps_acquisition_cc::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items __attribute__((unused)))
@ -318,7 +320,7 @@ int pcps_acquisition_cc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
int effective_fft_size = ( d_bit_transition_flag ? d_fft_size/2 : d_fft_size );

View File

@ -56,7 +56,6 @@ pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(
}
pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(
int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq,
long fs_in, int samples_per_ms, bool dump,
@ -108,6 +107,7 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc(
d_channel = 0;
}
void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_step)
{
d_doppler_step = doppler_step;
@ -123,6 +123,7 @@ void pcps_acquisition_fine_doppler_cc::set_doppler_step(unsigned int doppler_ste
update_carrier_wipeoff();
}
void pcps_acquisition_fine_doppler_cc::free_grid_memory()
{
for (int i = 0; i < d_num_doppler_points; i++)
@ -134,6 +135,7 @@ void pcps_acquisition_fine_doppler_cc::free_grid_memory()
delete d_grid_doppler_wipeoffs;
}
pcps_acquisition_fine_doppler_cc::~pcps_acquisition_fine_doppler_cc()
{
volk_gnsssdr_free(d_carrier);
@ -149,16 +151,15 @@ pcps_acquisition_fine_doppler_cc::~pcps_acquisition_fine_doppler_cc()
}
void pcps_acquisition_fine_doppler_cc::set_local_code(std::complex<float> * code)
{
memcpy(d_fft_if->get_inbuf(), code, sizeof(gr_complex) * d_fft_size);
d_fft_if->execute(); // We need the FFT of local code
//Conjugate the local code
volk_32fc_conjugate_32fc(d_fft_codes, d_fft_if->get_outbuf(), d_fft_size);
}
void pcps_acquisition_fine_doppler_cc::init()
{
d_gnss_synchro->Flag_valid_acquisition = false;
@ -171,9 +172,9 @@ void pcps_acquisition_fine_doppler_cc::init()
d_gnss_synchro->Acq_samplestamp_samples = 0;
d_input_power = 0.0;
d_state = 0;
}
void pcps_acquisition_fine_doppler_cc::forecast (int noutput_items,
gr_vector_int &ninput_items_required)
{
@ -216,6 +217,7 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff()
}
}
double pcps_acquisition_fine_doppler_cc::search_maximum()
{
float magt = 0.0;
@ -266,9 +268,10 @@ double pcps_acquisition_fine_doppler_cc::search_maximum()
return d_test_statistics;
}
float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_void_star &input_items)
{
const gr_complex *in = (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
// Compute the input signal power estimation
float power = 0;
volk_32fc_magnitude_squared_32f(d_magnitude, in, d_fft_size);
@ -277,6 +280,7 @@ float pcps_acquisition_fine_doppler_cc::estimate_input_power(gr_vector_const_voi
return power;
}
int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items)
{
// initialize acquisition algorithm
@ -288,8 +292,6 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
<< d_threshold << ", doppler_max: " << d_config_doppler_max
<< ", doppler_step: " << d_doppler_step;
// 2- Doppler frequency search loop
float* p_tmp_vector = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
@ -314,16 +316,15 @@ int pcps_acquisition_fine_doppler_cc::compute_and_accumulate_grid(gr_vector_cons
volk_32fc_magnitude_squared_32f(p_tmp_vector, d_ifft->get_outbuf(), d_fft_size);
const float* old_vector = d_grid_data[doppler_index];
volk_32f_x2_add_32f(d_grid_data[doppler_index], old_vector, p_tmp_vector, d_fft_size);
}
volk_gnsssdr_free(p_tmp_vector);
return d_fft_size;
}
int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star &input_items)
{
// Direct FFT
int zero_padding_factor = 2;
int fft_size_extended = d_fft_size * zero_padding_factor;
@ -346,7 +347,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
}
//2. Perform code wipe-off
const gr_complex *in = (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
volk_32fc_x2_multiply_32fc(fft_operator->get_inbuf(), in, code_replica, d_fft_size);
@ -367,7 +368,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
float fftFreqBins[fft_size_extended];
memset(fftFreqBins, 0, fft_size_extended * sizeof(float));
for (int k=0; k < (fft_size_extended / 2); k++)
for (int k = 0; k < (fft_size_extended / 2); k++)
{
fftFreqBins[counter] = ((static_cast<float>(d_fs_in) / 2.0) * static_cast<float>(k)) / (static_cast<float>(fft_size_extended) / 2.0);
counter++;
@ -419,7 +420,6 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star
// d_dump_file.close();
}
// free memory!!
delete fft_operator;
volk_gnsssdr_free(code_replica);
@ -432,7 +432,6 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items __attribute__((unused)))
{
/*!
* TODO: High sensitivity acquisition algorithm:
* State Mechine:
@ -479,9 +478,6 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items,
d_state = 5; //negative acquisition
}
break;
case 3: // Fine doppler estimation
//DLOG(INFO) <<"S3"<<std::endl;
DLOG(INFO) << "Performing fine Doppler estimation";

View File

@ -282,7 +282,7 @@ int pcps_acquisition_sc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const lv_16sc_t *in = (const lv_16sc_t *)input_items[0]; //Get the input samples pointer
const lv_16sc_t *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]); //Get the input samples pointer
int effective_fft_size = ( d_bit_transition_flag ? d_fft_size/2 : d_fft_size );
//TODO: optimize the signal processing chain to not use gr_complex. This is a temporary solution

View File

@ -314,7 +314,7 @@ double pcps_assisted_acquisition_cc::search_maximum()
float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_star &input_items)
{
const gr_complex *in = (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
// 1- Compute the input signal power estimation
float* p_tmp_vector = static_cast<float*>(volk_gnsssdr_malloc(d_fft_size * sizeof(float), volk_gnsssdr_get_alignment()));
@ -332,7 +332,7 @@ float pcps_assisted_acquisition_cc::estimate_input_power(gr_vector_const_void_st
int pcps_assisted_acquisition_cc::compute_and_accumulate_grid(gr_vector_const_void_star &input_items)
{
// initialize acquisition algorithm
const gr_complex *in = (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
DLOG(INFO) << "Channel: " << d_channel
<< " , doing acquisition of satellite: " << d_gnss_synchro->System << " "

View File

@ -260,7 +260,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items,
float magt = 0.0;
float magt_plus = 0.0;
float magt_minus = 0.0;
const gr_complex *in = (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);
d_sample_counter += d_fft_size; // sample counter

View File

@ -302,7 +302,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const gr_complex *in = (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
gr_complex* in_temp = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
gr_complex* in_temp_folded = static_cast<gr_complex*>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));

View File

@ -280,7 +280,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items,
int doppler;
uint32_t indext = 0;
float magt = 0.0;
const gr_complex *in = (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);
d_input_power = 0.0;
d_mag = 0.0;

View File

@ -55,8 +55,8 @@ int interleaved_byte_to_complex_byte::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int8_t *in = (const int8_t *) input_items[0];
lv_8sc_t *out = (lv_8sc_t *) output_items[0];
const int8_t *in = reinterpret_cast<const int8_t *>(input_items[0]);
lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int8_t real_part;
int8_t imag_part;

View File

@ -55,8 +55,8 @@ int interleaved_byte_to_complex_short::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int8_t *in = (const int8_t *) input_items[0];
lv_16sc_t *out = (lv_16sc_t *) output_items[0];
const int8_t *in = reinterpret_cast<const int8_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int8_t real_part;
int8_t imag_part;
@ -65,7 +65,7 @@ int interleaved_byte_to_complex_short::work(int noutput_items,
// lv_cmake(r, i) defined at volk/volk_complex.h
real_part = *in++;
imag_part = *in++;
*out++ = lv_cmake((int16_t)real_part, (int16_t)imag_part);
*out++ = lv_cmake(static_cast<int16_t>(real_part), static_cast<int16_t>(imag_part));
}
return noutput_items;
}

View File

@ -55,8 +55,8 @@ int interleaved_short_to_complex_short::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const int16_t *in = (const int16_t *) input_items[0];
lv_16sc_t *out = (lv_16sc_t *) output_items[0];
const int16_t *in = reinterpret_cast<const int16_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
// This could be put into a Volk kernel
int16_t real_part;
int16_t imag_part;

View File

@ -56,8 +56,8 @@ pulse_blanking_cc::pulse_blanking_cc(double Pfa) : gr::block("pulse_blanking_cc"
int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *) input_items[0];
gr_complex *out = (gr_complex *) output_items[0];
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
// 1- (optional) Compute the input signal power estimation
//float mean;

View File

@ -50,6 +50,7 @@ direct_resampler_conditioner_cb_sptr direct_resampler_make_conditioner_cb(
sample_freq_out));
}
direct_resampler_conditioner_cb::direct_resampler_conditioner_cb(
double sample_freq_in, double sample_freq_out) :
gr::block("direct_resampler_make_conditioner_cb", gr::io_signature::make(1,
@ -60,79 +61,80 @@ direct_resampler_conditioner_cb::direct_resampler_conditioner_cb(
const double two_32 = 4294967296.0;
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
if (d_sample_freq_in >= d_sample_freq_out)
{
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_out / sample_freq_in));
}
{
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_out / sample_freq_in));
}
else
{
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_in / sample_freq_out));
}
{
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_in / sample_freq_out));
}
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
set_output_multiple(1);
}
direct_resampler_conditioner_cb::~direct_resampler_conditioner_cb()
{
}
void direct_resampler_conditioner_cb::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int nreqd = std::max(static_cast<unsigned>(1), static_cast<int>(static_cast<double>(noutput_items + 1)
* sample_freq_in() / sample_freq_out()) + history() - 1);
unsigned ninputs = ninput_items_required.size();
for (unsigned i = 0; i < ninputs; i++)
{
ninput_items_required[i] = nreqd;
}
{
ninput_items_required[i] = nreqd;
}
}
int direct_resampler_conditioner_cb::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const lv_8sc_t *in = (const lv_8sc_t *)input_items[0];
lv_8sc_t *out = (lv_8sc_t *)output_items[0];
const lv_8sc_t *in = reinterpret_cast<const lv_8sc_t *>(input_items[0]);
lv_8sc_t *out = reinterpret_cast<lv_8sc_t *>(output_items[0]);
int lcv = 0;
int count = 0;
if (d_sample_freq_in >= d_sample_freq_out)
{
while ((lcv < noutput_items))
{
if (d_phase <= d_lphase)
{
out[lcv] = *in;
lcv++;
}
while ((lcv < noutput_items))
{
if (d_phase <= d_lphase)
{
out[lcv] = *in;
lcv++;
}
d_lphase = d_phase;
d_phase += d_phase_step;
in++;
count++;
d_lphase = d_phase;
d_phase += d_phase_step;
in++;
count++;
}
}
}
else
{
while ((lcv < noutput_items))
{
d_lphase = d_phase;
d_phase += d_phase_step;
if (d_phase <= d_lphase)
{
in++;
count++;
}
out[lcv] = *in;
lcv++;
while ((lcv < noutput_items))
{
d_lphase = d_phase;
d_phase += d_phase_step;
if (d_phase <= d_lphase)
{
in++;
count++;
}
out[lcv] = *in;
lcv++;
}
}
}
consume_each(std::min(count, ninput_items[0]));
return lcv;

View File

@ -43,7 +43,6 @@ using google::LogMessage;
direct_resampler_conditioner_cc_sptr direct_resampler_make_conditioner_cc(
double sample_freq_in, double sample_freq_out)
{
return direct_resampler_conditioner_cc_sptr(
new direct_resampler_conditioner_cc(sample_freq_in,
sample_freq_out));
@ -90,9 +89,9 @@ void direct_resampler_conditioner_cc::forecast(int noutput_items,
* sample_freq_in() / sample_freq_out()) + history() - 1);
unsigned ninputs = ninput_items_required.size();
for (unsigned i = 0; i < ninputs; i++)
{
ninput_items_required[i] = nreqd;
}
{
ninput_items_required[i] = nreqd;
}
}
@ -101,8 +100,8 @@ int direct_resampler_conditioner_cc::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const gr_complex *in = (const gr_complex *)input_items[0];
gr_complex *out = (gr_complex *)output_items[0];
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
int lcv = 0;
int count = 0;

View File

@ -43,12 +43,12 @@ using google::LogMessage;
direct_resampler_conditioner_cs_sptr direct_resampler_make_conditioner_cs(
double sample_freq_in, double sample_freq_out)
{
return direct_resampler_conditioner_cs_sptr(
new direct_resampler_conditioner_cs(sample_freq_in,
sample_freq_out));
}
direct_resampler_conditioner_cs::direct_resampler_conditioner_cs(
double sample_freq_in, double sample_freq_out) :
gr::block("direct_resampler_make_conditioner_cs", gr::io_signature::make(1,
@ -59,79 +59,80 @@ direct_resampler_conditioner_cs::direct_resampler_conditioner_cs(
const double two_32 = 4294967296.0;
// Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296
if (d_sample_freq_in >= d_sample_freq_out)
{
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_out / sample_freq_in));
}
{
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_out / sample_freq_in));
}
else
{
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_in / sample_freq_out));
}
{
d_phase_step = static_cast<uint32_t>(floor(two_32 * sample_freq_in / sample_freq_out));
}
set_relative_rate(1.0 * sample_freq_out / sample_freq_in);
set_output_multiple(1);
}
direct_resampler_conditioner_cs::~direct_resampler_conditioner_cs()
{
}
void direct_resampler_conditioner_cs::forecast(int noutput_items,
gr_vector_int &ninput_items_required)
{
int nreqd = std::max(static_cast<unsigned>(1), static_cast<int>(static_cast<double>(noutput_items + 1)
* sample_freq_in() / sample_freq_out()) + history() - 1);
unsigned ninputs = ninput_items_required.size();
for (unsigned i = 0; i < ninputs; i++)
{
ninput_items_required[i] = nreqd;
}
{
ninput_items_required[i] = nreqd;
}
}
int direct_resampler_conditioner_cs::general_work(int noutput_items,
gr_vector_int &ninput_items, gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const lv_16sc_t *in = (const lv_16sc_t *)input_items[0];
lv_16sc_t *out = (lv_16sc_t *)output_items[0];
const lv_16sc_t *in = reinterpret_cast<const lv_16sc_t *>(input_items[0]);
lv_16sc_t *out = reinterpret_cast<lv_16sc_t *>(output_items[0]);
int lcv = 0;
int count = 0;
if (d_sample_freq_in >= d_sample_freq_out)
{
while ((lcv < noutput_items))
{
if (d_phase <= d_lphase)
{
out[lcv] = *in;
lcv++;
}
while ((lcv < noutput_items))
{
if (d_phase <= d_lphase)
{
out[lcv] = *in;
lcv++;
}
d_lphase = d_phase;
d_phase += d_phase_step;
in++;
count++;
d_lphase = d_phase;
d_phase += d_phase_step;
in++;
count++;
}
}
}
else
{
while ((lcv < noutput_items))
{
d_lphase = d_phase;
d_phase += d_phase_step;
if (d_phase <= d_lphase)
{
in++;
count++;
}
out[lcv] = *in;
lcv++;
while ((lcv < noutput_items))
{
d_lphase = d_phase;
d_phase += d_phase_step;
if (d_phase <= d_lphase)
{
in++;
count++;
}
out[lcv] = *in;
lcv++;
}
}
}
consume_each(std::min(count, ninput_items[0]));
return lcv;

View File

@ -40,12 +40,14 @@ struct byte_2bit_struct
signed sample_3:2; // <- 2 bits wide only
};
union byte_and_samples
{
int8_t byte;
byte_2bit_struct samples;
};
bool systemIsBigEndian()
{
union
@ -57,6 +59,7 @@ bool systemIsBigEndian()
return test_int.c[0] == 1;
}
bool systemBytesAreBigEndian()
{
byte_and_samples b;
@ -65,6 +68,7 @@ bool systemBytesAreBigEndian()
else return true;
}
void swapEndianness( int8_t const *in, std::vector< int8_t > &out, size_t item_size, unsigned int ninput_items )
{
unsigned int i;
@ -74,16 +78,17 @@ void swapEndianness( int8_t const *in, std::vector< int8_t > &out, size_t item_s
size_t skip = item_size - 1;
for( i = 0; i < ninput_items; ++i )
{
k = j + skip;
l = j;
while( k >= l )
{
out[j++] = in[k--];
k = j + skip;
l = j;
while( k >= l )
{
out[j++] = in[k--];
}
}
}
}
unpack_2bit_samples_sptr make_unpack_2bit_samples( bool big_endian_bytes,
size_t item_size,
bool big_endian_items,
@ -97,6 +102,7 @@ unpack_2bit_samples_sptr make_unpack_2bit_samples( bool big_endian_bytes,
);
}
unpack_2bit_samples::unpack_2bit_samples( bool big_endian_bytes,
size_t item_size,
bool big_endian_items,
@ -111,7 +117,6 @@ unpack_2bit_samples::unpack_2bit_samples( bool big_endian_bytes,
swap_endian_items_(false),
reverse_interleaving_(reverse_interleaving)
{
bool big_endian_system = systemIsBigEndian();
// Only swap the item bytes if the item size > 1 byte and the system
@ -122,30 +127,31 @@ unpack_2bit_samples::unpack_2bit_samples( bool big_endian_bytes,
bool big_endian_bytes_system = systemBytesAreBigEndian();
swap_endian_bytes_ = ( big_endian_bytes_system != big_endian_bytes_ );
}
unpack_2bit_samples::~unpack_2bit_samples()
{}
int unpack_2bit_samples::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
signed char const *in = (signed char const *)input_items[0];
int8_t *out = (int8_t*)output_items[0];
signed char const *in = reinterpret_cast<signed char const *>(input_items[0]);
int8_t *out = reinterpret_cast<int8_t*>(output_items[0]);
size_t ninput_bytes = noutput_items/4;
size_t ninput_items = ninput_bytes/item_size_;
// Handle endian swap if needed
if( swap_endian_items_ )
{
work_buffer_.reserve( ninput_bytes );
swapEndianness( in, work_buffer_, item_size_, ninput_items );
{
work_buffer_.reserve( ninput_bytes );
swapEndianness( in, work_buffer_, item_size_, ninput_items );
in = const_cast< signed char const *> ( &work_buffer_[0] );
}
in = const_cast< signed char const *> ( &work_buffer_[0] );
}
// Here the in pointer can be interpreted as a stream of bytes to be
// converted. But we now have two possibilities:
@ -156,68 +162,63 @@ int unpack_2bit_samples::work(int noutput_items,
int n = 0;
if( !reverse_interleaving_ )
{
if( swap_endian_bytes_ )
{
for(unsigned int i = 0; i < ninput_bytes; ++i)
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
if( swap_endian_bytes_ )
{
for(unsigned int i = 0; i < ninput_bytes; ++i)
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
out[n++] = (int8_t)( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_0 + 1 );
}
}
else
{
for(unsigned int i = 0; i < ninput_bytes; ++i )
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
}
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_3 + 1 );
}
}
}
else
{
for(unsigned int i = 0; i < ninput_bytes; ++i )
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
out[n++] = (int8_t)( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_3 + 1 );
}
}
}
else
{
if( swap_endian_bytes_ )
{
for(unsigned int i = 0; i < ninput_bytes; ++i)
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
if( swap_endian_bytes_ )
{
for(unsigned int i = 0; i < ninput_bytes; ++i)
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
out[n++] = (int8_t)( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_2 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_1 + 1 );
}
}
else
{
for(unsigned int i = 0; i < ninput_bytes; ++i )
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
}
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = static_cast<int8_t>( 2*raw_byte.samples.sample_2 + 1 );
}
}
}
else
{
for(unsigned int i = 0; i < ninput_bytes; ++i )
{
// Read packed input sample (1 byte = 4 samples)
raw_byte.byte = in[i];
out[n++] = (int8_t)( 2*raw_byte.samples.sample_1 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_0 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_3 + 1 );
out[n++] = (int8_t)( 2*raw_byte.samples.sample_2 + 1 );
}
}
}
return noutput_items;
}

View File

@ -47,21 +47,24 @@ unpack_byte_2bit_cpx_samples_sptr make_unpack_byte_2bit_cpx_samples()
return unpack_byte_2bit_cpx_samples_sptr(new unpack_byte_2bit_cpx_samples());
}
unpack_byte_2bit_cpx_samples::unpack_byte_2bit_cpx_samples() : sync_interpolator("unpack_byte_2bit_cpx_samples",
gr::io_signature::make(1, 1, sizeof(signed char)),
gr::io_signature::make(1, 1, sizeof(short)),
4)
{}
unpack_byte_2bit_cpx_samples::~unpack_byte_2bit_cpx_samples()
{}
int unpack_byte_2bit_cpx_samples::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const signed char *in = (const signed char *)input_items[0];
short *out = (short*)output_items[0];
const signed char *in = reinterpret_cast<const signed char *>(input_items[0]);
short *out = reinterpret_cast<short *>(output_items[0]);
byte_2bit_struct sample;
int n = 0;
@ -91,16 +94,16 @@ int unpack_byte_2bit_cpx_samples::work(int noutput_items,
signed char c = in[i];
//I[n]
sample.two_bit_sample = (c >> 4) & 3;
out[n++] = (2*(short)sample.two_bit_sample + 1);
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
//Q[n]
sample.two_bit_sample = (c >> 6) & 3;
out[n++] = (2*(short)sample.two_bit_sample + 1);
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
//I[n+1]
sample.two_bit_sample = c & 3;
out[n++] = (2*(short)sample.two_bit_sample + 1);
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
//Q[n+1]
sample.two_bit_sample = (c >> 2) & 3;
out[n++] = (2*(short)sample.two_bit_sample + 1);
out[n++] = (2 * static_cast<short>(sample.two_bit_sample) + 1);
}
return noutput_items;
}

View File

@ -59,8 +59,8 @@ int unpack_byte_2bit_samples::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const signed char *in = (const signed char *)input_items[0];
float *out = (float*)output_items[0];
const signed char *in = reinterpret_cast<const signed char *>(input_items[0]);
float *out = reinterpret_cast<float *>(output_items[0]);
byte_2bit_struct sample;
int n = 0;

View File

@ -55,8 +55,8 @@ int unpack_intspir_1bit_samples::work(int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
const signed int *in = (const signed int *)input_items[0];
float *out = (float*)output_items[0];
const signed int *in = reinterpret_cast<const signed int *>(input_items[0]);
float *out = reinterpret_cast<float*>(output_items[0]);
int n = 0;
int channel = 1;

View File

@ -284,8 +284,8 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
int corr_value = 0;
int preamble_diff = 0;
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
@ -295,9 +295,9 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
consume_each(1);
d_flag_preamble = false;
unsigned int required_symbols=GALILEO_INAV_PAGE_SYMBOLS+d_symbols_per_preamble;
unsigned int required_symbols = GALILEO_INAV_PAGE_SYMBOLS + d_symbols_per_preamble;
if (d_symbol_history.size()>required_symbols)
if (d_symbol_history.size() > required_symbols)
{
// TODO Optimize me!
//******* preamble correlation ********
@ -432,7 +432,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64)));
}
if (d_flag_frame_sync == true and d_nav.flag_TOW_set == true)
if(d_flag_frame_sync == true and d_nav.flag_TOW_set == true)
{
current_symbol.Flag_valid_word = true;
}
@ -442,7 +442,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
}
current_symbol.TOW_at_current_symbol_s = floor(d_TOW_at_current_symbol*1000.0)/1000.0;
current_symbol.TOW_at_current_symbol_s -=delta_t; //Galileo to GPS TOW
current_symbol.TOW_at_current_symbol_s -= delta_t; //Galileo to GPS TOW
if(d_dump == true)
{
@ -466,9 +466,9 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
// remove used symbols from history
if (d_symbol_history.size()>required_symbols)
{
d_symbol_history.pop_front();
}
{
d_symbol_history.pop_front();
}
//3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
//std::cout<<"GPS L1 TLM output on CH="<<this->d_channel << " SAMPLE STAMP="<<d_sample_counter/d_decimation_output_factor<<std::endl;

View File

@ -175,7 +175,6 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols,int fram
std::cout << "New Galileo E5a F/NAV message received: UTC model parameters from satellite " << d_satellite << std::endl;
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
}
}
@ -246,8 +245,9 @@ galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc()
int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
/* Terminology: Prompt: output from tracking Prompt correlator (Prompt samples)
* Symbol: encoded navigation bits. 1 symbol = 20 samples in E5a
* Bit: decoded navigation bits forming words as described in Galileo ICD

View File

@ -48,6 +48,7 @@ gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, dump));
}
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
Gnss_Satellite satellite,
bool dump) :
@ -68,7 +69,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
//memcpy((unsigned short int*)this->d_preambles_bits, (unsigned short int*)preambles_bits, GPS_CA_PREAMBLE_LENGTH_BITS*sizeof(unsigned short int));
// preamble bits to sampled symbols
d_preambles_symbols = (signed int*)malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_SYMBOLS);
d_preambles_symbols = static_cast<signed int*>(malloc(sizeof(signed int) * GPS_CA_PREAMBLE_LENGTH_SYMBOLS));
int n = 0;
for (int i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
{
@ -150,14 +151,11 @@ bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
int corr_value = 0;
int preamble_diff_ms = 0;
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
// ########### Output the tracking data to navigation and PVT ##########
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
@ -165,7 +163,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
d_symbol_history.push_back(current_symbol); //add new symbol to the symbol queue
consume_each(1);
unsigned int required_symbols=GPS_CA_PREAMBLE_LENGTH_SYMBOLS;
unsigned int required_symbols = GPS_CA_PREAMBLE_LENGTH_SYMBOLS;
d_flag_preamble = false;
if (d_symbol_history.size()>required_symbols)
@ -186,8 +184,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
}
if (corr_value >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS) break;
}
}
//******* frame sync ******************
if (abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
{
@ -365,11 +363,10 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
current_symbol.TOW_at_current_symbol_s = d_TOW_at_current_symbol;
current_symbol.Flag_valid_word = flag_TOW_set;
if (flag_PLL_180_deg_phase_locked == true)
{
//correct the accumulated phase for the Costas loop phase shift, if required
current_symbol.Carrier_phase_rads += GPS_PI;
current_symbol.Carrier_phase_rads += GPS_PI;
}
if(d_dump == true)
@ -394,15 +391,16 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
// remove used symbols from history
if (d_symbol_history.size()>required_symbols)
{
d_symbol_history.pop_front();
}
{
d_symbol_history.pop_front();
}
//3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_symbol;
return 1;
}
void gps_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
{
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());

View File

@ -93,8 +93,8 @@ int gps_l2c_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// get pointers on in- and output gnss-synchro objects
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
bool flag_new_cnav_frame = false;
cnav_msg_t msg;

View File

@ -98,8 +98,8 @@ int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
{
VLOG(FLOW) << "general_work(): " << "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0];
// get pointers on in- and output gnss-synchro objects
const Gnss_Synchro *in = (const Gnss_Synchro *) input_items[0]; // input
Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output

View File

@ -286,8 +286,8 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items __attri
double code_error_filt_chips = 0.0;
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0];
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -282,8 +282,8 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attr
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0];
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
if (d_enable_tracking == true)
{
// Fill the acquisition data

View File

@ -388,7 +388,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute
double code_error_filt_chips;
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //block output streams pointer
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); //block output streams pointer
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data;
@ -404,7 +404,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute
{
case 0:
{
d_Early = gr_complex(0,0);
d_Prompt = gr_complex(0,0);
d_Late = gr_complex(0,0);
@ -438,7 +437,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute
case 2:
{
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]); //PRN start block alignment
gr_complex sec_sign_Q;
gr_complex sec_sign_I;
// Secondary code Chip

View File

@ -331,8 +331,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attri
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -335,7 +335,7 @@ int gps_l1_ca_dll_pll_c_aid_tracking_fpga_sc::general_work(
int samples_offset;
// Block input data and block output stream pointers
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -335,8 +335,8 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attri
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// Block input data and block output stream pointers
const lv_16sc_t* in = (lv_16sc_t*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const lv_16sc_t* in = reinterpret_cast<const lv_16sc_t*>(input_items[0]); //PRN start block alignment
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();

View File

@ -82,9 +82,9 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::forecast (int noutput_items,
gr_vector_int &ninput_items_required)
{
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<int>(d_vector_length) * 2; //set the required available samples in each call
}
}
@ -218,9 +218,9 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
double corrected_acq_phase_samples, delay_correction_samples;
corrected_acq_phase_samples = fmod((d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * static_cast<double>(d_fs_in)), T_prn_true_samples);
if (corrected_acq_phase_samples < 0)
{
corrected_acq_phase_samples = T_prn_mod_samples + corrected_acq_phase_samples;
}
{
corrected_acq_phase_samples = T_prn_mod_samples + corrected_acq_phase_samples;
}
delay_correction_samples = d_acq_code_phase_samples - corrected_acq_phase_samples;
d_acq_code_phase_samples = corrected_acq_phase_samples;
@ -237,9 +237,9 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking()
multicorrelator_cpu.set_local_code_and_taps(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips);
for (int n = 0; n < d_n_correlator_taps; n++)
{
d_correlator_outs[n] = gr_complex(0,0);
}
{
d_correlator_outs[n] = gr_complex(0,0);
}
d_carrier_lock_fail_counter = 0;
d_rem_code_phase_samples = 0;
@ -305,211 +305,211 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__
double code_error_filt_chips = 0.0;
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();
if (d_enable_tracking == true)
{
// Fill the acquisition data
current_synchro_data = *d_acquisition_gnss_synchro;
// Receiver signal alignment
if (d_pull_in == true)
{
int samples_offset;
double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples;
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));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
d_pull_in = false;
// take into account the carrier cycles accumulated in the pull in signal alignment
d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * samples_offset;
// Fill the acquisition data
current_synchro_data = *d_acquisition_gnss_synchro;
// Receiver signal alignment
if (d_pull_in == true)
{
int samples_offset;
double acq_trk_shif_correction_samples;
int acq_to_trk_delay_samples;
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));
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
current_synchro_data.Tracking_sample_counter = d_sample_counter + samples_offset;
d_sample_counter = d_sample_counter + samples_offset; // count for the processed samples
d_pull_in = false;
// take into account the carrier cycles accumulated in the pull in signal alignment
d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * samples_offset;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
current_synchro_data.fs = d_fs_in;
current_synchro_data.correlation_length_ms = 1;
*out[0] = current_synchro_data;
consume_each(samples_offset); // shift input to perform alignment with local replica
return 1;
}
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
// perform carrier wipe-off and compute Early, Prompt and Late correlation
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
d_carrier_phase_step_rad,
d_rem_code_phase_chips,
d_code_phase_step_chips,
d_current_prn_length_samples);
// ################## PLL ##########################################################
// PLL discriminator
// Update PLL discriminator [rads/Ti -> Secs/Ti]
carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; // prompt output
// Carrier discriminator filter
carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz);
// New carrier Doppler frequency estimation
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_error_filt_hz;
// New code Doppler frequency estimation
d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ);
// ################## DLL ##########################################################
// DLL discriminator
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
// Code discriminator filter
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second]
double T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_chips);
double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips*T_chip_seconds); //[seconds]
//double code_error_filt_secs = (GPS_L1_CA_CODE_PERIOD * code_error_filt_chips) / GPS_L1_CA_CODE_RATE_HZ; // [seconds]
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
// keep alignment parameters for the next input buffer
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
//double T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_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 K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
//################### PLL COMMANDS #################################################
// carrier phase step (NCO phase increment per sample) [rads/sample]
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
// remnant carrier phase to prevent overflow in the code NCO
d_rem_carr_phase_rad = d_rem_carr_phase_rad + d_carrier_phase_step_rad * d_current_prn_length_samples;
d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, GPS_TWO_PI);
// carrier phase accumulator
d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * d_current_prn_length_samples;
//################### DLL COMMANDS #################################################
// code phase step (Code resampler phase increment per sample) [chips/sample]
d_code_phase_step_chips = d_code_freq_chips / static_cast<double>(d_fs_in);
// remnant code phase [chips]
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast<double>(d_fs_in));
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES)
{
// fill buffer with prompt correlator output values
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt
d_cn0_estimation_counter++;
}
else
{
d_cn0_estimation_counter = 0;
// Code lock indicator
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS);
// Carrier lock indicator
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
// Loss of lock detection
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
{
d_carrier_lock_fail_counter++;
}
else
{
if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--;
}
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
{
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock
d_carrier_lock_fail_counter = 0;
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
}
}
// ########### 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_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.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
current_synchro_data.fs = d_fs_in;
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
current_synchro_data.Flag_valid_symbol_output = true;
current_synchro_data.correlation_length_ms = 1;
*out[0] = current_synchro_data;
consume_each(samples_offset); // shift input to perform alignment with local replica
return 1;
}
// ################# CARRIER WIPEOFF AND CORRELATORS ##############################
// perform carrier wipe-off and compute Early, Prompt and Late correlation
multicorrelator_cpu.set_input_output_vectors(d_correlator_outs, in);
multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad,
d_carrier_phase_step_rad,
d_rem_code_phase_chips,
d_code_phase_step_chips,
d_current_prn_length_samples);
// ################## PLL ##########################################################
// PLL discriminator
// Update PLL discriminator [rads/Ti -> Secs/Ti]
carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; // prompt output
// Carrier discriminator filter
carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz);
// New carrier Doppler frequency estimation
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_error_filt_hz;
// New code Doppler frequency estimation
d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ);
// ################## DLL ##########################################################
// DLL discriminator
code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); // [chips/Ti] //early and late
// Code discriminator filter
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); // [chips/second]
double T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_chips);
double T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
double code_error_filt_secs = (T_prn_seconds * code_error_filt_chips*T_chip_seconds); //[seconds]
//double code_error_filt_secs = (GPS_L1_CA_CODE_PERIOD * code_error_filt_chips) / GPS_L1_CA_CODE_RATE_HZ; // [seconds]
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
// keep alignment parameters for the next input buffer
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
//double T_chip_seconds = 1.0 / static_cast<double>(d_code_freq_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 K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples
//################### PLL COMMANDS #################################################
// carrier phase step (NCO phase increment per sample) [rads/sample]
d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast<double>(d_fs_in);
// remnant carrier phase to prevent overflow in the code NCO
d_rem_carr_phase_rad = d_rem_carr_phase_rad + d_carrier_phase_step_rad * d_current_prn_length_samples;
d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, GPS_TWO_PI);
// carrier phase accumulator
d_acc_carrier_phase_rad -= d_carrier_phase_step_rad * d_current_prn_length_samples;
//################### DLL COMMANDS #################################################
// code phase step (Code resampler phase increment per sample) [chips/sample]
d_code_phase_step_chips = d_code_freq_chips / static_cast<double>(d_fs_in);
// remnant code phase [chips]
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; // rounding error < 1 sample
d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast<double>(d_fs_in));
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES)
{
// fill buffer with prompt correlator output values
d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt
d_cn0_estimation_counter++;
}
else
{
d_cn0_estimation_counter = 0;
// Code lock indicator
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS);
// Carrier lock indicator
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
// Loss of lock detection
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
{
d_carrier_lock_fail_counter++;
}
else
{
if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--;
}
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
{
std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl;
LOG(INFO) << "Loss of lock in channel " << d_channel << "!";
this->message_port_pub(pmt::mp("events"), pmt::from_long(3)); // 3 -> loss of lock
d_carrier_lock_fail_counter = 0;
d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine
}
}
// ########### 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_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.Code_phase_samples = d_rem_code_phase_samples;
current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad;
current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz;
current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz;
current_synchro_data.Flag_valid_symbol_output = true;
current_synchro_data.correlation_length_ms = 1;
}
else
{
for (int n = 0; n < d_n_correlator_taps; n++)
{
d_correlator_outs[n] = gr_complex(0,0);
}
for (int n = 0; n < d_n_correlator_taps; n++)
{
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.System = {'G'};
current_synchro_data.correlation_length_ms = 1;
}
current_synchro_data.Tracking_sample_counter =d_sample_counter + d_current_prn_length_samples;
current_synchro_data.System = {'G'};
current_synchro_data.correlation_length_ms = 1;
}
//assign the GNURadio block output data
current_synchro_data.fs = d_fs_in;
*out[0] = current_synchro_data;
if(d_dump)
{
// MULTIPLEXED FILE RECORDING - Record results to file
float prompt_I;
float prompt_Q;
float tmp_E, tmp_P, tmp_L;
double tmp_double;
unsigned long int tmp_long;
prompt_I = d_correlator_outs[1].real();
prompt_Q = d_correlator_outs[1].imag();
tmp_E = std::abs<float>(d_correlator_outs[0]);
tmp_P = std::abs<float>(d_correlator_outs[1]);
tmp_L = std::abs<float>(d_correlator_outs[2]);
try
{
// EPR
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
// PROMPT I and Q (to analyze navigation symbols)
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
// PRN start sample stamp
tmp_long = d_sample_counter + d_current_prn_length_samples;
d_dump_file.write(reinterpret_cast<char*>(&tmp_long), sizeof(unsigned long int));
// accumulated carrier phase
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(double));
// MULTIPLEXED FILE RECORDING - Record results to file
float prompt_I;
float prompt_Q;
float tmp_E, tmp_P, tmp_L;
double tmp_double;
unsigned long int tmp_long;
prompt_I = d_correlator_outs[1].real();
prompt_Q = d_correlator_outs[1].imag();
tmp_E = std::abs<float>(d_correlator_outs[0]);
tmp_P = std::abs<float>(d_correlator_outs[1]);
tmp_L = std::abs<float>(d_correlator_outs[2]);
try
{
// EPR
d_dump_file.write(reinterpret_cast<char*>(&tmp_E), sizeof(float));
d_dump_file.write(reinterpret_cast<char*>(&tmp_P), sizeof(float));
d_dump_file.write(reinterpret_cast<char*>(&tmp_L), sizeof(float));
// PROMPT I and Q (to analyze navigation symbols)
d_dump_file.write(reinterpret_cast<char*>(&prompt_I), sizeof(float));
d_dump_file.write(reinterpret_cast<char*>(&prompt_Q), sizeof(float));
// PRN start sample stamp
tmp_long = d_sample_counter + d_current_prn_length_samples;
d_dump_file.write(reinterpret_cast<char*>(&tmp_long), sizeof(unsigned long int));
// accumulated carrier phase
d_dump_file.write(reinterpret_cast<char*>(&d_acc_carrier_phase_rad), sizeof(double));
// carrier and code frequency
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
// carrier and code frequency
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_doppler_hz), sizeof(double));
d_dump_file.write(reinterpret_cast<char*>(&d_code_freq_chips), sizeof(double));
// PLL commands
d_dump_file.write(reinterpret_cast<char*>(&carr_error_hz), sizeof(double));
d_dump_file.write(reinterpret_cast<char*>(&carr_error_filt_hz), sizeof(double));
// PLL commands
d_dump_file.write(reinterpret_cast<char*>(&carr_error_hz), sizeof(double));
d_dump_file.write(reinterpret_cast<char*>(&carr_error_filt_hz), sizeof(double));
// DLL commands
d_dump_file.write(reinterpret_cast<char*>(&code_error_chips), sizeof(double));
d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
// DLL commands
d_dump_file.write(reinterpret_cast<char*>(&code_error_chips), sizeof(double));
d_dump_file.write(reinterpret_cast<char*>(&code_error_filt_chips), sizeof(double));
// CN0 and carrier lock test
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
// CN0 and carrier lock test
d_dump_file.write(reinterpret_cast<char*>(&d_CN0_SNV_dB_Hz), sizeof(double));
d_dump_file.write(reinterpret_cast<char*>(&d_carrier_lock_test), sizeof(double));
// AUX vars (for debug purposes)
tmp_double = d_rem_code_phase_samples;
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
tmp_double = static_cast<double>(d_sample_counter);
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
// AUX vars (for debug purposes)
tmp_double = d_rem_code_phase_samples;
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
tmp_double = static_cast<double>(d_sample_counter);
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
// PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
// PRN
unsigned int prn_ = d_acquisition_gnss_synchro->PRN;
d_dump_file.write(reinterpret_cast<char*>(&prn_), sizeof(unsigned int));
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "Exception writing trk dump file " << e.what();
}
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "Exception writing trk dump file " << e.what();
}
}
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
d_sample_counter += d_current_prn_length_samples; // count for the processed samples
@ -524,23 +524,23 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel)
LOG(INFO) << "Tracking Channel set to " << d_channel;
// ############# ENABLE DATA FILE LOG #################
if (d_dump == true)
{
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
}
if (d_dump_file.is_open() == false)
{
try
{
d_dump_filename.append(boost::lexical_cast<std::string>(d_channel));
d_dump_filename.append(".dat");
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit);
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str();
}
catch (const std::ifstream::failure &e)
{
LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what();
}
}
}
}
}

View File

@ -301,8 +301,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();
@ -539,6 +539,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribu
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
}
void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::set_channel(unsigned int channel)
{
d_channel = channel;

View File

@ -189,6 +189,7 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
d_code_phase_step_chips = 0.0;
}
void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking()
{
/*
@ -315,8 +316,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
Gnss_Synchro current_synchro_data = Gnss_Synchro();
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0];
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
if (d_enable_tracking == true)
{
@ -345,7 +346,6 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attri
return 1;
}
// Update the prn length based on code freq (variable) and
// sampling frequency (fixed)
// variable code PRN sample block size

View File

@ -81,9 +81,9 @@ void gps_l2_m_dll_pll_tracking_cc::forecast (int noutput_items,
gr_vector_int &ninput_items_required)
{
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<int>(d_vector_length) * 2; //set the required available samples in each call
}
}
@ -310,8 +310,8 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__(
Gnss_Synchro current_synchro_data = Gnss_Synchro();
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
if (d_enable_tracking == true)
{