1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 11:40:33 +00:00

Work in progress for GPS L2C support:

- Patched GPS L2CM tracking pull-in code.
- Workaround for ViterbiDecoder bug
This commit is contained in:
Javier 2015-06-12 15:49:25 +02:00
parent 24c75a19db
commit adf73e0610
7 changed files with 116 additions and 127 deletions

View File

@ -26,11 +26,11 @@ GNSS-SDR.SUPL_CI=0x31b0
;######### SIGNAL_SOURCE CONFIG ############
SignalSource.implementation=UHD_Signal_Source
SignalSource.device_address=192.168.40.2
SignalSource.device_address=192.168.50.2
SignalSource.item_type=cshort
SignalSource.sampling_frequency=5000000
SignalSource.freq=1227600000
SignalSource.gain=40
SignalSource.gain=60
SignalSource.subdevice=A:0
SignalSource.samples=0
SignalSource.repeat=false
@ -85,7 +85,7 @@ Resampler.sample_freq_out=5000000
;######### CHANNELS GLOBAL CONFIG ############
;#count: Number of available GPS satellite channels.
Channels_2S.count=8
Channels_2S.count=1
;#in_acquisition: Number of channels simultaneously acquiring for the whole receiver
Channels.in_acquisition=1
@ -114,10 +114,10 @@ Acquisition_2S.item_type=gr_complex
Acquisition_2S.if=0
Acquisition_2S.coherent_integration_time_ms=1
Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S.threshold=0.0005
Acquisition_2S.threshold=0.0008
;Acquisition_2S.pfa=0.00001
Acquisition_2S.doppler_max=5000
Acquisition_2S.doppler_step=100
Acquisition_2S.doppler_step=30
Acquisition_2S.bit_transition_flag=false
Acquisition_2S.max_dwells=1
@ -128,11 +128,11 @@ Acquisition_2S.max_dwells=1
Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking
Tracking_2S.item_type=gr_complex
Tracking_2S.if=0
Tracking_2S.dump=false
Tracking_2S.dump=true
Tracking_2S.dump_filename=./tracking_ch_
Tracking_2S.pll_bw_hz=2.0;
Tracking_2S.dll_bw_hz=0.5;
Tracking_2S.fll_bw_hz=10.0;
Tracking_2S.pll_bw_hz=3.0;
Tracking_2S.dll_bw_hz=1;
Tracking_2S.fll_bw_hz=2.0;
Tracking_2S.order=3;
Tracking_2S.early_late_space_chips=0.5;

View File

