mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-26 00:46:59 +00:00
Bug correction for acquisition and tracking: acquisition Doppler sign were inverted and this issue caused several wrong interpretations in tracking algorithms, resulting in a swap in I/Q components. Now the bug was corrected in all tracking algorithms.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@249 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
4859faa245
commit
a25e712be6
@ -198,7 +198,7 @@ int pcps_acquisition_cc::general_work(int noutput_items,
|
||||
{
|
||||
//doppler search steps
|
||||
//Perform the carrier wipe-off
|
||||
complex_exp_gen(d_carrier, d_freq + doppler, d_fs_in, d_fft_size);
|
||||
complex_exp_gen_conj(d_carrier, d_freq + doppler, d_fs_in, d_fft_size);
|
||||
|
||||
if (is_unaligned()==true)
|
||||
{
|
||||
|
@ -61,6 +61,32 @@ void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs, unsigned int _samps)
|
||||
{
|
||||
//old
|
||||
//double phase = 0;
|
||||
//const double phase_step = (GPS_TWO_PI * _f) / _fs;
|
||||
|
||||
//new Fixed Point NCO (faster)
|
||||
int phase_i=0;
|
||||
int phase_step_i;
|
||||
float phase_step_f =(float)((GPS_TWO_PI * _f) / _fs);
|
||||
phase_step_i=gr_fxpt::float_to_fixed(phase_step_f);
|
||||
float sin_f,cos_f;
|
||||
|
||||
for(unsigned int i = 0; i < _samps; i++)
|
||||
{
|
||||
//old
|
||||
//_dest[i] = std::complex<float>(cos(phase), sin(phase));
|
||||
//phase += phase_step;
|
||||
|
||||
//new Fixed Point NCO (faster)
|
||||
gr_fxpt::sincos(phase_i,&sin_f,&cos_f);
|
||||
_dest[i] = std::complex<float>(cos_f, -sin_f);
|
||||
phase_i += phase_step_i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void hex_to_binary_converter(int * _dest, char _from)
|
||||
{
|
||||
|
@ -46,6 +46,14 @@
|
||||
void complex_exp_gen(std::complex<float>* _dest, double _f, double _fs,
|
||||
unsigned int _samps);
|
||||
|
||||
/*!
|
||||
* \brief This function generates a conjugate complex exponential in _dest.
|
||||
*
|
||||
*/
|
||||
void complex_exp_gen_conj(std::complex<float>* _dest, double _f, double _fs,
|
||||
unsigned int _samps);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief This function makes a conversion from hex (the input is a char)
|
||||
* to binary (the output are 4 ints with +1 or -1 values).
|
||||
|
@ -286,7 +286,7 @@ void galileo_e1_dll_pll_veml_tracking_cc::update_local_carrier()
|
||||
phase_rad = d_rem_carr_phase_rad;
|
||||
for(int i = 0; i < d_current_prn_length_samples; i++)
|
||||
{
|
||||
d_carr_sign[i] = gr_complex(cos(phase_rad), sin(phase_rad));
|
||||
d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad));
|
||||
phase_rad += phase_step_rad;
|
||||
}
|
||||
d_rem_carr_phase_rad = fmod(phase_rad, GPS_TWO_PI);
|
||||
@ -460,8 +460,8 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
|
||||
|
||||
// ########### Output the tracking results to Telemetry block ##########
|
||||
|
||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).imag(); // ???????
|
||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).real(); // ???????
|
||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag();
|
||||
// Tracking_timestamp_secs is aligned with the PRN start sample
|
||||
current_synchro_data.Tracking_timestamp_secs = ((double)d_sample_counter +
|
||||
(double)d_next_prn_length_samples + (double)d_next_rem_code_phase_samples) / (double)d_fs_in;
|
||||
@ -517,8 +517,8 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
|
||||
float tmp_VE, tmp_E, tmp_P, tmp_L, tmp_VL;
|
||||
float tmp_float;
|
||||
double tmp_double;
|
||||
prompt_I = (*d_Prompt).imag();
|
||||
prompt_Q = (*d_Prompt).real();
|
||||
prompt_I = (*d_Prompt).real();
|
||||
prompt_Q = (*d_Prompt).imag();
|
||||
tmp_VE = std::abs<float>(*d_Very_Early);
|
||||
tmp_E = std::abs<float>(*d_Early);
|
||||
tmp_P = std::abs<float>(*d_Prompt);
|
||||
|
@ -310,7 +310,7 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_carrier()
|
||||
phase = d_rem_carr_phase;
|
||||
for(int i = 0; i < d_current_prn_length_samples; i++)
|
||||
{
|
||||
d_carr_sign[i] = gr_complex(cos(phase), sin(phase));
|
||||
d_carr_sign[i] = gr_complex(cos(phase), -sin(phase));
|
||||
phase += phase_step;
|
||||
}
|
||||
d_rem_carr_phase = fmod(phase, GPS_TWO_PI);
|
||||
@ -319,8 +319,6 @@ void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_carrier()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc()
|
||||
{
|
||||
d_dump_file.close();
|
||||
@ -452,19 +450,12 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
// Compute PLL error
|
||||
PLL_discriminator_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / GPS_TWO_PI;
|
||||
|
||||
/*
|
||||
* \todo Update FLL assistance algorithm!
|
||||
*/
|
||||
if ((((double)d_sample_counter - (double)d_acq_sample_stamp) / d_fs_in) > 3)
|
||||
{
|
||||
d_FLL_discriminator_hz = 0; //disconnect the FLL after the initial lock
|
||||
}
|
||||
/*
|
||||
* DLL and FLL+PLL filter and get current carrier Doppler and code frequency
|
||||
*/
|
||||
carr_nco_hz = d_carrier_loop_filter.get_carrier_error(d_FLL_discriminator_hz, PLL_discriminator_hz, correlation_time_s);
|
||||
d_carrier_doppler_hz = d_if_freq + carr_nco_hz;
|
||||
d_code_freq_hz = GPS_L1_CA_CODE_RATE_HZ - (((d_carrier_doppler_hz - d_if_freq) * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ) - code_error_chips;
|
||||
d_code_freq_hz = GPS_L1_CA_CODE_RATE_HZ + (((d_carrier_doppler_hz + d_if_freq) * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ) - code_error_chips;
|
||||
|
||||
/*!
|
||||
* \todo Improve the lock detection algorithm!
|
||||
@ -539,8 +530,8 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error
|
||||
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
current_synchro_data.Prompt_I=(double)(*d_Prompt).imag();
|
||||
current_synchro_data.Prompt_Q=(double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_I=(double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_Q=(double)(*d_Prompt).imag();
|
||||
// Tracking_timestamp_secs is aligned with the PRN start sample
|
||||
current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_current_prn_length_samples+d_rem_code_phase_samples)/d_fs_in;
|
||||
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, Code_phase_secs=0
|
||||
@ -568,8 +559,8 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
|
||||
float tmp_E, tmp_P, tmp_L;
|
||||
float tmp_float;
|
||||
double tmp_double;
|
||||
prompt_I = (*d_Prompt).imag();
|
||||
prompt_Q = (*d_Prompt).real();
|
||||
prompt_I = (*d_Prompt).real();
|
||||
prompt_Q = (*d_Prompt).imag();
|
||||
tmp_E=std::abs<float>(*d_Early);
|
||||
tmp_P=std::abs<float>(*d_Prompt);
|
||||
tmp_L=std::abs<float>(*d_Late);
|
||||
|
@ -82,7 +82,7 @@ gps_l1_ca_dll_pll_make_optim_tracking_cc(
|
||||
void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::forecast (int noutput_items,
|
||||
gr_vector_int &ninput_items_required)
|
||||
{
|
||||
ninput_items_required[0] = (int)d_vector_length*2; //set the required available samples in each call
|
||||
ninput_items_required[0] = d_gnuradio_forecast_samples ; //set the required available samples in each call
|
||||
}
|
||||
|
||||
|
||||
@ -109,6 +109,7 @@ Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc(
|
||||
d_if_freq = if_freq;
|
||||
d_fs_in = fs_in;
|
||||
d_vector_length = vector_length;
|
||||
d_gnuradio_forecast_samples=(int)d_vector_length*2;
|
||||
d_dump_filename = dump_filename;
|
||||
|
||||
// Initialize tracking ==========================================
|
||||
@ -339,14 +340,14 @@ void Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::update_local_carrier()
|
||||
{
|
||||
//using temp variables
|
||||
gr_fxpt::sincos(phase_rad_i,&sin_f,&cos_f);
|
||||
d_carr_sign[i] = gr_complex(cos_f, sin_f);
|
||||
d_carr_sign[i] = gr_complex(cos_f, -sin_f);
|
||||
//using references (may be it can be a problem for c++11 standard
|
||||
//gr_fxpt::sincos(phase_rad_i,&d_carr_sign[i].imag(),&d_carr_sign[i].real());
|
||||
|
||||
phase_rad_i += phase_step_rad_i;
|
||||
|
||||
// Using std::cos and std::sin
|
||||
//d_carr_sign[i] = gr_complex(cos(phase_rad), sin(phase_rad));
|
||||
//d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad));
|
||||
}
|
||||
|
||||
d_rem_carr_phase_rad = fmod(gr_fxpt::fixed_to_float(phase_rad_i), GPS_TWO_PI);
|
||||
@ -425,7 +426,7 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
// variable code PRN sample block size
|
||||
d_current_prn_length_samples = d_next_prn_length_samples;
|
||||
|
||||
//update_local_code();
|
||||
update_local_code();
|
||||
update_local_carrier();
|
||||
|
||||
// perform Early, Prompt and Late correlation
|
||||
@ -535,8 +536,8 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
|
||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).imag();
|
||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag();
|
||||
// Tracking_timestamp_secs is aligned with the PRN start sample
|
||||
current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_next_prn_length_samples+(double)d_next_rem_code_phase_samples)/(double)d_fs_in;
|
||||
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0
|
||||
@ -593,8 +594,8 @@ int Gps_L1_Ca_Dll_Pll_Optim_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
float tmp_E, tmp_P, tmp_L;
|
||||
float tmp_float;
|
||||
double tmp_double;
|
||||
prompt_I = (*d_Prompt).imag();
|
||||
prompt_Q = (*d_Prompt).real();
|
||||
prompt_I = (*d_Prompt).real();
|
||||
prompt_Q = (*d_Prompt).imag();
|
||||
tmp_E = std::abs<float>(*d_Early);
|
||||
tmp_P = std::abs<float>(*d_Prompt);
|
||||
tmp_L = std::abs<float>(*d_Late);
|
||||
|
@ -135,7 +135,6 @@ private:
|
||||
long d_fs_in;
|
||||
|
||||
double d_early_late_spc_chips;
|
||||
|
||||
double d_code_phase_step_chips;
|
||||
|
||||
gr_complex* d_ca_code;
|
||||
@ -190,6 +189,7 @@ private:
|
||||
// control vars
|
||||
bool d_enable_tracking;
|
||||
bool d_pull_in;
|
||||
int d_gnuradio_forecast_samples;
|
||||
|
||||
// file dump
|
||||
std::string d_dump_filename;
|
||||
|
@ -307,7 +307,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_carrier()
|
||||
phase_rad = d_rem_carr_phase_rad;
|
||||
for(int i = 0; i < d_current_prn_length_samples; i++)
|
||||
{
|
||||
d_carr_sign[i] = gr_complex(cos(phase_rad), sin(phase_rad));
|
||||
d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad));
|
||||
phase_rad += phase_step_rad;
|
||||
}
|
||||
d_rem_carr_phase_rad = fmod(phase_rad, GPS_TWO_PI);
|
||||
@ -496,8 +496,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
|
||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).imag();
|
||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag();
|
||||
// Tracking_timestamp_secs is aligned with the PRN start sample
|
||||
current_synchro_data.Tracking_timestamp_secs=((double)d_sample_counter+(double)d_next_prn_length_samples+(double)d_next_rem_code_phase_samples)/(double)d_fs_in;
|
||||
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0
|
||||
@ -554,8 +554,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in
|
||||
float tmp_E, tmp_P, tmp_L;
|
||||
float tmp_float;
|
||||
double tmp_double;
|
||||
prompt_I = (*d_Prompt).imag();
|
||||
prompt_Q = (*d_Prompt).real();
|
||||
prompt_I = (*d_Prompt).real();
|
||||
prompt_Q = (*d_Prompt).imag();
|
||||
tmp_E = std::abs<float>(*d_Early);
|
||||
tmp_P = std::abs<float>(*d_Prompt);
|
||||
tmp_L = std::abs<float>(*d_Late);
|
||||
|
@ -310,10 +310,6 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::update_local_code()
|
||||
{
|
||||
associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips));
|
||||
d_early_code[i] = d_ca_code[associated_chip_index];
|
||||
//associated_chip_index = 1 + round(fmod(tcode_chips, code_length_chips));
|
||||
//d_prompt_code[i] = d_ca_code[associated_chip_index];
|
||||
//associated_chip_index = 1 + round(fmod(tcode_chips+d_early_late_spc_chips, code_length_chips));
|
||||
//d_late_code[i] = d_ca_code[associated_chip_index];
|
||||
tcode_chips = tcode_chips + d_code_phase_step_chips;
|
||||
}
|
||||
|
||||
@ -332,7 +328,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::update_local_carrier()
|
||||
phase_rad = d_rem_carr_phase_rad;
|
||||
for(int i = 0; i < d_current_prn_length_samples; i++)
|
||||
{
|
||||
d_carr_sign[i] = gr_complex(cos(phase_rad), sin(phase_rad));
|
||||
d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad));
|
||||
phase_rad += phase_step_rad;
|
||||
}
|
||||
d_rem_carr_phase_rad = fmod(phase_rad, GPS_TWO_PI);
|
||||
@ -466,7 +462,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
d_control_id++;
|
||||
|
||||
//! Send and receive a TCP packet
|
||||
boost::array<float, NUM_TX_VARIABLES> tx_variables_array = {{d_control_id,(*d_Early).imag(),(*d_Early).real(),(*d_Late).imag(),(*d_Late).real(),(*d_Prompt).imag(),(*d_Prompt).real(),d_acq_carrier_doppler_hz,1}};
|
||||
boost::array<float, NUM_TX_VARIABLES> tx_variables_array = {{d_control_id,(*d_Early).real(),(*d_Early).imag(),(*d_Late).real(),(*d_Late).imag(),(*d_Prompt).real(),(*d_Prompt).imag(),d_acq_carrier_doppler_hz,1}};
|
||||
d_tcp_com.send_receive_tcp_packet(tx_variables_array, &tcp_data);
|
||||
|
||||
//! Recover the tracking data
|
||||
@ -545,8 +541,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
|
||||
// ########### Output the tracking data to navigation and PVT ##########
|
||||
|
||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).imag();
|
||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_I = (double)(*d_Prompt).real();
|
||||
current_synchro_data.Prompt_Q = (double)(*d_Prompt).imag();
|
||||
current_synchro_data.Tracking_timestamp_secs = d_sample_counter_seconds;
|
||||
current_synchro_data.Carrier_phase_rads = (double)d_acc_carrier_phase_rad;
|
||||
current_synchro_data.Code_phase_secs = (double)d_code_phase_samples * (1/(float)d_fs_in);
|
||||
@ -600,8 +596,8 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec
|
||||
float prompt_Q;
|
||||
float tmp_E, tmp_P, tmp_L;
|
||||
float tmp_float;
|
||||
prompt_I = (*d_Prompt).imag();
|
||||
prompt_Q = (*d_Prompt).real();
|
||||
prompt_I = (*d_Prompt).real();
|
||||
prompt_Q = (*d_Prompt).imag();
|
||||
tmp_E = std::abs<float>(*d_Early);
|
||||
tmp_P = std::abs<float>(*d_Prompt);
|
||||
tmp_L = std::abs<float>(*d_Late);
|
||||
|
@ -72,19 +72,17 @@ float gps_l1_ca_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
|
||||
{
|
||||
// estimate CN0 using buffered values
|
||||
// MATLAB CODE
|
||||
// Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2;
|
||||
// Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2);
|
||||
// SNR_SNV(count)=Psig/(Ptot-Psig);
|
||||
// CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
|
||||
float SNR, SNR_dB_Hz;
|
||||
float tmp_abs_imag;
|
||||
float tmp_abs_real;
|
||||
float Psig, Ptot;
|
||||
Psig = 0;
|
||||
Ptot = 0;
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
tmp_abs_imag = std::abs(Prompt_buffer[i].imag());
|
||||
Psig += tmp_abs_imag;
|
||||
tmp_abs_real = std::abs(Prompt_buffer[i].real());
|
||||
Psig += tmp_abs_real;
|
||||
Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real();
|
||||
}
|
||||
Psig = Psig / (float)length;
|
||||
@ -114,19 +112,17 @@ float galileo_e1_CN0_SNV(gr_complex* Prompt_buffer, int length, long fs_in)
|
||||
{
|
||||
// estimate CN0 using buffered values
|
||||
// MATLAB CODE
|
||||
// Psig=((1/N)*sum(abs(imag(x((n-N+1):n)))))^2;
|
||||
// Ptot=(1/N)*sum(abs(x((n-N+1):n)).^2);
|
||||
// SNR_SNV(count)=Psig/(Ptot-Psig);
|
||||
// CN0_SNV_dB=10*log10(SNR_SNV)+10*log10(BW)-10*log10(PRN_length);
|
||||
float SNR, SNR_dB_Hz;
|
||||
float tmp_abs_imag;
|
||||
float tmp_abs_real;
|
||||
float Psig, Ptot;
|
||||
Psig = 0;
|
||||
Ptot = 0;
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
tmp_abs_imag = std::abs(Prompt_buffer[i].imag());
|
||||
Psig += tmp_abs_imag;
|
||||
tmp_abs_real= std::abs(Prompt_buffer[i].real());
|
||||
Psig += tmp_abs_real;
|
||||
Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real();
|
||||
}
|
||||
Psig = Psig / (float)length;
|
||||
@ -150,11 +146,6 @@ float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
||||
* Code lock detector
|
||||
*/
|
||||
// estimate using buffered values
|
||||
// MATLAB CODE
|
||||
// lock detector operation
|
||||
// NBD=sum(abs(imag(x((n-N+1):n))))^2 + sum(abs(real(x((n-N+1):n))))^2;
|
||||
// NBP=sum(imag(x((n-N+1):n)).^2) - sum(real(x((n-N+1):n)).^2);
|
||||
// LOCK(count)=NBD/NBP;
|
||||
float tmp_abs_I, tmp_abs_Q;
|
||||
float tmp_sum_abs_I, tmp_sum_abs_Q;
|
||||
float tmp_sum_sqr_I, tmp_sum_sqr_Q;
|
||||
@ -165,12 +156,12 @@ float carrier_lock_detector(gr_complex* Prompt_buffer, int length)
|
||||
float NBD,NBP;
|
||||
for (int i=0; i<length; i++)
|
||||
{
|
||||
tmp_abs_I = std::abs(Prompt_buffer[i].imag());
|
||||
tmp_abs_Q = std::abs(Prompt_buffer[i].real());
|
||||
tmp_abs_I = std::abs(Prompt_buffer[i].real());
|
||||
tmp_abs_Q = std::abs(Prompt_buffer[i].imag());
|
||||
tmp_sum_abs_I += tmp_abs_I;
|
||||
tmp_sum_abs_Q += tmp_abs_Q;
|
||||
tmp_sum_sqr_I += (Prompt_buffer[i].imag() * Prompt_buffer[i].imag());
|
||||
tmp_sum_sqr_Q += (Prompt_buffer[i].real() * Prompt_buffer[i].real());
|
||||
tmp_sum_sqr_I += (Prompt_buffer[i].real() * Prompt_buffer[i].real());
|
||||
tmp_sum_sqr_Q += (Prompt_buffer[i].imag() * Prompt_buffer[i].imag());
|
||||
}
|
||||
NBD = tmp_sum_abs_I * tmp_sum_abs_I + tmp_sum_abs_Q * tmp_sum_abs_Q;
|
||||
NBP = tmp_sum_sqr_I - tmp_sum_sqr_Q;
|
||||
|
@ -74,7 +74,7 @@ void Correlator::Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const
|
||||
|
||||
|
||||
|
||||
void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_aligned)
|
||||
void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, bool input_vector_unaligned)
|
||||
{
|
||||
gr_complex* bb_signal;
|
||||
gr_complex* input_aligned;
|
||||
@ -82,21 +82,22 @@ void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr
|
||||
//todo: do something if posix_memalign fails
|
||||
if (posix_memalign((void**)&bb_signal, 16, signal_length_samples * sizeof(gr_complex)) == 0) {};
|
||||
|
||||
if (input_vector_aligned==false)
|
||||
//todo: There is an issue with the aligned version of volk_32fc_x2_multiply_32fc, even if the is_unaligned()==false
|
||||
if (input_vector_unaligned==true)
|
||||
{
|
||||
//todo: do something if posix_memalign fails
|
||||
if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
|
||||
memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
|
||||
//if (posix_memalign((void**)&input_aligned, 16, signal_length_samples * sizeof(gr_complex)) == 0){};
|
||||
//memcpy(input_aligned,input,signal_length_samples * sizeof(gr_complex));
|
||||
|
||||
//volk_32fc_x2_multiply_32fc_a_manual(bb_signal, input_aligned, carrier, signal_length_samples, volk_32fc_x2_multiply_32fc_a_best_arch.c_str());
|
||||
//volk_32fc_x2_dot_prod_32fc_a_manual(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
|
||||
//volk_32fc_x2_dot_prod_32fc_a_manual(P_out, bb_signal, P_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
|
||||
//volk_32fc_x2_dot_prod_32fc_a_manual(L_out, bb_signal, L_code, signal_length_samples * sizeof(gr_complex), volk_32fc_x2_dot_prod_32fc_a_best_arch.c_str());
|
||||
|
||||
volk_32fc_x2_multiply_32fc_a(bb_signal, input_aligned, carrier, signal_length_samples);
|
||||
volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples);
|
||||
}else{
|
||||
//use directly the input vector
|
||||
volk_32fc_x2_multiply_32fc_a(bb_signal, input, carrier, signal_length_samples);
|
||||
volk_32fc_x2_multiply_32fc_u(bb_signal, input, carrier, signal_length_samples);
|
||||
}
|
||||
|
||||
volk_32fc_x2_dot_prod_32fc_a(E_out, bb_signal, E_code, signal_length_samples * sizeof(gr_complex));
|
||||
@ -104,10 +105,10 @@ void Correlator::Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr
|
||||
volk_32fc_x2_dot_prod_32fc_a(L_out, bb_signal, L_code, signal_length_samples * sizeof(gr_complex));
|
||||
|
||||
free(bb_signal);
|
||||
if (input_vector_aligned==false)
|
||||
{
|
||||
free(input_aligned);
|
||||
}
|
||||
//if (input_vector_unaligned==false)
|
||||
//{
|
||||
// free(input_aligned);
|
||||
//}
|
||||
}
|
||||
|
||||
void Correlator::Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* VE_code,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* VL_code,gr_complex* VE_out,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,gr_complex* VL_out,bool input_vector_aligned)
|
||||
|
@ -54,7 +54,7 @@ class Correlator
|
||||
public:
|
||||
void Carrier_wipeoff_and_EPL_generic(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out);
|
||||
void Carrier_wipeoff_and_EPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,bool input_vector_aligned);
|
||||
void Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* VE_code,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* VL_code,gr_complex* VE_out,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,gr_complex* VL_out,bool input_vector_aligned);
|
||||
void Carrier_wipeoff_and_VEPL_volk(int signal_length_samples,const gr_complex* input, gr_complex* carrier,gr_complex* VE_code,gr_complex* E_code, gr_complex* P_code, gr_complex* L_code,gr_complex* VL_code,gr_complex* VE_out,gr_complex* E_out, gr_complex* P_out, gr_complex* L_out,gr_complex* VL_out,bool input_vector_unaligned);
|
||||
Correlator();
|
||||
~Correlator();
|
||||
private:
|
||||
|
@ -49,8 +49,8 @@
|
||||
float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1, float t2)
|
||||
{
|
||||
float cross,dot;
|
||||
dot = prompt_s1.imag()*prompt_s2.imag() + prompt_s1.real()*prompt_s2.real();
|
||||
cross = prompt_s1.imag()*prompt_s2.real() - prompt_s2.imag()*prompt_s1.real();
|
||||
dot = prompt_s1.real()*prompt_s2.real() + prompt_s1.imag()*prompt_s2.imag();
|
||||
cross = prompt_s1.real()*prompt_s2.imag() - prompt_s2.real()*prompt_s1.imag();
|
||||
return atan2(cross, dot) / (t2-t1);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ float fll_four_quadrant_atan(gr_complex prompt_s1, gr_complex prompt_s2,float t1
|
||||
*/
|
||||
float pll_four_quadrant_atan(gr_complex prompt_s1)
|
||||
{
|
||||
return atan2(prompt_s1.real(), prompt_s1.imag());
|
||||
return atan2(prompt_s1.imag(), prompt_s1.real());
|
||||
}
|
||||
|
||||
|
||||
@ -77,9 +77,9 @@ float pll_four_quadrant_atan(gr_complex prompt_s1)
|
||||
*/
|
||||
float pll_cloop_two_quadrant_atan(gr_complex prompt_s1)
|
||||
{
|
||||
if (prompt_s1.imag() != 0.0)
|
||||
if (prompt_s1.real() != 0.0)
|
||||
{
|
||||
return atan(prompt_s1.real() / prompt_s1.imag());
|
||||
return atan(prompt_s1.imag() / prompt_s1.real());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user