[hamradio-commits] [gnss-sdr] 36/126: Artemisa tracking is almost working. Code cleaning, refactoring and renaming is in progress!
Carles Fernandez
carles_fernandez-guest at moszumanska.debian.org
Sat Dec 26 18:37:59 UTC 2015
This is an automated email from the git hooks/post-receive script.
carles_fernandez-guest pushed a commit to branch next
in repository gnss-sdr.
commit 27588fa83b17f6c4936571e01f7da188f43c0127
Author: Javier Arribas <javiarribas at gmail.com>
Date: Mon Nov 16 19:23:25 2015 +0100
Artemisa tracking is almost working. Code cleaning, refactoring and renaming is in progress!
---
conf/gnss-sdr_Hybrid_byte_sim.conf | 346 +++++++++++++++++++++
.../gps_l1_ca_dll_fll_pll_tracking_cc.cc | 8 +-
.../gps_l1_ca_dll_pll_artemisa_tracking_cc.cc | 72 +++--
.../gps_l1_ca_dll_pll_artemisa_tracking_cc.h | 6 +-
.../gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 58 ++--
.../tracking/libs/tracking_discriminators.cc | 2 +-
src/core/system_parameters/GPS_L1_CA.h | 1 +
7 files changed, 419 insertions(+), 74 deletions(-)
diff --git a/conf/gnss-sdr_Hybrid_byte_sim.conf b/conf/gnss-sdr_Hybrid_byte_sim.conf
new file mode 100644
index 0000000..6c0c8e3
--- /dev/null
+++ b/conf/gnss-sdr_Hybrid_byte_sim.conf
@@ -0,0 +1,346 @@
+; Default configuration file
+; You can define your own receiver and invoke it by doing
+; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf
+;
+
+[GNSS-SDR]
+
+;######### GLOBAL OPTIONS ##################
+;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz].
+GNSS-SDR.internal_fs_hz=2600000
+
+;######### CONTROL_THREAD CONFIG ############
+ControlThread.wait_for_flowgraph=false
+
+;######### SIGNAL_SOURCE CONFIG ############
+;#implementation: Use [File_Signal_Source] or [UHD_Signal_Source] or [GN3S_Signal_Source] (experimental)
+SignalSource.implementation=File_Signal_Source
+
+;#filename: path to file with the captured GNSS signal samples to be processed
+SignalSource.filename=/home/javier/ClionProjects/gnss-sim/build/signal_out.bin
+
+;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
+SignalSource.item_type=byte
+
+;#sampling_frequency: Original Signal sampling frequency in [Hz]
+SignalSource.sampling_frequency=2600000
+
+;#freq: RF front-end center frequency in [Hz]
+SignalSource.freq=1575420000
+
+;#samples: Number of samples to be processed. Notice that 0 indicates the entire file.
+SignalSource.samples=0
+
+;#repeat: Repeat the processing file. Disable this option in this version
+SignalSource.repeat=false
+
+;#dump: Dump the Signal source data to a file. Disable this option in this version
+SignalSource.dump=false
+
+SignalSource.dump_filename=../data/signal_source.dat
+
+
+;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing.
+; it helps to not overload the CPU, but the processing time will be longer.
+SignalSource.enable_throttle_control=false
+
+
+;######### SIGNAL_CONDITIONER CONFIG ############
+;## It holds blocks to change data type, filter and resample input data.
+
+;#implementation: Use [Pass_Through] or [Signal_Conditioner]
+;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks
+;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks
+SignalConditioner.implementation=Signal_Conditioner
+
+;######### DATA_TYPE_ADAPTER CONFIG ############
+;## Changes the type of input data. Please disable it in this version.
+;#implementation: [Pass_Through] disables this block
+DataTypeAdapter.implementation=Ibyte_To_Complex
+
+;######### INPUT_FILTER CONFIG ############
+;## Filter the input data. Can be combined with frequency translation for IF signals
+
+;#implementation: Use [Pass_Through] or [Fir_Filter] or [Freq_Xlating_Fir_Filter]
+;#[Pass_Through] disables this block
+;#[Fir_Filter] enables a FIR Filter
+;#[Freq_Xlating_Fir_Filter] enables FIR filter and a composite frequency translation that shifts IF down to zero Hz.
+
+;InputFilter.implementation=Fir_Filter
+;InputFilter.implementation=Freq_Xlating_Fir_Filter
+InputFilter.implementation=Pass_Through
+
+;#dump: Dump the filtered data to a file.
+InputFilter.dump=false
+
+;#dump_filename: Log path and filename.
+InputFilter.dump_filename=../data/input_filter.dat
+
+;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation.
+;#These options are based on parameters of gnuradio's function: gr_remez.
+;#These function calculates the optimal (in the Chebyshev/minimax sense) FIR filter inpulse reponse given a set of band edges, the desired reponse on those bands, and the weight given to the error in those bands.
+
+;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version.
+InputFilter.input_item_type=gr_complex
+
+;#outut_item_type: Type and resolution for output filtered signal samples. Use only gr_complex in this version.
+InputFilter.output_item_type=gr_complex
+
+;#taps_item_type: Type and resolution for the taps of the filter. Use only float in this version.
+InputFilter.taps_item_type=float
+
+;#number_of_taps: Number of taps in the filter. Increasing this parameter increases the processing time
+InputFilter.number_of_taps=5
+
+;#number_of _bands: Number of frequency bands in the filter.
+InputFilter.number_of_bands=2
+
+;#bands: frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...].
+;#Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2)
+;#The number of band_begin and band_end elements must match the number of bands
+
+InputFilter.band1_begin=0.0
+InputFilter.band1_end=0.45
+InputFilter.band2_begin=0.55
+InputFilter.band2_end=1.0
+
+;#ampl: desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...].
+;#The number of ampl_begin and ampl_end elements must match the number of bands
+
+InputFilter.ampl1_begin=1.0
+InputFilter.ampl1_end=1.0
+InputFilter.ampl2_begin=0.0
+InputFilter.ampl2_end=0.0
+
+;#band_error: weighting applied to each band (usually 1).
+;#The number of band_error elements must match the number of bands
+InputFilter.band1_error=1.0
+InputFilter.band2_error=1.0
+
+;#filter_type: one of "bandpass", "hilbert" or "differentiator"
+InputFilter.filter_type=bandpass
+
+;#grid_density: determines how accurately the filter will be constructed.
+;The minimum value is 16; higher values are slower to compute the filter.
+InputFilter.grid_density=16
+
+;#The following options are used only in Freq_Xlating_Fir_Filter implementation.
+;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz
+
+InputFilter.sampling_frequency=2600000
+InputFilter.IF=0
+
+
+
+;######### RESAMPLER CONFIG ############
+;## Resamples the input data.
+
+;#implementation: Use [Pass_Through] or [Direct_Resampler]
+;#[Pass_Through] disables this block
+;#[Direct_Resampler] enables a resampler that implements a nearest neigbourhood interpolation
+;Resampler.implementation=Direct_Resampler
+Resampler.implementation=Pass_Through
+
+;#dump: Dump the resamplered data to a file.
+Resampler.dump=false
+;#dump_filename: Log path and filename.
+Resampler.dump_filename=../data/resampler.dat
+
+;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
+Resampler.item_type=gr_complex
+
+;#sample_freq_in: the sample frequency of the input signal
+Resampler.sample_freq_in=2600000
+
+;#sample_freq_out: the desired sample frequency of the output signal
+Resampler.sample_freq_out=2600000
+
+
+;######### CHANNELS GLOBAL CONFIG ############
+;#count: Number of available GPS satellite channels.
+Channels_1C.count=8
+;#count: Number of available Galileo satellite channels.
+Channels_1B.count=0
+;#in_acquisition: Number of channels simultaneously acquiring for the whole receiver
+Channels.in_acquisition=1
+
+;#signal:
+;#if the option is disabled by default is assigned "1C" GPS L1 C/A
+Channel1.signal=1C
+Channel2.signal=1C
+Channel3.signal=1C
+Channel4.signal=1C
+Channel5.signal=1C
+Channel6.signal=1C
+Channel7.signal=1C
+Channel8.signal=1B
+Channel9.signal=1B
+Channel10.signal=1B
+Channel11.signal=1B
+Channel12.signal=1B
+Channel13.signal=1B
+Channel14.signal=1B
+Channel15.signal=1B
+
+
+;######### GPS ACQUISITION CONFIG ############
+
+;#dump: Enable or disable the acquisition internal data file logging [true] or [false]
+Acquisition_1C.dump=false
+;#filename: Log path and filename
+Acquisition_1C.dump_filename=./acq_dump.dat
+;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
+Acquisition_1C.item_type=gr_complex
+;#if: Signal intermediate frequency in [Hz]
+Acquisition_1C.if=0
+;#sampled_ms: Signal block duration for the acquisition signal detection [ms]
+Acquisition_1C.sampled_ms=1
+;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition]
+Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition
+;#threshold: Acquisition threshold
+Acquisition_1C.threshold=0.035
+;#pfa: Acquisition false alarm probability. This option overrides the threshold option. Only use with implementations: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition]
+;Acquisition_1C.pfa=0.01
+;#doppler_max: Maximum expected Doppler shift [Hz]
+Acquisition_1C.doppler_max=6000
+;#doppler_max: Doppler step in the grid search [Hz]
+Acquisition_1C.doppler_step=100
+
+
+;######### GALILEO ACQUISITION CONFIG ############
+
+;#dump: Enable or disable the acquisition internal data file logging [true] or [false]
+Acquisition_1B.dump=false
+;#filename: Log path and filename
+Acquisition_1B.dump_filename=./acq_dump.dat
+;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version.
+Acquisition_1B.item_type=gr_complex
+;#if: Signal intermediate frequency in [Hz]
+Acquisition_1B.if=0
+;#sampled_ms: Signal block duration for the acquisition signal detection [ms]
+Acquisition_1B.sampled_ms=4
+;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition]
+Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition
+;#threshold: Acquisition threshold
+;Acquisition_1B.threshold=0
+;#pfa: Acquisition false alarm probability. This option overrides the threshold option. Only use with implementations: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition]
+Acquisition_1B.pfa=0.0000008
+;#doppler_max: Maximum expected Doppler shift [Hz]
+Acquisition_1B.doppler_max=15000
+;#doppler_max: Doppler step in the grid search [Hz]
+Acquisition_1B.doppler_step=125
+
+;######### TRACKING GPS CONFIG ############
+
+;#implementation: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking] or [GPS_L1_CA_DLL_FLL_PLL_Tracking] or [GPS_L1_CA_TCP_CONNECTOR_Tracking] or [Galileo_E1_DLL_PLL_VEML_Tracking]
+Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Artemisa_Tracking
+;#item_type: Type and resolution for each of the signal samples. Use only [gr_complex] in this version.
+Tracking_1C.item_type=gr_complex
+
+;#sampling_frequency: Signal Intermediate Frequency in [Hz]
+Tracking_1C.if=0
+
+;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false]
+Tracking_1C.dump=true
+
+;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number.
+Tracking_1C.dump_filename=../data/epl_tracking_ch_
+
+;#pll_bw_hz: PLL loop filter bandwidth [Hz]
+Tracking_1C.pll_bw_hz=45.0;
+
+;#dll_bw_hz: DLL loop filter bandwidth [Hz]
+Tracking_1C.dll_bw_hz=2.0;
+
+;#fll_bw_hz: FLL loop filter bandwidth [Hz]
+Tracking_1C.fll_bw_hz=10.0;
+
+;#order: PLL/DLL loop filter order [2] or [3]
+Tracking_1C.order=3;
+
+;######### TRACKING GALILEO CONFIG ############
+
+;#implementation: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking] or [GPS_L1_CA_DLL_FLL_PLL_Tracking] or [GPS_L1_CA_TCP_CONNECTOR_Tracking] or [Galileo_E1_DLL_PLL_VEML_Tracking]
+Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking
+;#item_type: Type and resolution for each of the signal samples. Use only [gr_complex] in this version.
+Tracking_1B.item_type=gr_complex
+
+;#sampling_frequency: Signal Intermediate Frequency in [Hz]
+Tracking_1B.if=0
+
+;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false]
+Tracking_1B.dump=false
+
+;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number.
+Tracking_1B.dump_filename=../data/veml_tracking_ch_
+
+;#pll_bw_hz: PLL loop filter bandwidth [Hz]
+Tracking_1B.pll_bw_hz=15.0;
+
+;#dll_bw_hz: DLL loop filter bandwidth [Hz]
+Tracking_1B.dll_bw_hz=2.0;
+
+;#fll_bw_hz: FLL loop filter bandwidth [Hz]
+Tracking_1B.fll_bw_hz=10.0;
+
+;#order: PLL/DLL loop filter order [2] or [3]
+Tracking_1B.order=3;
+
+;#early_late_space_chips: correlator early-late space [chips]. Use [0.5] for GPS and [0.15] for Galileo
+Tracking_1B.early_late_space_chips=0.15;
+
+;#very_early_late_space_chips: only for [Galileo_E1_DLL_PLL_VEML_Tracking], correlator very early-late space [chips]. Use [0.6]
+Tracking_1B.very_early_late_space_chips=0.6;
+
+
+;######### TELEMETRY DECODER GPS CONFIG ############
+;#implementation: Use [GPS_L1_CA_Telemetry_Decoder] for GPS L1 C/A
+TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder
+TelemetryDecoder_1C.dump=false
+;#decimation factor
+TelemetryDecoder_1C.decimation_factor=1;
+
+;######### TELEMETRY DECODER GALILEO CONFIG ############
+;#implementation: Use [Galileo_E1B_Telemetry_Decoder] for Galileo E1B
+TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder
+TelemetryDecoder_1B.dump=false
+TelemetryDecoder_1B.decimation_factor=1;
+
+;######### OBSERVABLES CONFIG ############
+;#implementation: Use [GPS_L1_CA_Observables] for GPS L1 C/A.
+Observables.implementation=GPS_L1_CA_Observables
+
+;#dump: Enable or disable the Observables internal binary data file logging [true] or [false]
+Observables.dump=true
+
+;#dump_filename: Log path and filename.
+Observables.dump_filename=./observables.dat
+
+
+;######### PVT CONFIG ############
+;#implementation: Position Velocity and Time (PVT) implementation algorithm: Use [GPS_L1_CA_PVT] in this version.
+PVT.implementation=GPS_L1_CA_PVT
+
+;#averaging_depth: Number of PVT observations in the moving average algorithm
+PVT.averaging_depth=10
+
+;#flag_average: Enables the PVT averaging between output intervals (arithmetic mean) [true] or [false]
+PVT.flag_averaging=false
+
+;#output_rate_ms: Period between two PVT outputs. Notice that the minimum period is equal to the tracking integration time (for GPS CA L1 is 1ms) [ms]
+PVT.output_rate_ms=100;
+
+;#display_rate_ms: Position console print (std::out) interval [ms]. Notice that output_rate_ms<=display_rate_ms.
+PVT.display_rate_ms=500;
+
+;#dump: Enable or disable the PVT internal binary data file logging [true] or [false]
+PVT.dump=false
+
+;#dump_filename: Log path and filename without extension. Notice that PVT will add ".dat" to the binary dump and ".kml" to GoogleEarth dump.
+PVT.dump_filename=./PVT
+
+;######### OUTPUT_FILTER CONFIG ############
+;# Receiver output filter: Leave this block disabled in this version
+OutputFilter.implementation=Null_Sink_Output_Filter
+OutputFilter.filename=data/gnss-sdr.dat
+OutputFilter.item_type=gr_complex
diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc
index fec174e..c562425 100644
--- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc
+++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc
@@ -454,7 +454,7 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
/*
* 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);
+ carr_nco_hz = d_carrier_loop_filter.get_carrier_error(0.0, PLL_discriminator_hz, GPS_L1_CA_CODE_PERIOD);
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);
@@ -528,11 +528,13 @@ int Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::general_work (int noutput_items, gr_vecto
double T_prn_samples;
double K_blk_samples;
T_chip_seconds = 1 / static_cast<double>(d_code_freq_hz);
- T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
+ T_chip_seconds=GPS_L1_CA_CHIP_PERIOD;
+ //T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
+ T_prn_seconds = GPS_L1_CA_CODE_PERIOD;
T_prn_samples = T_prn_seconds * d_fs_in;
float code_error_filt_samples;
- code_error_filt_samples = T_prn_seconds * code_error_filt_chips * T_chip_seconds * static_cast<double>(d_fs_in); //[seconds]
+ code_error_filt_samples = GPS_L1_CA_CODE_PERIOD * code_error_filt_chips * GPS_L1_CA_CHIP_PERIOD * static_cast<double>(d_fs_in); //[seconds]
d_acc_code_phase_samples = d_acc_code_phase_samples + code_error_filt_samples;
K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_samples;
diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.cc
index 3c3ca1f..292747c 100644
--- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.cc
+++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.cc
@@ -105,7 +105,7 @@ gps_l1_ca_dll_pll_artemisa_tracking_cc::gps_l1_ca_dll_pll_artemisa_tracking_cc(
// Initialize tracking ==========================================
d_code_loop_filter.set_DLL_BW(dll_bw_hz);
- d_carrier_loop_filter.set_PLL_BW(pll_bw_hz);
+ d_carrier_loop_filter.set_params(10.0, pll_bw_hz,2);
//--- DLL variables --------------------------------------------------------
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
@@ -169,7 +169,8 @@ gps_l1_ca_dll_pll_artemisa_tracking_cc::gps_l1_ca_dll_pll_artemisa_tracking_cc(
d_carrier_doppler_hz = 0.0;
d_acc_carrier_phase_rad = 0.0;
d_code_phase_samples = 0.0;
- d_acc_code_phase_secs = 0.0;
+
+ d_pll_to_dll_assist_secs_ti=0.0;
//set_min_output_buffer((long int)300);
}
@@ -219,7 +220,7 @@ void gps_l1_ca_dll_pll_artemisa_tracking_cc::start_tracking()
d_carrier_doppler_hz = d_acq_carrier_doppler_hz;
// DLL/PLL filter initialization
- d_carrier_loop_filter.initialize(); // initialize the carrier filter
+ d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz);
d_code_loop_filter.initialize(); // initialize the code filter
// generate local reference ALWAYS starting at chip 1 (1 sample per chip)
@@ -231,7 +232,6 @@ void gps_l1_ca_dll_pll_artemisa_tracking_cc::start_tracking()
d_rem_code_phase_samples = 0;
d_rem_carr_phase_rad = 0;
d_acc_carrier_phase_rad = 0;
- d_acc_code_phase_secs = 0;
d_code_phase_samples = d_acq_code_phase_samples;
@@ -247,6 +247,8 @@ void gps_l1_ca_dll_pll_artemisa_tracking_cc::start_tracking()
d_pull_in = true;
d_enable_tracking = true;
+ d_pll_to_dll_assist_secs_ti=0.0;
+
LOG(INFO) << "PULL-IN Doppler [Hz]=" << d_carrier_doppler_hz
<< " Code Phase correction [samples]=" << delay_correction_samples
<< " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples;
@@ -317,8 +319,6 @@ void gps_l1_ca_dll_pll_artemisa_tracking_cc::update_local_carrier()
d_carr_sign[i] = std::complex<float>(cos_f, -sin_f);
phase_rad_i += phase_step_rad_i;
}
- //d_rem_carr_phase_rad = fmod(phase_rad, GPS_TWO_PI);
- //d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + d_rem_carr_phase_rad;
}
@@ -343,12 +343,6 @@ gps_l1_ca_dll_pll_artemisa_tracking_cc::~gps_l1_ca_dll_pll_artemisa_tracking_cc(
int gps_l1_ca_dll_pll_artemisa_tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items,
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;
-
// Block input data and block output stream pointers
const gr_complex* in = (gr_complex*) input_items[0]; //PRN start block alignment
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
@@ -356,6 +350,18 @@ int gps_l1_ca_dll_pll_artemisa_tracking_cc::general_work (int noutput_items, gr_
// GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder
Gnss_Synchro current_synchro_data = Gnss_Synchro();
+ // process vars
+ float code_error_chips=0.0;
+ float code_error_secs=0.0;
+ float code_error_filt_chips=0.0;
+ float code_error_filt_secs=0.0;
+ float INTEGRATION_TIME=0.0;
+ INTEGRATION_TIME=GPS_L1_CA_CODE_PERIOD; // [Ti]
+ float dll_delta_rho=0.0;
+ float carr_phase_error_secs_ti=0.0;
+ float carr_phase_error_filt_secs_ti=0.0;
+ float pll_to_dll_assist_secs_ti=0.0;
+
if (d_enable_tracking == true)
{
// Receiver signal alignment
@@ -394,34 +400,35 @@ int gps_l1_ca_dll_pll_artemisa_tracking_cc::general_work (int noutput_items, gr_
d_Prompt,
d_Late);
-
-
// ################## DLL ##########################################################
// DLL discriminator
code_error_chips = dll_nc_e_minus_l_normalized(*d_Early, *d_Late); //[chips/Ti]
+ code_error_secs = code_error_chips*GPS_L1_CA_CHIP_PERIOD;
// Code discriminator filter
code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second]
- //Code phase accumulator
- float code_error_filt_secs;
- code_error_filt_secs = (GPS_L1_CA_CODE_PERIOD * code_error_filt_chips) / GPS_L1_CA_CODE_RATE_HZ; //[seconds]
- d_acc_code_phase_secs = d_acc_code_phase_secs + code_error_filt_secs;
+ code_error_filt_secs = code_error_filt_chips*GPS_L1_CA_CHIP_PERIOD*GPS_L1_CA_CODE_PERIOD;
+ // DLL code error estimation [s/Ti]
+ dll_delta_rho=-code_error_filt_secs+d_pll_to_dll_assist_secs_ti;
// ################## PLL ##########################################################
- // PLL discriminator
- carr_error_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / static_cast<float>(GPS_TWO_PI);
+ // PLL discriminator [rads/Ti -> Secs/Ti]
+ carr_phase_error_secs_ti = pll_cloop_two_quadrant_atan(*d_Prompt)/GPS_TWO_PI;
// Carrier discriminator filter
- carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz);
+ //d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_phase_error_filt_secs_ti/INTEGRATION_TIME;
+ d_carrier_doppler_hz = d_carrier_loop_filter.get_carrier_error(0.0, carr_phase_error_secs_ti, INTEGRATION_TIME);
+ // PLL to DLL assistance [Secs/Ti]
+ pll_to_dll_assist_secs_ti = d_carrier_doppler_hz*GPS_L1_CA_CODE_PERIOD;
+ d_pll_to_dll_assist_secs_ti = pll_to_dll_assist_secs_ti/GPS_L1_FREQ_HZ;
// New carrier Doppler frequency estimation
- d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_error_filt_hz;
+ //PLL COMMAND
+ d_rem_carr_phase_rad = d_rem_carr_phase_rad + GPS_TWO_PI * d_carrier_doppler_hz * GPS_L1_CA_CODE_PERIOD;//GPS_TWO_PI*carr_phase_error_filt_secs_ti;
// New code Doppler frequency estimation
- d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ);
+ d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ;// + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ);
//carrier phase accumulator for (K) doppler estimation
- d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + GPS_TWO_PI * d_carrier_doppler_hz * GPS_L1_CA_CODE_PERIOD;
- //remanent carrier phase to prevent overflow in the code NCO
- d_rem_carr_phase_rad = d_rem_carr_phase_rad + GPS_TWO_PI * d_carrier_doppler_hz * GPS_L1_CA_CODE_PERIOD;
- d_rem_carr_phase_rad = fmod(d_rem_carr_phase_rad, GPS_TWO_PI);
+ d_acc_carrier_phase_rad += GPS_TWO_PI*d_carrier_doppler_hz*INTEGRATION_TIME;
// ################## CARRIER AND CODE NCO BUFFER ALIGNEMENT #######################
+ //DLL COMMAND
// keep alignment parameters for the next input buffer
double T_chip_seconds;
double T_prn_seconds;
@@ -431,11 +438,10 @@ int gps_l1_ca_dll_pll_artemisa_tracking_cc::general_work (int noutput_items, gr_
T_chip_seconds = 1 / static_cast<double>(d_code_freq_chips);
T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS;
T_prn_samples = T_prn_seconds * static_cast<double>(d_fs_in);
- K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast<double>(d_fs_in);
+ K_blk_samples = T_prn_samples + d_rem_code_phase_samples - static_cast<double>(dll_delta_rho) * static_cast<double>(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 - static_cast<double>(d_current_prn_length_samples); //rounding error < 1 sample
// ####### CN0 ESTIMATION AND LOCK DETECTORS ######
if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES)
@@ -481,8 +487,6 @@ int gps_l1_ca_dll_pll_artemisa_tracking_cc::general_work (int noutput_items, gr_
// Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!, but some glitches??)
current_synchro_data.Tracking_timestamp_secs = (static_cast<double>(d_sample_counter) + static_cast<double>(d_rem_code_phase_samples)) / static_cast<double>(d_fs_in);
- //compute remnant code phase samples AFTER the Tracking timestamp
- d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample
// This tracking block aligns the Tracking_timestamp_secs with the start sample of the PRN, thus, Code_phase_secs=0
current_synchro_data.Code_phase_secs = 0;
@@ -580,8 +584,8 @@ int gps_l1_ca_dll_pll_artemisa_tracking_cc::general_work (int noutput_items, gr_
d_dump_file.write(reinterpret_cast<char*>(&tmp_float), sizeof(float));
//PLL commands
- d_dump_file.write(reinterpret_cast<char*>(&carr_error_hz), sizeof(float));
- d_dump_file.write(reinterpret_cast<char*>(&carr_error_filt_hz), sizeof(float));
+ d_dump_file.write(reinterpret_cast<char*>(&carr_phase_error_secs_ti), sizeof(float));
+ d_dump_file.write(reinterpret_cast<char*>(&carr_phase_error_filt_secs_ti), sizeof(float));
//DLL commands
d_dump_file.write(reinterpret_cast<char*>(&code_error_chips), sizeof(float));
diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.h
index d584733..b3ddf80 100644
--- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.h
+++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_artemisa_tracking_cc.h
@@ -49,7 +49,7 @@
#include "gps_sdr_signal_processing.h"
#include "gnss_synchro.h"
#include "tracking_2nd_DLL_filter.h"
-#include "tracking_2nd_PLL_filter.h"
+#include "tracking_FLL_PLL_filter.h"
#include "correlator.h"
class gps_l1_ca_dll_pll_artemisa_tracking_cc;
@@ -143,7 +143,7 @@ private:
// PLL and DLL filter library
Tracking_2nd_DLL_filter d_code_loop_filter;
- Tracking_2nd_PLL_filter d_carrier_loop_filter;
+ Tracking_FLL_PLL_filter d_carrier_loop_filter;
// acquisition
float d_acq_code_phase_samples;
@@ -156,7 +156,7 @@ private:
float d_carrier_doppler_hz;
float d_acc_carrier_phase_rad;
float d_code_phase_samples;
- float d_acc_code_phase_secs;
+ float d_pll_to_dll_assist_secs_ti;
//PRN period in samples
int d_current_prn_length_samples;
diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc
index d16a0c6..9d0a563 100644
--- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc
+++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc
@@ -116,41 +116,32 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
//--- DLL variables --------------------------------------------------------
d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips)
- // Initialization of local code replica
- // Get space for a vector with the C/A code replica sampled 1x/chip
- //d_ca_code = static_cast<gr_complex*>(volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment()));
- d_ca_code = static_cast<gr_complex*>(volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_get_alignment()));
-
- multicorrelator_gpu = new cuda_multicorrelator();
- int N_CORRELATORS=3;
- //local code resampler on CPU (old)
- //multicorrelator_gpu->init_cuda(0, NULL, 2 * d_vector_length , 2 * d_vector_length , N_CORRELATORS);
-
- //local code resampler on GPU (new)
- multicorrelator_gpu->init_cuda_integrated_resampler(0, NULL, 2 * d_vector_length , GPS_L1_CA_CODE_LENGTH_CHIPS , N_CORRELATORS);
-
- // Get space for the resampled early / prompt / late local replicas
- cudaHostAlloc((void**)&d_local_code_shift_chips, N_CORRELATORS * sizeof(float), cudaHostAllocMapped );
-
-
+ // Set GPU flags
+ cudaSetDeviceFlags(cudaDeviceMapHost);
//allocate host memory
//pinned memory mode - use special function to get OS-pinned memory
- cudaHostAlloc((void**)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped );
-
- //old local codes vector
- // (cudaHostAlloc((void**)&d_local_codes_gpu, (V_LEN * sizeof(gr_complex))*N_CORRELATORS, cudaHostAllocWriteCombined ));
-
- //new integrated shifts
- // (cudaHostAlloc((void**)&d_local_codes_gpu, (2 * d_vector_length * sizeof(gr_complex)), cudaHostAllocWriteCombined ));
-
+ int N_CORRELATORS=3;
+ // Get space for a vector with the C/A code replica sampled 1x/chip
+ cudaHostAlloc((void**)&d_ca_code, (GPS_L1_CA_CODE_LENGTH_CHIPS* sizeof(gr_complex)), cudaHostAllocMapped || cudaHostAllocWriteCombined);
+ // Get space for the resampled early / prompt / late local replicas
+ cudaHostAlloc((void**)&d_local_code_shift_chips, N_CORRELATORS * sizeof(float), cudaHostAllocMapped || cudaHostAllocWriteCombined);
+ cudaHostAlloc((void**)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped || cudaHostAllocWriteCombined);
// correlator outputs (scalar)
- cudaHostAlloc((void**)&d_corr_outs_gpu ,sizeof(gr_complex)*N_CORRELATORS, cudaHostAllocWriteCombined );
+ cudaHostAlloc((void**)&d_corr_outs_gpu ,sizeof(gr_complex)*N_CORRELATORS, cudaHostAllocMapped || cudaHostAllocWriteCombined );
+
//map to EPL pointers
d_Early = &d_corr_outs_gpu[0];
d_Prompt = &d_corr_outs_gpu[1];
d_Late = &d_corr_outs_gpu[2];
//--- Perform initializations ------------------------------
+ multicorrelator_gpu = new cuda_multicorrelator();
+ //local code resampler on GPU
+ multicorrelator_gpu->init_cuda_integrated_resampler(2 * d_vector_length,GPS_L1_CA_CODE_LENGTH_CHIPS,3);
+ multicorrelator_gpu->set_input_output_vectors(
+ d_corr_outs_gpu,
+ in_gpu
+ );
// define initial code frequency basis of NCO
d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ;
// define residual code phase (in chips)
@@ -251,7 +242,12 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::start_tracking()
d_local_code_shift_chips[1]=0.0;
d_local_code_shift_chips[2]=d_early_late_spc_chips;
- multicorrelator_gpu->set_local_code_and_taps(GPS_L1_CA_CODE_LENGTH_CHIPS,d_ca_code, d_local_code_shift_chips,3);
+ multicorrelator_gpu->set_local_code_and_taps(
+ GPS_L1_CA_CODE_LENGTH_CHIPS,
+ d_ca_code,
+ d_local_code_shift_chips,
+ 3
+ );
d_carrier_lock_fail_counter = 0;
d_rem_code_phase_samples = 0;
@@ -284,15 +280,12 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::~Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc()
d_dump_file.close();
cudaFreeHost(in_gpu);
- cudaFreeHost(d_carr_sign_gpu);
cudaFreeHost(d_corr_outs_gpu);
cudaFreeHost(d_local_code_shift_chips);
+ cudaFreeHost(d_ca_code);
multicorrelator_gpu->free_cuda();
delete(multicorrelator_gpu);
-
- volk_free(d_ca_code);
-
delete[] d_Prompt_buffer;
}
@@ -342,10 +335,9 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items, gr_vecto
float code_phase_step_chips = static_cast<float>(d_code_freq_chips) / static_cast<float>(d_fs_in);
float rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / d_fs_in);
+ memcpy(in_gpu,in,sizeof(gr_complex)*d_current_prn_length_samples);
cudaProfilerStart();
multicorrelator_gpu->Carrier_wipeoff_multicorrelator_resampler_cuda(
- d_corr_outs_gpu,
- in,
d_rem_carr_phase_rad,
phase_step_rad,
code_phase_step_chips,
diff --git a/src/algorithms/tracking/libs/tracking_discriminators.cc b/src/algorithms/tracking/libs/tracking_discriminators.cc
index 119f40a..e82df1b 100644
--- a/src/algorithms/tracking/libs/tracking_discriminators.cc
+++ b/src/algorithms/tracking/libs/tracking_discriminators.cc
@@ -101,7 +101,7 @@ float dll_nc_e_minus_l_normalized(gr_complex early_s1, gr_complex late_s1)
float P_early, P_late;
P_early = std::abs(early_s1);
P_late = std::abs(late_s1);
- return (P_early - P_late) / ((P_early + P_late));
+ return 0.5*(P_early - P_late) / ((P_early + P_late));
}
/*
diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h
index dea0cbb..0008000 100644
--- a/src/core/system_parameters/GPS_L1_CA.h
+++ b/src/core/system_parameters/GPS_L1_CA.h
@@ -53,6 +53,7 @@ const double GPS_L1_FREQ_HZ = 1.57542e9; //!< L1 [Hz]
const double GPS_L1_CA_CODE_RATE_HZ = 1.023e6; //!< GPS L1 C/A code rate [chips/s]
const double GPS_L1_CA_CODE_LENGTH_CHIPS = 1023.0; //!< GPS L1 C/A code length [chips]
const double GPS_L1_CA_CODE_PERIOD = 0.001; //!< GPS L1 C/A code period [seconds]
+const double GPS_L1_CA_CHIP_PERIOD = 1.0e-6; //!< GPS L1 C/A chip period [seconds]
/*!
* \brief Maximum Time-Of-Arrival (TOA) difference between satellites for a receiver operated on Earth surface is 20 ms
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/gnss-sdr.git
More information about the pkg-hamradio-commits
mailing list