1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-02-18 20:10:09 +00:00

final version

This commit is contained in:
marc-sales 2014-08-20 10:59:47 +02:00
parent 3b3c809dab
commit 1d3d40cefd
22 changed files with 412 additions and 285 deletions

View File

@ -306,9 +306,9 @@ Acquisition.bit_transition_flag=false
;#max_dwells: Maximum number of consecutive dwells to be processed. It will be ignored if bit_transition_flag=true
Acquisition.max_dwells=1
;#CAF filter: Resolves doppler ambiguity averaging the specified BW in the winner code delay. If set to 0 CAF filter is desactivated.
Acquisition.CAF_window_hz=2000
;#Zero_padding: Avoids power loss and doppler ambiguity in bit transitions by correlating one code with twice the input data length, ensuring that at least one full code is present without transitions.
;#CAF filter: **Only for E5a** Resolves doppler ambiguity averaging the specified BW in the winner code delay. If set to 0 CAF filter is desactivated. Recommended value 3000 Hz
Acquisition.CAF_window_hz=0
;#Zero_padding: **Only for E5a** Avoids power loss and doppler ambiguity in bit transitions by correlating one code with twice the input data length, ensuring that at least one full code is present without transitions.
;#If set to 1 it is ON, if set to 0 it is OFF.
Acquisition.Zero_padding=0
@ -349,18 +349,21 @@ Tracking.dump=true
;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number.
Tracking.dump_filename=./tracking_ch_
;#pll_bw_hz_init: PLL loop filter bandwidth during initialization [Hz]
;#pll_bw_hz_init: **Only for E5a** PLL loop filter bandwidth during initialization [Hz]
Tracking.pll_bw_hz_init=20.0;
;#dll_bw_hz_init: DLL loop filter bandwidth during initialization [Hz]
;#dll_bw_hz_init: **Only for E5a** DLL loop filter bandwidth during initialization [Hz]
Tracking.dll_bw_hz_init=20.0;
;#dll_ti_ms: loop filter integration time after initialization (secondary code delay search)[ms]
Tracking.ti_ms=3;
;#dll_ti_ms: **Only for E5a** loop filter integration time after initialization (secondary code delay search)[ms]
;Tracking.ti_ms=3;
Tracking.ti_ms=1;
;#pll_bw_hz: PLL loop filter bandwidth [Hz]
Tracking.pll_bw_hz=5.0;
;Tracking.pll_bw_hz=5.0;
Tracking.pll_bw_hz=20.0;
;#dll_bw_hz: DLL loop filter bandwidth [Hz]
Tracking.dll_bw_hz=2.0;
;Tracking.dll_bw_hz=2.0;
Tracking.dll_bw_hz=20.0;
;#fll_bw_hz: FLL loop filter bandwidth [Hz]
;Tracking.fll_bw_hz=10.0;

View File

