mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-11-17 15:24:56 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into glonass
This commit is contained in:
commit
15f8a86a43
@ -48,6 +48,8 @@ option(ENABLE_OSMOSDR "Enable the use of OsmoSDR and other front-ends (RTL-based
|
|||||||
option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNURadio driver" OFF)
|
option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNURadio driver" OFF)
|
||||||
option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF)
|
option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF)
|
||||||
option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF)
|
option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF)
|
||||||
|
option(ENABLE_PLUTOSDR "Enable the use of ADALM-PLUTO Evaluation Boards (Analog Devices Inc.), requires gr-iio" OFF)
|
||||||
|
option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware" OFF)
|
||||||
|
|
||||||
# Performance analysis tools
|
# Performance analysis tools
|
||||||
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)
|
option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF)
|
||||||
@ -214,15 +216,21 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||||||
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on ${LINUX_DISTRIBUTION} GNU/Linux Release ${LINUX_VER} ${ARCH_}")
|
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on ${LINUX_DISTRIBUTION} GNU/Linux Release ${LINUX_VER} ${ARCH_}")
|
||||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
|
||||||
# Detect Mac OS X Version
|
# Detect macOS / Mac OS X Version
|
||||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
set(OperatingSystem "Mac OS X")
|
set(OperatingSystem "Mac OS X")
|
||||||
set(OS_IS_MACOSX TRUE)
|
set(OS_IS_MACOSX TRUE)
|
||||||
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
|
exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION)
|
||||||
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
||||||
|
if(${DARWIN_VERSION} MATCHES "17")
|
||||||
|
set(MACOS_HIGH_SIERRA TRUE)
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
|
||||||
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||||
|
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS High Sierra 10.13")
|
||||||
|
endif(${DARWIN_VERSION} MATCHES "17")
|
||||||
if(${DARWIN_VERSION} MATCHES "16")
|
if(${DARWIN_VERSION} MATCHES "16")
|
||||||
set(MACOS_SIERRA TRUE)
|
set(MACOS_SIERRA TRUE)
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++14")
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
|
||||||
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS Sierra 10.12")
|
message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on macOS Sierra 10.12")
|
||||||
endif(${DARWIN_VERSION} MATCHES "16")
|
endif(${DARWIN_VERSION} MATCHES "16")
|
||||||
|
60
README.md
60
README.md
@ -291,7 +291,7 @@ GNSS-SDR comes with a library which is a module of the Vector-Optimized Library
|
|||||||
If you are using Eclipse as your development environment, CMake can create the project for you. Type:
|
If you are using Eclipse as your development environment, CMake can create the project for you. Type:
|
||||||
|
|
||||||
~~~~~~
|
~~~~~~
|
||||||
$ cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DECLIPSE_CDT4_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_VERSION=3.7 -DCMAKE_ECLIPSE_MAKE_ARGUMENTS=-j8 ../
|
$ cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_VERSION=4.5 .
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
and then import the created project file into Eclipse:
|
and then import the created project file into Eclipse:
|
||||||
@ -368,7 +368,63 @@ $ sudo make install
|
|||||||
|
|
||||||
(in order to disable the `Osmosdr_Signal_Source` compilation, you can pass `DENABLE_OSMOSDR=OFF` to cmake and build GNSS-SDR again).
|
(in order to disable the `Osmosdr_Signal_Source` compilation, you can pass `DENABLE_OSMOSDR=OFF` to cmake and build GNSS-SDR again).
|
||||||
|
|
||||||
|
###### Build FMCOMMS2 based SDR Hardware support (OPTIONAL):
|
||||||
|
|
||||||
|
Install the [libiio](https://github.com/analogdevicesinc/libiio.git) (>=v0.11), [libad9361](https://github.com/analogdevicesinc/libad9361-iio.git) (>=v0.1-1) libraries and [gr-iio](https://github.com/analogdevicesinc/gr-iio.git) (>=v0.2) gnuradio block. For example in Ubuntu 16.04 follow these instructions (based on https://github.com/blurbdust/blurbdust.github.io):
|
||||||
|
|
||||||
|
~~~~~~
|
||||||
|
$ git clone https://github.com/analogdevicesinc/libiio.git
|
||||||
|
$ cd libiio
|
||||||
|
$ mkdir build
|
||||||
|
$ cd build
|
||||||
|
$ cmake ..
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
$ sudo ldconfig
|
||||||
|
$ git clone https://github.com/analogdevicesinc/libad9361-iio.git
|
||||||
|
$ cd libad9361-iio
|
||||||
|
$ mkdir build
|
||||||
|
$ cd build
|
||||||
|
$ cmake ..
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
$ sudo ldconfig
|
||||||
|
$ git clone https://github.com/analogdevicesinc/gr-iio.git
|
||||||
|
$ cd gr-iio
|
||||||
|
$ mv include/gnuradio/iio include/iio
|
||||||
|
$ rm -r include/gnuradio
|
||||||
|
$ sed -i 's/gnuradio\/iio/iio/g' CMakeLists.txt
|
||||||
|
$ sed -i 's/gnuradio\/iio/iio/g' swig/*
|
||||||
|
$ sed -i 's/gnuradio\/iio/iio/g' include/iio/*
|
||||||
|
$ sed -i 's/gnuradio\/iio/iio/g' lib/*
|
||||||
|
$ sed -i 's/gnuradio\/iio/iio/g' python/iio/*
|
||||||
|
$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_pluto_sink.xml
|
||||||
|
$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_pluto_source.xml
|
||||||
|
$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_fmcomms2_sink.xml
|
||||||
|
$ sed -i 's/from\ gnuradio\ import\ iio/import\ iio/g' grc/iio_fmcomms2_source.xml
|
||||||
|
$ mkdir build
|
||||||
|
$ cd build
|
||||||
|
$ cmake ..
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
$ sudo ldconfig
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
Then configure the gnss-sdr to build the `Fmcomms2_Signal_Source` and `Plutosdr_Signal_Source`:
|
||||||
|
~~~~~~
|
||||||
|
$ cmake -DENABLE_FMCOMMS2=ON ../
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
or configure only `Plutosdr_Signal_Source`:
|
||||||
|
~~~~~~
|
||||||
|
$ cmake -DENABLE_PLUTOSDR=ON ../
|
||||||
|
$ make
|
||||||
|
$ sudo make install
|
||||||
|
~~~~~~
|
||||||
|
|
||||||
|
With `Fmcomms2_Signal_Source` you can use any SDR hardware based on fmcomms2, including the ADALM-PLUTO (PlutoSdr) by configuring correctly the .conf file. The `Plutosdr_Signal_Source` offers a simplier manner to use the ADALM-PLUTO because implements only a subset of fmcomms2's parameters valid for those devices.
|
||||||
|
|
||||||
###### Build OpenCL support (OPTIONAL):
|
###### Build OpenCL support (OPTIONAL):
|
||||||
|
|
||||||
@ -413,7 +469,7 @@ More details can be found in our tutorial about [GNSS-SDR configuration options
|
|||||||
---------
|
---------
|
||||||
|
|
||||||
|
|
||||||
### macOS Sierra, Mac OS X 10.11 (El Capitan), 10.10 (Yosemite) and 10.9 (Mavericks).
|
### macOS 10.13 (High Sierra) and 10.12 (Sierra), Mac OS X 10.11 (El Capitan), 10.10 (Yosemite) and 10.9 (Mavericks).
|
||||||
|
|
||||||
If you still have not installed [Xcode](http://developer.apple.com/xcode/ "Xcode"), do it now from the App Store (it's free). You will also need the Xcode Command Line Tools. Launch the Terminal, found in /Applications/Utilities/, and type:
|
If you still have not installed [Xcode](http://developer.apple.com/xcode/ "Xcode"), do it now from the App Store (it's free). You will also need the Xcode Command Line Tools. Launch the Terminal, found in /Applications/Utilities/, and type:
|
||||||
|
|
||||||
|
141
conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf
Normal file
141
conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
; You can define your own receiver and invoke it by doing
|
||||||
|
; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf
|
||||||
|
;
|
||||||
|
|
||||||
|
[GNSS-SDR]
|
||||||
|
|
||||||
|
;######### GLOBAL OPTIONS ##################
|
||||||
|
;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps].
|
||||||
|
;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE
|
||||||
|
; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/
|
||||||
|
GNSS-SDR.internal_fs_sps=2000000
|
||||||
|
|
||||||
|
|
||||||
|
;######### SUPL RRLP GPS assistance configuration #####
|
||||||
|
; Check http://www.mcc-mnc.com/
|
||||||
|
; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en
|
||||||
|
GNSS-SDR.SUPL_gps_enabled=false
|
||||||
|
GNSS-SDR.SUPL_read_gps_assistance_xml=false
|
||||||
|
GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com
|
||||||
|
GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||||
|
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||||
|
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||||
|
GNSS-SDR.SUPL_MCC=244
|
||||||
|
GNSS-SDR.SUPL_MNS=5
|
||||||
|
GNSS-SDR.SUPL_LAC=0x59e2
|
||||||
|
GNSS-SDR.SUPL_CI=0x31b0
|
||||||
|
|
||||||
|
;######### SIGNAL_SOURCE CONFIG ############
|
||||||
|
SignalSource.implementation=Fmcomms2_Signal_Source
|
||||||
|
;SignalSource.filename=/media/DATALOGGER_/signals/RTL-SDR/geo/pmt4.dat
|
||||||
|
SignalSource.item_type=gr_complex
|
||||||
|
SignalSource.device_address=10.42.0.196
|
||||||
|
SignalSource.sampling_frequency=2000000
|
||||||
|
SignalSource.freq=1575420000
|
||||||
|
SignalSource.bandwidth=2000000
|
||||||
|
SignalSource.decimation=0
|
||||||
|
SignalSource.rx1_enable=true
|
||||||
|
SignalSource.gain_mode_rx1=manual
|
||||||
|
SignalSource.rf_port_select=A_BALANCED
|
||||||
|
SignalSource.gain_rx1=64
|
||||||
|
SignalSource.samples=0
|
||||||
|
SignalSource.repeat=false
|
||||||
|
SignalSource.dump=false
|
||||||
|
SignalSource.dump_filename=../data/signal_source.dat
|
||||||
|
SignalSource.enable_throttle_control=false
|
||||||
|
|
||||||
|
;######### SIGNAL_CONDITIONER CONFIG ############
|
||||||
|
SignalConditioner.implementation=Signal_Conditioner
|
||||||
|
|
||||||
|
;######### DATA_TYPE_ADAPTER CONFIG ############
|
||||||
|
DataTypeAdapter.implementation=Pass_Through
|
||||||
|
|
||||||
|
;######### INPUT_FILTER CONFIG ############
|
||||||
|
InputFilter.implementation=Freq_Xlating_Fir_Filter
|
||||||
|
InputFilter.dump=false
|
||||||
|
InputFilter.dump_filename=../data/input_filter.dat
|
||||||
|
InputFilter.input_item_type=gr_complex
|
||||||
|
InputFilter.output_item_type=gr_complex
|
||||||
|
InputFilter.taps_item_type=float
|
||||||
|
InputFilter.number_of_taps=5
|
||||||
|
InputFilter.number_of_bands=2
|
||||||
|
InputFilter.band1_begin=0.0
|
||||||
|
InputFilter.band1_end=0.45
|
||||||
|
InputFilter.band2_begin=0.55
|
||||||
|
InputFilter.band2_end=1.0
|
||||||
|
InputFilter.ampl1_begin=1.0
|
||||||
|
InputFilter.ampl1_end=1.0
|
||||||
|
InputFilter.ampl2_begin=0.0
|
||||||
|
InputFilter.ampl2_end=0.0
|
||||||
|
InputFilter.band1_error=1.0
|
||||||
|
InputFilter.band2_error=1.0
|
||||||
|
InputFilter.filter_type=bandpass
|
||||||
|
InputFilter.grid_density=16
|
||||||
|
InputFilter.sampling_frequency=2000000
|
||||||
|
InputFilter.IF=0; IF deviation due to front-end LO inaccuracies [Hz]
|
||||||
|
|
||||||
|
;######### RESAMPLER CONFIG ############
|
||||||
|
;## Resamples the input data.
|
||||||
|
;# DISABLED IN THE RTL-SDR REALTIME
|
||||||
|
;#implementation: Use [Pass_Through] or [Direct_Resampler]
|
||||||
|
;#[Pass_Through] disables this block
|
||||||
|
Resampler.implementation=Pass_Through
|
||||||
|
|
||||||
|
;######### CHANNELS GLOBAL CONFIG ############
|
||||||
|
Channels_1C.count=5
|
||||||
|
Channels.in_acquisition=1
|
||||||
|
Channel.signal=1C
|
||||||
|
|
||||||
|
|
||||||
|
;######### ACQUISITION GLOBAL CONFIG ############
|
||||||
|
Acquisition_1C.dump=false
|
||||||
|
Acquisition_1C.dump_filename=./acq_dump.dat
|
||||||
|
Acquisition_1C.item_type=gr_complex
|
||||||
|
Acquisition_1C.if=0
|
||||||
|
Acquisition_1C.sampled_ms=1
|
||||||
|
Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler
|
||||||
|
Acquisition_1C.threshold=0.015
|
||||||
|
;Acquisition_1C.pfa=0.0001
|
||||||
|
Acquisition_1C.doppler_max=10000
|
||||||
|
Acquisition_1C.doppler_min=-10000
|
||||||
|
Acquisition_1C.doppler_step=500
|
||||||
|
Acquisition_1C.max_dwells=15
|
||||||
|
|
||||||
|
|
||||||
|
;######### TRACKING GLOBAL CONFIG ############
|
||||||
|
Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking
|
||||||
|
Tracking_1C.item_type=gr_complex
|
||||||
|
Tracking_1C.if=0
|
||||||
|
Tracking_1C.dump=false
|
||||||
|
Tracking_1C.dump_filename=./tracking_ch_
|
||||||
|
Tracking_1C.pll_bw_hz=40.0;
|
||||||
|
Tracking_1C.dll_bw_hz=2.0;
|
||||||
|
Tracking_1C.order=3;
|
||||||
|
Tracking_1C.early_late_space_chips=0.5;
|
||||||
|
|
||||||
|
;######### TELEMETRY DECODER GPS CONFIG ############
|
||||||
|
TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder
|
||||||
|
TelemetryDecoder_1C.dump=false
|
||||||
|
TelemetryDecoder_1C.decimation_factor=1;
|
||||||
|
|
||||||
|
;######### OBSERVABLES CONFIG ############
|
||||||
|
Observables.implementation=Hybrid_Observables
|
||||||
|
Observables.dump=false
|
||||||
|
Observables.dump_filename=./observables.dat
|
||||||
|
|
||||||
|
|
||||||
|
;######### PVT CONFIG ############
|
||||||
|
PVT.implementation=RTKLIB_PVT
|
||||||
|
PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
|
||||||
|
PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
|
||||||
|
PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
|
||||||
|
PVT.output_rate_ms=100
|
||||||
|
PVT.display_rate_ms=500
|
||||||
|
PVT.dump_filename=./PVT
|
||||||
|
PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea;
|
||||||
|
PVT.flag_nmea_tty_port=false;
|
||||||
|
PVT.nmea_dump_devname=/dev/pts/4
|
||||||
|
PVT.flag_rtcm_server=false
|
||||||
|
PVT.flag_rtcm_tty_port=false
|
||||||
|
PVT.rtcm_dump_devname=/dev/pts/1
|
||||||
|
PVT.dump=false
|
101
conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf
Normal file
101
conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
; You can define your own receiver and invoke it by doing
|
||||||
|
; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf
|
||||||
|
;
|
||||||
|
|
||||||
|
[GNSS-SDR]
|
||||||
|
|
||||||
|
;######### GLOBAL OPTIONS ##################
|
||||||
|
;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [sps].
|
||||||
|
;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE
|
||||||
|
; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/
|
||||||
|
GNSS-SDR.internal_fs_sps=2000000
|
||||||
|
|
||||||
|
|
||||||
|
;######### SUPL RRLP GPS assistance configuration #####
|
||||||
|
; Check http://www.mcc-mnc.com/
|
||||||
|
; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en
|
||||||
|
GNSS-SDR.SUPL_gps_enabled=false
|
||||||
|
GNSS-SDR.SUPL_read_gps_assistance_xml=false
|
||||||
|
GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com
|
||||||
|
GNSS-SDR.SUPL_gps_ephemeris_port=7275
|
||||||
|
GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com
|
||||||
|
GNSS-SDR.SUPL_gps_acquisition_port=7275
|
||||||
|
GNSS-SDR.SUPL_MCC=244
|
||||||
|
GNSS-SDR.SUPL_MNS=5
|
||||||
|
GNSS-SDR.SUPL_LAC=0x59e2
|
||||||
|
GNSS-SDR.SUPL_CI=0x31b0
|
||||||
|
|
||||||
|
;######### SIGNAL_SOURCE CONFIG ############
|
||||||
|
SignalSource.implementation=Plutosdr_Signal_Source
|
||||||
|
;SignalSource.filename=/media/DATALOGGER_/signals/RTL-SDR/geo/pmt4.dat
|
||||||
|
SignalSource.item_type=gr_complex
|
||||||
|
SignalSource.device_address=192.168.2.1
|
||||||
|
SignalSource.sampling_frequency=3000000
|
||||||
|
SignalSource.freq=1575420000
|
||||||
|
SignalSource.bandwidth=2600000
|
||||||
|
SignalSource.decimation=0
|
||||||
|
SignalSource.gain_mode=manual
|
||||||
|
SignalSource.gain=30
|
||||||
|
SignalSource.samples=0
|
||||||
|
SignalSource.buffer_size=65000
|
||||||
|
SignalSource.repeat=false
|
||||||
|
SignalSource.dump=false
|
||||||
|
SignalSource.dump_filename=./capture.dat
|
||||||
|
SignalSource.enable_throttle_control=false
|
||||||
|
|
||||||
|
;######### SIGNAL_CONDITIONER CONFIG ############
|
||||||
|
SignalConditioner.implementation=Signal_Conditioner
|
||||||
|
InputFilter.implementation=Pass_Through
|
||||||
|
InputFilter.item_type=gr_complex
|
||||||
|
Resampler.implementation=Direct_Resampler
|
||||||
|
Resampler.sample_freq_in=4000000
|
||||||
|
Resampler.sample_freq_out=2000000
|
||||||
|
Resampler.item_type=gr_complex
|
||||||
|
|
||||||
|
|
||||||
|
;######### DATA_TYPE_ADAPTER CONFIG ############
|
||||||
|
DataTypeAdapter.implementation=Pass_Through
|
||||||
|
DataTypeAdapter.item_type=gr_complex
|
||||||
|
|
||||||
|
;######### CHANNELS GLOBAL CONFIG ############
|
||||||
|
Channels_1C.count=6
|
||||||
|
Channels.in_acquisition=1
|
||||||
|
Channel.signal=1C
|
||||||
|
|
||||||
|
;######### ACQUISITION GLOBAL CONFIG ############
|
||||||
|
Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition
|
||||||
|
Acquisition_1C.item_type=gr_complex
|
||||||
|
Acquisition_1C.threshold=0.008
|
||||||
|
Acquisition_1C.doppler_max=10000
|
||||||
|
Acquisition_1C.doppler_step=250
|
||||||
|
|
||||||
|
;######### TRACKING GLOBAL CONFIG ############
|
||||||
|
Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking
|
||||||
|
Tracking_1C.item_type=gr_complex
|
||||||
|
Tracking_1C.pll_bw_hz=40.0;
|
||||||
|
Tracking_1C.dll_bw_hz=4.0;
|
||||||
|
|
||||||
|
;######### TELEMETRY DECODER GPS CONFIG ############
|
||||||
|
TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder
|
||||||
|
|
||||||
|
;######### OBSERVABLES CONFIG ############
|
||||||
|
Observables.implementation=Hybrid_Observables
|
||||||
|
Observables.dump=false
|
||||||
|
Observables.dump_filename=./observables.dat
|
||||||
|
|
||||||
|
|
||||||
|
;######### PVT CONFIG ############
|
||||||
|
PVT.implementation=RTKLIB_PVT
|
||||||
|
PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic
|
||||||
|
PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX
|
||||||
|
PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad
|
||||||
|
PVT.output_rate_ms=100
|
||||||
|
PVT.display_rate_ms=500
|
||||||
|
PVT.dump_filename=./PVT
|
||||||
|
PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea;
|
||||||
|
PVT.flag_nmea_tty_port=false;
|
||||||
|
PVT.nmea_dump_devname=/dev/pts/4
|
||||||
|
PVT.flag_rtcm_server=false
|
||||||
|
PVT.flag_rtcm_tty_port=false
|
||||||
|
PVT.rtcm_dump_devname=/dev/pts/1
|
||||||
|
PVT.dump=false
|
@ -46,7 +46,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition(
|
|||||||
{
|
{
|
||||||
configuration_ = configuration;
|
configuration_ = configuration;
|
||||||
std::string default_item_type = "gr_complex";
|
std::string default_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "../data/acquisition.dat";
|
std::string default_dump_filename = "./data/acquisition.dat";
|
||||||
|
|
||||||
DLOG(INFO) << "role " << role;
|
DLOG(INFO) << "role " << role;
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ set(INPUT_FILTER_ADAPTER_SOURCES
|
|||||||
freq_xlating_fir_filter.cc
|
freq_xlating_fir_filter.cc
|
||||||
beamformer_filter.cc
|
beamformer_filter.cc
|
||||||
pulse_blanking_filter.cc
|
pulse_blanking_filter.cc
|
||||||
|
notch_filter.cc
|
||||||
|
notch_filter_lite.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
|
125
src/algorithms/input_filter/adapters/notch_filter.cc
Normal file
125
src/algorithms/input_filter/adapters/notch_filter.cc
Normal file
@ -0,0 +1,125 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_filter.cc
|
||||||
|
* \brief Adapts a gnuradio gr_notch_filter
|
||||||
|
* \author Antonio Ramos, 2017. antonio.ramosdet(at)gmail.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "notch_filter.h"
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
#include "notch_cc.h"
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_streams, unsigned int out_streams) :
|
||||||
|
role_(role), in_streams_(in_streams),
|
||||||
|
out_streams_(out_streams)
|
||||||
|
{
|
||||||
|
size_t item_size_;
|
||||||
|
float pfa;
|
||||||
|
float default_pfa = 0.001;
|
||||||
|
float p_c_factor;
|
||||||
|
float default_p_c_factor = 0.9;
|
||||||
|
int length_;
|
||||||
|
int default_length_ = 32;
|
||||||
|
int n_segments_est;
|
||||||
|
int default_n_segments_est = 12500;
|
||||||
|
int n_segments_reset;
|
||||||
|
int default_n_segments_reset = 5000000;
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_file = "./data/input_filter.dat";
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
DLOG(INFO) << "dump_ is " << dump_;
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||||
|
pfa = configuration->property(role + ".pfa", default_pfa);
|
||||||
|
p_c_factor = configuration->property(role + ".p_c_factor", default_p_c_factor);
|
||||||
|
length_ = configuration->property(role + ".length", default_length_);
|
||||||
|
n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est);
|
||||||
|
n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset);
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
notch_filter_ = make_notch_filter(pfa, p_c_factor, length_, n_segments_est, n_segments_reset);
|
||||||
|
DLOG(INFO) << "Item size " << item_size_;
|
||||||
|
DLOG(INFO) << "input filter(" << notch_filter_->unique_id() << ")";
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG(WARNING) << item_type_ << " unrecognized item type for notch filter";
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
}
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||||
|
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
||||||
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NotchFilter::~NotchFilter()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void NotchFilter::connect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(notch_filter_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected notch filter output to file sink";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NotchFilter::disconnect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(notch_filter_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr NotchFilter::get_left_block()
|
||||||
|
{
|
||||||
|
return notch_filter_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr NotchFilter::get_right_block()
|
||||||
|
{
|
||||||
|
return notch_filter_;
|
||||||
|
}
|
84
src/algorithms/input_filter/adapters/notch_filter.h
Normal file
84
src/algorithms/input_filter/adapters/notch_filter.h
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_filter.h
|
||||||
|
* \brief Adapter of a multistate Notch filter
|
||||||
|
* \author Antonio Ramos, 2017. antonio.ramosdet(at)gmail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_NOTCH_FILTER_H_
|
||||||
|
#define GNSS_SDR_NOTCH_FILTER_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
#include "notch_cc.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class NotchFilter: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NotchFilter(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_streams,
|
||||||
|
unsigned int out_streams);
|
||||||
|
|
||||||
|
virtual ~NotchFilter();
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns "Notch_Filter"
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "Notch_Filter";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
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:
|
||||||
|
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
std::string role_;
|
||||||
|
std::string item_type_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
gr::blocks::file_sink::sptr file_sink_;
|
||||||
|
notch_sptr notch_filter_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //GNSS_SDR_NOTCH_FILTER_H_
|
132
src/algorithms/input_filter/adapters/notch_filter_lite.cc
Normal file
132
src/algorithms/input_filter/adapters/notch_filter_lite.cc
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_filter_lite.cc
|
||||||
|
* \brief Adapts a gnuradio gr_notch_filter_lite
|
||||||
|
* \author Antonio Ramos, 2017. antonio.ramosdet(at)gmail.com
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "notch_filter_lite.h"
|
||||||
|
#include <cmath>
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
#include "notch_lite_cc.h"
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
NotchFilterLite::NotchFilterLite(ConfigurationInterface* configuration, std::string role,
|
||||||
|
unsigned int in_streams, unsigned int out_streams) :
|
||||||
|
role_(role), in_streams_(in_streams),
|
||||||
|
out_streams_(out_streams)
|
||||||
|
{
|
||||||
|
size_t item_size_;
|
||||||
|
float p_c_factor;
|
||||||
|
float default_p_c_factor = 0.9;
|
||||||
|
float pfa;
|
||||||
|
float default_pfa = 0.001;
|
||||||
|
int length_;
|
||||||
|
int default_length_ = 32;
|
||||||
|
int n_segments_est;
|
||||||
|
int default_n_segments_est = 12500;
|
||||||
|
int n_segments_reset;
|
||||||
|
int default_n_segments_reset = 5000000;
|
||||||
|
float default_samp_freq = 4000000;
|
||||||
|
float samp_freq = configuration->property("SignalSource.sampling_frequency", default_samp_freq);
|
||||||
|
float default_coeff_rate = samp_freq * 0.1;
|
||||||
|
float coeff_rate;
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_file = "./data/input_filter.dat";
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
DLOG(INFO) << "dump_ is " << dump_;
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||||
|
p_c_factor = configuration->property(role + ".p_c_factor", default_p_c_factor);
|
||||||
|
pfa = configuration->property(role + ".pfa", default_pfa);
|
||||||
|
coeff_rate = configuration->property(role + ".coeff_rate", default_coeff_rate);
|
||||||
|
length_ = configuration->property(role + ".length", default_length_);
|
||||||
|
n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est);
|
||||||
|
n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset);
|
||||||
|
int n_segments_coeff = static_cast<int>((samp_freq / coeff_rate) / static_cast<float>(length_));
|
||||||
|
n_segments_coeff = std::max(1, n_segments_coeff);
|
||||||
|
if (item_type_.compare("gr_complex") == 0)
|
||||||
|
{
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
notch_filter_lite_ = make_notch_filter_lite(p_c_factor, pfa, length_, n_segments_est, n_segments_reset, n_segments_coeff);
|
||||||
|
DLOG(INFO) << "Item size " << item_size_;
|
||||||
|
DLOG(INFO) << "input filter(" << notch_filter_lite_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG(WARNING) << item_type_ << " unrecognized item type for notch filter";
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
}
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||||
|
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
||||||
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NotchFilterLite::~NotchFilterLite()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void NotchFilterLite::connect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(notch_filter_lite_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected notch filter output to file sink";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "nothing to connect internally";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NotchFilterLite::disconnect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(notch_filter_lite_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr NotchFilterLite::get_left_block()
|
||||||
|
{
|
||||||
|
return notch_filter_lite_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr NotchFilterLite::get_right_block()
|
||||||
|
{
|
||||||
|
return notch_filter_lite_;
|
||||||
|
}
|
84
src/algorithms/input_filter/adapters/notch_filter_lite.h
Normal file
84
src/algorithms/input_filter/adapters/notch_filter_lite.h
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_filter_lite.h
|
||||||
|
* \brief Adapts a ligth version of a multistate notch filter
|
||||||
|
* \author Antonio Ramos, 2017. antonio.ramosdet(at)gmail.com
|
||||||
|
*
|
||||||
|
* Detailed description of the file here if needed.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_NOTCH_FILTER_LITE_H_
|
||||||
|
#define GNSS_SDR_NOTCH_FILTER_LITE_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
#include "notch_lite_cc.h"
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class NotchFilterLite: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NotchFilterLite(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_streams,
|
||||||
|
unsigned int out_streams);
|
||||||
|
|
||||||
|
virtual ~NotchFilterLite();
|
||||||
|
std::string role()
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Returns "Notch_Filter_Lite"
|
||||||
|
std::string implementation()
|
||||||
|
{
|
||||||
|
return "Notch_Filter_Lite";
|
||||||
|
}
|
||||||
|
size_t item_size()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
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:
|
||||||
|
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
std::string role_;
|
||||||
|
std::string item_type_;
|
||||||
|
unsigned int in_streams_;
|
||||||
|
unsigned int out_streams_;
|
||||||
|
gr::blocks::file_sink::sptr file_sink_;
|
||||||
|
notch_lite_sptr notch_filter_lite_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //GNSS_SDR_NOTCH_FILTER_LITE_H_
|
@ -2,7 +2,7 @@
|
|||||||
* \file pulse_blanking_filter.cc
|
* \file pulse_blanking_filter.cc
|
||||||
* \brief Instantiates the GNSS-SDR pulse blanking filter
|
* \brief Instantiates the GNSS-SDR pulse blanking filter
|
||||||
* \author Javier Arribas 2017
|
* \author Javier Arribas 2017
|
||||||
*
|
* Antonio Ramos 2017
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "pulse_blanking_filter.h"
|
#include "pulse_blanking_filter.h"
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <gnuradio/blocks/file_sink.h>
|
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "configuration_interface.h"
|
#include "configuration_interface.h"
|
||||||
|
|
||||||
@ -42,25 +41,29 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration,
|
|||||||
out_streams_(out_streams)
|
out_streams_(out_streams)
|
||||||
{
|
{
|
||||||
size_t item_size;
|
size_t item_size;
|
||||||
|
|
||||||
std::string default_input_item_type = "gr_complex";
|
std::string default_input_item_type = "gr_complex";
|
||||||
std::string default_output_item_type = "gr_complex";
|
std::string default_output_item_type = "gr_complex";
|
||||||
std::string default_dump_filename = "../data/input_filter.dat";
|
std::string default_dump_filename = "../data/input_filter.dat";
|
||||||
|
|
||||||
DLOG(INFO) << "role " << role_;
|
DLOG(INFO) << "role " << role_;
|
||||||
|
|
||||||
input_item_type_ = config_->property(role_ + ".input_item_type", default_input_item_type);
|
input_item_type_ = config_->property(role_ + ".input_item_type", default_input_item_type);
|
||||||
output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type);
|
output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type);
|
||||||
dump_ = config_->property(role_ + ".dump", false);
|
dump_ = config_->property(role_ + ".dump", false);
|
||||||
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
|
dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename);
|
||||||
|
float default_pfa_ = 0.04;
|
||||||
double Pfa = config_->property(role_ + ".Pfa", 0.001);
|
float pfa = config_->property(role_ + ".pfa", default_pfa_);
|
||||||
|
int default_length_ = 32;
|
||||||
|
int length_ = config_->property(role_ + ".length", default_length_);
|
||||||
|
int default_n_segments_est = 12500;
|
||||||
|
int n_segments_est = config_->property(role_ + ".segments_est", default_n_segments_est);
|
||||||
|
int default_n_segments_reset = 5000000;
|
||||||
|
int n_segments_reset = config_->property(role_ + ".segments_reset", default_n_segments_reset);
|
||||||
if (input_item_type_.compare("gr_complex") == 0)
|
if (input_item_type_.compare("gr_complex") == 0)
|
||||||
{
|
{
|
||||||
item_size = sizeof(gr_complex); //output
|
item_size = sizeof(gr_complex); //output
|
||||||
input_size_ = sizeof(gr_complex); //input
|
input_size_ = sizeof(gr_complex); //input
|
||||||
pulse_blanking_cc_ = make_pulse_blanking_cc(Pfa);
|
pulse_blanking_cc_ = make_pulse_blanking_cc(pfa, length_, n_segments_est, n_segments_reset);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* \file pulse_blanking_filter.h
|
* \file pulse_blanking_filter.h
|
||||||
* \brief Instantiates the GNSS-SDR pulse blanking filter
|
* \brief Instantiates the GNSS-SDR pulse blanking filter
|
||||||
* \author Javier Arribas 2017
|
* \author Javier Arribas 2017
|
||||||
|
* Antonio Ramos 2017
|
||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
@ -39,9 +40,6 @@
|
|||||||
|
|
||||||
class ConfigurationInterface;
|
class ConfigurationInterface;
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief TODO
|
|
||||||
*/
|
|
||||||
class PulseBlankingFilter: public GNSSBlockInterface
|
class PulseBlankingFilter: public GNSSBlockInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
set(INPUT_FILTER_GR_BLOCKS_SOURCES
|
set(INPUT_FILTER_GR_BLOCKS_SOURCES
|
||||||
beamformer.cc
|
beamformer.cc
|
||||||
pulse_blanking_cc.cc
|
pulse_blanking_cc.cc
|
||||||
|
notch_cc.cc
|
||||||
|
notch_lite_cc.cc
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
@ -27,6 +29,8 @@ include_directories(
|
|||||||
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
||||||
${GNURADIO_BLOCKS_INCLUDE_DIRS}
|
${GNURADIO_BLOCKS_INCLUDE_DIRS}
|
||||||
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
||||||
|
${GLOG_INCLUDE_DIRS}
|
||||||
|
${GFlags_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
file(GLOB INPUT_FILTER_GR_BLOCKS_HEADERS "*.h")
|
file(GLOB INPUT_FILTER_GR_BLOCKS_HEADERS "*.h")
|
||||||
@ -37,5 +41,7 @@ source_group(Headers FILES ${INPUT_FILTER_GR_BLOCKS_HEADERS})
|
|||||||
target_link_libraries(input_filter_gr_blocks ${GNURADIO_FILTER_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${LOG4CPP_LIBRARIES})
|
target_link_libraries(input_filter_gr_blocks ${GNURADIO_FILTER_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${LOG4CPP_LIBRARIES})
|
||||||
|
|
||||||
if(NOT VOLK_GNSSSDR_FOUND)
|
if(NOT VOLK_GNSSSDR_FOUND)
|
||||||
add_dependencies(input_filter_gr_blocks volk_gnsssdr_module)
|
add_dependencies(input_filter_gr_blocks volk_gnsssdr_module glog-${glog_RELEASE})
|
||||||
endif(NOT VOLK_GNSSSDR_FOUND)
|
else(NOT VOLK_GNSSSDR_FOUND)
|
||||||
|
add_dependencies(input_filter_gr_blocks glog-${glog_RELEASE})
|
||||||
|
endif(NOT VOLK_GNSSSDR_FOUND)
|
||||||
|
149
src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc
Normal file
149
src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_cc.cc
|
||||||
|
* \brief Implements a multi state notch filter algorithm
|
||||||
|
* \author Antonio Ramos (antonio.ramosdet(at)gmail.com)
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "notch_cc.h"
|
||||||
|
#include <cstring>
|
||||||
|
#include <cmath>
|
||||||
|
#include <boost/math/distributions/chi_squared.hpp>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <volk/volk.h>
|
||||||
|
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
notch_sptr make_notch_filter(float pfa, float p_c_factor,
|
||||||
|
int length_, int n_segments_est, int n_segments_reset)
|
||||||
|
{
|
||||||
|
return notch_sptr(new Notch(pfa, p_c_factor, length_, n_segments_est, n_segments_reset));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Notch::Notch(float pfa, float p_c_factor, int length_, int n_segments_est, int n_segments_reset) : gr::block("Notch",
|
||||||
|
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
||||||
|
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
||||||
|
{
|
||||||
|
const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
|
||||||
|
set_alignment(std::max(1, alignment_multiple));
|
||||||
|
set_history(2);
|
||||||
|
this->pfa = pfa;
|
||||||
|
noise_pow_est = 0.0;
|
||||||
|
this->p_c_factor = gr_complex(p_c_factor , 0);
|
||||||
|
this->length_ = length_; //Set the number of samples per segment
|
||||||
|
filter_state_ = false; //Initial state of the filter
|
||||||
|
n_deg_fred = 2 * length_; //Number of dregrees of freedom
|
||||||
|
n_segments = 0;
|
||||||
|
this->n_segments_est = n_segments_est; // Set the number of segments for noise power estimation
|
||||||
|
this->n_segments_reset = n_segments_reset; // Set the period (in segments) when the noise power is estimated
|
||||||
|
z_0 = gr_complex(0 , 0);
|
||||||
|
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred);
|
||||||
|
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa));
|
||||||
|
c_samples = static_cast<gr_complex *>(volk_malloc(length_ * sizeof(gr_complex), volk_get_alignment()));
|
||||||
|
angle_ = static_cast<float *>(volk_malloc(length_ * sizeof(float), volk_get_alignment()));
|
||||||
|
power_spect = static_cast<float *>(volk_malloc(length_ * sizeof(float), volk_get_alignment()));
|
||||||
|
last_out = gr_complex(0,0);
|
||||||
|
d_fft = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(length_, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Notch::~Notch()
|
||||||
|
{
|
||||||
|
volk_free(c_samples);
|
||||||
|
volk_free(angle_);
|
||||||
|
volk_free(power_spect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notch::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
||||||
|
{
|
||||||
|
for(unsigned int aux = 0; aux < ninput_items_required.size(); aux++)
|
||||||
|
{
|
||||||
|
ninput_items_required[aux] = length_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int Notch::general_work(int noutput_items, gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
int index_out = 0;
|
||||||
|
float sig2dB = 0.0;
|
||||||
|
float sig2lin = 0.0;
|
||||||
|
lv_32fc_t dot_prod_;
|
||||||
|
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||||
|
gr_complex* out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||||
|
in++;
|
||||||
|
while((index_out + length_) < noutput_items)
|
||||||
|
{
|
||||||
|
if((n_segments < n_segments_est) && (filter_state_ == false))
|
||||||
|
{
|
||||||
|
memcpy(d_fft->get_inbuf(), in, sizeof(gr_complex) * length_);
|
||||||
|
d_fft->execute();
|
||||||
|
volk_32fc_s32f_power_spectrum_32f(power_spect, d_fft->get_outbuf(), 1.0, length_);
|
||||||
|
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect, 15.0, length_);
|
||||||
|
sig2lin = std::pow(10.0, (sig2dB / 10.0)) / (static_cast<float>(n_deg_fred) );
|
||||||
|
noise_pow_est = (static_cast<float>(n_segments) * noise_pow_est + sig2lin) / (static_cast<float>(n_segments + 1));
|
||||||
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
volk_32fc_x2_conjugate_dot_prod_32fc(&dot_prod_, in, in, length_);
|
||||||
|
if( (lv_creal(dot_prod_) / noise_pow_est) > thres_)
|
||||||
|
{
|
||||||
|
if(filter_state_ == false)
|
||||||
|
{
|
||||||
|
filter_state_ = true;
|
||||||
|
last_out = gr_complex(0,0);
|
||||||
|
}
|
||||||
|
volk_32fc_x2_multiply_conjugate_32fc(c_samples, in, (in - 1), length_);
|
||||||
|
volk_32fc_s32f_atan2_32f(angle_, c_samples, static_cast<float>(1.0), length_);
|
||||||
|
for(int aux = 0; aux < length_; aux++)
|
||||||
|
{
|
||||||
|
z_0 = std::exp(gr_complex(0,1) * (*(angle_ + aux)));
|
||||||
|
*(out + aux) = *(in + aux) - z_0 * (*(in + aux - 1)) + p_c_factor * z_0 * last_out;
|
||||||
|
last_out = *(out + aux);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (n_segments > n_segments_reset)
|
||||||
|
{
|
||||||
|
n_segments = 0;
|
||||||
|
}
|
||||||
|
filter_state_ = false;
|
||||||
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
index_out += length_;
|
||||||
|
n_segments++;
|
||||||
|
in += length_;
|
||||||
|
out += length_;
|
||||||
|
}
|
||||||
|
consume_each(index_out);
|
||||||
|
return index_out;
|
||||||
|
}
|
84
src/algorithms/input_filter/gnuradio_blocks/notch_cc.h
Normal file
84
src/algorithms/input_filter/gnuradio_blocks/notch_cc.h
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_cc.h
|
||||||
|
* \brief Implements a notch filter algorithm
|
||||||
|
* \author Antonio Ramos (antonio.ramosdet(at)gmail.com)
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_NOTCH_H_
|
||||||
|
#define GNSS_SDR_NOTCH_H_
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
#include <gnuradio/fft/fft.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
class Notch;
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<Notch> notch_sptr;
|
||||||
|
|
||||||
|
notch_sptr make_notch_filter(float pfa, float p_c_factor,
|
||||||
|
int length_, int n_segments_est, int n_segments_reset);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This class implements a real-time software-defined multi state notch filter
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Notch : public gr::block
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
float pfa;
|
||||||
|
float noise_pow_est;
|
||||||
|
float thres_;
|
||||||
|
int length_;
|
||||||
|
int n_deg_fred;
|
||||||
|
unsigned int n_segments;
|
||||||
|
unsigned int n_segments_est;
|
||||||
|
unsigned int n_segments_reset;
|
||||||
|
bool filter_state_;
|
||||||
|
gr_complex last_out;
|
||||||
|
gr_complex z_0;
|
||||||
|
gr_complex p_c_factor;
|
||||||
|
gr_complex* c_samples;
|
||||||
|
float* angle_;
|
||||||
|
float* power_spect;
|
||||||
|
std::unique_ptr<gr::fft::fft_complex> d_fft;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
Notch(float pfa, float p_c_factor, int length_, int n_segments_est, int n_segments_reset);
|
||||||
|
|
||||||
|
~Notch();
|
||||||
|
|
||||||
|
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||||
|
|
||||||
|
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //GNSS_SDR_NOTCH_H_
|
159
src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc
Normal file
159
src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.cc
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_lite_cc.cc
|
||||||
|
* \brief Implements a multi state notch filter algorithm
|
||||||
|
* \author Antonio Ramos (antonio.ramosdet(at)gmail.com)
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "notch_lite_cc.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
#include <cmath>
|
||||||
|
#include <boost/math/distributions/chi_squared.hpp>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
#include <gnuradio/io_signature.h>
|
||||||
|
#include <volk/volk.h>
|
||||||
|
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int length_, int n_segments_est, int n_segments_reset, int n_segments_coeff)
|
||||||
|
{
|
||||||
|
return notch_lite_sptr(new NotchLite(p_c_factor, pfa, length_, n_segments_est, n_segments_reset, n_segments_coeff));
|
||||||
|
}
|
||||||
|
|
||||||
|
NotchLite::NotchLite(float p_c_factor, float pfa, int length_, int n_segments_est, int n_segments_reset, int n_segments_coeff) : gr::block("NotchLite",
|
||||||
|
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
||||||
|
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
||||||
|
{
|
||||||
|
const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
|
||||||
|
set_alignment(std::max(1, alignment_multiple));
|
||||||
|
set_history(2);
|
||||||
|
this->p_c_factor = gr_complex(p_c_factor , 0);
|
||||||
|
this->n_segments_est = n_segments_est;
|
||||||
|
this->n_segments_reset = n_segments_reset;
|
||||||
|
this->n_segments_coeff_reset = n_segments_coeff;
|
||||||
|
this->n_segments_coeff = 0;
|
||||||
|
this->length_ = length_;
|
||||||
|
set_output_multiple(length_);
|
||||||
|
this->pfa = pfa;
|
||||||
|
n_segments = 0;
|
||||||
|
n_deg_fred = 2 * length_;
|
||||||
|
noise_pow_est = 0.0;
|
||||||
|
filter_state_ = false;
|
||||||
|
z_0 = gr_complex(0 , 0);
|
||||||
|
last_out = gr_complex(0, 0);
|
||||||
|
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred);
|
||||||
|
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa));
|
||||||
|
c_samples1 = gr_complex(0, 0);
|
||||||
|
c_samples2 = gr_complex(0, 0);
|
||||||
|
angle1 = 0.0;
|
||||||
|
angle2 = 0.0;
|
||||||
|
power_spect = static_cast<float *>(volk_malloc(length_ * sizeof(float), volk_get_alignment()));
|
||||||
|
d_fft = std::unique_ptr<gr::fft::fft_complex>(new gr::fft::fft_complex(length_, true));
|
||||||
|
}
|
||||||
|
|
||||||
|
NotchLite::~NotchLite()
|
||||||
|
{
|
||||||
|
volk_free(power_spect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotchLite::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
||||||
|
{
|
||||||
|
for(unsigned int aux = 0; aux < ninput_items_required.size(); aux++)
|
||||||
|
{
|
||||||
|
ninput_items_required[aux] = length_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int NotchLite::general_work(int noutput_items, gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
|
{
|
||||||
|
int index_out = 0;
|
||||||
|
float sig2dB = 0.0;
|
||||||
|
float sig2lin = 0.0;
|
||||||
|
lv_32fc_t dot_prod_;
|
||||||
|
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||||
|
gr_complex* out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||||
|
in++;
|
||||||
|
while((index_out + length_) < noutput_items)
|
||||||
|
{
|
||||||
|
if((n_segments < n_segments_est) && (filter_state_ == false))
|
||||||
|
{
|
||||||
|
memcpy(d_fft->get_inbuf(), in, sizeof(gr_complex) * length_);
|
||||||
|
d_fft->execute();
|
||||||
|
volk_32fc_s32f_power_spectrum_32f(power_spect, d_fft->get_outbuf(), 1.0, length_);
|
||||||
|
volk_32f_s32f_calc_spectral_noise_floor_32f(&sig2dB, power_spect, 15.0, length_);
|
||||||
|
sig2lin = std::pow(10.0, (sig2dB / 10.0)) / static_cast<float>(n_deg_fred);
|
||||||
|
noise_pow_est = (static_cast<float>(n_segments) * noise_pow_est + sig2lin) / static_cast<float>(n_segments + 1);
|
||||||
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
volk_32fc_x2_conjugate_dot_prod_32fc(&dot_prod_, in, in, length_);
|
||||||
|
if( (lv_creal(dot_prod_) / noise_pow_est) > thres_)
|
||||||
|
{
|
||||||
|
if(filter_state_ == false)
|
||||||
|
{
|
||||||
|
filter_state_ = true;
|
||||||
|
last_out = gr_complex(0,0);
|
||||||
|
n_segments_coeff = 0;
|
||||||
|
}
|
||||||
|
if(n_segments_coeff == 0)
|
||||||
|
{
|
||||||
|
volk_32fc_x2_multiply_conjugate_32fc(&c_samples1, (in + 1), in, 1);
|
||||||
|
volk_32fc_s32f_atan2_32f(&angle1, &c_samples1, static_cast<float>(1.0), 1);
|
||||||
|
volk_32fc_x2_multiply_conjugate_32fc(&c_samples2, (in + length_ - 1), (in + length_ - 2), 1);
|
||||||
|
volk_32fc_s32f_atan2_32f(&angle2, &c_samples2, static_cast<float>(1.0), 1);
|
||||||
|
float angle_ = (angle1 + angle2) / 2.0;
|
||||||
|
z_0 = std::exp(gr_complex(0,1) * angle_);
|
||||||
|
}
|
||||||
|
for(int aux = 0; aux < length_; aux++)
|
||||||
|
{
|
||||||
|
*(out + aux) = *(in + aux) - z_0 * (*(in + aux - 1)) + p_c_factor * z_0 * last_out;
|
||||||
|
last_out = *(out + aux);
|
||||||
|
}
|
||||||
|
n_segments_coeff++;
|
||||||
|
n_segments_coeff = n_segments_coeff % n_segments_coeff_reset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (n_segments > n_segments_reset)
|
||||||
|
{
|
||||||
|
n_segments = 0;
|
||||||
|
}
|
||||||
|
filter_state_ = false;
|
||||||
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
index_out += length_;
|
||||||
|
n_segments++;
|
||||||
|
in += length_;
|
||||||
|
out += length_;
|
||||||
|
}
|
||||||
|
consume_each(index_out);
|
||||||
|
return index_out;
|
||||||
|
}
|
87
src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.h
Normal file
87
src/algorithms/input_filter/gnuradio_blocks/notch_lite_cc.h
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_lite_cc.h
|
||||||
|
* \brief Implements a notch filter ligth algorithm
|
||||||
|
* \author Antonio Ramos (antonio.ramosdet(at)gmail.com)
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_NOTCH_LITE_H_
|
||||||
|
#define GNSS_SDR_NOTCH_LITE_H_
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <gnuradio/block.h>
|
||||||
|
#include <gnuradio/fft/fft.h>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
class NotchLite;
|
||||||
|
|
||||||
|
typedef boost::shared_ptr<NotchLite> notch_lite_sptr;
|
||||||
|
|
||||||
|
notch_lite_sptr make_notch_filter_lite(float p_c_factor, float pfa, int length_, int n_segments_est, int n_segments_reset, int n_segments_coeff);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief This class implements a real-time software-defined multi state notch filter ligth version
|
||||||
|
*/
|
||||||
|
|
||||||
|
class NotchLite : public gr::block
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
int length_;
|
||||||
|
int n_segments;
|
||||||
|
int n_segments_est;
|
||||||
|
int n_segments_reset;
|
||||||
|
int n_segments_coeff_reset;
|
||||||
|
int n_segments_coeff;
|
||||||
|
int n_deg_fred;
|
||||||
|
float pfa;
|
||||||
|
float thres_;
|
||||||
|
float noise_pow_est;
|
||||||
|
bool filter_state_;
|
||||||
|
gr_complex last_out;
|
||||||
|
gr_complex z_0;
|
||||||
|
gr_complex p_c_factor;
|
||||||
|
gr_complex c_samples1;
|
||||||
|
gr_complex c_samples2;
|
||||||
|
float angle1;
|
||||||
|
float angle2;
|
||||||
|
float* power_spect;
|
||||||
|
std::unique_ptr<gr::fft::fft_complex> d_fft;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
NotchLite(float p_c_factor, float pfa, int length_, int n_segments_est, int n_segments_reset, int n_segments_coeff);
|
||||||
|
|
||||||
|
~NotchLite();
|
||||||
|
|
||||||
|
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||||
|
|
||||||
|
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
||||||
|
gr_vector_const_void_star &input_items,
|
||||||
|
gr_vector_void_star &output_items);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //GNSS_SDR_NOTCH_LITE_H_
|
@ -1,8 +1,8 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file pulse_blanking_cc.cc
|
* \file pulse_blanking_cc.cc
|
||||||
* \brief Implements a simple pulse blanking algorithm
|
* \brief Implements a pulse blanking algorithm
|
||||||
* \author Javier Arribas (jarribas(at)cttc.es)
|
* \author Javier Arribas (jarribas(at)cttc.es)
|
||||||
*
|
* Antonio Ramos (antonio.ramosdet(at)gmail.com)
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
@ -30,61 +30,98 @@
|
|||||||
|
|
||||||
#include "pulse_blanking_cc.h"
|
#include "pulse_blanking_cc.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <complex>
|
#include <boost/math/distributions/chi_squared.hpp>
|
||||||
|
#include <glog/logging.h>
|
||||||
#include <gnuradio/io_signature.h>
|
#include <gnuradio/io_signature.h>
|
||||||
#include <volk/volk.h>
|
#include <volk/volk.h>
|
||||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
|
||||||
|
|
||||||
|
|
||||||
pulse_blanking_cc_sptr make_pulse_blanking_cc(double Pfa)
|
using google::LogMessage;
|
||||||
|
|
||||||
|
pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int length_,
|
||||||
|
int n_segments_est, int n_segments_reset)
|
||||||
{
|
{
|
||||||
return pulse_blanking_cc_sptr(new pulse_blanking_cc(Pfa));
|
return pulse_blanking_cc_sptr(new pulse_blanking_cc(pfa, length_, n_segments_est, n_segments_reset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pulse_blanking_cc::pulse_blanking_cc(float pfa, int length_, int n_segments_est, int n_segments_reset) : gr::block("pulse_blanking_cc",
|
||||||
pulse_blanking_cc::pulse_blanking_cc(double Pfa) : gr::block("pulse_blanking_cc",
|
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
||||||
gr::io_signature::make (1, 1, sizeof(gr_complex)),
|
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
||||||
gr::io_signature::make (1, 1, sizeof(gr_complex)))
|
|
||||||
{
|
{
|
||||||
const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
|
const int alignment_multiple = volk_get_alignment() / sizeof(gr_complex);
|
||||||
set_alignment(std::max(1, alignment_multiple));
|
set_alignment(std::max(1, alignment_multiple));
|
||||||
d_Pfa = Pfa;
|
this->pfa = pfa;
|
||||||
|
this->length_ = length_;
|
||||||
|
last_filtered = false;
|
||||||
|
n_segments = 0;
|
||||||
|
this->n_segments_est = n_segments_est;
|
||||||
|
this->n_segments_reset = n_segments_reset;
|
||||||
|
noise_power_estimation = 0.0;
|
||||||
|
n_deg_fred = 2 * length_;
|
||||||
|
boost::math::chi_squared_distribution<float> my_dist_(n_deg_fred);
|
||||||
|
thres_ = boost::math::quantile(boost::math::complement(my_dist_, pfa));
|
||||||
|
zeros_ = static_cast<gr_complex *>(volk_malloc(length_ * sizeof(gr_complex), volk_get_alignment()));
|
||||||
|
for (int aux = 0; aux < length_; aux++)
|
||||||
|
{
|
||||||
|
zeros_[aux] = gr_complex(0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pulse_blanking_cc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
pulse_blanking_cc::~pulse_blanking_cc()
|
||||||
|
{
|
||||||
|
volk_free(zeros_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void pulse_blanking_cc::forecast(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items_required)
|
||||||
|
{
|
||||||
|
for(unsigned int aux=0; aux < ninput_items_required.size(); aux++)
|
||||||
|
{
|
||||||
|
ninput_items_required[aux] = length_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int pulse_blanking_cc::general_work (int noutput_items, gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
const gr_complex *in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
const gr_complex* in = reinterpret_cast<const gr_complex *>(input_items[0]);
|
||||||
gr_complex *out = reinterpret_cast<gr_complex *>(output_items[0]);
|
gr_complex* out = reinterpret_cast<gr_complex *>(output_items[0]);
|
||||||
|
float* magnitude = static_cast<float *>(volk_malloc(noutput_items * sizeof(float), volk_get_alignment()));
|
||||||
// 1- (optional) Compute the input signal power estimation
|
|
||||||
//float mean;
|
|
||||||
//float stddev;
|
|
||||||
//volk_32f_stddev_and_mean_32f_x2(&stddev, &mean, in, noutput_items);
|
|
||||||
|
|
||||||
float* magnitude;
|
|
||||||
magnitude = static_cast<float*>(volk_gnsssdr_malloc(noutput_items * sizeof(float), volk_gnsssdr_get_alignment()));
|
|
||||||
|
|
||||||
float var;
|
|
||||||
volk_32fc_magnitude_squared_32f(magnitude, in, noutput_items);
|
volk_32fc_magnitude_squared_32f(magnitude, in, noutput_items);
|
||||||
volk_32f_accumulator_s32f(&var, magnitude, noutput_items);
|
int sample_index = 0;
|
||||||
var /= static_cast<float>(noutput_items);
|
float segment_energy;
|
||||||
// compute pulse blanking threshold (Paper Borio 2016)
|
while((sample_index + length_) < noutput_items)
|
||||||
|
|
||||||
float Th = sqrt(-2.0 * var * log10(d_Pfa));
|
|
||||||
|
|
||||||
//apply the pulse blanking
|
|
||||||
//todo: write volk kernel to optimize the blanking
|
|
||||||
memcpy(out,in, sizeof(gr_complex)*noutput_items);
|
|
||||||
for (int n = 0; n < noutput_items; n++)
|
|
||||||
{
|
{
|
||||||
if (std::abs(out[n]) > Th)
|
volk_32f_accumulator_s32f(&segment_energy, (magnitude + sample_index), length_);
|
||||||
|
if((n_segments < n_segments_est) && (last_filtered == false))
|
||||||
{
|
{
|
||||||
out[n] = gr_complex(0,0);
|
noise_power_estimation = ( static_cast<float>(n_segments) * noise_power_estimation + segment_energy / static_cast<float>(n_deg_fred) ) / static_cast<float>(n_segments + 1);
|
||||||
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if((segment_energy / noise_power_estimation) > thres_)
|
||||||
|
{
|
||||||
|
memcpy(out, zeros_, sizeof(gr_complex) * length_);
|
||||||
|
last_filtered = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy(out, in, sizeof(gr_complex) * length_);
|
||||||
|
last_filtered = false;
|
||||||
|
if (n_segments > n_segments_reset)
|
||||||
|
{
|
||||||
|
n_segments = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
in += length_;
|
||||||
|
out += length_;
|
||||||
|
sample_index += length_;
|
||||||
|
n_segments++;
|
||||||
}
|
}
|
||||||
consume_each(noutput_items);
|
volk_free(magnitude);
|
||||||
return noutput_items;
|
consume_each(sample_index);
|
||||||
|
return sample_index;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/*!
|
/*!
|
||||||
* \file pulse_blanking_cc.h
|
* \file pulse_blanking_cc.h
|
||||||
* \brief Implements a simple pulse blanking algorithm
|
* \brief Implements a pulse blanking algorithm
|
||||||
* \author Javier Arribas (jarribas(at)cttc.es)
|
* \author Javier Arribas (jarribas(at)cttc.es)
|
||||||
*
|
* Antonio Ramos (antonio.ramosdet(at)gmail.com)
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
@ -38,22 +38,35 @@ class pulse_blanking_cc;
|
|||||||
|
|
||||||
typedef boost::shared_ptr<pulse_blanking_cc> pulse_blanking_cc_sptr;
|
typedef boost::shared_ptr<pulse_blanking_cc> pulse_blanking_cc_sptr;
|
||||||
|
|
||||||
pulse_blanking_cc_sptr make_pulse_blanking_cc(double Pfa);
|
pulse_blanking_cc_sptr make_pulse_blanking_cc(float pfa, int length_, int n_segments_est, int n_segments_reset);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief This class adapts a short (16-bits) interleaved sample stream
|
|
||||||
* into a std::complex<short> stream
|
|
||||||
*/
|
|
||||||
class pulse_blanking_cc : public gr::block
|
class pulse_blanking_cc : public gr::block
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
friend pulse_blanking_cc_sptr make_pulse_blanking_cc(double Pfa);
|
|
||||||
double d_Pfa;
|
int length_;
|
||||||
|
int n_segments;
|
||||||
|
int n_segments_est;
|
||||||
|
int n_segments_reset;
|
||||||
|
int n_deg_fred;
|
||||||
|
bool last_filtered;
|
||||||
|
float noise_power_estimation;
|
||||||
|
float thres_;
|
||||||
|
float pfa;
|
||||||
|
gr_complex* zeros_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
pulse_blanking_cc(double Pfa);
|
|
||||||
|
pulse_blanking_cc(float pfa, int length_, int n_segments_est, int n_segments_reset);
|
||||||
|
|
||||||
|
~pulse_blanking_cc();
|
||||||
|
|
||||||
int general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int 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);
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||||
|
|
||||||
|
void forecast(int noutput_items, gr_vector_int &ninput_items_required);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -365,8 +365,8 @@ void decodefile(rtksvr_t *svr, int index)
|
|||||||
|
|
||||||
nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
{0, 0, (erpd_t *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0},
|
{0, 0, (erpd_t *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0},
|
||||||
{0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0},{0.0}}, {{0.0},{0.0}}, {{0.0},{0.0},{0.0}},
|
{0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0},{0.0}}, {{0.0},{0.0}}, {{0.0}, {0.0}, {0.0}},
|
||||||
{0.0}, {0.0}, '0', {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0},
|
{0.0}, {0.0}, {'0'}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0},
|
||||||
{{0,0.0}, 0.0, {0.0}, {{0.0},{0.0}} }, pppcorr0} ;
|
{{0,0.0}, 0.0, {0.0}, {{0.0},{0.0}} }, pppcorr0} ;
|
||||||
|
|
||||||
char file[1024];
|
char file[1024];
|
||||||
|
@ -192,7 +192,9 @@ install(FILES
|
|||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_prefs.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_prefs.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_complex.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_complex.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_common.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_common.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/saturation_arithmetic.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_avx_intrinsics.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_avx_intrinsics.h
|
||||||
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_sse_intrinsics.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_sse3_intrinsics.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_sse3_intrinsics.h
|
||||||
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h
|
${PROJECT_SOURCE_DIR}/include/volk_gnsssdr/volk_gnsssdr_neon_intrinsics.h
|
||||||
${PROJECT_BINARY_DIR}/include/volk_gnsssdr/volk_gnsssdr.h
|
${PROJECT_BINARY_DIR}/include/volk_gnsssdr/volk_gnsssdr.h
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
# define __VOLK_ATTR_UNUSED __attribute__((unused))
|
# define __VOLK_ATTR_UNUSED __attribute__((unused))
|
||||||
# define __VOLK_ATTR_INLINE __attribute__((always_inline))
|
# define __VOLK_ATTR_INLINE __attribute__((always_inline))
|
||||||
# define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
|
# define __VOLK_ATTR_DEPRECATED __attribute__((deprecated))
|
||||||
|
# define __VOLK_ASM __asm__
|
||||||
|
# define __VOLK_VOLATILE __volatile__
|
||||||
# if __GNUC__ >= 4
|
# if __GNUC__ >= 4
|
||||||
# define __VOLK_ATTR_EXPORT __attribute__((visibility("default")))
|
# define __VOLK_ATTR_EXPORT __attribute__((visibility("default")))
|
||||||
# define __VOLK_ATTR_IMPORT __attribute__((visibility("default")))
|
# define __VOLK_ATTR_IMPORT __attribute__((visibility("default")))
|
||||||
@ -63,6 +65,8 @@
|
|||||||
# define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
|
# define __VOLK_ATTR_DEPRECATED __declspec(deprecated)
|
||||||
# define __VOLK_ATTR_EXPORT __declspec(dllexport)
|
# define __VOLK_ATTR_EXPORT __declspec(dllexport)
|
||||||
# define __VOLK_ATTR_IMPORT __declspec(dllimport)
|
# define __VOLK_ATTR_IMPORT __declspec(dllimport)
|
||||||
|
# define __VOLK_ASM __asm
|
||||||
|
# define __VOLK_VOLATILE
|
||||||
#else
|
#else
|
||||||
# define __VOLK_ATTR_ALIGNED(x)
|
# define __VOLK_ATTR_ALIGNED(x)
|
||||||
# define __VOLK_ATTR_UNUSED
|
# define __VOLK_ATTR_UNUSED
|
||||||
@ -70,6 +74,8 @@
|
|||||||
# define __VOLK_ATTR_DEPRECATED
|
# define __VOLK_ATTR_DEPRECATED
|
||||||
# define __VOLK_ATTR_EXPORT
|
# define __VOLK_ATTR_EXPORT
|
||||||
# define __VOLK_ATTR_IMPORT
|
# define __VOLK_ATTR_IMPORT
|
||||||
|
# define __VOLK_ASM __asm__
|
||||||
|
# define __VOLK_VOLATILE __volatile__
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -717,11 +717,11 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc,
|
|||||||
{
|
{
|
||||||
if(both_sigs[j].is_signed)
|
if(both_sigs[j].is_signed)
|
||||||
{
|
{
|
||||||
fail = icompare((int16_t *) test_data[generic_offset][j], (int16_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
|
fail = icompare((int8_t *) test_data[generic_offset][j], (int8_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fail = icompare((uint16_t *) test_data[generic_offset][j], (uint16_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
|
fail = icompare((uint8_t *) test_data[generic_offset][j], (uint8_t *) test_data[i][j], vlen*(both_sigs[j].is_complex ? 2 : 1), tol_i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
#ifndef GNSS_SDR_VOLK_QA_UTILS_H
|
#ifndef GNSS_SDR_VOLK_QA_UTILS_H
|
||||||
#define GNSS_SDR_VOLK_QA_UTILS_H
|
#define GNSS_SDR_VOLK_QA_UTILS_H
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#define _DARWIN_C_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -42,7 +42,7 @@ struct VOLK_CPU volk_gnsssdr_cpu;
|
|||||||
#if ((__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__clang_major__ >= 3)) && defined(HAVE_XGETBV)
|
#if ((__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 2) || (__clang_major__ >= 3)) && defined(HAVE_XGETBV)
|
||||||
static inline unsigned long long _xgetbv(unsigned int index){
|
static inline unsigned long long _xgetbv(unsigned int index){
|
||||||
unsigned int eax, edx;
|
unsigned int eax, edx;
|
||||||
__asm__ __volatile__("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
|
__VOLK_ASM __VOLK_VOLATILE ("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index));
|
||||||
return ((unsigned long long)edx << 32) | eax;
|
return ((unsigned long long)edx << 32) | eax;
|
||||||
}
|
}
|
||||||
#define __xgetbv() _xgetbv(0)
|
#define __xgetbv() _xgetbv(0)
|
||||||
|
@ -46,345 +46,341 @@ using google::LogMessage;
|
|||||||
|
|
||||||
hybrid_observables_cc_sptr hybrid_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history)
|
hybrid_observables_cc_sptr hybrid_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history)
|
||||||
{
|
{
|
||||||
return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels, dump, dump_filename, deep_history));
|
return hybrid_observables_cc_sptr(new hybrid_observables_cc(nchannels, dump, dump_filename, deep_history));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history) :
|
hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history) :
|
||||||
gr::block("hybrid_observables_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
gr::block("hybrid_observables_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
||||||
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)))
|
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)))
|
||||||
{
|
{
|
||||||
// initialize internal vars
|
// initialize internal vars
|
||||||
d_dump = dump;
|
d_dump = dump;
|
||||||
d_nchannels = nchannels;
|
d_nchannels = nchannels;
|
||||||
d_dump_filename = dump_filename;
|
d_dump_filename = dump_filename;
|
||||||
history_deep = deep_history;
|
history_deep = deep_history;
|
||||||
T_rx_s = 0.0;
|
T_rx_s = 0.0;
|
||||||
T_rx_step_s = 1e-3;// todo: move to gnss-sdr config
|
T_rx_step_s = 1e-3; // todo: move to gnss-sdr config
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
|
||||||
d_gnss_synchro_history_queue.push_back(std::deque<Gnss_Synchro>());
|
|
||||||
}
|
|
||||||
//todo: this is a gnuradio scheduler hack.
|
|
||||||
// Migrate the queues to gnuradio set_history to see if the scheduler can handle
|
|
||||||
// the multiple output flow
|
|
||||||
d_max_noutputs = 100;
|
|
||||||
this->set_min_noutput_items(100);
|
|
||||||
|
|
||||||
// ############# ENABLE DATA FILE LOG #################
|
|
||||||
if (d_dump == true)
|
|
||||||
{
|
|
||||||
if (d_dump_file.is_open() == false)
|
|
||||||
{
|
{
|
||||||
try
|
d_gnss_synchro_history_queue.push_back(std::deque<Gnss_Synchro>());
|
||||||
{
|
}
|
||||||
d_dump_file.exceptions (std::ifstream::failbit | std::ifstream::badbit );
|
// todo: this is a gnuradio scheduler hack.
|
||||||
d_dump_file.open(d_dump_filename.c_str(), std::ios::out | std::ios::binary);
|
// Migrate the queues to gnuradio set_history to see if the scheduler can handle
|
||||||
LOG(INFO) << "Observables dump enabled Log file: " << d_dump_filename.c_str();
|
// the multiple output flow
|
||||||
}
|
d_max_noutputs = 100;
|
||||||
catch (const std::ifstream::failure & e)
|
this->set_min_noutput_items(100);
|
||||||
{
|
|
||||||
LOG(WARNING) << "Exception opening observables dump file " << e.what();
|
// ############# ENABLE DATA FILE LOG #################
|
||||||
}
|
if (d_dump == true)
|
||||||
|
{
|
||||||
|
if (d_dump_file.is_open() == false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
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) << "Observables dump enabled Log file: " << d_dump_filename.c_str();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure & e)
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Exception opening observables dump file " << e.what();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
hybrid_observables_cc::~hybrid_observables_cc()
|
hybrid_observables_cc::~hybrid_observables_cc()
|
||||||
{
|
{
|
||||||
if (d_dump_file.is_open() == true)
|
if (d_dump_file.is_open() == true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
d_dump_file.close();
|
d_dump_file.close();
|
||||||
}
|
}
|
||||||
catch(const std::exception & ex)
|
catch(const std::exception & ex)
|
||||||
{
|
{
|
||||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Hybrid_pairCompare_gnss_synchro_sample_counter(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
bool Hybrid_pairCompare_gnss_synchro_sample_counter(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||||
{
|
{
|
||||||
return (a.second.Tracking_sample_counter) < (b.second.Tracking_sample_counter);
|
return (a.second.Tracking_sample_counter) < (b.second.Tracking_sample_counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Hybrid_valueCompare_gnss_synchro_sample_counter(const Gnss_Synchro& a, unsigned long int b)
|
bool Hybrid_valueCompare_gnss_synchro_sample_counter(const Gnss_Synchro& a, unsigned long int b)
|
||||||
{
|
{
|
||||||
return (a.Tracking_sample_counter) < (b);
|
return (a.Tracking_sample_counter) < (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Hybrid_valueCompare_gnss_synchro_receiver_time(const Gnss_Synchro& a, double b)
|
bool Hybrid_valueCompare_gnss_synchro_receiver_time(const Gnss_Synchro& a, double b)
|
||||||
{
|
{
|
||||||
return (((double)a.Tracking_sample_counter+a.Code_phase_samples)/(double)a.fs) < (b);
|
return (((double)a.Tracking_sample_counter+a.Code_phase_samples)/(double)a.fs) < (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Hybrid_pairCompare_gnss_synchro_d_TOW(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
bool Hybrid_pairCompare_gnss_synchro_d_TOW(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||||
{
|
{
|
||||||
return (a.second.TOW_at_current_symbol_s) < (b.second.TOW_at_current_symbol_s);
|
return (a.second.TOW_at_current_symbol_s) < (b.second.TOW_at_current_symbol_s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Hybrid_valueCompare_gnss_synchro_d_TOW(const Gnss_Synchro& a, double b)
|
bool Hybrid_valueCompare_gnss_synchro_d_TOW(const Gnss_Synchro& a, double b)
|
||||||
{
|
{
|
||||||
return (a.TOW_at_current_symbol_s) < (b);
|
return (a.TOW_at_current_symbol_s) < (b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int hybrid_observables_cc::general_work (int noutput_items,
|
int hybrid_observables_cc::general_work (int noutput_items __attribute__((unused)),
|
||||||
gr_vector_int &ninput_items,
|
gr_vector_int &ninput_items,
|
||||||
gr_vector_const_void_star &input_items,
|
gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items)
|
gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
Gnss_Synchro **in = (Gnss_Synchro **) &input_items[0]; // Get the input pointer
|
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0]; // Get the output pointer
|
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
int n_outputs = 0;
|
int n_outputs = 0;
|
||||||
int n_consume[d_nchannels];
|
int n_consume[d_nchannels];
|
||||||
double past_history_s = 100e-3;
|
double past_history_s = 100e-3;
|
||||||
|
|
||||||
Gnss_Synchro current_gnss_synchro[d_nchannels];
|
Gnss_Synchro current_gnss_synchro[d_nchannels];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1. Read the GNSS SYNCHRO objects from available channels.
|
* 1. Read the GNSS SYNCHRO objects from available channels.
|
||||||
* Multi-rate GNURADIO Block. Read how many input items are avaliable in each channel
|
* Multi-rate GNURADIO Block. Read how many input items are avaliable in each channel
|
||||||
* Record all synchronization data into queues
|
* Record all synchronization data into queues
|
||||||
*/
|
*/
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
|
||||||
n_consume[i] = ninput_items[i];// full throttle
|
|
||||||
for (int j = 0; j < n_consume[i]; j++)
|
|
||||||
{
|
{
|
||||||
d_gnss_synchro_history_queue[i].push_back(in[i][j]);
|
n_consume[i] = ninput_items[i];// full throttle
|
||||||
}
|
for (int j = 0; j < n_consume[i]; j++)
|
||||||
//std::cout<<"push["<<i<<"] items "<<n_consume[i]
|
|
||||||
/// <<" latest T_rx: "<<(double)in[i][ninput_items[i]-1].Tracking_sample_counter/(double)in[i][ninput_items[i]-1].fs
|
|
||||||
// <<" [s] q size: "
|
|
||||||
// <<d_gnss_synchro_history_queue[i].size()
|
|
||||||
// <<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool channel_history_ok;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
channel_history_ok = true;
|
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
|
||||||
{
|
|
||||||
if (d_gnss_synchro_history_queue[i].size() < history_deep)
|
|
||||||
{
|
|
||||||
channel_history_ok = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (channel_history_ok == true)
|
|
||||||
{
|
|
||||||
std::map<int,Gnss_Synchro>::iterator gnss_synchro_map_iter;
|
|
||||||
std::deque<Gnss_Synchro>::iterator gnss_synchro_deque_iter;
|
|
||||||
|
|
||||||
//1. If the RX time is not set, set the Rx time
|
|
||||||
if (T_rx_s == 0)
|
|
||||||
{
|
|
||||||
//0. Read a gnss_synchro snapshot from the queue and store it in a map
|
|
||||||
std::map<int,Gnss_Synchro> gnss_synchro_map;
|
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
|
||||||
{
|
{
|
||||||
gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(
|
d_gnss_synchro_history_queue[i].push_back(in[i][j]);
|
||||||
d_gnss_synchro_history_queue[i].front().Channel_ID,
|
|
||||||
d_gnss_synchro_history_queue[i].front()));
|
|
||||||
}
|
}
|
||||||
gnss_synchro_map_iter = min_element(gnss_synchro_map.begin(),
|
//std::cout<<"push["<<i<<"] items "<<n_consume[i]
|
||||||
gnss_synchro_map.end(),
|
/// <<" latest T_rx: "<<(double)in[i][ninput_items[i]-1].Tracking_sample_counter/(double)in[i][ninput_items[i]-1].fs
|
||||||
Hybrid_pairCompare_gnss_synchro_sample_counter);
|
// <<" [s] q size: "
|
||||||
T_rx_s = (double)gnss_synchro_map_iter->second.Tracking_sample_counter / (double)gnss_synchro_map_iter->second.fs;
|
// <<d_gnss_synchro_history_queue[i].size()
|
||||||
T_rx_s = floor(T_rx_s * 1000.0) / 1000.0; // truncate to ms
|
// <<std::endl;
|
||||||
T_rx_s += past_history_s; // increase T_rx to have a minimum past history to interpolate
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//2. Realign RX time in all valid channels
|
bool channel_history_ok;
|
||||||
std::map<int,Gnss_Synchro> realigned_gnss_synchro_map; //container for the aligned set of observables for the selected T_rx
|
do
|
||||||
std::map<int,Gnss_Synchro> adjacent_gnss_synchro_map; //container for the previous observable values to interpolate
|
{
|
||||||
//shift channels history to match the reference TOW
|
channel_history_ok = true;
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
|
||||||
gnss_synchro_deque_iter = std::lower_bound(d_gnss_synchro_history_queue[i].begin(),
|
|
||||||
d_gnss_synchro_history_queue[i].end(),
|
|
||||||
T_rx_s,
|
|
||||||
Hybrid_valueCompare_gnss_synchro_receiver_time);
|
|
||||||
if (gnss_synchro_deque_iter != d_gnss_synchro_history_queue[i].end())
|
|
||||||
{
|
{
|
||||||
if (gnss_synchro_deque_iter->Flag_valid_word == true)
|
if (d_gnss_synchro_history_queue[i].size() < history_deep)
|
||||||
{
|
|
||||||
double T_rx_channel = (double)gnss_synchro_deque_iter->Tracking_sample_counter / (double)gnss_synchro_deque_iter->fs;
|
|
||||||
double delta_T_rx_s = T_rx_channel - T_rx_s;
|
|
||||||
|
|
||||||
//check that T_rx difference is less than a threshold (the correlation interval)
|
|
||||||
if (delta_T_rx_s * 1000.0 < (double)gnss_synchro_deque_iter->correlation_length_ms)
|
|
||||||
{
|
{
|
||||||
//record the word structure in a map for pseudorange computation
|
channel_history_ok = false;
|
||||||
//save the previous observable
|
}
|
||||||
int distance = std::distance(d_gnss_synchro_history_queue[i].begin(), gnss_synchro_deque_iter);
|
}
|
||||||
if (distance > 0)
|
if (channel_history_ok == true)
|
||||||
{
|
{
|
||||||
if (d_gnss_synchro_history_queue[i].at(distance-1).Flag_valid_word)
|
std::map<int,Gnss_Synchro>::const_iterator gnss_synchro_map_iter;
|
||||||
|
std::deque<Gnss_Synchro>::const_iterator gnss_synchro_deque_iter;
|
||||||
|
|
||||||
|
// 1. If the RX time is not set, set the Rx time
|
||||||
|
if (T_rx_s == 0)
|
||||||
|
{
|
||||||
|
// 0. Read a gnss_synchro snapshot from the queue and store it in a map
|
||||||
|
std::map<int,Gnss_Synchro> gnss_synchro_map;
|
||||||
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
{
|
||||||
double T_rx_channel_prev = (double)d_gnss_synchro_history_queue[i].at(distance - 1).Tracking_sample_counter / (double)gnss_synchro_deque_iter->fs;
|
gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(d_gnss_synchro_history_queue[i].front().Channel_ID,
|
||||||
double delta_T_rx_s_prev = T_rx_channel_prev - T_rx_s;
|
d_gnss_synchro_history_queue[i].front()));
|
||||||
if (fabs(delta_T_rx_s_prev) < fabs(delta_T_rx_s))
|
}
|
||||||
|
gnss_synchro_map_iter = min_element(gnss_synchro_map.cbegin(),
|
||||||
|
gnss_synchro_map.cend(),
|
||||||
|
Hybrid_pairCompare_gnss_synchro_sample_counter);
|
||||||
|
T_rx_s = static_cast<double>(gnss_synchro_map_iter->second.Tracking_sample_counter) / static_cast<double>(gnss_synchro_map_iter->second.fs);
|
||||||
|
T_rx_s = floor(T_rx_s * 1000.0) / 1000.0; // truncate to ms
|
||||||
|
T_rx_s += past_history_s; // increase T_rx to have a minimum past history to interpolate
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Realign RX time in all valid channels
|
||||||
|
std::map<int,Gnss_Synchro> realigned_gnss_synchro_map; // container for the aligned set of observables for the selected T_rx
|
||||||
|
std::map<int,Gnss_Synchro> adjacent_gnss_synchro_map; // container for the previous observable values to interpolate
|
||||||
|
// shift channels history to match the reference TOW
|
||||||
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
|
{
|
||||||
|
gnss_synchro_deque_iter = std::lower_bound(d_gnss_synchro_history_queue[i].cbegin(),
|
||||||
|
d_gnss_synchro_history_queue[i].cend(),
|
||||||
|
T_rx_s,
|
||||||
|
Hybrid_valueCompare_gnss_synchro_receiver_time);
|
||||||
|
if (gnss_synchro_deque_iter != d_gnss_synchro_history_queue[i].cend())
|
||||||
|
{
|
||||||
|
if (gnss_synchro_deque_iter->Flag_valid_word == true)
|
||||||
|
{
|
||||||
|
double T_rx_channel = static_cast<double>(gnss_synchro_deque_iter->Tracking_sample_counter) / static_cast<double>(gnss_synchro_deque_iter->fs);
|
||||||
|
double delta_T_rx_s = T_rx_channel - T_rx_s;
|
||||||
|
|
||||||
|
// check that T_rx difference is less than a threshold (the correlation interval)
|
||||||
|
if (delta_T_rx_s * 1000.0 < static_cast<double>(gnss_synchro_deque_iter->correlation_length_ms))
|
||||||
|
{
|
||||||
|
// record the word structure in a map for pseudorange computation
|
||||||
|
// save the previous observable
|
||||||
|
int distance = std::distance(d_gnss_synchro_history_queue[i].cbegin(), gnss_synchro_deque_iter);
|
||||||
|
if (distance > 0)
|
||||||
|
{
|
||||||
|
if (d_gnss_synchro_history_queue[i].at(distance - 1).Flag_valid_word)
|
||||||
|
{
|
||||||
|
double T_rx_channel_prev = static_cast<double>(d_gnss_synchro_history_queue[i].at(distance - 1).Tracking_sample_counter) / static_cast<double>(gnss_synchro_deque_iter->fs);
|
||||||
|
double delta_T_rx_s_prev = T_rx_channel_prev - T_rx_s;
|
||||||
|
if (fabs(delta_T_rx_s_prev) < fabs(delta_T_rx_s))
|
||||||
|
{
|
||||||
|
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(d_gnss_synchro_history_queue[i].at(distance - 1).Channel_ID,
|
||||||
|
d_gnss_synchro_history_queue[i].at(distance - 1)));
|
||||||
|
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
||||||
|
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(d_gnss_synchro_history_queue[i].at(distance - 1).Channel_ID,
|
||||||
|
d_gnss_synchro_history_queue[i].at(distance - 1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//std::cout<<"ch["<<i<<"] delta_T_rx:"<<delta_T_rx_s*1000.0<<std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!realigned_gnss_synchro_map.empty())
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* 2.1 Use CURRENT set of measurements and find the nearest satellite
|
||||||
|
* common RX time algorithm
|
||||||
|
*/
|
||||||
|
// what is the most recent symbol TOW in the current set? -> this will be the reference symbol
|
||||||
|
gnss_synchro_map_iter = max_element(realigned_gnss_synchro_map.cbegin(),
|
||||||
|
realigned_gnss_synchro_map.cend(),
|
||||||
|
Hybrid_pairCompare_gnss_synchro_d_TOW);
|
||||||
|
double ref_fs_hz = static_cast<double>(gnss_synchro_map_iter->second.fs);
|
||||||
|
|
||||||
|
// compute interpolated TOW value at T_rx_s
|
||||||
|
int ref_channel_key = gnss_synchro_map_iter->second.Channel_ID;
|
||||||
|
Gnss_Synchro adj_obs = adjacent_gnss_synchro_map.at(ref_channel_key);
|
||||||
|
double ref_adj_T_rx_s = static_cast<double>(adj_obs.Tracking_sample_counter) / ref_fs_hz + adj_obs.Code_phase_samples / ref_fs_hz;
|
||||||
|
|
||||||
|
double d_TOW_reference = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
|
||||||
|
double d_ref_T_rx_s = static_cast<double>(gnss_synchro_map_iter->second.Tracking_sample_counter) / ref_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / ref_fs_hz;
|
||||||
|
|
||||||
|
double selected_T_rx_s = T_rx_s;
|
||||||
|
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
|
||||||
|
double ref_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s +
|
||||||
|
(selected_T_rx_s - ref_adj_T_rx_s) * (d_TOW_reference - adj_obs.TOW_at_current_symbol_s) / (d_ref_T_rx_s - ref_adj_T_rx_s);
|
||||||
|
|
||||||
|
// Now compute RX time differences due to the PRN alignment in the correlators
|
||||||
|
double traveltime_ms;
|
||||||
|
double pseudorange_m;
|
||||||
|
double channel_T_rx_s;
|
||||||
|
double channel_fs_hz;
|
||||||
|
double channel_TOW_s;
|
||||||
|
for(gnss_synchro_map_iter = realigned_gnss_synchro_map.cbegin(); gnss_synchro_map_iter != realigned_gnss_synchro_map.cend(); gnss_synchro_map_iter++)
|
||||||
|
{
|
||||||
|
channel_fs_hz = static_cast<double>(gnss_synchro_map_iter->second.fs);
|
||||||
|
channel_TOW_s = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
|
||||||
|
channel_T_rx_s = static_cast<double>(gnss_synchro_map_iter->second.Tracking_sample_counter) / channel_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / channel_fs_hz;
|
||||||
|
// compute interpolated observation values
|
||||||
|
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
|
||||||
|
// TOW at the selected receiver time T_rx_s
|
||||||
|
int element_key = gnss_synchro_map_iter->second.Channel_ID;
|
||||||
|
adj_obs = adjacent_gnss_synchro_map.at(element_key);
|
||||||
|
|
||||||
|
double adj_T_rx_s = static_cast<double>(adj_obs.Tracking_sample_counter) / channel_fs_hz + adj_obs.Code_phase_samples / channel_fs_hz;
|
||||||
|
|
||||||
|
double channel_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - adj_T_rx_s) * (channel_TOW_s - adj_obs.TOW_at_current_symbol_s) / (channel_T_rx_s - adj_T_rx_s);
|
||||||
|
|
||||||
|
// Doppler and Accumulated carrier phase
|
||||||
|
double Carrier_phase_lin_rads = adj_obs.Carrier_phase_rads + (selected_T_rx_s - adj_T_rx_s) * (gnss_synchro_map_iter->second.Carrier_phase_rads - adj_obs.Carrier_phase_rads) / (channel_T_rx_s - adj_T_rx_s);
|
||||||
|
double Carrier_Doppler_lin_hz = adj_obs.Carrier_Doppler_hz + (selected_T_rx_s - adj_T_rx_s) * (gnss_synchro_map_iter->second.Carrier_Doppler_hz - adj_obs.Carrier_Doppler_hz) / (channel_T_rx_s - adj_T_rx_s);
|
||||||
|
|
||||||
|
// compute the pseudorange (no rx time offset correction)
|
||||||
|
traveltime_ms = (ref_TOW_at_T_rx_s - channel_TOW_at_T_rx_s) * 1000.0 + GPS_STARTOFFSET_ms;
|
||||||
|
// convert to meters
|
||||||
|
pseudorange_m = traveltime_ms * GPS_C_m_ms; // [m]
|
||||||
|
// update the pseudorange object
|
||||||
|
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID] = gnss_synchro_map_iter->second;
|
||||||
|
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Pseudorange_m = pseudorange_m;
|
||||||
|
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Flag_valid_pseudorange = true;
|
||||||
|
// Save the estimated RX time (no RX clock offset correction yet!)
|
||||||
|
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].RX_time = ref_TOW_at_T_rx_s + GPS_STARTOFFSET_ms / 1000.0;
|
||||||
|
|
||||||
|
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Carrier_phase_rads = Carrier_phase_lin_rads;
|
||||||
|
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Carrier_Doppler_hz = Carrier_Doppler_lin_hz;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(d_dump == true)
|
||||||
|
{
|
||||||
|
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||||
|
try
|
||||||
{
|
{
|
||||||
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(
|
double tmp_double;
|
||||||
d_gnss_synchro_history_queue[i].at(distance-1).Channel_ID,
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
d_gnss_synchro_history_queue[i].at(distance-1)));
|
{
|
||||||
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
tmp_double = current_gnss_synchro[i].RX_time;
|
||||||
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
|
tmp_double = current_gnss_synchro[i].TOW_at_current_symbol_s;
|
||||||
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
|
tmp_double = current_gnss_synchro[i].Carrier_Doppler_hz;
|
||||||
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
|
tmp_double = current_gnss_synchro[i].Carrier_phase_rads/GPS_TWO_PI;
|
||||||
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
|
tmp_double = current_gnss_synchro[i].Pseudorange_m;
|
||||||
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
|
tmp_double = current_gnss_synchro[i].PRN;
|
||||||
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
|
tmp_double = current_gnss_synchro[i].Flag_valid_pseudorange;
|
||||||
|
d_dump_file.write(reinterpret_cast<char*>(&tmp_double), sizeof(double));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (const std::ifstream::failure& e)
|
||||||
{
|
{
|
||||||
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
LOG(WARNING) << "Exception writing observables dump file " << e.what();
|
||||||
adjacent_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(
|
|
||||||
d_gnss_synchro_history_queue[i].at(distance-1).Channel_ID,
|
|
||||||
d_gnss_synchro_history_queue[i].at(distance-1)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
realigned_gnss_synchro_map.insert(std::pair<int, Gnss_Synchro>(gnss_synchro_deque_iter->Channel_ID, *gnss_synchro_deque_iter));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
|
{
|
||||||
|
out[i][n_outputs] = current_gnss_synchro[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
n_outputs++;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
// Move RX time
|
||||||
|
T_rx_s = T_rx_s + T_rx_step_s;
|
||||||
|
// pop old elements from queue
|
||||||
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
{
|
{
|
||||||
//std::cout<<"ch["<<i<<"] delta_T_rx:"<<delta_T_rx_s*1000.0<<std::endl;
|
while (static_cast<double>(d_gnss_synchro_history_queue[i].front().Tracking_sample_counter) / static_cast<double>(d_gnss_synchro_history_queue[i].front().fs) < (T_rx_s - past_history_s))
|
||||||
|
{
|
||||||
|
d_gnss_synchro_history_queue[i].pop_front();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
} while(channel_history_ok == true && d_max_noutputs > n_outputs);
|
||||||
|
|
||||||
if(!realigned_gnss_synchro_map.empty())
|
// Multi-rate consume!
|
||||||
{
|
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||||
/*
|
{
|
||||||
* 2.1 Use CURRENT set of measurements and find the nearest satellite
|
consume(i, n_consume[i]); // which input, how many items
|
||||||
* common RX time algorithm
|
|
||||||
*/
|
|
||||||
// what is the most recent symbol TOW in the current set? -> this will be the reference symbol
|
|
||||||
gnss_synchro_map_iter = max_element(realigned_gnss_synchro_map.begin(),
|
|
||||||
realigned_gnss_synchro_map.end(),
|
|
||||||
Hybrid_pairCompare_gnss_synchro_d_TOW);
|
|
||||||
double ref_fs_hz = (double)gnss_synchro_map_iter->second.fs;
|
|
||||||
|
|
||||||
// compute interpolated TOW value at T_rx_s
|
|
||||||
int ref_channel_key = gnss_synchro_map_iter->second.Channel_ID;
|
|
||||||
Gnss_Synchro adj_obs = adjacent_gnss_synchro_map.at(ref_channel_key);
|
|
||||||
double ref_adj_T_rx_s = (double)adj_obs.Tracking_sample_counter / ref_fs_hz + adj_obs.Code_phase_samples / ref_fs_hz;
|
|
||||||
|
|
||||||
double d_TOW_reference = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
|
|
||||||
double d_ref_T_rx_s = (double)gnss_synchro_map_iter->second.Tracking_sample_counter / ref_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / ref_fs_hz;
|
|
||||||
|
|
||||||
double selected_T_rx_s = T_rx_s;
|
|
||||||
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
|
|
||||||
double ref_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - ref_adj_T_rx_s)
|
|
||||||
* (d_TOW_reference - adj_obs.TOW_at_current_symbol_s) / (d_ref_T_rx_s - ref_adj_T_rx_s);
|
|
||||||
|
|
||||||
// Now compute RX time differences due to the PRN alignment in the correlators
|
|
||||||
double traveltime_ms;
|
|
||||||
double pseudorange_m;
|
|
||||||
double channel_T_rx_s;
|
|
||||||
double channel_fs_hz;
|
|
||||||
double channel_TOW_s;
|
|
||||||
for(gnss_synchro_map_iter = realigned_gnss_synchro_map.begin(); gnss_synchro_map_iter != realigned_gnss_synchro_map.end(); gnss_synchro_map_iter++)
|
|
||||||
{
|
|
||||||
channel_fs_hz = (double)gnss_synchro_map_iter->second.fs;
|
|
||||||
channel_TOW_s = gnss_synchro_map_iter->second.TOW_at_current_symbol_s;
|
|
||||||
channel_T_rx_s = (double)gnss_synchro_map_iter->second.Tracking_sample_counter / channel_fs_hz + gnss_synchro_map_iter->second.Code_phase_samples / channel_fs_hz;
|
|
||||||
// compute interpolated observation values
|
|
||||||
// two points linear interpolation using adjacent (adj) values: y=y1+(x-x1)*(y2-y1)/(x2-x1)
|
|
||||||
// TOW at the selected receiver time T_rx_s
|
|
||||||
int element_key = gnss_synchro_map_iter->second.Channel_ID;
|
|
||||||
adj_obs = adjacent_gnss_synchro_map.at(element_key);
|
|
||||||
|
|
||||||
double adj_T_rx_s = (double)adj_obs.Tracking_sample_counter / channel_fs_hz + adj_obs.Code_phase_samples / channel_fs_hz;
|
|
||||||
|
|
||||||
double channel_TOW_at_T_rx_s = adj_obs.TOW_at_current_symbol_s + (selected_T_rx_s - adj_T_rx_s) * (channel_TOW_s - adj_obs.TOW_at_current_symbol_s) / (channel_T_rx_s - adj_T_rx_s);
|
|
||||||
|
|
||||||
//Doppler and Accumulated carrier phase
|
|
||||||
double Carrier_phase_lin_rads = adj_obs.Carrier_phase_rads + (selected_T_rx_s - adj_T_rx_s) * (gnss_synchro_map_iter->second.Carrier_phase_rads - adj_obs.Carrier_phase_rads) / (channel_T_rx_s - adj_T_rx_s);
|
|
||||||
double Carrier_Doppler_lin_hz = adj_obs.Carrier_Doppler_hz + (selected_T_rx_s - adj_T_rx_s) * (gnss_synchro_map_iter->second.Carrier_Doppler_hz - adj_obs.Carrier_Doppler_hz) / (channel_T_rx_s - adj_T_rx_s);
|
|
||||||
|
|
||||||
//compute the pseudorange (no rx time offset correction)
|
|
||||||
traveltime_ms = (ref_TOW_at_T_rx_s - channel_TOW_at_T_rx_s) * 1000.0 + GPS_STARTOFFSET_ms;
|
|
||||||
//convert to meters
|
|
||||||
pseudorange_m = traveltime_ms * GPS_C_m_ms; // [m]
|
|
||||||
// update the pseudorange object
|
|
||||||
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID] = gnss_synchro_map_iter->second;
|
|
||||||
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Pseudorange_m = pseudorange_m;
|
|
||||||
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Flag_valid_pseudorange = true;
|
|
||||||
// Save the estimated RX time (no RX clock offset correction yet!)
|
|
||||||
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].RX_time = ref_TOW_at_T_rx_s + GPS_STARTOFFSET_ms / 1000.0;
|
|
||||||
|
|
||||||
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Carrier_phase_rads = Carrier_phase_lin_rads;
|
|
||||||
current_gnss_synchro[gnss_synchro_map_iter->second.Channel_ID].Carrier_Doppler_hz = Carrier_Doppler_lin_hz;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(d_dump == true)
|
|
||||||
{
|
|
||||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
|
||||||
try
|
|
||||||
{
|
|
||||||
double tmp_double;
|
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
|
||||||
{
|
|
||||||
tmp_double = current_gnss_synchro[i].RX_time;
|
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
tmp_double = current_gnss_synchro[i].TOW_at_current_symbol_s;
|
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
tmp_double = current_gnss_synchro[i].Carrier_Doppler_hz;
|
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
tmp_double = current_gnss_synchro[i].Carrier_phase_rads/GPS_TWO_PI;
|
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
tmp_double = current_gnss_synchro[i].Pseudorange_m;
|
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
tmp_double = current_gnss_synchro[i].PRN;
|
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
tmp_double = current_gnss_synchro[i].Flag_valid_pseudorange;
|
|
||||||
d_dump_file.write((char*)&tmp_double, sizeof(double));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (const std::ifstream::failure& e)
|
|
||||||
{
|
|
||||||
LOG(WARNING) << "Exception writing observables dump file " << e.what();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
|
||||||
{
|
|
||||||
out[i][n_outputs] = current_gnss_synchro[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
n_outputs++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Move RX time
|
|
||||||
T_rx_s = T_rx_s + T_rx_step_s;
|
|
||||||
//pop old elements from queue
|
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
|
||||||
{
|
|
||||||
while (d_gnss_synchro_history_queue[i].front().Tracking_sample_counter / (double)d_gnss_synchro_history_queue[i].front().fs < (T_rx_s - past_history_s))
|
|
||||||
{
|
|
||||||
d_gnss_synchro_history_queue[i].pop_front();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}while(channel_history_ok == true && d_max_noutputs>n_outputs);
|
|
||||||
|
|
||||||
//Multi-rate consume!
|
return n_outputs;
|
||||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
|
||||||
{
|
|
||||||
consume(i, n_consume[i]); //which input, how many items
|
|
||||||
}
|
|
||||||
|
|
||||||
return n_outputs;
|
|
||||||
}
|
}
|
||||||
|
@ -52,26 +52,26 @@ hybrid_make_observables_cc(unsigned int n_channels, bool dump, std::string dump_
|
|||||||
class hybrid_observables_cc : public gr::block
|
class hybrid_observables_cc : public gr::block
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~hybrid_observables_cc ();
|
~hybrid_observables_cc ();
|
||||||
int general_work (int noutput_items, gr_vector_int &ninput_items,
|
int 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_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend hybrid_observables_cc_sptr
|
friend hybrid_observables_cc_sptr
|
||||||
hybrid_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
hybrid_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
||||||
hybrid_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
hybrid_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
||||||
|
|
||||||
//Tracking observable history
|
//Tracking observable history
|
||||||
std::vector<std::deque<Gnss_Synchro>> d_gnss_synchro_history_queue;
|
std::vector<std::deque<Gnss_Synchro>> d_gnss_synchro_history_queue;
|
||||||
|
|
||||||
double T_rx_s;
|
double T_rx_s;
|
||||||
double T_rx_step_s;
|
double T_rx_step_s;
|
||||||
int d_max_noutputs;
|
int d_max_noutputs;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
unsigned int d_nchannels;
|
unsigned int d_nchannels;
|
||||||
unsigned int history_deep;
|
unsigned int history_deep;
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,6 +21,36 @@ list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS)
|
|||||||
|
|
||||||
# Optional drivers
|
# Optional drivers
|
||||||
|
|
||||||
|
if(ENABLE_PLUTOSDR)
|
||||||
|
##############################################
|
||||||
|
# ADALM-PLUTO (Analog Devices Inc.)
|
||||||
|
##############################################
|
||||||
|
find_package(iio REQUIRED)
|
||||||
|
if(NOT IIO_FOUND)
|
||||||
|
message("gnuradio-iio not found, installation is required")
|
||||||
|
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled")
|
||||||
|
else(NOT IIO_FOUND)
|
||||||
|
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
|
||||||
|
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
|
||||||
|
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc)
|
||||||
|
endif(NOT IIO_FOUND)
|
||||||
|
endif(ENABLE_PLUTOSDR)
|
||||||
|
|
||||||
|
if(ENABLE_FMCOMMS2)
|
||||||
|
###############################################
|
||||||
|
# FMCOMMS2 based SDR Hardware
|
||||||
|
###############################################
|
||||||
|
find_package(iio REQUIRED)
|
||||||
|
if(NOT IIO_FOUND)
|
||||||
|
message("gnuradio-iio not found, installation is required")
|
||||||
|
message(FATAL_ERROR "gnuradio-iio required for building gnss-sdr with this option enabled")
|
||||||
|
else(NOT IIO_FOUND)
|
||||||
|
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES})
|
||||||
|
set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS})
|
||||||
|
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc plutosdr_signal_source.cc)
|
||||||
|
endif(NOT IIO_FOUND)
|
||||||
|
endif(ENABLE_FMCOMMS2)
|
||||||
|
|
||||||
if(ENABLE_GN3S)
|
if(ENABLE_GN3S)
|
||||||
##############################################
|
##############################################
|
||||||
# GN3S (USB dongle)
|
# GN3S (USB dongle)
|
||||||
|
179
src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc
Normal file
179
src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
/*!
|
||||||
|
* \filei fmcomms2_signal_source.cc
|
||||||
|
* \brief signal source for sdr hardware from analog devices based on
|
||||||
|
* fmcomms2 evaluation board.
|
||||||
|
* \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fmcomms2_signal_source.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "GPS_L1_CA.h"
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||||
|
boost::shared_ptr<gr::msg_queue> queue) :
|
||||||
|
role_(role), in_stream_(in_stream), out_stream_(out_stream),
|
||||||
|
queue_(queue)
|
||||||
|
{
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_file = "./data/signal_source.dat";
|
||||||
|
uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1"));
|
||||||
|
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
||||||
|
sample_rate_ = configuration->property(role + ".sampling_frequency", 2600000);
|
||||||
|
bandwidth_ = configuration->property(role + ".bandwidth", 2000000);
|
||||||
|
rx1_en_ = configuration->property(role + ".rx1_enable", true);
|
||||||
|
rx2_en_ = configuration->property(role + ".rx2_enable", false);
|
||||||
|
buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000);
|
||||||
|
decimation_ = configuration->property(role + ".decimation", 1);
|
||||||
|
quadrature_ = configuration->property(role + ".quadrature", true);
|
||||||
|
rf_dc_ = configuration->property(role + ".rf_dc", true);
|
||||||
|
bb_dc_ = configuration->property(role + ".bb_dc", true);
|
||||||
|
gain_mode_rx1_ = configuration->property(role + ".gain_mode_rx1", std::string("manual"));
|
||||||
|
gain_mode_rx2_ = configuration->property(role + ".gain_mode_rx2", std::string("manual"));
|
||||||
|
rf_gain_rx1_ = configuration->property(role + ".gain_rx1", 64.0);
|
||||||
|
rf_gain_rx2_ = configuration->property(role + ".gain_rx2", 64.0);
|
||||||
|
rf_port_select_ = configuration->property(role + ".rf_port_select", std::string("A_BALANCED"));
|
||||||
|
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||||
|
filter_auto_ = configuration->property(role + ".filter_auto", true);
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
samples_ = configuration->property(role + ".samples", 0);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||||
|
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
|
||||||
|
std::cout << "device address: " << uri_ << std::endl;
|
||||||
|
std::cout << "LO frequency : " << freq_ << "Hz" << std::endl;
|
||||||
|
std::cout << "sample rate: " << sample_rate_ << "Hz" << std::endl;
|
||||||
|
|
||||||
|
if(item_type_.compare("gr_complex")==0)
|
||||||
|
{
|
||||||
|
fmcomms2_source_f32c_ = gr::iio::fmcomms2_source_f32c::make(
|
||||||
|
uri_.c_str(), freq_, sample_rate_,
|
||||||
|
decimation_, bandwidth_,
|
||||||
|
rx1_en_, rx2_en_,
|
||||||
|
buffer_size_, quadrature_, rf_dc_,
|
||||||
|
bb_dc_, gain_mode_rx1_.c_str(), rf_gain_rx1_,
|
||||||
|
gain_mode_rx2_.c_str(), rf_gain_rx2_,
|
||||||
|
rf_port_select_.c_str(), filter_file_.c_str(),
|
||||||
|
filter_auto_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG(FATAL) << "Exception: item type " << item_type_ << " not suported!";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
|
||||||
|
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
|
||||||
|
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||||
|
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
||||||
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Fmcomms2SignalSource::~Fmcomms2SignalSource()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Fmcomms2SignalSource::connect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
top_block->connect(fmcomms2_source_f32c_, 0, valve_, 0);
|
||||||
|
DLOG(INFO) << "connected fmcomms2 source to valve";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(valve_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected valve to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
|
||||||
|
top_block->connect(fmcomms2_source_f32c_ , 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected fmcomms2 source to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Fmcomms2SignalSource::disconnect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
top_block->disconnect(fmcomms2_source_f32c_, 0, valve_, 0);
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(valve_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(fmcomms2_source_f32c_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr Fmcomms2SignalSource::get_left_block()
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Trying to get signal source left block.";
|
||||||
|
return gr::basic_block_sptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr Fmcomms2SignalSource::get_right_block()
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
return valve_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return (fmcomms2_source_f32c_);
|
||||||
|
}
|
||||||
|
}
|
116
src/algorithms/signal_source/adapters/fmcomms2_signal_source.h
Normal file
116
src/algorithms/signal_source/adapters/fmcomms2_signal_source.h
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/*!
|
||||||
|
* \file fmcomms2_signal_source.h
|
||||||
|
* \brief Interface to use SDR hardware based in FMCOMMS2 driver from analog
|
||||||
|
* devices, for example FMCOMMS4 and ADALM-PLUTO (PlutoSdr)
|
||||||
|
* \author Rodrigo Muñoz, 2017. rmunozl(at)inacap.cl
|
||||||
|
*
|
||||||
|
* This class represent a fmcomms2 signal source. It use the gr_iio block
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H_
|
||||||
|
#define GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
|
#include <iio/fmcomms2_source.h>
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
class Fmcomms2SignalSource: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Fmcomms2SignalSource(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_stream,
|
||||||
|
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||||
|
|
||||||
|
virtual ~Fmcomms2SignalSource();
|
||||||
|
|
||||||
|
inline std::string role() override
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns "fmcomms2_Signal_Source"
|
||||||
|
*/
|
||||||
|
inline std::string implementation() override
|
||||||
|
{
|
||||||
|
return "Fmcomms2_Signal_Source";
|
||||||
|
}
|
||||||
|
|
||||||
|
inline size_t item_size() override
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr::top_block_sptr top_block) override;
|
||||||
|
void disconnect(gr::top_block_sptr top_block) override;
|
||||||
|
gr::basic_block_sptr get_left_block() override;
|
||||||
|
gr::basic_block_sptr get_right_block() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string role_;
|
||||||
|
|
||||||
|
// Front-end settings
|
||||||
|
std::string uri_;//device direction
|
||||||
|
unsigned long freq_; //frequency of local oscilator
|
||||||
|
unsigned long sample_rate_;
|
||||||
|
unsigned long bandwidth_;
|
||||||
|
unsigned long buffer_size_; //reception buffer
|
||||||
|
unsigned int decimation_;
|
||||||
|
bool rx1_en_;
|
||||||
|
bool rx2_en_;
|
||||||
|
bool quadrature_;
|
||||||
|
bool rf_dc_;
|
||||||
|
bool bb_dc_;
|
||||||
|
std::string gain_mode_rx1_;
|
||||||
|
std::string gain_mode_rx2_;
|
||||||
|
double rf_gain_rx1_;
|
||||||
|
double rf_gain_rx2_;
|
||||||
|
std::string rf_port_select_;
|
||||||
|
std::string filter_file_;
|
||||||
|
bool filter_auto_;
|
||||||
|
|
||||||
|
unsigned int in_stream_;
|
||||||
|
unsigned int out_stream_;
|
||||||
|
|
||||||
|
std::string item_type_;
|
||||||
|
size_t item_size_;
|
||||||
|
long samples_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
gr::iio::fmcomms2_source_f32c::sptr fmcomms2_source_f32c_;
|
||||||
|
|
||||||
|
boost::shared_ptr<gr::block> valve_;
|
||||||
|
gr::blocks::file_sink::sptr file_sink_;
|
||||||
|
boost::shared_ptr<gr::msg_queue> queue_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_FMCOMMS2_SIGNAL_SOURCE_H_*/
|
169
src/algorithms/signal_source/adapters/plutosdr_signal_source.cc
Normal file
169
src/algorithms/signal_source/adapters/plutosdr_signal_source.cc
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
/*!
|
||||||
|
* \file plutosdr_signal_source.cc
|
||||||
|
* \brief Signal source for PlutoSDR
|
||||||
|
* \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "plutosdr_signal_source.h"
|
||||||
|
#include <iostream>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
#include <glog/logging.h>
|
||||||
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "GPS_L1_CA.h"
|
||||||
|
|
||||||
|
|
||||||
|
using google::LogMessage;
|
||||||
|
|
||||||
|
|
||||||
|
PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_stream, unsigned int out_stream,
|
||||||
|
boost::shared_ptr<gr::msg_queue> queue) :
|
||||||
|
role_(role), in_stream_(in_stream), out_stream_(out_stream),
|
||||||
|
queue_(queue)
|
||||||
|
{
|
||||||
|
std::string default_item_type = "gr_complex";
|
||||||
|
std::string default_dump_file = "./data/signal_source.dat";
|
||||||
|
uri_ = configuration->property(role + ".device_address", std::string("192.168.2.1"));
|
||||||
|
freq_ = configuration->property(role + ".freq", GPS_L1_FREQ_HZ);
|
||||||
|
sample_rate_ configuration->property(role + ".sampling_frequency", 3000000);
|
||||||
|
bandwidth_ = configuration->property(role + ".bandwidth", 2000000);
|
||||||
|
buffer_size_ = configuration->property(role + ".buffer_size", 0xA0000);
|
||||||
|
decimation_ = configuration->property(role + ".decimation", 1);
|
||||||
|
quadrature_ = configuration->property(role + ".quadrature", true);
|
||||||
|
rf_dc_ = configuration->property(role + ".rf_dc", true);
|
||||||
|
bb_dc_ = configuration->property(role + ".bb_dc", true);
|
||||||
|
gain_mode_ = configuration->property(role + ".gain_mode", std::string("manual"));
|
||||||
|
rf_gain_ = configuration->property(role + ".gain", 50.0);
|
||||||
|
filter_file_ = configuration->property(role + ".filter_file", std::string(""));
|
||||||
|
filter_auto_ = configuration->property(role + ".filter_auto", true);
|
||||||
|
|
||||||
|
item_type_ = configuration->property(role + ".item_type", default_item_type);
|
||||||
|
samples_ = configuration->property(role + ".samples", 0);
|
||||||
|
dump_ = configuration->property(role + ".dump", false);
|
||||||
|
dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file);
|
||||||
|
|
||||||
|
if(item_type_.compare("gr_complex") != 0)
|
||||||
|
{
|
||||||
|
std::cout << "bad item_type!!" << std::endl;
|
||||||
|
LOG(FATAL) << "Exception: item type must be gr_complex!";
|
||||||
|
}
|
||||||
|
|
||||||
|
item_size_ = sizeof(gr_complex);
|
||||||
|
|
||||||
|
std::cout << "device address: " << uri_ << std::endl;
|
||||||
|
std::cout << "frequency : " << freq_ << "Hz" << std::endl;
|
||||||
|
std::cout << "sample rate: " << sample_rate_ << "Hz" << std::endl;
|
||||||
|
std::cout << "gain mode: " << gain_mode_ << std::endl;
|
||||||
|
std::cout << "item type: " << item_type_ << std::endl;
|
||||||
|
|
||||||
|
plutosdr_source_ = gr::iio::pluto_source::make(uri_, freq_, sample_rate_,
|
||||||
|
decimation_, bandwidth_, buffer_size_, quadrature_, rf_dc_, bb_dc_,
|
||||||
|
gain_mode_.c_str(), rf_gain_,filter_file_.c_str(), filter_auto_);
|
||||||
|
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Send STOP signal after " << samples_ << " samples";
|
||||||
|
valve_ = gnss_sdr_make_valve(item_size_, samples_, queue_);
|
||||||
|
DLOG(INFO) << "valve(" << valve_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
DLOG(INFO) << "Dumping output into file " << dump_filename_;
|
||||||
|
file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str());
|
||||||
|
DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PlutosdrSignalSource::~PlutosdrSignalSource()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void PlutosdrSignalSource::connect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
top_block->connect(plutosdr_source_, 0, valve_, 0);
|
||||||
|
DLOG(INFO) << "connected plutosdr source to valve";
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(valve_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected valve to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->connect(plutosdr_source_, 0, file_sink_, 0);
|
||||||
|
DLOG(INFO) << "connected plutosdr source to file sink";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PlutosdrSignalSource::disconnect(gr::top_block_sptr top_block)
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
top_block->disconnect(plutosdr_source_, 0, valve_, 0);
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(valve_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (dump_)
|
||||||
|
{
|
||||||
|
top_block->disconnect(plutosdr_source_, 0, file_sink_, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr PlutosdrSignalSource::get_left_block()
|
||||||
|
{
|
||||||
|
LOG(WARNING) << "Trying to get signal source left block.";
|
||||||
|
return gr::basic_block_sptr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gr::basic_block_sptr PlutosdrSignalSource::get_right_block()
|
||||||
|
{
|
||||||
|
if (samples_ != 0)
|
||||||
|
{
|
||||||
|
return valve_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return plutosdr_source_;
|
||||||
|
}
|
||||||
|
}
|
111
src/algorithms/signal_source/adapters/plutosdr_signal_source.h
Normal file
111
src/algorithms/signal_source/adapters/plutosdr_signal_source.h
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/*!
|
||||||
|
* \file plutosdr_signal_source.h
|
||||||
|
* \brief Signal source for PlutoSDR
|
||||||
|
* \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_
|
||||||
|
#define GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <gnuradio/blocks/file_sink.h>
|
||||||
|
#include <iio/pluto_source.h>
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
|
||||||
|
class ConfigurationInterface;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
*/
|
||||||
|
class PlutosdrSignalSource: public GNSSBlockInterface
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PlutosdrSignalSource(ConfigurationInterface* configuration,
|
||||||
|
std::string role, unsigned int in_stream,
|
||||||
|
unsigned int out_stream, boost::shared_ptr<gr::msg_queue> queue);
|
||||||
|
|
||||||
|
virtual ~PlutosdrSignalSource();
|
||||||
|
|
||||||
|
std::string role() override
|
||||||
|
{
|
||||||
|
return role_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns "Plutosdr_Signal_Source"
|
||||||
|
*/
|
||||||
|
std::string implementation() override
|
||||||
|
{
|
||||||
|
return "Plutosdr_Signal_Source";
|
||||||
|
}
|
||||||
|
size_t item_size() override
|
||||||
|
{
|
||||||
|
return item_size_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void connect(gr::top_block_sptr top_block) override;
|
||||||
|
void disconnect(gr::top_block_sptr top_block) override;
|
||||||
|
gr::basic_block_sptr get_left_block() override;
|
||||||
|
gr::basic_block_sptr get_right_block() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string role_;
|
||||||
|
|
||||||
|
// Front-end settings
|
||||||
|
std::string uri_; // device direction
|
||||||
|
unsigned long freq_; // frequency of local oscilator
|
||||||
|
unsigned long sample_rate_;
|
||||||
|
unsigned long bandwidth_;
|
||||||
|
unsigned long buffer_size_; // reception buffer
|
||||||
|
unsigned int decimation_;
|
||||||
|
bool quadrature_;
|
||||||
|
bool rf_dc_;
|
||||||
|
bool bb_dc_;
|
||||||
|
std::string gain_mode_;
|
||||||
|
double rf_gain_;
|
||||||
|
std::string filter_file_;
|
||||||
|
bool filter_auto_;
|
||||||
|
|
||||||
|
unsigned int in_stream_;
|
||||||
|
unsigned int out_stream_;
|
||||||
|
|
||||||
|
std::string item_type_;
|
||||||
|
size_t item_size_;
|
||||||
|
long samples_;
|
||||||
|
bool dump_;
|
||||||
|
std::string dump_filename_;
|
||||||
|
|
||||||
|
gr::iio::pluto_source::sptr plutosdr_source_;
|
||||||
|
|
||||||
|
boost::shared_ptr<gr::block> valve_;
|
||||||
|
gr::blocks::file_sink::sptr file_sink_;
|
||||||
|
boost::shared_ptr<gr::msg_queue> queue_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /*GNSS_SDR_PLUTOSDR_SIGNAL_SOURCE_H_*/
|
@ -36,7 +36,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
|
#ifndef GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
|
||||||
#define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
|
#define GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
|
||||||
|
|
||||||
#include "rtl_tcp_dongle_info.h"
|
#include "rtl_tcp_dongle_info.h"
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
@ -67,8 +67,8 @@ public:
|
|||||||
~rtl_tcp_signal_source_c();
|
~rtl_tcp_signal_source_c();
|
||||||
|
|
||||||
int work (int noutput_items,
|
int work (int noutput_items,
|
||||||
gr_vector_const_void_star &input_items,
|
gr_vector_const_void_star &input_items,
|
||||||
gr_vector_void_star &output_items);
|
gr_vector_void_star &output_items);
|
||||||
|
|
||||||
void set_frequency (int frequency);
|
void set_frequency (int frequency);
|
||||||
void set_sample_rate (int sample_rate);
|
void set_sample_rate (int sample_rate);
|
||||||
@ -110,13 +110,15 @@ private:
|
|||||||
void handle_read (const boost::system::error_code &ec,
|
void handle_read (const boost::system::error_code &ec,
|
||||||
size_t bytes_transferred);
|
size_t bytes_transferred);
|
||||||
|
|
||||||
inline bool not_full ( ) const {
|
inline bool not_full ( ) const
|
||||||
|
{
|
||||||
return unread_ < buffer_.capacity( );
|
return unread_ < buffer_.capacity( );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool not_empty ( ) const {
|
inline bool not_empty ( ) const
|
||||||
|
{
|
||||||
return unread_ > 0 || io_service_.stopped ();
|
return unread_ > 0 || io_service_.stopped ();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
|
#endif // GNSS_SDR_RTL_TCP_SIGNAL_SOURCE_C_H
|
||||||
|
@ -29,25 +29,21 @@
|
|||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rtl_tcp_commands.h"
|
#include "rtl_tcp_commands.h"
|
||||||
#include <string.h>
|
#include <string>
|
||||||
|
|
||||||
using boost::asio::ip::tcp;
|
boost::system::error_code rtl_tcp_command (RTL_TCP_COMMAND id, unsigned param, boost::asio::ip::tcp::socket &socket)
|
||||||
|
{
|
||||||
|
|
||||||
boost::system::error_code
|
|
||||||
rtl_tcp_command (RTL_TCP_COMMAND id, unsigned param, tcp::socket &socket) {
|
|
||||||
// Data payload
|
// Data payload
|
||||||
unsigned char data[sizeof (unsigned char) + sizeof (unsigned)];
|
unsigned char data[sizeof(unsigned char) + sizeof(unsigned)];
|
||||||
|
|
||||||
data[0] = static_cast<unsigned char> (id);
|
data[0] = static_cast<unsigned char>(id);
|
||||||
|
|
||||||
|
unsigned nparam = boost::asio::detail::socket_ops::host_to_network_long(param);
|
||||||
unsigned nparam =
|
std::memcpy(&data[1], &nparam, sizeof(nparam));
|
||||||
boost::asio::detail::socket_ops::host_to_network_long (param);
|
|
||||||
::memcpy (&data[1], &nparam, sizeof (nparam));
|
|
||||||
|
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
socket.send (boost::asio::buffer (data), 0, ec);
|
socket.send(boost::asio::buffer(data), 0, ec);
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
@ -48,8 +48,7 @@ enum RTL_TCP_COMMAND {
|
|||||||
/*!
|
/*!
|
||||||
* \brief Send a command to rtl_tcp over the given socket.
|
* \brief Send a command to rtl_tcp over the given socket.
|
||||||
*/
|
*/
|
||||||
boost::system::error_code
|
boost::system::error_code rtl_tcp_command (RTL_TCP_COMMAND id, unsigned param,
|
||||||
rtl_tcp_command (RTL_TCP_COMMAND id, unsigned param,
|
boost::asio::ip::tcp::socket &socket);
|
||||||
boost::asio::ip::tcp::socket &socket);
|
|
||||||
|
|
||||||
#endif // GNSS_SDR_RTL_TCP_COMMANDS_H
|
#endif // GNSS_SDR_RTL_TCP_COMMANDS_H
|
||||||
|
@ -30,45 +30,47 @@
|
|||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rtl_tcp_dongle_info.h"
|
#include "rtl_tcp_dongle_info.h"
|
||||||
#include <string.h>
|
#include <string>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
using boost::asio::ip::tcp;
|
using boost::asio::ip::tcp;
|
||||||
|
|
||||||
rtl_tcp_dongle_info::rtl_tcp_dongle_info ()
|
rtl_tcp_dongle_info::rtl_tcp_dongle_info() : tuner_type_(0), tuner_gain_count_(0)
|
||||||
: tuner_type_ (0), tuner_gain_count_ (0)
|
|
||||||
{
|
{
|
||||||
::memset (magic_, 0, sizeof (magic_));
|
std::memset(magic_, 0, sizeof(magic_));
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::system::error_code rtl_tcp_dongle_info::read (tcp::socket &socket) {
|
|
||||||
|
boost::system::error_code rtl_tcp_dongle_info::read(boost::asio::ip::tcp::socket &socket)
|
||||||
|
{
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
|
|
||||||
unsigned char data[sizeof (char) * 4 + sizeof (uint32_t) * 2];
|
unsigned char data[sizeof(char) * 4 + sizeof(uint32_t) * 2];
|
||||||
socket.receive (boost::asio::buffer (data), 0, ec);
|
socket.receive(boost::asio::buffer(data), 0, ec);
|
||||||
if (!ec) {
|
if (!ec)
|
||||||
::memcpy (magic_, data, 4);
|
{
|
||||||
|
std::memcpy(magic_, data, 4);
|
||||||
|
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
::memcpy (&type, &data[4], 4);
|
std::memcpy(&type, &data[4], 4);
|
||||||
|
|
||||||
tuner_type_ =
|
tuner_type_ = boost::asio::detail::socket_ops::network_to_host_long(type);
|
||||||
boost::asio::detail::socket_ops::network_to_host_long (type);
|
|
||||||
|
|
||||||
|
uint32_t count;
|
||||||
|
std ::memcpy(&count, &data[8], 4);
|
||||||
|
|
||||||
uint32_t count;
|
tuner_gain_count_ = boost::asio::detail::socket_ops::network_to_host_long(count);
|
||||||
::memcpy (&count, &data[8], 4);
|
}
|
||||||
|
|
||||||
tuner_gain_count_ =
|
|
||||||
boost::asio::detail::socket_ops::network_to_host_long (count);
|
|
||||||
}
|
|
||||||
return ec;
|
return ec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *rtl_tcp_dongle_info::get_type_name () const {
|
const char *rtl_tcp_dongle_info::get_type_name() const
|
||||||
switch (get_tuner_type()) {
|
{
|
||||||
|
switch(get_tuner_type())
|
||||||
|
{
|
||||||
default:
|
default:
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
case TUNER_E4000:
|
case TUNER_E4000:
|
||||||
@ -86,29 +88,32 @@ const char *rtl_tcp_dongle_info::get_type_name () const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double rtl_tcp_dongle_info::clip_gain (int gain) const {
|
|
||||||
|
double rtl_tcp_dongle_info::clip_gain(int gain) const
|
||||||
|
{
|
||||||
// the following gain values have been copied from librtlsdr
|
// the following gain values have been copied from librtlsdr
|
||||||
// all gain values are expressed in tenths of a dB
|
// all gain values are expressed in tenths of a dB
|
||||||
|
|
||||||
std::vector<double> gains;
|
std::vector<double> gains;
|
||||||
switch (get_tuner_type()) {
|
switch (get_tuner_type())
|
||||||
|
{
|
||||||
case TUNER_E4000:
|
case TUNER_E4000:
|
||||||
gains = { -10, 15, 40, 65, 90, 115, 140, 165, 190, 215,
|
gains = { -10, 15, 40, 65, 90, 115, 140, 165, 190, 215,
|
||||||
240, 290, 340, 420 };
|
240, 290, 340, 420 };
|
||||||
break;
|
break;
|
||||||
case TUNER_FC0012:
|
case TUNER_FC0012:
|
||||||
gains = { -99, -40, 71, 179, 192 };
|
gains = { -99, -40, 71, 179, 192 };
|
||||||
break;
|
break;
|
||||||
case TUNER_FC0013:
|
case TUNER_FC0013:
|
||||||
gains = { -99, -73, -65, -63, -60, -58, -54, 58, 61,
|
gains = { -99, -73, -65, -63, -60, -58, -54, 58, 61,
|
||||||
63, 65, 67, 68, 70, 71, 179, 181, 182,
|
63, 65, 67, 68, 70, 71, 179, 181, 182,
|
||||||
184, 186, 188, 191, 197 };
|
184, 186, 188, 191, 197 };
|
||||||
break;
|
break;
|
||||||
case TUNER_R820T:
|
case TUNER_R820T:
|
||||||
gains = { 0, 9, 14, 27, 37, 77, 87, 125, 144, 157,
|
gains = { 0, 9, 14, 27, 37, 77, 87, 125, 144, 157,
|
||||||
166, 197, 207, 229, 254, 280, 297, 328,
|
166, 197, 207, 229, 254, 280, 297, 328,
|
||||||
338, 364, 372, 386, 402, 421, 434, 439,
|
338, 364, 372, 386, 402, 421, 434, 439,
|
||||||
445, 480, 496 };
|
445, 480, 496 };
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// no gains
|
// no gains
|
||||||
@ -116,29 +121,37 @@ double rtl_tcp_dongle_info::clip_gain (int gain) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// clip
|
// clip
|
||||||
if (gains.size() == 0) {
|
if (gains.size() == 0)
|
||||||
// no defined gains to clip to
|
{
|
||||||
return gain;
|
// no defined gains to clip to
|
||||||
}
|
return gain;
|
||||||
else {
|
}
|
||||||
double last_stop = gains.front ();
|
else
|
||||||
BOOST_FOREACH (double g, gains) {
|
{
|
||||||
g /= 10.0;
|
double last_stop = gains.front();
|
||||||
|
BOOST_FOREACH (double g, gains)
|
||||||
if (gain < g) {
|
{
|
||||||
if (std::abs (gain - g) < std::abs (gain - last_stop)) {
|
g /= 10.0;
|
||||||
return g;
|
|
||||||
}
|
if (gain < g)
|
||||||
else {
|
{
|
||||||
return last_stop;
|
if (std::abs(gain - g) < std::abs(gain - last_stop))
|
||||||
}
|
{
|
||||||
}
|
return g;
|
||||||
last_stop = g;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return last_stop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
last_stop = g;
|
||||||
|
}
|
||||||
|
return last_stop;
|
||||||
}
|
}
|
||||||
return last_stop;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool rtl_tcp_dongle_info::is_valid () const {
|
|
||||||
return ::memcmp (magic_, "RTL0", 4) == 0;
|
bool rtl_tcp_dongle_info::is_valid() const
|
||||||
|
{
|
||||||
|
return std::memcmp(magic_, "RTL0", 4) == 0;
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GNSS_SDR_RTL_TCP_DONGLE_INFO_H
|
#ifndef GNSS_SDR_RTL_TCP_DONGLE_INFO_H
|
||||||
#define GNSS_SDR_RTL_TCP_DONGLE_INFO_H
|
#define GNSS_SDR_RTL_TCP_DONGLE_INFO_H
|
||||||
|
|
||||||
@ -38,9 +39,16 @@
|
|||||||
* \brief This class represents the dongle information
|
* \brief This class represents the dongle information
|
||||||
* which is sent by rtl_tcp.
|
* which is sent by rtl_tcp.
|
||||||
*/
|
*/
|
||||||
class rtl_tcp_dongle_info {
|
class rtl_tcp_dongle_info
|
||||||
public:
|
{
|
||||||
enum {
|
private:
|
||||||
|
char magic_[4];
|
||||||
|
uint32_t tuner_type_;
|
||||||
|
uint32_t tuner_gain_count_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
TUNER_UNKNOWN = 0,
|
TUNER_UNKNOWN = 0,
|
||||||
TUNER_E4000,
|
TUNER_E4000,
|
||||||
TUNER_FC0012,
|
TUNER_FC0012,
|
||||||
@ -50,28 +58,23 @@ class rtl_tcp_dongle_info {
|
|||||||
TUNER_R828D
|
TUNER_R828D
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
rtl_tcp_dongle_info();
|
||||||
char magic_[4];
|
|
||||||
uint32_t tuner_type_;
|
|
||||||
uint32_t tuner_gain_count_;
|
|
||||||
|
|
||||||
public:
|
boost::system::error_code read(boost::asio::ip::tcp::socket &socket);
|
||||||
rtl_tcp_dongle_info ();
|
|
||||||
|
|
||||||
boost::system::error_code read (
|
bool is_valid() const;
|
||||||
boost::asio::ip::tcp::socket &socket);
|
|
||||||
|
|
||||||
bool is_valid () const;
|
const char *get_type_name() const;
|
||||||
|
|
||||||
const char *get_type_name () const;
|
double clip_gain(int gain) const;
|
||||||
|
|
||||||
double clip_gain (int gain) const;
|
inline uint32_t get_tuner_type() const
|
||||||
|
{
|
||||||
inline uint32_t get_tuner_type () const {
|
|
||||||
return tuner_type_;
|
return tuner_type_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t get_tuner_gain_count () const {
|
inline uint32_t get_tuner_gain_count() const
|
||||||
|
{
|
||||||
return tuner_gain_count_;
|
return tuner_gain_count_;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -67,7 +67,7 @@ GalileoE1BTelemetryDecoder::~GalileoE1BTelemetryDecoder()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void GalileoE1BTelemetryDecoder::set_satellite(Gnss_Satellite satellite)
|
void GalileoE1BTelemetryDecoder::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
telemetry_decoder_->set_satellite(satellite_);
|
telemetry_decoder_->set_satellite(satellite_);
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
gr::basic_block_sptr get_left_block() override;
|
gr::basic_block_sptr get_left_block() override;
|
||||||
gr::basic_block_sptr get_right_block() override;
|
gr::basic_block_sptr get_right_block() override;
|
||||||
|
|
||||||
void set_satellite(Gnss_Satellite satellite) override;
|
void set_satellite(const Gnss_Satellite & satellite) override;
|
||||||
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
||||||
|
|
||||||
inline void reset() override
|
inline void reset() override
|
||||||
|
@ -71,7 +71,7 @@ GalileoE5aTelemetryDecoder::~GalileoE5aTelemetryDecoder()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void GalileoE5aTelemetryDecoder::set_satellite(Gnss_Satellite satellite)
|
void GalileoE5aTelemetryDecoder::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
telemetry_decoder_->set_satellite(satellite_);
|
telemetry_decoder_->set_satellite(satellite_);
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
gr::basic_block_sptr get_left_block() override;
|
gr::basic_block_sptr get_left_block() override;
|
||||||
gr::basic_block_sptr get_right_block() override;
|
gr::basic_block_sptr get_right_block() override;
|
||||||
|
|
||||||
void set_satellite(Gnss_Satellite satellite) override;
|
void set_satellite(const Gnss_Satellite & satellite) override;
|
||||||
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
||||||
|
|
||||||
inline void reset() override
|
inline void reset() override
|
||||||
|
@ -67,7 +67,7 @@ GpsL1CaTelemetryDecoder::~GpsL1CaTelemetryDecoder()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void GpsL1CaTelemetryDecoder::set_satellite(Gnss_Satellite satellite)
|
void GpsL1CaTelemetryDecoder::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
telemetry_decoder_->set_satellite(satellite_);
|
telemetry_decoder_->set_satellite(satellite_);
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
gr::basic_block_sptr get_left_block() override;
|
gr::basic_block_sptr get_left_block() override;
|
||||||
gr::basic_block_sptr get_right_block() override;
|
gr::basic_block_sptr get_right_block() override;
|
||||||
|
|
||||||
void set_satellite(Gnss_Satellite satellite) override;
|
void set_satellite(const Gnss_Satellite & satellite) override;
|
||||||
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
||||||
|
|
||||||
inline void reset() override
|
inline void reset() override
|
||||||
|
@ -68,7 +68,7 @@ GpsL2CTelemetryDecoder::~GpsL2CTelemetryDecoder()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void GpsL2CTelemetryDecoder::set_satellite(Gnss_Satellite satellite)
|
void GpsL2CTelemetryDecoder::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
telemetry_decoder_->set_satellite(satellite_);
|
telemetry_decoder_->set_satellite(satellite_);
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
gr::basic_block_sptr get_left_block() override;
|
gr::basic_block_sptr get_left_block() override;
|
||||||
gr::basic_block_sptr get_right_block() override;
|
gr::basic_block_sptr get_right_block() override;
|
||||||
|
|
||||||
void set_satellite(Gnss_Satellite satellite) override;
|
void set_satellite(const Gnss_Satellite & satellite) override;
|
||||||
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
||||||
|
|
||||||
inline void reset() override
|
inline void reset() override
|
||||||
|
@ -63,7 +63,7 @@ SbasL1TelemetryDecoder::~SbasL1TelemetryDecoder()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
void SbasL1TelemetryDecoder::set_satellite(Gnss_Satellite satellite)
|
void SbasL1TelemetryDecoder::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
satellite_ = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
telemetry_decoder_->set_satellite(satellite_);
|
telemetry_decoder_->set_satellite(satellite_);
|
||||||
|
@ -72,7 +72,7 @@ public:
|
|||||||
gr::basic_block_sptr get_left_block() override;
|
gr::basic_block_sptr get_left_block() override;
|
||||||
gr::basic_block_sptr get_right_block() override;
|
gr::basic_block_sptr get_right_block() override;
|
||||||
|
|
||||||
void set_satellite(Gnss_Satellite satellite) override;
|
void set_satellite(const Gnss_Satellite & satellite) override;
|
||||||
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
inline void set_channel(int channel) override { telemetry_decoder_->set_channel(channel); }
|
||||||
|
|
||||||
inline void reset() override
|
inline void reset() override
|
||||||
|
@ -46,7 +46,7 @@ using google::LogMessage;
|
|||||||
|
|
||||||
|
|
||||||
galileo_e1b_telemetry_decoder_cc_sptr
|
galileo_e1b_telemetry_decoder_cc_sptr
|
||||||
galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
|
galileo_e1b_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump)
|
||||||
{
|
{
|
||||||
return galileo_e1b_telemetry_decoder_cc_sptr(new galileo_e1b_telemetry_decoder_cc(satellite, dump));
|
return galileo_e1b_telemetry_decoder_cc_sptr(new galileo_e1b_telemetry_decoder_cc(satellite, dump));
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ void galileo_e1b_telemetry_decoder_cc::deinterleaver(int rows, int cols, double
|
|||||||
|
|
||||||
|
|
||||||
galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
|
galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
|
||||||
Gnss_Satellite satellite,
|
const Gnss_Satellite & satellite,
|
||||||
bool dump) :
|
bool dump) :
|
||||||
gr::block("galileo_e1b_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
gr::block("galileo_e1b_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||||
@ -476,7 +476,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1b_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
void galileo_e1b_telemetry_decoder_cc::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
||||||
|
@ -51,7 +51,7 @@ class galileo_e1b_telemetry_decoder_cc;
|
|||||||
|
|
||||||
typedef boost::shared_ptr<galileo_e1b_telemetry_decoder_cc> galileo_e1b_telemetry_decoder_cc_sptr;
|
typedef boost::shared_ptr<galileo_e1b_telemetry_decoder_cc> galileo_e1b_telemetry_decoder_cc_sptr;
|
||||||
|
|
||||||
galileo_e1b_telemetry_decoder_cc_sptr galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
galileo_e1b_telemetry_decoder_cc_sptr galileo_e1b_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a block that decodes the INAV data defined in Galileo ICD
|
* \brief This class implements a block that decodes the INAV data defined in Galileo ICD
|
||||||
@ -61,7 +61,7 @@ class galileo_e1b_telemetry_decoder_cc : public gr::block
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~galileo_e1b_telemetry_decoder_cc();
|
~galileo_e1b_telemetry_decoder_cc();
|
||||||
void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite & satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int channel); //!< Set receiver's channel
|
||||||
int flag_even_word_arrived;
|
int flag_even_word_arrived;
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend galileo_e1b_telemetry_decoder_cc_sptr
|
friend galileo_e1b_telemetry_decoder_cc_sptr
|
||||||
galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
galileo_e1b_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
galileo_e1b_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
galileo_e1b_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ using google::LogMessage;
|
|||||||
|
|
||||||
|
|
||||||
galileo_e5a_telemetry_decoder_cc_sptr
|
galileo_e5a_telemetry_decoder_cc_sptr
|
||||||
galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
|
galileo_e5a_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump)
|
||||||
{
|
{
|
||||||
return galileo_e5a_telemetry_decoder_cc_sptr(new galileo_e5a_telemetry_decoder_cc(satellite, dump));
|
return galileo_e5a_telemetry_decoder_cc_sptr(new galileo_e5a_telemetry_decoder_cc(satellite, dump));
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ void galileo_e5a_telemetry_decoder_cc::deinterleaver(int rows, int cols, double
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols,int frame_length)
|
void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols, int frame_length)
|
||||||
{
|
{
|
||||||
double page_symbols_deint[frame_length];
|
double page_symbols_deint[frame_length];
|
||||||
// 1. De-interleave
|
// 1. De-interleave
|
||||||
@ -179,7 +179,7 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols,int fram
|
|||||||
|
|
||||||
|
|
||||||
galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
|
galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
|
||||||
Gnss_Satellite satellite, bool dump) : gr::block("galileo_e5a_telemetry_decoder_cc",
|
const Gnss_Satellite & satellite, bool dump) : gr::block("galileo_e5a_telemetry_decoder_cc",
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||||
{
|
{
|
||||||
@ -530,7 +530,7 @@ int galileo_e5a_telemetry_decoder_cc::general_work (int noutput_items __attribut
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e5a_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
void galileo_e5a_telemetry_decoder_cc::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
DLOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
||||||
|
@ -55,7 +55,7 @@ class galileo_e5a_telemetry_decoder_cc;
|
|||||||
|
|
||||||
typedef boost::shared_ptr<galileo_e5a_telemetry_decoder_cc> galileo_e5a_telemetry_decoder_cc_sptr;
|
typedef boost::shared_ptr<galileo_e5a_telemetry_decoder_cc> galileo_e5a_telemetry_decoder_cc_sptr;
|
||||||
|
|
||||||
galileo_e5a_telemetry_decoder_cc_sptr galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
galileo_e5a_telemetry_decoder_cc_sptr galileo_e5a_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -66,8 +66,8 @@ class galileo_e5a_telemetry_decoder_cc : public gr::block
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~galileo_e5a_telemetry_decoder_cc();
|
~galileo_e5a_telemetry_decoder_cc();
|
||||||
void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite & satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int channel); //!< Set receiver's channel
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
*/
|
*/
|
||||||
@ -76,20 +76,18 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend galileo_e5a_telemetry_decoder_cc_sptr
|
friend galileo_e5a_telemetry_decoder_cc_sptr
|
||||||
galileo_e5a_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
galileo_e5a_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
galileo_e5a_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
galileo_e5a_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
||||||
|
|
||||||
void deinterleaver(int rows, int cols, double *in, double *out);
|
void deinterleaver(int rows, int cols, double *in, double *out);
|
||||||
|
|
||||||
void decode_word(double *page_symbols,int frame_length);
|
void decode_word(double *page_symbols, int frame_length);
|
||||||
|
|
||||||
int d_preamble_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
int d_preamble_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
||||||
// signed int d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
|
||||||
double d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
double d_page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
||||||
|
|
||||||
// signed int *d_preamble_symbols;
|
|
||||||
double d_current_symbol;
|
double d_current_symbol;
|
||||||
long unsigned int d_symbol_counter;
|
long unsigned int d_symbol_counter;
|
||||||
int d_prompt_counter;
|
int d_prompt_counter;
|
||||||
|
@ -43,14 +43,14 @@
|
|||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
gps_l1_ca_telemetry_decoder_cc_sptr
|
gps_l1_ca_telemetry_decoder_cc_sptr
|
||||||
gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
|
gps_l1_ca_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump)
|
||||||
{
|
{
|
||||||
return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, dump));
|
return gps_l1_ca_telemetry_decoder_cc_sptr(new gps_l1_ca_telemetry_decoder_cc(satellite, dump));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
||||||
Gnss_Satellite satellite,
|
const Gnss_Satellite & satellite,
|
||||||
bool dump) :
|
bool dump) :
|
||||||
gr::block("gps_navigation_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
gr::block("gps_navigation_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||||
@ -237,7 +237,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
|
|||||||
if (d_stat == 1)
|
if (d_stat == 1)
|
||||||
{
|
{
|
||||||
preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - static_cast<double>(d_preamble_time_samples)) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - static_cast<double>(d_preamble_time_samples)) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
||||||
if (preamble_diff_ms > GPS_SUBFRAME_MS+1)
|
if (preamble_diff_ms > GPS_SUBFRAME_MS + 1)
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff_ms;
|
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff_ms;
|
||||||
d_stat = 0; //lost of frame sync
|
d_stat = 0; //lost of frame sync
|
||||||
@ -344,16 +344,16 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
|
|||||||
}
|
}
|
||||||
|
|
||||||
//2. Add the telemetry decoder information
|
//2. Add the telemetry decoder information
|
||||||
if (this->d_flag_preamble == true and d_flag_new_tow_available==true)
|
if (this->d_flag_preamble == true and d_flag_new_tow_available == true)
|
||||||
{
|
{
|
||||||
//double decoder_latency_ms=(double)(current_symbol.Tracking_sample_counter-d_symbol_history.at(0).Tracking_sample_counter)
|
//double decoder_latency_ms=(double)(current_symbol.Tracking_sample_counter-d_symbol_history.at(0).Tracking_sample_counter)
|
||||||
// /(double)current_symbol.fs;
|
// /(double)current_symbol.fs;
|
||||||
// update TOW at the preamble instant (account with decoder latency)
|
// update TOW at the preamble instant (account with decoder latency)
|
||||||
d_TOW_at_Preamble = d_GPS_FSM.d_nav.d_TOW + 2*GPS_L1_CA_CODE_PERIOD + GPS_CA_PREAMBLE_DURATION_S;
|
d_TOW_at_Preamble = d_GPS_FSM.d_nav.d_TOW + 2 * GPS_L1_CA_CODE_PERIOD + GPS_CA_PREAMBLE_DURATION_S;
|
||||||
|
|
||||||
d_TOW_at_current_symbol = floor(d_TOW_at_Preamble*1000.0)/1000.0;
|
d_TOW_at_current_symbol = floor(d_TOW_at_Preamble * 1000.0) / 1000.0;
|
||||||
flag_TOW_set = true;
|
flag_TOW_set = true;
|
||||||
d_flag_new_tow_available=false;
|
d_flag_new_tow_available = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -401,7 +401,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items __attribute_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
void gps_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
LOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
LOG(INFO) << "Setting decoder Finite State Machine to satellite " << d_satellite;
|
||||||
|
@ -47,7 +47,7 @@ class gps_l1_ca_telemetry_decoder_cc;
|
|||||||
typedef boost::shared_ptr<gps_l1_ca_telemetry_decoder_cc> gps_l1_ca_telemetry_decoder_cc_sptr;
|
typedef boost::shared_ptr<gps_l1_ca_telemetry_decoder_cc> gps_l1_ca_telemetry_decoder_cc_sptr;
|
||||||
|
|
||||||
gps_l1_ca_telemetry_decoder_cc_sptr
|
gps_l1_ca_telemetry_decoder_cc_sptr
|
||||||
gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
gps_l1_ca_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a block that decodes the NAV data defined in IS-GPS-200E
|
* \brief This class implements a block that decodes the NAV data defined in IS-GPS-200E
|
||||||
@ -57,8 +57,8 @@ class gps_l1_ca_telemetry_decoder_cc : public gr::block
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~gps_l1_ca_telemetry_decoder_cc();
|
~gps_l1_ca_telemetry_decoder_cc();
|
||||||
void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite & satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int channel); //!< Set receiver's channel
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
@ -68,9 +68,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend gps_l1_ca_telemetry_decoder_cc_sptr
|
friend gps_l1_ca_telemetry_decoder_cc_sptr
|
||||||
gps_l1_ca_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
gps_l1_ca_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
gps_l1_ca_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
gps_l1_ca_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
bool gps_word_parityCheck(unsigned int gpsword);
|
bool gps_word_parityCheck(unsigned int gpsword);
|
||||||
|
|
||||||
|
@ -41,14 +41,14 @@
|
|||||||
using google::LogMessage;
|
using google::LogMessage;
|
||||||
|
|
||||||
gps_l2c_telemetry_decoder_cc_sptr
|
gps_l2c_telemetry_decoder_cc_sptr
|
||||||
gps_l2c_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
|
gps_l2c_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump)
|
||||||
{
|
{
|
||||||
return gps_l2c_telemetry_decoder_cc_sptr(new gps_l2c_telemetry_decoder_cc(satellite, dump));
|
return gps_l2c_telemetry_decoder_cc_sptr(new gps_l2c_telemetry_decoder_cc(satellite, dump));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gps_l2c_telemetry_decoder_cc::gps_l2c_telemetry_decoder_cc(
|
gps_l2c_telemetry_decoder_cc::gps_l2c_telemetry_decoder_cc(
|
||||||
Gnss_Satellite satellite, bool dump) : gr::block("gps_l2c_telemetry_decoder_cc",
|
const Gnss_Satellite & satellite, bool dump) : gr::block("gps_l2c_telemetry_decoder_cc",
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||||
{
|
{
|
||||||
@ -202,7 +202,7 @@ int gps_l2c_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l2c_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
void gps_l2c_telemetry_decoder_cc::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
LOG(INFO) << "GPS L2C CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
|
LOG(INFO) << "GPS L2C CNAV telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
|
||||||
|
@ -57,7 +57,7 @@ class gps_l2c_telemetry_decoder_cc;
|
|||||||
typedef boost::shared_ptr<gps_l2c_telemetry_decoder_cc> gps_l2c_telemetry_decoder_cc_sptr;
|
typedef boost::shared_ptr<gps_l2c_telemetry_decoder_cc> gps_l2c_telemetry_decoder_cc_sptr;
|
||||||
|
|
||||||
gps_l2c_telemetry_decoder_cc_sptr
|
gps_l2c_telemetry_decoder_cc_sptr
|
||||||
gps_l2c_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
gps_l2c_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a block that decodes the SBAS integrity and corrections data defined in RTCA MOPS DO-229
|
* \brief This class implements a block that decodes the SBAS integrity and corrections data defined in RTCA MOPS DO-229
|
||||||
@ -67,8 +67,8 @@ class gps_l2c_telemetry_decoder_cc : public gr::block
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~gps_l2c_telemetry_decoder_cc();
|
~gps_l2c_telemetry_decoder_cc();
|
||||||
void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite & satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int channel); //!< Set receiver's channel
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
@ -79,8 +79,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend gps_l2c_telemetry_decoder_cc_sptr
|
friend gps_l2c_telemetry_decoder_cc_sptr
|
||||||
gps_l2c_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
gps_l2c_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
gps_l2c_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
gps_l2c_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
|
@ -48,7 +48,7 @@ using google::LogMessage;
|
|||||||
|
|
||||||
|
|
||||||
sbas_l1_telemetry_decoder_cc_sptr
|
sbas_l1_telemetry_decoder_cc_sptr
|
||||||
sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
|
sbas_l1_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump)
|
||||||
{
|
{
|
||||||
return sbas_l1_telemetry_decoder_cc_sptr(new sbas_l1_telemetry_decoder_cc(satellite, dump));
|
return sbas_l1_telemetry_decoder_cc_sptr(new sbas_l1_telemetry_decoder_cc(satellite, dump));
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
|
|||||||
|
|
||||||
|
|
||||||
sbas_l1_telemetry_decoder_cc::sbas_l1_telemetry_decoder_cc(
|
sbas_l1_telemetry_decoder_cc::sbas_l1_telemetry_decoder_cc(
|
||||||
Gnss_Satellite satellite,
|
const Gnss_Satellite & satellite,
|
||||||
bool dump) :
|
bool dump) :
|
||||||
gr::block("sbas_l1_telemetry_decoder_cc",
|
gr::block("sbas_l1_telemetry_decoder_cc",
|
||||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||||
@ -177,7 +177,7 @@ int sbas_l1_telemetry_decoder_cc::general_work (int noutput_items __attribute__(
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void sbas_l1_telemetry_decoder_cc::set_satellite(Gnss_Satellite satellite)
|
void sbas_l1_telemetry_decoder_cc::set_satellite(const Gnss_Satellite & satellite)
|
||||||
{
|
{
|
||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
LOG(INFO) << "SBAS telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
|
LOG(INFO) << "SBAS telemetry decoder in channel " << this->d_channel << " set to satellite " << d_satellite;
|
||||||
|
@ -47,7 +47,7 @@ class sbas_l1_telemetry_decoder_cc;
|
|||||||
typedef boost::shared_ptr<sbas_l1_telemetry_decoder_cc> sbas_l1_telemetry_decoder_cc_sptr;
|
typedef boost::shared_ptr<sbas_l1_telemetry_decoder_cc> sbas_l1_telemetry_decoder_cc_sptr;
|
||||||
|
|
||||||
sbas_l1_telemetry_decoder_cc_sptr
|
sbas_l1_telemetry_decoder_cc_sptr
|
||||||
sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
sbas_l1_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This class implements a block that decodes the SBAS integrity and corrections data defined in RTCA MOPS DO-229
|
* \brief This class implements a block that decodes the SBAS integrity and corrections data defined in RTCA MOPS DO-229
|
||||||
@ -57,8 +57,8 @@ class sbas_l1_telemetry_decoder_cc : public gr::block
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~sbas_l1_telemetry_decoder_cc();
|
~sbas_l1_telemetry_decoder_cc();
|
||||||
void set_satellite(Gnss_Satellite satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite & satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int channel); //!< Set receiver's channel
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
@ -68,8 +68,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
friend sbas_l1_telemetry_decoder_cc_sptr
|
friend sbas_l1_telemetry_decoder_cc_sptr
|
||||||
sbas_l1_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
sbas_l1_make_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
sbas_l1_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
|
sbas_l1_telemetry_decoder_cc(const Gnss_Satellite & satellite, bool dump);
|
||||||
|
|
||||||
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
||||||
void align_samples();
|
void align_samples();
|
||||||
|
@ -52,7 +52,7 @@ class TelemetryDecoderInterface : public GNSSBlockInterface
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void reset() = 0;
|
virtual void reset() = 0;
|
||||||
virtual void set_satellite(Gnss_Satellite sat) = 0;
|
virtual void set_satellite(const Gnss_Satellite & sat) = 0;
|
||||||
virtual void set_channel(int channel) = 0;
|
virtual void set_channel(int channel) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -124,6 +124,16 @@ else(OPENCL_FOUND)
|
|||||||
add_definitions(-DOPENCL_BLOCKS=0)
|
add_definitions(-DOPENCL_BLOCKS=0)
|
||||||
endif(OPENCL_FOUND)
|
endif(OPENCL_FOUND)
|
||||||
|
|
||||||
|
#enable SDR Hardware based on fmcomms2
|
||||||
|
if(ENABLE_PLUTOSDR)
|
||||||
|
add_definitions(-DPLUTOSDR_DRIVER=1)
|
||||||
|
endif(ENABLE_PLUTOSDR)
|
||||||
|
|
||||||
|
if(ENABLE_FMCOMMS2)
|
||||||
|
add_definitions(-DFMCOMMS2_DRIVER=1)
|
||||||
|
add_definitions(-DPLUTOSDR_DRIVER=1)
|
||||||
|
endif(ENABLE_FMCOMMS2)
|
||||||
|
|
||||||
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
|
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
|
||||||
|
|
||||||
file(GLOB GNSS_RECEIVER_HEADERS "*.h")
|
file(GLOB GNSS_RECEIVER_HEADERS "*.h")
|
||||||
|
@ -422,7 +422,14 @@ void ControlThread::init()
|
|||||||
{
|
{
|
||||||
// Instantiates a control queue, a GNSS flowgraph, and a control message factory
|
// Instantiates a control queue, a GNSS flowgraph, and a control message factory
|
||||||
control_queue_ = gr::msg_queue::make(0);
|
control_queue_ = gr::msg_queue::make(0);
|
||||||
flowgraph_ = std::make_shared<GNSSFlowgraph>(configuration_, control_queue_);
|
try
|
||||||
|
{
|
||||||
|
flowgraph_ = std::make_shared<GNSSFlowgraph>(configuration_, control_queue_);
|
||||||
|
}
|
||||||
|
catch (const boost::bad_lexical_cast& e )
|
||||||
|
{
|
||||||
|
std::cout << "Caught bad lexical cast with error " << e.what() << std::endl;
|
||||||
|
}
|
||||||
control_message_factory_ = std::make_shared<ControlMessageFactory>();
|
control_message_factory_ = std::make_shared<ControlMessageFactory>();
|
||||||
stop_ = false;
|
stop_ = false;
|
||||||
processed_control_messages_ = 0;
|
processed_control_messages_ = 0;
|
||||||
|
@ -65,6 +65,8 @@
|
|||||||
#include "freq_xlating_fir_filter.h"
|
#include "freq_xlating_fir_filter.h"
|
||||||
#include "beamformer_filter.h"
|
#include "beamformer_filter.h"
|
||||||
#include "pulse_blanking_filter.h"
|
#include "pulse_blanking_filter.h"
|
||||||
|
#include "notch_filter.h"
|
||||||
|
#include "notch_filter_lite.h"
|
||||||
#include "gps_l1_ca_pcps_acquisition.h"
|
#include "gps_l1_ca_pcps_acquisition.h"
|
||||||
#include "gps_l2_m_pcps_acquisition.h"
|
#include "gps_l2_m_pcps_acquisition.h"
|
||||||
#include "gps_l1_ca_pcps_tong_acquisition.h"
|
#include "gps_l1_ca_pcps_tong_acquisition.h"
|
||||||
@ -121,6 +123,14 @@
|
|||||||
#include "uhd_signal_source.h"
|
#include "uhd_signal_source.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PLUTOSDR_DRIVER
|
||||||
|
#include "plutosdr_signal_source.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FMCOMMS2_DRIVER
|
||||||
|
#include "fmcomms2_signal_source.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FLEXIBAND_DRIVER
|
#if FLEXIBAND_DRIVER
|
||||||
#include "flexiband_signal_source.h"
|
#include "flexiband_signal_source.h"
|
||||||
#endif
|
#endif
|
||||||
@ -916,6 +926,24 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PLUTOSDR_DRIVER
|
||||||
|
else if (implementation.compare("Plutosdr_Signal_Source") == 0)
|
||||||
|
{
|
||||||
|
std::unique_ptr<GNSSBlockInterface> block_(new PlutosdrSignalSource(configuration.get(), role, in_streams,
|
||||||
|
out_streams, queue));
|
||||||
|
block = std::move(block_);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if FMCOMMS2_DRIVER
|
||||||
|
else if (implementation.compare("Fmcomms2_Signal_Source") == 0)
|
||||||
|
{
|
||||||
|
std::unique_ptr<GNSSBlockInterface> block_(new Fmcomms2SignalSource(configuration.get(), role, in_streams,
|
||||||
|
out_streams, queue));
|
||||||
|
block = std::move(block_);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if FLEXIBAND_DRIVER
|
#if FLEXIBAND_DRIVER
|
||||||
else if (implementation.compare("Flexiband_Signal_Source") == 0)
|
else if (implementation.compare("Flexiband_Signal_Source") == 0)
|
||||||
{
|
{
|
||||||
@ -988,6 +1016,18 @@ std::unique_ptr<GNSSBlockInterface> GNSSBlockFactory::GetBlock(
|
|||||||
out_streams));
|
out_streams));
|
||||||
block = std::move(block_);
|
block = std::move(block_);
|
||||||
}
|
}
|
||||||
|
else if (implementation.compare("Notch_Filter") == 0)
|
||||||
|
{
|
||||||
|
std::unique_ptr<GNSSBlockInterface> block_(new NotchFilter(configuration.get(), role, in_streams,
|
||||||
|
out_streams));
|
||||||
|
block = std::move(block_);
|
||||||
|
}
|
||||||
|
else if (implementation.compare("Notch_Filter_Lite") == 0)
|
||||||
|
{
|
||||||
|
std::unique_ptr<GNSSBlockInterface> block_(new NotchFilterLite(configuration.get(), role, in_streams,
|
||||||
|
out_streams));
|
||||||
|
block = std::move(block_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// RESAMPLER -------------------------------------------------------------------
|
// RESAMPLER -------------------------------------------------------------------
|
||||||
|
@ -158,6 +158,11 @@ if(ENABLE_FPGA)
|
|||||||
add_definitions(-DFPGA_BLOCKS_TEST=1)
|
add_definitions(-DFPGA_BLOCKS_TEST=1)
|
||||||
endif(ENABLE_FPGA)
|
endif(ENABLE_FPGA)
|
||||||
|
|
||||||
|
find_package(Gnuplot)
|
||||||
|
if(GNUPLOT_FOUND)
|
||||||
|
add_definitions(-DGNUPLOT_EXECUTABLE="${GNUPLOT_EXECUTABLE}")
|
||||||
|
endif(GNUPLOT_FOUND)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Optional generator
|
# Optional generator
|
||||||
################################################################################
|
################################################################################
|
||||||
@ -567,6 +572,9 @@ if(NOT ${ENABLE_PACKAGING})
|
|||||||
add_executable(gnss_block_test ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
|
add_executable(gnss_block_test ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/adapter/adapter_test.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/adapter/adapter_test.cc
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/gnss_block_factory_test.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/control-plane/gnss_block_factory_test.cc
|
||||||
|
2074
src/tests/common-files/gnuplot_i.h
Normal file
2074
src/tests/common-files/gnuplot_i.h
Normal file
File diff suppressed because it is too large
Load Diff
45
src/tests/common-files/test_flags.h
Normal file
45
src/tests/common-files/test_flags.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*!
|
||||||
|
* \file test_flags.h
|
||||||
|
* \brief Helper file for unit testing
|
||||||
|
* \author Carles Fernandez-Prades, 2017. cfernandez(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_TEST_FLAGS_H_
|
||||||
|
#define GNSS_SDR_TEST_FLAGS_H_
|
||||||
|
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
|
||||||
|
#if defined GNUPLOT_EXECUTABLE
|
||||||
|
DEFINE_string(gnuplot_executable, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path");
|
||||||
|
#elif !defined GNUPLOT_EXECUTABLE
|
||||||
|
DEFINE_string(gnuplot_executable, "", "Gnuplot binary path");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DEFINE_bool(plot_acq_grid, false, "Plots acquisition grid with gnuplot");
|
||||||
|
DEFINE_int32(plot_decimate, 1, "Decimate plots");
|
||||||
|
|
||||||
|
#endif
|
@ -29,11 +29,13 @@
|
|||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <gflags/gflags.h>
|
#include <gflags/gflags.h>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
@ -43,10 +45,13 @@
|
|||||||
#include "in_memory_configuration.h"
|
#include "in_memory_configuration.h"
|
||||||
#include "file_configuration.h"
|
#include "file_configuration.h"
|
||||||
#include "MATH_CONSTANTS.h"
|
#include "MATH_CONSTANTS.h"
|
||||||
|
#include "gnuplot_i.h"
|
||||||
|
#include "test_flags.h"
|
||||||
#include "signal_generator_flags.h"
|
#include "signal_generator_flags.h"
|
||||||
|
|
||||||
|
|
||||||
DEFINE_string(config_file_ptest, std::string(""), "File containing the configuration parameters for the position test.");
|
DEFINE_string(config_file_ptest, std::string(""), "File containing the configuration parameters for the position test.");
|
||||||
|
DEFINE_bool(plot_position_test, false, "Plots results of FFTLengthTest with gnuplot");
|
||||||
|
|
||||||
// For GPS NAVIGATION (L1)
|
// For GPS NAVIGATION (L1)
|
||||||
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
||||||
@ -73,6 +78,9 @@ public:
|
|||||||
int configure_receiver();
|
int configure_receiver();
|
||||||
int run_receiver();
|
int run_receiver();
|
||||||
void check_results();
|
void check_results();
|
||||||
|
void print_results(const std::vector<double> & east,
|
||||||
|
const std::vector<double> & north,
|
||||||
|
const std::vector<double> & up);
|
||||||
|
|
||||||
double compute_stdev_precision(const std::vector<double> & vec);
|
double compute_stdev_precision(const std::vector<double> & vec);
|
||||||
double compute_stdev_accuracy(const std::vector<double> & vec, double ref);
|
double compute_stdev_accuracy(const std::vector<double> & vec, double ref);
|
||||||
@ -333,7 +341,6 @@ int StaticPositionSystemTest::configure_receiver()
|
|||||||
// Set Acquisition
|
// Set Acquisition
|
||||||
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
||||||
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition_1C.if", std::to_string(zero));
|
|
||||||
config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms));
|
config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms));
|
||||||
config->set_property("Acquisition_1C.threshold", std::to_string(threshold));
|
config->set_property("Acquisition_1C.threshold", std::to_string(threshold));
|
||||||
config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max));
|
config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max));
|
||||||
@ -348,7 +355,6 @@ int StaticPositionSystemTest::configure_receiver()
|
|||||||
config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
|
config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
|
||||||
//config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking");
|
//config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking");
|
||||||
config->set_property("Tracking_1C.item_type", "gr_complex");
|
config->set_property("Tracking_1C.item_type", "gr_complex");
|
||||||
config->set_property("Tracking_1C.if", std::to_string(zero));
|
|
||||||
config->set_property("Tracking_1C.dump", "false");
|
config->set_property("Tracking_1C.dump", "false");
|
||||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||||
config->set_property("Tracking_1C.pll_bw_hz", std::to_string(pll_bw_hz));
|
config->set_property("Tracking_1C.pll_bw_hz", std::to_string(pll_bw_hz));
|
||||||
@ -542,9 +548,105 @@ void StaticPositionSystemTest::check_results()
|
|||||||
// Sanity Check
|
// Sanity Check
|
||||||
double precision_SEP = 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision);
|
double precision_SEP = 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision);
|
||||||
ASSERT_LT(precision_SEP, 20.0);
|
ASSERT_LT(precision_SEP, 20.0);
|
||||||
|
|
||||||
|
if(FLAGS_plot_position_test == true)
|
||||||
|
{
|
||||||
|
print_results(pos_e, pos_n, pos_u);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void StaticPositionSystemTest::print_results(const std::vector<double> & east,
|
||||||
|
const std::vector<double> & north,
|
||||||
|
const std::vector<double> & up)
|
||||||
|
{
|
||||||
|
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||||
|
if(gnuplot_executable.empty())
|
||||||
|
{
|
||||||
|
std::cout << "WARNING: Although the flag plot_position_test has been set to TRUE," << std::endl;
|
||||||
|
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||||
|
std::cout << "Test results will not be plotted." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double sigma_E_2_precision = std::pow(compute_stdev_precision(east), 2.0);
|
||||||
|
double sigma_N_2_precision = std::pow(compute_stdev_precision(north), 2.0);
|
||||||
|
double sigma_U_2_precision = std::pow(compute_stdev_precision(up), 2.0);
|
||||||
|
|
||||||
|
double mean_east = std::accumulate(east.begin(), east.end(), 0.0) / east.size();
|
||||||
|
double mean_north = std::accumulate(north.begin(), north.end(), 0.0) / north.size();
|
||||||
|
|
||||||
|
auto it_max_east = std::max_element(std::begin(east), std::end(east));
|
||||||
|
auto it_min_east = std::min_element(std::begin(east), std::end(east));
|
||||||
|
auto it_max_north = std::max_element(std::begin(north), std::end(north));
|
||||||
|
auto it_min_north = std::min_element(std::begin(north), std::end(north));
|
||||||
|
auto it_max_up = std::max_element(std::begin(up), std::end(up));
|
||||||
|
auto it_min_up = std::min_element(std::begin(up), std::end(up));
|
||||||
|
|
||||||
|
auto east_range = std::max(*it_max_east, std::abs(*it_min_east));
|
||||||
|
auto north_range = std::max(*it_max_north, std::abs(*it_min_north));
|
||||||
|
auto up_range = std::max(*it_max_up, std::abs(*it_min_up));
|
||||||
|
|
||||||
|
double range = std::max(east_range, north_range) * 1.1;
|
||||||
|
double range_3d = std::max(std::max(east_range, north_range), up_range) * 1.1;
|
||||||
|
|
||||||
|
double two_drms = 2 * sqrt(sigma_E_2_precision + sigma_N_2_precision);
|
||||||
|
double ninty_sas = 0.833 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boost::filesystem::path p(gnuplot_executable);
|
||||||
|
boost::filesystem::path dir = p.parent_path();
|
||||||
|
std::string gnuplot_path = dir.native();
|
||||||
|
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||||
|
|
||||||
|
Gnuplot g1("points");
|
||||||
|
g1.set_title("2D precision");
|
||||||
|
g1.set_xlabel("East [m]");
|
||||||
|
g1.set_ylabel("North [m]");
|
||||||
|
g1.cmd("set size ratio -1");
|
||||||
|
g1.cmd("set xrange [-" + std::to_string(range) + ":" + std::to_string(range) + "]");
|
||||||
|
g1.cmd("set yrange [-" + std::to_string(range) + ":" + std::to_string(range) + "]");
|
||||||
|
|
||||||
|
g1.plot_xy(east, north, "2D Position Fixes");
|
||||||
|
g1.set_style("lines").plot_circle(mean_east, mean_north, two_drms, "2DRMS");
|
||||||
|
g1.set_style("lines").plot_circle(mean_east, mean_north, two_drms / 2.0, "DRMS");
|
||||||
|
|
||||||
|
g1.cmd("set grid front");
|
||||||
|
g1.cmd("replot");
|
||||||
|
|
||||||
|
g1.savetops("Position_test_2D");
|
||||||
|
g1.savetopdf("Position_test_2D", 18);
|
||||||
|
g1.showonscreen(); // window output
|
||||||
|
|
||||||
|
Gnuplot g2("points");
|
||||||
|
g2.set_title("3D precision");
|
||||||
|
g2.set_xlabel("East [m]");
|
||||||
|
g2.set_ylabel("North [m]");
|
||||||
|
g2.set_zlabel("Up [m]");
|
||||||
|
g2.cmd("set size ratio -1");
|
||||||
|
g2.cmd("set xrange [-" + std::to_string(range_3d) + ":" + std::to_string(range_3d) + "]");
|
||||||
|
g2.cmd("set yrange [-" + std::to_string(range_3d) + ":" + std::to_string(range_3d) + "]");
|
||||||
|
g2.cmd("set zrange [-" + std::to_string(range_3d) + ":" + std::to_string(range_3d) + "]");
|
||||||
|
g2.cmd("set view equal xyz");
|
||||||
|
g2.cmd("set ticslevel 0");
|
||||||
|
|
||||||
|
g2.cmd("set style fill transparent solid 0.30 border\n set parametric\n set urange [0:2.0*pi]\n set vrange [-pi/2:pi/2]\n r = " +
|
||||||
|
std::to_string(ninty_sas) +
|
||||||
|
"\n fx(v,u) = r*cos(v)*cos(u)\n fy(v,u) = r*cos(v)*sin(u)\n fz(v) = r*sin(v) \n splot fx(v,u),fy(v,u),fz(v) title \"90\%-SAS\" lt rgb \"gray\"\n");
|
||||||
|
g2.plot_xyz(east, north, up, "3D Position Fixes");
|
||||||
|
|
||||||
|
g2.savetops("Position_test_3D");
|
||||||
|
g2.savetopdf("Position_test_3D");
|
||||||
|
g2.showonscreen(); // window output
|
||||||
|
}
|
||||||
|
catch (const GnuplotException & ge)
|
||||||
|
{
|
||||||
|
std::cout << ge.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(StaticPositionSystemTest, Position_system_test)
|
TEST_F(StaticPositionSystemTest, Position_system_test)
|
||||||
{
|
{
|
||||||
if(FLAGS_config_file_ptest.empty())
|
if(FLAGS_config_file_ptest.empty())
|
||||||
|
@ -73,6 +73,7 @@ DECLARE_string(log_dir);
|
|||||||
#include "unit-tests/arithmetic/multiply_test.cc"
|
#include "unit-tests/arithmetic/multiply_test.cc"
|
||||||
#include "unit-tests/arithmetic/code_generation_test.cc"
|
#include "unit-tests/arithmetic/code_generation_test.cc"
|
||||||
#include "unit-tests/arithmetic/fft_length_test.cc"
|
#include "unit-tests/arithmetic/fft_length_test.cc"
|
||||||
|
#include "unit-tests/arithmetic/fft_speed_test.cc"
|
||||||
|
|
||||||
#include "unit-tests/control-plane/file_configuration_test.cc"
|
#include "unit-tests/control-plane/file_configuration_test.cc"
|
||||||
#include "unit-tests/control-plane/in_memory_configuration_test.cc"
|
#include "unit-tests/control-plane/in_memory_configuration_test.cc"
|
||||||
@ -90,6 +91,9 @@ DECLARE_string(log_dir);
|
|||||||
#include "unit-tests/signal-processing-blocks/adapter/adapter_test.cc"
|
#include "unit-tests/signal-processing-blocks/adapter/adapter_test.cc"
|
||||||
|
|
||||||
#include "unit-tests/signal-processing-blocks/filter/fir_filter_test.cc"
|
#include "unit-tests/signal-processing-blocks/filter/fir_filter_test.cc"
|
||||||
|
#include "unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc"
|
||||||
|
#include "unit-tests/signal-processing-blocks/filter/notch_filter_test.cc"
|
||||||
|
#include "unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc"
|
||||||
|
|
||||||
#include "unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc"
|
#include "unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc"
|
||||||
|
|
||||||
|
@ -29,26 +29,55 @@
|
|||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <functional>
|
||||||
|
#include <random>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <gnuradio/fft/fft.h>
|
#include <gnuradio/fft/fft.h>
|
||||||
|
#include "gnuplot_i.h"
|
||||||
|
#include "test_flags.h"
|
||||||
|
|
||||||
|
|
||||||
DEFINE_int32(fft_iterations_test, 1000, "Number of averaged iterations in FFT length timing test");
|
DEFINE_int32(fft_iterations_test, 1000, "Number of averaged iterations in FFT length timing test");
|
||||||
|
DEFINE_bool(plot_fft_length_test, false, "Plots results of FFTLengthTest with gnuplot");
|
||||||
|
|
||||||
|
// Note from FFTW documentation: the standard FFTW distribution works most efficiently for arrays whose
|
||||||
|
// size can be factored into small primes (2, 3, 5, and 7), and otherwise it uses a slower general-purpose routine.
|
||||||
|
|
||||||
TEST(FFTLengthTest, MeasureExecutionTime)
|
TEST(FFTLengthTest, MeasureExecutionTime)
|
||||||
{
|
{
|
||||||
unsigned int d_fft_size;
|
unsigned int fft_sizes [] = { 512, 1000, 1024, 1100, 1297, 1400, 1500, 1960, 2000, 2048, 2221, 2500, 3000, 3500, 4000,
|
||||||
|
4096, 4200, 4500, 4725, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 8192, 8500, 9000, 9500, 10000, 10368, 11000,
|
||||||
|
12000, 15000, 16000, 16384, 27000, 32768, 50000, 65536 };
|
||||||
|
|
||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
|
||||||
unsigned int fft_sizes [18] = { 1000, 1024, 1960, 2000, 2048, 4000, 4096, 4725, 8000, 8192, 10368, 12000, 16000, 16384, 27000, 32768, 50000, 65536 };
|
std::random_device r;
|
||||||
double execution_times [18];
|
std::default_random_engine e1(r());
|
||||||
|
std::default_random_engine e2(r());
|
||||||
|
std::uniform_real_distribution<float> uniform_dist(-1, 1);
|
||||||
|
auto func = [] (float a, float b) { return gr_complex(a, b); }; // Helper lambda function that returns a gr_complex
|
||||||
|
auto random_number1 = std::bind(uniform_dist, e1);
|
||||||
|
auto random_number2 = std::bind(uniform_dist, e2);
|
||||||
|
auto gen = std::bind(func, random_number1, random_number2); // Function that returns a random gr_complex
|
||||||
|
|
||||||
|
std::vector<unsigned int> fft_sizes_v(fft_sizes, fft_sizes + sizeof(fft_sizes) / sizeof(unsigned int) );
|
||||||
|
std::sort(fft_sizes_v.begin(), fft_sizes_v.end());
|
||||||
|
std::vector<unsigned int>::const_iterator it;
|
||||||
|
unsigned int d_fft_size;
|
||||||
|
std::vector<double> execution_times;
|
||||||
|
std::vector<unsigned int> powers_of_two;
|
||||||
|
std::vector<double> execution_times_powers_of_two;
|
||||||
|
|
||||||
EXPECT_NO_THROW(
|
EXPECT_NO_THROW(
|
||||||
for(int i = 0; i < 18; i++)
|
for(it = fft_sizes_v.cbegin(); it != fft_sizes_v.cend(); ++it)
|
||||||
{
|
{
|
||||||
gr::fft::fft_complex* d_fft;
|
gr::fft::fft_complex* d_fft;
|
||||||
d_fft_size = fft_sizes[i];
|
d_fft_size = *it;
|
||||||
d_fft = new gr::fft::fft_complex(d_fft_size, true);
|
d_fft = new gr::fft::fft_complex(d_fft_size, true);
|
||||||
std::fill_n( d_fft->get_inbuf(), d_fft_size, gr_complex( 0.0, 0.0 ) );
|
|
||||||
|
std::generate_n( d_fft->get_inbuf(), d_fft_size, gen );
|
||||||
|
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
for(int k = 0; k < FLAGS_fft_iterations_test; k++)
|
for(int k = 0; k < FLAGS_fft_iterations_test; k++)
|
||||||
@ -57,9 +86,64 @@ TEST(FFTLengthTest, MeasureExecutionTime)
|
|||||||
}
|
}
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||||
execution_times[i] = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_iterations_test);
|
double exec_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_iterations_test);
|
||||||
std::cout << "FFT execution time for length=" << d_fft_size << " : " << execution_times[i] << " [s]" << std::endl;
|
execution_times.push_back(exec_time * 1e3);
|
||||||
|
std::cout << "FFT execution time for length=" << d_fft_size << " : " << exec_time << " [s]" << std::endl;
|
||||||
delete d_fft;
|
delete d_fft;
|
||||||
|
|
||||||
|
if( (d_fft_size & (d_fft_size - 1)) == 0 ) // if it is a power of two
|
||||||
|
{
|
||||||
|
powers_of_two.push_back(d_fft_size);
|
||||||
|
execution_times_powers_of_two.push_back(exec_time / 1e-3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if(FLAGS_plot_fft_length_test == true)
|
||||||
|
{
|
||||||
|
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||||
|
if(gnuplot_executable.empty())
|
||||||
|
{
|
||||||
|
std::cout << "WARNING: Although the flag plot_fft_length_test has been set to TRUE," << std::endl;
|
||||||
|
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||||
|
std::cout << "Test results will not be plotted." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boost::filesystem::path p(gnuplot_executable);
|
||||||
|
boost::filesystem::path dir = p.parent_path();
|
||||||
|
std::string gnuplot_path = dir.native();
|
||||||
|
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||||
|
|
||||||
|
Gnuplot g1("linespoints");
|
||||||
|
g1.set_title("FFT execution times for different lengths");
|
||||||
|
g1.set_grid();
|
||||||
|
g1.set_xlabel("FFT length");
|
||||||
|
g1.set_ylabel("Execution time [ms]");
|
||||||
|
g1.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(FLAGS_fft_iterations_test) + " iterations)");
|
||||||
|
g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||||
|
g1.savetops("FFT_execution_times_extended");
|
||||||
|
g1.savetopdf("FFT_execution_times_extended", 18);
|
||||||
|
g1.showonscreen(); // window output
|
||||||
|
|
||||||
|
Gnuplot g2("linespoints");
|
||||||
|
g2.set_title("FFT execution times for different lengths (up to 2^{14}=16384)");
|
||||||
|
g2.set_grid();
|
||||||
|
g2.set_xlabel("FFT length");
|
||||||
|
g2.set_ylabel("Execution time [ms]");
|
||||||
|
g2.set_xrange(0, 16384);
|
||||||
|
g2.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(FLAGS_fft_iterations_test) + " iterations)");
|
||||||
|
g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2");
|
||||||
|
g2.savetops("FFT_execution_times");
|
||||||
|
g2.savetopdf("FFT_execution_times", 18);
|
||||||
|
g2.showonscreen(); // window output
|
||||||
|
}
|
||||||
|
catch (const GnuplotException & ge)
|
||||||
|
{
|
||||||
|
std::cout << ge.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
81
src/tests/unit-tests/arithmetic/fft_speed_test.cc
Normal file
81
src/tests/unit-tests/arithmetic/fft_speed_test.cc
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/*!
|
||||||
|
* \file fft_speed_test.cc
|
||||||
|
* \brief This file implements timing tests for the Armadillo
|
||||||
|
* and GNU Radio FFT implementations
|
||||||
|
* \author Antonio Ramos, 2017. antonio.ramos(at)cttc.es
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <memory>
|
||||||
|
#include <gnuradio/fft/fft.h>
|
||||||
|
#include <armadillo>
|
||||||
|
|
||||||
|
DEFINE_int32(fft_speed_iterations_test, 100, "Number of averaged iterations in FFT length timing test");
|
||||||
|
|
||||||
|
TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime)
|
||||||
|
{
|
||||||
|
unsigned int d_fft_size;
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds;
|
||||||
|
|
||||||
|
unsigned int fft_sizes [19] = { 16, 25, 32, 45, 64, 95, 128, 195, 256, 325, 512, 785, 1024, 1503, 2048, 3127, 4096, 6349, 8192 };
|
||||||
|
double d_execution_time;
|
||||||
|
EXPECT_NO_THROW(
|
||||||
|
for(int i = 0; i < 19; i++)
|
||||||
|
{
|
||||||
|
d_fft_size = fft_sizes[i];
|
||||||
|
gr::fft::fft_complex* d_gr_fft;
|
||||||
|
d_gr_fft = new gr::fft::fft_complex(d_fft_size, true);
|
||||||
|
arma::arma_rng::set_seed_random();
|
||||||
|
arma::cx_fvec d_arma_fft = arma::cx_fvec(d_fft_size).randn() + gr_complex(0.0, 1.0) * arma::cx_fvec(d_fft_size).randn();
|
||||||
|
arma::cx_fvec d_arma_fft_result(d_fft_size);
|
||||||
|
memcpy(d_gr_fft->get_inbuf(), d_arma_fft.memptr(), sizeof(gr_complex) * d_fft_size);
|
||||||
|
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
for(int k = 0; k < FLAGS_fft_speed_iterations_test; k++)
|
||||||
|
{
|
||||||
|
d_gr_fft->execute();
|
||||||
|
}
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
d_execution_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_speed_iterations_test);
|
||||||
|
std::cout << "GNU Radio FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl;
|
||||||
|
delete d_gr_fft;
|
||||||
|
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
for(int k = 0; k < FLAGS_fft_speed_iterations_test; k++)
|
||||||
|
{
|
||||||
|
d_arma_fft_result = arma::fft(d_arma_fft);
|
||||||
|
}
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
d_execution_time = elapsed_seconds.count() / static_cast<double>(FLAGS_fft_speed_iterations_test);
|
||||||
|
std::cout << "Armadillo FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]" << std::endl;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
@ -155,6 +155,45 @@ TEST(GNSSBlockFactoryTest, InstantiateFreqXlatingFIRFilter)
|
|||||||
EXPECT_STREQ("Freq_Xlating_Fir_Filter", input_filter->implementation().c_str());
|
EXPECT_STREQ("Freq_Xlating_Fir_Filter", input_filter->implementation().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(GNSSBlockFactoryTest, InstantiatePulseBlankingFilter)
|
||||||
|
{
|
||||||
|
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||||
|
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||||
|
configuration->set_property("InputFilter.implementation", "Pulse_Blanking_Filter");
|
||||||
|
|
||||||
|
std::unique_ptr<GNSSBlockFactory> factory;
|
||||||
|
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Pulse_Blanking_Filter", 1, 1);
|
||||||
|
|
||||||
|
EXPECT_STREQ("InputFilter", input_filter->role().c_str());
|
||||||
|
EXPECT_STREQ("Pulse_Blanking_Filter", input_filter->implementation().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(GNSSBlockFactoryTest, InstantiateNotchFilter)
|
||||||
|
{
|
||||||
|
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||||
|
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||||
|
configuration->set_property("InputFilter.implementation", "Notch_Filter");
|
||||||
|
|
||||||
|
std::unique_ptr<GNSSBlockFactory> factory;
|
||||||
|
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Notch_Filter", 1, 1);
|
||||||
|
|
||||||
|
EXPECT_STREQ("InputFilter", input_filter->role().c_str());
|
||||||
|
EXPECT_STREQ("Notch_Filter", input_filter->implementation().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(GNSSBlockFactoryTest, InstantiateNotchFilterLite)
|
||||||
|
{
|
||||||
|
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||||
|
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||||
|
configuration->set_property("InputFilter.implementation", "Notch_Filter_Lite");
|
||||||
|
|
||||||
|
std::unique_ptr<GNSSBlockFactory> factory;
|
||||||
|
std::unique_ptr<GNSSBlockInterface> input_filter = factory->GetBlock(configuration, "InputFilter", "Notch_Filter_Lite", 1, 1);
|
||||||
|
|
||||||
|
EXPECT_STREQ("InputFilter", input_filter->role().c_str());
|
||||||
|
EXPECT_STREQ("Notch_Filter_Lite", input_filter->implementation().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(GNSSBlockFactoryTest, InstantiateDirectResampler)
|
TEST(GNSSBlockFactoryTest, InstantiateDirectResampler)
|
||||||
{
|
{
|
||||||
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
std::shared_ptr<InMemoryConfiguration> configuration = std::make_shared<InMemoryConfiguration>();
|
||||||
|
@ -238,15 +238,14 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(integration_time_ms));
|
config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.threshold", "0.2");
|
||||||
config->set_property("Acquisition.threshold", "0.2");
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -324,15 +323,14 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(integration_time_ms));
|
config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.pfa", "0.1");
|
||||||
config->set_property("Acquisition.pfa", "0.1");
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -421,43 +419,43 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::stop_queue()
|
|||||||
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
||||||
{
|
{
|
||||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
std::chrono::duration<double> elapsed_seconds(0);
|
std::chrono::duration<double> elapsed_seconds(0.0);
|
||||||
|
|
||||||
config_1();
|
config_1();
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
|
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
@ -466,14 +464,14 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -485,33 +483,33 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
|
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -523,7 +521,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -546,7 +544,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
@ -574,33 +572,33 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
|
|||||||
config_2();
|
config_2();
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1Pcps8msAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -612,7 +610,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -637,7 +635,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
stop_queue();
|
stop_queue();
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
|
@ -241,17 +241,16 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.bit_transition_flag","false");
|
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.threshold", "0.1");
|
||||||
config->set_property("Acquisition.threshold", "0.1");
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -267,7 +266,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2()
|
|||||||
|
|
||||||
expected_delay_chips = 600;
|
expected_delay_chips = 600;
|
||||||
expected_doppler_hz = 750;
|
expected_doppler_hz = 750;
|
||||||
max_doppler_error_hz = 2/(3*integration_time_ms*1e-3);
|
max_doppler_error_hz = 2 / (3 * integration_time_ms * 1e-3);
|
||||||
max_delay_error_chips = 0.50;
|
max_delay_error_chips = 0.50;
|
||||||
|
|
||||||
num_of_realizations = 100;
|
num_of_realizations = 100;
|
||||||
@ -331,17 +330,16 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.bit_transition_flag","false");
|
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.pfa", "0.1");
|
||||||
config->set_property("Acquisition.pfa", "0.1");
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -424,7 +422,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue()
|
|||||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,7 +436,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
config_1();
|
config_1();
|
||||||
|
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
@ -449,14 +447,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -467,33 +465,33 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
config_1();
|
config_1();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -505,7 +503,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -528,7 +526,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
stop_queue();
|
stop_queue();
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
@ -553,33 +551,33 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
|
|||||||
config_2();
|
config_2();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -591,7 +589,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -616,7 +614,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
|
@ -158,17 +158,16 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::init()
|
|||||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||||
gnss_synchro.PRN = 11;
|
gnss_synchro.PRN = 11;
|
||||||
|
|
||||||
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.coherent_integration_time_ms", "4");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms", "4");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
config->set_property("Acquisition_1B.threshold", "0.1");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.threshold", "0.1");
|
config->set_property("Acquisition_1B.doppler_step", "125");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.repeat_satellite", "false");
|
||||||
config->set_property("Acquisition.doppler_step", "125");
|
config->set_property("Acquisition_1B.cboc", "true");
|
||||||
config->set_property("Acquisition.repeat_satellite", "false");
|
|
||||||
config->set_property("Acquisition0.cboc", "true");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -205,7 +204,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue()
|
|||||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate)
|
TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||||
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
|
EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str());
|
||||||
}
|
}
|
||||||
@ -221,7 +220,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
|||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
|
|
||||||
init();
|
init();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
@ -232,14 +231,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -258,27 +257,27 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
|||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(gnss_synchro.Channel_ID);
|
acquisition->set_channel(gnss_synchro.Channel_ID);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.00001));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00001));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 250));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 250));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
@ -288,7 +287,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
|||||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
start_queue();
|
start_queue();
|
||||||
@ -296,14 +295,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults)
|
|||||||
acquisition->init();
|
acquisition->init();
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
acquisition->set_state(1);
|
acquisition->set_state(1);
|
||||||
}) << "Failure starting acquisition" << std::endl;
|
}) << "Failure starting acquisition";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
|
@ -47,8 +47,11 @@
|
|||||||
#include "gnss_sdr_valve.h"
|
#include "gnss_sdr_valve.h"
|
||||||
#include "gnss_signal.h"
|
#include "gnss_signal.h"
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
|
#include "gnuplot_i.h"
|
||||||
|
#include "test_flags.h"
|
||||||
|
#include "acquisition_dump_reader.h"
|
||||||
#include "galileo_e1_pcps_ambiguous_acquisition.h"
|
#include "galileo_e1_pcps_ambiguous_acquisition.h"
|
||||||
|
#include "Galileo_E1.h"
|
||||||
|
|
||||||
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||||
class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx;
|
class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx;
|
||||||
@ -115,18 +118,23 @@ protected:
|
|||||||
config = std::make_shared<InMemoryConfiguration>();
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
item_size = sizeof(gr_complex);
|
item_size = sizeof(gr_complex);
|
||||||
gnss_synchro = Gnss_Synchro();
|
gnss_synchro = Gnss_Synchro();
|
||||||
|
doppler_max = 10000;
|
||||||
|
doppler_step = 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
~GalileoE1PcpsAmbiguousAcquisitionTest()
|
~GalileoE1PcpsAmbiguousAcquisitionTest()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
void plot_grid();
|
||||||
|
|
||||||
gr::top_block_sptr top_block;
|
gr::top_block_sptr top_block;
|
||||||
std::shared_ptr<GNSSBlockFactory> factory;
|
std::shared_ptr<GNSSBlockFactory> factory;
|
||||||
std::shared_ptr<InMemoryConfiguration> config;
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
Gnss_Synchro gnss_synchro;
|
Gnss_Synchro gnss_synchro;
|
||||||
size_t item_size;
|
size_t item_size;
|
||||||
|
unsigned int doppler_max;
|
||||||
|
unsigned int doppler_step;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -134,28 +142,92 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::init()
|
|||||||
{
|
{
|
||||||
gnss_synchro.Channel_ID = 0;
|
gnss_synchro.Channel_ID = 0;
|
||||||
gnss_synchro.System = 'E';
|
gnss_synchro.System = 'E';
|
||||||
std::string signal = "1C";
|
std::string signal = "1B";
|
||||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||||
gnss_synchro.PRN = 1;
|
gnss_synchro.PRN = 1;
|
||||||
|
|
||||||
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.coherent_integration_time_ms", "4");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms", "4");
|
if(FLAGS_plot_acq_grid == true)
|
||||||
config->set_property("Acquisition.dump", "false");
|
{
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.dump", "true");
|
||||||
config->set_property("Acquisition.threshold", "0.0001");
|
}
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
else
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
{
|
||||||
config->set_property("Acquisition.repeat_satellite", "false");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition1.cboc", "true");
|
}
|
||||||
|
config->set_property("Acquisition_1B.dump_filename", "./tmp-acq-gal1/acquisition.dat");
|
||||||
|
config->set_property("Acquisition_1B.threshold", "0.0001");
|
||||||
|
config->set_property("Acquisition_1B.doppler_max", std::to_string(doppler_max));
|
||||||
|
config->set_property("Acquisition_1B.doppler_step", std::to_string(doppler_step));
|
||||||
|
config->set_property("Acquisition_1B.repeat_satellite", "false");
|
||||||
|
config->set_property("Acquisition_1B.cboc", "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid()
|
||||||
|
{
|
||||||
|
//load the measured values
|
||||||
|
std::string basename = "./tmp-acq-gal1/acquisition_E_1B";
|
||||||
|
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||||
|
|
||||||
|
unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS))); // !!
|
||||||
|
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||||
|
|
||||||
|
if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||||
|
|
||||||
|
std::vector<int> * doppler = &acq_dump.doppler;
|
||||||
|
std::vector<unsigned int> * samples = &acq_dump.samples;
|
||||||
|
std::vector<std::vector<float> > * mag = &acq_dump.mag;
|
||||||
|
|
||||||
|
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||||
|
if(gnuplot_executable.empty())
|
||||||
|
{
|
||||||
|
std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl;
|
||||||
|
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||||
|
std::cout << "Test results will not be plotted." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boost::filesystem::path p(gnuplot_executable);
|
||||||
|
boost::filesystem::path dir = p.parent_path();
|
||||||
|
std::string gnuplot_path = dir.native();
|
||||||
|
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||||
|
|
||||||
|
Gnuplot g1("lines");
|
||||||
|
g1.set_title("Galileo E1b/c signal acquisition for satellite PRN #" + std::to_string(gnss_synchro.PRN));
|
||||||
|
g1.set_xlabel("Doppler [Hz]");
|
||||||
|
g1.set_ylabel("Sample");
|
||||||
|
//g1.cmd("set view 60, 105, 1, 1");
|
||||||
|
g1.plot_grid3d(*doppler, *samples, *mag);
|
||||||
|
|
||||||
|
g1.savetops("Galileo_E1_acq_grid");
|
||||||
|
g1.savetopdf("Galileo_E1_acq_grid");
|
||||||
|
g1.showonscreen();
|
||||||
|
}
|
||||||
|
catch (const GnuplotException & ge)
|
||||||
|
{
|
||||||
|
std::cout << ge.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string data_str = "./tmp-acq-gal1";
|
||||||
|
if (boost::filesystem::exists(data_str))
|
||||||
|
{
|
||||||
|
boost::filesystem::remove_all(data_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
|
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +241,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
|
|||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
gr::msg_queue::sptr queue = gr::msg_queue::make(0);
|
||||||
init();
|
init();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
||||||
|
|
||||||
@ -180,14 +252,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,37 +269,47 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
|||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
std::chrono::duration<double> elapsed_seconds(0);
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
|
||||||
|
if(FLAGS_plot_acq_grid == true)
|
||||||
|
{
|
||||||
|
std::string data_str = "./tmp-acq-gal1";
|
||||||
|
if (boost::filesystem::exists(data_str))
|
||||||
|
{
|
||||||
|
boost::filesystem::remove_all(data_str);
|
||||||
|
}
|
||||||
|
boost::filesystem::create_directory(data_str);
|
||||||
|
}
|
||||||
|
|
||||||
double expected_delay_samples = 2920; //18250;
|
double expected_delay_samples = 2920; //18250;
|
||||||
double expected_doppler_hz = -632;
|
double expected_doppler_hz = -632;
|
||||||
init();
|
init();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1);
|
||||||
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(gnss_synchro.Channel_ID);
|
acquisition->set_channel(gnss_synchro.Channel_ID);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 1e-9));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 1e-9));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", doppler_max));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 250));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", doppler_step));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
@ -236,7 +318,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
|||||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
acquisition->set_local_code();
|
acquisition->set_local_code();
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
@ -248,7 +330,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
|||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
@ -263,5 +345,10 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)";
|
EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)";
|
||||||
EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips";
|
EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips";
|
||||||
|
|
||||||
|
if(FLAGS_plot_acq_grid == true)
|
||||||
|
{
|
||||||
|
plot_grid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,16 +242,16 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.if", "0");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.threshold", "0.7");
|
config->set_property("Acquisition_1B.threshold", "0.7");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition.dump", "false");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -331,16 +331,15 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.threshold", "0.00215"); // Pfa,a = 0.1
|
||||||
config->set_property("Acquisition.threshold", "0.00215"); // Pfa,a = 0.1
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -425,7 +424,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::stop_queue()
|
|||||||
TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate)
|
TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +439,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun)
|
|||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
|
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
@ -451,14 +450,14 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -469,33 +468,33 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
|
|||||||
config_1();
|
config_1();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.00001));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00001));
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
@ -508,7 +507,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -532,7 +531,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
@ -552,12 +551,12 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults)
|
|||||||
#ifdef OLD_BOOST
|
#ifdef OLD_BOOST
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
}) << "Failure while waiting the queue to stop";
|
||||||
#endif
|
#endif
|
||||||
#ifndef OLD_BOOST
|
#ifndef OLD_BOOST
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
}) << "Failure while waiting the queue to stop";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -568,33 +567,33 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
|
|||||||
config_2();
|
config_2();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsCccwsrAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx> msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.00215));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00215));
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
@ -607,7 +606,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -635,7 +634,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
|
@ -260,18 +260,17 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.bit_transition_flag","false");
|
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.threshold", "1");
|
||||||
config->set_property("Acquisition.threshold", "1");
|
config->set_property("Acquisition_1Bdoppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1B.folding_factor", "2");
|
||||||
config->set_property("Acquisition.folding_factor", "2");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -355,18 +354,17 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.bit_transition_flag","false");
|
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.threshold", std::to_string(FLAGS_e1_value_threshold));
|
||||||
config->set_property("Acquisition.threshold", std::to_string(FLAGS_e1_value_threshold));
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "125");
|
||||||
config->set_property("Acquisition.doppler_step", "125");
|
config->set_property("Acquisition_1B.folding_factor", "2");
|
||||||
config->set_property("Acquisition.folding_factor", "2");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -446,18 +444,17 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_3()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1B.max_dwells", "1");
|
||||||
config->set_property("Acquisition.bit_transition_flag","false");
|
config->set_property("Acquisition_1B.bit_transition_flag","false");
|
||||||
config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.threshold", "0.2");
|
||||||
config->set_property("Acquisition.threshold", "0.2");
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "125");
|
||||||
config->set_property("Acquisition.doppler_step", "125");
|
config->set_property("Acquisition_1B.folding_factor", "4");
|
||||||
config->set_property("Acquisition.folding_factor", "4");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -551,7 +548,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::stop_queue()
|
|||||||
TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate)
|
TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,7 +564,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun)
|
|||||||
|
|
||||||
config_1();
|
config_1();
|
||||||
|
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
@ -580,14 +577,14 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
begin = std::chrono::system_clock::now();
|
begin = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - begin;
|
elapsed_seconds = end - begin;
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
LOG(INFO) << "----end connect and run test-----";
|
LOG(INFO) << "----end connect and run test-----";
|
||||||
@ -602,33 +599,33 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
|
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(0);
|
acquisition->set_channel(0);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 125));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 125));
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(1);
|
acquisition->set_threshold(1);
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
@ -641,7 +638,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
@ -666,7 +663,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
@ -693,33 +690,33 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
|
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(50);
|
acquisition->set_doppler_step(50);
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(5);
|
acquisition->set_threshold(5);
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
@ -732,7 +729,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -757,7 +754,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@ -781,33 +778,33 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
|
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsQuickSyncAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx> msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.0));
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -819,7 +816,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -846,7 +843,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
|
@ -246,17 +246,16 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition_Galileo.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition_Galileo.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition_Galileo.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition_Galileo.tong_init_val", "1");
|
config->set_property("Acquisition_1B.tong_init_val", "1");
|
||||||
config->set_property("Acquisition_Galileo.tong_max_val", "8");
|
config->set_property("Acquisition_1B.tong_max_val", "8");
|
||||||
config->set_property("Acquisition_Galileo.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.threshold", "0.3");
|
||||||
config->set_property("Acquisition_Galileo.threshold", "0.3");
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition_Galileo.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition_Galileo.doppler_step", "250");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition_Galileo.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -336,17 +335,16 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition_Galileo.item_type", "gr_complex");
|
config->set_property("Acquisition_1B.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition");
|
||||||
config->set_property("Acquisition_Galileo.if", "0");
|
config->set_property("Acquisition_1B.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition_Galileo.coherent_integration_time_ms",
|
config->set_property("Acquisition_1B.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition_Galileo.tong_init_val", "1");
|
config->set_property("Acquisition_1B.tong_init_val", "1");
|
||||||
config->set_property("Acquisition_Galileo.tong_max_val", "8");
|
config->set_property("Acquisition_1B.tong_max_val", "8");
|
||||||
config->set_property("Acquisition_Galileo.implementation", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition");
|
config->set_property("Acquisition_1B.threshold", "0.00028"); // Pfa,a = 0.1
|
||||||
config->set_property("Acquisition_Galileo.threshold", "0.00028"); // Pfa,a = 0.1
|
config->set_property("Acquisition_1B.doppler_max", "10000");
|
||||||
config->set_property("Acquisition_Galileo.doppler_max", "10000");
|
config->set_property("Acquisition_1B.doppler_step", "250");
|
||||||
config->set_property("Acquisition_Galileo.doppler_step", "250");
|
config->set_property("Acquisition_1B.dump", "false");
|
||||||
config->set_property("Acquisition_Galileo.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -431,7 +429,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::stop_queue()
|
|||||||
TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,11 +438,11 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
{
|
{
|
||||||
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
int nsamples = floor(fs_in*integration_time_ms*1e-3);
|
||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
std::chrono::duration<double> elapsed_seconds(0);
|
std::chrono::duration<double> elapsed_seconds(0.0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
config_1();
|
config_1();
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
@ -453,14 +451,14 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -471,33 +469,33 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
config_1();
|
config_1();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(5000);
|
acquisition->set_doppler_max(5000);
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(100);
|
acquisition->set_doppler_step(100);
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(0.01);
|
acquisition->set_threshold(0.01);
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
@ -510,7 +508,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -534,7 +532,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
@ -560,33 +558,33 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
|
|||||||
config_2();
|
config_2();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1);
|
||||||
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
acquisition = std::dynamic_pointer_cast<GalileoE1PcpsTongAmbiguousAcquisition>(acq_);
|
||||||
boost::shared_ptr<GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx> msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1B.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1B.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.00028));
|
acquisition->set_threshold(config->property("Acquisition_1B.threshold", 0.00028));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -598,7 +596,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -623,7 +621,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
|
@ -257,15 +257,13 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
|
config->set_property("Acquisition_5X.implementation", "Galileo_E5a_Noncoherent_IQ_Acquisition_CAF");
|
||||||
config->set_property("Acquisition_5X.item_type", "gr_complex");
|
config->set_property("Acquisition_5X.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition_5X.if", "0");
|
|
||||||
config->set_property("Acquisition_5X.coherent_integration_time_ms",
|
config->set_property("Acquisition_5X.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition_5X.max_dwells", "1");
|
config->set_property("Acquisition_5X.max_dwells", "1");
|
||||||
config->set_property("Acquisition_5X.CAF_window_hz",std::to_string(CAF_window_hz));
|
config->set_property("Acquisition_5X.CAF_window_hz",std::to_string(CAF_window_hz));
|
||||||
config->set_property("Acquisition_5X.Zero_padding",std::to_string(Zero_padding));
|
config->set_property("Acquisition_5X.Zero_padding",std::to_string(Zero_padding));
|
||||||
|
|
||||||
config->set_property("Acquisition_5X.implementation", "Galileo_E5a_Noncoherent_IQ_Acquisition_CAF");
|
|
||||||
config->set_property("Acquisition_5X.pfa","0.003");
|
config->set_property("Acquisition_5X.pfa","0.003");
|
||||||
// config->set_property("Acquisition_5X.threshold", "0.01");
|
// config->set_property("Acquisition_5X.threshold", "0.01");
|
||||||
config->set_property("Acquisition_5X.doppler_max", "10000");
|
config->set_property("Acquisition_5X.doppler_max", "10000");
|
||||||
@ -298,12 +296,11 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_2()
|
|||||||
|
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(fs_in));
|
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(fs_in));
|
||||||
|
|
||||||
|
config->set_property("Acquisition_5X.implementation", "Galileo_E5a_PCPS_Acquisition");
|
||||||
config->set_property("Acquisition_5X.item_type", "gr_complex");
|
config->set_property("Acquisition_5X.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition_5X.if", "0");
|
|
||||||
config->set_property("Acquisition_5X.coherent_integration_time_ms",
|
config->set_property("Acquisition_5X.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition_5X.max_dwells", "1");
|
config->set_property("Acquisition_5X.max_dwells", "1");
|
||||||
config->set_property("Acquisition_5X.implementation", "Galileo_E5a_PCPS_Acquisition");
|
|
||||||
config->set_property("Acquisition_5X.threshold", "0.1");
|
config->set_property("Acquisition_5X.threshold", "0.1");
|
||||||
config->set_property("Acquisition_5X.doppler_max", "10000");
|
config->set_property("Acquisition_5X.doppler_max", "10000");
|
||||||
config->set_property("Acquisition_5X.doppler_step", "250");
|
config->set_property("Acquisition_5X.doppler_step", "250");
|
||||||
@ -530,7 +527,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::stop_queue()
|
|||||||
TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, Instantiate)
|
TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -541,7 +538,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun)
|
|||||||
int nsamples = 21000*3;
|
int nsamples = 21000*3;
|
||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
std::chrono::duration<double> elapsed_seconds(0);
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 1);
|
||||||
boost::shared_ptr<GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx> msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx> msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue);
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
@ -553,14 +550,14 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -571,32 +568,32 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
|
|||||||
config_1();
|
config_1();
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GalileoE5aNoncoherentIQAcquisitionCaf>(config.get(), "Acquisition_5X", 1, 1);
|
||||||
boost::shared_ptr<GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx> msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx> msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(0);
|
acquisition->set_channel(0);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition_5X.doppler_max", 5000));
|
acquisition->set_doppler_max(config->property("Acquisition_5X.doppler_max", 5000));
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition_5X.doppler_step", 100));
|
acquisition->set_doppler_step(config->property("Acquisition_5X.doppler_step", 100));
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition_5X.threshold", 0.0001));
|
acquisition->set_threshold(config->property("Acquisition_5X.threshold", 0.0001));
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
// USING THE SIGNAL GENERATOR
|
// USING THE SIGNAL GENERATOR
|
||||||
|
|
||||||
@ -609,7 +606,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
@ -641,7 +638,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
|
@ -244,17 +244,16 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
config->set_property("Acquisition_1C.threshold", "0.8");
|
||||||
config->set_property("Acquisition.threshold", "0.8");
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||||
config->set_property("Acquisition.bit_transition_flag", "false");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -332,17 +331,16 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
config->set_property("Acquisition_1C.pfa", "0.1");
|
||||||
config->set_property("Acquisition.pfa", "0.1");
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||||
config->set_property("Acquisition.bit_transition_flag", "false");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -439,7 +437,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
|
|
||||||
config_1();
|
config_1();
|
||||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
@ -449,14 +447,14 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
|
||||||
@ -470,33 +468,33 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
|
|
||||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(10000);
|
acquisition->set_doppler_max(10000);
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(500);
|
acquisition->set_doppler_step(500);
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(0.5);
|
acquisition->set_threshold(0.5);
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -507,7 +505,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -530,7 +528,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
@ -548,12 +546,12 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
#ifdef OLD_BOOST
|
#ifdef OLD_BOOST
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
}) << "Failure while waiting the queue to stop";
|
||||||
#endif
|
#endif
|
||||||
#ifndef OLD_BOOST
|
#ifndef OLD_BOOST
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
}) << "Failure while waiting the queue to stop";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,33 +564,33 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
|||||||
config_2();
|
config_2();
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1);
|
acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -603,7 +601,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
|||||||
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue));
|
||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test." ;
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -628,7 +626,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
@ -643,12 +641,12 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
|||||||
#ifdef OLD_BOOST
|
#ifdef OLD_BOOST
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
ch_thread.timed_join(boost::posix_time::seconds(1));
|
ch_thread.timed_join(boost::posix_time::seconds(1));
|
||||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
}) << "Failure while waiting the queue to stop";
|
||||||
#endif
|
#endif
|
||||||
#ifndef OLD_BOOST
|
#ifndef OLD_BOOST
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50));
|
||||||
}) << "Failure while waiting the queue to stop" << std::endl;
|
}) << "Failure while waiting the queue to stop";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
#include <gnuradio/top_block.h>
|
#include <gnuradio/top_block.h>
|
||||||
#include <gnuradio/blocks/file_source.h>
|
#include <gnuradio/blocks/file_source.h>
|
||||||
@ -47,6 +48,9 @@
|
|||||||
#include "in_memory_configuration.h"
|
#include "in_memory_configuration.h"
|
||||||
#include "gnss_sdr_valve.h"
|
#include "gnss_sdr_valve.h"
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
|
#include "gnuplot_i.h"
|
||||||
|
#include "test_flags.h"
|
||||||
|
#include "acquisition_dump_reader.h"
|
||||||
#include "gps_l1_ca_pcps_acquisition.h"
|
#include "gps_l1_ca_pcps_acquisition.h"
|
||||||
|
|
||||||
|
|
||||||
@ -114,18 +118,23 @@ protected:
|
|||||||
config = std::make_shared<InMemoryConfiguration>();
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
item_size = sizeof(gr_complex);
|
item_size = sizeof(gr_complex);
|
||||||
gnss_synchro = Gnss_Synchro();
|
gnss_synchro = Gnss_Synchro();
|
||||||
|
doppler_max = 5000;
|
||||||
|
doppler_step = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
~GpsL1CaPcpsAcquisitionTest()
|
~GpsL1CaPcpsAcquisitionTest()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
void plot_grid();
|
||||||
|
|
||||||
gr::top_block_sptr top_block;
|
gr::top_block_sptr top_block;
|
||||||
std::shared_ptr<GNSSBlockFactory> factory;
|
std::shared_ptr<GNSSBlockFactory> factory;
|
||||||
std::shared_ptr<InMemoryConfiguration> config;
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
Gnss_Synchro gnss_synchro;
|
Gnss_Synchro gnss_synchro;
|
||||||
size_t item_size;
|
size_t item_size;
|
||||||
|
unsigned int doppler_max;
|
||||||
|
unsigned int doppler_step;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -137,23 +146,86 @@ void GpsL1CaPcpsAcquisitionTest::init()
|
|||||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||||
gnss_synchro.PRN = 1;
|
gnss_synchro.PRN = 1;
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms", "1");
|
config->set_property("Acquisition_1C.coherent_integration_time_ms", "1");
|
||||||
config->set_property("Acquisition.dump", "false");
|
if(FLAGS_plot_acq_grid == true)
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
{
|
||||||
config->set_property("Acquisition.threshold", "0.00001");
|
config->set_property("Acquisition_1C.dump", "true");
|
||||||
config->set_property("Acquisition.doppler_max", "5000");
|
}
|
||||||
config->set_property("Acquisition.doppler_step", "500");
|
else
|
||||||
config->set_property("Acquisition.repeat_satellite", "false");
|
{
|
||||||
//config->set_property("Acquisition.pfa", "0.0");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
|
}
|
||||||
|
config->set_property("Acquisition_1C.dump_filename", "./tmp-acq-gps1/acquisition.dat");
|
||||||
|
config->set_property("Acquisition_1C.threshold", "0.00001");
|
||||||
|
config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max));
|
||||||
|
config->set_property("Acquisition_1C.doppler_step", std::to_string(doppler_step));
|
||||||
|
config->set_property("Acquisition_1C.repeat_satellite", "false");
|
||||||
|
//config->set_property("Acquisition_1C.pfa", "0.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GpsL1CaPcpsAcquisitionTest::plot_grid()
|
||||||
|
{
|
||||||
|
//load the measured values
|
||||||
|
std::string basename = "./tmp-acq-gps1/acquisition_G_1C";
|
||||||
|
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||||
|
|
||||||
|
unsigned int samples_per_code = static_cast<unsigned int>(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !!
|
||||||
|
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||||
|
|
||||||
|
if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||||
|
|
||||||
|
std::vector<int> *doppler = &acq_dump.doppler;
|
||||||
|
std::vector<unsigned int> *samples = &acq_dump.samples;
|
||||||
|
std::vector<std::vector<float> > *mag = &acq_dump.mag;
|
||||||
|
|
||||||
|
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||||
|
if(gnuplot_executable.empty())
|
||||||
|
{
|
||||||
|
std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl;
|
||||||
|
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||||
|
std::cout << "Test results will not be plotted." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boost::filesystem::path p(gnuplot_executable);
|
||||||
|
boost::filesystem::path dir = p.parent_path();
|
||||||
|
std::string gnuplot_path = dir.native();
|
||||||
|
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||||
|
|
||||||
|
Gnuplot g1("lines");
|
||||||
|
g1.set_title("GPS L1 C/A signal acquisition for satellite PRN #" + std::to_string(gnss_synchro.PRN));
|
||||||
|
g1.set_xlabel("Doppler [Hz]");
|
||||||
|
g1.set_ylabel("Sample");
|
||||||
|
//g1.cmd("set view 60, 105, 1, 1");
|
||||||
|
g1.plot_grid3d(*doppler, *samples, *mag);
|
||||||
|
|
||||||
|
g1.savetops("GPS_L1_acq_grid");
|
||||||
|
g1.savetopdf("GPS_L1_acq_grid");
|
||||||
|
g1.showonscreen();
|
||||||
|
}
|
||||||
|
catch (const GnuplotException & ge)
|
||||||
|
{
|
||||||
|
std::cout << ge.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string data_str = "./tmp-acq-gps1";
|
||||||
|
if (boost::filesystem::exists(data_str))
|
||||||
|
{
|
||||||
|
boost::filesystem::remove_all(data_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate)
|
TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,7 +239,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
|
|||||||
|
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
init();
|
init();
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
boost::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = boost::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
@ -178,14 +250,14 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
|
|||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
|
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -194,7 +266,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun)
|
|||||||
TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
||||||
{
|
{
|
||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
std::chrono::duration<double> elapsed_seconds(0);
|
std::chrono::duration<double> elapsed_seconds(0.0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
|
|
||||||
double expected_delay_samples = 524;
|
double expected_delay_samples = 524;
|
||||||
@ -202,32 +274,42 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
|||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
if(FLAGS_plot_acq_grid == true)
|
||||||
|
{
|
||||||
|
std::string data_str = "./tmp-acq-gps1";
|
||||||
|
if (boost::filesystem::exists(data_str))
|
||||||
|
{
|
||||||
|
boost::filesystem::remove_all(data_str);
|
||||||
|
}
|
||||||
|
boost::filesystem::create_directory(data_str);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<GpsL1CaPcpsAcquisition> acquisition = std::make_shared<GpsL1CaPcpsAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(0.001);
|
acquisition->set_threshold(0.001);
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(5000);
|
acquisition->set_doppler_max(doppler_max);
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(100);
|
acquisition->set_doppler_step(doppler_step);
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
@ -236,7 +318,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
|||||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
acquisition->set_local_code();
|
acquisition->set_local_code();
|
||||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||||
@ -247,7 +329,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
|||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||||
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
@ -259,4 +341,9 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";
|
EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";
|
||||||
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
||||||
|
|
||||||
|
if(FLAGS_plot_acq_grid == true)
|
||||||
|
{
|
||||||
|
plot_grid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,19 +259,17 @@ void GpsL1CaPcpsAcquisitionTestFpga::init()
|
|||||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||||
gnss_synchro.PRN = 1;
|
gnss_synchro.PRN = 1;
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
config->set_property("GNSS-SDR.internal_fs_sps", "4000000");
|
||||||
config->set_property("Acquisition.item_type", "cshort");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "cshort");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms", "1");
|
config->set_property("Acquisition_1C.coherent_integration_time_ms", "1");
|
||||||
config->set_property("Acquisition.dump", "false");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.implementation",
|
config->set_property("Acquisition_1C.threshold", "0.001");
|
||||||
"GPS_L1_CA_PCPS_Acquisition");
|
config->set_property("Acquisition_1C.doppler_max", "5000");
|
||||||
config->set_property("Acquisition.threshold", "0.001");
|
config->set_property("Acquisition_1C.doppler_step", "500");
|
||||||
config->set_property("Acquisition.doppler_max", "5000");
|
config->set_property("Acquisition_1C.repeat_satellite", "false");
|
||||||
config->set_property("Acquisition.doppler_step", "500");
|
config->set_property("Acquisition_1C.pfa", "0.0");
|
||||||
config->set_property("Acquisition.repeat_satellite", "false");
|
config->set_property("Acquisition_1C.select_queue_Fpga", "0");
|
||||||
config->set_property("Acquisition.pfa", "0.0");
|
config->set_property("Acquisition_1C.devicename", "/dev/uio0");
|
||||||
config->set_property("Acquisition.select_queue_Fpga", "0");
|
|
||||||
config->set_property("Acquisition.devicename", "/dev/uio0");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -279,7 +277,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, Instantiate)
|
|||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionFpga> acquisition =
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionFpga> acquisition =
|
||||||
boost::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition", 0, 1);
|
boost::make_shared<GpsL1CaPcpsAcquisitionFpga>(config.get(), "Acquisition_1C", 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -294,39 +292,39 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults)
|
|||||||
init();
|
init();
|
||||||
|
|
||||||
std::shared_ptr < GpsL1CaPcpsAcquisitionFpga > acquisition =
|
std::shared_ptr < GpsL1CaPcpsAcquisitionFpga > acquisition =
|
||||||
std::make_shared < GpsL1CaPcpsAcquisitionFpga > (config.get(), "Acquisition", 0, 1);
|
std::make_shared < GpsL1CaPcpsAcquisitionFpga > (config.get(), "Acquisition_1C", 0, 1);
|
||||||
|
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTestFpga_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTestFpga_msg_rx_make();
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionTestFpga_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTestFpga_msg_rx_make();
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
})<< "Failure setting channel." << std::endl;
|
})<< "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
})<< "Failure setting gnss_synchro." << std::endl;
|
})<< "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
acquisition->set_threshold(0.1);
|
acquisition->set_threshold(0.1);
|
||||||
})<< "Failure setting threshold." << std::endl;
|
})<< "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
acquisition->set_doppler_max(10000);
|
acquisition->set_doppler_max(10000);
|
||||||
})<< "Failure setting doppler_max." << std::endl;
|
})<< "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
acquisition->set_doppler_step(250);
|
acquisition->set_doppler_step(250);
|
||||||
})<< "Failure setting doppler_step." << std::endl;
|
})<< "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
})<< "Failure connecting acquisition to the top_block." << std::endl;
|
})<< "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
// uncomment the next line to load the file from the current directory
|
// uncomment the next line to load the file from the current directory
|
||||||
std::string file = "./GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
std::string file = "./GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
@ -349,7 +347,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults)
|
|||||||
top_block->connect(file_source, 0, throttle_block, 0);
|
top_block->connect(file_source, 0, throttle_block, 0);
|
||||||
top_block->connect(throttle_block, 0, null_sink, 0);
|
top_block->connect(throttle_block, 0, null_sink, 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
})<< "Failure connecting the blocks of acquisition test." << std::endl;
|
})<< "Failure connecting the blocks of acquisition test." ;
|
||||||
|
|
||||||
acquisition->set_state(1); // Ensure that acquisition starts at the first state
|
acquisition->set_state(1); // Ensure that acquisition starts at the first state
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
@ -366,7 +364,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTestFpga, ValidationOfResults)
|
|||||||
top_block->wait();
|
top_block->wait();
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
})<< "Failure running the top_block." << std::endl;
|
})<< "Failure running the top_block.";
|
||||||
|
|
||||||
t3.join();
|
t3.join();
|
||||||
|
|
||||||
|
@ -240,17 +240,16 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition");
|
config->set_property("Acquisition_1C.threshold", "0.8");
|
||||||
config->set_property("Acquisition.threshold", "0.8");
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||||
config->set_property("Acquisition.bit_transition_flag", "false");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -328,17 +327,16 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_OpenCl_Acquisition");
|
config->set_property("Acquisition_1C.pfa", "0.1");
|
||||||
config->set_property("Acquisition.pfa", "0.1");
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||||
config->set_property("Acquisition.bit_transition_flag", "false");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -423,7 +421,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::stop_queue()
|
|||||||
TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, Instantiate)
|
TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -434,7 +432,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
std::chrono::duration<double> elapsed_seconds(0);
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
|
||||||
config_1();
|
config_1();
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
@ -444,14 +442,14 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -466,27 +464,27 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -498,7 +496,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -521,7 +519,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
@ -544,32 +542,32 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
|
|||||||
{
|
{
|
||||||
config_2();
|
config_2();
|
||||||
|
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsOpenClAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -581,7 +579,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -606,7 +604,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
|
@ -255,17 +255,16 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
config->set_property("Acquisition_1C.threshold", "250");
|
||||||
config->set_property("Acquisition.threshold", "250");
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||||
config->set_property("Acquisition.bit_transition_flag", "false");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -347,17 +346,16 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "1");
|
config->set_property("Acquisition_1C.max_dwells", "1");
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
config->set_property("Acquisition_1C.threshold", std::to_string(FLAGS_value_threshold));
|
||||||
config->set_property("Acquisition.threshold", std::to_string(FLAGS_value_threshold));
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "100");
|
||||||
config->set_property("Acquisition.doppler_step", "100");
|
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||||
config->set_property("Acquisition.bit_transition_flag", "false");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -439,17 +437,16 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_3()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.max_dwells", "2");
|
config->set_property("Acquisition_1C.max_dwells", "2");
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition");
|
config->set_property("Acquisition_1C.threshold", "0.01");
|
||||||
config->set_property("Acquisition.threshold", "0.01");
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1C.bit_transition_flag", "false");
|
||||||
config->set_property("Acquisition.bit_transition_flag", "false");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -537,7 +534,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::stop_queue()
|
|||||||
TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, Instantiate)
|
TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -545,13 +542,13 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun)
|
|||||||
{
|
{
|
||||||
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
int nsamples = floor(fs_in * integration_time_ms * 1e-3);
|
||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
std::chrono::duration<double> elapsed_seconds(0);
|
std::chrono::duration<double> elapsed_seconds(0.0);
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
config_1();
|
config_1();
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
@ -560,14 +557,14 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test."<< std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block."<< std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -578,32 +575,32 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults)
|
|||||||
config_1();
|
config_1();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(10000);
|
acquisition->set_doppler_max(10000);
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(250);
|
acquisition->set_doppler_step(250);
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(100);
|
acquisition->set_threshold(100);
|
||||||
}) << "Failure setting threshold."<< std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
@ -616,7 +613,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -642,7 +639,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
@ -672,32 +669,32 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
|
|||||||
config_1();
|
config_1();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(10000);
|
acquisition->set_doppler_max(10000);
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(250);
|
acquisition->set_doppler_step(250);
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(100);
|
acquisition->set_threshold(100);
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
@ -710,7 +707,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -736,7 +733,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
@ -764,32 +761,20 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
|||||||
config_2();
|
config_2();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsQuickSyncAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel."<< std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro."<< std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
/* ASSERT_NO_THROW( {
|
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
|
||||||
}) << "Failure setting doppler_max."<< std::endl;
|
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
|
||||||
}) << "Failure setting doppler_step."<< std::endl;
|
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
|
||||||
}) << "Failure setting threshold."<< std::endl; */
|
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block."<< std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
acquisition->reset();
|
acquisition->reset();
|
||||||
@ -802,7 +787,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -829,7 +814,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
|
@ -240,17 +240,16 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_1()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
config->set_property("Acquisition_1C.threshold", "0.8");
|
||||||
config->set_property("Acquisition.threshold", "0.8");
|
config->set_property("Acquisition_1C.tong_init_val", "1");
|
||||||
config->set_property("Acquisition.tong_init_val", "1");
|
config->set_property("Acquisition_1C.tong_max_val", "8");
|
||||||
config->set_property("Acquisition.tong_max_val", "8");
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -328,17 +327,16 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::config_2()
|
|||||||
config->set_property("InputFilter.filter_type", "bandpass");
|
config->set_property("InputFilter.filter_type", "bandpass");
|
||||||
config->set_property("InputFilter.grid_density", "16");
|
config->set_property("InputFilter.grid_density", "16");
|
||||||
|
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
||||||
config->set_property("Acquisition.if", "0");
|
config->set_property("Acquisition_1C.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.coherent_integration_time_ms",
|
config->set_property("Acquisition_1C.coherent_integration_time_ms",
|
||||||
std::to_string(integration_time_ms));
|
std::to_string(integration_time_ms));
|
||||||
config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition");
|
config->set_property("Acquisition_1C.threshold", "0.00108"); // Pfa,a = 0.1
|
||||||
config->set_property("Acquisition.threshold", "0.00108"); // Pfa,a = 0.1
|
config->set_property("Acquisition_1C.tong_init_val", "1");
|
||||||
config->set_property("Acquisition.tong_init_val", "1");
|
config->set_property("Acquisition_1C.tong_max_val", "8");
|
||||||
config->set_property("Acquisition.tong_max_val", "8");
|
config->set_property("Acquisition_1C.doppler_max", "10000");
|
||||||
config->set_property("Acquisition.doppler_max", "10000");
|
config->set_property("Acquisition_1C.doppler_step", "250");
|
||||||
config->set_property("Acquisition.doppler_step", "250");
|
config->set_property("Acquisition_1C.dump", "false");
|
||||||
config->set_property("Acquisition.dump", "false");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -422,7 +420,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::stop_queue()
|
|||||||
TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, Instantiate)
|
TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, Instantiate)
|
||||||
{
|
{
|
||||||
config_1();
|
config_1();
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -435,7 +433,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
|
|
||||||
config_1();
|
config_1();
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
@ -445,14 +443,14 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -464,32 +462,32 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
|
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -501,7 +499,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
// i = 0 --> satellite in acquisition is visible
|
// i = 0 --> satellite in acquisition is visible
|
||||||
// i = 1 --> satellite in acquisition is not visible
|
// i = 1 --> satellite in acquisition is not visible
|
||||||
@ -525,7 +523,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
@ -552,32 +550,32 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
|||||||
config_2();
|
config_2();
|
||||||
top_block = gr::make_top_block("Acquisition test");
|
top_block = gr::make_top_block("Acquisition test");
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition", 1, 1);
|
acquisition = std::make_shared<GpsL1CaPcpsTongAcquisition>(config.get(), "Acquisition_1C", 1, 1);
|
||||||
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
boost::shared_ptr<GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx> msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000));
|
acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000));
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500));
|
acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500));
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(config->property("Acquisition.threshold", 0.0));
|
acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0));
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
|
|
||||||
@ -589,7 +587,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
|||||||
signal_source->connect(top_block);
|
signal_source->connect(top_block);
|
||||||
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl;
|
||||||
|
|
||||||
@ -614,7 +612,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities)
|
|||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
stop_queue();
|
stop_queue();
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/make_shared.hpp>
|
#include <boost/make_shared.hpp>
|
||||||
#include <gnuradio/top_block.h>
|
#include <gnuradio/top_block.h>
|
||||||
#include <gnuradio/blocks/file_source.h>
|
#include <gnuradio/blocks/file_source.h>
|
||||||
@ -49,6 +50,9 @@
|
|||||||
#include "in_memory_configuration.h"
|
#include "in_memory_configuration.h"
|
||||||
#include "gnss_sdr_valve.h"
|
#include "gnss_sdr_valve.h"
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
|
#include "gnuplot_i.h"
|
||||||
|
#include "test_flags.h"
|
||||||
|
#include "acquisition_dump_reader.h"
|
||||||
#include "gps_l2_m_pcps_acquisition.h"
|
#include "gps_l2_m_pcps_acquisition.h"
|
||||||
#include "GPS_L2C.h"
|
#include "GPS_L2C.h"
|
||||||
|
|
||||||
@ -70,7 +74,6 @@ private:
|
|||||||
public:
|
public:
|
||||||
int rx_message;
|
int rx_message;
|
||||||
~GpsL2MPcpsAcquisitionTest_msg_rx(); //!< Default destructor
|
~GpsL2MPcpsAcquisitionTest_msg_rx(); //!< Default destructor
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GpsL2MPcpsAcquisitionTest_msg_rx_sptr GpsL2MPcpsAcquisitionTest_msg_rx_make()
|
GpsL2MPcpsAcquisitionTest_msg_rx_sptr GpsL2MPcpsAcquisitionTest_msg_rx_make()
|
||||||
@ -114,8 +117,10 @@ protected:
|
|||||||
factory = std::make_shared<GNSSBlockFactory>();
|
factory = std::make_shared<GNSSBlockFactory>();
|
||||||
config = std::make_shared<InMemoryConfiguration>();
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
item_size = sizeof(gr_complex);
|
item_size = sizeof(gr_complex);
|
||||||
sampling_freqeuncy_hz = 0;
|
sampling_frequency_hz = 5000000;
|
||||||
nsamples = 0;
|
nsamples = 0;
|
||||||
|
doppler_max = 3000;
|
||||||
|
doppler_step = 125;
|
||||||
gnss_synchro = Gnss_Synchro();
|
gnss_synchro = Gnss_Synchro();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +128,7 @@ protected:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
|
void plot_grid();
|
||||||
|
|
||||||
gr::msg_queue::sptr queue;
|
gr::msg_queue::sptr queue;
|
||||||
gr::top_block_sptr top_block;
|
gr::top_block_sptr top_block;
|
||||||
@ -130,8 +136,10 @@ protected:
|
|||||||
std::shared_ptr<InMemoryConfiguration> config;
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
Gnss_Synchro gnss_synchro;
|
Gnss_Synchro gnss_synchro;
|
||||||
size_t item_size;
|
size_t item_size;
|
||||||
int sampling_freqeuncy_hz;
|
int sampling_frequency_hz;
|
||||||
int nsamples;
|
int nsamples;
|
||||||
|
unsigned int doppler_max;
|
||||||
|
unsigned int doppler_step;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -140,22 +148,83 @@ void GpsL2MPcpsAcquisitionTest::init()
|
|||||||
gnss_synchro.Channel_ID = 0;
|
gnss_synchro.Channel_ID = 0;
|
||||||
gnss_synchro.System = 'G';
|
gnss_synchro.System = 'G';
|
||||||
std::string signal = "2S";
|
std::string signal = "2S";
|
||||||
//strncpy(gnss_synchro.Signal, signal.c_str(), 3);
|
|
||||||
std::memcpy(static_cast<void*>(gnss_synchro.Signal), signal.c_str(), 3); // copy string into synchro char array: 2 char + null
|
std::memcpy(static_cast<void*>(gnss_synchro.Signal), signal.c_str(), 3); // copy string into synchro char array: 2 char + null
|
||||||
gnss_synchro.Signal[2] = 0; // make sure that string length is only two characters
|
gnss_synchro.Signal[2] = 0; // make sure that string length is only two characters
|
||||||
gnss_synchro.PRN = 7;
|
gnss_synchro.PRN = 7;
|
||||||
|
|
||||||
sampling_freqeuncy_hz = 5000000;
|
nsamples = round(static_cast<double>(sampling_frequency_hz) * GPS_L2_M_PERIOD) * 2;
|
||||||
nsamples = round(static_cast<double>(sampling_freqeuncy_hz) * GPS_L2_M_PERIOD) * 2;
|
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_frequency_hz));
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_freqeuncy_hz));
|
config->set_property("Acquisition_2S.implementation", "GPS_L2_M_PCPS_Acquisition");
|
||||||
config->set_property("Acquisition.item_type", "gr_complex");
|
config->set_property("Acquisition_2S.item_type", "gr_complex");
|
||||||
config->set_property("Acquisition.if", "0");
|
if(FLAGS_plot_acq_grid == true)
|
||||||
config->set_property("Acquisition.dump", "false");
|
{
|
||||||
config->set_property("Acquisition.implementation", "GPS_L2_M_PCPS_Acquisition");
|
config->set_property("Acquisition_2S.dump", "true");
|
||||||
config->set_property("Acquisition.threshold", "0.001");
|
}
|
||||||
config->set_property("Acquisition.doppler_max", "5000");
|
else
|
||||||
config->set_property("Acquisition.doppler_step", "100");
|
{
|
||||||
config->set_property("Acquisition.repeat_satellite", "false");
|
config->set_property("Acquisition_2S.dump", "false");
|
||||||
|
}
|
||||||
|
config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition.dat");
|
||||||
|
config->set_property("Acquisition_2S.threshold", "0.001");
|
||||||
|
config->set_property("Acquisition_2S.doppler_max", std::to_string(doppler_max));
|
||||||
|
config->set_property("Acquisition_2S.doppler_step", std::to_string(doppler_step));
|
||||||
|
config->set_property("Acquisition_2S.repeat_satellite", "false");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GpsL2MPcpsAcquisitionTest::plot_grid()
|
||||||
|
{
|
||||||
|
//load the measured values
|
||||||
|
std::string basename = "./tmp-acq-gps2/acquisition_G_2S";
|
||||||
|
unsigned int sat = static_cast<unsigned int>(gnss_synchro.PRN);
|
||||||
|
|
||||||
|
unsigned int samples_per_code = static_cast<unsigned int>(floor(sampling_frequency_hz / (GPS_L2_M_CODE_RATE_HZ / GPS_L2_M_CODE_LENGTH_CHIPS)) - 1000); // !!
|
||||||
|
acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code);
|
||||||
|
|
||||||
|
if(!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl;
|
||||||
|
|
||||||
|
std::vector<int> *doppler = &acq_dump.doppler;
|
||||||
|
std::vector<unsigned int> *samples = &acq_dump.samples;
|
||||||
|
std::vector<std::vector<float> > *mag = &acq_dump.mag;
|
||||||
|
|
||||||
|
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||||
|
if(gnuplot_executable.empty())
|
||||||
|
{
|
||||||
|
std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE," << std::endl;
|
||||||
|
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||||
|
std::cout << "Test results will not be plotted." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Plotting the acquisition grid. This can take a while..." << std::endl;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boost::filesystem::path p(gnuplot_executable);
|
||||||
|
boost::filesystem::path dir = p.parent_path();
|
||||||
|
std::string gnuplot_path = dir.native();
|
||||||
|
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||||
|
|
||||||
|
Gnuplot g1("lines");
|
||||||
|
g1.set_title("GPS L2CM signal acquisition for satellite PRN #" + std::to_string(gnss_synchro.PRN));
|
||||||
|
g1.set_xlabel("Doppler [Hz]");
|
||||||
|
g1.set_ylabel("Sample");
|
||||||
|
//g1.cmd("set view 60, 105, 1, 1");
|
||||||
|
g1.plot_grid3d(*doppler, *samples, *mag);
|
||||||
|
|
||||||
|
g1.savetops("GPS_L2CM_acq_grid");
|
||||||
|
g1.savetopdf("GPS_L2CM_acq_grid");
|
||||||
|
g1.showonscreen();
|
||||||
|
}
|
||||||
|
catch (const GnuplotException & ge)
|
||||||
|
{
|
||||||
|
std::cout << ge.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string data_str = "./tmp-acq-gps2";
|
||||||
|
if (boost::filesystem::exists(data_str))
|
||||||
|
{
|
||||||
|
boost::filesystem::remove_all(data_str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -163,7 +232,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, Instantiate)
|
|||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -175,24 +244,23 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun)
|
|||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
|
|
||||||
init();
|
init();
|
||||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 1);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(sampling_freqeuncy_hz, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
boost::shared_ptr<gr::analog::sig_source_c> source = gr::analog::sig_source_c::make(sampling_frequency_hz, gr::analog::GR_SIN_WAVE, 2000, 1, gr_complex(0));
|
||||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||||
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -206,33 +274,44 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
|
|||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
double expected_delay_samples = 1;//2004;
|
double expected_delay_samples = 1;//2004;
|
||||||
double expected_doppler_hz = 1200;//3000;
|
double expected_doppler_hz = 1200;//3000;
|
||||||
|
|
||||||
|
if(FLAGS_plot_acq_grid == true)
|
||||||
|
{
|
||||||
|
std::string data_str = "./tmp-acq-gps2";
|
||||||
|
if (boost::filesystem::exists(data_str))
|
||||||
|
{
|
||||||
|
boost::filesystem::remove_all(data_str);
|
||||||
|
}
|
||||||
|
boost::filesystem::create_directory(data_str);
|
||||||
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition_2S", 1, 1);
|
||||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_channel(1);
|
acquisition->set_channel(1);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_gnss_synchro(&gnss_synchro);
|
acquisition->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_threshold(0.001);
|
acquisition->set_threshold(0.001);
|
||||||
}) << "Failure setting threshold." << std::endl;
|
}) << "Failure setting threshold.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_max(5000);
|
acquisition->set_doppler_max(doppler_max);
|
||||||
}) << "Failure setting doppler_max." << std::endl;
|
}) << "Failure setting doppler_max.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_doppler_step(10);
|
acquisition->set_doppler_step(doppler_step);
|
||||||
}) << "Failure setting doppler_step." << std::endl;
|
}) << "Failure setting doppler_step.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->connect(top_block);
|
acquisition->connect(top_block);
|
||||||
}) << "Failure connecting acquisition to the top_block." << std::endl;
|
}) << "Failure connecting acquisition to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
@ -249,22 +328,21 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
|
|||||||
top_block->connect(file_source, 0, valve , 0);
|
top_block->connect(file_source, 0, valve , 0);
|
||||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||||
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
}) << "Failure connecting the blocks of acquisition test.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
acquisition->set_local_code();
|
acquisition->set_local_code();
|
||||||
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
acquisition->set_state(1); // Ensure that acquisition starts at the first sample
|
||||||
acquisition->init();
|
acquisition->init();
|
||||||
}) << "Failure set_state and init acquisition test" << std::endl;
|
}) << "Failure set_state and init acquisition test";
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
start = std::chrono::system_clock::now();
|
start = std::chrono::system_clock::now();
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
//unsigned long int Acq_samplestamp_samples = gnss_synchro.Acq_samplestamp_samples;
|
|
||||||
std::cout << "Acquisition process runtime duration: " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Acquisition process runtime duration: " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
|
||||||
std::cout << "gnss_synchro.Acq_doppler_hz = " << gnss_synchro.Acq_doppler_hz << " Hz" << std::endl;
|
std::cout << "gnss_synchro.Acq_doppler_hz = " << gnss_synchro.Acq_doppler_hz << " Hz" << std::endl;
|
||||||
@ -276,6 +354,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
|
|||||||
float delay_error_chips = static_cast<float>(delay_error_samples * 1023 / 4000);
|
float delay_error_chips = static_cast<float>(delay_error_samples * 1023 / 4000);
|
||||||
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
|
double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz);
|
||||||
|
|
||||||
EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)";
|
EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 2/(3*integration period)";
|
||||||
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips";
|
||||||
|
|
||||||
|
if(FLAGS_plot_acq_grid == true)
|
||||||
|
{
|
||||||
|
plot_grid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,169 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_filter_lite_test.cc
|
||||||
|
* \brief Implements Unit Test for the NotchFilterLite class.
|
||||||
|
* \author Antonio Ramos, 2017. antonio.ramos(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <complex>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
#include <gnuradio/top_block.h>
|
||||||
|
#include <gnuradio/analog/sig_source_waveform.h>
|
||||||
|
#include <gnuradio/analog/sig_source_c.h>
|
||||||
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <gnuradio/blocks/null_sink.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "gnss_block_factory.h"
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
#include "in_memory_configuration.h"
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "notch_filter_lite.h"
|
||||||
|
#include "file_signal_source.h"
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_int32(notch_filter_lite_test_nsamples, 1000000 , "Number of samples to filter in the tests (max: 2147483647)");
|
||||||
|
|
||||||
|
class NotchFilterLiteTest: public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
NotchFilterLiteTest()
|
||||||
|
{
|
||||||
|
queue = gr::msg_queue::make(0);
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
nsamples = FLAGS_notch_filter_lite_test_nsamples;
|
||||||
|
}
|
||||||
|
~NotchFilterLiteTest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void configure_gr_complex_gr_complex();
|
||||||
|
boost::shared_ptr<gr::msg_queue> queue;
|
||||||
|
gr::top_block_sptr top_block;
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
|
size_t item_size;
|
||||||
|
int nsamples;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void NotchFilterLiteTest::init()
|
||||||
|
{
|
||||||
|
config->set_property("InputFilter.pfa", "0.01");
|
||||||
|
config->set_property("InputFilter.p_c_factor", "0.9");
|
||||||
|
config->set_property("InputFilter.length", "32");
|
||||||
|
config->set_property("InputFilter.segments_est", "12500");
|
||||||
|
config->set_property("InputFilter.segments_reset", "5000000");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotchFilterLiteTest::configure_gr_complex_gr_complex()
|
||||||
|
{
|
||||||
|
config->set_property("InputFilter.input_item_type", "gr_complex");
|
||||||
|
config->set_property("InputFilter.output_item_type", "gr_complex");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(NotchFilterLiteTest, InstantiateGrComplexGrComplex)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::unique_ptr<NotchFilterLite> filter(new NotchFilterLite(config.get(), "InputFilter", 1, 1));
|
||||||
|
int res = 0;
|
||||||
|
if (filter) res = 1;
|
||||||
|
ASSERT_EQ(1, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(NotchFilterLiteTest, ConnectAndRun)
|
||||||
|
{
|
||||||
|
int fs_in = 4000000;
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
top_block = gr::make_top_block("Notch filter lite test");
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::shared_ptr<NotchFilterLite> filter = std::make_shared<NotchFilterLite>(config.get(), "InputFilter", 1, 1);
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
filter->connect(top_block);
|
||||||
|
boost::shared_ptr<gr::block> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||||
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
|
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||||
|
|
||||||
|
top_block->connect(source, 0, valve, 0);
|
||||||
|
top_block->connect(valve, 0, filter->get_left_block(), 0);
|
||||||
|
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||||
|
}) << "Failure connecting the top_block."<< std::endl;
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
}) << "Failure running the top_block." << std::endl;
|
||||||
|
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(NotchFilterLiteTest, ConnectAndRunGrcomplex)
|
||||||
|
{
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
top_block = gr::make_top_block("Notch filter lite test");
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::shared_ptr<NotchFilterLite> filter = std::make_shared<NotchFilterLite>(config.get(), "InputFilter", 1, 1);
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config2 = std::make_shared<InMemoryConfiguration>();
|
||||||
|
|
||||||
|
config2->set_property("Test_Source.samples", std::to_string(nsamples));
|
||||||
|
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
||||||
|
std::string path = std::string(TEST_PATH);
|
||||||
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
|
config2->set_property("Test_Source.filename", filename);
|
||||||
|
config2->set_property("Test_Source.item_type", "gr_complex");
|
||||||
|
config2->set_property("Test_Source.repeat", "true");
|
||||||
|
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
filter->connect(top_block);
|
||||||
|
|
||||||
|
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||||
|
source->connect(top_block);
|
||||||
|
|
||||||
|
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||||
|
|
||||||
|
top_block->connect(source->get_right_block(), 0, filter->get_left_block(), 0);
|
||||||
|
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||||
|
}) << "Failure connecting the top_block."<< std::endl;
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
}) << "Failure running the top_block." << std::endl;
|
||||||
|
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
}
|
@ -0,0 +1,169 @@
|
|||||||
|
/*!
|
||||||
|
* \file notch_filter_test.cc
|
||||||
|
* \brief Implements Unit Test for the NotchFilter class.
|
||||||
|
* \author Antonio Ramos, 2017. antonio.ramos(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <complex>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
#include <gnuradio/top_block.h>
|
||||||
|
#include <gnuradio/analog/sig_source_waveform.h>
|
||||||
|
#include <gnuradio/analog/sig_source_c.h>
|
||||||
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <gnuradio/blocks/null_sink.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "gnss_block_factory.h"
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
#include "in_memory_configuration.h"
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "notch_filter.h"
|
||||||
|
#include "file_signal_source.h"
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_int32(notch_filter_test_nsamples, 1000000 , "Number of samples to filter in the tests (max: 2147483647)");
|
||||||
|
|
||||||
|
class NotchFilterTest: public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
NotchFilterTest()
|
||||||
|
{
|
||||||
|
queue = gr::msg_queue::make(0);
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
nsamples = FLAGS_notch_filter_test_nsamples;
|
||||||
|
}
|
||||||
|
~NotchFilterTest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void configure_gr_complex_gr_complex();
|
||||||
|
boost::shared_ptr<gr::msg_queue> queue;
|
||||||
|
gr::top_block_sptr top_block;
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
|
size_t item_size;
|
||||||
|
int nsamples;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void NotchFilterTest::init()
|
||||||
|
{
|
||||||
|
config->set_property("InputFilter.pfa", "0.01");
|
||||||
|
config->set_property("InputFilter.p_c_factor", "0.9");
|
||||||
|
config->set_property("InputFilter.length", "32");
|
||||||
|
config->set_property("InputFilter.segments_est", "12500");
|
||||||
|
config->set_property("InputFilter.segments_reset", "5000000");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NotchFilterTest::configure_gr_complex_gr_complex()
|
||||||
|
{
|
||||||
|
config->set_property("InputFilter.input_item_type", "gr_complex");
|
||||||
|
config->set_property("InputFilter.output_item_type", "gr_complex");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(NotchFilterTest, InstantiateGrComplexGrComplex)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::unique_ptr<NotchFilter> filter(new NotchFilter(config.get(), "InputFilter", 1, 1));
|
||||||
|
int res = 0;
|
||||||
|
if (filter) res = 1;
|
||||||
|
ASSERT_EQ(1, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(NotchFilterTest, ConnectAndRun)
|
||||||
|
{
|
||||||
|
int fs_in = 4000000;
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
top_block = gr::make_top_block("Notch filter test");
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::shared_ptr<NotchFilter> filter = std::make_shared<NotchFilter>(config.get(), "InputFilter", 1, 1);
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
filter->connect(top_block);
|
||||||
|
boost::shared_ptr<gr::block> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||||
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
|
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||||
|
|
||||||
|
top_block->connect(source, 0, valve, 0);
|
||||||
|
top_block->connect(valve, 0, filter->get_left_block(), 0);
|
||||||
|
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||||
|
}) << "Failure connecting the top_block."<< std::endl;
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
}) << "Failure running the top_block." << std::endl;
|
||||||
|
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(NotchFilterTest, ConnectAndRunGrcomplex)
|
||||||
|
{
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
top_block = gr::make_top_block("Notch filter test");
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::shared_ptr<NotchFilter> filter = std::make_shared<NotchFilter>(config.get(), "InputFilter", 1, 1);
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config2 = std::make_shared<InMemoryConfiguration>();
|
||||||
|
|
||||||
|
config2->set_property("Test_Source.samples", std::to_string(nsamples));
|
||||||
|
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
||||||
|
std::string path = std::string(TEST_PATH);
|
||||||
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
|
config2->set_property("Test_Source.filename", filename);
|
||||||
|
config2->set_property("Test_Source.item_type", "gr_complex");
|
||||||
|
config2->set_property("Test_Source.repeat", "true");
|
||||||
|
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
filter->connect(top_block);
|
||||||
|
|
||||||
|
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||||
|
source->connect(top_block);
|
||||||
|
|
||||||
|
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||||
|
|
||||||
|
top_block->connect(source->get_right_block(), 0, filter->get_left_block(), 0);
|
||||||
|
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||||
|
}) << "Failure connecting the top_block."<< std::endl;
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
}) << "Failure running the top_block." << std::endl;
|
||||||
|
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
}
|
@ -0,0 +1,168 @@
|
|||||||
|
/*!
|
||||||
|
* \file pulse_blanking_filter_test.cc
|
||||||
|
* \brief Implements Unit Test for the PulseBlankingFilter class.
|
||||||
|
* \author Antonio Ramos, 2017. antonio.ramos(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <complex>
|
||||||
|
#include <iostream>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <gflags/gflags.h>
|
||||||
|
#include <gnuradio/top_block.h>
|
||||||
|
#include <gnuradio/analog/sig_source_waveform.h>
|
||||||
|
#include <gnuradio/analog/sig_source_c.h>
|
||||||
|
#include <gnuradio/msg_queue.h>
|
||||||
|
#include <gnuradio/blocks/null_sink.h>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include "gnss_block_factory.h"
|
||||||
|
#include "gnss_block_interface.h"
|
||||||
|
#include "in_memory_configuration.h"
|
||||||
|
#include "gnss_sdr_valve.h"
|
||||||
|
#include "pulse_blanking_filter.h"
|
||||||
|
#include "file_signal_source.h"
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_int32(pb_filter_test_nsamples, 1000000 , "Number of samples to filter in the tests (max: 2147483647)");
|
||||||
|
|
||||||
|
class PulseBlankingFilterTest: public ::testing::Test
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
PulseBlankingFilterTest()
|
||||||
|
{
|
||||||
|
queue = gr::msg_queue::make(0);
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
nsamples = FLAGS_pb_filter_test_nsamples;
|
||||||
|
}
|
||||||
|
~PulseBlankingFilterTest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void init();
|
||||||
|
void configure_gr_complex_gr_complex();
|
||||||
|
boost::shared_ptr<gr::msg_queue> queue;
|
||||||
|
gr::top_block_sptr top_block;
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
|
size_t item_size;
|
||||||
|
int nsamples;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void PulseBlankingFilterTest::init()
|
||||||
|
{
|
||||||
|
config->set_property("InputFilter.pfa", "0.04");
|
||||||
|
config->set_property("InputFilter.length", "32");
|
||||||
|
config->set_property("InputFilter.segments_est", "12500");
|
||||||
|
config->set_property("InputFilter.segments_reset", "5000000");
|
||||||
|
}
|
||||||
|
|
||||||
|
void PulseBlankingFilterTest::configure_gr_complex_gr_complex()
|
||||||
|
{
|
||||||
|
config->set_property("InputFilter.input_item_type", "gr_complex");
|
||||||
|
config->set_property("InputFilter.output_item_type", "gr_complex");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(PulseBlankingFilterTest, InstantiateGrComplexGrComplex)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::unique_ptr<PulseBlankingFilter> filter(new PulseBlankingFilter(config.get(), "InputFilter", 1, 1));
|
||||||
|
int res = 0;
|
||||||
|
if (filter) res = 1;
|
||||||
|
ASSERT_EQ(1, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(PulseBlankingFilterTest, ConnectAndRun)
|
||||||
|
{
|
||||||
|
int fs_in = 4000000;
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
top_block = gr::make_top_block("Pulse Blanking filter test");
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::shared_ptr<PulseBlankingFilter> filter = std::make_shared<PulseBlankingFilter>(config.get(), "InputFilter", 1, 1);
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
filter->connect(top_block);
|
||||||
|
boost::shared_ptr<gr::block> source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000.0, 1.0, gr_complex(0.0));
|
||||||
|
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||||
|
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||||
|
|
||||||
|
top_block->connect(source, 0, valve, 0);
|
||||||
|
top_block->connect(valve, 0, filter->get_left_block(), 0);
|
||||||
|
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||||
|
}) << "Failure connecting the top_block."<< std::endl;
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
}) << "Failure running the top_block." << std::endl;
|
||||||
|
std::cout << "Filtered " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST_F(PulseBlankingFilterTest, ConnectAndRunGrcomplex)
|
||||||
|
{
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
|
top_block = gr::make_top_block("Pulse Blanking filter test");
|
||||||
|
init();
|
||||||
|
configure_gr_complex_gr_complex();
|
||||||
|
std::shared_ptr<PulseBlankingFilter> filter = std::make_shared<PulseBlankingFilter>(config.get(), "InputFilter", 1, 1);
|
||||||
|
std::shared_ptr<InMemoryConfiguration> config2 = std::make_shared<InMemoryConfiguration>();
|
||||||
|
|
||||||
|
config2->set_property("Test_Source.samples", std::to_string(nsamples));
|
||||||
|
config2->set_property("Test_Source.sampling_frequency", "4000000");
|
||||||
|
std::string path = std::string(TEST_PATH);
|
||||||
|
std::string filename = path + "signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat";
|
||||||
|
config2->set_property("Test_Source.filename", filename);
|
||||||
|
config2->set_property("Test_Source.item_type", "gr_complex");
|
||||||
|
config2->set_property("Test_Source.repeat", "true");
|
||||||
|
|
||||||
|
item_size = sizeof(gr_complex);
|
||||||
|
ASSERT_NO_THROW( {
|
||||||
|
filter->connect(top_block);
|
||||||
|
|
||||||
|
boost::shared_ptr<FileSignalSource> source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue));
|
||||||
|
source->connect(top_block);
|
||||||
|
|
||||||
|
boost::shared_ptr<gr::block> null_sink = gr::blocks::null_sink::make(item_size);
|
||||||
|
|
||||||
|
top_block->connect(source->get_right_block(), 0, filter->get_left_block(), 0);
|
||||||
|
top_block->connect(filter->get_right_block(), 0, null_sink, 0);
|
||||||
|
}) << "Failure connecting the top_block."<< std::endl;
|
||||||
|
|
||||||
|
EXPECT_NO_THROW( {
|
||||||
|
start = std::chrono::system_clock::now();
|
||||||
|
top_block->run(); // Start threads and wait
|
||||||
|
end = std::chrono::system_clock::now();
|
||||||
|
elapsed_seconds = end - start;
|
||||||
|
}) << "Failure running the top_block." << std::endl;
|
||||||
|
std::cout << "Filtered " << nsamples << " gr_complex samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
}
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
|
|
||||||
set(SIGNAL_PROCESSING_TESTING_LIB_SOURCES
|
set(SIGNAL_PROCESSING_TESTING_LIB_SOURCES
|
||||||
|
acquisition_dump_reader.cc
|
||||||
tracking_dump_reader.cc
|
tracking_dump_reader.cc
|
||||||
tlm_dump_reader.cc
|
tlm_dump_reader.cc
|
||||||
observables_dump_reader.cc
|
observables_dump_reader.cc
|
||||||
|
@ -0,0 +1,106 @@
|
|||||||
|
/*!
|
||||||
|
* \file acquisition_dump_reader.cc
|
||||||
|
* \brief Helper file for unit testing
|
||||||
|
* \author Carles Fernandez-Prades, 2017. cfernandez(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <complex>
|
||||||
|
#include "acquisition_dump_reader.h"
|
||||||
|
|
||||||
|
bool acquisition_dump_reader::read_binary_acq()
|
||||||
|
{
|
||||||
|
std::complex<float>* aux = new std::complex<float>[1];
|
||||||
|
for(unsigned int i = 0; i < d_num_doppler_bins; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::ifstream ifs;
|
||||||
|
ifs.exceptions( std::ifstream::failbit | std::ifstream::badbit );
|
||||||
|
ifs.open(d_dump_filenames.at(i).c_str(), std::ios::in | std::ios::binary);
|
||||||
|
d_dump_files.at(i).swap(ifs);
|
||||||
|
if (d_dump_files.at(i).is_open())
|
||||||
|
{
|
||||||
|
for(unsigned int k = 0; k < d_samples_per_code; k++)
|
||||||
|
{
|
||||||
|
d_dump_files.at(i).read(reinterpret_cast<char *>(&aux[0]), sizeof(std::complex<float>));
|
||||||
|
mag.at(i).at(k) = std::abs(*aux) / std::pow(d_samples_per_code, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "File " << d_dump_filenames.at(i).c_str() << " not found." << std::endl;
|
||||||
|
delete[] aux;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
d_dump_files.at(i).close();
|
||||||
|
}
|
||||||
|
catch (const std::ifstream::failure &e)
|
||||||
|
{
|
||||||
|
std::cout << e.what() << std::endl;
|
||||||
|
delete[] aux;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete[] aux;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
acquisition_dump_reader::acquisition_dump_reader(const std::string & basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code)
|
||||||
|
{
|
||||||
|
d_basename = basename;
|
||||||
|
d_sat = sat;
|
||||||
|
d_doppler_max = doppler_max;
|
||||||
|
d_doppler_step = doppler_step;
|
||||||
|
d_samples_per_code = samples_per_code;
|
||||||
|
d_num_doppler_bins = static_cast<unsigned int>(ceil( static_cast<double>(static_cast<int>(d_doppler_max) - static_cast<int>(-d_doppler_max)) / static_cast<double>(d_doppler_step)));
|
||||||
|
std::vector<std::vector<float> > mag_aux(d_num_doppler_bins, std::vector<float>(d_samples_per_code));
|
||||||
|
mag = mag_aux;
|
||||||
|
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
|
||||||
|
{
|
||||||
|
doppler.push_back(-static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index);
|
||||||
|
d_dump_filenames.push_back(d_basename + "_sat_" + std::to_string(d_sat) + "_doppler_" + std::to_string(doppler.at(doppler_index)) + ".dat");
|
||||||
|
std::ifstream ifs;
|
||||||
|
d_dump_files.push_back(std::move(ifs));
|
||||||
|
}
|
||||||
|
for (unsigned int k = 0; k < d_samples_per_code; k++)
|
||||||
|
{
|
||||||
|
samples.push_back(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
acquisition_dump_reader::~acquisition_dump_reader()
|
||||||
|
{
|
||||||
|
for(unsigned int i = 0; i < d_num_doppler_bins; i++)
|
||||||
|
{
|
||||||
|
if (d_dump_files.at(i).is_open() == true)
|
||||||
|
{
|
||||||
|
d_dump_files.at(i).close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*!
|
||||||
|
* \file acquisition_dump_reader.h
|
||||||
|
* \brief Helper file for unit testing
|
||||||
|
* \author Carles Fernandez-Prades, 2017. cfernandez(at)cttc.es
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010-2017 (see AUTHORS file for a list of contributors)
|
||||||
|
*
|
||||||
|
* GNSS-SDR is a software defined Global Navigation
|
||||||
|
* Satellite Systems receiver
|
||||||
|
*
|
||||||
|
* This file is part of GNSS-SDR.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* -------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef GNSS_SDR_ACQUISITION_DUMP_READER_H
|
||||||
|
#define GNSS_SDR_ACQUISITION_DUMP_READER_H
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
class acquisition_dump_reader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
acquisition_dump_reader(const std::string & basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code);
|
||||||
|
~acquisition_dump_reader();
|
||||||
|
bool read_binary_acq();
|
||||||
|
|
||||||
|
std::vector<int> doppler;
|
||||||
|
std::vector<unsigned int> samples;
|
||||||
|
std::vector<std::vector<float> > mag;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string d_basename;
|
||||||
|
unsigned int d_sat;
|
||||||
|
unsigned int d_doppler_max;
|
||||||
|
unsigned int d_doppler_step;
|
||||||
|
unsigned int d_samples_per_code;
|
||||||
|
unsigned int d_num_doppler_bins;
|
||||||
|
std::vector<std::string> d_dump_filenames;
|
||||||
|
std::vector<std::ifstream> d_dump_files;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GNSS_SDR_ACQUISITION_DUMP_READER_H
|
@ -34,16 +34,16 @@ bool observables_dump_reader::read_binary_obs()
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for(int i = 0; i < n_channels; i++)
|
for(int i = 0; i < n_channels; i++)
|
||||||
{
|
{
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&RX_time[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&RX_time[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_s[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&TOW_at_current_symbol_s[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&Carrier_Doppler_hz[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&Carrier_Doppler_hz[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&Acc_carrier_phase_hz[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&Acc_carrier_phase_hz[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&Pseudorange_m[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&Pseudorange_m[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&PRN[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&valid[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&valid[i]), sizeof(double));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,8 @@
|
|||||||
|
|
||||||
bool tracking_dump_reader::read_binary_obs()
|
bool tracking_dump_reader::read_binary_obs()
|
||||||
{
|
{
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&abs_E), sizeof(float));
|
d_dump_file.read(reinterpret_cast<char *>(&abs_E), sizeof(float));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&abs_P), sizeof(float));
|
d_dump_file.read(reinterpret_cast<char *>(&abs_P), sizeof(float));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&abs_L), sizeof(float));
|
d_dump_file.read(reinterpret_cast<char *>(&abs_L), sizeof(float));
|
||||||
@ -54,7 +55,7 @@ bool tracking_dump_reader::read_binary_obs()
|
|||||||
d_dump_file.read(reinterpret_cast<char *>(&aux2), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&aux2), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&PRN), sizeof(unsigned int));
|
d_dump_file.read(reinterpret_cast<char *>(&PRN), sizeof(unsigned int));
|
||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ bool tracking_true_obs_reader::read_binary_obs()
|
|||||||
d_dump_file.read(reinterpret_cast<char *>(&prn_delay_chips), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&prn_delay_chips), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&tow), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&tow), sizeof(double));
|
||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -34,16 +34,16 @@ bool true_observables_reader::read_binary_obs()
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for(int i=0;i<12;i++)
|
for(int i = 0; i < 12; i++)
|
||||||
{
|
{
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&gps_time_sec[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&gps_time_sec[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&doppler_l1_hz), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&doppler_l1_hz), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&acc_carrier_phase_l1_cycles[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&acc_carrier_phase_l1_cycles[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&dist_m[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&dist_m[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&true_dist_m[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&true_dist_m[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&carrier_phase_l1_cycles[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&carrier_phase_l1_cycles[i]), sizeof(double));
|
||||||
d_dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(double));
|
d_dump_file.read(reinterpret_cast<char *>(&prn[i]), sizeof(double));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (const std::ifstream::failure &e)
|
catch (const std::ifstream::failure &e)
|
||||||
{
|
{
|
||||||
|
@ -379,9 +379,9 @@ void HybridObservablesTest::check_results_carrier_phase(
|
|||||||
ASSERT_LT(error_var_ch1, 1e-2);
|
ASSERT_LT(error_var_ch1, 1e-2);
|
||||||
ASSERT_LT(max_error_ch1, 5e-2);
|
ASSERT_LT(max_error_ch1, 5e-2);
|
||||||
ASSERT_GT(min_error_ch1, -5e-2);
|
ASSERT_GT(min_error_ch1, -5e-2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HybridObservablesTest::check_results_code_psudorange(
|
void HybridObservablesTest::check_results_code_psudorange(
|
||||||
arma::vec & true_ch0_dist_m,
|
arma::vec & true_ch0_dist_m,
|
||||||
arma::vec & true_ch1_dist_m,
|
arma::vec & true_ch1_dist_m,
|
||||||
@ -401,8 +401,6 @@ void HybridObservablesTest::check_results_code_psudorange(
|
|||||||
arma::vec delta_true_dist_m = true_ch0_dist_interp-true_ch1_dist_interp;
|
arma::vec delta_true_dist_m = true_ch0_dist_interp-true_ch1_dist_interp;
|
||||||
arma::vec delta_measured_dist_m = measuded_ch0_Pseudorange_m-measuded_ch1_Pseudorange_m;
|
arma::vec delta_measured_dist_m = measuded_ch0_Pseudorange_m-measuded_ch1_Pseudorange_m;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//2. RMSE
|
//2. RMSE
|
||||||
arma::vec err;
|
arma::vec err;
|
||||||
|
|
||||||
@ -467,7 +465,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
}) << "Failure opening true observables file" << std::endl;
|
}) << "Failure opening true observables file";
|
||||||
|
|
||||||
true_obs_file = std::string("./gps_l1_ca_obs_prn");
|
true_obs_file = std::string("./gps_l1_ca_obs_prn");
|
||||||
true_obs_file.append(std::to_string(test_satellite_PRN2));
|
true_obs_file.append(std::to_string(test_satellite_PRN2));
|
||||||
@ -477,7 +475,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
}) << "Failure opening true observables file" << std::endl;
|
}) << "Failure opening true observables file";
|
||||||
|
|
||||||
top_block = gr::make_top_block("Telemetry_Decoder test");
|
top_block = gr::make_top_block("Telemetry_Decoder test");
|
||||||
std::shared_ptr<TrackingInterface> tracking_ch0 = std::make_shared<GpsL1CaDllPllTracking>(config.get(), "Tracking_1C", 1, 1);
|
std::shared_ptr<TrackingInterface> tracking_ch0 = std::make_shared<GpsL1CaDllPllTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||||
@ -494,14 +492,14 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
})<< "Failure reading true observables file" << std::endl;
|
}) << "Failure reading true observables file";
|
||||||
|
|
||||||
ASSERT_NO_THROW({
|
ASSERT_NO_THROW({
|
||||||
if (true_obs_data_ch1.read_binary_obs() == false)
|
if (true_obs_data_ch1.read_binary_obs() == false)
|
||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
}) << "Failure reading true observables file" << std::endl;
|
}) << "Failure reading true observables file";
|
||||||
|
|
||||||
//restart the epoch counter
|
//restart the epoch counter
|
||||||
true_obs_data_ch0.restart();
|
true_obs_data_ch0.restart();
|
||||||
@ -529,7 +527,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
|
|
||||||
tlm_ch0->set_satellite(Gnss_Satellite(std::string("GPS"),gnss_synchro_ch0.PRN));
|
tlm_ch0->set_satellite(Gnss_Satellite(std::string("GPS"),gnss_synchro_ch0.PRN));
|
||||||
tlm_ch1->set_satellite(Gnss_Satellite(std::string("GPS"),gnss_synchro_ch1.PRN));
|
tlm_ch1->set_satellite(Gnss_Satellite(std::string("GPS"),gnss_synchro_ch1.PRN));
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
boost::shared_ptr<HybridObservablesTest_tlm_msg_rx> tlm_msg_rx_ch1 = HybridObservablesTest_tlm_msg_rx_make();
|
boost::shared_ptr<HybridObservablesTest_tlm_msg_rx> tlm_msg_rx_ch1 = HybridObservablesTest_tlm_msg_rx_make();
|
||||||
boost::shared_ptr<HybridObservablesTest_tlm_msg_rx> tlm_msg_rx_ch2 = HybridObservablesTest_tlm_msg_rx_make();
|
boost::shared_ptr<HybridObservablesTest_tlm_msg_rx> tlm_msg_rx_ch2 = HybridObservablesTest_tlm_msg_rx_make();
|
||||||
@ -540,17 +538,17 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking_ch0->set_channel(gnss_synchro_ch0.Channel_ID);
|
tracking_ch0->set_channel(gnss_synchro_ch0.Channel_ID);
|
||||||
tracking_ch1->set_channel(gnss_synchro_ch1.Channel_ID);
|
tracking_ch1->set_channel(gnss_synchro_ch1.Channel_ID);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking_ch0->set_gnss_synchro(&gnss_synchro_ch0);
|
tracking_ch0->set_gnss_synchro(&gnss_synchro_ch0);
|
||||||
tracking_ch1->set_gnss_synchro(&gnss_synchro_ch1);
|
tracking_ch1->set_gnss_synchro(&gnss_synchro_ch1);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking_ch0->connect(top_block);
|
tracking_ch0->connect(top_block);
|
||||||
tracking_ch1->connect(top_block);
|
tracking_ch1->connect(top_block);
|
||||||
}) << "Failure connecting tracking to the top_block." << std::endl;
|
}) << "Failure connecting tracking to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
std::string file = "./" + filename_raw_data;
|
std::string file = "./" + filename_raw_data;
|
||||||
@ -574,7 +572,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
top_block->connect(observables->get_right_block(), 0, sink_ch0, 0);
|
top_block->connect(observables->get_right_block(), 0, sink_ch0, 0);
|
||||||
top_block->connect(observables->get_right_block(), 1, sink_ch1, 0);
|
top_block->connect(observables->get_right_block(), 1, sink_ch1, 0);
|
||||||
|
|
||||||
}) << "Failure connecting the blocks." << std::endl;
|
}) << "Failure connecting the blocks.";
|
||||||
|
|
||||||
tracking_ch0->start_tracking();
|
tracking_ch0->start_tracking();
|
||||||
tracking_ch1->start_tracking();
|
tracking_ch1->start_tracking();
|
||||||
@ -584,7 +582,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
//check results
|
//check results
|
||||||
//load the true values
|
//load the true values
|
||||||
@ -596,7 +594,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
}) << "Failure opening true observables file" << std::endl;
|
}) << "Failure opening true observables file";
|
||||||
|
|
||||||
long int nepoch = true_observables.num_epochs();
|
long int nepoch = true_observables.num_epochs();
|
||||||
|
|
||||||
@ -637,7 +635,6 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
|
|
||||||
epoch_counter++;
|
epoch_counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//read measured values
|
//read measured values
|
||||||
@ -647,7 +644,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
}) << "Failure opening dump observables file" << std::endl;
|
}) << "Failure opening dump observables file";
|
||||||
|
|
||||||
nepoch = estimated_observables.num_epochs();
|
nepoch = estimated_observables.num_epochs();
|
||||||
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
||||||
|
@ -170,7 +170,6 @@ GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::~GpsL1CADllPllTelemetryDecoderTest
|
|||||||
|
|
||||||
class GpsL1CATelemetryDecoderTest: public ::testing::Test
|
class GpsL1CATelemetryDecoderTest: public ::testing::Test
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::string generator_binary;
|
std::string generator_binary;
|
||||||
std::string p1;
|
std::string p1;
|
||||||
@ -357,7 +356,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
}) << "Failure opening true observables file" << std::endl;
|
}) << "Failure opening true observables file";
|
||||||
|
|
||||||
top_block = gr::make_top_block("Telemetry_Decoder test");
|
top_block = gr::make_top_block("Telemetry_Decoder test");
|
||||||
std::shared_ptr<TrackingInterface> tracking = std::make_shared<GpsL1CaDllPllTracking>(config.get(), "Tracking_1C", 1, 1);
|
std::shared_ptr<TrackingInterface> tracking = std::make_shared<GpsL1CaDllPllTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||||
@ -371,7 +370,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
})<< "Failure reading true observables file" << std::endl;
|
}) << "Failure reading true observables file";
|
||||||
|
|
||||||
//restart the epoch counter
|
//restart the epoch counter
|
||||||
true_obs_data.restart();
|
true_obs_data.restart();
|
||||||
@ -388,15 +387,15 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
|||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_gnss_synchro(&gnss_synchro);
|
tracking->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->connect(top_block);
|
tracking->connect(top_block);
|
||||||
}) << "Failure connecting tracking to the top_block." << std::endl;
|
}) << "Failure connecting tracking to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
std::string file = "./" + filename_raw_data;
|
std::string file = "./" + filename_raw_data;
|
||||||
@ -409,7 +408,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
|||||||
top_block->connect(tracking->get_right_block(), 0, tlm->get_left_block(), 0);
|
top_block->connect(tracking->get_right_block(), 0, tlm->get_left_block(), 0);
|
||||||
top_block->connect(tlm->get_right_block(), 0, sink, 0);
|
top_block->connect(tlm->get_right_block(), 0, sink, 0);
|
||||||
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks." << std::endl;
|
}) << "Failure connecting the blocks.";
|
||||||
|
|
||||||
tracking->start_tracking();
|
tracking->start_tracking();
|
||||||
|
|
||||||
@ -418,7 +417,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
|||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
//check results
|
//check results
|
||||||
//load the true values
|
//load the true values
|
||||||
@ -449,7 +448,7 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
}) << "Failure opening telemetry dump file" << std::endl;
|
}) << "Failure opening telemetry dump file";
|
||||||
|
|
||||||
nepoch = tlm_dump.num_epochs();
|
nepoch = tlm_dump.num_epochs();
|
||||||
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
||||||
|
@ -87,21 +87,21 @@ void GalileoE1DllPllVemlTrackingInternalTest::init()
|
|||||||
gnss_synchro.PRN = 11;
|
gnss_synchro.PRN = 11;
|
||||||
|
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", "8000000");
|
config->set_property("GNSS-SDR.internal_fs_sps", "8000000");
|
||||||
config->set_property("Tracking_Galileo.item_type", "gr_complex");
|
config->set_property("Tracking_1B.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking");
|
||||||
config->set_property("Tracking_Galileo.dump", "false");
|
config->set_property("Tracking_1B.item_type", "gr_complex");
|
||||||
config->set_property("Tracking_Galileo.dump_filename", "../data/veml_tracking_ch_");
|
config->set_property("Tracking_1B.dump", "false");
|
||||||
config->set_property("Tracking_Galileo.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking");
|
config->set_property("Tracking_1B.dump_filename", "../data/veml_tracking_ch_");
|
||||||
config->set_property("Tracking_Galileo.early_late_space_chips", "0.15");
|
config->set_property("Tracking_1B.early_late_space_chips", "0.15");
|
||||||
config->set_property("Tracking_Galileo.very_early_late_space_chips", "0.6");
|
config->set_property("Tracking_1B.very_early_late_space_chips", "0.6");
|
||||||
config->set_property("Tracking_Galileo.pll_bw_hz", "30.0");
|
config->set_property("Tracking_1B.pll_bw_hz", "30.0");
|
||||||
config->set_property("Tracking_Galileo.dll_bw_hz", "2.0");
|
config->set_property("Tracking_1B.dll_bw_hz", "2.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate)
|
TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
auto tracking = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
|
auto tracking = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
|
||||||
EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str());
|
EXPECT_STREQ("Galileo_E1_DLL_PLL_VEML_Tracking", tracking->implementation().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,16 +117,16 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun)
|
|||||||
top_block = gr::make_top_block("Tracking test");
|
top_block = gr::make_top_block("Tracking test");
|
||||||
|
|
||||||
// Example using smart pointers and the block factory
|
// Example using smart pointers and the block factory
|
||||||
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
|
||||||
std::shared_ptr<GalileoE1DllPllVemlTracking> tracking = std::dynamic_pointer_cast<GalileoE1DllPllVemlTracking>(trk_);
|
std::shared_ptr<GalileoE1DllPllVemlTracking> tracking = std::dynamic_pointer_cast<GalileoE1DllPllVemlTracking>(trk_);
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_gnss_synchro(&gnss_synchro);
|
tracking->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->connect(top_block);
|
tracking->connect(top_block);
|
||||||
@ -136,8 +136,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
||||||
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||||
|
}) << "Failure connecting the blocks of tracking test.";
|
||||||
}) << "Failure connecting the blocks of tracking test." << std::endl;
|
|
||||||
|
|
||||||
tracking->start_tracking();
|
tracking->start_tracking();
|
||||||
|
|
||||||
@ -146,7 +145,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun)
|
|||||||
top_block->run(); //Start threads and wait
|
top_block->run(); //Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
@ -165,7 +164,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
|||||||
top_block = gr::make_top_block("Tracking test");
|
top_block = gr::make_top_block("Tracking test");
|
||||||
|
|
||||||
// Example using smart pointers and the block factory
|
// Example using smart pointers and the block factory
|
||||||
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking_1B", "Galileo_E1_DLL_PLL_VEML_Tracking", 1, 1);
|
||||||
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
|
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
|
||||||
|
|
||||||
// gnss_synchro.Acq_delay_samples = 1753; // 4 Msps
|
// gnss_synchro.Acq_delay_samples = 1753; // 4 Msps
|
||||||
@ -176,15 +175,15 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
|||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_gnss_synchro(&gnss_synchro);
|
tracking->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->connect(top_block);
|
tracking->connect(top_block);
|
||||||
}) << "Failure connecting tracking to the top_block." << std::endl;
|
}) << "Failure connecting tracking to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
std::string path = std::string(TEST_PATH);
|
std::string path = std::string(TEST_PATH);
|
||||||
@ -198,7 +197,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
|||||||
top_block->connect(skip_head, 0, valve, 0);
|
top_block->connect(skip_head, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
||||||
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||||
}) << "Failure connecting the blocks of tracking test." << std::endl;
|
}) << "Failure connecting the blocks of tracking test.";
|
||||||
|
|
||||||
tracking->start_tracking();
|
tracking->start_tracking();
|
||||||
|
|
||||||
@ -207,7 +206,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ValidationOfResults)
|
|||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Tracked " << num_samples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Tracked " << num_samples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -81,22 +81,22 @@ void GalileoE5aTrackingTest::init()
|
|||||||
{
|
{
|
||||||
gnss_synchro.Channel_ID = 0;
|
gnss_synchro.Channel_ID = 0;
|
||||||
gnss_synchro.System = 'E';
|
gnss_synchro.System = 'E';
|
||||||
std::string signal = "5Q";
|
std::string signal = "5X";
|
||||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||||
gnss_synchro.PRN = 11;
|
gnss_synchro.PRN = 11;
|
||||||
|
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", "32000000");
|
config->set_property("GNSS-SDR.internal_fs_sps", "32000000");
|
||||||
config->set_property("Tracking_Galileo.item_type", "gr_complex");
|
config->set_property("Tracking_5X.implementation", "Galileo_E5a_DLL_PLL_Tracking");
|
||||||
config->set_property("Tracking_Galileo.dump", "false");
|
config->set_property("Tracking_5X.item_type", "gr_complex");
|
||||||
config->set_property("Tracking_Galileo.dump_filename", "../data/e5a_tracking_ch_");
|
config->set_property("Tracking_5X.dump", "false");
|
||||||
config->set_property("Tracking_Galileo.implementation", "Galileo_E5a_DLL_PLL_Tracking");
|
config->set_property("Tracking_5X.dump_filename", "../data/e5a_tracking_ch_");
|
||||||
config->set_property("Tracking_Galileo.early_late_space_chips", "0.5");
|
config->set_property("Tracking_5X.early_late_space_chips", "0.5");
|
||||||
config->set_property("Tracking_Galileo.order", "2");
|
config->set_property("Tracking_5X.order", "2");
|
||||||
config->set_property("Tracking_Galileo.pll_bw_hz_init","20.0");
|
config->set_property("Tracking_5X.pll_bw_hz_init","20.0");
|
||||||
config->set_property("Tracking_Galileo.pll_bw_hz", "5");
|
config->set_property("Tracking_5X.pll_bw_hz", "5");
|
||||||
config->set_property("Tracking_Galileo.dll_bw_hz_init","2.0");
|
config->set_property("Tracking_5X.dll_bw_hz_init","2.0");
|
||||||
config->set_property("Tracking_Galileo.dll_bw_hz", "2");
|
config->set_property("Tracking_5X.dll_bw_hz", "2");
|
||||||
config->set_property("Tracking_Galileo.ti_ms", "1");
|
config->set_property("Tracking_5X.ti_ms", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -105,13 +105,13 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
|
|||||||
std::chrono::time_point<std::chrono::system_clock> start, end;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
std::chrono::duration<double> elapsed_seconds(0);
|
std::chrono::duration<double> elapsed_seconds(0);
|
||||||
int fs_in = 32000000;
|
int fs_in = 32000000;
|
||||||
int nsamples = 32000000*5;
|
int nsamples = 32000000 * 5;
|
||||||
init();
|
init();
|
||||||
queue = gr::msg_queue::make(0);
|
queue = gr::msg_queue::make(0);
|
||||||
top_block = gr::make_top_block("Tracking test");
|
top_block = gr::make_top_block("Tracking test");
|
||||||
|
|
||||||
// Example using smart pointers and the block factory
|
// Example using smart pointers and the block factory
|
||||||
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking", "Galileo_E5a_DLL_PLL_Tracking", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking_5X", "Galileo_E5a_DLL_PLL_Tracking", 1, 1);
|
||||||
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
|
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);
|
||||||
|
|
||||||
//REAL
|
//REAL
|
||||||
@ -123,15 +123,15 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
|
|||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_gnss_synchro(&gnss_synchro);
|
tracking->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->connect(top_block);
|
tracking->connect(top_block);
|
||||||
}) << "Failure connecting tracking to the top_block." << std::endl;
|
}) << "Failure connecting tracking to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||||
@ -140,8 +140,7 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
|
|||||||
top_block->connect(source, 0, valve, 0);
|
top_block->connect(source, 0, valve, 0);
|
||||||
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
top_block->connect(valve, 0, tracking->get_left_block(), 0);
|
||||||
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||||
|
}) << "Failure connecting the blocks of tracking test.";
|
||||||
}) << "Failure connecting the blocks of tracking test." << std::endl;
|
|
||||||
|
|
||||||
tracking->start_tracking();
|
tracking->start_tracking();
|
||||||
|
|
||||||
@ -150,7 +149,7 @@ TEST_F(GalileoE5aTrackingTest, ValidationOfResults)
|
|||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
}) << "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
std::cout << "Tracked " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -30,10 +30,12 @@
|
|||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <vector>
|
||||||
#include <armadillo>
|
#include <armadillo>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
#include <gnuradio/top_block.h>
|
#include <gnuradio/top_block.h>
|
||||||
#include <gnuradio/blocks/file_source.h>
|
#include <gnuradio/blocks/file_source.h>
|
||||||
#include <gnuradio/analog/sig_source_waveform.h>
|
#include <gnuradio/analog/sig_source_waveform.h>
|
||||||
@ -44,15 +46,15 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "GPS_L1_CA.h"
|
#include "GPS_L1_CA.h"
|
||||||
#include "gnss_block_factory.h"
|
#include "gnss_block_factory.h"
|
||||||
#include "gnss_block_interface.h"
|
|
||||||
#include "tracking_interface.h"
|
#include "tracking_interface.h"
|
||||||
#include "in_memory_configuration.h"
|
#include "in_memory_configuration.h"
|
||||||
#include "gnss_synchro.h"
|
|
||||||
//#include "gps_l1_ca_dll_pll_tracking.h"
|
|
||||||
#include "gps_l1_ca_dll_pll_c_aid_tracking.h"
|
|
||||||
#include "tracking_true_obs_reader.h"
|
#include "tracking_true_obs_reader.h"
|
||||||
#include "tracking_dump_reader.h"
|
#include "tracking_dump_reader.h"
|
||||||
#include "signal_generator_flags.h"
|
#include "signal_generator_flags.h"
|
||||||
|
#include "gnuplot_i.h"
|
||||||
|
#include "test_flags.h"
|
||||||
|
|
||||||
|
DEFINE_bool(plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot");
|
||||||
|
|
||||||
|
|
||||||
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||||
@ -97,7 +99,7 @@ void GpsL1CADllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
|||||||
|
|
||||||
|
|
||||||
GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() :
|
GpsL1CADllPllTrackingTest_msg_rx::GpsL1CADllPllTrackingTest_msg_rx() :
|
||||||
gr::block("GpsL1CADllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
gr::block("GpsL1CADllPllTrackingTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||||
{
|
{
|
||||||
this->message_port_register_in(pmt::mp("events"));
|
this->message_port_register_in(pmt::mp("events"));
|
||||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CADllPllTrackingTest_msg_rx::msg_handler_events, this, _1));
|
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CADllPllTrackingTest_msg_rx::msg_handler_events, this, _1));
|
||||||
@ -121,6 +123,8 @@ public:
|
|||||||
std::string p4;
|
std::string p4;
|
||||||
std::string p5;
|
std::string p5;
|
||||||
|
|
||||||
|
std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; //"GPS_L1_CA_DLL_PLL_C_Aid_Tracking";
|
||||||
|
|
||||||
const int baseband_sampling_freq = FLAGS_fs_gen_sps;
|
const int baseband_sampling_freq = FLAGS_fs_gen_sps;
|
||||||
|
|
||||||
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
|
std::string filename_rinex_obs = FLAGS_filename_rinex_obs;
|
||||||
@ -216,14 +220,14 @@ void GpsL1CADllPllTrackingTest::configure_receiver()
|
|||||||
|
|
||||||
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq));
|
config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq));
|
||||||
// Set Tracking
|
// Set Tracking
|
||||||
config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking");
|
config->set_property("Tracking_1C.implementation", implementation);
|
||||||
config->set_property("Tracking_1C.item_type", "gr_complex");
|
config->set_property("Tracking_1C.item_type", "gr_complex");
|
||||||
config->set_property("Tracking_1C.if", "0");
|
config->set_property("Tracking_1C.pll_bw_hz", "20.0");
|
||||||
config->set_property("Tracking_1C.dump", "true");
|
|
||||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
|
||||||
config->set_property("Tracking_1C.pll_bw_hz", "30.0");
|
|
||||||
config->set_property("Tracking_1C.dll_bw_hz", "2.0");
|
config->set_property("Tracking_1C.dll_bw_hz", "2.0");
|
||||||
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
||||||
|
config->set_property("Tracking_1C.extend_correlation_ms", "1");
|
||||||
|
config->set_property("Tracking_1C.dump", "true");
|
||||||
|
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -232,8 +236,7 @@ void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec & true_time_s,
|
|||||||
arma::vec & meas_time_s,
|
arma::vec & meas_time_s,
|
||||||
arma::vec & meas_value)
|
arma::vec & meas_value)
|
||||||
{
|
{
|
||||||
//1. True value interpolation to match the measurement times
|
// 1. True value interpolation to match the measurement times
|
||||||
|
|
||||||
arma::vec true_value_interp;
|
arma::vec true_value_interp;
|
||||||
arma::uvec true_time_s_valid = find(true_time_s > 0);
|
arma::uvec true_time_s_valid = find(true_time_s > 0);
|
||||||
true_time_s = true_time_s(true_time_s_valid);
|
true_time_s = true_time_s(true_time_s_valid);
|
||||||
@ -244,26 +247,26 @@ void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec & true_time_s,
|
|||||||
|
|
||||||
arma::interp1(true_time_s, true_value, meas_time_s, true_value_interp);
|
arma::interp1(true_time_s, true_value, meas_time_s, true_value_interp);
|
||||||
|
|
||||||
//2. RMSE
|
// 2. RMSE
|
||||||
arma::vec err;
|
arma::vec err;
|
||||||
|
|
||||||
err = meas_value - true_value_interp;
|
err = meas_value - true_value_interp;
|
||||||
arma::vec err2 = arma::square(err);
|
arma::vec err2 = arma::square(err);
|
||||||
double rmse = sqrt(arma::mean(err2));
|
double rmse = sqrt(arma::mean(err2));
|
||||||
|
|
||||||
//3. Mean err and variance
|
// 3. Mean err and variance
|
||||||
double error_mean = arma::mean(err);
|
double error_mean = arma::mean(err);
|
||||||
double error_var = arma::var(err);
|
double error_var = arma::var(err);
|
||||||
|
|
||||||
// 5. Peaks
|
// 4. Peaks
|
||||||
double max_error = arma::max(err);
|
double max_error = arma::max(err);
|
||||||
double min_error = arma::min(err);
|
double min_error = arma::min(err);
|
||||||
|
|
||||||
//5. report
|
// 5. report
|
||||||
std::streamsize ss = std::cout.precision();
|
std::streamsize ss = std::cout.precision();
|
||||||
std::cout << std::setprecision(10) << "TRK Doppler RMSE=" << rmse
|
std::cout << std::setprecision(10) << "TRK Doppler RMSE=" << rmse
|
||||||
<< ", mean=" << error_mean
|
<< ", mean=" << error_mean
|
||||||
<< ", stdev="<< sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Hz]" << std::endl;
|
<< ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Hz]" << std::endl;
|
||||||
std::cout.precision (ss);
|
std::cout.precision (ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,7 +276,7 @@ void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec & true
|
|||||||
arma::vec & meas_time_s,
|
arma::vec & meas_time_s,
|
||||||
arma::vec & meas_value)
|
arma::vec & meas_value)
|
||||||
{
|
{
|
||||||
//1. True value interpolation to match the measurement times
|
// 1. True value interpolation to match the measurement times
|
||||||
arma::vec true_value_interp;
|
arma::vec true_value_interp;
|
||||||
arma::uvec true_time_s_valid = find(true_time_s > 0);
|
arma::uvec true_time_s_valid = find(true_time_s > 0);
|
||||||
true_time_s = true_time_s(true_time_s_valid);
|
true_time_s = true_time_s(true_time_s_valid);
|
||||||
@ -284,13 +287,13 @@ void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec & true
|
|||||||
|
|
||||||
arma::interp1(true_time_s, true_value, meas_time_s, true_value_interp);
|
arma::interp1(true_time_s, true_value, meas_time_s, true_value_interp);
|
||||||
|
|
||||||
//2. RMSE
|
// 2. RMSE
|
||||||
arma::vec err;
|
arma::vec err;
|
||||||
err = meas_value - true_value_interp;
|
err = meas_value - true_value_interp;
|
||||||
arma::vec err2 = arma::square(err);
|
arma::vec err2 = arma::square(err);
|
||||||
double rmse = sqrt(arma::mean(err2));
|
double rmse = sqrt(arma::mean(err2));
|
||||||
|
|
||||||
//3. Mean err and variance
|
// 3. Mean err and variance
|
||||||
double error_mean = arma::mean(err);
|
double error_mean = arma::mean(err);
|
||||||
double error_var = arma::var(err);
|
double error_var = arma::var(err);
|
||||||
|
|
||||||
@ -298,7 +301,7 @@ void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec & true
|
|||||||
double max_error = arma::max(err);
|
double max_error = arma::max(err);
|
||||||
double min_error = arma::min(err);
|
double min_error = arma::min(err);
|
||||||
|
|
||||||
//5. report
|
// 5. report
|
||||||
std::streamsize ss = std::cout.precision();
|
std::streamsize ss = std::cout.precision();
|
||||||
std::cout << std::setprecision(10) << "TRK acc carrier phase RMSE=" << rmse
|
std::cout << std::setprecision(10) << "TRK acc carrier phase RMSE=" << rmse
|
||||||
<< ", mean=" << error_mean
|
<< ", mean=" << error_mean
|
||||||
@ -312,7 +315,7 @@ void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec & true_time_s,
|
|||||||
arma::vec & meas_time_s,
|
arma::vec & meas_time_s,
|
||||||
arma::vec & meas_value)
|
arma::vec & meas_value)
|
||||||
{
|
{
|
||||||
//1. True value interpolation to match the measurement times
|
// 1. True value interpolation to match the measurement times
|
||||||
arma::vec true_value_interp;
|
arma::vec true_value_interp;
|
||||||
arma::uvec true_time_s_valid = find(true_time_s > 0);
|
arma::uvec true_time_s_valid = find(true_time_s > 0);
|
||||||
true_time_s = true_time_s(true_time_s_valid);
|
true_time_s = true_time_s(true_time_s_valid);
|
||||||
@ -323,14 +326,14 @@ void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec & true_time_s,
|
|||||||
|
|
||||||
arma::interp1(true_time_s, true_value, meas_time_s, true_value_interp);
|
arma::interp1(true_time_s, true_value, meas_time_s, true_value_interp);
|
||||||
|
|
||||||
//2. RMSE
|
// 2. RMSE
|
||||||
arma::vec err;
|
arma::vec err;
|
||||||
|
|
||||||
err = meas_value - true_value_interp;
|
err = meas_value - true_value_interp;
|
||||||
arma::vec err2 = arma::square(err);
|
arma::vec err2 = arma::square(err);
|
||||||
double rmse = sqrt(arma::mean(err2));
|
double rmse = sqrt(arma::mean(err2));
|
||||||
|
|
||||||
//3. Mean err and variance
|
// 3. Mean err and variance
|
||||||
double error_mean = arma::mean(err);
|
double error_mean = arma::mean(err);
|
||||||
double error_var = arma::var(err);
|
double error_var = arma::var(err);
|
||||||
|
|
||||||
@ -338,7 +341,7 @@ void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec & true_time_s,
|
|||||||
double max_error = arma::max(err);
|
double max_error = arma::max(err);
|
||||||
double min_error = arma::min(err);
|
double min_error = arma::min(err);
|
||||||
|
|
||||||
//5. report
|
// 5. report
|
||||||
std::streamsize ss = std::cout.precision();
|
std::streamsize ss = std::cout.precision();
|
||||||
std::cout << std::setprecision(10) << "TRK code phase RMSE=" << rmse
|
std::cout << std::setprecision(10) << "TRK code phase RMSE=" << rmse
|
||||||
<< ", mean=" << error_mean
|
<< ", mean=" << error_mean
|
||||||
@ -358,41 +361,33 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
generate_signal();
|
generate_signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct timeval tv;
|
std::chrono::time_point<std::chrono::system_clock> start, end;
|
||||||
long long int begin = 0;
|
|
||||||
long long int end = 0;
|
|
||||||
|
|
||||||
configure_receiver();
|
configure_receiver();
|
||||||
|
|
||||||
//open true observables log file written by the simulator
|
// open true observables log file written by the simulator
|
||||||
tracking_true_obs_reader true_obs_data;
|
tracking_true_obs_reader true_obs_data;
|
||||||
int test_satellite_PRN = FLAGS_test_satellite_PRN;
|
int test_satellite_PRN = FLAGS_test_satellite_PRN;
|
||||||
std::cout << "Testing satellite PRN=" << test_satellite_PRN << std::endl;
|
std::cout << "Testing satellite PRN=" << test_satellite_PRN << std::endl;
|
||||||
std::string true_obs_file = std::string("./gps_l1_ca_obs_prn");
|
std::string true_obs_file = std::string("./gps_l1_ca_obs_prn");
|
||||||
true_obs_file.append(std::to_string(test_satellite_PRN));
|
true_obs_file.append(std::to_string(test_satellite_PRN));
|
||||||
true_obs_file.append(".dat");
|
true_obs_file.append(".dat");
|
||||||
ASSERT_NO_THROW({
|
ASSERT_EQ(true_obs_data.open_obs_file(true_obs_file), true) << "Failure opening true observables file";
|
||||||
if (true_obs_data.open_obs_file(true_obs_file) == false)
|
|
||||||
{
|
|
||||||
throw std::exception();
|
|
||||||
};
|
|
||||||
}) << "Failure opening true observables file" << std::endl;
|
|
||||||
|
|
||||||
top_block = gr::make_top_block("Tracking test");
|
top_block = gr::make_top_block("Tracking test");
|
||||||
//std::shared_ptr<TrackingInterface> tracking = std::make_shared<GpsL1CaDllPllTracking>(config.get(), "Tracking_1C", 1, 1);
|
|
||||||
std::shared_ptr<TrackingInterface> tracking = std::make_shared<GpsL1CaDllPllCAidTracking>(config.get(), "Tracking_1C", 1, 1);
|
std::shared_ptr<GNSSBlockInterface> trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1);
|
||||||
|
std::shared_ptr<TrackingInterface> tracking = std::dynamic_pointer_cast<TrackingInterface>(trk_);//std::make_shared<GpsL1CaDllPllCAidTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||||
|
|
||||||
boost::shared_ptr<GpsL1CADllPllTrackingTest_msg_rx> msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make();
|
boost::shared_ptr<GpsL1CADllPllTrackingTest_msg_rx> msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make();
|
||||||
|
|
||||||
// load acquisition data based on the first epoch of the true observations
|
// load acquisition data based on the first epoch of the true observations
|
||||||
ASSERT_NO_THROW({
|
ASSERT_EQ(true_obs_data.read_binary_obs(), true)
|
||||||
if (true_obs_data.read_binary_obs() == false)
|
<< "Failure reading true tracking dump file." << std::endl
|
||||||
{
|
<< "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) +
|
||||||
throw std::exception();
|
" is not available?";
|
||||||
};
|
|
||||||
}) << "Failure reading true observables file" << std::endl;
|
|
||||||
|
|
||||||
//restart the epoch counter
|
// restart the epoch counter
|
||||||
true_obs_data.restart();
|
true_obs_data.restart();
|
||||||
|
|
||||||
std::cout << "Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << std::endl;
|
std::cout << "Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << std::endl;
|
||||||
@ -402,15 +397,15 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||||
}) << "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->set_gnss_synchro(&gnss_synchro);
|
tracking->set_gnss_synchro(&gnss_synchro);
|
||||||
}) << "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
tracking->connect(top_block);
|
tracking->connect(top_block);
|
||||||
}) << "Failure connecting tracking to the top_block." << std::endl;
|
}) << "Failure connecting tracking to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW( {
|
ASSERT_NO_THROW( {
|
||||||
std::string file = "./" + filename_raw_data;
|
std::string file = "./" + filename_raw_data;
|
||||||
@ -422,20 +417,18 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 0);
|
top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 0);
|
||||||
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||||
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
}) << "Failure connecting the blocks of tracking test." << std::endl;
|
}) << "Failure connecting the blocks of tracking test.";
|
||||||
|
|
||||||
tracking->start_tracking();
|
tracking->start_tracking();
|
||||||
|
|
||||||
EXPECT_NO_THROW( {
|
EXPECT_NO_THROW( {
|
||||||
gettimeofday(&tv, NULL);
|
start = std::chrono::system_clock::now();
|
||||||
begin = tv.tv_sec * 1000000 + tv.tv_usec;
|
|
||||||
top_block->run(); // Start threads and wait
|
top_block->run(); // Start threads and wait
|
||||||
gettimeofday(&tv, NULL);
|
end = std::chrono::system_clock::now();
|
||||||
end = tv.tv_sec * 1000000 + tv.tv_usec;
|
}) << "Failure running the top_block.";
|
||||||
}) << "Failure running the top_block." << std::endl;
|
|
||||||
|
|
||||||
//check results
|
// check results
|
||||||
//load the true values
|
// load the true values
|
||||||
long int nepoch = true_obs_data.num_epochs();
|
long int nepoch = true_obs_data.num_epochs();
|
||||||
std::cout << "True observation epochs=" << nepoch << std::endl;
|
std::cout << "True observation epochs=" << nepoch << std::endl;
|
||||||
|
|
||||||
@ -458,13 +451,9 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
|
|
||||||
//load the measured values
|
//load the measured values
|
||||||
tracking_dump_reader trk_dump;
|
tracking_dump_reader trk_dump;
|
||||||
ASSERT_NO_THROW({
|
|
||||||
if (trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")) == false)
|
ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true)
|
||||||
{
|
<< "Failure opening tracking dump file";
|
||||||
|
|
||||||
throw std::exception();
|
|
||||||
};
|
|
||||||
}) << "Failure opening tracking dump file" << std::endl;
|
|
||||||
|
|
||||||
nepoch = trk_dump.num_epochs();
|
nepoch = trk_dump.num_epochs();
|
||||||
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
||||||
@ -473,7 +462,13 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
arma::vec trk_acc_carrier_phase_cycles = arma::zeros(nepoch, 1);
|
arma::vec trk_acc_carrier_phase_cycles = arma::zeros(nepoch, 1);
|
||||||
arma::vec trk_Doppler_Hz = arma::zeros(nepoch, 1);
|
arma::vec trk_Doppler_Hz = arma::zeros(nepoch, 1);
|
||||||
arma::vec trk_prn_delay_chips = arma::zeros(nepoch, 1);
|
arma::vec trk_prn_delay_chips = arma::zeros(nepoch, 1);
|
||||||
|
|
||||||
|
std::vector<double> prompt;
|
||||||
|
std::vector<double> early;
|
||||||
|
std::vector<double> late;
|
||||||
|
std::vector<double> promptI;
|
||||||
|
std::vector<double> promptQ;
|
||||||
|
|
||||||
epoch_counter = 0;
|
epoch_counter = 0;
|
||||||
while(trk_dump.read_binary_obs())
|
while(trk_dump.read_binary_obs())
|
||||||
{
|
{
|
||||||
@ -486,9 +481,14 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
|
|
||||||
trk_prn_delay_chips(epoch_counter) = delay_chips;
|
trk_prn_delay_chips(epoch_counter) = delay_chips;
|
||||||
epoch_counter++;
|
epoch_counter++;
|
||||||
|
prompt.push_back(trk_dump.abs_P);
|
||||||
|
early.push_back(trk_dump.abs_E);
|
||||||
|
late.push_back(trk_dump.abs_L);
|
||||||
|
promptI.push_back(trk_dump.prompt_I);
|
||||||
|
promptQ.push_back(trk_dump.prompt_Q);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Align initial measurements and cut the tracking pull-in transitory
|
// Align initial measurements and cut the tracking pull-in transitory
|
||||||
double pull_in_offset_s = 1.0;
|
double pull_in_offset_s = 1.0;
|
||||||
arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first");
|
arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first");
|
||||||
|
|
||||||
@ -501,6 +501,64 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
|
|||||||
check_results_codephase(true_timestamp_s, true_prn_delay_chips, trk_timestamp_s, trk_prn_delay_chips);
|
check_results_codephase(true_timestamp_s, true_prn_delay_chips, trk_timestamp_s, trk_prn_delay_chips);
|
||||||
check_results_acc_carrier_phase(true_timestamp_s, true_acc_carrier_phase_cycles, trk_timestamp_s, trk_acc_carrier_phase_cycles);
|
check_results_acc_carrier_phase(true_timestamp_s, true_acc_carrier_phase_cycles, trk_timestamp_s, trk_acc_carrier_phase_cycles);
|
||||||
|
|
||||||
std::cout << "Signal tracking completed in " << (end - begin) << " microseconds" << std::endl;
|
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||||
}
|
std::cout << "Signal tracking completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl;
|
||||||
|
|
||||||
|
if(FLAGS_plot_gps_l1_tracking_test == true)
|
||||||
|
{
|
||||||
|
const std::string gnuplot_executable(FLAGS_gnuplot_executable);
|
||||||
|
if(gnuplot_executable.empty())
|
||||||
|
{
|
||||||
|
std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE," << std::endl;
|
||||||
|
std::cout << "gnuplot has not been found in your system." << std::endl;
|
||||||
|
std::cout << "Test results will not be plotted." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boost::filesystem::path p(gnuplot_executable);
|
||||||
|
boost::filesystem::path dir = p.parent_path();
|
||||||
|
std::string gnuplot_path = dir.native();
|
||||||
|
Gnuplot::set_GNUPlotPath(gnuplot_path);
|
||||||
|
|
||||||
|
std::vector<double> timevec;
|
||||||
|
double t = 0.0;
|
||||||
|
for (auto it = prompt.begin(); it != prompt.end(); it++)
|
||||||
|
{
|
||||||
|
timevec.push_back(t);
|
||||||
|
t = t + GPS_L1_CA_CODE_PERIOD;
|
||||||
|
}
|
||||||
|
Gnuplot g1("linespoints");
|
||||||
|
g1.set_title("GPS L1 C/A signal tracking correlators' output (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
|
g1.set_grid();
|
||||||
|
g1.set_xlabel("Time [s]");
|
||||||
|
g1.set_ylabel("Correlators' output");
|
||||||
|
g1.cmd("set key box opaque");
|
||||||
|
unsigned int decimate = static_cast<unsigned int>(FLAGS_plot_decimate);
|
||||||
|
g1.plot_xy( timevec, prompt, "Prompt", decimate);
|
||||||
|
g1.plot_xy( timevec, early, "Early", decimate);
|
||||||
|
g1.plot_xy( timevec, late, "Late", decimate);
|
||||||
|
g1.savetops("Correlators_outputs");
|
||||||
|
g1.savetopdf("Correlators_outputs", 18);
|
||||||
|
g1.showonscreen(); // window output
|
||||||
|
|
||||||
|
Gnuplot g2("points");
|
||||||
|
g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")");
|
||||||
|
g2.set_grid();
|
||||||
|
g2.set_xlabel("Inphase");
|
||||||
|
g2.set_ylabel("Quadrature");
|
||||||
|
g2.cmd("set size ratio -1");
|
||||||
|
g2.plot_xy( promptI, promptQ);
|
||||||
|
g2.savetops("Constellation");
|
||||||
|
g2.savetopdf("Constellation", 18);
|
||||||
|
g2.showonscreen(); // window output
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (const GnuplotException & ge)
|
||||||
|
{
|
||||||
|
std::cout << ge.what() << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -465,7 +465,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
})<< "Failure opening true observables file" << std::endl;
|
}) << "Failure opening true observables file";
|
||||||
|
|
||||||
top_block = gr::make_top_block("Tracking test");
|
top_block = gr::make_top_block("Tracking test");
|
||||||
std::shared_ptr<GpsL1CaDllPllCAidTrackingFpga> tracking = std::make_shared<GpsL1CaDllPllCAidTrackingFpga> (config.get(), "Tracking_1C", 1, 1);
|
std::shared_ptr<GpsL1CaDllPllCAidTrackingFpga> tracking = std::make_shared<GpsL1CaDllPllCAidTrackingFpga> (config.get(), "Tracking_1C", 1, 1);
|
||||||
@ -479,7 +479,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
})<< "Failure reading true observables file" << std::endl;
|
}) << "Failure reading true observables file";
|
||||||
|
|
||||||
//restart the epoch counter
|
//restart the epoch counter
|
||||||
true_obs_data.restart();
|
true_obs_data.restart();
|
||||||
@ -497,24 +497,24 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
|||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||||
})<< "Failure setting channel." << std::endl;
|
}) << "Failure setting channel.";
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
tracking->set_gnss_synchro(&gnss_synchro);
|
tracking->set_gnss_synchro(&gnss_synchro);
|
||||||
})<< "Failure setting gnss_synchro." << std::endl;
|
}) << "Failure setting gnss_synchro.";
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
tracking->connect(top_block);
|
tracking->connect(top_block);
|
||||||
})<< "Failure connecting tracking to the top_block." << std::endl;
|
}) << "Failure connecting tracking to the top_block.";
|
||||||
|
|
||||||
ASSERT_NO_THROW(
|
ASSERT_NO_THROW(
|
||||||
{
|
{
|
||||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||||
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||||
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||||
})<< "Failure connecting the blocks of tracking test." << std::endl;
|
}) << "Failure connecting the blocks of tracking test.";
|
||||||
|
|
||||||
tracking->start_tracking();
|
tracking->start_tracking();
|
||||||
|
|
||||||
@ -533,7 +533,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
|||||||
tracking->reset();// unlock the channel
|
tracking->reset();// unlock the channel
|
||||||
end = std::chrono::system_clock::now();
|
end = std::chrono::system_clock::now();
|
||||||
elapsed_seconds = end - start;
|
elapsed_seconds = end - start;
|
||||||
})<< "Failure running the top_block." << std::endl;
|
}) << "Failure running the top_block.";
|
||||||
|
|
||||||
// wait until child thread terminates
|
// wait until child thread terminates
|
||||||
t.join();
|
t.join();
|
||||||
@ -568,7 +568,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga)
|
|||||||
{
|
{
|
||||||
throw std::exception();
|
throw std::exception();
|
||||||
};
|
};
|
||||||
})<< "Failure opening tracking dump file" << std::endl;
|
}) << "Failure opening tracking dump file";
|
||||||
|
|
||||||
nepoch = trk_dump.num_epochs();
|
nepoch = trk_dump.num_epochs();
|
||||||
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
std::cout << "Measured observation epochs=" << nepoch << std::endl;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user