@ -268,7 +268,7 @@ Resampler2.implementation=Pass_Through
;######### CHANNELS GLOBAL CONFIG ############
;#count: Number of available GPS satellite channels.
Channels_1C.count=1
Channels_2S.count=4
Channels_2S.count=6
;#count: Number of available Galileo satellite channels.
;Channels_Galileo.count=0
;#in_acquisition: Number of channels simultaneously acquiring for the whole receiver
@ -298,14 +298,14 @@ Channel3.signal=2S
Channel4.RF_channel_ID=1
Channel4.signal=2S
Channel5.RF_channel_ID=0
Channel5.signal=1C
Channel5.RF_channel_ID=1
Channel5.signal=2S
Channel6.RF_channel_ID=0
Channel6.signal=1C
Channel6.RF_channel_ID=1
Channel6.signal=2S
Channel7.RF_channel_ID=0
Channel7.signal=1C
Channel7.RF_channel_ID=1
Channel7.signal=2S
Channel8.RF_channel_ID=1
@ -448,11 +448,11 @@ Acquisition_2S1.dump_filename=./acq_dump.dat
Acquisition_2S1.item_type=gr_complex
Acquisition_2S1.if=0
Acquisition_2S1.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S1.threshold=0.0007
Acquisition_2S1.threshold=0.0004
;Acquisition_2S1.pfa=0.001
Acquisition_2S1.doppler_max=5000
Acquisition_2S1.doppler_min=-5000
Acquisition_2S1.doppler_step=10
Acquisition_2S1.doppler_step=30
Acquisition_2S1.max_dwells=1
Acquisition_2S2.dump=false
@ -460,11 +460,11 @@ Acquisition_2S2.dump_filename=./acq_dump.dat
Acquisition_2S2.item_type=gr_complex
Acquisition_2S2.if=0
Acquisition_2S2.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S2.threshold=0.0005
Acquisition_2S2.threshold=0.0004
;Acquisition_2S2.pfa=0.001
Acquisition_2S2.doppler_max=5000
Acquisition_2S2.doppler_min=-5000
Acquisition_2S2.doppler_step=100
Acquisition_2S2.doppler_step=30
Acquisition_2S2.max_dwells=1
Acquisition_2S3.dump=false
@ -472,11 +472,11 @@ Acquisition_2S3.dump_filename=./acq_dump.dat
Acquisition_2S3.item_type=gr_complex
Acquisition_2S3.if=0
Acquisition_2S3.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S3.threshold=0.0005
Acquisition_2S3.threshold=0.0004
;Acquisition_2S3.pfa=0.001
Acquisition_2S3.doppler_max=5000
Acquisition_2S3.doppler_min=-5000
Acquisition_2S3.doppler_step=100
Acquisition_2S3.doppler_step=30
Acquisition_2S3.max_dwells=1
Acquisition_2S4.dump=false
@ -484,61 +484,48 @@ Acquisition_2S4.dump_filename=./acq_dump.dat
Acquisition_2S4.item_type=gr_complex
Acquisition_2S4.if=0
Acquisition_2S4.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S4.threshold=0.0005
Acquisition_2S4.threshold=0.0004
;Acquisition_2S4.pfa=0.001
Acquisition_2S4.doppler_max=5000
Acquisition_2S4.doppler_min=-5000
Acquisition_2S4.doppler_step=100
Acquisition_2S4.doppler_step=30
Acquisition_2S4.max_dwells=1
Acquisition_2S12.dump=false
Acquisition_2S12.dump_filename=./acq_dump.dat
Acquisition_2S12.item_type=gr_complex
Acquisition_2S12.if=0
Acquisition_2S12.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S12.threshold=0.0005
;Acquisition_2S12.pfa=0.001
Acquisition_2S12.doppler_max=5000
Acquisition_2S12.doppler_min=-5000
Acquisition_2S12.doppler_step=100
Acquisition_2S12.max_dwells=1
Acquisition_2S5.dump=false
Acquisition_2S5.dump_filename=./acq_dump.dat
Acquisition_2S5.item_type=gr_complex
Acquisition_2S5.if=0
Acquisition_2S5.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S5.threshold=0.0004
;Acquisition_2S5.pfa=0.001
Acquisition_2S5.doppler_max=5000
Acquisition_2S5.doppler_min=-5000
Acquisition_2S5.doppler_step=30
Acquisition_2S5.max_dwells=1
Acquisition_2S13.dump=false
Acquisition_2S13.dump_filename=./acq_dump.dat
Acquisition_2S13.item_type=gr_complex
Acquisition_2S13.if=0
Acquisition_2S13.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S13.threshold=0.0005
;Acquisition_2S13.pfa=0.001
Acquisition_2S13.doppler_max=5000
Acquisition_2S13.doppler_min=-5000
Acquisition_2S13.doppler_step=100
Acquisition_2S13.max_dwells=1
Acquisition_2S14.dump=false
Acquisition_2S14.dump_filename=./acq_dump.dat
Acquisition_2S14.item_type=gr_complex
Acquisition_2S14.if=0
Acquisition_2S14.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S14.threshold=0.0005
;Acquisition_2S14.pfa=0.001
Acquisition_2S14.doppler_max=5000
Acquisition_2S14.doppler_min=-5000
Acquisition_2S14.doppler_step=100
Acquisition_2S14.max_dwells=1
Acquisition_2S15.dump=false
Acquisition_2S15.dump_filename=./acq_dump.dat
Acquisition_2S15.item_type=gr_complex
Acquisition_2S15.if=0
Acquisition_2S15.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S15.threshold=0.0005
;Acquisition_2S15.pfa=0.001
Acquisition_2S15.doppler_max=5000
Acquisition_2S15.doppler_min=-5000
Acquisition_2S15.doppler_step=100
Acquisition_2S15.max_dwells=1
Acquisition_2S6.dump=false
Acquisition_2S6.dump_filename=./acq_dump.dat
Acquisition_2S6.item_type=gr_complex
Acquisition_2S6.if=0
Acquisition_2S6.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S6.threshold=0.0004
;Acquisition_2S6.pfa=0.001
Acquisition_2S6.doppler_max=5000
Acquisition_2S6.doppler_min=-5000
Acquisition_2S6.doppler_step=30
Acquisition_2S6.max_dwells=1
Acquisition_2S7.dump=false
Acquisition_2S7.dump_filename=./acq_dump.dat
Acquisition_2S7.item_type=gr_complex
Acquisition_2S7.if=0
Acquisition_2S7.implementation=GPS_L2_M_PCPS_Acquisition
Acquisition_2S7.threshold=0.0004
;Acquisition_2S7.pfa=0.001
Acquisition_2S7.doppler_max=5000
Acquisition_2S7.doppler_min=-5000
Acquisition_2S7.doppler_step=100
Acquisition_2S7.max_dwells=1
;######### ACQUISITION CHANNELS CONFIG ######
@ -681,51 +668,38 @@ Tracking_2S4.order=3;
Tracking_2S4.early_late_space_chips=0.5;
;######### TRACKING CHANNEL 12 CONFIG ############
Tracking_2S12.implementation=GPS_L2_M_DLL_PLL_Tracking
Tracking_2S12.item_type=gr_complex
Tracking_2S12.if=0
Tracking_2S12.dump=false
Tracking_2S12.dump_filename=./tracking_ch_
Tracking_2S12.pll_bw_hz=2.0;
Tracking_2S12.dll_bw_hz=0.5;
Tracking_2S12.fll_bw_hz=2.0;
Tracking_2S12.order=2;
Tracking_2S12.early_late_space_chips=0.5;
Tracking_2S5.implementation=GPS_L2_M_DLL_PLL_Tracking
Tracking_2S5.item_type=gr_complex
Tracking_2S5.if=0
Tracking_2S5.dump=true
Tracking_2S5.dump_filename=./tracking_ch_
Tracking_2S5.pll_bw_hz=3.0;
Tracking_2S5.dll_bw_hz=1;
Tracking_2S5.fll_bw_hz=2.0;
Tracking_2S5.order=3;
Tracking_2S5.early_late_space_chips=0.5;
;######### TRACKING CHANNEL 13 CONFIG ############
Tracking_2S13.implementation=GPS_L2_M_DLL_PLL_Tracking
Tracking_2S13.item_type=gr_complex
Tracking_2S13.if=0
Tracking_2S13.dump=false
Tracking_2S13.dump_filename=./tracking_ch_
Tracking_2S13.pll_bw_hz=2.0;
Tracking_2S13.dll_bw_hz=0.5;
Tracking_2S13.fll_bw_hz=2.0;
Tracking_2S13.order=2;
Tracking_2S13.early_late_space_chips=0.5;
Tracking_2S6.implementation=GPS_L2_M_DLL_PLL_Tracking
Tracking_2S6.item_type=gr_complex
Tracking_2S6.if=0
Tracking_2S6.dump=true
Tracking_2S6.dump_filename=./tracking_ch_
Tracking_2S6.pll_bw_hz=3.0;
Tracking_2S6.dll_bw_hz=1;
Tracking_2S6.fll_bw_hz=2.0;
Tracking_2S6.order=3;
Tracking_2S6.early_late_space_chips=0.5;
;######### TRACKING CHANNEL 14 CONFIG ############
Tracking_2S14.implementation=GPS_L2_M_DLL_PLL_Tracking
Tracking_2S14.item_type=gr_complex
Tracking_2S14.if=0
Tracking_2S14.dump=false
Tracking_2S14.dump_filename=./tracking_ch_
Tracking_2S14.pll_bw_hz=2.0;
Tracking_2S14.dll_bw_hz=0.5;
Tracking_2S14.fll_bw_hz=2.0;
Tracking_2S14.order=2;
Tracking_2S14.early_late_space_chips=0.5;
;######### TRACKING CHANNEL 15 CONFIG ############
Tracking_2S15.implementation=GPS_L2_M_DLL_PLL_Tracking
Tracking_2S15.item_type=gr_complex
Tracking_2S15.if=0
Tracking_2S15.dump=false
Tracking_2S15.dump_filename=./tracking_ch_
Tracking_2S15.pll_bw_hz=2.0;
Tracking_2S15.dll_bw_hz=0.5;
Tracking_2S15.fll_bw_hz=2.0;
Tracking_2S15.order=2;
Tracking_2S15.early_late_space_chips=0.5;
Tracking_2S7.implementation=GPS_L2_M_DLL_PLL_Tracking
Tracking_2S7.item_type=gr_complex
Tracking_2S7.if=0
Tracking_2S7.dump=true
Tracking_2S7.dump_filename=./tracking_ch_
Tracking_2S7.pll_bw_hz=3.0;
Tracking_2S7.dll_bw_hz=1;
Tracking_2S7.fll_bw_hz=2.0;
Tracking_2S7.order=3;
Tracking_2S7.early_late_space_chips=0.5;
;######### TELEMETRY DECODER GPS CONFIG ############