@ -107,7 +107,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf(
item_size_ = sizeof(gr_complex);
acquisition_cc_ = galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(sampled_ms_, max_dwells_,
shift_resolution_, if_, fs_in_, code_length_, code_length_,
bit_transition_flag_, queue_, dump_, dump_filename_, both_signal_components, CAF_window_hz_);
bit_transition_flag_, queue_, dump_, dump_filename_, both_signal_components, CAF_window_hz_,Zero_padding);
}
else
{

View File

@ -55,12 +55,13 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make
gr::msg_queue::sptr queue, bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_)
int CAF_window_hz_,
int Zero_padding_)
{
return galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr(
new galileo_e5a_noncoherentIQ_acquisition_caf_cc(sampled_ms, max_dwells, doppler_max, freq, fs_in, samples_per_ms,
samples_per_code, bit_transition_flag, queue, dump, dump_filename, both_signal_components_, CAF_window_hz_));
samples_per_code, bit_transition_flag, queue, dump, dump_filename, both_signal_components_, CAF_window_hz_, Zero_padding_));
}
galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisition_caf_cc(
@ -72,7 +73,8 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
gr::msg_queue::sptr queue, bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_) :
int CAF_window_hz_,
int Zero_padding_) :
gr::block("galileo_e5a_noncoherentIQ_acquisition_caf_cc",
gr::io_signature::make(1, 1, sizeof(gr_complex)),
gr::io_signature::make(0, 0, sizeof(gr_complex)))
@ -88,6 +90,14 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
d_max_dwells = max_dwells;
d_well_count = 0;
d_doppler_max = doppler_max;
if (Zero_padding_ > 0)
{
d_sampled_ms = 1;
}
else
{
d_sampled_ms = sampled_ms;
}
d_fft_size = sampled_ms * d_samples_per_ms;
d_mag = 0;
d_input_power = 0.0;
@ -95,8 +105,6 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
d_bit_transition_flag = bit_transition_flag;
d_buffer_count=0;
d_both_signal_components = both_signal_components_;
// d_CAF_filter = true;
// d_CAF_window_hz = 6000;
d_CAF_window_hz = CAF_window_hz_;
//todo: do something if posix_memalign fails
@ -109,8 +117,8 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit
if (posix_memalign((void**)&d_fft_code_Q_A, 16, d_fft_size * sizeof(gr_complex)) == 0){};
if (posix_memalign((void**)&d_magnitudeQA, 16, d_fft_size * sizeof(float)) == 0){};
}
// IF INTEGRATION TIME > 1
if (d_samples_per_ms != d_fft_size)
// IF COHERENT INTEGRATION TIME > 1
if (d_sampled_ms > 1)
{
if (posix_memalign((void**)&d_fft_code_I_B, 16, d_fft_size * sizeof(gr_complex)) == 0){};
if (posix_memalign((void**)&d_magnitudeIB, 16, d_fft_size * sizeof(float)) == 0){};
@ -158,7 +166,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::~galileo_e5a_noncoherentIQ_acquisi
free(d_magnitudeQA);
}
// IF INTEGRATION TIME > 1
if (d_samples_per_ms != d_fft_size)
if (d_sampled_ms > 1)
{
free(d_fft_code_I_B);
free(d_magnitudeIB);
@ -217,7 +225,7 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::set_local_code(std::complex<f
}
// IF INTEGRATION TIME > 1 code, we need to evaluate the other possible combination
// Note: max integration time allowed = 3ms (dealt in adapter)
if (d_samples_per_ms != d_fft_size)
if (d_sampled_ms > 1)
{
// DATA CODE B: First replica is inverted (0,1,1)
volk_32fc_s32fc_multiply_32fc_a(&(d_fft_if->get_inbuf())[0],
@ -430,7 +438,6 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// Search maximum
volk_32fc_magnitude_squared_32f_a(d_magnitudeIA, d_ifft->get_outbuf(), d_fft_size);
volk_32f_index_max_16u_a(&indext_IA, d_magnitudeIA, d_fft_size);
// Normalize the maximum value to correct the scale factor introduced by FFTW
magt_IA = d_magnitudeIA[indext_IA] / (fft_normalization_factor * fft_normalization_factor);
@ -444,7 +451,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
volk_32f_index_max_16u_a(&indext_QA, d_magnitudeQA, d_fft_size);
magt_QA = d_magnitudeQA[indext_QA] / (fft_normalization_factor * fft_normalization_factor);
}
if (d_samples_per_ms != d_fft_size) // If Integration time > 1 code
if (d_sampled_ms > 1) // If Integration time > 1 code
{
// REPEAT FOR ALL CODES. CODE_IB
volk_32fc_x2_multiply_32fc_a(d_ifft->get_inbuf(),
@ -470,7 +477,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// and store the result in the I channel.
// If CAF filter to resolve doppler ambiguity is needed,
// peak is stored before non-coherent integration.
if (d_samples_per_ms != d_fft_size) // T_integration > 1 code
if (d_sampled_ms > 1) // T_integration > 1 code
{
if (magt_IA >= magt_IB)
{
@ -580,7 +587,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
filename << "../data/test_statistics_E5a_sat_"
<< d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat";
d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary);
if (d_samples_per_ms != d_fft_size) // If integration time > 1 code
if (d_sampled_ms > 1) // If integration time > 1 code
{
if (magt_IA >= magt_IB)
{
@ -598,7 +605,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
d_dump_file.close();
}
}
std::cout << "d_mag " << d_mag << ".d_sample_counter " << d_sample_counter << std::endl;
// std::cout << "d_mag " << d_mag << ".d_sample_counter " << d_sample_counter << ". acq delay " << d_gnss_synchro->Acq_delay_samples<< " indext "<< indext << std::endl;
// 6 OPTIONAL: CAF filter to avoid Doppler ambiguity in bit transition.
if (d_CAF_window_hz > 0)
{
@ -607,7 +614,10 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// double* accum;
if (posix_memalign((void**)&accum, 16, sizeof(float)) == 0){};
CAF_bins_half = d_CAF_window_hz/(2*d_doppler_step);
std::cout << "CAF_bins_half " << CAF_bins_half << std::endl;
float weighting_factor;
weighting_factor = 0.5/(float)CAF_bins_half;
// weighting_factor = 0;
// std::cout << "weighting_factor " << weighting_factor << std::endl;
// Initialize first iterations
for (int doppler_index=0;doppler_index<CAF_bins_half;doppler_index++)
{
@ -615,20 +625,20 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], d_CAF_vector_I, CAF_bins_half+doppler_index+1);
for (int i = 0; i < CAF_bins_half+doppler_index+1; i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-0.1*(abs(doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-weighting_factor*(unsigned int)(abs(doppler_index - i)));
}
// d_CAF_vector[doppler_index] /= CAF_bins_half+doppler_index+1;
d_CAF_vector[doppler_index] /= 1+CAF_bins_half+doppler_index - 0.1*CAF_bins_half*(CAF_bins_half+1)/2 - 0.1*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] /= 1+CAF_bins_half+doppler_index - weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2 - weighting_factor*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2]
if (d_both_signal_components)
{
accum[0] = 0;
// volk_32f_accumulator_s32f_a(&accum[0], d_CAF_vector_Q, CAF_bins_half+doppler_index+1);
for (int i = 0; i < CAF_bins_half+doppler_index+1; i++)
{
accum[0] += d_CAF_vector_Q[i] * (1-0.1*(abs(doppler_index - i)));
accum[0] += d_CAF_vector_Q[i] * (1-weighting_factor*(unsigned int)(abs(doppler_index - i)));
}
// accum[0] /= CAF_bins_half+doppler_index+1;
accum[0] /= 1+CAF_bins_half+doppler_index - 0.1*CAF_bins_half*(CAF_bins_half+1)/2 - 0.1*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2]
accum[0] /= 1+CAF_bins_half+doppler_index - weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2 - weighting_factor*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2]
d_CAF_vector[doppler_index] += accum[0];
}
}
@ -639,20 +649,20 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], &d_CAF_vector_I[doppler_index-CAF_bins_half], 2*CAF_bins_half+1);
for (int i = doppler_index-CAF_bins_half; i < doppler_index+CAF_bins_half+1; i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-0.1*(abs(doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-weighting_factor*(unsigned int)(abs(doppler_index - i)));
}
// d_CAF_vector[doppler_index] /= 2*CAF_bins_half+1;
d_CAF_vector[doppler_index] /= 1+2*CAF_bins_half - 2*0.1*CAF_bins_half*(CAF_bins_half+1)/2;
d_CAF_vector[doppler_index] /= 1+2*CAF_bins_half - 2*weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2;
if (d_both_signal_components)
{
accum[0] = 0;
// volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], 2*CAF_bins_half);
for (int i = doppler_index-CAF_bins_half; i < doppler_index+CAF_bins_half+1; i++)
{
accum[0] += d_CAF_vector_Q[i] * (1-0.1*(abs(doppler_index - i)));
accum[0] += d_CAF_vector_Q[i] * (1-weighting_factor*(unsigned int)(abs(doppler_index - i)));
}
// accum[0] /= 2*CAF_bins_half+1;
accum[0] /= 1+2*CAF_bins_half - 2*0.1*CAF_bins_half*(CAF_bins_half+1)/2;
accum[0] /= 1+2*CAF_bins_half - 2*weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2;
d_CAF_vector[doppler_index] += accum[0];
}
}
@ -663,20 +673,20 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items
// volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], &d_CAF_vector_I[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index));
for (int i = doppler_index-CAF_bins_half; i < d_num_doppler_bins; i++)
{
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-0.1*(abs(doppler_index - i)));
d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1-weighting_factor*(abs(doppler_index - i)));
}
// d_CAF_vector[doppler_index] /= CAF_bins_half+(d_num_doppler_bins-doppler_index);
d_CAF_vector[doppler_index] /= 1+CAF_bins_half+(d_num_doppler_bins-doppler_index-1) -0.1*CAF_bins_half*(CAF_bins_half+1)/2 -0.1*(d_num_doppler_bins-doppler_index-1)*(d_num_doppler_bins-doppler_index)/2;
d_CAF_vector[doppler_index] /= 1+CAF_bins_half+(d_num_doppler_bins-doppler_index-1) -weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2 -weighting_factor*(d_num_doppler_bins-doppler_index-1)*(d_num_doppler_bins-doppler_index)/2;
if (d_both_signal_components)
{
accum[0] = 0;
// volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index));
for (int i = doppler_index-CAF_bins_half; i < d_num_doppler_bins; i++)
{
accum[0] += d_CAF_vector_Q[i] * (1-0.1*(abs(doppler_index - i)));
accum[0] += d_CAF_vector_Q[i] * (1-weighting_factor*(abs(doppler_index - i)));
}
// accum[0] /= CAF_bins_half+(d_num_doppler_bins-doppler_index);
accum[0] /= 1+CAF_bins_half+(d_num_doppler_bins-doppler_index-1) -0.1*CAF_bins_half*(CAF_bins_half+1)/2 -0.1*(d_num_doppler_bins-doppler_index-1)*(d_num_doppler_bins-doppler_index)/2;
accum[0] /= 1+CAF_bins_half+(d_num_doppler_bins-doppler_index-1) -weighting_factor*CAF_bins_half*(CAF_bins_half+1)/2 -weighting_factor*(d_num_doppler_bins-doppler_index-1)*(d_num_doppler_bins-doppler_index)/2;
d_CAF_vector[doppler_index] += accum[0];
}
}

