diff --git a/README.md b/README.md index dc419957d..6381ed9ca 100644 --- a/README.md +++ b/README.md @@ -1180,19 +1180,6 @@ $ gnss-sdr --RTCM_Port=12345 --RTCM_Ref_Station_ID=10 In order to get well-formatted GeoJSON, KML and RINEX files, always terminate ```gnss-sdr``` execution by pressing key ```q``` and then key ```ENTER```. Those files will be automatically deleted if no position fix have been obtained during the execution of the software receiver. -#### Output filter - -Implements a sink for the signal stream. - -~~~~~~ -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.filename=data/gnss-sdr.dat -OutputFilter.item_type=gr_complex -~~~~~~ - - - About the software license ========================== diff --git a/conf/gnss-sdr.conf b/conf/gnss-sdr.conf index abd8a47be..e959a0319 100644 --- a/conf/gnss-sdr.conf +++ b/conf/gnss-sdr.conf @@ -313,8 +313,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_GPS_L1_GN3S_realtime.conf b/conf/gnss-sdr_GPS_L1_GN3S_realtime.conf index b5f2c8c3b..27004e825 100644 --- a/conf/gnss-sdr_GPS_L1_GN3S_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_GN3S_realtime.conf @@ -113,6 +113,3 @@ PVT.flag_rtcm_server=false PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_GPS_L1_SPIR.conf b/conf/gnss-sdr_GPS_L1_SPIR.conf index 9881e4d88..9229290e1 100644 --- a/conf/gnss-sdr_GPS_L1_SPIR.conf +++ b/conf/gnss-sdr_GPS_L1_SPIR.conf @@ -316,8 +316,3 @@ PVT.nmea_dump_devname=/dev/pts/4 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf b/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf index 17d1ad4a4..04a3c38fc 100644 --- a/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf @@ -382,8 +382,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_GPS_L1_USRP_X300_realtime_new.conf b/conf/gnss-sdr_GPS_L1_USRP_X300_realtime_new.conf index da410de20..88efbae58 100644 --- a/conf/gnss-sdr_GPS_L1_USRP_X300_realtime_new.conf +++ b/conf/gnss-sdr_GPS_L1_USRP_X300_realtime_new.conf @@ -398,8 +398,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_GPS_L1_USRP_realtime.conf b/conf/gnss-sdr_GPS_L1_USRP_realtime.conf index 7f0ce9063..38adb7669 100644 --- a/conf/gnss-sdr_GPS_L1_USRP_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_USRP_realtime.conf @@ -383,8 +383,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_GPS_L1_acq_QuickSync.conf b/conf/gnss-sdr_GPS_L1_acq_QuickSync.conf index c0d58615d..7ef0bab5d 100644 --- a/conf/gnss-sdr_GPS_L1_acq_QuickSync.conf +++ b/conf/gnss-sdr_GPS_L1_acq_QuickSync.conf @@ -300,8 +300,3 @@ PVT.flag_rtcm_server=false PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 -;######### 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/conf/gnss-sdr_GPS_L1_gr_complex.conf b/conf/gnss-sdr_GPS_L1_gr_complex.conf index ed637880e..235a80943 100644 --- a/conf/gnss-sdr_GPS_L1_gr_complex.conf +++ b/conf/gnss-sdr_GPS_L1_gr_complex.conf @@ -82,6 +82,3 @@ PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 PVT.dump=false -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_GPS_L1_gr_complex_gpu.conf b/conf/gnss-sdr_GPS_L1_gr_complex_gpu.conf index 0b1f83156..48a00fbcd 100644 --- a/conf/gnss-sdr_GPS_L1_gr_complex_gpu.conf +++ b/conf/gnss-sdr_GPS_L1_gr_complex_gpu.conf @@ -295,8 +295,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_GPS_L1_ishort.conf b/conf/gnss-sdr_GPS_L1_ishort.conf index bbea10058..06c5d4991 100644 --- a/conf/gnss-sdr_GPS_L1_ishort.conf +++ b/conf/gnss-sdr_GPS_L1_ishort.conf @@ -82,6 +82,3 @@ PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 PVT.dump=false -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_GPS_L1_nsr.conf b/conf/gnss-sdr_GPS_L1_nsr.conf index ef1457f73..64e08a61c 100644 --- a/conf/gnss-sdr_GPS_L1_nsr.conf +++ b/conf/gnss-sdr_GPS_L1_nsr.conf @@ -135,6 +135,3 @@ PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 PVT.dump=true -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf b/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf index c3087fecd..365a5a8d8 100644 --- a/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf +++ b/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf @@ -150,6 +150,3 @@ PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 PVT.dump=true -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf b/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf index 1e3d3b3c3..1c3b4e901 100644 --- a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf @@ -293,9 +293,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=true - -;######### 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/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf b/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf index 181ec894d..72fa2cccf 100644 --- a/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf @@ -146,7 +146,3 @@ PVT.flag_rtcm_server=false PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 -;######### OUTPUT_FILTER CONFIG ############ -;# Receiver output filter: Leave this block disabled in this version -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_GPS_L1_two_bits_cpx.conf b/conf/gnss-sdr_GPS_L1_two_bits_cpx.conf index 8a638f560..fc3b6a1c6 100644 --- a/conf/gnss-sdr_GPS_L1_two_bits_cpx.conf +++ b/conf/gnss-sdr_GPS_L1_two_bits_cpx.conf @@ -134,6 +134,3 @@ PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 PVT.dump=false -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf b/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf index a312d3cfa..9c15c8b09 100644 --- a/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf +++ b/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf @@ -204,8 +204,3 @@ PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 PVT.dump=false -;######### 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/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf b/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf index ff0f0bdf5..1ff5a370e 100644 --- a/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf +++ b/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf @@ -161,8 +161,3 @@ PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 PVT.dump=false -;######### 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/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf b/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf index 055962e31..e868ca8c2 100644 --- a/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf +++ b/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf @@ -84,6 +84,3 @@ PVT.flag_rtcm_server=true PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_Galileo_E1_acq_QuickSync.conf b/conf/gnss-sdr_Galileo_E1_acq_QuickSync.conf index 9774d7de5..290e4b58c 100644 --- a/conf/gnss-sdr_Galileo_E1_acq_QuickSync.conf +++ b/conf/gnss-sdr_Galileo_E1_acq_QuickSync.conf @@ -299,8 +299,3 @@ PVT.flag_rtcm_tty_port=false; ;#rtcm_dump_devname: serial device descriptor for RTCM logging PVT.rtcm_dump_devname=/dev/pts/1 -;######### 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/conf/gnss-sdr_Galileo_E1_nsr.conf b/conf/gnss-sdr_Galileo_E1_nsr.conf index 73a7bb1ef..20f314d17 100644 --- a/conf/gnss-sdr_Galileo_E1_nsr.conf +++ b/conf/gnss-sdr_Galileo_E1_nsr.conf @@ -129,6 +129,3 @@ PVT.flag_rtcm_server=false PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 -;######### OUTPUT_FILTER CONFIG ############ -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_Galileo_E1_short.conf b/conf/gnss-sdr_Galileo_E1_short.conf index 62919ace1..4b9d58469 100644 --- a/conf/gnss-sdr_Galileo_E1_short.conf +++ b/conf/gnss-sdr_Galileo_E1_short.conf @@ -294,8 +294,3 @@ PVT.flag_rtcm_tty_port=false; ;#rtcm_dump_devname: serial device descriptor for RTCM logging PVT.rtcm_dump_devname=/dev/pts/1 -;######### 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/conf/gnss-sdr_Galileo_E5a.conf b/conf/gnss-sdr_Galileo_E5a.conf index 6fb907813..65c6bdd42 100644 --- a/conf/gnss-sdr_Galileo_E5a.conf +++ b/conf/gnss-sdr_Galileo_E5a.conf @@ -344,8 +344,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf b/conf/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf index 89be9e4f8..3978e72d5 100644 --- a/conf/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf +++ b/conf/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf @@ -26,7 +26,7 @@ ControlThread.wait_for_flowgraph=false ;######### SIGNAL_SOURCE CONFIG ############ SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/captures/Galileo_E5ab_IFEN_CTTC_run1.dat +SignalSource.filename=/media/javier/SISTEMA/signals/captura Generador IFEN CTTC Gal E5ab/Galileo_E5ab_IFEN_CTTC_run1.dat SignalSource.item_type=gr_complex SignalSource.sampling_frequency=50000000 SignalSource.freq=1176450000 @@ -76,7 +76,7 @@ Resampler.dump_filename=../data/resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ -Channels_5X.count=4 +Channels_5X.count=1 Channels.in_acquisition=1 Channel.signal=5X @@ -154,7 +154,3 @@ PVT.flag_rtcm_server=true PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 -;######### OUTPUT_FILTER CONFIG ############ -;# Receiver output filter: Leave this block disabled in this version -OutputFilter.implementation=Null_Sink_Output_Filter -OutputFilter.item_type=gr_complex diff --git a/conf/gnss-sdr_Hybrid_byte.conf b/conf/gnss-sdr_Hybrid_byte.conf index 3f3e7931b..729c2cb52 100644 --- a/conf/gnss-sdr_Hybrid_byte.conf +++ b/conf/gnss-sdr_Hybrid_byte.conf @@ -343,8 +343,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#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/conf/gnss-sdr_Hybrid_byte_sim.conf b/conf/gnss-sdr_Hybrid_byte_sim.conf index ce26c3629..7208a89d9 100644 --- a/conf/gnss-sdr_Hybrid_byte_sim.conf +++ b/conf/gnss-sdr_Hybrid_byte_sim.conf @@ -353,8 +353,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#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/conf/gnss-sdr_Hybrid_gr_complex.conf b/conf/gnss-sdr_Hybrid_gr_complex.conf index 213710eaf..ea60c1836 100644 --- a/conf/gnss-sdr_Hybrid_gr_complex.conf +++ b/conf/gnss-sdr_Hybrid_gr_complex.conf @@ -346,8 +346,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#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/conf/gnss-sdr_Hybrid_nsr.conf b/conf/gnss-sdr_Hybrid_nsr.conf index e6435579c..c47317473 100644 --- a/conf/gnss-sdr_Hybrid_nsr.conf +++ b/conf/gnss-sdr_Hybrid_nsr.conf @@ -200,7 +200,7 @@ Acquisition_1C.threshold=0.0075 ;#doppler_max: Maximum expected Doppler shift [Hz] Acquisition_1C.doppler_max=5000 ;#doppler_max: Doppler step in the grid search [Hz] -Acquisition_1C.doppler_step=500 +Acquisition_1C.doppler_step=250 ;######### GALILEO ACQUISITION CONFIG ############ @@ -228,8 +228,8 @@ 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_Tracking +;#implementation: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking] or [GPS_L1_CA_DLL_PLL_C_Aid_Tracking] or [GPS_L1_CA_TCP_CONNECTOR_Tracking] or [Galileo_E1_DLL_PLL_VEML_Tracking] +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_C_Aid_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 @@ -237,7 +237,7 @@ Tracking_1C.item_type=gr_complex Tracking_1C.if=0 ;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false] -Tracking_1C.dump=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_ @@ -246,7 +246,7 @@ Tracking_1C.dump_filename=../data/epl_tracking_ch_ ;# Valid values are: [1,2,4,5,10,20] (integer divisors of the GPS L1 CA bit period (20 ms) ) ;# Longer integration period require more stable front-end LO -Tracking_1C.extend_correlation_ms=10 +Tracking_1C.extend_correlation_ms=1 ;#pll_bw_hz: PLL loop filter bandwidth [Hz] @@ -265,7 +265,7 @@ 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] +;#implementation: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking] or [GPS_L1_CA_DLL_PLL_C_Aid_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 @@ -348,8 +348,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#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/conf/gnss-sdr_Hybrid_short.conf b/conf/gnss-sdr_Hybrid_short.conf index a0e8bae92..878bf2850 100644 --- a/conf/gnss-sdr_Hybrid_short.conf +++ b/conf/gnss-sdr_Hybrid_short.conf @@ -354,8 +354,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#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/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf index 6e9f1d2a8..8767b2113 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf @@ -342,8 +342,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf index 94b34d55f..f5fd7cdec 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf @@ -350,8 +350,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf index d71f5882d..00cf01b37 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf @@ -348,8 +348,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf index 2b787f259..660aa89d2 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf @@ -349,8 +349,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf index 39f2cecc8..12fc2baf5 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf @@ -344,8 +344,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf b/conf/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf index 36859a7dd..9824f47df 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf @@ -494,8 +494,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_realtime_III_1b.conf b/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_realtime_III_1b.conf index bf3bb57fb..41017b821 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_realtime_III_1b.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_realtime_III_1b.conf @@ -540,8 +540,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf b/conf/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf index 49f36b44d..ab5a9abd0 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf @@ -418,8 +418,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1a.conf b/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1a.conf index a2edd7b6e..08c178866 100644 --- a/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1a.conf +++ b/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1a.conf @@ -441,8 +441,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf b/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf index a2943a616..259425e4b 100644 --- a/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf +++ b/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf @@ -655,8 +655,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] PVT.dump=false -;######### 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/conf/gnss-sdr_multisource_Hybrid_nsr.conf b/conf/gnss-sdr_multisource_Hybrid_nsr.conf index d2aceef93..58e8709ff 100644 --- a/conf/gnss-sdr_multisource_Hybrid_nsr.conf +++ b/conf/gnss-sdr_multisource_Hybrid_nsr.conf @@ -490,8 +490,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#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/conf/gnss-sdr_multisource_Hybrid_short.conf b/conf/gnss-sdr_multisource_Hybrid_short.conf index f063619da..2ef42559a 100644 --- a/conf/gnss-sdr_multisource_Hybrid_short.conf +++ b/conf/gnss-sdr_multisource_Hybrid_short.conf @@ -476,8 +476,3 @@ PVT.rtcm_dump_devname=/dev/pts/1 ;#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/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index 35f027422..c1043c431 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -53,7 +53,6 @@ More details on GNSS-SDR signal processing blocks: \li \ref observables \li \ref pvt -\li \ref output_filter \section overview Overview @@ -125,7 +124,6 @@ This will create a folder named gnss-sdr with the following structure: |-------input_filter |-------libs |-------observables - |-------output_filter |-------resampler |-------signal_source |-------telemetry_decoder @@ -585,9 +583,6 @@ PVT.dump=false ; Enable or disable the PVT internal binary data file logging [tr PVT.dump_filename=./PVT ; Log path and filename without extension. \endverbatim -\subsection output_filter Output filter - -(To be completed) \section license About the software license GNSS-SDR is released under the General Public License (GPL) v3, thus securing practical usability, inspection, diff --git a/src/algorithms/CMakeLists.txt b/src/algorithms/CMakeLists.txt index 75a3b3c4b..d6f0521dc 100644 --- a/src/algorithms/CMakeLists.txt +++ b/src/algorithms/CMakeLists.txt @@ -23,7 +23,6 @@ add_subdirectory(conditioner) add_subdirectory(data_type_adapter) add_subdirectory(observables) add_subdirectory(telemetry_decoder) -add_subdirectory(output_filter) add_subdirectory(resampler) add_subdirectory(signal_generator) add_subdirectory(signal_source) diff --git a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc index eca8f01b2..c57513da8 100644 --- a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.cc @@ -54,7 +54,7 @@ galileo_e1_make_pvt_cc(unsigned int nchannels, boost::shared_ptr galileo_e1_pvt_cc::galileo_e1_pvt_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname, bool flag_rtcm_server, bool flag_rtcm_tty_port, std::string rtcm_dump_devname) : gr::block("galileo_e1_pvt_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), - gr::io_signature::make(1, 1, sizeof(gr_complex))) + gr::io_signature::make(0, 0, sizeof(gr_complex))) { d_output_rate_ms = output_rate_ms; @@ -102,6 +102,8 @@ galileo_e1_pvt_cc::galileo_e1_pvt_cc(unsigned int nchannels, boost::shared_ptr(); + d_last_status_print_seg=0; + // ############# ENABLE DATA FILE LOG ################# if (d_dump == true) { @@ -134,9 +136,21 @@ bool galileo_e1_pvt_cc::pseudoranges_pairCompare_min(const std::pairPRN) + // << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; + } +} -int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) +int galileo_e1_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), + gr_vector_const_void_star &input_items, gr_vector_void_star &output_items __attribute__((unused))) { d_sample_counter++; @@ -144,6 +158,8 @@ int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_it Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer + print_receiver_status(in); + for (unsigned int i = 0; i < d_nchannels; i++) { if (in[i][0].Flag_valid_pseudorange == true) @@ -344,11 +360,6 @@ int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_it } consume_each(1); //one by one - output_items.clear(); // removes a warning - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; } diff --git a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.h index 766aedf64..3b9e7e881 100644 --- a/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.h +++ b/src/algorithms/PVT/gnuradio_blocks/galileo_e1_pvt_cc.h @@ -102,6 +102,9 @@ private: bool b_rinex_header_updated; bool b_rtcm_writing_started; + void print_receiver_status(Gnss_Synchro** channels_synchronization_data); + int d_last_status_print_seg; //for status printer + unsigned int d_nchannels; std::string d_dump_filename; std::ofstream d_dump_file; diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc index 194a02d1a..75d7e51b6 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.cc @@ -72,7 +72,7 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, bool flag_rtcm_tty_port, std::string rtcm_dump_devname) : gr::block("gps_l1_ca_pvt_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), - gr::io_signature::make(1, 1, sizeof(gr_complex)) ) + gr::io_signature::make(0, 0, sizeof(gr_complex)) ) { d_output_rate_ms = output_rate_ms; d_display_rate_ms = display_rate_ms; @@ -115,6 +115,8 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, d_last_sample_nav_output = 0; d_rx_time = 0.0; + d_last_status_print_seg = 0; + b_rinex_header_writen = false; b_rinex_header_updated = false; b_rinex_sbs_header_writen = false; @@ -131,7 +133,7 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "PVT dump enabled Log file: " << d_dump_filename.c_str(); } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure & e) { LOG(INFO) << "Exception opening PVT dump file " << e.what(); } @@ -152,9 +154,21 @@ bool pseudoranges_pairCompare_min(const std::pair& a, const st } +void gps_l1_ca_pvt_cc::print_receiver_status(Gnss_Synchro** channels_synchronization_data) +{ + // Print the current receiver status using std::cout every second + int current_rx_seg=floor(channels_synchronization_data[0][0].Tracking_timestamp_secs); + if ( current_rx_seg!= d_last_status_print_seg) + { + d_last_status_print_seg = current_rx_seg; + std::cout << "Current input signal time = " << current_rx_seg << " [s]" << std::endl<< std::flush; + //DLOG(INFO) << "GPS L1 C/A Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) + // << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; + } +} -int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) +int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), + gr_vector_const_void_star &input_items, gr_vector_void_star &output_items __attribute__((unused))) { d_sample_counter++; @@ -163,6 +177,8 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer //Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //Get the output pointer + print_receiver_status(in); + // ############ 1. READ EPHEMERIS FROM GLOBAL MAP #### d_ls_pvt->gps_ephemeris_map = global_gps_ephemeris_map.get_map_copy(); @@ -381,7 +397,7 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite d_dump_file.write((char*)&d_rx_time, sizeof(double)); } } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure & e) { LOG(WARNING) << "Exception writing observables dump file " << e.what(); } @@ -389,11 +405,6 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite } consume_each(1); //one by one - output_items.clear(); // removes a warning - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; } diff --git a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h index 47394682f..c2c8a7b9e 100644 --- a/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h +++ b/src/algorithms/PVT/gnuradio_blocks/gps_l1_ca_pvt_cc.h @@ -103,6 +103,9 @@ private: bool b_rinex_header_updated; bool b_rtcm_writing_started; + void print_receiver_status(Gnss_Synchro** channels_synchronization_data); + int d_last_status_print_seg; //for status printer + unsigned int d_nchannels; std::string d_dump_filename; std::ofstream d_dump_file; diff --git a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc index e1aebd792..d11e6039b 100644 --- a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc @@ -58,7 +58,7 @@ hybrid_make_pvt_cc(unsigned int nchannels, boost::shared_ptr queu hybrid_pvt_cc::hybrid_pvt_cc(unsigned int nchannels, boost::shared_ptr queue, bool dump, std::string dump_filename, int averaging_depth, bool flag_averaging, int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, std::string nmea_dump_filename, std::string nmea_dump_devname, bool flag_rtcm_server, bool flag_rtcm_tty_port, std::string rtcm_dump_devname) : gr::block("hybrid_pvt_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), - gr::io_signature::make(1, 1, sizeof(gr_complex))) + gr::io_signature::make(0, 0, sizeof(gr_complex))) { d_output_rate_ms = output_rate_ms; @@ -105,6 +105,8 @@ hybrid_pvt_cc::hybrid_pvt_cc(unsigned int nchannels, boost::shared_ptr(); + d_last_status_print_seg=0; + // ############# ENABLE DATA FILE LOG ################# if (d_dump == true) { @@ -137,9 +139,21 @@ bool hybrid_pvt_cc::pseudoranges_pairCompare_min(const std::pairPRN) + // << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; + } +} -int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) +int hybrid_pvt_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), + gr_vector_const_void_star &input_items, gr_vector_void_star &output_items __attribute__((unused))) { d_sample_counter++; bool arrived_galileo_almanac = false; @@ -148,6 +162,8 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; //Get the input pointer + print_receiver_status(in); + for (unsigned int i = 0; i < d_nchannels; i++) { if (in[i][0].Flag_valid_pseudorange == true) @@ -370,11 +386,6 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, } consume_each(1); //one by one - output_items.clear(); // removes a warning - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; } diff --git a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h index b95928c57..89d728317 100644 --- a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h +++ b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.h @@ -101,6 +101,9 @@ private: bool b_rinex_header_writen; bool b_rinex_header_updated; + void print_receiver_status(Gnss_Synchro** channels_synchronization_data); + int d_last_status_print_seg; //for status printer + unsigned int d_nchannels; std::string d_dump_filename; std::ofstream d_dump_file; diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index 786cf7198..123ce5ce3 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -342,7 +342,7 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::set_state(int state) int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_void_star &output_items __attribute__((unused))) { /* * By J.Arribas, L.Esteve, M.Molina and M.Sales @@ -806,7 +806,6 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items } } - output_items.clear(); // removes a warning return noutput_items; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index c4fbb93ac..58ff25804 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -206,7 +206,7 @@ void galileo_pcps_8ms_acquisition_cc::set_state(int state) int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_void_star &output_items __attribute__((unused))) { int acquisition_message = -1; //0=STOP_CHANNEL 1=ACQ_SUCCEES 2=ACQ_FAIL @@ -416,6 +416,5 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, } } - output_items.clear(); // removes a warning return noutput_items; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc index 07f3e6b4e..699ba060f 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc @@ -226,7 +226,7 @@ void pcps_acquisition_cc::set_state(int state) int pcps_acquisition_cc::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_void_star &output_items __attribute__((unused))) { /* * By J.Arribas, L.Esteve and M.Molina @@ -472,7 +472,6 @@ int pcps_acquisition_cc::general_work(int noutput_items, } } - output_items.clear(); // removes a warning return noutput_items; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index 9d63da86d..4744c16c6 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -427,7 +427,7 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_void_star &output_items __attribute__((unused))) { /*! @@ -525,6 +525,5 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, //DLOG(INFO)<<"d_sample_counter="<. -# - -add_subdirectory(adapters) \ No newline at end of file diff --git a/src/algorithms/output_filter/adapters/CMakeLists.txt b/src/algorithms/output_filter/adapters/CMakeLists.txt deleted file mode 100644 index 6656b1b02..000000000 --- a/src/algorithms/output_filter/adapters/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2012-2015 (see AUTHORS file for a list of contributors) -# -# 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 . -# - -set(OUTPUTFILTER_ADAPTER_SOURCES - file_output_filter.cc - null_sink_output_filter.cc -) - -include_directories( - $(CMAKE_CURRENT_SOURCE_DIR) - ${CMAKE_SOURCE_DIR}/src/core/interfaces - ${CMAKE_SOURCE_DIR}/src/core/receiver - ${GLOG_INCLUDE_DIRS} - ${GFlags_INCLUDE_DIRS} - ${GNURADIO_RUNTIME_INCLUDE_DIRS} -) - -file(GLOB OUTPUTFILTER_ADAPTER_HEADERS "*.h") -add_library(out_adapters ${OUTPUTFILTER_ADAPTER_SOURCES} ${OUTPUTFILTER_ADAPTER_HEADERS}) -source_group(Headers FILES ${OUTPUTFILTER_ADAPTER_HEADERS}) -add_dependencies(out_adapters glog-${glog_RELEASE}) -target_link_libraries(out_adapters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}) diff --git a/src/algorithms/output_filter/adapters/file_output_filter.cc b/src/algorithms/output_filter/adapters/file_output_filter.cc deleted file mode 100644 index 86cde40f7..000000000 --- a/src/algorithms/output_filter/adapters/file_output_filter.cc +++ /dev/null @@ -1,105 +0,0 @@ -/*! - * \file file_output_filter.cc - * \brief Implementation of an adapter of a file output filter block - * to an OutputFilterInterface - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#include "file_output_filter.h" -#include -#include -#include "configuration_interface.h" - -using google::LogMessage; - -FileOutputFilter::FileOutputFilter(ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, - unsigned int out_streams) : - role_(role), - in_streams_(in_streams), - out_streams_(out_streams) -{ - std::string default_filename = "./output.dat"; - std::string default_item_type = "short"; - filename_ = configuration->property(role + ".filename", default_filename); - item_type_ = configuration->property(role + ".item_type", default_item_type); - if(item_type_.compare("gr_complex") == 0) - { - item_size_ = sizeof(gr_complex); - } - else if(item_type_.compare("float") == 0) - { - item_size_ = sizeof(float); - } - else if(item_type_.compare("short") == 0) - { - item_size_ = sizeof(short); - } - else - { - LOG(WARNING) << item_type_ << " Unrecognized item type. Using short."; - item_size_ = sizeof(short); - } - file_sink_ = gr::blocks::file_sink::make(item_size_, filename_.c_str()); - DLOG(INFO) << "file sink(" << file_sink_->unique_id() << ")"; -} - - - -FileOutputFilter::~FileOutputFilter() -{} - - - -void FileOutputFilter::connect(gr::top_block_sptr top_block) -{ - if(top_block) { /* top_block is not null */}; - DLOG(INFO) << "nothing to connect internally"; -} - - -void FileOutputFilter::disconnect(gr::top_block_sptr top_block) -{ - if(top_block) { /* top_block is not null */}; - // Nothing to disconnect internally -} - - - -gr::basic_block_sptr FileOutputFilter::get_left_block() -{ - return file_sink_; -} - - - -gr::basic_block_sptr FileOutputFilter::get_right_block() -{ - //return file_sink_;//gr_block_sptr(); - return gr::blocks::file_sink::sptr(); -} diff --git a/src/algorithms/output_filter/adapters/file_output_filter.h b/src/algorithms/output_filter/adapters/file_output_filter.h deleted file mode 100644 index 87052a629..000000000 --- a/src/algorithms/output_filter/adapters/file_output_filter.h +++ /dev/null @@ -1,83 +0,0 @@ -/*! - * \file file_output_filter.h - * \brief Interface of an adapter of a file output filter block to an - * OutputFilterInterface - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_FILE_OUTPUT_FILTER_H_ -#define GNSS_SDR_FILE_OUTPUT_FILTER_H_ - -#include -#include -#include "gnss_block_interface.h" - - -class ConfigurationInterface; - -/*! - * \brief An output filter that sends its output - * to a file without any change in the data format. - */ -class FileOutputFilter : public GNSSBlockInterface -{ -public: - FileOutputFilter(ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, - unsigned int out_streams); - - virtual ~FileOutputFilter(); - std::string role() - { - return role_; - } - std::string implementation() - { - return "File_Output_Filter"; - } - size_t item_size() - { - return item_size_; - } - void connect(gr::top_block_sptr top_block); - void disconnect(gr::top_block_sptr top_block); - gr::basic_block_sptr get_left_block(); - gr::basic_block_sptr get_right_block(); - -private: - gr::blocks::file_sink::sptr file_sink_; - size_t item_size_; - std::string filename_; - std::string item_type_; - std::string role_; - unsigned int in_streams_; - unsigned int out_streams_; -}; - -#endif /*GNSS_SDR_FILE_OUTPUT_FILTER_H_*/ diff --git a/src/algorithms/output_filter/adapters/null_sink_output_filter.cc b/src/algorithms/output_filter/adapters/null_sink_output_filter.cc deleted file mode 100644 index 51263baaf..000000000 --- a/src/algorithms/output_filter/adapters/null_sink_output_filter.cc +++ /dev/null @@ -1,105 +0,0 @@ -/*! - * \file null_sink_output_filter.cc - * \brief Implementation of an adapter of a null sink output filter block to an - * OutputFilterInterface - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#include "null_sink_output_filter.h" -#include -#include -#include "configuration_interface.h" - -using google::LogMessage; - -NullSinkOutputFilter::NullSinkOutputFilter(ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, - unsigned int out_streams) : - role_(role), - in_streams_(in_streams), - out_streams_(out_streams) -{ - std::string default_item_type = "short"; - item_type_ = configuration->property(role + ".item_type", default_item_type); - if(item_type_.compare("gr_complex") == 0) - { - item_size_ = sizeof(gr_complex); - } - else if(item_type_.compare("short") == 0) - { - item_size_ = sizeof(short); - } - else if(item_type_.compare("float") == 0) - { - item_size_ = sizeof(float); - } - else - { - LOG(WARNING) << item_type_ << " unrecognized item type. Using float"; - item_size_ = sizeof(float); - } - sink_ = gr::blocks::null_sink::make(item_size_); - DLOG(INFO) << "null_sink(" << sink_->unique_id() << ")"; -} - - - -NullSinkOutputFilter::~NullSinkOutputFilter() -{} - - - -void NullSinkOutputFilter::connect(gr::top_block_sptr top_block) -{ - if(top_block) { /* top_block is not null */}; - DLOG(INFO) << "nothing to connect internally"; -} - - - -void NullSinkOutputFilter::disconnect(gr::top_block_sptr top_block) -{ - if(top_block) { /* top_block is not null */}; - // Nothing to connect -} - - - -gr::basic_block_sptr NullSinkOutputFilter::get_left_block() -{ - return sink_; -} - - - -gr::basic_block_sptr NullSinkOutputFilter::get_right_block() -{ - LOG(WARNING) << "Right block of a signal sink should not be retrieved"; - //return gr::blocks::sptr::make(); - return sink_; -} diff --git a/src/algorithms/output_filter/adapters/null_sink_output_filter.h b/src/algorithms/output_filter/adapters/null_sink_output_filter.h deleted file mode 100644 index c4016ab75..000000000 --- a/src/algorithms/output_filter/adapters/null_sink_output_filter.h +++ /dev/null @@ -1,88 +0,0 @@ -/*! - * \file null_sink_output_filter.h - * \brief Interface of an adapter of a null sink output filter block to an - * OutputFilterInterface - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * - * This class represents an implementation of an output filter that - * sends its input to a null sink. - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_NULL_SINK_OUTPUT_FILTER_H_ -#define GNSS_SDR_NULL_SINK_OUTPUT_FILTER_H_ - -#include -#include -#include "gnss_block_interface.h" - - -class ConfigurationInterface; - -/*! - * \brief This class implements a null sink output filter - */ -class NullSinkOutputFilter : public GNSSBlockInterface -{ -public: - NullSinkOutputFilter(ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, - unsigned int out_streams); - - virtual ~NullSinkOutputFilter(); - std::string item_type() - { - return item_type_; - } - std::string role() - { - return role_; - } - //! Returns "Null_Sink_Output_Filter" - std::string implementation() - { - return "Null_Sink_Output_Filter"; - } - size_t item_size() - { - return item_size_; - } - void connect(gr::top_block_sptr top_block); - void disconnect(gr::top_block_sptr top_block); - gr::basic_block_sptr get_left_block(); - gr::basic_block_sptr get_right_block(); - -private: - gr::blocks::null_sink::sptr sink_; - size_t item_size_; - std::string item_type_; - std::string role_; - unsigned int in_streams_; - unsigned int out_streams_; -}; - -#endif /*GNSS_SDR_NULL_SINK_OUTPUT_FILTER_H_*/ diff --git a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc index 8c95cb55b..27b1dd75a 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc +++ b/src/algorithms/signal_generator/gnuradio_blocks/signal_generator_c.cc @@ -250,9 +250,9 @@ signal_generator_c::~signal_generator_c() } -int signal_generator_c::general_work (int noutput_items, - gr_vector_int &ninput_items, -gr_vector_const_void_star &input_items, +int signal_generator_c::general_work (int noutput_items __attribute__((unused)), + gr_vector_int &ninput_items __attribute__((unused)), +gr_vector_const_void_star &input_items __attribute__((unused)), gr_vector_void_star &output_items) { gr_complex *out = (gr_complex *) output_items[0]; @@ -388,11 +388,6 @@ gr_vector_void_star &output_items) } } - if((noutput_items == 0) || (ninput_items.size() != 0) || input_items[0] == 0) - { - // do nothing - } - // Tell runtime system how many output items we produced. return 1; } diff --git a/src/algorithms/signal_source/adapters/gen_signal_source.h b/src/algorithms/signal_source/adapters/gen_signal_source.h index 0c8e7f7f4..b607f0320 100644 --- a/src/algorithms/signal_source/adapters/gen_signal_source.h +++ b/src/algorithms/signal_source/adapters/gen_signal_source.h @@ -64,7 +64,6 @@ public: size_t item_size(){ return 0; } GNSSBlockInterface *signal_generator(){ return signal_generator_; } - GNSSBlockInterface *output_filter(){ return filter_; } private: GNSSBlockInterface *signal_generator_; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc index a6708eb96..0e0ca0507 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc @@ -290,7 +290,7 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols,int -int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { int corr_value = 0; @@ -494,10 +494,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector } //todo: implement averaging d_average_count++; - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } + if (d_average_count == d_decimation_output_factor) { d_average_count = 0; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc index 1765cb13c..df0ee2927 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e5a_telemetry_decoder_cc.cc @@ -274,7 +274,7 @@ galileo_e5a_telemetry_decoder_cc::~galileo_e5a_telemetry_decoder_cc() } -int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // @@ -340,16 +340,6 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector // **** Attempt Preamble correlation **** bool corr_flag=true; int corr_sign = 0; // sequence can be found inverted - // corr_sign = d_preamble_bits[0] * d_page_symbols[d_symbol_counter - GALILEO_FNAV_PREAMBLE_LENGTH_BITS]; - // for (int i = 1; i < GALILEO_FNAV_PREAMBLE_LENGTH_BITS; i++) - // { - // if ((d_preamble_bits[i] * d_page_symbols[i + d_symbol_counter - GALILEO_FNAV_PREAMBLE_LENGTH_BITS]) != corr_sign) - // { - // //exit for if one bit doesn't correlate - // corr_flag = false; - // break; - // } - // } // check if the preamble starts positive correlated or negative correlated if (d_page_symbols[d_symbol_counter - GALILEO_FNAV_PREAMBLE_LENGTH_BITS] < 0) // symbols clipping { @@ -583,10 +573,6 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items, gr_vector d_sample_counter++; //count for the processed samples //3. Make the output (copy the object contents to the GNURadio reserved memory) *out[0] = current_synchro_data; - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index be09af2be..f7162c58c 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -49,7 +49,7 @@ gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr< return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, queue, dump)); } -void gps_l1_ca_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) +void gps_l1_ca_telemetry_decoder_cc::forecast (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required) { ninput_items_required[0] = GPS_CA_PREAMBLE_LENGTH_SYMBOLS; //set the required sample history } @@ -142,7 +142,7 @@ bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword) } -int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { int corr_value = 0; @@ -234,7 +234,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i d_symbol_accumulator += in[0][0].Prompt_I; // accumulate the input value in d_symbol_accumulator d_symbol_accumulator_counter += in[0][0].correlation_length_ms; } - if (d_symbol_accumulator_counter == 20) + if (d_symbol_accumulator_counter >= 20) { if (d_symbol_accumulator > 0) { //symbol to bit @@ -348,10 +348,6 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i //todo: implement averaging d_average_count++; - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } if (d_average_count == d_decimation_output_factor) { d_average_count = 0; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.cc index a49d3cfa7..adeb22711 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2_m_telemetry_decoder_cc.cc @@ -57,7 +57,7 @@ gps_l2_m_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, + boost::shared_ptr queue __attribute__((unused)), bool dump) : gr::block("gps_l2_m_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), @@ -110,7 +110,7 @@ void gps_l2_m_telemetry_decoder_cc::set_decimation(int decimation) } -int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // get pointers on in- and output gnss-synchro objects @@ -118,7 +118,7 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in Gnss_Synchro *out = (Gnss_Synchro *) output_items[0]; // output // store the time stamp of the first sample in the processed sample block - double sample_stamp = in[0].Tracking_timestamp_secs; + //double sample_stamp = in[0].Tracking_timestamp_secs; bool flag_new_cnav_frame = false; int last_frame_preamble_start = 0; @@ -152,7 +152,8 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in // and obtain the bits by decoding the symbols (viterbi decoder) // they can be already aligned or shifted by one position std::vector bits; - bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(d_sample_buf, bits); + + //bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(d_sample_buf, bits); //std::stringstream ss; //for (std::vector::const_iterator bit_it = bits.begin(); bit_it < bits.end(); ++bit_it) @@ -260,10 +261,6 @@ int gps_l2_m_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_in } d_average_count++; - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } if (d_average_count == d_decimation_output_factor) { d_average_count = 0; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc index 026167790..b7c772888 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_cc.cc @@ -57,7 +57,7 @@ sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, boost::shared_ptr queue, + boost::shared_ptr queue __attribute__((unused)), bool dump) : gr::block("sbas_l1_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)), @@ -93,7 +93,7 @@ void sbas_l1_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &n -int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { VLOG(FLOW) << "general_work(): " << "noutput_items=" << noutput_items << "\toutput_items real size=" << output_items.size() << "\tninput_items size=" << ninput_items.size() << "\tinput_items real size=" << input_items.size() << "\tninput_items[0]=" << ninput_items[0]; @@ -182,10 +182,6 @@ int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_int current_synchro_data[i].Flag_valid_word = false; // indicate to observable block that this synchro object isn't valid for pseudorange computation } consume_each(noutput_items); // tell scheduler input items consumed - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return noutput_items; // tell scheduler output items produced } diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index 3d146f646..c9841612c 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -24,7 +24,6 @@ endif(ENABLE_CUDA) set(TRACKING_ADAPTER_SOURCES galileo_e1_dll_pll_veml_tracking.cc galileo_e1_tcp_connector_tracking.cc - gps_l1_ca_dll_fll_pll_tracking.cc gps_l1_ca_dll_pll_tracking.cc gps_l1_ca_dll_pll_c_aid_tracking.cc gps_l1_ca_tcp_connector_tracking.cc diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.cc deleted file mode 100644 index 265b3eedb..000000000 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.cc +++ /dev/null @@ -1,163 +0,0 @@ -/*! - * \file gps_l1_ca_dll_fll_pll_tracking.cc - * \brief Implementation of an adapter of a code DLL + carrier FLL/PLL tracking - * loop for GPS L1 C/A to a TrackingInterface - * \author Javier Arribas, 2011. jarribas(at)cttc.es - * - * This file implements the code Delay Locked Loop (DLL) + carrier Phase - * Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) - * according to the algorithms described in: - * E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and - * Applications, Second Edition, Artech House Publishers, 2005. - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#include "gps_l1_ca_dll_fll_pll_tracking.h" -#include -#include "GPS_L1_CA.h" -#include "configuration_interface.h" - - -using google::LogMessage; - -GpsL1CaDllFllPllTracking::GpsL1CaDllFllPllTracking( - ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, unsigned int - out_streams, - boost::shared_ptr queue) : - role_(role), - in_streams_(in_streams), - out_streams_(out_streams), - queue_(queue) -{ - DLOG(INFO) << "role " << role; - //################# CONFIGURATION PARAMETERS ######################## - int fs_in; - int vector_length; - int f_if; - bool dump; - std::string dump_filename; - std::string item_type; - std::string default_item_type = "gr_complex"; - float pll_bw_hz; - float fll_bw_hz; - float dll_bw_hz; - float early_late_space_chips; - int order; - item_type = configuration->property(role + ".item_type",default_item_type); - //vector_length = configuration->property(role + ".vector_length", 2048); - fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); - f_if = configuration->property(role + ".if", 0); - dump = configuration->property(role + ".dump", false); - order = configuration->property(role + ".order", 2); - pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); - fll_bw_hz = configuration->property(role + ".fll_bw_hz", 100.0); - dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); - early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); - std::string default_dump_filename = "./track_ch"; - dump_filename = configuration->property(role + ".dump_filename", - default_dump_filename); //unused! - vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); - - //################# MAKE TRACKING GNURadio object ################### - if (item_type.compare("gr_complex") == 0) - { - item_size_ = sizeof(gr_complex); - tracking_ = gps_l1_ca_dll_fll_pll_make_tracking_cc( - f_if, - fs_in, - vector_length, - queue_, - dump, - dump_filename, - order, - fll_bw_hz, - pll_bw_hz, - dll_bw_hz, - early_late_space_chips); - } - else - { - item_size_ = sizeof(gr_complex); - LOG(WARNING) << item_type << " unknown tracking item type."; - } - channel_ = 0; - channel_internal_queue_ = 0; - - DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; -} - - -GpsL1CaDllFllPllTracking::~GpsL1CaDllFllPllTracking() -{} - - -void GpsL1CaDllFllPllTracking::start_tracking() -{ - tracking_->start_tracking(); -} - -void GpsL1CaDllFllPllTracking::set_channel(unsigned int channel) -{ - channel_ = channel; - tracking_->set_channel(channel); -} - -void GpsL1CaDllFllPllTracking::set_channel_queue( - concurrent_queue *channel_internal_queue) -{ - channel_internal_queue_ = channel_internal_queue; - tracking_->set_channel_queue(channel_internal_queue_); -} - -void GpsL1CaDllFllPllTracking::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) -{ - return tracking_->set_gnss_synchro(p_gnss_synchro); -} - -void GpsL1CaDllFllPllTracking::connect(gr::top_block_sptr top_block) -{ - if(top_block) { /* top_block is not null */}; - //nothing to connect, now the tracking uses gr_sync_decimator -} - -void GpsL1CaDllFllPllTracking::disconnect(gr::top_block_sptr top_block) -{ - if(top_block) { /* top_block is not null */}; - //nothing to disconnect, now the tracking uses gr_sync_decimator -} - -gr::basic_block_sptr GpsL1CaDllFllPllTracking::get_left_block() -{ - return tracking_; -} - -gr::basic_block_sptr GpsL1CaDllFllPllTracking::get_right_block() -{ - return tracking_; -} - diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.h deleted file mode 100644 index 7fd84a9d7..000000000 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_fll_pll_tracking.h +++ /dev/null @@ -1,99 +0,0 @@ -/*! - * \file gps_l1_ca_dll_fll_pll_tracking.h - * \brief Interface of an adapter of a code DLL + carrier FLL/PLL tracking - * loop for GPS L1 C/A to a TrackingInterface - * \author Javier Arribas, 2011. jarribas(at)cttc.es - * - * This is the interface of a code Delay Locked Loop (DLL) + carrier - * Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) - * according to the algorithms described in: - * E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and - * Applications, Second Edition, Artech House Publishers, 2005. - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GPS_L1_CA_DLL_FLL_PLL_TRACKING_H_ -#define GNSS_SDR_GPS_L1_CA_DLL_FLL_PLL_TRACKING_H_ - -#include -#include -#include "tracking_interface.h" -#include "gps_l1_ca_dll_fll_pll_tracking_cc.h" - - -class ConfigurationInterface; - -/*! - * \brief This class implements a code DLL + carrier PLL/FLL Assisted tracking loop - */ -class GpsL1CaDllFllPllTracking : public TrackingInterface -{ -public: - GpsL1CaDllFllPllTracking(ConfigurationInterface* configuration, - std::string role, - unsigned int in_streams, - unsigned int out_streams, - boost::shared_ptr queue); - - virtual ~GpsL1CaDllFllPllTracking(); - - std::string role() - { - return role_; - } - - //! Returns "GPS_L1_CA_DLL_FLL_PLL_Tracking" - std::string implementation() - { - return "GPS_L1_CA_DLL_FLL_PLL_Tracking"; - } - size_t item_size() - { - return item_size_; - } - - void connect(gr::top_block_sptr top_block); - void disconnect(gr::top_block_sptr top_block); - gr::basic_block_sptr get_left_block(); - gr::basic_block_sptr get_right_block(); - - void set_channel(unsigned int channel); - void set_channel_queue(concurrent_queue *channel_internal_queue); - void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); - void start_tracking(); - -private: - gps_l1_ca_dll_fll_pll_tracking_cc_sptr tracking_; - size_t item_size_; - unsigned int channel_; - std::string role_; - unsigned int in_streams_; - unsigned int out_streams_; - boost::shared_ptr queue_; - concurrent_queue *channel_internal_queue_; -}; - -#endif // GPS_L1_CA_DLL_FLL_PLL_TRACKING_H_ diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index f21e73b94..0ca1c9142 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -59,8 +59,6 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( std::string dump_filename; std::string item_type; std::string default_item_type = "gr_complex"; - float pll_bw_hz; - float dll_bw_hz; float early_late_space_chips; size_t port_ch0; item_type = configuration->property(role + ".item_type",default_item_type); @@ -68,8 +66,6 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( fs_in = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); - pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); - dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); port_ch0 = configuration->property(role + ".port_ch0", 2060); std::string default_dump_filename = "./track_ch"; @@ -87,8 +83,6 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( queue_, dump, dump_filename, - pll_bw_hz, - dll_bw_hz, early_late_space_chips, port_ch0); } diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index 3a583b7b0..1e2fe27b2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -25,7 +25,6 @@ endif(ENABLE_CUDA) set(TRACKING_GR_BLOCKS_SOURCES galileo_e1_dll_pll_veml_tracking_cc.cc galileo_e1_tcp_connector_tracking_cc.cc - gps_l1_ca_dll_fll_pll_tracking_cc.cc gps_l1_ca_dll_pll_tracking_cc.cc gps_l1_ca_tcp_connector_tracking_cc.cc galileo_e5a_dll_pll_tracking_cc.cc diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc index 46f25fc08..343ec972a 100755 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include "galileo_e1_signal_processing.h" #include "tracking_discriminators.h" #include "lock_detectors.h" @@ -129,11 +129,11 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc( // Initialization of local code replica // Get space for a vector with the sinboc(1,1) replica sampled 2x/chip - d_ca_code = static_cast(volk_gnsssdr_malloc((2*Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); + d_ca_code = static_cast(volk_malloc((2*Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_get_alignment())); // correlator outputs (scalar) d_n_correlator_taps = 5; // Very-Early, Early, Prompt, Late, Very-Late - d_correlator_outs = static_cast(volk_gnsssdr_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_gnsssdr_get_alignment())); + d_correlator_outs = static_cast(volk_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_get_alignment())); for (int n = 0; n < d_n_correlator_taps; n++) { d_correlator_outs[n] = gr_complex(0,0); @@ -145,7 +145,7 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc( d_Late = &d_correlator_outs[3]; d_Very_Late = &d_correlator_outs[4]; - d_local_code_shift_chips = static_cast(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment())); + d_local_code_shift_chips = static_cast(volk_malloc(d_n_correlator_taps * sizeof(float), volk_get_alignment())); // Set TAPs delay values [chips] d_local_code_shift_chips[0] = - d_very_early_late_spc_chips * 2.0; d_local_code_shift_chips[1] = - d_very_early_late_spc_chips; @@ -172,7 +172,6 @@ galileo_e1_dll_pll_veml_tracking_cc::galileo_e1_dll_pll_veml_tracking_cc( d_enable_tracking = false; d_pull_in = false; - d_last_seg = 0; d_current_prn_length_samples = static_cast(d_vector_length); @@ -253,9 +252,9 @@ galileo_e1_dll_pll_veml_tracking_cc::~galileo_e1_dll_pll_veml_tracking_cc() { d_dump_file.close(); - volk_gnsssdr_free(d_local_code_shift_chips); - volk_gnsssdr_free(d_correlator_outs); - volk_gnsssdr_free(d_ca_code); + volk_free(d_local_code_shift_chips); + volk_free(d_correlator_outs); + volk_free(d_ca_code); delete[] d_Prompt_buffer; multicorrelator_cpu.free(); @@ -263,7 +262,7 @@ galileo_e1_dll_pll_veml_tracking_cc::~galileo_e1_dll_pll_veml_tracking_cc() -int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { double carr_error_hz = 0.0; @@ -416,49 +415,9 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items, gr_vec current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz; current_synchro_data.Flag_valid_pseudorange = false; *out[0] = current_synchro_data; - - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (std::floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = std::floor(d_sample_counter / d_fs_in); - - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - - tmp_str_stream << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", Doppler=" << d_carrier_doppler_hz << " [Hz] CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; - LOG(INFO) << tmp_str_stream.rdbuf() << std::flush; - //if (d_channel == 0 || d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! - } } else { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (std::floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = std::floor(d_sample_counter / d_fs_in); - - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - } *d_Early = gr_complex(0,0); *d_Prompt = gr_complex(0,0); *d_Late = gr_complex(0,0); @@ -526,7 +485,7 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items, gr_vec tmp_double = static_cast(d_sample_counter + d_current_prn_length_samples); d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what() << std::endl; } @@ -534,10 +493,6 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items, gr_vec consume_each(d_current_prn_length_samples); // this is required for gr_block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } @@ -560,7 +515,7 @@ void galileo_e1_dll_pll_veml_tracking_cc::set_channel(unsigned int channel) d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what() << std::endl; } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h index 5d073ca6f..f443f561a 100755 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.h @@ -119,7 +119,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; long d_if_freq; long d_fs_in; diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index e84b01fc1..49848e409 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -100,8 +100,8 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( boost::shared_ptr queue, bool dump, std::string dump_filename, - float pll_bw_hz, - float dll_bw_hz, + float pll_bw_hz __attribute__((unused)), + float dll_bw_hz __attribute__((unused)), float early_late_space_chips, float very_early_late_space_chips, size_t port_ch0): @@ -133,22 +133,33 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( // Initialization of local code replica // Get space for a vector with the sinboc(1,1) replica sampled 2x/chip - d_ca_code = static_cast(volk_malloc(((2 * Galileo_E1_B_CODE_LENGTH_CHIPS + 4)) * sizeof(gr_complex), volk_get_alignment())); - - d_very_early_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_early_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_prompt_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_late_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_very_late_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_carr_sign = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); + d_ca_code = static_cast(volk_malloc((2*Galileo_E1_B_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_get_alignment())); // correlator outputs (scalar) + d_n_correlator_taps = 5; // Very-Early, Early, Prompt, Late, Very-Late + d_correlator_outs = static_cast(volk_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_get_alignment())); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } + // map memory pointers of correlator outputs + d_Very_Early = &d_correlator_outs[0]; + d_Early = &d_correlator_outs[1]; + d_Prompt = &d_correlator_outs[2]; + d_Late = &d_correlator_outs[3]; + d_Very_Late = &d_correlator_outs[4]; - d_Very_Early = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Early = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Prompt = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Late = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Very_Late = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); + d_local_code_shift_chips = static_cast(volk_malloc(d_n_correlator_taps * sizeof(float), volk_get_alignment())); + // Set TAPs delay values [chips] + d_local_code_shift_chips[0] = - d_very_early_late_spc_chips * 2.0; + d_local_code_shift_chips[1] = - d_very_early_late_spc_chips; + d_local_code_shift_chips[2] = 0.0; + d_local_code_shift_chips[3] = d_very_early_late_spc_chips; + d_local_code_shift_chips[4] = d_very_early_late_spc_chips * 2.0; + + d_correlation_length_samples=d_vector_length; + + multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); //--- Perform initializations ------------------------------ // define initial code frequency basis of NCO @@ -164,7 +175,6 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( d_enable_tracking = false; d_pull_in = false; - d_last_seg = 0; d_current_prn_length_samples = (int)d_vector_length; @@ -198,18 +208,19 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking() d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - // generate local reference ALWAYS starting at chip 2 (2 samples per chip) - galileo_e1_code_gen_complex_sampled(&d_ca_code[2], + // generate local reference ALWAYS starting at chip 1 (2 samples per chip) + galileo_e1_code_gen_complex_sampled(d_ca_code, d_acquisition_gnss_synchro->Signal, false, d_acquisition_gnss_synchro->PRN, - 2*Galileo_E1_CODE_CHIP_RATE_HZ, + 2 * Galileo_E1_CODE_CHIP_RATE_HZ, 0); - // Fill head and tail - d_ca_code[0] = d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS)]; - d_ca_code[1] = d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+1)]; - d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+2)] = d_ca_code[2]; - d_ca_code[(int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS+3)] = d_ca_code[3]; + + multicorrelator_cpu.set_local_code_and_taps(static_cast(2*Galileo_E1_B_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } d_carrier_lock_fail_counter = 0; d_rem_code_phase_samples = 0.0; @@ -235,82 +246,21 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::start_tracking() } -void Galileo_E1_Tcp_Connector_Tracking_cc::update_local_code() -{ - double tcode_half_chips; - float rem_code_phase_half_chips; - int associated_chip_index; - int code_length_half_chips = (int)(2*Galileo_E1_B_CODE_LENGTH_CHIPS); - double code_phase_step_chips; - double code_phase_step_half_chips; - int early_late_spc_samples; - int very_early_late_spc_samples; - int epl_loop_length_samples; - - // unified loop for VE, E, P, L, VL code vectors - code_phase_step_chips = ((double)d_code_freq_chips) / ((double)d_fs_in); - code_phase_step_half_chips = (2.0*(double)d_code_freq_chips) / ((double)d_fs_in); - - rem_code_phase_half_chips = d_rem_code_phase_samples * (2*d_code_freq_chips / d_fs_in); - tcode_half_chips = -(double)rem_code_phase_half_chips; - - early_late_spc_samples = round(d_early_late_spc_chips / code_phase_step_chips); - very_early_late_spc_samples = round(d_very_early_late_spc_chips / code_phase_step_chips); - - epl_loop_length_samples = d_current_prn_length_samples + very_early_late_spc_samples*2; - - for (int i = 0; i < epl_loop_length_samples; i++) - { - associated_chip_index = 2 + round(fmod(tcode_half_chips - 2*d_very_early_late_spc_chips, code_length_half_chips)); - d_very_early_code[i] = d_ca_code[associated_chip_index]; - tcode_half_chips = tcode_half_chips + code_phase_step_half_chips; - } - memcpy(d_early_code, &d_very_early_code[very_early_late_spc_samples - early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex)); - memcpy(d_prompt_code, &d_very_early_code[very_early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex)); - memcpy(d_late_code, &d_very_early_code[2*very_early_late_spc_samples - early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex)); - memcpy(d_very_late_code, &d_very_early_code[2*very_early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex)); -} - - -void Galileo_E1_Tcp_Connector_Tracking_cc::update_local_carrier() -{ - float phase_rad, phase_step_rad; - // Compute the carrier phase step for the K-1 carrier Doppler estimation - phase_step_rad = (float)GPS_TWO_PI*d_carrier_doppler_hz / (float)d_fs_in; - // Initialize the carrier phase with the remnant carrier phase of the K-2 loop - 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)); - phase_rad += phase_step_rad; - } -} - - Galileo_E1_Tcp_Connector_Tracking_cc::~Galileo_E1_Tcp_Connector_Tracking_cc() { d_dump_file.close(); - volk_free(d_very_early_code); - volk_free(d_early_code); - volk_free(d_prompt_code); - volk_free(d_late_code); - volk_free(d_very_late_code); - volk_free(d_carr_sign); - volk_free(d_Very_Early); - volk_free(d_Early); - volk_free(d_Prompt); - volk_free(d_Late); - volk_free(d_Very_Late); - volk_free(d_ca_code); - delete[] d_Prompt_buffer; + volk_free(d_ca_code); + volk_free(d_local_code_shift_chips); + volk_free(d_correlator_outs); d_tcp_com.close_tcp_connection(d_port); + multicorrelator_cpu.free(); } -int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // process vars @@ -346,24 +296,19 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve const gr_complex* in = (gr_complex*) input_items[0]; Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; - // Generate local code and carrier replicas (using \hat{f}_d(k-1)) - update_local_code(); - update_local_carrier(); + // ################# CARRIER WIPEOFF AND CORRELATORS ############################## + // perform carrier wipe-off and compute Early, Prompt and Late correlation + multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in); - // perform Early, Prompt and Late correlation - d_correlator.Carrier_wipeoff_and_VEPL_volk(d_current_prn_length_samples, - in, - d_carr_sign, - d_very_early_code, - d_early_code, - d_prompt_code, - d_late_code, - d_very_late_code, - d_Very_Early, - d_Early, - d_Prompt, - d_Late, - d_Very_Late); + double carr_phase_step_rad = GALILEO_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); + double code_phase_step_half_chips = (2.0 * d_code_freq_chips) / (static_cast(d_fs_in)); + double rem_code_phase_half_chips = d_rem_code_phase_samples * (2.0*d_code_freq_chips / d_fs_in); + multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler( + d_rem_carr_phase_rad, + carr_phase_step_rad, + rem_code_phase_half_chips, + code_phase_step_half_chips, + d_correlation_length_samples); // ################## TCP CONNECTOR ########################################################## //! Variable used for control @@ -474,52 +419,9 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve current_synchro_data.CN0_dB_hz = (double)d_CN0_SNV_dB_Hz; current_synchro_data.Flag_valid_pseudorange = false; *out[0] = current_synchro_data; - - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; - LOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } - else - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - LOG(INFO) << "Tracking CH " << d_channel - << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } } else { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - } *d_Early = gr_complex(0,0); *d_Prompt = gr_complex(0,0); *d_Late = gr_complex(0,0); @@ -588,17 +490,14 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_ve tmp_double = (double)(d_sample_counter+d_current_prn_length_samples); d_dump_file.write((char*)&tmp_double, sizeof(double)); } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } } consume_each(d_current_prn_length_samples); // this is needed in gr::block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } + return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } @@ -621,7 +520,7 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel) d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h index e57586d61..7c9f4acf4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h @@ -46,7 +46,8 @@ #include #include "concurrent_queue.h" #include "gnss_synchro.h" -#include "correlator.h" +#include +#include "cpu_multicorrelator.h" #include "tcp_communication.h" @@ -123,22 +124,17 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; + long d_if_freq; long d_fs_in; + int d_correlation_length_samples; + int d_n_correlator_taps; float d_early_late_spc_chips; float d_very_early_late_spc_chips; gr_complex* d_ca_code; - gr_complex* d_very_early_code; - gr_complex* d_early_code; - gr_complex* d_prompt_code; - gr_complex* d_late_code; - gr_complex* d_very_late_code; - gr_complex* d_carr_sign; - gr_complex *d_Very_Early; gr_complex *d_Early; gr_complex *d_Prompt; @@ -155,7 +151,9 @@ private: float d_acq_carrier_doppler_hz; // correlator - Correlator d_correlator; + float* d_local_code_shift_chips; + gr_complex* d_correlator_outs; + cpu_multicorrelator multicorrelator_cpu; // tracking vars double d_code_freq_chips; @@ -172,7 +170,6 @@ private: //PRN period in samples int d_current_prn_length_samples; int d_next_prn_length_samples; - //double d_sample_counter_seconds; //processing samples counters unsigned long int d_sample_counter; diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc index 09c4b0d45..4722bd0d2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc @@ -137,20 +137,34 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc( // Initialization of local code replica // Get space for a vector with the E5a primary code replicas sampled 1x/chip - d_codeQ = new gr_complex[static_cast(Galileo_E5a_CODE_LENGTH_CHIPS) + 2]; - d_codeI = new gr_complex[static_cast(Galileo_E5a_CODE_LENGTH_CHIPS) + 2]; + d_codeQ = static_cast(volk_malloc(Galileo_E5a_CODE_LENGTH_CHIPS * sizeof(gr_complex), volk_get_alignment())); + d_codeI = static_cast(volk_malloc(Galileo_E5a_CODE_LENGTH_CHIPS * sizeof(gr_complex), volk_get_alignment())); - d_early_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_late_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_prompt_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_prompt_data_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_carr_sign = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); + // correlator Q outputs (scalar) + d_n_correlator_taps = 3; // Early, Prompt, Late + d_correlator_outs = static_cast(volk_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_get_alignment())); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } - // correlator outputs (complex number) - d_Early = gr_complex(0, 0); - d_Prompt = gr_complex(0, 0); - d_Late = gr_complex(0, 0); - d_Prompt_data = gr_complex(0, 0); + // map memory pointers of correlator outputs + d_Single_Early = &d_correlator_outs[0]; + d_Single_Prompt = &d_correlator_outs[1]; + d_Single_Late = &d_correlator_outs[2]; + + d_local_code_shift_chips = static_cast(volk_malloc(d_n_correlator_taps * sizeof(float), volk_get_alignment())); + // Set TAPs delay values [chips] + d_local_code_shift_chips[0] = - d_early_late_spc_chips; + d_local_code_shift_chips[1] = 0.0; + d_local_code_shift_chips[2] = d_early_late_spc_chips; + + multicorrelator_cpu_Q.init(2 * d_vector_length, d_n_correlator_taps); + + // correlator I single output for data (scalar) + d_Single_Prompt_data=static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); + *d_Single_Prompt_data = gr_complex(0,0); + multicorrelator_cpu_I.init(2 * d_vector_length, 1); // single correlator for data channel //--- Perform initializations ------------------------------ // define initial code frequency basis of NCO @@ -164,7 +178,6 @@ Galileo_E5a_Dll_Pll_Tracking_cc::Galileo_E5a_Dll_Pll_Tracking_cc( // sample synchronization d_sample_counter = 0; d_acq_sample_stamp = 0; - d_last_seg = 0; d_first_transition = false; d_secondary_lock = false; @@ -203,14 +216,18 @@ Galileo_E5a_Dll_Pll_Tracking_cc::~Galileo_E5a_Dll_Pll_Tracking_cc () { d_dump_file.close(); - volk_free(d_prompt_code); - volk_free(d_late_code); - volk_free(d_early_code); - volk_free(d_carr_sign); - volk_free(d_prompt_data_code); delete[] d_codeI; delete[] d_codeQ; delete[] d_Prompt_buffer; + + d_dump_file.close(); + + volk_free(d_local_code_shift_chips); + volk_free(d_correlator_outs); + volk_free(d_Single_Prompt_data); + + multicorrelator_cpu_Q.free(); + multicorrelator_cpu_I.free(); } @@ -268,14 +285,10 @@ void Galileo_E5a_Dll_Pll_Tracking_cc::start_tracking() // generate local reference ALWAYS starting at chip 1 (1 sample per chip) char sig[3]; strcpy(sig,"5Q"); - galileo_e5_a_code_gen_complex_primary(&d_codeQ[1], d_acquisition_gnss_synchro->PRN, sig); - d_codeQ[0] = d_codeQ[static_cast(Galileo_E5a_CODE_LENGTH_CHIPS)]; - d_codeQ[static_cast(Galileo_E5a_CODE_LENGTH_CHIPS) + 1] = d_codeQ[1]; + galileo_e5_a_code_gen_complex_primary(d_codeQ, d_acquisition_gnss_synchro->PRN, sig); strcpy(sig,"5I"); - galileo_e5_a_code_gen_complex_primary(&d_codeI[1], d_acquisition_gnss_synchro->PRN, sig); - d_codeI[0] = d_codeI[static_cast(Galileo_E5a_CODE_LENGTH_CHIPS)]; - d_codeI[static_cast(Galileo_E5a_CODE_LENGTH_CHIPS) + 1] = d_codeI[1]; + galileo_e5_a_code_gen_complex_primary(d_codeI, d_acquisition_gnss_synchro->PRN, sig); d_carrier_lock_fail_counter = 0; d_rem_code_phase_samples = 0; @@ -299,6 +312,7 @@ void Galileo_E5a_Dll_Pll_Tracking_cc::start_tracking() 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; + } @@ -355,57 +369,7 @@ void Galileo_E5a_Dll_Pll_Tracking_cc::acquire_secondary() } -void Galileo_E5a_Dll_Pll_Tracking_cc::update_local_code() -{ - double tcode_chips; - double rem_code_phase_chips; - int associated_chip_index; - int associated_chip_index_data; - int code_length_chips = static_cast(Galileo_E5a_CODE_LENGTH_CHIPS); - double code_phase_step_chips; - int early_late_spc_samples; - int epl_loop_length_samples; - - // unified loop for E, P, L code vectors - code_phase_step_chips = d_code_freq_chips / static_cast(d_fs_in); - rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / d_fs_in); - tcode_chips = -rem_code_phase_chips; - - // Alternative EPL code generation (40% of speed improvement!) - early_late_spc_samples = round(d_early_late_spc_chips / code_phase_step_chips); - epl_loop_length_samples = d_current_prn_length_samples + early_late_spc_samples * 2; - - for (int i = 0; i < epl_loop_length_samples; i++) - { - associated_chip_index = 1 + round(fmod(tcode_chips - d_early_late_spc_chips, code_length_chips)); - associated_chip_index_data = 1 + round(fmod(tcode_chips, code_length_chips)); - d_early_code[i] = d_codeQ[associated_chip_index]; - d_prompt_data_code[i] = d_codeI[associated_chip_index_data]; - tcode_chips = tcode_chips + code_phase_step_chips; - } - memcpy(d_prompt_code, &d_early_code[early_late_spc_samples], d_current_prn_length_samples * sizeof(gr_complex)); - memcpy(d_late_code, &d_early_code[early_late_spc_samples * 2], d_current_prn_length_samples * sizeof(gr_complex)); - -} - - -void Galileo_E5a_Dll_Pll_Tracking_cc::update_local_carrier() -{ - float sin_f, cos_f; - float phase_step_rad = static_cast(2.0 * GALILEO_PI * d_carrier_doppler_hz / static_cast(d_fs_in)); - int phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad); - int phase_rad_i = gr::fxpt::float_to_fixed(d_rem_carr_phase_rad); - - for(int i = 0; i < d_current_prn_length_samples; i++) - { - gr::fxpt::sincos(phase_rad_i, &sin_f, &cos_f); - d_carr_sign[i] = std::complex(cos_f, -sin_f); - phase_rad_i += phase_step_rad_i; - } -} - - -int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // process vars @@ -431,23 +395,7 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_ { case 0: { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - } d_Early = gr_complex(0,0); d_Prompt = gr_complex(0,0); d_Late = gr_complex(0,0); @@ -512,59 +460,50 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_ //Generate local code and carrier replicas (using \hat{f}_d(k-1)) if (d_integration_counter == 0) { - update_local_code(); - update_local_carrier(); // Reset accumulated values d_Early = gr_complex(0,0); d_Prompt = gr_complex(0,0); d_Late = gr_complex(0,0); } - gr_complex single_early; - gr_complex single_prompt; - gr_complex single_late; // perform carrier wipe-off and compute Early, Prompt and Late // correlation of 1 primary code - d_correlator.Carrier_wipeoff_and_EPL_volk_IQ(d_current_prn_length_samples, - in, - d_carr_sign, - d_early_code, - d_prompt_code, - d_late_code, - d_prompt_data_code, - &single_early, - &single_prompt, - &single_late, - &d_Prompt_data); + + multicorrelator_cpu_Q.set_local_code_and_taps(d_current_prn_length_samples, d_codeQ, d_local_code_shift_chips); + multicorrelator_cpu_I.set_local_code_and_taps(d_current_prn_length_samples, d_codeI, &d_local_code_shift_chips[1]); + + + // ################# CARRIER WIPEOFF AND CORRELATORS ############################## + // perform carrier wipe-off and compute Early, Prompt and Late correlation + multicorrelator_cpu_Q.set_input_output_vectors(d_correlator_outs,in); + multicorrelator_cpu_I.set_input_output_vectors(d_Single_Prompt_data,in); + + double carr_phase_step_rad = GALILEO_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); + double code_phase_step_chips = d_code_freq_chips / (static_cast(d_fs_in)); + double rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / d_fs_in); + multicorrelator_cpu_Q.Carrier_wipeoff_multicorrelator_resampler( + d_rem_carr_phase_rad, + carr_phase_step_rad, + rem_code_phase_chips, + code_phase_step_chips, + d_current_prn_length_samples); + + multicorrelator_cpu_I.Carrier_wipeoff_multicorrelator_resampler( + d_rem_carr_phase_rad, + carr_phase_step_rad, + rem_code_phase_chips, + code_phase_step_chips, + d_current_prn_length_samples); + // 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; + d_Early += (*d_Single_Early) * sec_sign_Q; + d_Prompt += (*d_Single_Prompt) * sec_sign_Q; + d_Late += (*d_Single_Late) * sec_sign_Q; + d_Prompt_data=(*d_Single_Prompt_data); d_Prompt_data *= sec_sign_I; d_integration_counter++; - // check for samples consistency (this should be done before in the receiver / here only if the source is a file) - if (std::isnan((d_Prompt).real()) == true or std::isnan((d_Prompt).imag()) == true ) // or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true) - { - const int samples_available = ninput_items[0]; - d_sample_counter = d_sample_counter + samples_available; - LOG(WARNING) << "Detected NaN samples at sample number " << d_sample_counter; - consume_each(samples_available); - - // 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; - current_synchro_data.Tracking_timestamp_secs = static_cast(d_sample_counter) / static_cast(d_fs_in); - current_synchro_data.Carrier_phase_rads = 0.0; - current_synchro_data.Code_phase_secs = 0.0; - current_synchro_data.CN0_dB_hz = 0.0; - current_synchro_data.Flag_valid_tracking = false; - - *out[0] = current_synchro_data; - - return 1; - } // ################## PLL ########################################################## // PLL discriminator if (d_integration_counter == d_current_ti_ms) @@ -709,33 +648,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_ current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz; current_synchro_data.Flag_valid_tracking = false; - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; - std::cout << "Galileo E5 Tracking CH " << d_channel << ": Satellite " - << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz] "<<"Doppler="<PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz] "<<"Doppler="<(&tmp_double), sizeof(double)); } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure & e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } @@ -832,10 +727,6 @@ int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_ 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 - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } @@ -857,7 +748,7 @@ void Galileo_E5a_Dll_Pll_Tracking_cc::set_channel(unsigned int channel) d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str() << std::endl; } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what() << std::endl; } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.h index ae06357c0..e79623509 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.h @@ -46,7 +46,7 @@ #include "gnss_synchro.h" #include "tracking_2nd_DLL_filter.h" #include "tracking_2nd_PLL_filter.h" -#include "correlator.h" +#include "cpu_multicorrelator.h" class Galileo_E5a_Dll_Pll_Tracking_cc; @@ -114,8 +114,6 @@ private: float dll_bw_init_hz, int ti_ms, float early_late_space_chips); - void update_local_code(); - void update_local_carrier(); void acquire_secondary(); // tracking configuration vars boost::shared_ptr d_queue; @@ -128,7 +126,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; long d_if_freq; long d_fs_in; @@ -141,22 +138,23 @@ private: gr_complex* d_codeQ; gr_complex* d_codeI; - gr_complex* d_early_code; - gr_complex* d_late_code; - gr_complex* d_prompt_code; - gr_complex* d_prompt_data_code; - gr_complex* d_carr_sign; - gr_complex d_Early; gr_complex d_Prompt; gr_complex d_Late; gr_complex d_Prompt_data; + gr_complex* d_Single_Early; + gr_complex* d_Single_Prompt; + gr_complex* d_Single_Late; + gr_complex* d_Single_Prompt_data; + + float tmp_E; float tmp_P; float tmp_L; // remaining code phase and carrier phase between tracking loops double d_rem_code_phase_samples; + double d_rem_code_phase_chips; double d_rem_carr_phase_rad; // PLL and DLL filter library @@ -167,7 +165,11 @@ private: double d_acq_code_phase_samples; double d_acq_carrier_doppler_hz; // correlator - Correlator d_correlator; + int d_n_correlator_taps; + float* d_local_code_shift_chips; + gr_complex* d_correlator_outs; + cpu_multicorrelator multicorrelator_cpu_I; + cpu_multicorrelator multicorrelator_cpu_Q; // tracking vars double d_code_freq_chips; @@ -176,6 +178,9 @@ private: double d_code_phase_samples; double d_acc_code_phase_secs; double d_code_error_filt_secs; + double d_code_phase_step_chips; + double d_carrier_phase_step_rad; + //PRN period in samples int d_current_prn_length_samples; 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 deleted file mode 100644 index 7d8216886..000000000 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.cc +++ /dev/null @@ -1,690 +0,0 @@ -/*! - * \file gps_l1_ca_dll_fll_pll_tracking_cc.cc - * \brief Implementation of a code DLL + carrier FLL/PLL tracking block - * \author Javier Arribas, 2011. jarribas(at)cttc.es - * - * This file implements the code Delay Locked Loop (DLL) + carrier - * Phase Locked Loop (PLL) helped with a carrier Frequency Locked Loop (FLL) - * according to the algorithms described in: - * E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and - * Applications, Second Edition, Artech House Publishers, 2005. - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#include "gps_l1_ca_dll_fll_pll_tracking_cc.h" -#include -#include -#include -#include -#include -#include -#include -#include "gps_sdr_signal_processing.h" -#include "GPS_L1_CA.h" -#include "tracking_discriminators.h" -#include "lock_detectors.h" -#include "control_message_factory.h" - - -/*! - * \todo Include in definition header file - */ -#define CN0_ESTIMATION_SAMPLES 20 -#define MINIMUM_VALID_CN0 25 -#define MAXIMUM_LOCK_FAIL_COUNTER 50 -#define CARRIER_LOCK_THRESHOLD 0.85 - -using google::LogMessage; - -gps_l1_ca_dll_fll_pll_tracking_cc_sptr gps_l1_ca_dll_fll_pll_make_tracking_cc( - long if_freq, - long fs_in, - unsigned - int vector_length, - boost::shared_ptr queue, - bool dump, std::string dump_filename, - int order, - float fll_bw_hz, - float pll_bw_hz, - float dll_bw_hz, - float early_late_space_chips) -{ - return gps_l1_ca_dll_fll_pll_tracking_cc_sptr(new Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(if_freq, - fs_in, vector_length, queue, dump, dump_filename, order, fll_bw_hz, pll_bw_hz,dll_bw_hz, - early_late_space_chips)); -} - - - - -void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - if (noutput_items != 0) - { - ninput_items_required[0] = d_vector_length * 2; //set the required available samples in each call - } -} - - -Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc( - long if_freq, - long fs_in, - unsigned int vector_length, - boost::shared_ptr queue, - bool dump, - std::string dump_filename, - int order, - float fll_bw_hz, - float pll_bw_hz, - float dll_bw_hz, - float early_late_space_chips) : - gr::block("Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), - gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) -{ - // Telemetry bit synchronization message port input - this->message_port_register_in(pmt::mp("preamble_timestamp_s")); - // initialize internal vars - d_queue = queue; - d_dump = dump; - - d_acquisition_gnss_synchro = NULL; - - d_if_freq = static_cast(if_freq); - d_fs_in = static_cast(fs_in); - d_vector_length = vector_length; - d_early_late_spc_chips = static_cast(early_late_space_chips); // Define early-late offset (in chips) - d_dump_filename = dump_filename; - - // Initialize tracking variables ========================================== - d_carrier_loop_filter.set_params(fll_bw_hz, pll_bw_hz,order); - - d_code_loop_filter = Tracking_2nd_DLL_filter(GPS_L1_CA_CODE_PERIOD); - d_code_loop_filter.set_DLL_BW(dll_bw_hz); - - // Get space for a vector with the C/A code replica sampled 1x/chip - d_ca_code = static_cast(volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment())); - - // Get space for the resampled early / prompt / late local replicas - d_early_code = static_cast(volk_malloc(2*d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_prompt_code = static_cast(volk_malloc(2*d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_late_code = static_cast(volk_malloc(2*d_vector_length * sizeof(gr_complex), volk_get_alignment())); - - // space for carrier wipeoff and signal baseband vectors - d_carr_sign = static_cast(volk_malloc(2*d_vector_length * sizeof(gr_complex), volk_get_alignment())); - - // correlator outputs (scalar) - d_Early = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Prompt = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Late = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - - // sample synchronization - d_sample_counter = 0; - d_acq_sample_stamp = 0; - d_last_seg = 0;// this is for debug output only - d_code_phase_samples = 0; - d_enable_tracking = false; - d_current_prn_length_samples = static_cast(d_vector_length); - - // CN0 estimation and lock detector buffers - d_cn0_estimation_counter = 0; - d_Prompt_buffer = new gr_complex[CN0_ESTIMATION_SAMPLES]; - d_carrier_lock_test = 1; - d_CN0_SNV_dB_Hz = 0; - d_carrier_lock_fail_counter = 0; - d_carrier_lock_threshold = CARRIER_LOCK_THRESHOLD; - - systemName["G"] = std::string("GPS"); - systemName["R"] = std::string("GLONASS"); - systemName["S"] = std::string("SBAS"); - systemName["E"] = std::string("Galileo"); - systemName["C"] = std::string("Compass"); - - d_channel_internal_queue = 0; - //d_acquisition_gnss_synchro = 0; - d_channel = 0; - d_acq_carrier_doppler_hz = 0.0; - d_carrier_doppler_hz = 0; - d_code_freq_hz = 0.0; - d_rem_carr_phase = 0.0; - d_rem_code_phase_samples = 0.0; - d_acq_code_phase_samples = 0; - d_acq_carrier_doppler_hz = 0.0; - d_acc_carrier_phase_rad = 0.0; - d_acc_code_phase_samples = 0; - d_FLL_discriminator_hz = 0.0; - d_pull_in = false; - d_FLL_wait = 1; -} - - - - -void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::start_tracking() -{ - /* - * correct the code phase according to the delay between acq and trk - */ - d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples; - d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; - d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; - - long int acq_trk_diff_samples; - float acq_trk_diff_seconds; - acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp); - acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / d_fs_in; - //doppler effect - // Fd=(C/(C+Vr))*F - double radial_velocity; - radial_velocity = (GPS_L1_FREQ_HZ + d_acq_carrier_doppler_hz) / GPS_L1_FREQ_HZ; - // new chip and prn sequence periods based on acq Doppler - double T_chip_mod_seconds; - double T_prn_mod_seconds; - double T_prn_mod_samples; - d_code_freq_hz = radial_velocity * GPS_L1_CA_CODE_RATE_HZ; - T_chip_mod_seconds = 1 / d_code_freq_hz; - T_prn_mod_seconds = T_chip_mod_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; - T_prn_mod_samples = T_prn_mod_seconds * d_fs_in; - d_current_prn_length_samples = round(T_prn_mod_samples); - - double T_prn_true_seconds = GPS_L1_CA_CODE_LENGTH_CHIPS / GPS_L1_CA_CODE_RATE_HZ; - double T_prn_true_samples = T_prn_true_seconds * d_fs_in; - double T_prn_diff_seconds; - T_prn_diff_seconds = T_prn_true_seconds - T_prn_mod_seconds; - double N_prn_diff; - N_prn_diff = acq_trk_diff_seconds / T_prn_true_seconds; - double corrected_acq_phase_samples, delay_correction_samples; - corrected_acq_phase_samples = fmod((d_acq_code_phase_samples + T_prn_diff_seconds * N_prn_diff * d_fs_in), T_prn_true_samples); - - if (corrected_acq_phase_samples < 0) - { - corrected_acq_phase_samples = T_prn_mod_samples + corrected_acq_phase_samples; - } - delay_correction_samples = d_acq_code_phase_samples - corrected_acq_phase_samples; - d_acq_code_phase_samples = corrected_acq_phase_samples; - - d_carrier_doppler_hz = d_acq_carrier_doppler_hz; - // DLL/PLL filter initialization - d_carrier_loop_filter.initialize(d_acq_carrier_doppler_hz); - d_FLL_wait = 1; - - // generate local reference ALWAYS starting at chip 1 (1 sample per chip) - gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0); - - d_ca_code[0] = d_ca_code[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS)]; - d_ca_code[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) + 1] = d_ca_code[1]; - - d_carrier_lock_fail_counter = 0; - d_Prompt_prev = 0; - d_rem_code_phase_samples = 0; - d_rem_carr_phase = 0; - d_FLL_discriminator_hz = 0; - d_rem_code_phase_samples = 0; - d_acc_carrier_phase_rad = 0; - - std::string sys_ = &d_acquisition_gnss_synchro->System; - 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; - LOG(INFO) << "Starting tracking of satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << " on channel " << d_channel; - - // enable tracking Gnss_Satellite(systemName[&d_acquisition_gnss_synchro->System], d_acquisition_gnss_synchro->PRN) - d_pull_in = true; - d_enable_tracking = true; - - 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 << std::endl; -} - - - - - -void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_code() -{ - double tcode_chips; - double rem_code_phase_chips; - double code_phase_step_chips; - int early_late_spc_samples; - int epl_loop_length_samples; - - int associated_chip_index; - int code_length_chips = static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS); - code_phase_step_chips = d_code_freq_hz / d_fs_in; - rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in); - // unified loop for E, P, L code vectors - tcode_chips = -rem_code_phase_chips; - // Alternative EPL code generation (40% of speed improvement!) - early_late_spc_samples = round(d_early_late_spc_chips/code_phase_step_chips); - epl_loop_length_samples = d_current_prn_length_samples + early_late_spc_samples*2; - for (int i = 0; i < epl_loop_length_samples; i++) - { - 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]; - tcode_chips = tcode_chips + code_phase_step_chips; - } - - memcpy(d_prompt_code, &d_early_code[early_late_spc_samples], d_current_prn_length_samples * sizeof(gr_complex)); - memcpy(d_late_code, &d_early_code[early_late_spc_samples*2], d_current_prn_length_samples * sizeof(gr_complex)); -} - - - - - -void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::update_local_carrier() -{ - double phase, phase_step; - phase_step = GPS_TWO_PI * d_carrier_doppler_hz / d_fs_in; - 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)); - phase += phase_step; - } - d_rem_carr_phase = fmod(phase, GPS_TWO_PI); - d_acc_carrier_phase_rad -= d_acc_carrier_phase_rad + phase; -} - - - -Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc() -{ - d_dump_file.close(); - - volk_free(d_ca_code); - volk_free(d_prompt_code); - volk_free(d_late_code); - volk_free(d_early_code); - volk_free(d_carr_sign); - volk_free(d_Early); - volk_free(d_Prompt); - volk_free(d_Late); - - delete[] d_Prompt_buffer; -} - - - -int Gps_L1_Ca_Dll_Fll_Pll_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) -{ - double code_error_chips = 0; - double code_error_filt_chips = 0; - double correlation_time_s = 0; - double PLL_discriminator_hz = 0; - double carr_nco_hz = 0; - // get the sample in and out pointers - const gr_complex* in = (gr_complex*) input_items[0]; // block input samples pointer - Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; // block output streams pointer - - d_Prompt_prev = *d_Prompt; // for the FLL discriminator - - if (d_enable_tracking == true) - { - // GNSS_SYNCHRO OBJECT to interchange data between tracking->telemetry_decoder - Gnss_Synchro current_synchro_data; - // Fill the acquisition data - current_synchro_data = *d_acquisition_gnss_synchro; - /* - * Receiver signal alignment - */ - if (d_pull_in == true) - { - int samples_offset; - double acq_trk_shif_correction_samples; - int acq_to_trk_delay_samples; - acq_to_trk_delay_samples = d_sample_counter - d_acq_sample_stamp; - acq_trk_shif_correction_samples = d_current_prn_length_samples - fmod(static_cast(acq_to_trk_delay_samples), static_cast(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 - d_pull_in = false; - consume_each(samples_offset); //shift input to perform alignment with local replica - - // 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; - current_synchro_data.Tracking_timestamp_secs = static_cast(d_sample_counter) / d_fs_in; - current_synchro_data.Carrier_phase_rads = 0.0; - current_synchro_data.Code_phase_secs = 0.0; - current_synchro_data.CN0_dB_hz = 0.0; - current_synchro_data.Flag_valid_tracking = false; - current_synchro_data.Flag_valid_pseudorange = false; - - *out[0] = current_synchro_data; - - return 1; - } - - update_local_code(); - update_local_carrier(); - - // perform Early, Prompt and Late correlation - d_correlator.Carrier_wipeoff_and_EPL_volk(d_current_prn_length_samples, - in, - d_carr_sign, - d_early_code, - d_prompt_code, - d_late_code, - d_Early, - d_Prompt, - d_Late); - // check for samples consistency (this should be done before in the receiver / here only if the source is a file) - if (std::isnan((*d_Prompt).real()) == true or std::isnan((*d_Prompt).imag()) == true )// or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true) - { - const int samples_available = ninput_items[0]; - d_sample_counter = d_sample_counter + samples_available; - LOG(WARNING) << "Detected NaN samples at sample number " << d_sample_counter; - consume_each(samples_available); - - // 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; - current_synchro_data.Tracking_timestamp_secs = static_cast(d_sample_counter) / d_fs_in; - current_synchro_data.Carrier_phase_rads = 0.0; - current_synchro_data.Code_phase_secs = 0.0; - current_synchro_data.CN0_dB_hz = 0.0; - current_synchro_data.Flag_valid_tracking = false; - current_synchro_data.Flag_valid_pseudorange = false; - - *out[0] = current_synchro_data; - - return 1; - } - - /* - * DLL, FLL, and PLL discriminators - */ - // Compute DLL error - code_error_chips = dll_nc_e_minus_l_normalized(*d_Early, *d_Late); - // Compute DLL filtered error - code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); - - //compute FLL error - correlation_time_s = (static_cast(d_current_prn_length_samples)) / d_fs_in; - if (d_FLL_wait == 1) - { - d_Prompt_prev = *d_Prompt; - d_FLL_discriminator_hz = 0.0; - d_FLL_wait = 0; - } - else - { - d_FLL_discriminator_hz = fll_four_quadrant_atan(d_Prompt_prev, *d_Prompt, 0, correlation_time_s) / GPS_TWO_PI; - d_Prompt_prev = *d_Prompt; - d_FLL_wait = 1; - } - - // Compute PLL error - PLL_discriminator_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / GPS_TWO_PI; - - /* - * 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); - - /*! - * \todo Improve the lock detection algorithm! - */ - // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### - if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) - { - // fill buffer with prompt correlator output values - d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; - d_cn0_estimation_counter++; - } - else - { - d_cn0_estimation_counter = 0; - //d_CN0_SNV_dB_Hz = gps_l1_ca_CN0_SNV(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in); - d_CN0_SNV_dB_Hz = cn0_svn_estimator(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES, d_fs_in, GPS_L1_CA_CODE_LENGTH_CHIPS); - - d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer, CN0_ESTIMATION_SAMPLES); - // ###### TRACKING UNLOCK NOTIFICATION ##### - if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < MINIMUM_VALID_CN0) - { - d_carrier_lock_fail_counter++; - } - else - { - if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; - } - if (d_carrier_lock_fail_counter > MAXIMUM_LOCK_FAIL_COUNTER) - { - std::cout << "Loss of lock in channel " << d_channel << "!" << std::endl; - LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; - std::unique_ptr cmf(new ControlMessageFactory()); - if (d_queue != gr::msg_queue::sptr()) - { - d_queue->handle(cmf->GetQueueMessage(d_channel, 2)); - } - d_carrier_lock_fail_counter = 0; - d_enable_tracking = false; // TODO: check if disabling tracking is consistent with the channel state machine - } - } - - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter/d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; - LOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } - else - { - if (floor(d_sample_counter/d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter/d_fs_in); - LOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } - - //predict the next loop PRN period length prediction - double T_chip_seconds; - double T_prn_seconds; - double T_prn_samples; - double K_blk_samples; - T_chip_seconds = 1 / static_cast(d_code_freq_hz); - T_prn_seconds = T_chip_seconds * GPS_L1_CA_CODE_LENGTH_CHIPS; - T_prn_samples = T_prn_seconds * d_fs_in; - - float code_error_filt_samples; - code_error_filt_samples = GPS_L1_CA_CODE_PERIOD * code_error_filt_chips * GPS_L1_CA_CHIP_PERIOD * static_cast(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; - d_current_prn_length_samples = round(K_blk_samples); //round to a discrete sample - //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 = static_cast((*d_Prompt).real()); - current_synchro_data.Prompt_Q = static_cast((*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 + (double)d_rem_code_phase_samples) / (double)d_fs_in; - current_synchro_data.Tracking_timestamp_secs = (static_cast(d_sample_counter) + static_cast(d_rem_code_phase_samples))/static_cast(d_fs_in); - 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, Code_phase_secs=0 - current_synchro_data.Code_phase_secs = 0; - current_synchro_data.Carrier_phase_rads = d_acc_carrier_phase_rad; - current_synchro_data.Carrier_Doppler_hz = d_carrier_doppler_hz; - current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz; - current_synchro_data.Flag_valid_tracking = true; - current_synchro_data.Flag_valid_symbol_output = true; - current_synchro_data.correlation_length_ms = 1; - current_synchro_data.Flag_valid_pseudorange = false; - *out[0] = current_synchro_data; - } - else - { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - } - *d_Early = gr_complex(0,0); - *d_Prompt = gr_complex(0,0); - *d_Late = gr_complex(0,0); - - Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; //block output streams pointer - d_acquisition_gnss_synchro->Flag_valid_pseudorange = false; - d_acquisition_gnss_synchro->Flag_valid_symbol_output = false; - *out[0] = *d_acquisition_gnss_synchro; - } - - - if(d_dump) - { - // 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).real(); - prompt_Q = (*d_Prompt).imag(); - tmp_E = std::abs(*d_Early); - tmp_P = std::abs(*d_Prompt); - tmp_L = std::abs(*d_Late); - try - { - // EPR - d_dump_file.write((char*)&tmp_E, sizeof(float)); - 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) - d_dump_file.write((char*)&prompt_I, sizeof(float)); - d_dump_file.write((char*)&prompt_Q, sizeof(float)); - // PRN start sample stamp - d_dump_file.write((char*)&d_sample_counter, sizeof(unsigned long int)); - // accumulated carrier phase - tmp_float = (float)d_acc_carrier_phase_rad; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - - // carrier and code frequency - tmp_float = (float)d_carrier_doppler_hz; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - tmp_float = (float)d_code_freq_hz; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - - //PLL commands - tmp_float = (float)PLL_discriminator_hz; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - tmp_float = (float)carr_nco_hz; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - - //DLL commands - tmp_float = (float)code_error_chips; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - tmp_float = (float)code_error_filt_chips; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - - // CN0 and carrier lock test - tmp_float = (float)d_CN0_SNV_dB_Hz; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - tmp_float = (float)d_carrier_lock_test; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - - // AUX vars (for debug purposes) - tmp_float = (float)d_rem_code_phase_samples; - d_dump_file.write((char*)&tmp_float, sizeof(float)); - tmp_double = (double)(d_sample_counter + d_current_prn_length_samples); - d_dump_file.write((char*)&tmp_double, sizeof(double)); - } - catch (std::ifstream::failure e) - { - LOG(INFO) << "Exception writing trk dump file "<< e.what() << std::endl; - } - } - consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates - d_sample_counter += d_current_prn_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } - return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false -} - - -void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_channel(unsigned int channel) -{ - d_channel = channel; - LOG(INFO) << "Tracking Channel set to " << d_channel; - // ############# ENABLE DATA FILE LOG ################# - if (d_dump == true) - { - if (d_dump_file.is_open() == false) - { - try - { - d_dump_filename.append(boost::lexical_cast(d_channel)); - d_dump_filename.append(".dat"); - d_dump_file.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); - d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); - LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); - } - catch (std::ifstream::failure e) - { - LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); - } - } - } -} - - - -void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_channel_queue(concurrent_queue *channel_internal_queue) -{ - d_channel_internal_queue = channel_internal_queue; -} - -void Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) -{ - d_acquisition_gnss_synchro=p_gnss_synchro; -} diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.h deleted file mode 100644 index 3213821cf..000000000 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_fll_pll_tracking_cc.h +++ /dev/null @@ -1,206 +0,0 @@ -/*! - * \file gps_l1_ca_dll_fll_pll_tracking_cc.h - * \brief Interface of a code DLL + carrier FLL/PLL tracking block - * \author Javier Arribas, 2011. jarribas(at)cttc.es - * - * This is the interface of a code Delay Locked Loop (DLL) + - * carrier Phase Locked Loop (PLL) helped with a carrier Frequency Locked - * Loop (FLL) according to the algorithms described in: - * E.D. Kaplan and C. Hegarty, Understanding GPS. Principles and - * Applications, Second Edition, Artech House Publishers, 2005. - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_GPS_L1_CA_DLL_FLL_PLL_TRACKING_CC_H -#define GNSS_SDR_GPS_L1_CA_DLL_FLL_PLL_TRACKING_CC_H - -#include -#include -#include -#include -#include -#include "concurrent_queue.h" -#include "tracking_FLL_PLL_filter.h" -#include "tracking_2nd_DLL_filter.h" -#include "gnss_synchro.h" -#include "correlator.h" - -class Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc; - -typedef boost::shared_ptr -gps_l1_ca_dll_fll_pll_tracking_cc_sptr; - -gps_l1_ca_dll_fll_pll_tracking_cc_sptr -gps_l1_ca_dll_fll_pll_make_tracking_cc( - long if_freq, - long fs_in, - unsigned int vector_length, - boost::shared_ptr queue, - bool dump, - std::string dump_filename, - int order, - float fll_bw_hz, - float pll_bw_hz, - float dll_bw_hz, - float early_late_space_chips); - - -/*! - * \brief This class implements a DLL and a FLL assisted PLL tracking loop block - */ -class Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc: public gr::block -{ -public: - ~Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc(); - - void set_channel(unsigned int channel); - void start_tracking(); - void update_local_code(); - void update_local_carrier(); - void set_FLL_and_PLL_BW(float fll_bw_hz,float pll_bw_hz); - /* - * \brief Satellite signal synchronization parameters uses shared memory between acquisition and tracking - */ - void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); - void set_channel_queue(concurrent_queue *channel_internal_queue); - - /* - * \brief just like gr_block::general_work, only this arranges to call consume_each for you - * - * The user must override work to define the signal processing code - */ - - int general_work (int noutput_items, gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); - - void forecast (int noutput_items, gr_vector_int &ninput_items_required); -private: - friend gps_l1_ca_dll_fll_pll_tracking_cc_sptr - gps_l1_ca_dll_fll_pll_make_tracking_cc( - long if_freq, - long fs_in, unsigned - int vector_length, - boost::shared_ptr queue, - bool dump, - std::string dump_filename, - int order, - float fll_bw_hz, - float pll_bw_hz, - float dll_bw_hz, - float early_late_space_chips); - - Gps_L1_Ca_Dll_Fll_Pll_Tracking_cc( - long if_freq, - long fs_in, unsigned - int vector_length, - boost::shared_ptr queue, - bool dump, - std::string dump_filename, - int order, - float fll_bw_hz, - float pll_bw_hz, - float dll_bw_hz, - float early_late_space_chips); - - void CN0_estimation_and_lock_detectors(); - - // class private vars - Gnss_Synchro* d_acquisition_gnss_synchro; - boost::shared_ptr d_queue; - concurrent_queue *d_channel_internal_queue; - unsigned int d_vector_length; - bool d_dump; - unsigned int d_channel; - int d_last_seg; - double d_if_freq; - double d_fs_in; - - gr_complex* d_ca_code; - - gr_complex* d_early_code; - gr_complex* d_late_code; - gr_complex* d_prompt_code; - - gr_complex* d_carr_sign; - - gr_complex* d_Early; - gr_complex* d_Prompt; - gr_complex* d_Late; - - gr_complex d_Prompt_prev; - - double d_early_late_spc_chips; - - double d_carrier_doppler_hz; - double d_code_freq_hz; - double d_code_phase_samples; - int d_current_prn_length_samples; - //int d_next_prn_length_samples; - int d_FLL_wait; - double d_rem_carr_phase; - double d_rem_code_phase_samples; - //double d_next_rem_code_phase_samples; - bool d_pull_in; - - // acquisition - double d_acq_code_phase_samples; - double d_acq_carrier_doppler_hz; - - // correlator - Correlator d_correlator; - - // FLL + PLL filter - double d_FLL_discriminator_hz; // This is a class variable because FLL needs to have memory - Tracking_FLL_PLL_filter d_carrier_loop_filter; - double d_acc_carrier_phase_rad; - double d_acc_code_phase_samples; - - Tracking_2nd_DLL_filter d_code_loop_filter; - - unsigned long int d_sample_counter; - - unsigned long int d_acq_sample_stamp; - - // CN0 estimation and lock detector - int d_cn0_estimation_counter; - gr_complex* d_Prompt_buffer; - double d_carrier_lock_test; - double d_CN0_SNV_dB_Hz; - - double d_carrier_lock_threshold; - - int d_carrier_lock_fail_counter; - - bool d_enable_tracking; - - std::string d_dump_filename; - std::ofstream d_dump_file; - - std::map systemName; - std::string sys; -}; - -#endif //GNSS_SDR_GPS_L1_CA_DLL_FLL_PLL_TRACKING_CC_H diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc index 48ec51858..a0a829039 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -179,7 +179,6 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( d_enable_tracking = false; d_pull_in = false; - d_last_seg = 0; // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; @@ -320,7 +319,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::~gps_l1_ca_dll_pll_c_aid_tracking_cc() -int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers @@ -597,52 +596,9 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec current_synchro_data.correlation_length_ms = 1; *out[0] = current_synchro_data; } - - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; - DLOG(INFO) << "GPS L1 C/A Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! - } - } - else - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - DLOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } } else { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - } for (int n = 0; n < d_n_correlator_taps; n++) { d_correlator_outs[n] = gr_complex(0,0); @@ -712,10 +668,6 @@ int gps_l1_ca_dll_pll_c_aid_tracking_cc::general_work (int noutput_items, gr_vec consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_correlation_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h index c32f94ea7..338d6441b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h @@ -126,7 +126,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; long d_if_freq; long d_fs_in; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc index ae4c050e1..f768f7bf4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -161,7 +161,6 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc( d_enable_tracking = false; d_pull_in = false; - d_last_seg = 0; // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; @@ -294,7 +293,7 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::~gps_l1_ca_dll_pll_c_aid_tracking_sc() -int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items, gr_vector_int &ninput_items, +int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers @@ -453,51 +452,10 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items, gr_vec current_synchro_data.correlation_length_ms = 1; *out[0] = current_synchro_data; - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; - DLOG(INFO) << "GPS L1 C/A Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; - //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! - } - } - else - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - DLOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } } else { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - } for (int n = 0; n < d_n_correlator_taps; n++) { d_correlator_outs_16sc[n] = lv_16sc_t(0,0); @@ -567,10 +525,6 @@ int gps_l1_ca_dll_pll_c_aid_tracking_sc::general_work (int noutput_items, gr_vec consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_correlation_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h index ab0efd957..bf97b9a44 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h @@ -125,7 +125,7 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; + long d_if_freq; long d_fs_in; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc index 26d8fc5ef..8d02ca1b9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc @@ -123,21 +123,22 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( // Initialization of local code replica // Get space for a vector with the C/A code replica sampled 1x/chip - d_ca_code = static_cast(volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment())); - - // Get space for the resampled early / prompt / late local replicas - d_early_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_prompt_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_late_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - - // space for carrier wipeoff and signal baseband vectors - d_carr_sign = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); + d_ca_code = static_cast(volk_malloc(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_get_alignment())); // correlator outputs (scalar) - d_Early = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Prompt = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Late = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); + d_n_correlator_taps = 3; // Early, Prompt, and Late + d_correlator_outs = static_cast(volk_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_get_alignment())); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } + d_local_code_shift_chips = static_cast(volk_malloc(d_n_correlator_taps*sizeof(float), volk_get_alignment())); + // Set TAPs delay values [chips] + d_local_code_shift_chips[0] = - d_early_late_spc_chips; + d_local_code_shift_chips[1] = 0.0; + d_local_code_shift_chips[2] = d_early_late_spc_chips; + multicorrelator_cpu.init(2 * d_vector_length, d_n_correlator_taps); //--- Perform initializations ------------------------------ // define initial code frequency basis of NCO @@ -154,7 +155,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( d_enable_tracking = false; d_pull_in = false; - d_last_seg = 0; + d_current_prn_length_samples = static_cast(d_vector_length); @@ -169,9 +170,6 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); - - set_relative_rate(1.0/((double)d_vector_length*2)); - d_channel_internal_queue = 0; d_acquisition_gnss_synchro = 0; d_channel = 0; @@ -181,7 +179,8 @@ Gps_L1_Ca_Dll_Pll_Tracking_cc::Gps_L1_Ca_Dll_Pll_Tracking_cc( d_acc_carrier_phase_rad = 0.0; d_code_phase_samples = 0.0; d_acc_code_phase_secs = 0.0; - //set_min_output_buffer((long int)300); + + set_relative_rate(1.0/((double)d_vector_length*2)); } @@ -234,9 +233,13 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) - gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0); - d_ca_code[0] = d_ca_code[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS)]; - d_ca_code[static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) + 1] = d_ca_code[1]; + gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0); + + multicorrelator_cpu.set_local_code_and_taps(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } d_carrier_lock_fail_counter = 0; d_rem_code_phase_samples = 0; @@ -262,79 +265,21 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() << " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples; } - - - - -void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_code() -{ - double tcode_chips; - double rem_code_phase_chips; - int associated_chip_index; - int code_length_chips = static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS); - double code_phase_step_chips; - int early_late_spc_samples; - int epl_loop_length_samples; - - // unified loop for E, P, L code vectors - code_phase_step_chips = static_cast(d_code_freq_chips) / static_cast(d_fs_in); - rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / d_fs_in); - tcode_chips = -rem_code_phase_chips; - - // Alternative EPL code generation (40% of speed improvement!) - early_late_spc_samples = round(d_early_late_spc_chips / code_phase_step_chips); - epl_loop_length_samples = d_current_prn_length_samples + early_late_spc_samples * 2; - for (int i = 0; i < epl_loop_length_samples; i++) - { - 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]; - tcode_chips = tcode_chips + code_phase_step_chips; - } - - memcpy(d_prompt_code, &d_early_code[early_late_spc_samples], d_current_prn_length_samples * sizeof(gr_complex)); - memcpy(d_late_code, &d_early_code[early_late_spc_samples * 2], d_current_prn_length_samples * sizeof(gr_complex)); -} - - - - -void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_carrier() -{ - float sin_f, cos_f; - float phase_step_rad = static_cast(GPS_TWO_PI) * static_cast( d_if_freq + d_carrier_doppler_hz ) / static_cast(d_fs_in); - int phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad); - int phase_rad_i = gr::fxpt::float_to_fixed(d_rem_carr_phase_rad); - - for(int i = 0; i < d_current_prn_length_samples; i++) - { - gr::fxpt::sincos(phase_rad_i, &sin_f, &cos_f); - d_carr_sign[i] = std::complex(cos_f, -sin_f); - phase_rad_i += phase_step_rad_i; - } -} - - - - Gps_L1_Ca_Dll_Pll_Tracking_cc::~Gps_L1_Ca_Dll_Pll_Tracking_cc() { d_dump_file.close(); - volk_free(d_prompt_code); - volk_free(d_late_code); - volk_free(d_early_code); - volk_free(d_carr_sign); - volk_free(d_Early); - volk_free(d_Prompt); - volk_free(d_Late); + volk_free(d_local_code_shift_chips); + volk_free(d_correlator_outs); volk_free(d_ca_code); delete[] d_Prompt_buffer; + multicorrelator_cpu.free(); } -int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // process vars @@ -353,6 +298,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in if (d_enable_tracking == true) { + // Fill the acquisition data + current_synchro_data = *d_acquisition_gnss_synchro; // Receiver signal alignment if (d_pull_in == true) { @@ -364,60 +311,31 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in samples_offset = round(d_acq_code_phase_samples + acq_trk_shif_correction_samples); d_sample_counter = d_sample_counter + samples_offset; //count for the processed samples d_pull_in = false; - // Fill the acquisition data - current_synchro_data = *d_acquisition_gnss_synchro; + current_synchro_data.correlation_length_ms = 1; + current_synchro_data.Flag_valid_symbol_output = false; *out[0] = current_synchro_data; consume_each(samples_offset); //shift input to perform alignment with local replica return 1; } - // Fill the acquisition data - current_synchro_data = *d_acquisition_gnss_synchro; - - // Generate local code and carrier replicas (using \hat{f}_d(k-1)) - update_local_code(); - update_local_carrier(); - + // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation - d_correlator.Carrier_wipeoff_and_EPL_volk(d_current_prn_length_samples, - in, - d_carr_sign, - d_early_code, - d_prompt_code, - d_late_code, - d_Early, - d_Prompt, - d_Late); - - // check for samples consistency (this should be done before in the receiver / here only if the source is a file) - if (std::isnan((*d_Prompt).real()) == true or std::isnan((*d_Prompt).imag()) == true ) // or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true) - { - const int samples_available = ninput_items[0]; - d_sample_counter = d_sample_counter + samples_available; - LOG(WARNING) << "Detected NaN samples at sample number " << d_sample_counter; - consume_each(samples_available); - - // 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; - current_synchro_data.Tracking_timestamp_secs = static_cast(d_sample_counter) / static_cast(d_fs_in); - current_synchro_data.Carrier_phase_rads = 0.0; - current_synchro_data.Code_phase_secs = 0.0; - current_synchro_data.CN0_dB_hz = 0.0; - current_synchro_data.Flag_valid_tracking = false; - current_synchro_data.Flag_valid_pseudorange = false; - - *out[0] = current_synchro_data; - return 1; - } + multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in); + multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad, + d_carrier_phase_step_rad, + d_rem_code_phase_chips, + d_code_phase_step_chips, + d_current_prn_length_samples); // ################## PLL ########################################################## // PLL discriminator - carr_error_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / GPS_TWO_PI; + // Update PLL discriminator [rads/Ti -> Secs/Ti] + carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_TWO_PI; //prompt output // Carrier discriminator filter carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz); // New carrier Doppler frequency estimation d_carrier_doppler_hz = d_acq_carrier_doppler_hz + carr_error_filt_hz; + // New code Doppler frequency estimation d_code_freq_chips = GPS_L1_CA_CODE_RATE_HZ + ((d_carrier_doppler_hz * GPS_L1_CA_CODE_RATE_HZ) / GPS_L1_FREQ_HZ); //carrier phase accumulator for (K) doppler estimation @@ -428,7 +346,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in // ################## DLL ########################################################## // DLL discriminator - code_error_chips = dll_nc_e_minus_l_normalized(*d_Early, *d_Late); //[chips/Ti] + code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); //[chips/Ti] //early and late // Code discriminator filter code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second] //Code phase accumulator @@ -448,13 +366,22 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in T_prn_samples = T_prn_seconds * static_cast(d_fs_in); K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast(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 + + //################### PLL COMMANDS ################################################# + //carrier phase step (NCO phase increment per sample) [rads/sample] + d_carrier_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); + + //################### DLL COMMANDS ################################################# + //code phase step (Code resampler phase increment per sample) [chips/sample] + d_code_phase_step_chips = d_code_freq_chips / static_cast(d_fs_in); + //remnant code phase [chips] + d_rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### if (d_cn0_estimation_counter < CN0_ESTIMATION_SAMPLES) { // fill buffer with prompt correlator output values - d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; + d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; //prompt d_cn0_estimation_counter++; } else @@ -487,8 +414,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 = static_cast((*d_Prompt).real()); - current_synchro_data.Prompt_Q = static_cast((*d_Prompt).imag()); + current_synchro_data.Prompt_I = static_cast((d_correlator_outs[1]).real()); + current_synchro_data.Prompt_Q = static_cast((d_correlator_outs[1]).imag()); // Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!, but some glitches??) current_synchro_data.Tracking_timestamp_secs = (static_cast(d_sample_counter) + static_cast(d_rem_code_phase_samples)) / static_cast(d_fs_in); @@ -506,73 +433,33 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in current_synchro_data.correlation_length_ms=1; *out[0] = current_synchro_data; - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; - DLOG(INFO) << "GPS L1 C/A Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; - //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! - } - } - else - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - DLOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } } else { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (floor(d_sample_counter / d_fs_in) != d_last_seg) + for (int n = 0; n < d_n_correlator_taps; n++) { - d_last_seg = floor(d_sample_counter / d_fs_in); - - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } + d_correlator_outs[n] = gr_complex(0,0); } - *d_Early = gr_complex(0,0); - *d_Prompt = gr_complex(0,0); - *d_Late = gr_complex(0,0); current_synchro_data.System = {'G'}; current_synchro_data.Flag_valid_pseudorange = false; current_synchro_data.Flag_valid_symbol_output = false; + current_synchro_data.correlation_length_ms=1; *out[0] = current_synchro_data; } if(d_dump) { - // MULTIPLEXED FILE RECORDING - Record results to file - float prompt_I; - float prompt_Q; - float tmp_E, tmp_P, tmp_L; - double tmp_double; - prompt_I = (*d_Prompt).real(); - prompt_Q = (*d_Prompt).imag(); - tmp_E = std::abs(*d_Early); - tmp_P = std::abs(*d_Prompt); - tmp_L = std::abs(*d_Late); + // MULTIPLEXED FILE RECORDING - Record results to file + float prompt_I; + float prompt_Q; + float tmp_E, tmp_P, tmp_L; + double tmp_double; + prompt_I = d_correlator_outs[1].real(); + prompt_Q = d_correlator_outs[1].imag(); + tmp_E = std::abs(d_correlator_outs[0]); + tmp_P = std::abs(d_correlator_outs[1]); + tmp_L = std::abs(d_correlator_outs[2]); try { @@ -620,10 +507,6 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } @@ -654,14 +537,11 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel(unsigned int channel) } } - - void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_channel_queue(concurrent_queue *channel_internal_queue) { d_channel_internal_queue = channel_internal_queue; } - void Gps_L1_Ca_Dll_Pll_Tracking_cc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) { d_acquisition_gnss_synchro = p_gnss_synchro; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h index 2ff14ad71..225fd8751 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.h @@ -46,7 +46,7 @@ #include "gnss_synchro.h" #include "tracking_2nd_DLL_filter.h" #include "tracking_2nd_PLL_filter.h" -#include "correlator.h" +#include "cpu_multicorrelator.h" class Gps_L1_Ca_Dll_Pll_Tracking_cc; @@ -105,8 +105,6 @@ private: float pll_bw_hz, float dll_bw_hz, float early_late_space_chips); - void update_local_code(); - void update_local_carrier(); // tracking configuration vars boost::shared_ptr d_queue; @@ -116,25 +114,15 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; + long d_if_freq; long d_fs_in; double d_early_late_spc_chips; - gr_complex* d_ca_code; - - gr_complex* d_early_code; - gr_complex* d_late_code; - gr_complex* d_prompt_code; - gr_complex* d_carr_sign; - - gr_complex *d_Early; - gr_complex *d_Prompt; - gr_complex *d_Late; - // remaining code phase and carrier phase between tracking loops double d_rem_code_phase_samples; + double d_rem_code_phase_chips; double d_rem_carr_phase_rad; // PLL and DLL filter library @@ -145,11 +133,18 @@ private: double d_acq_code_phase_samples; double d_acq_carrier_doppler_hz; // correlator - Correlator d_correlator; + int d_n_correlator_taps; + gr_complex* d_ca_code; + float* d_local_code_shift_chips; + gr_complex* d_correlator_outs; + cpu_multicorrelator multicorrelator_cpu; + // tracking vars double d_code_freq_chips; + double d_code_phase_step_chips; double d_carrier_doppler_hz; + double d_carrier_phase_step_rad; double d_acc_carrier_phase_rad; double d_code_phase_samples; double d_acc_code_phase_secs; 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 7b50d1afc..40a3fc5a0 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 @@ -156,7 +156,6 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( d_enable_tracking = false; d_pull_in = false; - d_last_seg = 0; // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; @@ -290,7 +289,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::~Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc() -int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // Block input data and block output stream pointers @@ -457,51 +456,10 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items, gr_vecto current_synchro_data.correlation_length_ms=1; *out[0] = current_synchro_data; - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; - DLOG(INFO) << "GPS L1 C/A Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl; - //if (d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock! - } - } - else - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - DLOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } } else { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - } for (int n = 0; n < d_n_correlator_taps; n++) { d_correlator_outs[n] = gr_complex(0,0); @@ -571,10 +529,6 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work (int noutput_items, gr_vecto consume_each(d_correlation_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_correlation_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h index f08e32b04..355f796bb 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h @@ -115,7 +115,7 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; + long d_if_freq; long d_fs_in; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 0ae1f08c5..5effdb9c9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -70,13 +70,11 @@ gps_l1_ca_tcp_connector_make_tracking_cc( boost::shared_ptr queue, bool dump, std::string dump_filename, - float pll_bw_hz, - float dll_bw_hz, float early_late_space_chips, size_t port_ch0) { return gps_l1_ca_tcp_connector_tracking_cc_sptr(new Gps_L1_Ca_Tcp_Connector_Tracking_cc(if_freq, - fs_in, vector_length, queue, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips, port_ch0)); + fs_in, vector_length, queue, dump, dump_filename, early_late_space_chips, port_ch0)); } @@ -99,8 +97,6 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( boost::shared_ptr queue, bool dump, std::string dump_filename, - float pll_bw_hz, - float dll_bw_hz, float early_late_space_chips, size_t port_ch0) : gr::block("Gps_L1_Ca_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), @@ -116,10 +112,6 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( d_vector_length = vector_length; d_dump_filename = dump_filename; - // Initialize tracking ========================================== - d_code_loop_filter.set_DLL_BW(dll_bw_hz); - d_carrier_loop_filter.set_PLL_BW(pll_bw_hz); - //--- DLL variables -------------------------------------------------------- d_early_late_spc_chips = early_late_space_chips; // Define early-late offset (in chips) @@ -131,21 +123,29 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( // Initialization of local code replica // Get space for a vector with the C/A code replica sampled 1x/chip - d_ca_code = static_cast(volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment())); - d_carr_sign = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - - // Get space for the resampled early / prompt / late local replicas - d_early_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_prompt_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_late_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - - // space for carrier wipeoff and signal baseband vectors - d_carr_sign = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); + d_ca_code = static_cast(volk_malloc((GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_get_alignment())); // correlator outputs (scalar) - d_Early = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Prompt = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Late = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); + d_n_correlator_taps = 3; // Very-Early, Early, Prompt, Late, Very-Late + d_correlator_outs = static_cast(volk_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_get_alignment())); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } + // map memory pointers of correlator outputs + d_Early = &d_correlator_outs[0]; + d_Prompt = &d_correlator_outs[1]; + d_Late = &d_correlator_outs[2]; + + d_local_code_shift_chips = static_cast(volk_malloc(d_n_correlator_taps * sizeof(float), volk_get_alignment())); + // Set TAPs delay values [chips] + d_local_code_shift_chips[0] = - d_early_late_spc_chips; + d_local_code_shift_chips[1] = 0.0; + d_local_code_shift_chips[2] = d_early_late_spc_chips; + + d_correlation_length_samples=d_vector_length; + + multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); //--- Perform initializations ------------------------------ // define initial code frequency basis of NCO @@ -162,7 +162,6 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( d_enable_tracking = false; d_pull_in = false; - d_last_seg = 0; d_current_prn_length_samples = (int)d_vector_length; @@ -247,16 +246,16 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() delay_correction_samples = d_acq_code_phase_samples - corrected_acq_phase_samples; d_acq_code_phase_samples = corrected_acq_phase_samples; - d_carrier_doppler_hz = d_acq_carrier_doppler_hz; - // DLL/PLL filter initialization - d_carrier_loop_filter.initialize(); //initialize the carrier filter - d_code_loop_filter.initialize(); //initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) - gps_l1_ca_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN, 0); - d_ca_code[0] = d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS]; - d_ca_code[(int)GPS_L1_CA_CODE_LENGTH_CHIPS + 1] = d_ca_code[1]; + gps_l1_ca_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN, 0); + + multicorrelator_cpu.set_local_code_and_taps(static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } d_carrier_lock_fail_counter = 0; d_rem_code_phase_samples = 0; @@ -286,79 +285,20 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::start_tracking() - -void Gps_L1_Ca_Tcp_Connector_Tracking_cc::update_local_code() -{ - double tcode_chips; - double rem_code_phase_chips; - int associated_chip_index; - int code_length_chips = (int)GPS_L1_CA_CODE_LENGTH_CHIPS; - double code_phase_step_chips; - int early_late_spc_samples; - int epl_loop_length_samples; - - // unified loop for E, P, L code vectors - code_phase_step_chips = ((double)d_code_freq_hz) / ((double)d_fs_in); - rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in); - tcode_chips = -rem_code_phase_chips; - - // Alternative EPL code generation (40% of speed improvement!) - early_late_spc_samples = round(d_early_late_spc_chips/code_phase_step_chips); - epl_loop_length_samples = d_current_prn_length_samples+early_late_spc_samples*2; - for (int i = 0; i < epl_loop_length_samples; i++) - { - 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]; - tcode_chips = tcode_chips + d_code_phase_step_chips; - } - - memcpy(d_prompt_code,&d_early_code[early_late_spc_samples], d_current_prn_length_samples* sizeof(gr_complex)); - memcpy(d_late_code,&d_early_code[early_late_spc_samples*2], d_current_prn_length_samples* sizeof(gr_complex)); -} - - - - -void Gps_L1_Ca_Tcp_Connector_Tracking_cc::update_local_carrier() -{ - float phase_rad, phase_step_rad; - - phase_step_rad = (float)GPS_TWO_PI*d_carrier_doppler_hz / (float)d_fs_in; - 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)); - phase_rad += phase_step_rad; - } - 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; -} - - - - Gps_L1_Ca_Tcp_Connector_Tracking_cc::~Gps_L1_Ca_Tcp_Connector_Tracking_cc() { d_dump_file.close(); - volk_free(d_prompt_code); - volk_free(d_late_code); - volk_free(d_early_code); - volk_free(d_carr_sign); - volk_free(d_Early); - volk_free(d_Prompt); - volk_free(d_Late); - volk_free(d_ca_code); - delete[] d_Prompt_buffer; + volk_free(d_ca_code); + volk_free(d_local_code_shift_chips); + volk_free(d_correlator_outs); d_tcp_com.close_tcp_connection(d_port); + multicorrelator_cpu.free(); } - - - -int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // process vars @@ -405,42 +345,19 @@ int Gps_L1_Ca_Tcp_Connector_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_carrier(); + // ################# CARRIER WIPEOFF AND CORRELATORS ############################## + // perform carrier wipe-off and compute Early, Prompt and Late correlation + multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in); - // perform Early, Prompt and Late correlation - d_correlator.Carrier_wipeoff_and_EPL_volk(d_current_prn_length_samples, - in, - d_carr_sign, - d_early_code, - d_prompt_code, - d_late_code, - d_Early, - d_Prompt, - d_Late); + double carr_phase_step_rad = GPS_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); + double rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_hz / d_fs_in); - // check for samples consistency (this should be done before in the receiver / here only if the source is a file) - if (std::isnan((*d_Prompt).real()) == true or std::isnan((*d_Prompt).imag()) == true )// or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true) - { - const int samples_available = ninput_items[0]; - d_sample_counter = d_sample_counter + samples_available; - LOG(WARNING) << "Detected NaN samples at sample number " << d_sample_counter; - consume_each(samples_available); + multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad, + carr_phase_step_rad, + rem_code_phase_chips, + d_code_phase_step_chips, + d_current_prn_length_samples); - // 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; - current_synchro_data.Tracking_timestamp_secs = d_sample_counter_seconds; - current_synchro_data.Carrier_phase_rads = 0.0; - current_synchro_data.Code_phase_secs = 0.0; - current_synchro_data.CN0_dB_hz = 0.0; - current_synchro_data.Flag_valid_tracking = false; - current_synchro_data.Flag_valid_pseudorange = false; - current_synchro_data.Flag_valid_symbol_output = true; - *out[0] = current_synchro_data; - - return 1; - } //! Variable used for control d_control_id++; @@ -552,51 +469,10 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec current_synchro_data.Flag_valid_symbol_output = true; current_synchro_data.correlation_length_ms=1; *out[0] = current_synchro_data; - - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl; - LOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } - else - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - LOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - } - } } else { - // ########## DEBUG OUTPUT (TIME ONLY for channel 0 when tracking is disabled) - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // stream to collect cout calls to improve thread safety - std::stringstream tmp_str_stream; - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - d_last_seg = floor(d_sample_counter / d_fs_in); - if (d_channel == 0) - { - // debug: Second counter in channel 0 - tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush; - std::cout << tmp_str_stream.rdbuf() << std::flush; - } - } *d_Early = gr_complex(0,0); *d_Prompt = gr_complex(0,0); *d_Late = gr_complex(0,0); @@ -658,7 +534,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec d_dump_file.write((char*)&tmp_float, sizeof(float)); d_dump_file.write((char*)&d_sample_counter_seconds, sizeof(double)); } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure &e) { LOG(WARNING) << "Exception writing trk dump file " << e.what(); } @@ -667,10 +543,7 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work (int noutput_items, gr_vec consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates d_sample_counter_seconds = d_sample_counter_seconds + ( ((double)d_current_prn_length_samples) / (double)d_fs_in ); d_sample_counter += d_current_prn_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } + return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } @@ -693,7 +566,7 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::set_channel(unsigned int channel) d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary); LOG(INFO) << "Tracking dump enabled on channel " << d_channel << " Log file: " << d_dump_filename.c_str(); } - catch (std::ifstream::failure e) + catch (const std::ifstream::failure &e) { LOG(WARNING) << "channel " << d_channel << " Exception opening trk dump file " << e.what(); } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h index d272b1639..a886cc887 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h @@ -44,9 +44,7 @@ #include #include "concurrent_queue.h" #include "gnss_synchro.h" -#include "tracking_2nd_DLL_filter.h" -#include "tracking_2nd_PLL_filter.h" -#include "correlator.h" +#include "cpu_multicorrelator.h" #include "tcp_communication.h" @@ -62,8 +60,6 @@ gps_l1_ca_tcp_connector_make_tracking_cc(long if_freq, boost::shared_ptr queue, bool dump, std::string dump_filename, - float pll_bw_hz, - float dll_bw_hz, float early_late_space_chips, size_t port_ch0); @@ -98,8 +94,6 @@ private: boost::shared_ptr queue, bool dump, std::string dump_filename, - float pll_bw_hz, - float dll_bw_hz, float early_late_space_chips, size_t port_ch0); @@ -109,12 +103,8 @@ private: boost::shared_ptr queue, bool dump, std::string dump_filename, - float pll_bw_hz, - float dll_bw_hz, float early_late_space_chips, size_t port_ch0); - void update_local_code(); - void update_local_carrier(); // tracking configuration vars boost::shared_ptr d_queue; @@ -124,21 +114,17 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; + long d_if_freq; long d_fs_in; - + int d_correlation_length_samples; + int d_n_correlator_taps; double d_early_late_spc_chips; double d_code_phase_step_chips; gr_complex* d_ca_code; - gr_complex* d_early_code; - gr_complex* d_late_code; - gr_complex* d_prompt_code; - gr_complex* d_carr_sign; - gr_complex *d_Early; gr_complex *d_Prompt; gr_complex *d_Late; @@ -148,15 +134,13 @@ private: double d_next_rem_code_phase_samples; float d_rem_carr_phase_rad; - // PLL and DLL filter library - Tracking_2nd_DLL_filter d_code_loop_filter; - Tracking_2nd_PLL_filter d_carrier_loop_filter; - // acquisition float d_acq_code_phase_samples; float d_acq_carrier_doppler_hz; // correlator - Correlator d_correlator; + float* d_local_code_shift_chips; + gr_complex* d_correlator_outs; + cpu_multicorrelator multicorrelator_cpu; // tracking vars double d_code_freq_hz; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.cc index 828b4142e..999ee26b4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.cc @@ -126,20 +126,22 @@ gps_l2_m_dll_pll_tracking_cc::gps_l2_m_dll_pll_tracking_cc( // Initialization of local code replica // Get space for a vector with the C/A code replica sampled 1x/chip - d_ca_code = static_cast(volk_malloc((GPS_L2_M_CODE_LENGTH_CHIPS + 2) * sizeof(gr_complex), volk_get_alignment())); - - // Get space for the resampled early / prompt / late local replicas - d_early_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_prompt_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - d_late_code = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); - - // space for carrier wipeoff and signal baseband vectors - d_carr_sign = static_cast(volk_malloc(2 * d_vector_length * sizeof(gr_complex), volk_get_alignment())); + d_ca_code = static_cast(volk_malloc(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) * sizeof(gr_complex), volk_get_alignment())); // correlator outputs (scalar) - d_Early = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Prompt = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); - d_Late = static_cast(volk_malloc(sizeof(gr_complex), volk_get_alignment())); + d_n_correlator_taps = 3; // Early, Prompt, and Late + d_correlator_outs = static_cast(volk_malloc(d_n_correlator_taps*sizeof(gr_complex), volk_get_alignment())); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } + d_local_code_shift_chips = static_cast(volk_malloc(d_n_correlator_taps*sizeof(float), volk_get_alignment())); + // Set TAPs delay values [chips] + d_local_code_shift_chips[0] = - d_early_late_spc_chips; + d_local_code_shift_chips[1] = 0.0; + d_local_code_shift_chips[2] = d_early_late_spc_chips; + + multicorrelator_cpu.init(2 * d_vector_length, d_n_correlator_taps); //--- Perform initializations ------------------------------ @@ -157,7 +159,6 @@ gps_l2_m_dll_pll_tracking_cc::gps_l2_m_dll_pll_tracking_cc( d_enable_tracking = false; d_pull_in = false; - d_last_seg = 0; d_current_prn_length_samples = static_cast(d_vector_length); @@ -237,9 +238,13 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking() d_code_loop_filter.initialize(); // initialize the code filter // generate local reference ALWAYS starting at chip 1 (1 sample per chip) - gps_l2c_m_code_gen_complex(&d_ca_code[1], d_acquisition_gnss_synchro->PRN); - d_ca_code[0] = d_ca_code[static_cast(GPS_L2_M_CODE_LENGTH_CHIPS)]; - d_ca_code[static_cast(GPS_L2_M_CODE_LENGTH_CHIPS) + 1] = d_ca_code[1]; + gps_l2c_m_code_gen_complex(d_ca_code, d_acquisition_gnss_synchro->PRN); + + multicorrelator_cpu.set_local_code_and_taps(static_cast(GPS_L2_M_CODE_LENGTH_CHIPS), d_ca_code, d_local_code_shift_chips); + for (int n = 0; n < d_n_correlator_taps; n++) + { + d_correlator_outs[n] = gr_complex(0,0); + } d_carrier_lock_fail_counter = 0; d_rem_code_phase_samples = 0; @@ -266,77 +271,21 @@ void gps_l2_m_dll_pll_tracking_cc::start_tracking() << " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples; } - - - - -void gps_l2_m_dll_pll_tracking_cc::update_local_code() -{ - double tcode_chips; - double rem_code_phase_chips; - int associated_chip_index; - int code_length_chips = static_cast(GPS_L2_M_CODE_LENGTH_CHIPS); - double code_phase_step_chips; - int early_late_spc_samples; - int epl_loop_length_samples; - - // unified loop for E, P, L code vectors - code_phase_step_chips = d_code_freq_chips / static_cast(d_fs_in); - rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / d_fs_in); - tcode_chips = -rem_code_phase_chips; - - // Alternative EPL code generation (40% of speed improvement!) - early_late_spc_samples = round(d_early_late_spc_chips / code_phase_step_chips); - epl_loop_length_samples = d_current_prn_length_samples + early_late_spc_samples * 2; - for (int i = 0; i < epl_loop_length_samples; i++) - { - 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]; - tcode_chips = tcode_chips + code_phase_step_chips; - } - - memcpy(d_prompt_code, &d_early_code[early_late_spc_samples], d_current_prn_length_samples * sizeof(gr_complex)); - memcpy(d_late_code, &d_early_code[early_late_spc_samples * 2], d_current_prn_length_samples * sizeof(gr_complex)); -} - - - - -void gps_l2_m_dll_pll_tracking_cc::update_local_carrier() -{ - float phase_rad, phase_step_rad; - - phase_step_rad = GPS_L2_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); - 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)); - phase_rad += phase_step_rad; - } -} - - - - gps_l2_m_dll_pll_tracking_cc::~gps_l2_m_dll_pll_tracking_cc() { - d_dump_file.close(); + d_dump_file.close(); - volk_free(d_prompt_code); - volk_free(d_late_code); - volk_free(d_early_code); - volk_free(d_carr_sign); - volk_free(d_Early); - volk_free(d_Prompt); - volk_free(d_Late); - volk_free(d_ca_code); + volk_free(d_local_code_shift_chips); + volk_free(d_correlator_outs); + volk_free(d_ca_code); - delete[] d_Prompt_buffer; + delete[] d_Prompt_buffer; + multicorrelator_cpu.free(); } -int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, +int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { // process vars @@ -383,46 +332,18 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int // Fill the acquisition data current_synchro_data = *d_acquisition_gnss_synchro; - // Generate local code and carrier replicas (using \hat{f}_d(k-1)) - update_local_code(); - update_local_carrier(); - + // ################# CARRIER WIPEOFF AND CORRELATORS ############################## // perform carrier wipe-off and compute Early, Prompt and Late correlation - d_correlator.Carrier_wipeoff_and_EPL_volk(d_current_prn_length_samples, - in, - d_carr_sign, - d_early_code, - d_prompt_code, - d_late_code, - d_Early, - d_Prompt, - d_Late); - // check for samples consistency (this should be done before in the receiver / here only if the source is a file) - if (std::isnan((*d_Prompt).real()) == true or std::isnan((*d_Prompt).imag()) == true ) // or std::isinf(in[i].real())==true or std::isinf(in[i].imag())==true) - { - const int samples_available = ninput_items[0]; - d_sample_counter = d_sample_counter + samples_available; - LOG(WARNING) << "Detected NaN samples at sample number " << d_sample_counter; - consume_each(samples_available); - - // 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; - current_synchro_data.Tracking_timestamp_secs = static_cast(d_sample_counter) / static_cast(d_fs_in); - current_synchro_data.Carrier_phase_rads = 0.0; - current_synchro_data.Code_phase_secs = 0.0; - current_synchro_data.CN0_dB_hz = 0.0; - current_synchro_data.Flag_valid_tracking = false; - current_synchro_data.Flag_valid_pseudorange = false; - current_synchro_data.Flag_valid_symbol_output = false; - *out[0] = current_synchro_data; - - return 1; - } + multicorrelator_cpu.set_input_output_vectors(d_correlator_outs,in); + multicorrelator_cpu.Carrier_wipeoff_multicorrelator_resampler(d_rem_carr_phase_rad, + d_carrier_phase_step_rad, + d_rem_code_phase_chips, + d_code_phase_step_chips, + d_current_prn_length_samples); // ################## PLL ########################################################## // PLL discriminator - carr_error_hz = pll_cloop_two_quadrant_atan(*d_Prompt) / GPS_L2_TWO_PI; + carr_error_hz = pll_cloop_two_quadrant_atan(d_correlator_outs[1]) / GPS_L2_TWO_PI; // Carrier discriminator filter carr_error_filt_hz = d_carrier_loop_filter.get_carrier_nco(carr_error_hz); // New carrier Doppler frequency estimation @@ -437,7 +358,7 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int // ################## DLL ########################################################## // DLL discriminator - code_error_chips = dll_nc_e_minus_l_normalized(*d_Early, *d_Late); //[chips/Ti] + code_error_chips = dll_nc_e_minus_l_normalized(d_correlator_outs[0], d_correlator_outs[2]); //[chips/Ti] // Code discriminator filter code_error_filt_chips = d_code_loop_filter.get_code_nco(code_error_chips); //[chips/second] //Code phase accumulator @@ -457,13 +378,23 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int T_prn_samples = T_prn_seconds * static_cast(d_fs_in); K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast(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 + + //################### PLL COMMANDS ################################################# + //carrier phase step (NCO phase increment per sample) [rads/sample] + d_carrier_phase_step_rad = GPS_L2_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); + + //################### DLL COMMANDS ################################################# + //code phase step (Code resampler phase increment per sample) [chips/sample] + d_code_phase_step_chips = d_code_freq_chips / static_cast(d_fs_in); + + //remnant code phase [chips] + d_rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### if (d_cn0_estimation_counter < GPS_L2M_CN0_ESTIMATION_SAMPLES) { // fill buffer with prompt correlator output values - d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; + d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; d_cn0_estimation_counter++; } else @@ -496,8 +427,8 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int } } // ########### Output the tracking data to navigation and PVT ########## - current_synchro_data.Prompt_I = static_cast((*d_Prompt).real()); - current_synchro_data.Prompt_Q = static_cast((*d_Prompt).imag()); + current_synchro_data.Prompt_I = static_cast(d_correlator_outs[1].real()); + current_synchro_data.Prompt_Q = static_cast(d_correlator_outs[1].imag()); // Tracking_timestamp_secs is aligned with the CURRENT PRN start sample (Hybridization OK!, but some glitches??) current_synchro_data.Tracking_timestamp_secs = (static_cast(d_sample_counter) + d_rem_code_phase_samples) / static_cast(d_fs_in); @@ -512,59 +443,15 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int current_synchro_data.CN0_dB_hz = d_CN0_SNV_dB_Hz; current_synchro_data.Flag_valid_tracking = true; current_synchro_data.Flag_valid_symbol_output = true; - current_synchro_data.correlation_length_ms=1; *out[0] = current_synchro_data; - // ########## DEBUG OUTPUT - /*! - * \todo The stop timer has to be moved to the signal source! - */ - // debug: Second counter in channel 0 - if (d_channel == 0) - { - if (floor(d_sample_counter / d_fs_in) != d_last_seg) - { - 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] "<<"Doppler="<PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz] "<<"Doppler="<(*d_Early); - tmp_P = std::abs(*d_Prompt); - tmp_L = std::abs(*d_Late); + // MULTIPLEXED FILE RECORDING - Record results to file + float prompt_I; + float prompt_Q; + float tmp_E, tmp_P, tmp_L; + double tmp_double; + prompt_I = d_correlator_outs[1].real(); + prompt_Q = d_correlator_outs[1].imag(); + tmp_E = std::abs(d_correlator_outs[0]); + tmp_P = std::abs(d_correlator_outs[1]); + tmp_L = std::abs(d_correlator_outs[2]); try { // EPR @@ -627,10 +514,6 @@ int gps_l2_m_dll_pll_tracking_cc::general_work (int noutput_items, gr_vector_int } consume_each(d_current_prn_length_samples); // this is necessary in gr::block derivates d_sample_counter += d_current_prn_length_samples; //count for the processed samples - if((noutput_items == 0) || (ninput_items[0] == 0)) - { - LOG(WARNING) << "noutput_items = 0"; - } return 1; //output tracking result ALWAYS even in the case of d_enable_tracking==false } diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.h index 8fdcfb689..5f278b520 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l2_m_dll_pll_tracking_cc.h @@ -46,7 +46,7 @@ #include "gnss_synchro.h" #include "tracking_2nd_DLL_filter.h" #include "tracking_2nd_PLL_filter.h" -#include "correlator.h" +#include "cpu_multicorrelator.h" class gps_l2_m_dll_pll_tracking_cc; @@ -105,8 +105,6 @@ private: float pll_bw_hz, float dll_bw_hz, float early_late_space_chips); - void update_local_code(); - void update_local_carrier(); // tracking configuration vars boost::shared_ptr d_queue; @@ -116,25 +114,14 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - int d_last_seg; long d_if_freq; long d_fs_in; double d_early_late_spc_chips; - gr_complex* d_ca_code; - - gr_complex* d_early_code; - gr_complex* d_late_code; - gr_complex* d_prompt_code; - gr_complex* d_carr_sign; - - gr_complex *d_Early; - gr_complex *d_Prompt; - gr_complex *d_Late; - // remaining code phase and carrier phase between tracking loops double d_rem_code_phase_samples; + double d_rem_code_phase_chips; double d_rem_carr_phase_rad; // PLL and DLL filter library @@ -145,11 +132,17 @@ private: double d_acq_code_phase_samples; double d_acq_carrier_doppler_hz; // correlator - Correlator d_correlator; + int d_n_correlator_taps; + gr_complex* d_ca_code; + float* d_local_code_shift_chips; + gr_complex* d_correlator_outs; + cpu_multicorrelator multicorrelator_cpu; // tracking vars double d_code_freq_chips; + double d_code_phase_step_chips; double d_carrier_doppler_hz; + double d_carrier_phase_step_rad; double d_acc_carrier_phase_rad; double d_code_phase_samples; double d_acc_code_phase_secs; diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index e113105e3..bc0dc85e3 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -31,7 +31,6 @@ endif(ENABLE_CUDA) set(TRACKING_LIB_SOURCES - correlator.cc cpu_multicorrelator.cc cpu_multicorrelator_16sc.cc lock_detectors.cc diff --git a/src/algorithms/tracking/libs/correlator.cc b/src/algorithms/tracking/libs/correlator.cc deleted file mode 100644 index 967bb5c40..000000000 --- a/src/algorithms/tracking/libs/correlator.cc +++ /dev/null @@ -1,201 +0,0 @@ -/*! - * \file correlator.cc - * \brief Highly optimized vector correlator class - * \authors
    - *
  • Javier Arribas, 2011. jarribas(at)cttc.es - *
  • Luis Esteve, 2012. luis(at)epsilon-formacion.com - *