View File

@ -180,6 +180,8 @@ void GpsL2MPcpsAcquisition::set_doppler_max(unsigned int doppler_max)
}
// Be aware that Doppler step should be set to 2/(3T) Hz, where T is the coherent integration time (GPS L2 period is 0.02s)
// Doppler bin minimum size= 33 Hz
void GpsL2MPcpsAcquisition::set_doppler_step(unsigned int doppler_step)
{
doppler_step_ = doppler_step;

View File

@ -194,7 +194,7 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in
{
tmp_msg = valid_msgs.at(i).second;
d_CNAV_Message.decode_page(tmp_msg);
std::cout << "Valid CNAV frame with relative preamble start at " << valid_msgs.at(i).first << std::endl;
//std::cout << "Valid CNAV frame with relative preamble start at " << valid_msgs.at(i).first << std::endl;
flag_new_cnav_frame = true;
d_flag_valid_word = true;
last_frame_preamble_start = valid_msgs.at(i).first;

View File

@ -311,7 +311,6 @@ int Viterbi_Decoder::do_tb_and_decode(int traceback_length, int requested_decodi
int n_im = 0;
VLOG(FLOW) << "do_tb_and_decode(): requested_decoding_length=" << requested_decoding_length;
// decode only decode_length bits -> overstep newer bits which are too much
decoding_length_mismatch = d_trellis_paths.size() - (traceback_length + requested_decoding_length);
VLOG(BLOCK) << "decoding_length_mismatch=" << decoding_length_mismatch;
@ -323,7 +322,6 @@ int Viterbi_Decoder::do_tb_and_decode(int traceback_length, int requested_decodi
{
state = it->get_anchestor_state_of_current_state(state);
}
t_out = d_trellis_paths.end() - (d_trellis_paths.begin() + traceback_length + overstep_length) - 1;//requested_decoding_length-1;
indicator_metric = 0;
for (it = d_trellis_paths.begin() + traceback_length + overstep_length; it < d_trellis_paths.end(); ++it)
@ -347,6 +345,7 @@ int Viterbi_Decoder::do_tb_and_decode(int traceback_length, int requested_decodi
// remove old states
if (d_trellis_paths.begin() + traceback_length + overstep_length <= d_trellis_paths.end())
{
d_trellis_paths.erase(d_trellis_paths.begin() + traceback_length+overstep_length, d_trellis_paths.end());
}
return decoding_length_mismatch;
@ -479,6 +478,7 @@ Viterbi_Decoder::Prev::Prev(int states, int t)
{
this->t = t;
state = new int[states];
num_states=states;
bit = new int[states];
metric = new float[states];
refcount = new int;
@ -494,6 +494,7 @@ Viterbi_Decoder::Prev::Prev(const Prev& prev)
(*refcount)++;
t = prev.t;
state = prev.state;
num_states=prev.num_states;
bit = prev.bit;
metric = prev.metric;
VLOG(LMORE) << "Prev(" << "?" << ", " << t << ")" << " copy, new refcount = " << *refcount;
@ -562,7 +563,14 @@ Viterbi_Decoder::Prev::~Prev()
int Viterbi_Decoder::Prev::get_anchestor_state_of_current_state(int current_state)
{
//std::cout << "get prev state: for state " << current_state << " at time " << t << ", the prev state at time " << t-1 << " is " << state[current_state] << std::endl;
return state[current_state];
if (num_states>current_state)
{
return state[current_state];
}else{
//std::cout<<"alarm "<<"num_states="<<num_states<<" current_state="<<current_state<<std::endl;
//return state[current_state];
return 0;
}
}

View File

@ -63,6 +63,7 @@ private:
class Prev
{
public:
int num_states;
Prev(int states, int t);
Prev(const Prev& prev);
Prev& operator=(const Prev& other);

View File

@ -222,7 +222,8 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking()
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;
//TODO: debug the algorithm implementation and enable correction
//d_acq_code_phase_samples = corrected_acq_phase_samples;
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
@ -247,7 +248,7 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking()
sys = sys_.substr(0,1);
// DEBUG OUTPUT
std::cout << "Tracking start on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << std::endl;
std::cout << "Tracking start on channel " << d_channel << " for satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) <<" whith Doppler="<<d_acq_carrier_doppler_hz<<" [Hz]"<< std::endl;
LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel;
@ -336,10 +337,10 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// process vars
float carr_error_hz;
float carr_error_filt_hz;
float code_error_chips;
float code_error_filt_chips;
float carr_error_hz=0;
float carr_error_filt_hz=0;
float code_error_chips=0;
float code_error_filt_chips=0;
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();
@ -358,12 +359,15 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int
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);
samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples+(1.5*(d_fs_in/GPS_L2_M_CODE_RATE_HZ)));
// /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_seconds = d_sample_counter_seconds + (((double)samples_offset) / static_cast<double>(d_fs_in));
d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples
d_pull_in = false;
//std::cout<<" samples_offset="<<samples_offset<<"\r\n";
//std::cout<<" d_acq_code_phase_samples="<<d_acq_code_phase_samples<<std::endl;
//std::cout<<" acq_trk_shif_correction_samples="<<acq_trk_shif_correction_samples<<std::endl;
//std::cout<<" d_current_prn_length_samples="<<d_current_prn_length_samples<<std::endl;
//std::cout<<" samples_offset="<<samples_offset<<std::endl;
// Fill the acquisition data
current_synchro_data = *d_acquisition_gnss_synchro;
current_synchro_data.Flag_valid_tracking = false;
@ -522,7 +526,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int
d_last_seg = floor(d_sample_counter / d_fs_in);
std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl;
std::cout << "GPS L2C M Tracking CH " << d_channel << ": Satellite "
<< Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"<< std::endl;
<< Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz] "<<"Doppler="<<d_carrier_doppler_hz<<" [Hz]"<< std::endl;
//if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock!
}
}
@ -533,7 +537,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int
d_last_seg = floor(d_sample_counter / d_fs_in);
std::cout << "GPS L2C M Tracking CH " << d_channel << ": Satellite "
<< Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"<<std::endl;
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz] "<<"Doppler="<<d_carrier_doppler_hz<<" [Hz]"<< std::endl;
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
}
}