View File

@ -63,7 +63,8 @@ galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms,
gr::msg_queue::sptr queue, bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_);
int CAF_window_hz_,
int Zero_padding_);
/*!
* \brief This class implements a Parallel Code Phase Search Acquisition.
@ -84,7 +85,8 @@ private:
gr::msg_queue::sptr queue, bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_);
int CAF_window_hz_,
int Zero_padding_);
galileo_e5a_noncoherentIQ_acquisition_caf_cc(
unsigned int sampled_ms,
@ -95,7 +97,8 @@ private:
gr::msg_queue::sptr queue, bool dump,
std::string dump_filename,
bool both_signal_components_,
int CAF_window_hz_);
int CAF_window_hz_,
int Zero_padding_);
void calculate_magnitudes(gr_complex* fft_begin, int doppler_shift,
int doppler_offset);
@ -104,6 +107,7 @@ private:
long d_fs_in;
long d_freq;
int d_samples_per_ms;
int d_sampled_ms;
int d_samples_per_code;
unsigned int d_doppler_resolution;
float d_threshold;

View File

@ -89,9 +89,6 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration,
{
vector_length = round((float) fs_in / (Galileo_E5a_CODE_CHIP_RATE_HZ
/ Galileo_E5a_CODE_LENGTH_CHIPS));
// vector_length = round((float) fs_in / (Galileo_E5a_CODE_CHIP_RATE_HZ
// / Galileo_E5a_CODE_LENGTH_CHIPS))
// * Galileo_E5a_Q_SECONDARY_CODE_LENGTH;
}
else
{

View File

@ -83,7 +83,6 @@ signal_generator_c::signal_generator_c (std::vector<std::string> signal1, std::v
void signal_generator_c::init()
{
work_counter_ = 0;
std::cout << "work counter reset to 0"<< std::endl;
if (posix_memalign((void**)&complex_phase_, 16, vector_length_ * sizeof(gr_complex)) == 0){};
@ -99,9 +98,6 @@ void signal_generator_c::init()
data_modulation_.push_back((Galileo_E5a_I_SECONDARY_CODE.at(0)=='0' ? 1 : -1));
pilot_modulation_.push_back((Galileo_E5a_Q_SECONDARY_CODE[PRN_[sat]].at(0)=='0' ? 1 : -1));
std::cout << "data bit init" << current_data_bits_[sat] << std::endl;
std::cout << "data bit init" << current_data_bit_int_[sat] << std::endl;
if (system_[sat] == "G")
{
@ -115,14 +111,11 @@ void signal_generator_c::init()
{
if (signal_[sat].at(0)=='5')
{
// int codelen = (int)(Galileo_E5a_CODE_LENGTH_CHIPS * Galileo_E5a_Q_SECONDARY_CODE_LENGTH);
int codelen = (int)Galileo_E5a_CODE_LENGTH_CHIPS;
samples_per_code_.push_back(round((float)fs_in_ / (Galileo_E5a_CODE_CHIP_RATE_HZ
/ codelen)));
num_of_codes_per_vector_.push_back(1);
// num_of_codes_per_vector_.push_back((int)Galileo_E5a_Q_SECONDARY_CODE_LENGTH);
data_bit_duration_ms_.push_back(1e3/Galileo_E5a_SYMBOL_RATE_BPS);
}
else
@ -138,25 +131,25 @@ void signal_generator_c::init()
random_ = new gr::random();
std::cout << "fs_in: " << fs_in_ << std::endl;
std::cout << "data_flag: " << data_flag_ << std::endl;
std::cout << "noise_flag_: " << noise_flag_ << std::endl;
std::cout << "num_sats_: " << num_sats_ << std::endl;
std::cout << "vector_length_: " << vector_length_ << std::endl;
std::cout << "BW_BB_: " << BW_BB_ << std::endl;
// std::cout << "fs_in: " << fs_in_ << std::endl;
// std::cout << "data_flag: " << data_flag_ << std::endl;
// std::cout << "noise_flag_: " << noise_flag_ << std::endl;
// std::cout << "num_sats_: " << num_sats_ << std::endl;
// std::cout << "vector_length_: " << vector_length_ << std::endl;
// std::cout << "BW_BB_: " << BW_BB_ << std::endl;
for (unsigned int i = 0; i < num_sats_; i++)
{
std::cout << "Sat " << i << ": " << std::endl;
std::cout << " System " << system_[i] << ": " << std::endl;
std::cout << " PRN: " << PRN_[i] << std::endl;
std::cout << " CN0: " << CN0_dB_[i] << std::endl;
std::cout << " Doppler: " << doppler_Hz_[i] << std::endl;
std::cout << " Delay: " << delay_chips_[i] << std::endl;
std::cout << " Samples per code = " << samples_per_code_[i] << std::endl;
std::cout << " codes per vector = " << num_of_codes_per_vector_[i] << std::endl;
std::cout << " data_bit_duration = " << data_bit_duration_ms_[i] << std::endl;
}
// for (unsigned int i = 0; i < num_sats_; i++)
// {
// std::cout << "Sat " << i << ": " << std::endl;
// std::cout << " System " << system_[i] << ": " << std::endl;
// std::cout << " PRN: " << PRN_[i] << std::endl;
// std::cout << " CN0: " << CN0_dB_[i] << std::endl;
// std::cout << " Doppler: " << doppler_Hz_[i] << std::endl;
// std::cout << " Delay: " << delay_chips_[i] << std::endl;
// std::cout << " Samples per code = " << samples_per_code_[i] << std::endl;
// std::cout << " codes per vector = " << num_of_codes_per_vector_[i] << std::endl;
// std::cout << " data_bit_duration = " << data_bit_duration_ms_[i] << std::endl;
// }
}
void signal_generator_c::generate_codes()
@ -170,7 +163,6 @@ void signal_generator_c::generate_codes()
vector_length_ * sizeof(gr_complex)) == 0){};
gr_complex code[64000];//[samples_per_code_[sat]];
//gr_complex code[64000];
if (system_[sat] == "G")
{
@ -294,7 +286,6 @@ gr_vector_void_star &output_items)
gr_complex *out = (gr_complex *) output_items[0];
work_counter_++;
//std::cout<<"work counter = "<<work_counter_<<std::endl;
unsigned int out_idx = 0;
unsigned int i = 0;

View File

@ -30,108 +30,6 @@
#ifndef GNSS_SDR_SIGNAL_GENERATOR_C_H
#define GNSS_SDR_SIGNAL_GENERATOR_C_H
/*
#include <string>
#include <vector>
#include <boost/scoped_array.hpp>
#include <gnuradio/random.h>
#include <gnuradio/block.h>
#include "gnss_signal.h"
class signal_generator_c;
/*
* We use boost::shared_ptr's instead of raw pointers for all access
* to gr_blocks (and many other data structures). The shared_ptr gets
* us transparent reference counting, which greatly simplifies storage
* management issues.
*
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*
* As a convention, the _sptr suffix indicates a boost::shared_ptr
*//*
typedef boost::shared_ptr<signal_generator_c> signal_generator_c_sptr;
/*!
* \brief Return a shared_ptr to a new instance of gen_source.
*
* To avoid accidental use of raw pointers, gen_source's
* constructor is private. signal_make_generator_c is the public
* interface for creating new instances.
*//*
signal_generator_c_sptr
signal_make_generator_c (std::vector<std::string> system, std::vector<std::string> _signal, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
/*!
* \brief This class generates synthesized GNSS signal.
* \ingroup block
*
* \sa gen_source for a version that subclasses gr_block.
*//*
class signal_generator_c : public gr::block
{
private:
// The friend declaration allows gen_source to
// access the private constructor.
/* Create the signal_generator_c object*//*
friend signal_generator_c_sptr
signal_make_generator_c (std::vector<std::string> system, std::vector<std::string> signal, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
signal_generator_c (std::vector<std::string> system,std::vector<std::string> signal, const std::vector<unsigned int> &PRN,
const std::vector<float> &CN0_dB, const std::vector<float> &doppler_Hz,
const std::vector<unsigned int> &delay_chips, bool data_flag, bool noise_flag,
unsigned int fs_in, unsigned int vector_length, float BW_BB);
void init();
void generate_codes();
std::vector<std::string> system_;
std::vector<std::string> signal_;
std::vector<unsigned int> PRN_;
std::vector<float> CN0_dB_;
std::vector<float> doppler_Hz_;
std::vector<unsigned int> delay_chips_;
bool data_flag_;
bool noise_flag_;
unsigned int fs_in_;
unsigned int num_sats_;
unsigned int vector_length_;
float BW_BB_;
std::vector<unsigned int> samples_per_code_;
std::vector<unsigned int> num_of_codes_per_vector_;
std::vector<unsigned int> data_bit_duration_ms_;
std::vector<unsigned int> ms_counter_;
std::vector<float> start_phase_rad_;
std::vector<gr_complex> current_data_bits_;
boost::scoped_array<gr_complex*> sampled_code_data_;
boost::scoped_array<gr_complex*> sampled_code_pilot_;
gr::random* random_;
gr_complex* complex_phase_;
public:
~signal_generator_c (); // public destructor
// Where all the action really happens
int general_work (int noutput_items,
gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
};
*/
#include <string>
#include <vector>
@ -140,9 +38,6 @@ public:
#include <gnuradio/block.h>
#include "gnss_signal.h"
class signal_generator_c;
/*

View File

@ -2,7 +2,12 @@
* \file galileo_e5a_telemetry_decoder.h
* \brief Interface of an adapter of a GALILEO E5a FNAV data decoder block
* to a TelemetryDecoderInterface
* \author Marc Sales 2014 marcsales92(at)gmail.com
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* </ul>
*
*
* -------------------------------------------------------------------------
*

View File

@ -2,7 +2,12 @@
* \file galileo_e5a_telemetry_decoder.h
* \brief Interface of an adapter of a GALILEO E5a FNAV data decoder block
* to a TelemetryDecoderInterface
* \author Marc Sales 2014 marcsales92(at)gmail.com
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* </ul>
*
*
* -------------------------------------------------------------------------
*

View File

@ -1,7 +1,12 @@
/*!
* \file galileo_e5a_telemetry_decoder_cc.cc
* \brief Implementation of a Galileo FNAV message demodulator block
* \author Marc Sales 2014. marcsales92(at)gmail.com
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* </ul>
*
*
* -------------------------------------------------------------------------
*
@ -246,7 +251,7 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
d_preamble_index = 0;
d_preamble_time_seconds = 0;
d_flag_frame_sync = false;
d_current_symbol_float = 0;
d_current_symbol = 0;
d_prompt_counter = 0;
d_symbol_counter = 0;
@ -254,6 +259,7 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
d_TOW_at_current_symbol = 0;
d_CRC_error_counter = 0;
d_sign_init = 0;
}
galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc()
@ -282,10 +288,10 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
{
if (in[0][0].Prompt_I != 0)
{
d_current_symbol_float += (float)in[0][0].Prompt_I;
d_current_symbol += in[0][0].Prompt_I;
if (d_prompt_counter == GALILEO_FNAV_CODES_PER_SYMBOL - 1)
{
if (d_current_symbol_float > 0)
if (d_current_symbol > 0)
{
d_page_symbols[d_symbol_counter] = 1;
}
@ -293,7 +299,7 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
{
d_page_symbols[d_symbol_counter] = -1;
}
d_current_symbol_float = 0;
d_current_symbol = 0;
d_symbol_counter++;
d_prompt_counter = 0;
if (d_symbol_counter == GALILEO_FNAV_PREAMBLE_LENGTH_BITS-1)
@ -310,10 +316,10 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
}
case 1:
{
d_current_symbol_float += (float)in[0][0].Prompt_I;
d_current_symbol += in[0][0].Prompt_I;
if (d_prompt_counter == GALILEO_FNAV_CODES_PER_SYMBOL - 1)
{
if (d_current_symbol_float > 0)
if (d_current_symbol > 0)
{
d_page_symbols[d_symbol_counter] = 1;
}
@ -322,7 +328,7 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
d_page_symbols[d_symbol_counter] = -1;
}
// d_page_symbols[d_symbol_counter] = d_current_symbol_float/(float)GALILEO_FNAV_CODES_PER_SYMBOL;
d_current_symbol_float = 0;
d_current_symbol = 0;
d_symbol_counter++;
d_prompt_counter = 0;
// **** Attempt Preamble correlation ****
@ -384,10 +390,10 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
}
case 2:
{
d_current_symbol_float += (float)in[0][0].Prompt_I;
d_current_symbol += in[0][0].Prompt_I;
if (d_prompt_counter == GALILEO_FNAV_CODES_PER_SYMBOL - 1)
{
if (d_current_symbol_float > 0)
if (d_current_symbol > 0)
{
d_page_symbols[d_symbol_counter] = 1;
}
@ -396,7 +402,7 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
d_page_symbols[d_symbol_counter] = -1;
}
// d_page_symbols[d_symbol_counter] = d_current_symbol_float/(float)GALILEO_FNAV_CODES_PER_SYMBOL;
d_current_symbol_float = 0;
d_current_symbol = 0;
d_symbol_counter++;
d_prompt_counter = 0;
// At the right sample stamp, check preamble synchro
@ -444,15 +450,6 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
if (corr_flag==true) // NEW PREAMBLE RECEIVED. DECODE PAGE
{
d_preamble_index = d_sample_counter - GALILEO_FNAV_CODES_PER_PREAMBLE;//record the preamble sample stamp
// Change sign if necessary
// if (corr_sign < 0)
// {
// // NOTE: exists volk library for integers ???
// for (int i = 0; i < d_symbol_counter; i++)
// {
// d_page_symbols[i] = -d_page_symbols[i];
// }
// }
// DECODE WORD
decode_word(d_page_symbols, GALILEO_FNAV_SYMBOLS_PER_PAGE - GALILEO_FNAV_PREAMBLE_LENGTH_BITS);
// CHECK CRC

View File

@ -1,7 +1,12 @@
/*!
* \file galileo_e5a_telemetry_decoder_cc.cc
* \brief Implementation of a Galileo FNAV message demodulator block
* \author Marc Sales 2014. marcsales92(at)gmail.com
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* </ul>
*
*
* -------------------------------------------------------------------------
*
@ -100,9 +105,10 @@ private:
// signed int d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
double d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
signed int *d_preamble_symbols;
float d_current_symbol_float;
double d_current_symbol;
long unsigned int d_symbol_counter;
int d_prompt_counter;
int d_sign_init;
long unsigned int d_sample_counter;
long unsigned int d_preamble_index;

View File

@ -1,8 +1,39 @@
/*
* galileo_e5a_dll_pll_tracking.cc
/*!
* \file galileo_e5a_dll_fll_pll_tracking.cc
* \brief Adapts a code DLL + carrier PLL
* tracking block to a TrackingInterface for Galileo E5a signals
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* Galileo E5a data and pilot Signals
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
* </ul>
*
* Created on: Jun 19, 2014
* Author: marc
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#include "galileo_e5a_dll_pll_tracking.h"

View File

@ -1,8 +1,39 @@
/*
* galileo_e5a_dll_pll_tracking.h
/*!
* \file galileo_e5a_dll_fll_pll_tracking.h
* \brief Adapts a code DLL + carrier PLL
* tracking block to a TrackingInterface for Galileo E5a signals
* \brief Adapts a PCPS acquisition block to an AcquisitionInterface for
* Galileo E5a data and pilot Signals
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
* </ul>
*
* Created on: Jun 19, 2014
* Author: marc
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2014 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* at your option) any later version.
*
* GNSS-SDR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GALILEO_E5A_DLL_PLL_TRACKING_H_

View File

@ -3,6 +3,11 @@
* \brief Implementation of a code DLL + carrier PLL
* tracking block for Galileo E5a signals
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
* </ul>
*
* -------------------------------------------------------------------------
*
@ -144,11 +149,7 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc(
if (posix_memalign((void**)&d_Early, 16, sizeof(gr_complex)) == 0){};
if (posix_memalign((void**)&d_Prompt, 16, sizeof(gr_complex)) == 0){};
if (posix_memalign((void**)&d_Late, 16, sizeof(gr_complex)) == 0){};
// if (posix_memalign((void**)&d_Prompt_data, 16, sizeof(gr_complex)*MAX_INTEGRATION_TIME_MS) == 0){};
if (posix_memalign((void**)&d_Prompt_data, 16, sizeof(gr_complex)) == 0){};
// space for buffer, notice max Ti+1 to ensure enough space since code samples is doppler dependant.
// if (posix_memalign((void**)&d_inbuffer, 16, (MAX_INTEGRATION_TIME_MS+1)*d_vector_length*sizeof(gr_complex)) == 0){};
//--- Perform initializations ------------------------------
// define initial code frequency basis of NCO
d_code_freq_chips = Galileo_E5a_CODE_CHIP_RATE_HZ;
@ -165,15 +166,12 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc(
d_sample_counter = 0;
d_acq_sample_stamp = 0;
//d_enable_tracking = false;
//d_pull_in = false;
d_last_seg = 0;
d_first_transition = false;
d_secondary_lock=false;
d_secondary_delay=0;
d_integration_counter = 0;
// d_buffer_counter = 0;
d_current_prn_length_samples = (int)d_vector_length;
@ -451,13 +449,10 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp;
acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod((float)acq_to_trk_delay_samples, (float)d_current_prn_length_samples);
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples);
// /todo: Check if the sample counter sent to the next block as a time reference should be incremented AFTER sended or BEFORE
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
std::cout<<" samples_offset="<<samples_offset<<"\r\n";
d_state = 2; // start in Ti = 1 code, until secondary code lock.
std::cout << "acq_code_phase" << d_acq_code_phase_samples << " d_sample_counter" << d_sample_counter << " d_acq_sample_stamp " << d_acq_sample_stamp << std::endl;
std::cout << "acq doppler " << d_acq_carrier_doppler_hz << std::endl;
// make an output to not stop the rest of the processing blocks
current_synchro_data.Prompt_I = 0.0;
current_synchro_data.Prompt_Q = 0.0;
@ -480,8 +475,10 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
// Secondary code Chip
if (d_secondary_lock)
{
sec_sign_Q = gr_complex((Galileo_E5a_Q_SECONDARY_CODE[d_acquisition_gnss_synchro->PRN-1].at(d_secondary_delay)=='0' ? 1 : -1),0);
sec_sign_I = gr_complex((Galileo_E5a_I_SECONDARY_CODE.at(d_secondary_delay%Galileo_E5a_I_SECONDARY_CODE_LENGTH))=='0' ? 1 : -1,0);
// sec_sign_Q = gr_complex((Galileo_E5a_Q_SECONDARY_CODE[d_acquisition_gnss_synchro->PRN-1].at(d_secondary_delay)=='0' ? 1 : -1),0);
// sec_sign_I = gr_complex((Galileo_E5a_I_SECONDARY_CODE.at(d_secondary_delay%Galileo_E5a_I_SECONDARY_CODE_LENGTH)=='0' ? 1 : -1),0);
sec_sign_Q = gr_complex((Galileo_E5a_Q_SECONDARY_CODE[d_acquisition_gnss_synchro->PRN-1].at(d_secondary_delay)=='0' ? -1 : 1),0);
sec_sign_I = gr_complex((Galileo_E5a_I_SECONDARY_CODE.at(d_secondary_delay%Galileo_E5a_I_SECONDARY_CODE_LENGTH)=='0' ? -1 : 1),0);
}
else
{
@ -522,7 +519,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
&d_Prompt_data,
is_unaligned());
// Accumulate results (coherent integration)
// Accumulate results (coherent integration since there are no bit transitions in pilot signal)
d_Early += single_early * sec_sign_Q;
d_Prompt += single_prompt * sec_sign_Q;
d_Late += single_late * sec_sign_Q;
@ -565,9 +562,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
// Carrier discriminator filter
carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz);
// TEST
// carr_error_filt_hz = 0;
//
// New carrier Doppler frequency estimation
d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_error_filt_hz;
// New code Doppler frequency estimation
@ -586,34 +580,25 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
code_error_chips = dll_nc_e_minus_l_normalized(d_Early, d_Late); //[chips/Ti]
// Code discriminator filter
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second]
// TEST
// code_error_filt_chips = 0;
//
//Code phase accumulator
d_code_error_filt_secs = (GALILEO_E5a_CODE_PERIOD*code_error_filt_chips)/Galileo_E5a_CODE_CHIP_RATE_HZ; //[seconds]
}
d_acc_code_phase_secs = d_acc_code_phase_secs + d_code_error_filt_secs;
// std::cout<< "Early " << d_Early << std::endl;
// std::cout<< "Prompt " << d_Prompt << std::endl;
// std::cout<< "Late " << d_Late << std::endl;
// std::cout<< "Prompt data " << d_Prompt_data << std::endl;
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
// ################## CARRIER AND CODE NCO BUFFER ALIGNMENT #######################
// keep alignment parameters for the next input buffer
double T_chip_seconds;
double T_prn_seconds;
float T_prn_samples;
float K_blk_samples;
// float T_prn_samples;
// float K_blk_samples;
//double T_chip_seconds;
// double T_prn_seconds;
// double T_prn_samples;
// double K_blk_samples;
double T_prn_samples;
double K_blk_samples;
// Compute the next buffer length based in the new period of the PRN sequence and the code phase error estimation
T_chip_seconds = 1 / (double)d_code_freq_chips;
T_prn_seconds = T_chip_seconds * Galileo_E5a_CODE_LENGTH_CHIPS;
T_prn_samples = T_prn_seconds * (float)d_fs_in;
T_prn_samples = T_prn_seconds * (double)d_fs_in;
K_blk_samples = T_prn_samples + d_rem_code_phase_samples + d_code_error_filt_secs*(float)d_fs_in;
d_current_prn_length_samples = round(K_blk_samples); //round to a discrete samples
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
@ -624,7 +609,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
// fill buffer with prompt correlator output values
d_Prompt_buffer[d_cn0_estimation_counter] = d_Prompt;
d_cn0_estimation_counter++;
// d_cn0_estimation_counter += d_integration_t_ms;
}
else
{
@ -635,27 +619,18 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
acquire_secondary(); // changes d_secondary_lock and d_secondary_delay
if (d_secondary_lock == true)
{
// std::cout << "first prompt=" << d_Prompt_buffer[0] << std::endl;
std::cout << "Secondary code locked." << std::endl;
d_current_ti_ms = d_ti_ms;
d_integration_counter = 0;
// Change loop parameters ==========================================
d_code_loop_filter.set_pdi(d_current_ti_ms * GALILEO_E5a_CODE_PERIOD);
d_carrier_loop_filter.set_pdi(d_current_ti_ms * GALILEO_E5a_CODE_PERIOD);
d_code_loop_filter.initialize();
d_carrier_loop_filter.initialize();
// d_code_loop_filter.initialize();
// d_carrier_loop_filter.initialize();
d_code_loop_filter.set_DLL_BW(d_dll_bw_hz);
d_carrier_loop_filter.set_PLL_BW(d_pll_bw_hz);
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
d_secondary_delay = (d_secondary_delay + 1)%Galileo_E5a_Q_SECONDARY_CODE_LENGTH;
d_sample_counter += d_current_prn_length_samples; //count for the processed samples
return 1;
}
else
{
// std::cout << "first prompt=" << d_Prompt_buffer[0] << std::endl;
std::cout << "Secondary code delay couldn't be resolved." << std::endl;
d_carrier_lock_fail_counter++;
if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER)
@ -676,12 +651,9 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
else // Secondary lock achieved, monitor carrier lock.
{
// Code lock indicator
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, Galileo_E5a_CODE_LENGTH_CHIPS);
d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in,d_current_ti_ms * Galileo_E5a_CODE_LENGTH_CHIPS);
// Carrier lock indicator
d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES);
// TODO: tune Time integration period and filter parameters according to CN0 levels
// Loss of lock detection
if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0)
{
@ -747,12 +719,11 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
// MULTIPLEXED FILE RECORDING - Record results to file
float prompt_I;
float prompt_Q;
float tmp_E, tmp_P, tmp_L;
float tmp_float;
double tmp_double;
prompt_I = d_Prompt_data.real();
prompt_Q = d_Prompt_data.imag();
if (d_integration_counter == d_current_ti_ms)
if (d_integration_counter == d_current_ti_ms)
{
tmp_E = std::abs<float>(d_Early);
tmp_P = std::abs<float>(d_Prompt);
@ -765,7 +736,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
d_dump_file.write((char*)&tmp_P, sizeof(float));
d_dump_file.write((char*)&tmp_L, sizeof(float));
// PROMPT I and Q (to analyze navigation symbols)
//TODO: save all nav symbols, not only the first of the integration time.
d_dump_file.write((char*)&prompt_I, sizeof(float));
d_dump_file.write((char*)&prompt_Q, sizeof(float));
// PRN start sample stamp
@ -801,9 +771,9 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_
}
}
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
d_secondary_delay = (d_secondary_delay + 1)%Galileo_E5a_Q_SECONDARY_CODE_LENGTH;
d_sample_counter += d_current_prn_length_samples; //count for the processed samples
consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates
return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false
}

View File

@ -3,6 +3,11 @@
* \brief Implementation of a code DLL + carrier PLL
* tracking block for Galileo E5a signals
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* <li> Luis Esteve, 2012. luis(at)epsilon-formacion.com
* </ul>
*
* -------------------------------------------------------------------------
*
@ -151,7 +156,9 @@ private:
gr_complex d_Late;
gr_complex d_Prompt_data;
float tmp_E;
float tmp_P;
float tmp_L;
// remaining code phase and carrier phase between tracking loops
float d_rem_code_phase_samples;
float d_rem_carr_phase_rad;
@ -196,7 +203,7 @@ private:
// Secondary code acquisition
bool d_secondary_lock;
int d_secondary_delay;
unsigned int d_integration_counter;
int d_integration_counter;
// file dump
std::string d_dump_filename;

View File

@ -2,7 +2,12 @@
* \file galileo_fnav_message.h
* \brief Implementation of a Galileo F/NAV Data message
* as described in Galileo OS SIS ICD Issue 1.1 (Sept. 2010)
* \author Marc Sales 2014. marcsales92(at)gmail.com
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* </ul>
*
*
* -------------------------------------------------------------------------
*

View File

@ -2,7 +2,12 @@
* \file galileo_fnav_message.h
* \brief Implementation of a Galileo F/NAV Data message
* as described in Galileo OS SIS ICD Issue 1.1 (Sept. 2010)
* \author Marc Sales 2014. marcsales92(at)gmail.com
* \author Marc Sales, 2014. marcsales92(at)gmail.com
* \based on work from:
* <ul>
* <li> Javier Arribas, 2011. jarribas(at)cttc.es
* </ul>
*
*
* -------------------------------------------------------------------------
*

View File

@ -155,7 +155,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
signal.copy(gnss_synchro.Signal,2,0);
integration_time_ms = 1;
integration_time_ms = 3;
//fs_in = 11e6;
//fs_in = 18e6;
fs_in = 32e6;
@ -168,8 +168,8 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
expected_doppler_hz = 2800;
//expected_doppler_hz = 0;
expected_delay_sec = 94;
CAF_window_hz = 2000;
// CAF_window_hz = 0;
// CAF_window_hz = 3000;
CAF_window_hz = 0;
Zero_padding = 0;
//expected_delay_chips = 1000;
@ -244,6 +244,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
// config->set_property("Acquisition.threshold", "0.01");
config->set_property("Acquisition.doppler_max", "10000");
config->set_property("Acquisition.doppler_step", "250");
// config->set_property("Acquisition.doppler_step", "500");
config->set_property("Acquisition.bit_transition_flag", "false");
config->set_property("Acquisition.dump", "true");
config->set_property("SignalSource.dump_filename", "../data/acquisition.dat");
@ -304,7 +305,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3()
signal.copy(gnss_synchro.Signal,2,0);
integration_time_ms = 1;
integration_time_ms = 3;
//fs_in = 10.24e6;
//fs_in = 12e6;
fs_in = 12e6;
@ -612,9 +613,9 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
//int nsamples = floor(fs_in*integration_time_ms*1e-3);
acquisition = new GalileoE5aNoncoherentIQAcquisitionCaf(config.get(), "Acquisition", 1, 1, queue);
unsigned int skiphead_sps = 28000; // 32 Msps
unsigned int skiphead_sps = 28000+32000; // 32 Msps
// unsigned int skiphead_sps = 0;
//unsigned int skiphead_sps = 84000;
// unsigned int skiphead_sps = 84000;
ASSERT_NO_THROW( {
acquisition->set_channel(1);
@ -645,6 +646,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
}) << "Failure connecting acquisition to the top_block."<< std::endl;
acquisition->init();
// USING SIGNAL GENERATOR
/*
ASSERT_NO_THROW( {
//std::string filename_ = "../data/Tiered_sink.dat";
@ -670,12 +672,13 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
}) << "Failure connecting the blocks of acquisition test." << std::endl;
*/
// USING SIGNAL FROM FILE SOURCE
ASSERT_NO_THROW( {
//noiseless sim
std::string file = "/home/marc/E5a_acquisitions/sim_32M_sec94_PRN11_long.dat";
//std::string file = "/home/marc/E5a_acquisitions/sim_32M_sec94_PRN11_long.dat";
// real
//std::string file = "/home/marc/E5a_acquisitions/32MS_complex.dat";
std::string file = "/home/marc/E5a_acquisitions/32MS_complex.dat";
const char * file_name = file.c_str();
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
@ -697,8 +700,8 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
{
case 0:
{
//gnss_synchro.PRN = 19; //real
gnss_synchro.PRN = 11; //sim
gnss_synchro.PRN = 19; //real
//gnss_synchro.PRN = 11; //sim
break;
}
// case 1:

View File

@ -94,12 +94,18 @@ void GalileoE5aTrackingTest::init()
config->set_property("Tracking.dump_filename", "../data/e5a_tracking_ch_");
config->set_property("Tracking.implementation", "Galileo_E5a_DLL_PLL_Tracking");
config->set_property("Tracking.early_late_space_chips", "0.5");
config->set_property("Tracking.pll_bw_hz", "5.0");
config->set_property("Tracking.dll_bw_hz", "2.0");
config->set_property("Tracking.pll_bw_hz_init","20.0");
config->set_property("Tracking.dll_bw_hz_init","20.0");
config->set_property("Tracking.ti_ms","3");
// config->set_property("Tracking.pll_bw_hz_init","5.0");
config->set_property("Tracking.dll_bw_hz_init","2.0");
config->set_property("Tracking.pll_bw_hz", "5");
config->set_property("Tracking.dll_bw_hz", "2");
config->set_property("Tracking.ti_ms","1");
// config->set_property("Tracking.pll_bw_hz", "5");
// config->set_property("Tracking.dll_bw_hz", "2");
// config->set_property("Tracking.ti_ms","1");
//config->set_property("Tracking.fll_bw_hz", "10.0");
}
/*
@ -169,7 +175,7 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
struct timeval tv;
long long int begin = 0;
long long int end = 0;
int num_samples = 32000000000; // 32 Msps
int num_samples = 320000000*1.5; // 32 Msps
//unsigned int skiphead_sps = 98000; // 1 Msample
unsigned int skiphead_sps = 0; // 1 Msampl
// unsigned int skiphead_sps = 104191; // 1 Msampl
@ -181,20 +187,21 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
//REAL
gnss_synchro.Acq_delay_samples = 15579+1; // 32 Msps
gnss_synchro.Acq_doppler_hz = 3500; // 32 Msps
// gnss_synchro.Acq_doppler_hz = 3500; // 32 Msps
gnss_synchro.Acq_doppler_hz = 3750; // 500 Hz resolution
// gnss_synchro.Acq_samplestamp_samples = 98000;
gnss_synchro.Acq_samplestamp_samples = 0;
//SIM
// gnss_synchro.Acq_delay_samples = 14001+1; // 32 Msps
// //gnss_synchro.Acq_doppler_hz = 2750; // 32 Msps (real 2800)
// gnss_synchro.Acq_doppler_hz = 2800; // 32 Msps (real 2800)
// //gnss_synchro.Acq_doppler_hz = 0; // 32 Msps (real 2800)
//// gnss_synchro.Acq_doppler_hz = 2800; // 32 Msps (real 2800)
// gnss_synchro.Acq_doppler_hz = 0; // 32 Msps (real 2800)
//// gnss_synchro.Acq_samplestamp_samples = 98000;
// gnss_synchro.Acq_samplestamp_samples = 0;
//SIM2
// gnss_synchro.Acq_delay_samples = 5810; // 32 Msps
// gnss_synchro.Acq_doppler_hz = 2750;
// gnss_synchro.Acq_doppler_hz = 2800;
// gnss_synchro.Acq_samplestamp_samples = 0;
ASSERT_NO_THROW( {

View File

@ -51,8 +51,10 @@ for N=1:1:channels
trackResults(N).pllDiscr = GNSS_tracking(N).carr_error.';
trackResults(N).pllDiscrFilt = GNSS_tracking(N).carr_nco.';
trackResults(N).I_P=GNSS_tracking(N).prompt_I.';
trackResults(N).Q_P=GNSS_tracking(N).prompt_Q.';
trackResults(N).I_PN=GNSS_tracking(N).prompt_I.';
trackResults(N).Q_PN=GNSS_tracking(N).prompt_Q.';
trackResults(N).Q_P=zeros(1,length(GNSS_tracking(N).P));
trackResults(N).I_P=GNSS_tracking(N).P.';
trackResults(N).I_E= GNSS_tracking(N).E.';
trackResults(N).I_L = GNSS_tracking(N).L.';
@ -63,7 +65,7 @@ for N=1:1:channels
% Use original MATLAB tracking plot function
settings.numberOfChannels=channels;
settings.msToProcess=length(GNSS_tracking(N).E);
plotTracking(N,trackResults,settings)
plotTrackingE5a(N,trackResults,settings)
end
for N=1:1:channels

View File

@ -0,0 +1,153 @@
function plotTracking(channelList, trackResults, settings)
%This function plots the tracking results for the given channel list.
%
%plotTracking(channelList, trackResults, settings)
%
% Inputs:
% channelList - list of channels to be plotted.
% trackResults - tracking results from the tracking function.
% settings - receiver settings.
%--------------------------------------------------------------------------
% SoftGNSS v3.0
%
% Copyright (C) Darius Plausinaitis
% Written by Darius Plausinaitis
%--------------------------------------------------------------------------
%This program is free software; you can redistribute it and/or
%modify it under the terms of the GNU General Public License
%as published by the Free Software Foundation; either version 2
%of the License, or (at your option) any later version.
%
%This program is distributed in the hope that it will be useful,
%but WITHOUT ANY WARRANTY; without even the implied warranty of
%MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
%GNU General Public License for more details.
%
%You should have received a copy of the GNU General Public License
%along with this program; if not, write to the Free Software
%Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
%USA.
%--------------------------------------------------------------------------
%CVS record:
%$Id: plotTracking.m,v 1.5.2.23 2006/08/14 14:45:14 dpl Exp $
% Protection - if the list contains incorrect channel numbers
channelList = intersect(channelList, 1:settings.numberOfChannels);
%=== For all listed channels ==============================================
for channelNr = channelList
%% Select (or create) and clear the figure ================================
% The number 200 is added just for more convenient handling of the open
% figure windows, when many figures are closed and reopened.
% Figures drawn or opened by the user, will not be "overwritten" by
% this function.
figure(channelNr +200);
clf(channelNr +200);
set(channelNr +200, 'Name', ['Channel ', num2str(channelNr), ...
' (PRN ', ...
num2str(trackResults(channelNr).PRN), ...
') results']);
%% Draw axes ==============================================================
% Row 1
handles(1, 1) = subplot(3, 3, 1);
handles(1, 2) = subplot(3, 3, [2 3]);
% Row 2
handles(2, 1) = subplot(3, 3, 4);
handles(2, 2) = subplot(3, 3, [5 6]);
% Row 3
handles(3, 1) = subplot(3, 3, 7);
handles(3, 2) = subplot(3, 3, 8);
handles(3, 3) = subplot(3, 3, 9);
%% Plot all figures =======================================================
timeAxisInSeconds = (1:settings.msToProcess)/1000;
%----- Discrete-Time Scatter Plot ---------------------------------
plot(handles(1, 1), trackResults(channelNr).I_PN,...
trackResults(channelNr).Q_PN, ...
'.');
grid (handles(1, 1));
axis (handles(1, 1), 'equal');
title (handles(1, 1), 'Discrete-Time Scatter Plot');
xlabel(handles(1, 1), 'I prompt');
ylabel(handles(1, 1), 'Q prompt');
%----- Nav bits ---------------------------------------------------
plot (handles(1, 2), timeAxisInSeconds, ...
trackResults(channelNr).I_PN);
grid (handles(1, 2));
title (handles(1, 2), 'Bits of the navigation message');
xlabel(handles(1, 2), 'Time (s)');
axis (handles(1, 2), 'tight');
%----- PLL discriminator unfiltered--------------------------------
plot (handles(2, 1), timeAxisInSeconds, ...
trackResults(channelNr).pllDiscr, 'r');
grid (handles(2, 1));
axis (handles(2, 1), 'tight');
xlabel(handles(2, 1), 'Time (s)');
ylabel(handles(2, 1), 'Amplitude');
title (handles(2, 1), 'Raw PLL discriminator');
%----- Correlation ------------------------------------------------
plot(handles(2, 2), timeAxisInSeconds, ...
[sqrt(trackResults(channelNr).I_E.^2 + ...
trackResults(channelNr).Q_E.^2)', ...
sqrt(trackResults(channelNr).I_P.^2 + ...
trackResults(channelNr).Q_P.^2)', ...
sqrt(trackResults(channelNr).I_L.^2 + ...
trackResults(channelNr).Q_L.^2)'], ...
'-*');
grid (handles(2, 2));
title (handles(2, 2), 'Correlation results');
xlabel(handles(2, 2), 'Time (s)');
axis (handles(2, 2), 'tight');
hLegend = legend(handles(2, 2), '$\sqrt{I_{E}^2 + Q_{E}^2}$', ...
'$\sqrt{I_{P}^2 + Q_{P}^2}$', ...
'$\sqrt{I_{L}^2 + Q_{L}^2}$');
%set interpreter from tex to latex. This will draw \sqrt correctly
set(hLegend, 'Interpreter', 'Latex');
%----- PLL discriminator filtered----------------------------------
plot (handles(3, 1), timeAxisInSeconds, ...
trackResults(channelNr).pllDiscrFilt, 'b');
grid (handles(3, 1));
axis (handles(3, 1), 'tight');
xlabel(handles(3, 1), 'Time (s)');
ylabel(handles(3, 1), 'Amplitude');
title (handles(3, 1), 'Filtered PLL discriminator');
%----- DLL discriminator unfiltered--------------------------------
plot (handles(3, 2), timeAxisInSeconds, ...
trackResults(channelNr).dllDiscr, 'r');
grid (handles(3, 2));
axis (handles(3, 2), 'tight');
xlabel(handles(3, 2), 'Time (s)');
ylabel(handles(3, 2), 'Amplitude');
title (handles(3, 2), 'Raw DLL discriminator');
%----- DLL discriminator filtered----------------------------------
plot (handles(3, 3), timeAxisInSeconds, ...
trackResults(channelNr).dllDiscrFilt, 'b');
grid (handles(3, 3));
axis (handles(3, 3), 'tight');
xlabel(handles(3, 3), 'Time (s)');
ylabel(handles(3, 3), 'Amplitude');
title (handles(3, 3), 'Filtered DLL discriminator');
end % for channelNr = channelList

View File

@ -83,7 +83,7 @@ if (CAF > 0)
filename=[path 'test_statistics_E5a_sat_' num2str(sat) '_CAF.dat'];
fid=fopen(filename,'r');
xx=fread(fid,'float');%floats from squared correlation
acq_grid(:,col)=abs(xx);
acq_grid(:,col(1))=abs(xx);
Doppler_error_Hz = Doppler_axes(xx==max(xx))
maximum_correlation_peak = max(xx)
else