- * - * Class that implements a high optimized vector correlator class. - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - - -#include "correlator.h" -#include - -#if USING_VOLK_CW_EPL_CORR_CUSTOM - #define LV_HAVE_SSE3 - #include "volk_cw_epl_corr.h" -#endif - - -unsigned long Correlator::next_power_2(unsigned long v) -{ - v--; - v |= v >> 1; - v |= v >> 2; - v |= v >> 4; - v |= v >> 8; - v |= v >> 16; - v++; - return v; -} - - - - -void Correlator::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) -{ - gr_complex bb_signal_sample(0,0); - - *E_out = 0; - *P_out = 0; - *L_out = 0; - // perform Early, Prompt and Late correlation - for(int i=0; i < signal_length_samples; ++i) - { - //Perform the carrier wipe-off - bb_signal_sample = input[i] * carrier[i]; - // Now get early, late, and prompt values for each - *E_out += bb_signal_sample * E_code[i]; - *P_out += bb_signal_sample * P_code[i]; - *L_out += bb_signal_sample * L_code[i]; - } -} - - - - -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) -{ - gr_complex* bb_signal = static_cast(volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment())); - - volk_32fc_x2_multiply_32fc(bb_signal, input, carrier, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, signal_length_samples); - - volk_free(bb_signal); -} - -//void Correlator::Carrier_wipeoff_and_EPL_volk_IQ(int prn_length_samples,int integration_time ,const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out) -//{ -// gr_complex* bb_signal = static_cast(volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment())); -// volk_32fc_x2_multiply_32fc(bb_signal, input, carrier, integration_time * prn_length_samples); -// volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, integration_time * prn_length_samples); -// volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, integration_time * prn_length_samples); -// volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, integration_time * prn_length_samples); -// // Vector of Prompts of I code -// for (int i = 0; i < integration_time; i++) -// { -// volk_32fc_x2_dot_prod_32fc(&P_data_out[i], &bb_signal[i*prn_length_samples], P_data_code, prn_length_samples); -// } -// -// volk_free(bb_signal); -//} - -void Correlator::Carrier_wipeoff_and_EPL_volk_IQ(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* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out) -{ - gr_complex* bb_signal = static_cast(volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment())); - - volk_32fc_x2_multiply_32fc(bb_signal, input, carrier, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(P_data_out, bb_signal, P_data_code, signal_length_samples); - - volk_free(bb_signal); -} - - -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) -{ - gr_complex* bb_signal = static_cast(volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment())); - - volk_32fc_x2_multiply_32fc(bb_signal, input, carrier, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(VE_out, bb_signal, VE_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(VL_out, bb_signal, VL_code, signal_length_samples); - - volk_free(bb_signal); -} - - - -Correlator::Correlator () -{} - - -Correlator::~Correlator () -{} - - -#if USING_VOLK_CW_EPL_CORR_CUSTOM -void Correlator::Carrier_wipeoff_and_EPL_volk_custom(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) -{ - volk_cw_epl_corr_u(input, carrier, E_code, P_code, L_code, E_out, P_out, L_out, signal_length_samples); -} -#endif -void Correlator::Carrier_rotate_and_EPL_volk(int signal_length_samples, - const gr_complex* input, - gr_complex *phase_as_complex, - gr_complex phase_inc_as_complex, - const gr_complex* E_code, - const gr_complex* P_code, - const gr_complex* L_code, - gr_complex* E_out, - gr_complex* P_out, - gr_complex* L_out ) -{ - gr_complex* bb_signal = static_cast(volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment())); - - volk_32fc_s32fc_x2_rotator_32fc(bb_signal, input, phase_inc_as_complex, phase_as_complex, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, signal_length_samples); - - volk_free(bb_signal); -} - -void Correlator::Carrier_rotate_and_VEPL_volk(int signal_length_samples, - const gr_complex* input, - gr_complex *phase_as_complex, - gr_complex phase_inc_as_complex, - const gr_complex* VE_code, - const gr_complex* E_code, - const gr_complex* P_code, - const gr_complex* L_code, - const gr_complex* VL_code, - gr_complex* VE_out, - gr_complex* E_out, - gr_complex* P_out, - gr_complex* L_out, - gr_complex* VL_out ) -{ - gr_complex* bb_signal = static_cast(volk_malloc(signal_length_samples * sizeof(gr_complex), volk_get_alignment())); - - volk_32fc_s32fc_x2_rotator_32fc(bb_signal, input, phase_inc_as_complex, phase_as_complex, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(VE_out, bb_signal, VE_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(E_out, bb_signal, E_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(P_out, bb_signal, P_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(L_out, bb_signal, L_code, signal_length_samples); - volk_32fc_x2_dot_prod_32fc(VL_out, bb_signal, VL_code, signal_length_samples); - - volk_free(bb_signal); -} diff --git a/src/algorithms/tracking/libs/correlator.h b/src/algorithms/tracking/libs/correlator.h deleted file mode 100644 index ea8672846..000000000 --- a/src/algorithms/tracking/libs/correlator.h +++ /dev/null @@ -1,99 +0,0 @@ -/*! - * \file correlator.h - * \brief High optimized vector correlator class - * \authors
    - *
  • Javier Arribas, 2011. jarribas(at)cttc.es - *
  • Luis Esteve, 2012. luis(at)epsilon-formacion.com - *
- * - * Class that implements a high optimized vector correlator class - * using the volk library - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_CORRELATOR_H_ -#define GNSS_SDR_CORRELATOR_H_ - -#include - -#if !defined(GENERIC_ARCH) && HAVE_SSE3 -#define USING_VOLK_CW_EPL_CORR_CUSTOM 1 -#endif - -/*! - * \brief Class that implements carrier wipe-off and correlators. - * - * Implemented versions: - * - Generic: Standard C++ implementation. - * - Volk: uses VOLK (Vector-Optimized Library of Kernels) and uses the processor's SIMD instruction sets. See http://gnuradio.org/redmine/projects/gnuradio/wiki/Volk - * - */ -class Correlator -{ -public: - Correlator(); - ~Correlator(); - 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); - 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); - // void Carrier_wipeoff_and_EPL_volk_IQ(int prn_length_samples,int integration_time ,const gr_complex* input, gr_complex* carrier, gr_complex* E_code, gr_complex* P_code, gr_complex* L_code, gr_complex* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out); - void Carrier_wipeoff_and_EPL_volk_IQ(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* P_data_code, gr_complex* E_out, gr_complex* P_out, gr_complex* L_out, gr_complex* P_data_out); - - void Carrier_rotate_and_EPL_volk(int signal_length_samples, - const gr_complex* input, - gr_complex *phase_as_complex, - gr_complex phase_inc_as_complex, - const gr_complex* E_code, - const gr_complex* P_code, - const gr_complex* L_code, - gr_complex* E_out, - gr_complex* P_out, - gr_complex* L_out ); - - void Carrier_rotate_and_VEPL_volk(int signal_length_samples, - const gr_complex* input, - gr_complex *phase_as_complex, - gr_complex phase_inc_as_complex, - const gr_complex* VE_code, - const gr_complex* E_code, - const gr_complex* P_code, - const gr_complex* L_code, - const gr_complex* VL_code, - gr_complex* VE_out, - gr_complex* E_out, - gr_complex* P_out, - gr_complex* L_out, - gr_complex* VL_out ); - -#if USING_VOLK_CW_EPL_CORR_CUSTOM - void Carrier_wipeoff_and_EPL_volk_custom(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); -#endif - -private: - unsigned long next_power_2(unsigned long v); -}; -#endif - diff --git a/src/algorithms/tracking/libs/cpu_multicorrelator.cc b/src/algorithms/tracking/libs/cpu_multicorrelator.cc index 47a619a0f..710e342b2 100644 --- a/src/algorithms/tracking/libs/cpu_multicorrelator.cc +++ b/src/algorithms/tracking/libs/cpu_multicorrelator.cc @@ -84,6 +84,7 @@ bool cpu_multicorrelator::set_local_code_and_taps( float *shifts_chips ) { + d_local_code_in = local_code_in; d_shifts_chips = shifts_chips; d_code_length_chips = code_length_chips; @@ -107,9 +108,10 @@ void cpu_multicorrelator::update_local_code(int correlator_length_samples, float rem_code_phase_chips, code_phase_step_chips, d_shifts_chips, - correlator_length_samples, + d_code_length_chips, d_n_correlators, - d_code_length_chips); + correlator_length_samples); + } diff --git a/src/algorithms/tracking/libs/volk_cw_epl_corr.h b/src/algorithms/tracking/libs/volk_cw_epl_corr.h deleted file mode 100644 index 2aed9d2a9..000000000 --- a/src/algorithms/tracking/libs/volk_cw_epl_corr.h +++ /dev/null @@ -1,202 +0,0 @@ -/*! - * \file volk_cw_epl_corr.h - * \brief Implements the carrier wipe-off function and the Early-Prompt-Late - * correlators in a single SSE-enabled loop. - * - * \author Javier Arribas 2012, jarribas(at)cttc.es - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_VOLK_CW_EPL_CORR_H_ -#define GNSS_SDR_VOLK_CW_EPL_CORR_H_ - -#include -#include -#include -#include -#include - -/*! - * TODO: Code the SSE4 version and benchmark it - */ -#ifdef LV_HAVE_SSE3 -#include - - - /*! - \brief Performs the carrier wipe-off mixing and the Early, Prompt, and Late correlation - \param input The input signal input - \param carrier The carrier signal input - \param E_code Early PRN code replica input - \param P_code Early PRN code replica input - \param L_code Early PRN code replica input - \param E_out Early correlation output - \param P_out Early correlation output - \param L_out Early correlation output - \param num_points The number of complex values in vectors - */ -static inline void volk_cw_epl_corr_u(const lv_32fc_t* input, const lv_32fc_t* carrier, const lv_32fc_t* E_code, const lv_32fc_t* P_code, const lv_32fc_t* L_code, lv_32fc_t* E_out, lv_32fc_t* P_out, lv_32fc_t* L_out, unsigned int num_points) -{ - unsigned int number = 0; - const unsigned int halfPoints = num_points / 2; - - lv_32fc_t dotProduct_E; - memset(&dotProduct_E, 0x0, 2*sizeof(float)); - lv_32fc_t dotProduct_P; - memset(&dotProduct_P, 0x0, 2*sizeof(float)); - lv_32fc_t dotProduct_L; - memset(&dotProduct_L, 0x0, 2*sizeof(float)); - - // Aux vars - __m128 x, y, yl, yh, z, tmp1, tmp2, z_E, z_P, z_L; - - z_E = _mm_setzero_ps(); - z_P = _mm_setzero_ps(); - z_L = _mm_setzero_ps(); - - //input and output vectors - //lv_32fc_t* _input_BB = input_BB; - const lv_32fc_t* _input = input; - const lv_32fc_t* _carrier = carrier; - const lv_32fc_t* _E_code = E_code; - const lv_32fc_t* _P_code = P_code; - const lv_32fc_t* _L_code = L_code; - - for(;number < halfPoints; number++) - { - // carrier wipe-off (vector point-to-point product) - x = _mm_loadu_ps((float*)_input); // Load the ar + ai, br + bi as ar,ai,br,bi - y = _mm_loadu_ps((float*)_carrier); // Load the cr + ci, dr + di as cr,ci,dr,di - - yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr - yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di - - tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr - - x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br - - tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di - - z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di - - //_mm_storeu_ps((float*)_input_BB,z); // Store the results back into the _input_BB container - - // correlation E,P,L (3x vector scalar product) - // Early - //x = _mm_load_ps((float*)_input_BB); // Load the ar + ai, br + bi as ar,ai,br,bi - x = z; - - y = _mm_load_ps((float*)_E_code); // Load the cr + ci, dr + di as cr,ci,dr,di - - yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr - yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di - - tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr - - x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br - - tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di - - z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di - - z_E = _mm_add_ps(z_E, z); // Add the complex multiplication results together - - // Prompt - //x = _mm_load_ps((float*)_input_BB); // Load the ar + ai, br + bi as ar,ai,br,bi - y = _mm_load_ps((float*)_P_code); // Load the cr + ci, dr + di as cr,ci,dr,di - - yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr - yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di - - x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br - - tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr - - x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br - - tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di - - z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di - - z_P = _mm_add_ps(z_P, z); // Add the complex multiplication results together - - // Late - //x = _mm_load_ps((float*)_input_BB); // Load the ar + ai, br + bi as ar,ai,br,bi - y = _mm_load_ps((float*)_L_code); // Load the cr + ci, dr + di as cr,ci,dr,di - - yl = _mm_moveldup_ps(y); // Load yl with cr,cr,dr,dr - yh = _mm_movehdup_ps(y); // Load yh with ci,ci,di,di - - x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br - - tmp1 = _mm_mul_ps(x,yl); // tmp1 = ar*cr,ai*cr,br*dr,bi*dr - - x = _mm_shuffle_ps(x,x,0xB1); // Re-arrange x to be ai,ar,bi,br - - tmp2 = _mm_mul_ps(x,yh); // tmp2 = ai*ci,ar*ci,bi*di,br*di - - z = _mm_addsub_ps(tmp1,tmp2); // ar*cr-ai*ci, ai*cr+ar*ci, br*dr-bi*di, bi*dr+br*di - - z_L = _mm_add_ps(z_L, z); // Add the complex multiplication results together - - /*pointer increment*/ - _carrier += 2; - _input += 2; - //_input_BB += 2; - _E_code += 2; - _P_code += 2; - _L_code +=2; - } - - __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector_E[2]; - __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector_P[2]; - __VOLK_ATTR_ALIGNED(16) lv_32fc_t dotProductVector_L[2]; - //__VOLK_ATTR_ALIGNED(16) lv_32fc_t _input_BB; - - _mm_store_ps((float*)dotProductVector_E,z_E); // Store the results back into the dot product vector - _mm_store_ps((float*)dotProductVector_P,z_P); // Store the results back into the dot product vector - _mm_store_ps((float*)dotProductVector_L,z_L); // Store the results back into the dot product vector - - dotProduct_E += ( dotProductVector_E[0] + dotProductVector_E[1] ); - dotProduct_P += ( dotProductVector_P[0] + dotProductVector_P[1] ); - dotProduct_L += ( dotProductVector_L[0] + dotProductVector_L[1] ); - - if((num_points % 2) != 0) - { - //_input_BB = (*_input) * (*_carrier); - dotProduct_E += (*_input) * (*_E_code)*(*_carrier); - dotProduct_P += (*_input) * (*_P_code)*(*_carrier); - dotProduct_L += (*_input) * (*_L_code)*(*_carrier); - } - - *E_out = dotProduct_E; - *P_out = dotProduct_P; - *L_out = dotProduct_L; -} - - -#endif /* LV_HAVE_SSE */ -#endif /* GNSS_SDR_VOLK_CW_EPL_CORR_H_ */ diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 5e75ae28d..db7cc372d 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -49,7 +49,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/libs ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/gnuradio_blocks - ${CMAKE_SOURCE_DIR}/src/algorithms/output_filter/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/channel/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/channel/libs ${CMAKE_SOURCE_DIR}/src/algorithms/conditioner/adapters @@ -144,6 +143,5 @@ target_link_libraries(gnss_rx ${Boost_LIBRARIES} obs_adapters pvt_adapters pvt_lib - out_adapters rx_core_lib ) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 2c179db53..ac3e74201 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -49,8 +49,6 @@ #include "spir_file_signal_source.h" #include "rtl_tcp_signal_source.h" #include "two_bit_packed_file_signal_source.h" -#include "null_sink_output_filter.h" -#include "file_output_filter.h" #include "channel.h" #include "signal_conditioner.h" @@ -80,7 +78,6 @@ #include "galileo_e5a_noncoherent_iq_acquisition_caf.h" #include "gps_l1_ca_dll_pll_tracking.h" #include "gps_l1_ca_dll_pll_c_aid_tracking.h" -#include "gps_l1_ca_dll_fll_pll_tracking.h" #include "gps_l1_ca_tcp_connector_tracking.h" #include "galileo_e1_dll_pll_veml_tracking.h" #include "galileo_e1_tcp_connector_tracking.h" @@ -270,15 +267,6 @@ std::unique_ptr GNSSBlockFactory::GetPVT(std::shared_ptr GNSSBlockFactory::GetOutputFilter(std::shared_ptr configuration, - boost::shared_ptr queue) -{ - std::string default_implementation = "Null_Sink_Output_Filter"; - std::string implementation = configuration->property("OutputFilter.implementation", default_implementation); - LOG(INFO) << "Getting OutputFilter with implementation " << implementation; - return GetBlock(configuration, "OutputFilter", implementation, 1, 0, queue); -} - //********* GPS CHANNEL ***************** std::unique_ptr GNSSBlockFactory::GetChannel_GPS( std::shared_ptr configuration, @@ -1323,12 +1311,6 @@ std::unique_ptr GNSSBlockFactory::GetBlock( out_streams, queue)); block = std::move(block_); } - else if (implementation.compare("GPS_L1_CA_DLL_FLL_PLL_Tracking") == 0) - { - std::unique_ptr block_(new GpsL1CaDllFllPllTracking(configuration.get(), role, in_streams, - out_streams, queue)); - block = std::move(block_); - } else if (implementation.compare("GPS_L1_CA_TCP_CONNECTOR_Tracking") == 0) { std::unique_ptr block_(new GpsL1CaTcpConnectorTracking(configuration.get(), role, in_streams, @@ -1425,19 +1407,6 @@ std::unique_ptr GNSSBlockFactory::GetBlock( out_streams, queue)); block = std::move(block_); } - // OUTPUT FILTERS -------------------------------------------------------------- - else if (implementation.compare("Null_Sink_Output_Filter") == 0) - { - std::unique_ptr block_(new NullSinkOutputFilter(configuration.get(), role, in_streams, - out_streams)); - block = std::move(block_); - } - else if (implementation.compare("File_Output_Filter") == 0) - { - std::unique_ptr block_(new FileOutputFilter(configuration.get(), role, in_streams, - out_streams)); - block = std::move(block_); - } else { // Log fatal. This causes execution to stop. @@ -1582,12 +1551,6 @@ std::unique_ptr GNSSBlockFactory::GetTrkBlock( out_streams, queue)); block = std::move(block_); } - else if (implementation.compare("GPS_L1_CA_DLL_FLL_PLL_Tracking") == 0) - { - std::unique_ptr block_(new GpsL1CaDllFllPllTracking(configuration.get(), role, in_streams, - out_streams, queue)); - block = std::move(block_); - } else if (implementation.compare("GPS_L1_CA_TCP_CONNECTOR_Tracking") == 0) { std::unique_ptr block_(new GpsL1CaTcpConnectorTracking(configuration.get(), role, in_streams, diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index f15398fdc..b34277193 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -105,7 +105,7 @@ void GNSSFlowgraph::connect() { /* Connects the blocks in the flowgraph * - * Signal Source > Signal conditioner >> Channels >> Observables >> PVT > Output filter + * Signal Source > Signal conditioner >> Channels >> Observables >> PVT */ LOG(INFO) << "Connecting flowgraph"; if (connected_) @@ -185,19 +185,6 @@ void GNSSFlowgraph::connect() return; } - // Signal Source > Signal conditioner >> Channels >> Observables > PVT > Output Filter - try - { - output_filter_->connect(top_block_); - } - catch (std::exception& e) - { - LOG(WARNING) << "Can't connect output filter block internally"; - LOG(ERROR) << e.what(); - top_block_->disconnect_all(); - return; - } - DLOG(INFO) << "blocks connected internally"; // Signal Source (i) > Signal conditioner (i) > @@ -348,19 +335,6 @@ void GNSSFlowgraph::connect() return; } - try - { - top_block_->connect(pvt_->get_right_block(), 0, output_filter_->get_left_block(), 0); - } - catch (std::exception& e) - { - LOG(WARNING) << "Can't connect PVT to output filter"; - LOG(ERROR) << e.what(); - top_block_->disconnect_all(); - return; - } - - DLOG(INFO) << "PVT connected to output filter"; connected_ = true; LOG(INFO) << "Flowgraph connected"; top_block_->dump(); @@ -546,7 +520,6 @@ void GNSSFlowgraph::init() observables_ = block_factory_->GetObservables(configuration_, queue_); pvt_ = block_factory_->GetPVT(configuration_, queue_); - output_filter_ = block_factory_->GetOutputFilter(configuration_, queue_); std::shared_ptr>> channels = block_factory_->GetChannels(configuration_, queue_); diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 4b5250995..3ca3183bc 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -130,7 +130,6 @@ private: std::shared_ptr observables_; std::shared_ptr pvt_; - std::shared_ptr output_filter_; std::vector> channels_; gr::top_block_sptr top_block_; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 2df4ed0ef..ede1f1ea2 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -130,7 +130,6 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/algorithms/input_filter/gnuradio_blocks ${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/acquisition/gnuradio_blocks - ${CMAKE_SOURCE_DIR}/src/algorithms/output_filter/adapters ${CMAKE_SOURCE_DIR}/src/algorithms/PVT/libs ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} @@ -178,7 +177,6 @@ target_link_libraries(run_tests ${CLANG_FLAGS} gnss_system_parameters signal_generator_blocks signal_generator_adapters - out_adapters pvt_gr_blocks ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ${GNSS_SDR_TEST_OPTIONAL_LIBS} @@ -250,7 +248,6 @@ add_executable(gnss_block_test ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/file_signal_source_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/fir_filter_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/flowgraph/pass_through_test.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/file_output_filter_test.cc ${CMAKE_CURRENT_SOURCE_DIR}/gnss_block/gnss_block_factory_test.cc ) if(NOT ${ENABLE_PACKAGING}) @@ -269,7 +266,6 @@ target_link_libraries(gnss_block_test ${Boost_LIBRARIES} gnss_rx gnss_system_parameters # signal_generator_blocks - out_adapters ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ) @@ -300,7 +296,6 @@ target_link_libraries(gnuradio_block_test ${Boost_LIBRARIES} gnss_rx gnss_system_parameters # signal_generator_blocks - out_adapters ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ) @@ -329,7 +324,6 @@ endif(NOT ${GTEST_DIR_LOCAL}) # gnss_rx # gnss_system_parameters # signal_generator_blocks -# out_adapters # ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} # ) # add_test(acq_test acq_test) @@ -355,7 +349,6 @@ target_link_libraries(trk_test ${Boost_LIBRARIES} gnss_rx gnss_system_parameters signal_generator_blocks - out_adapters ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ) diff --git a/src/tests/control_thread/control_thread_test.cc b/src/tests/control_thread/control_thread_test.cc index 5b80ecae8..1548e2780 100644 --- a/src/tests/control_thread/control_thread_test.cc +++ b/src/tests/control_thread/control_thread_test.cc @@ -79,8 +79,6 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages) config->set_property("Observables.item_type", "gr_complex"); config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); config->set_property("PVT.item_type", "gr_complex"); - config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - config->set_property("OutputFilter.item_type", "gr_complex"); std::shared_ptr control_thread = std::make_shared(config); @@ -146,8 +144,6 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages2) config->set_property("Observables.item_type", "gr_complex"); config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); config->set_property("PVT.item_type", "gr_complex"); - config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - config->set_property("OutputFilter.item_type", "gr_complex"); std::unique_ptr control_thread2(new ControlThread(config)); diff --git a/src/tests/flowgraph/gnss_flowgraph_test.cc b/src/tests/flowgraph/gnss_flowgraph_test.cc index 7a9291141..3772ad3b3 100644 --- a/src/tests/flowgraph/gnss_flowgraph_test.cc +++ b/src/tests/flowgraph/gnss_flowgraph_test.cc @@ -40,7 +40,6 @@ #include "acquisition_interface.h" #include "tracking_interface.h" #include "channel_interface.h" -#include "null_sink_output_filter.h" #include "pass_through.h" #include "file_signal_source.h" @@ -69,8 +68,6 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStopOldNotation) config->set_property("TelemetryDecoder_GPS.implementation", "GPS_L1_CA_Telemetry_Decoder"); config->set_property("Observables.implementation", "GPS_L1_CA_Observables"); config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); - config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - config->set_property("OutputFilter.item_type", "gr_complex"); std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); @@ -106,8 +103,6 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStop) config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder"); config->set_property("Observables.implementation", "GPS_L1_CA_Observables"); config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); - config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - config->set_property("OutputFilter.item_type", "gr_complex"); std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); @@ -142,8 +137,6 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStopGalileoE1B) config->set_property("TelemetryDecoder_1B.implementation", "Galileo_E1B_Telemetry_Decoder"); config->set_property("Observables.implementation", "Galileo_E1B_Observables"); config->set_property("PVT.implementation", "GALILEO_E1_PVT"); - config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - config->set_property("OutputFilter.item_type", "gr_complex"); std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); @@ -292,8 +285,6 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStopHybrid) config->set_property("Observables.implementation", "Hybrid_Observables"); config->set_property("PVT.implementation", "Hybrid_PVT"); - config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - config->set_property("OutputFilter.item_type", "gr_complex"); std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); diff --git a/src/tests/gnss_block/file_output_filter_test.cc b/src/tests/gnss_block/file_output_filter_test.cc deleted file mode 100644 index 9e53ed2e0..000000000 --- a/src/tests/gnss_block/file_output_filter_test.cc +++ /dev/null @@ -1,47 +0,0 @@ -/*! - * \file file_output_filter_test.cc - * \brief This class implements a Unit Test for the class FileOutputFilter. - * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com - * - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2015 (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 . - * - * ------------------------------------------------------------------------- - */ - -#include -#include "file_output_filter.h" -#include "in_memory_configuration.h" - -TEST(FileOutputFilter, Instantiate) -{ - std::shared_ptr config = std::make_shared(); - std::string path = std::string(TEST_PATH); - std::string file = path + "data/output.dat"; - config->set_property("Test.filename", file); - config->set_property("Test.item_type", "float"); - std::unique_ptr output_filter(new FileOutputFilter(config.get(), "Test", 1, 0)); - int res = 0; - if (output_filter) res = 1; - ASSERT_EQ(1, res); -} diff --git a/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index b85b13010..8aa2fba42 100644 --- a/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -50,7 +50,6 @@ #include "gen_signal_source.h" #include "gnss_sdr_valve.h" #include "pass_through.h" -#include "file_output_filter.h" #include "gnss_block_factory.h" diff --git a/src/tests/gnss_block/gnss_block_factory_test.cc b/src/tests/gnss_block/gnss_block_factory_test.cc index 812647e8d..22ed142b6 100644 --- a/src/tests/gnss_block/gnss_block_factory_test.cc +++ b/src/tests/gnss_block/gnss_block_factory_test.cc @@ -363,38 +363,3 @@ TEST(GNSS_Block_Factory_Test, InstantiateWrongPvt) EXPECT_EQ(nullptr, pvt); } - - -TEST(GNSS_Block_Factory_Test, InstantiateNullSinkOutputFilter) -{ - std::shared_ptr configuration = std::make_shared(); - configuration->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); - std::unique_ptr factory; - std::unique_ptr output_filter = factory->GetOutputFilter(configuration, queue); - EXPECT_STREQ("OutputFilter", output_filter->role().c_str()); - EXPECT_STREQ("Null_Sink_Output_Filter", output_filter->implementation().c_str()); -} - - -TEST(GNSS_Block_Factory_Test, InstantiateFileOutputFilter) -{ - std::shared_ptr configuration = std::make_shared(); - configuration->set_property("OutputFilter.implementation", "File_Output_Filter"); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); - std::unique_ptr factory; - std::unique_ptr output_filter = factory->GetOutputFilter(configuration, queue); - EXPECT_STREQ("OutputFilter", output_filter->role().c_str()); - EXPECT_STREQ("File_Output_Filter", output_filter->implementation().c_str()); -} - - -TEST(GNSS_Block_Factory_Test, InstantiateWrongOutputFilter) -{ - std::shared_ptr configuration = std::make_shared(); - configuration->set_property("OutputFilter.implementation", "Pepito"); - gr::msg_queue::sptr queue = gr::msg_queue::make(0); - std::unique_ptr factory; - std::unique_ptr output_filter = factory->GetOutputFilter(configuration, queue); - EXPECT_EQ(nullptr, output_filter); -} diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index c9ccf105c..486bcfeaf 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -84,7 +84,6 @@ DECLARE_string(log_dir); #include "formats/rtcm_test.cc" #include "gnss_block/gnss_block_factory_test.cc" #include "gnss_block/rtcm_printer_test.cc" -#include "gnss_block/file_output_filter_test.cc" #include "gnss_block/file_signal_source_test.cc" #include "gnss_block/fir_filter_test.cc" #include "gnss_block/gps_l1_ca_pcps_acquisition_test.cc"