diff --git a/CMakeLists.txt b/CMakeLists.txt index f9a035feb..11d3db749 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -408,8 +408,8 @@ set(GNSSSDR_MATIO_MIN_VERSION "1.5.3") # Versions to download and build (but not installed) if not found ################################################################################ set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") -set(GNSSSDR_GLOG_LOCAL_VERSION "0.3.5") -set(GNSSSDR_ARMADILLO_LOCAL_VERSION "9.200.x") +set(GNSSSDR_GLOG_LOCAL_VERSION "0.4.0") +set(GNSSSDR_ARMADILLO_LOCAL_VERSION "9.300.x") set(GNSSSDR_GTEST_LOCAL_VERSION "1.8.1") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GPSTK_LOCAL_VERSION "2.10.6") @@ -510,6 +510,7 @@ else() endif() + ################################################################################ # Check if the compiler defines the architecture as ARM ################################################################################ @@ -1331,14 +1332,33 @@ endif() # Check that BLAS (Basic Linear Algebra Subprograms) is found in the system # See http://www.netlib.org/blas/ ################################################################################ -find_library(BLAS blas) -if(NOT BLAS) +if(OS_IS_MACOSX) + # Avoid using the implementation that comes with the Accelerate framework + include(AvoidAccelerate) +else() + if(NOT BLA_VENDOR) + set(BLA_VENDOR "Generic") + endif() + find_package(BLAS) + set_package_properties(BLAS PROPERTIES + URL "http://www.netlib.org/blas/" + DESCRIPTION "Basic Linear Algebra Subprograms" + PURPOSE "Used for matrix algebra computations." + TYPE REQUIRED + ) +endif() +if(NOT BLAS_FOUND) message(" The BLAS library has not been found.") message(" You can try to install it by typing:") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(" sudo yum install blas-devel") + if(OS_IS_MACOSX) + message(" 'sudo port install lapack' if you are using Macports, or") + message(" 'brew install lapack' if you are using Homebrew.") else() - message(" sudo apt-get install libblas-dev") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(" sudo yum install blas-devel") + else() + message(" sudo apt-get install libblas-dev") + endif() endif() message(FATAL_ERROR "BLAS is required to build gnss-sdr") endif() @@ -1349,8 +1369,16 @@ endif() # Check that LAPACK (Linear Algebra PACKage) is found in the system # See http://www.netlib.org/lapack/ ################################################################################ -find_library(LAPACK lapack) -if(NOT LAPACK) +if(NOT OS_IS_MACOSX) + find_package(LAPACK) + set_package_properties(LAPACK PROPERTIES + URL "http://www.netlib.org/lapack/" + DESCRIPTION "Linear Algebra PACKage" + PURPOSE "Used for matrix algebra computations." + TYPE REQUIRED + ) +endif() +if(NOT LAPACK_FOUND) message(" The LAPACK library has not been found.") message(" You can try to install it by typing:") if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") @@ -1457,7 +1485,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) if(NOT GFORTRAN) set(GFORTRAN "") endif() - set(ARMADILLO_LIBRARIES ${BLAS} ${LAPACK} ${GFORTRAN} ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}) + set(ARMADILLO_LIBRARIES ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${GFORTRAN} ${binary_dir}/${CMAKE_FIND_LIBRARY_PREFIXES}armadillo${CMAKE_STATIC_LIBRARY_SUFFIX}) set(LOCAL_ARMADILLO true CACHE STRING "Armadillo downloaded and built automatically" FORCE) set(ARMADILLO_VERSION_STRING ${armadillo_RELEASE}) file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE}/include) @@ -1518,7 +1546,13 @@ find_library(GNUTLS_OPENSSL_LIBRARY NAMES gnutls-openssl libgnutls-openssl.so.27 /usr/lib/sh4-linux-gnu ) if(NOT GNUTLS_OPENSSL_LIBRARY) - message(STATUS "Looking for OpenSSL instead...") + if(GnuTLS_FOUND) + message(STATUS " But it was not built with openssl compatibility.") + endif() + message(STATUS " Looking for OpenSSL instead...") + if(OS_IS_MACOSX) + set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) # Trick for Homebrew + endif() find_package(OpenSSL) set_package_properties(OpenSSL PROPERTIES URL "https://www.openssl.org" @@ -1540,11 +1574,12 @@ if(NOT GNUTLS_OPENSSL_LIBRARY) if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") message(" sudo yum install openssl-devel") else() - message(" sudo apt-get install libgnutls-openssl-dev") + message(" sudo apt-get install libgnutls28-dev") endif() endif() if(OS_IS_MACOSX) - message(" sudo port install gnutls") + message(" 'sudo port install gnutls', if you are using Macports, or") + message(" 'brew install openssl', if you are using Homebrew.") endif() message(FATAL_ERROR "GnuTLS libraries with openssl compatibility are required to build gnss-sdr") endif() @@ -2199,10 +2234,12 @@ endif() configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake - @ONLY) + @ONLY +) add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake +) diff --git a/README.md b/README.md index 4e6e0b11c..3f9d5c33a 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ This section describes how to set up the compilation environment in GNU/Linux or GNU/Linux ---------- - * Tested distributions: Ubuntu 14.04 LTS and above; Debian 8.0 "jessie" and above; Fedora 26 and above; CentOS 7; Arch Linux. + * Tested distributions: Ubuntu 14.04 LTS and above; Debian 8.0 "jessie" and above; Arch Linux; CentOS 7; Fedora 26 and above; OpenSUSE 42.3 and above. * Supported microprocessor architectures: * i386: Intel x86 instruction set (32-bit microprocessors). * amd64: also known as x86-64, the 64-bit version of the x86 instruction set, originally created by AMD and implemented by AMD, Intel, VIA and others. @@ -79,21 +79,19 @@ Please note that the required files from `libgtest-dev` were moved to `googletes Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux). +#### Arch Linux -#### Fedora - -If you are using Fedora 26 or above, the required software dependencies can be installed by doing: +If you are using Arch Linux: ~~~~~~ -$ sudo yum install make automake gcc gcc-c++ kernel-devel cmake git boost-devel \ - boost-date-time boost-system boost-filesystem boost-thread boost-chrono \ - boost-serialization log4cpp-devel gnuradio-devel gr-osmosdr-devel \ - blas-devel lapack-devel matio-devel armadillo-devel gflags-devel \ - glog-devel openssl-devel libpcap-devel python-mako python-six pugixml-devel +$ pacman -S gcc make cmake git boost boost-libs log4cpp libvolk gnuradio \ + gnuradio-osmosdr blas lapack gflags google-glog openssl pugixml \ + python-mako python-six libmatio libpcap gtest ~~~~~~ Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux). + #### CentOS If you are using CentOS 7, you can install the dependencies via Extra Packages for Enterprise Linux ([EPEL](https://fedoraproject.org/wiki/EPEL)): @@ -111,18 +109,39 @@ $ sudo yum install make automake gcc gcc-c++ kernel-devel libtool \ Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux). -#### Arch Linux -If you are using Arch Linux: +#### Fedora + +If you are using Fedora 26 or above, the required software dependencies can be installed by doing: ~~~~~~ -$ pacman -S gcc make cmake git boost boost-libs log4cpp libvolk gnuradio \ - gnuradio-osmosdr blas lapack gflags google-glog openssl pugixml \ - python-mako python-six libmatio libpcap gtest +$ sudo yum install make automake gcc gcc-c++ kernel-devel cmake git boost-devel \ + boost-date-time boost-system boost-filesystem boost-thread boost-chrono \ + boost-serialization log4cpp-devel gnuradio-devel gr-osmosdr-devel \ + blas-devel lapack-devel matio-devel armadillo-devel gflags-devel \ + glog-devel openssl-devel libpcap-devel python-mako python-six pugixml-devel ~~~~~~ Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux). + +#### openSUSE + +If you are using openSUSE Leap: + +~~~~~~ +zypper install cmake git gcc-c++ boost-devel libboost_atomic-devel \ + libboost_system-devel libboost_filesystem-devel libboost_date_time-devel \ + libboost_thread-devel libboost_chrono-devel libboost_serialization-devel \ + log4cpp-devel gtest gnuradio-devel pugixml-devel libpcap-devel \ + armadillo-devel libtool automake hdf5-devel libopenssl-devel python-Mako \ + python-six +~~~~~~ + +Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#download-and-build-linux). + + + ### Alternative 2: Install dependencies using PyBOMBS This option is adequate if you are interested in development, in working with the most recent versions of software dependencies, want more fine tuning on the installed versions, or simply in building everything from the scratch just for the fun of it. In such cases, we recommend to use [PyBOMBS](https://github.com/gnuradio/pybombs "Python Build Overlay Managed Bundle System") (Python Build Overlay Managed Bundle System), GNU Radio's meta-package manager tool that installs software from source, or whatever the local package manager is, that automatically does all the work for you. Please take a look at the configuration options and general PyBOMBS usage at https://github.com/gnuradio/pybombs. Here we provide a quick step-by-step tutorial. @@ -190,9 +209,9 @@ $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/Linux $ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE $ sudo pacman -S blas lapack # For Arch Linux -$ wget https://sourceforge.net/projects/arma/files/armadillo-9.200.7.tar.xz -$ tar xvfz armadillo-9.200.7.tar.xz -$ cd armadillo-9.200.7 +$ wget https://sourceforge.net/projects/arma/files/armadillo-9.300.2.tar.xz +$ tar xvfz armadillo-9.300.2.tar.xz +$ cd armadillo-9.300.2 $ cmake . $ make $ sudo make install @@ -219,9 +238,10 @@ $ sudo ldconfig #### Install [Glog](https://github.com/google/glog "Glog's Homepage"), a library that implements application-level logging: ~~~~~~ -$ wget https://github.com/google/glog/archive/v0.3.5.tar.gz -$ tar xvfz v0.3.5.tar.gz -$ cd glog-0.3.5 +$ wget https://github.com/google/glog/archive/v0.4.0.tar.gz +$ tar xvfz v0.4.0.tar.gz +$ cd glog-0.4.0 +$ ./autogen.sh $ ./configure $ make $ sudo make install @@ -307,14 +327,14 @@ $ cd gnss-sdr/build Configure and build the application: ~~~~~~ -$ cmake ../ +$ cmake .. $ make ~~~~~~ By default, CMake will build the Release version, meaning that the compiler will generate a fast, optimized executable. This is the recommended build type when using an RF front-end and you need to attain real time. If working with a file (and thus without real-time constraints), you may want to obtain more information about the internals of the receiver, as well as more fine-grained logging. This can be done by building the Debug version, by doing: ~~~~~~ -$ cmake -DCMAKE_BUILD_TYPE=Debug ../ +$ cmake -DCMAKE_BUILD_TYPE=Debug .. $ make ~~~~~~ @@ -372,7 +392,7 @@ Install the GNU Radio module: ~~~~~~ $ git clone https://github.com/gnss-sdr/gr-gn3s $ cd gr-gn3s/build -$ cmake ../ +$ cmake .. $ make $ sudo make install $ sudo ldconfig @@ -382,7 +402,7 @@ Then configure GNSS-SDR to build the `GN3S_Signal_Source` by: ~~~~~~ $ cd gnss-sdr/build -$ cmake -DENABLE_GN3S=ON ../ +$ cmake -DENABLE_GN3S=ON .. $ make $ sudo make install ~~~~~~ @@ -405,16 +425,16 @@ $ git clone git://git.osmocom.org/osmo-sdr.git $ cd osmo-sdr/software/libosmosdr $ mkdir build $ cd build/ -$ cmake ../ +$ cmake .. $ make $ sudo make install $ sudo ldconfig -$ cd ../../ +$ cd ../.. $ git clone git://git.osmocom.org/gr-osmosdr $ cd gr-osmosdr $ mkdir build $ cd build -$ cmake ../ -Wno-dev +$ cmake .. -Wno-dev $ make $ sudo make install $ sudo ldconfig @@ -424,7 +444,7 @@ $ sudo ldconfig Then, configure GNSS-SDR to build the `Osmosdr_Signal_Source` by: ~~~~~~ -$ cmake -DENABLE_OSMOSDR=ON ../ +$ cmake -DENABLE_OSMOSDR=ON .. $ make $ sudo make install ~~~~~~ @@ -464,14 +484,14 @@ Then configure GNSS-SDR to build the `Fmcomms2_Signal_Source` implementation: ~~~~~~ $ cd gnss-sdr/build -$ cmake -DENABLE_FMCOMMS2=ON ../ +$ cmake -DENABLE_FMCOMMS2=ON .. $ make $ sudo make install ~~~~~~ or configure it to build `Plutosdr_Signal_Source`: ~~~~~~ -$ cmake -DENABLE_PLUTOSDR=ON ../ +$ cmake -DENABLE_PLUTOSDR=ON .. $ make $ sudo make install ~~~~~~ @@ -483,7 +503,7 @@ With `Fmcomms2_Signal_Source` you can use any SDR hardware based on [FMCOMMS2](h In order to enable the building of blocks that use OpenCL, type: ~~~~~~ -$ cmake -DENABLE_OPENCL=ON ../ +$ cmake -DENABLE_OPENCL=ON .. $ make $ sudo make install ~~~~~~ @@ -494,7 +514,7 @@ $ sudo make install In order to enable the building of blocks that use CUDA, NVIDIA's parallel programming model that enables graphics processing unit (GPU) acceleration for data-parallel computations, first you need to install the CUDA Toolkit from [NVIDIA Developers Download page](https://developer.nvidia.com/cuda-downloads "CUDA Downloads"). Make sure that the SDK samples build well. Then, build GNSS-SDR by doing: ~~~~~~ -$ cmake -DENABLE_CUDA=ON ../ +$ cmake -DENABLE_CUDA=ON .. $ make $ sudo make install ~~~~~~ @@ -507,7 +527,7 @@ Of course, you will also need a GPU that [supports CUDA](https://developer.nvidi In order to build an executable that not depends on the specific SIMD instruction set that is present in the processor of the compiling machine, so other users can execute it in other machines without those particular sets, use: ~~~~~~ -$ cmake -DENABLE_GENERIC_ARCH=ON ../ +$ cmake -DENABLE_GENERIC_ARCH=ON .. $ make $ sudo make install ~~~~~~ @@ -543,15 +563,16 @@ In a terminal, type: ~~~~~~ $ sudo port selfupdate $ sudo port upgrade outdated -$ sudo port install doxygen +docs $ sudo port install gnuradio +$ sudo port install lapack $ sudo port install armadillo $ sudo port install gnutls $ sudo port install google-glog +gflags -$ sudo port install py27-mako -$ sudo port install py27-six $ sudo port install matio $ sudo port install pugixml +$ sudo port install py27-mako +$ sudo port install py27-six +$ sudo port install doxygen +docs ~~~~~~ You also might need to activate a Python installation. The list of installed versions can be retrieved with: @@ -586,23 +607,20 @@ Install the required dependencies: ~~~~~~ $ brew install cmake -$ brew install hdf5 arpack superlu armadillo -$ brew install glog gflags +$ brew install hdf5 +$ brew install lapack +$ brew install armadillo +$ brew install gflags +$ brew install glog $ brew install gnuradio $ brew install libmatio $ brew install log4cpp +$ brew install openssl $ brew install pugixml $ pip install mako $ pip install six -$ brew install openssl ~~~~~~ -In the last step, Homebrew installs OpenSSL but it does not link it to `/usr/local`. Thus, you must manually link it instead: - -~~~~~~ -$ ln -s /usr/local/opt/openssl/include/openssl /usr/local/include -$ ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/ -~~~~~~ #### Build GNSS-SDR @@ -612,7 +630,7 @@ Finally, you are ready to clone the GNSS-SDR repository, configure and build the ~~~~~~ $ git clone https://github.com/gnss-sdr/gnss-sdr $ cd gnss-sdr/build -$ cmake ../ +$ cmake .. $ make ~~~~~~ @@ -643,18 +661,18 @@ GNSS-SDR comes with a library which is a module of the Vector-Optimized Library GNU Radio and other dependencies can also be installed using other package managers than Macports, such as [Fink](http://www.finkproject.org/ "Fink") or [Homebrew](https://brew.sh/ "Homebrew"). Since the version of Python that ships with OS X is great for learning but it is not good for development, you could have another Python executable in a non-standard location. If that is the case, you need to inform GNSS-SDR's configuration system by defining the `PYTHON_EXECUTABLE` variable as: ~~~~~~ -cmake -DPYTHON_EXECUTABLE=/path/to/bin/python ../ +cmake -DPYTHON_EXECUTABLE=/path/to/bin/python .. ~~~~~~ In case you have installed Macports in a non-standard location, you can use: ~~~~~~ -$ cmake -DCMAKE_PREFIX_PATH=/opt/local -DUSE_MACPORTS_PYTHON=/opt/local/bin/python ../ +$ cmake -DCMAKE_PREFIX_PATH=/opt/local -DUSE_MACPORTS_PYTHON=/opt/local/bin/python .. ~~~~~~ changing ```/opt/local``` by the base directory in which your software is installed. -The CMake script will create Makefiles that download, build and link Armadillo, Gflags, Glog and Google Test on the fly at compile time if they are not detected in your machine. +The CMake script will create Makefiles that download, build and link Armadillo, Gflags, Glog, Matio, PugiXML and Google Test on the fly at compile time if they are not detected in your machine. Other builds diff --git a/cmake/Modules/AvoidAccelerate.cmake b/cmake/Modules/AvoidAccelerate.cmake new file mode 100644 index 000000000..ab6e54cde --- /dev/null +++ b/cmake/Modules/AvoidAccelerate.cmake @@ -0,0 +1,58 @@ +# Copyright (C) 2011-2019 (see AUTHORS file for a list of contributors) +# +# This file is part of GNSS-SDR. +# +# GNSS-SDR is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GNSS-SDR is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNSS-SDR. If not, see . + +# Avoid using the BLAS and LAPACK implementations that comes with the Accelerate +# framework, which causes a bug when the BeiDou constellation is enabled + +find_library(BLAS_LIBRARIES + libblas.dylib + PATHS + /opt/local/lib/lapack + /usr/local/opt/lapack/lib + /usr/local/lib + ${BLAS_ROOT}/lib + $ENV{BLAS_ROOT}/lib + NO_DEFAULT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH +) + +if(BLAS_LIBRARIES) + set(BLAS_FOUND TRUE) +endif() + + +find_library(LAPACK_LIBRARIES + liblapack.dylib + PATHS + /opt/local/lib/lapack + /usr/local/opt/lapack/lib + /usr/local/lib + ${BLAS_ROOT}/lib + $ENV{BLAS_ROOT}/lib + NO_DEFAULT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_ENVIRONMENT_PATH + NO_SYSTEM_ENVIRONMENT_PATH + NO_CMAKE_SYSTEM_PATH +) + +if(LAPACK_LIBRARIES) + set(LAPACK_FOUND TRUE) +endif() diff --git a/conf/gnss-sdr_BDS_B1I_byte.conf b/conf/gnss-sdr_BDS_B1I_byte.conf index ce522bca0..15e86537d 100644 --- a/conf/gnss-sdr_BDS_B1I_byte.conf +++ b/conf/gnss-sdr_BDS_B1I_byte.conf @@ -47,6 +47,8 @@ InputFilter.filter_type=bandpass InputFilter.grid_density=16 InputFilter.sampling_frequency=25000000 InputFilter.IF=6250000 +InputFilter.dump = false +InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat Resampler.implementation=Pass_Through Resampler.sample_freq_in=25000000 Resampler.sample_freq_out=25000000 @@ -77,7 +79,7 @@ Acquisition_B1.threshold=0.0038 ;Acquisition_B1.pfa=0.0000001; Acquisition_B1.doppler_max=10000 Acquisition_B1.doppler_step=100 -Acquisition_B1.dump=false +Acquisition_B1.dump=true Acquisition_B1.dump_filename=./bds_acq Acquisition_B1.blocking=false; Acquisition_B1.use_CFAR_algorithm=true; @@ -89,7 +91,7 @@ Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking Tracking_B1.item_type=gr_complex Tracking_B1.pll_bw_hz=25.0; Tracking_B1.dll_bw_hz=2.50; -Tracking_B1.dump=false; +Tracking_B1.dump=true; Tracking_B1.dump_filename=./epl_tracking_ch_ diff --git a/conf/gnss-sdr_BDS_B3I_byte.conf b/conf/gnss-sdr_BDS_B3I_byte.conf index 45eb7df3a..2c3180779 100644 --- a/conf/gnss-sdr_BDS_B3I_byte.conf +++ b/conf/gnss-sdr_BDS_B3I_byte.conf @@ -23,6 +23,7 @@ SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false SignalSource.enable_throttle_control=false +;SignalSource.samples=200000 ;######### SIGNAL_CONDITIONER CONFIG ############ SignalConditioner.implementation=Signal_Conditioner @@ -47,6 +48,8 @@ InputFilter.filter_type=bandpass InputFilter.grid_density=16 InputFilter.sampling_frequency=50000000 InputFilter.IF=12500000 +InputFilter.dump = false +InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat Resampler.implementation=Pass_Through Resampler.sample_freq_in=50000000 Resampler.sample_freq_out=50000000 @@ -55,7 +58,7 @@ Resampler.item_type=gr_complex ;######### CHANNELS GLOBAL CONFIG ############ Channels_B3.count=10 -Channels.in_acquisition=10 +Channels.in_acquisition=1 Channel.signal=B3 Channel0.satellite = 6; @@ -74,7 +77,7 @@ Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition Acquisition_B3.item_type=gr_complex Acquisition_B3.coherent_integration_time_ms=3 Acquisition_B3.max_dwells = 2 -Acquisition_B3.threshold=0.0004 +Acquisition_B3.threshold=0.0005 Acquisition_B3.doppler_max=10000 Acquisition_B3.doppler_step=100 Acquisition_B3.dump=false diff --git a/docs/changelog b/docs/changelog index 549c049c3..849d5518d 100644 --- a/docs/changelog +++ b/docs/changelog @@ -8,10 +8,18 @@ ### Improvements in Efficiency -- Improved preamble detection implementation in the decoding of navigation messages (acceleration by x1.6 on average). +- Improved preamble detection implementation in the decoding of navigation messages (acceleration by x1.6 on average per channel). +- Shortened Acquisition to Tracking transition time. - Applied clang-tidy checks and fixes related to performance: performance-faster-string-find, performance-inefficient-algorithm, performance-move-const-arg, performance-type-promotion-in-math-fn, performance-unnecessary-copy-initialization, performance-unnecessary-value-param, readability-string-compare. +### Improvements in Flexibility: + +- New Tracking parameters allow the configuration of PLL and DLL filters order. +- Added parameter to enable FLL during pull-in time. +- Configurable pull-in time in the Tracking loops. + + ### Improvements in Interoperability: - Added the BeiDou B1I receiver chain. @@ -30,7 +38,8 @@ ### Improvements in Portability: - Added interfaces for FPGA off-loading. -- CMake scripts now follow a modern approach (targets and properties) but still work in 2.8.12 +- CMake scripts now follow a modern approach (targets and properties) but still work with 2.8.12. +- Improvements for macOS users using Homebrew. ### Improvements in Reliability diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 7b58f31ae..54ca099a5 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -366,10 +366,10 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, // Display time in local time zone d_show_local_time_zone = conf_.show_local_time_zone; - time_t when = std::time(nullptr); - auto const tm = *std::localtime(&when); std::ostringstream os; #ifdef HAS_PUT_TIME + time_t when = std::time(nullptr); + auto const tm = *std::localtime(&when); os << std::put_time(&tm, "%z"); #endif std::string utc_diff_str = os.str(); // in ISO 8601 format: "+HHMM" or "-HHMM" diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 792fe004a..eb7c9c6bd 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -892,6 +892,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ if ((valid_obs + glo_valid_obs) > 3) { int result = 0; + int sat = 0; nav_t nav_data; nav_data.eph = eph_data; nav_data.geph = geph_data; @@ -903,6 +904,15 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ i[0] = SPEED_OF_LIGHT / FREQ1; // L1/E1 i[1] = SPEED_OF_LIGHT / FREQ2; // L2 i[2] = SPEED_OF_LIGHT / FREQ5; // L5/E5 + + // Keep update on sat number + sat++; + if (sat > NSYSGPS + NSYSGLO + NSYSGAL + NSYSQZS and sat < NSYSGPS + NSYSGLO + NSYSGAL + NSYSQZS + NSYSBDS) + { + i[0] = SPEED_OF_LIGHT / FREQ1_BDS; // B1I + i[1] = SPEED_OF_LIGHT / FREQ3_BDS; // B3I + i[2] = SPEED_OF_LIGHT / FREQ5; // L5/E5 + } } result = rtkpos(&rtk_, obs_data, valid_obs + glo_valid_obs, &nav_data); diff --git a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc index 168209193..b5423c471 100644 --- a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc @@ -26,7 +26,7 @@ * 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 . + * along with GNSS-SDR. If not, see . * * ------------------------------------------------------------------------- */ @@ -57,7 +57,6 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition( DLOG(INFO) << "role " << role; item_type_ = configuration_->property(role + ".item_type", default_item_type); - int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; diff --git a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h index 6822659cf..05965a97f 100644 --- a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.h @@ -93,7 +93,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -102,7 +102,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h index 2562d2790..93f65a89d 100644 --- a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.h @@ -92,7 +92,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -101,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h index 35044840b..265bf9701 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h @@ -87,7 +87,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -96,7 +96,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h index 897336965..ea2d18b27 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -91,7 +91,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -100,7 +100,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 191279974..898ba8d62 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -64,6 +64,9 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); int64_t fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false); + DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; + float downsampling_factor = configuration_->property(role + ".downsampling_factor", 4.0); acq_parameters.downsampling_factor = downsampling_factor; @@ -163,7 +166,6 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 14); acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); - DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")"; channel_ = 0; doppler_step_ = 0; @@ -274,5 +276,5 @@ gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisitionFpga::get_left_block() gr::basic_block_sptr GalileoE1PcpsAmbiguousAcquisitionFpga::get_right_block() { - return acquisition_fpga_; + return nullptr; } diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index 543c55248..8683d5556 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -33,10 +33,7 @@ #define GNSS_SDR_GALILEO_E1_PCPS_AMBIGUOUS_ACQUISITION_FPGA_H_ #include "channel_fsm.h" -#include "complex_byte_to_float_x2.h" #include "pcps_acquisition_fpga.h" -#include -#include #include // for basic_block_sptr, top_block_sptr #include // for lv_16sc_t #include // for size_t @@ -93,7 +90,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_fpga_->set_channel(channel_); @@ -102,11 +99,12 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); } + /*! * \brief Set statistics threshold of PCPS algorithm */ @@ -157,9 +155,6 @@ public: private: ConfigurationInterface* configuration_; pcps_acquisition_fpga_sptr acquisition_fpga_; - gr::blocks::stream_to_vector::sptr stream_to_vector_; - gr::blocks::float_to_complex::sptr float_to_complex_; - complex_byte_to_float_x2_sptr cbyte_to_float_x2_; bool acquire_pilot_; uint32_t channel_; std::shared_ptr channel_fsm_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h index 561b6055e..46957d533 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h @@ -87,7 +87,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -96,7 +96,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h index 017ebf295..b29b808a8 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h @@ -88,7 +88,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h index 8618c606f..0893f731c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h @@ -87,7 +87,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -96,7 +96,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h index cdd1504c4..6d709894f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h @@ -88,7 +88,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h index 4ea234cf5..b3c43d542 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.h @@ -79,7 +79,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -88,7 +88,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 5c79068ed..0b8e0c815 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -61,6 +61,9 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); int64_t fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false); + DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; + float downsampling_factor = configuration_->property(role + ".downsampling_factor", 1.0); acq_parameters.downsampling_factor = downsampling_factor; fs_in = fs_in / downsampling_factor; @@ -164,7 +167,6 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 14); acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); - DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")"; channel_ = 0; doppler_step_ = 0; @@ -274,5 +276,5 @@ gr::basic_block_sptr GalileoE5aPcpsAcquisitionFpga::get_left_block() gr::basic_block_sptr GalileoE5aPcpsAcquisitionFpga::get_right_block() { - return acquisition_fpga_; + return nullptr; } diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index ff9e9a126..62c186503 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -35,7 +35,6 @@ #include "channel_fsm.h" #include "pcps_acquisition_fpga.h" -#include #include // for basic_block_sptr, top_block_sptr #include // for lv_16sc_t #include // for size_t @@ -89,10 +88,11 @@ public: * tracking blocks */ void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) override; + /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_fpga_->set_channel(channel_); @@ -101,11 +101,12 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); } + /*! * \brief Set statistics threshold of PCPS algorithm */ @@ -166,7 +167,6 @@ public: private: ConfigurationInterface* configuration_; pcps_acquisition_fpga_sptr acquisition_fpga_; - gr::blocks::stream_to_vector::sptr stream_to_vector_; std::string item_type_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h index 9f3e4497f..91229faa8 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h @@ -89,7 +89,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -98,7 +98,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h index 95bfde06c..a063d0532 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h @@ -89,7 +89,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -98,7 +98,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h index 727c0a81c..ab2ed82d7 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -95,7 +95,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -104,7 +104,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h index 33bd36c0f..2b7daf80e 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h @@ -88,7 +88,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 2505180f0..ff300ea57 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -68,6 +68,9 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); int64_t fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false); + DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; + float downsampling_factor = configuration_->property(role + ".downsampling_factor", 4.0); acq_parameters.downsampling_factor = downsampling_factor; @@ -146,7 +149,6 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 14); acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); - DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")"; channel_ = 0; doppler_step_ = 0; @@ -257,5 +259,5 @@ gr::basic_block_sptr GpsL1CaPcpsAcquisitionFpga::get_left_block() gr::basic_block_sptr GpsL1CaPcpsAcquisitionFpga::get_right_block() { - return acquisition_fpga_; + return nullptr; } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index e92e3a41c..6204354b2 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -93,7 +93,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_fpga_->set_channel(channel_); @@ -102,11 +102,12 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); } + /*! * \brief Set statistics threshold of PCPS algorithm */ diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h index 24d22f4a5..13560238e 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h @@ -88,7 +88,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h index e5c8b11b9..29da366a6 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h @@ -87,7 +87,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -96,7 +96,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h index b5de94a96..fadd57f73 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h @@ -89,7 +89,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -98,7 +98,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h index c158b0c9a..5fac3c436 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h @@ -88,7 +88,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_cc_->set_channel(channel_); @@ -97,7 +97,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_cc_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h index a3398ae63..1c7c591bb 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h @@ -92,7 +92,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -101,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index cc08b8bb2..6dcb7e224 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -70,6 +70,9 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; + acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false); + DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; + doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; @@ -139,13 +142,11 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( delete[] fft_codes_padded; acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); - DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")"; channel_ = 0; doppler_step_ = 0; gnss_synchro_ = nullptr; channel_fsm_ = nullptr; - DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")"; threshold_ = 0.0; } @@ -253,5 +254,5 @@ gr::basic_block_sptr GpsL2MPcpsAcquisitionFpga::get_left_block() gr::basic_block_sptr GpsL2MPcpsAcquisitionFpga::get_right_block() { - return acquisition_fpga_; + return nullptr; } diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index 08bf8a9fb..495a613e5 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -35,10 +35,7 @@ #define GNSS_SDR_GPS_L2_M_PCPS_ACQUISITION_FPGA_H_ #include "channel_fsm.h" -#include "complex_byte_to_float_x2.h" #include "pcps_acquisition_fpga.h" -#include -#include #include // for basic_block_sptr, top_block_sptr #include // for lv_16sc_t #include // for size_t @@ -94,7 +91,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_fpga_->set_channel(channel_); @@ -103,11 +100,12 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); } + /*! * \brief Set statistics threshold of PCPS algorithm */ @@ -158,9 +156,6 @@ public: private: ConfigurationInterface* configuration_; pcps_acquisition_fpga_sptr acquisition_fpga_; - gr::blocks::stream_to_vector::sptr stream_to_vector_; - gr::blocks::float_to_complex::sptr float_to_complex_; - complex_byte_to_float_x2_sptr cbyte_to_float_x2_; std::string item_type_; unsigned int channel_; std::shared_ptr channel_fsm_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h index 756d122d4..fa157024e 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h @@ -92,7 +92,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_->set_channel(channel_); @@ -101,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_->set_channel_fsm(channel_fsm); diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 92b43c988..413f68783 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -67,6 +67,9 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); int64_t fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + acq_parameters.repeat_satellite = configuration_->property(role + ".repeat_satellite", false); + DLOG(INFO) << role << " satellite repeat = " << acq_parameters.repeat_satellite; + float downsampling_factor = configuration_->property(role + ".downsampling_factor", 1.0); acq_parameters.downsampling_factor = downsampling_factor; @@ -146,7 +149,6 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( acq_parameters.total_block_exp = configuration_->property(role + ".total_block_exp", 14); acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); - DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")"; channel_ = 0; doppler_step_ = 0; @@ -258,5 +260,5 @@ gr::basic_block_sptr GpsL5iPcpsAcquisitionFpga::get_left_block() gr::basic_block_sptr GpsL5iPcpsAcquisitionFpga::get_right_block() { - return acquisition_fpga_; + return nullptr; } diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index d009eca49..caecc68a8 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -36,10 +36,7 @@ #define GNSS_SDR_GPS_L5I_PCPS_ACQUISITION_FPGA_H_ #include "channel_fsm.h" -#include "complex_byte_to_float_x2.h" #include "pcps_acquisition_fpga.h" -#include -#include #include // for basic_block_sptr, top_block_sptr #include // for lv_16sc_t #include // for size_t @@ -95,7 +92,7 @@ public: /*! * \brief Set acquisition channel unique ID */ - inline void set_channel(unsigned int channel) + inline void set_channel(unsigned int channel) override { channel_ = channel; acquisition_fpga_->set_channel(channel_); @@ -104,7 +101,7 @@ public: /*! * \brief Set channel fsm associated to this acquisition instance */ - inline void set_channel_fsm(std::shared_ptr channel_fsm) + inline void set_channel_fsm(std::shared_ptr channel_fsm) override { channel_fsm_ = channel_fsm; acquisition_fpga_->set_channel_fsm(channel_fsm); @@ -159,9 +156,6 @@ public: private: ConfigurationInterface* configuration_; pcps_acquisition_fpga_sptr acquisition_fpga_; - gr::blocks::stream_to_vector::sptr stream_to_vector_; - gr::blocks::float_to_complex::sptr float_to_complex_; - complex_byte_to_float_x2_sptr cbyte_to_float_x2_; std::string item_type_; uint32_t channel_; std::shared_ptr channel_fsm_; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index f89d0fc16..e3e5fdd60 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -35,12 +35,9 @@ #include "pcps_acquisition_fpga.h" #include "gnss_synchro.h" #include -#include -#include // for from_long -#include // for mp -#include // for ceil -#include // for operator<< -#include // for move +#include // for ceil +#include // for operator<< +#include // for move #define AQ_DOWNSAMPLING_DELAY 40 // delay due to the downsampling filter in the acquisition @@ -52,12 +49,8 @@ pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_) } -pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block("pcps_acquisition_fpga", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(0, 0, 0)) +pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) { - this->message_port_register_out(pmt::mp("events")); - acq_parameters = std::move(conf_); d_sample_counter = 0ULL; // SAMPLE COUNTER d_active = false; @@ -150,15 +143,8 @@ void pcps_acquisition_fpga::send_positive_acquisition() << ", magnitude " << d_mag << ", input signal power " << d_input_power; - if (d_channel_fsm) - { - //the channel FSM is set, so, notify it directly the positive acquisition to minimize delays - d_channel_fsm->Event_valid_acquisition(); - } - else - { - this->message_port_pub(pmt::mp("events"), pmt::from_long(1)); - } + //the channel FSM is set, so, notify it directly the positive acquisition to minimize delays + d_channel_fsm->Event_valid_acquisition(); } @@ -175,7 +161,14 @@ void pcps_acquisition_fpga::send_negative_acquisition() << ", magnitude " << d_mag << ", input signal power " << d_input_power; - this->message_port_pub(pmt::mp("events"), pmt::from_long(2)); + if (acq_parameters.repeat_satellite == true) + { + d_channel_fsm->Event_failed_acquisition_repeat(); + } + else + { + d_channel_fsm->Event_failed_acquisition_no_repeat(); + } } @@ -266,16 +259,6 @@ void pcps_acquisition_fpga::set_active(bool active) } -int pcps_acquisition_fpga::general_work(int noutput_items __attribute__((unused)), - gr_vector_int& ninput_items __attribute__((unused)), - gr_vector_const_void_star& input_items __attribute__((unused)), - gr_vector_void_star& output_items __attribute__((unused))) -{ - // the general work is not used with the acquisition that uses the FPGA - return noutput_items; -} - - void pcps_acquisition_fpga::reset_acquisition(void) { // this function triggers a HW reset of the FPGA PL. diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index 4ee9acb81..174ee7af5 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -44,8 +44,6 @@ #include "channel_fsm.h" #include "fpga_acquisition.h" #include -#include // for block -#include // for gr_vector_const_void_star #include // for lv_16sc_t #include // for uint32_t #include // for shared_ptr @@ -68,6 +66,7 @@ typedef struct float downsampling_factor; uint32_t total_block_exp; uint32_t excludelimit; + bool repeat_satellite; } pcpsconf_fpga_t; class pcps_acquisition_fpga; @@ -83,7 +82,7 @@ pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); * Check \ref Navitec2012 "An Open Source Galileo E1 Software Receiver", * Algorithm 1, for a pseudocode description of this implementation. */ -class pcps_acquisition_fpga : public gr::block +class pcps_acquisition_fpga { private: friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); @@ -221,13 +220,6 @@ public: * \brief This funciton is only used for the unit tests */ void read_fpga_total_scale_factor(uint32_t* total_scale_factor, uint32_t* fw_scale_factor); - - /*! - * \brief Parallel Code Phase Search Acquisition signal processing. - */ - 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_PCPS_ACQUISITION_FPGA_H_*/ diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index c68c35628..419df642c 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -55,7 +55,8 @@ Channel::Channel(ConfigurationInterface* configuration, uint32_t channel, std::s queue_ = std::move(queue); channel_fsm_ = std::make_shared(); - flag_enable_fpga = configuration->property("Channel.enable_FPGA", false); + flag_enable_fpga = configuration->property("GNSS-SDR.enable_FPGA", false); + acq_->set_channel(channel_); acq_->set_channel_fsm(channel_fsm_); trk_->set_channel(channel_); @@ -125,7 +126,10 @@ Channel::~Channel() = default; void Channel::connect(gr::top_block_sptr top_block) { - acq_->connect(top_block); + if (!flag_enable_fpga) + { + acq_->connect(top_block); + } trk_->connect(top_block); nav_->connect(top_block); @@ -136,7 +140,10 @@ void Channel::connect(gr::top_block_sptr top_block) DLOG(INFO) << "tracking -> telemetry_decoder"; // Message ports - top_block->msg_connect(acq_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events")); + if (!flag_enable_fpga) + { + top_block->msg_connect(acq_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events")); + } top_block->msg_connect(trk_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events")); connected_ = true; @@ -152,12 +159,18 @@ void Channel::disconnect(gr::top_block_sptr top_block) } top_block->disconnect(trk_->get_right_block(), 0, nav_->get_left_block(), 0); - - acq_->disconnect(top_block); + if (!flag_enable_fpga) + { + acq_->disconnect(top_block); + } trk_->disconnect(top_block); nav_->disconnect(top_block); + top_block->msg_disconnect(nav_->get_left_block(), pmt::mp("telemetry_to_trk"), trk_->get_right_block(), pmt::mp("telemetry_to_trk")); - top_block->msg_disconnect(acq_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events")); + if (!flag_enable_fpga) + { + top_block->msg_disconnect(acq_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events")); + } top_block->msg_disconnect(trk_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events")); connected_ = false; } @@ -178,6 +191,10 @@ gr::basic_block_sptr Channel::get_left_block_trk() gr::basic_block_sptr Channel::get_left_block_acq() { + if (flag_enable_fpga) + { + LOG(ERROR) << "Enabled FPGA and called get_left_block() in channel interface"; + } return acq_->get_left_block(); } @@ -199,6 +216,11 @@ void Channel::set_signal(const Gnss_Signal& gnss_signal) gnss_synchro_.PRN = gnss_signal_.get_satellite().get_PRN(); gnss_synchro_.System = gnss_signal_.get_satellite().get_system_short().c_str()[0]; acq_->set_local_code(); + if (flag_enable_fpga) + { + //set again the gnss_synchro pointer to trigger the preloading of the current PRN code to the FPGA fabric + trk_->set_gnss_synchro(&gnss_synchro_); + } nav_->set_satellite(gnss_signal_.get_satellite()); } @@ -220,7 +242,15 @@ void Channel::start_acquisition() { std::lock_guard lk(mx); bool result = false; - result = channel_fsm_->Event_start_acquisition(); + if (!flag_enable_fpga) + { + result = channel_fsm_->Event_start_acquisition(); + } + else + { + result = channel_fsm_->Event_start_acquisition_fpga(); + channel_fsm_->start_acquisition(); + } if (!result) { LOG(WARNING) << "Invalid channel event"; diff --git a/src/algorithms/channel/libs/channel_fsm.cc b/src/algorithms/channel/libs/channel_fsm.cc index 533bbd2d4..f5e75ed7c 100644 --- a/src/algorithms/channel/libs/channel_fsm.cc +++ b/src/algorithms/channel/libs/channel_fsm.cc @@ -1,7 +1,8 @@ /*! * \file channel_fsm.cc * \brief Implementation of a State Machine for channel - * \authors Antonio Ramos, 2017. antonio.ramos(at)cttc.es + * \authors Javier Arribas, 2019. javiarribas@gmail.com + * Antonio Ramos, 2017. antonio.ramos(at)cttc.es * Luis Esteve, 2011. luis(at)epsilon-formacion.com * * ------------------------------------------------------------------------- @@ -74,6 +75,18 @@ bool ChannelFsm::Event_stop_channel() } +bool ChannelFsm::Event_start_acquisition_fpga() +{ + std::lock_guard lk(mx); + if ((d_state == 1) || (d_state == 2)) + { + return false; + } + d_state = 1; + DLOG(INFO) << "CH = " << channel_ << ". Ev start acquisition FPGA"; + return true; +} + bool ChannelFsm::Event_start_acquisition() { std::lock_guard lk(mx); diff --git a/src/algorithms/channel/libs/channel_fsm.h b/src/algorithms/channel/libs/channel_fsm.h index bb26b3c08..8a3342511 100644 --- a/src/algorithms/channel/libs/channel_fsm.h +++ b/src/algorithms/channel/libs/channel_fsm.h @@ -1,7 +1,8 @@ /*! * \file channel_fsm.h * \brief Interface of the State Machine for channel - * \authors Antonio Ramos, 2017. antonio.ramos(at)cttc.es + * \authors Javier Arribas, 2019. javiarribas@gmail.com + * Antonio Ramos, 2017. antonio.ramos(at)cttc.es * Luis Esteve, 2011. luis(at)epsilon-formacion.com * * ------------------------------------------------------------------------- @@ -55,9 +56,10 @@ public: void set_telemetry(std::shared_ptr telemetry); void set_queue(gr::msg_queue::sptr queue); void set_channel(uint32_t channel); - + void start_acquisition(); // FSM EVENTS bool Event_start_acquisition(); + bool Event_start_acquisition_fpga(); bool Event_valid_acquisition(); bool Event_stop_channel(); bool Event_failed_acquisition_repeat(); @@ -65,7 +67,6 @@ public: bool Event_failed_tracking_standby(); private: - void start_acquisition(); void start_tracking(); void stop_acquisition(); void stop_tracking(); diff --git a/src/algorithms/libs/rtklib/CMakeLists.txt b/src/algorithms/libs/rtklib/CMakeLists.txt index f15c1c074..814ad6eaf 100644 --- a/src/algorithms/libs/rtklib/CMakeLists.txt +++ b/src/algorithms/libs/rtklib/CMakeLists.txt @@ -70,14 +70,10 @@ target_link_libraries(algorithms_libs_rtklib core_system_parameters Gflags::gflags Glog::glog + ${LAPACK_LIBRARIES} + ${BLAS_LIBRARIES} ) -if(OS_IS_MACOSX) - target_link_libraries(algorithms_libs_rtklib PRIVATE "-framework Accelerate") -else() - target_link_libraries(algorithms_libs_rtklib PRIVATE ${LAPACK} ${BLAS}) -endif() - set_property(TARGET algorithms_libs_rtklib APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ diff --git a/src/algorithms/libs/rtklib/rtklib.h b/src/algorithms/libs/rtklib/rtklib.h index 1b8cd9cbe..0f8cf61b7 100644 --- a/src/algorithms/libs/rtklib/rtklib.h +++ b/src/algorithms/libs/rtklib/rtklib.h @@ -215,9 +215,7 @@ const int NSATQZS = 0; const int NSYSQZS = 0; #endif -#ifndef __APPLE__ #define ENABDS -#endif #ifdef ENABDS const int MINPRNBDS = 1; //!< min satellite sat number of BeiDou const int MAXPRNBDS = 37; //!< max satellite sat number of BeiDou diff --git a/src/algorithms/libs/rtklib/rtklib_conversions.cc b/src/algorithms/libs/rtklib/rtklib_conversions.cc index fe3aad6c8..463a63598 100644 --- a/src/algorithms/libs/rtklib/rtklib_conversions.cc +++ b/src/algorithms/libs/rtklib/rtklib_conversions.cc @@ -43,12 +43,17 @@ #include "rtklib_rtkcmn.h" #include #include +#include obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro, int week, int band) { + // Get signal type info to adjust code type based on constellation + std::string sig_ = gnss_synchro.Signal; + rtklib_obs.D[band] = gnss_synchro.Carrier_Doppler_hz; rtklib_obs.P[band] = gnss_synchro.Pseudorange_m; rtklib_obs.L[band] = gnss_synchro.Carrier_phase_rads / PI_2; + switch (band) { case 0: @@ -86,6 +91,16 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs, const Gnss_Synchro& gnss_synchro break; case 'C': rtklib_obs.sat = gnss_synchro.PRN + NSATGPS + NSATGLO + NSATGAL + NSATQZS; + // Update signal code + if (sig_ == "B1") + { + rtklib_obs.code[band] = static_cast(CODE_L2I); + } + else if (sig_ == "B3") + { + rtklib_obs.code[band] = static_cast(CODE_L6I); + } + break; default: diff --git a/src/algorithms/libs/rtklib/rtklib_pntpos.cc b/src/algorithms/libs/rtklib/rtklib_pntpos.cc index 19cb48d46..2715a369a 100644 --- a/src/algorithms/libs/rtklib/rtklib_pntpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_pntpos.cc @@ -210,7 +210,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel, } } /* fL1^2 / fL2(orL5)^2 . See IS-GPS-200, p. 103 and Galileo ICD p. 48 */ - if (sys == SYS_GPS or sys == SYS_GAL or sys == SYS_GLO) + if (sys == SYS_GPS or sys == SYS_GAL or sys == SYS_GLO or sys == SYS_BDS) { gamma_ = std::pow(lam[j], 2.0) / std::pow(lam[i], 2.0); } @@ -282,7 +282,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel, PC = P2 + P1_P2 - ISCl5i; } } - else if (sys == SYS_GAL or sys == SYS_GLO) // Gal. E5a single freq. + else if (sys == SYS_GAL or sys == SYS_GLO or sys == SYS_BDS) // Gal. E5a single freq. { P2 += P2_C2; /* C2->P2 */ PC = P2 - gamma_ * P1_P2 / (1.0 - gamma_); @@ -306,7 +306,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel, PC = P1 + P1_P2; } } - else if (sys == SYS_GAL or sys == SYS_GLO) /* E1 + E5a */ + else if (sys == SYS_GAL or sys == SYS_GLO or sys == SYS_BDS) /* E1 + E5a */ { P1 += P1_C1; P2 += P2_C2; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h index 822742daf..ded912ed9 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h @@ -1,9 +1,10 @@ /*! * \file volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn.h * \brief VOLK_GNSSSDR kernel: multiplies N complex (32-bit float per component) vectors - * by a common vector, phase rotated and accumulates the results in N float complex outputs. + * by a common vector, phase rotated with Doppler rate and accumulates the results in N float complex outputs. * \authors
    - *
  • Antonio Ramos 2018. antonio.ramosdet(at)gmail.com + *
  • Carles Fernandez, 2019 cfernandez@cttc.es + *
  • Javier Arribas, 2019 javiarribas@cttc.es *
* * VOLK_GNSSSDR kernel that multiplies N 32 bits complex vectors by a common vector, which is @@ -43,8 +44,8 @@ * * Rotates and multiplies the reference complex vector with an arbitrary number of other real vectors, * accumulates the results and stores them in the output vector. - * The rotation is done at a fixed rate per sample, from an initial \p phase offset. - * This function can be used for Doppler wipe-off and multiple correlator. + * The rotation is done at a variable rate per sample, from an initial \p phase offset. + * This function can be used for Doppler wipe-off and multiple correlator in the presence of Doppler rate. * * Dispatcher Prototype * \code @@ -70,24 +71,19 @@ #define INCLUDED_volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_H -#include #include #include #include #include + #ifdef LV_HAVE_GENERIC static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_generic(lv_32fc_t* result, const lv_32fc_t* in_common, const lv_32fc_t phase_inc, const lv_32fc_t phase_inc_rate, lv_32fc_t* phase, const float** in_a, int num_a_vectors, unsigned int num_points) { lv_32fc_t tmp32_1; -#ifdef __cplusplus - lv_32fc_t half_phase_inc_rate = std::sqrt(phase_inc_rate); -#else - lv_32fc_t half_phase_inc_rate = csqrtf(phase_inc_rate); -#endif - lv_32fc_t constant_rotation = phase_inc * half_phase_inc_rate; - lv_32fc_t delta_phase_rate = lv_cmake(1.0f, 0.0f); + lv_32fc_t phase_doppler_rate = lv_cmake(1.0f, 0.0f); + lv_32fc_t phase_doppler = (*phase); int n_vec; unsigned int n; for (n_vec = 0; n_vec < num_a_vectors; n_vec++) @@ -96,27 +92,66 @@ static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_g } for (n = 0; n < num_points; n++) { - tmp32_1 = *in_common++ * (*phase); // Regenerate phase if (n % 256 == 0) { #ifdef __cplusplus (*phase) /= std::abs((*phase)); - delta_phase_rate /= std::abs(delta_phase_rate); #else (*phase) /= hypotf(lv_creal(*phase), lv_cimag(*phase)); - delta_phase_rate /= hypotf(lv_creal(delta_phase_rate), lv_cimag(delta_phase_rate)); #endif } - (*phase) *= (constant_rotation * delta_phase_rate); - delta_phase_rate *= phase_inc_rate; + tmp32_1 = *in_common++ * (*phase); + phase_doppler *= phase_inc; + phase_doppler_rate = cpowf(phase_inc_rate, lv_cmake(n * n, 0.0f)); + phase_doppler_rate /= hypotf(lv_creal(phase_doppler_rate), lv_cimag(phase_doppler_rate)); + (*phase) = phase_doppler * phase_doppler_rate; + for (n_vec = 0; n_vec < num_a_vectors; n_vec++) { result[n_vec] += (tmp32_1 * in_a[n_vec][n]); } } } +#endif -#endif /*LV_HAVE_GENERIC*/ + +#ifdef LV_HAVE_GENERIC +static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_generic_arg(lv_32fc_t* result, const lv_32fc_t* in_common, const lv_32fc_t phase_inc, const lv_32fc_t phase_inc_rate, lv_32fc_t* phase, const float** in_a, int num_a_vectors, unsigned int num_points) +{ + lv_32fc_t tmp32_1; + lv_32fc_t phase_doppler_rate = lv_cmake(1.0f, 0.0f); + lv_32fc_t phase_doppler = (*phase); + int n_vec; + const float arga = cargf(phase_inc_rate); + unsigned int n; + for (n_vec = 0; n_vec < num_a_vectors; n_vec++) + { + result[n_vec] = lv_cmake(0.0f, 0.0f); + } + for (n = 0; n < num_points; n++) + { + // Regenerate phase + if (n % 256 == 0) + { +#ifdef __cplusplus + (*phase) /= std::abs((*phase)); +#else + (*phase) /= hypotf(lv_creal(*phase), lv_cimag(*phase)); +#endif + } + tmp32_1 = *in_common++ * (*phase); + phase_doppler *= phase_inc; + const float theta = (float)(n * n) * arga; + phase_doppler_rate = lv_cmake(cosf(theta), sinf(theta)); + (*phase) = phase_doppler * phase_doppler_rate; + + for (n_vec = 0; n_vec < num_a_vectors; n_vec++) + { + result[n_vec] += (tmp32_1 * in_a[n_vec][n]); + } + } +} +#endif #endif /* INCLUDED_volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_H */ diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32fc.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32fc.h index ac71ab47a..b05485e1c 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32fc.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32fc.h @@ -1,6 +1,7 @@ /*! * \file volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc.h - * \brief Volk puppet for the multiple 16-bit complex dot product kernel. + * \brief VOLK_GNSSSDR kernel: multiplies N complex (32-bit float per component) vectors + * by a common vector, phase rotated with Doppler rate and accumulates the results in N float complex outputs. * \authors
    *
  • Carles Fernandez Prades 2016 cfernandez at cttc dot cat *
@@ -48,11 +49,11 @@ static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32 float rem_carrier_phase_in_rad = 0.25; float phase_step_rad = 0.1; lv_32fc_t phase[1]; - phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), sin(rem_carrier_phase_in_rad)); + phase[0] = lv_cmake(cosf(rem_carrier_phase_in_rad), sinf(rem_carrier_phase_in_rad)); lv_32fc_t phase_inc[1]; - phase_inc[0] = lv_cmake(cos(phase_step_rad), sin(phase_step_rad)); + phase_inc[0] = lv_cmake(cosf(phase_step_rad), sinf(phase_step_rad)); lv_32fc_t phase_inc_rate[1]; - phase_inc_rate[0] = lv_cmake(cos(phase_step_rad * 0.001), sin(phase_step_rad * 0.001)); + phase_inc_rate[0] = lv_cmake(cosf(phase_step_rad * 0.001), sinf(phase_step_rad * 0.001)); int n; int num_a_vectors = 3; float** in_a = (float**)volk_gnsssdr_malloc(sizeof(float*) * num_a_vectors, volk_gnsssdr_get_alignment()); @@ -61,6 +62,7 @@ static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32 in_a[n] = (float*)volk_gnsssdr_malloc(sizeof(float) * num_points, volk_gnsssdr_get_alignment()); memcpy((float*)in_a[n], (float*)in, sizeof(float) * num_points); } + volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_generic(result, local_code, phase_inc[0], phase_inc_rate[0], phase, (const float**)in_a, num_a_vectors, num_points); for (n = 0; n < num_a_vectors; n++) @@ -71,93 +73,35 @@ static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32 } #endif // Generic -// -//#ifdef LV_HAVE_GENERIC -//static inline void volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc_generic_reload(lv_32fc_t* result, const lv_32fc_t* local_code, const float* in, unsigned int num_points) -//{ -// // phases must be normalized. Phase rotator expects a complex exponential input! -// float rem_carrier_phase_in_rad = 0.25; -// float phase_step_rad = 0.1; -// lv_32fc_t phase[1]; -// phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), sin(rem_carrier_phase_in_rad)); -// lv_32fc_t phase_inc[1]; -// phase_inc[0] = lv_cmake(cos(phase_step_rad), sin(phase_step_rad)); -// int n; -// int num_a_vectors = 3; -// float** in_a = (float**)volk_gnsssdr_malloc(sizeof(float*) * num_a_vectors, volk_gnsssdr_get_alignment()); -// for (n = 0; n < num_a_vectors; n++) -// { -// in_a[n] = (float*)volk_gnsssdr_malloc(sizeof(float) * num_points, volk_gnsssdr_get_alignment()); -// memcpy((float*)in_a[n], (float*)in, sizeof(float) * num_points); -// } -// volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn_generic_reload(result, local_code, phase_inc[0], phase, (const float**)in_a, num_a_vectors, num_points); -// -// for (n = 0; n < num_a_vectors; n++) -// { -// volk_gnsssdr_free(in_a[n]); -// } -// volk_gnsssdr_free(in_a); -//} -// -//#endif // Generic -// -//#ifdef LV_HAVE_AVX -//static inline void volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc_u_avx(lv_32fc_t* result, const lv_32fc_t* local_code, const float* in, unsigned int num_points) -//{ -// // phases must be normalized. Phase rotator expects a complex exponential input! -// float rem_carrier_phase_in_rad = 0.25; -// float phase_step_rad = 0.1; -// lv_32fc_t phase[1]; -// phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), sin(rem_carrier_phase_in_rad)); -// lv_32fc_t phase_inc[1]; -// phase_inc[0] = lv_cmake(cos(phase_step_rad), sin(phase_step_rad)); -// int n; -// int num_a_vectors = 3; -// float** in_a = (float**)volk_gnsssdr_malloc(sizeof(float*) * num_a_vectors, volk_gnsssdr_get_alignment()); -// for (n = 0; n < num_a_vectors; n++) -// { -// in_a[n] = (float*)volk_gnsssdr_malloc(sizeof(float) * num_points, volk_gnsssdr_get_alignment()); -// memcpy((float*)in_a[n], (float*)in, sizeof(float) * num_points); -// } -// volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn_u_avx(result, local_code, phase_inc[0], phase, (const float**)in_a, num_a_vectors, num_points); -// -// for (n = 0; n < num_a_vectors; n++) -// { -// volk_gnsssdr_free(in_a[n]); -// } -// volk_gnsssdr_free(in_a); -//} -// -//#endif // AVX -// -// -//#ifdef LV_HAVE_AVX -//static inline void volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc_a_avx(lv_32fc_t* result, const lv_32fc_t* local_code, const float* in, unsigned int num_points) -//{ -// // phases must be normalized. Phase rotator expects a complex exponential input! -// float rem_carrier_phase_in_rad = 0.25; -// float phase_step_rad = 0.1; -// lv_32fc_t phase[1]; -// phase[0] = lv_cmake(cos(rem_carrier_phase_in_rad), sin(rem_carrier_phase_in_rad)); -// lv_32fc_t phase_inc[1]; -// phase_inc[0] = lv_cmake(cos(phase_step_rad), sin(phase_step_rad)); -// int n; -// int num_a_vectors = 3; -// float** in_a = (float**)volk_gnsssdr_malloc(sizeof(float*) * num_a_vectors, volk_gnsssdr_get_alignment()); -// for (n = 0; n < num_a_vectors; n++) -// { -// in_a[n] = (float*)volk_gnsssdr_malloc(sizeof(float) * num_points, volk_gnsssdr_get_alignment()); -// memcpy((float*)in_a[n], (float*)in, sizeof(float) * num_points); -// } -// volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn_a_avx(result, local_code, phase_inc[0], phase, (const float**)in_a, num_a_vectors, num_points); -// -// for (n = 0; n < num_a_vectors; n++) -// { -// volk_gnsssdr_free(in_a[n]); -// } -// volk_gnsssdr_free(in_a); -//} -// -//#endif // AVX +#ifdef LV_HAVE_GENERIC +static inline void volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32fc_generic_arg(lv_32fc_t* result, const lv_32fc_t* local_code, const float* in, unsigned int num_points) +{ + // phases must be normalized. Phase rotator expects a complex exponential input! + float rem_carrier_phase_in_rad = 0.25; + float phase_step_rad = 0.1; + lv_32fc_t phase[1]; + phase[0] = lv_cmake(cosf(rem_carrier_phase_in_rad), sinf(rem_carrier_phase_in_rad)); + lv_32fc_t phase_inc[1]; + phase_inc[0] = lv_cmake(cosf(phase_step_rad), sinf(phase_step_rad)); + lv_32fc_t phase_inc_rate[1]; + phase_inc_rate[0] = lv_cmake(cosf(phase_step_rad * 0.001), sinf(phase_step_rad * 0.001)); + int n; + int num_a_vectors = 3; + float** in_a = (float**)volk_gnsssdr_malloc(sizeof(float*) * num_a_vectors, volk_gnsssdr_get_alignment()); + for (n = 0; n < num_a_vectors; n++) + { + in_a[n] = (float*)volk_gnsssdr_malloc(sizeof(float) * num_points, volk_gnsssdr_get_alignment()); + memcpy((float*)in_a[n], (float*)in, sizeof(float) * num_points); + } + + volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn_generic_arg(result, local_code, phase_inc[0], phase_inc_rate[0], phase, (const float**)in_a, num_a_vectors, num_points); + + for (n = 0; n < num_a_vectors; n++) + { + volk_gnsssdr_free(in_a[n]); + } + volk_gnsssdr_free(in_a); +} +#endif // Generic #endif // INCLUDED_volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32fc_H diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h index c08591deb..6c4eb5a58 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h @@ -313,7 +313,7 @@ static inline void volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn_u_avx(lv_32fc_ number = sixteenthPoints * 16; for (; number < num_points; number++) { - wo = (*aPtr++) * _phase; + wo = in_common[number] * _phase; _phase *= phase_inc; for (vec_ind = 0; vec_ind < num_a_vectors; ++vec_ind) @@ -477,7 +477,7 @@ static inline void volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn_a_avx(lv_32fc_ number = sixteenthPoints * 16; for (; number < num_points; number++) { - wo = (*aPtr++) * _phase; + wo = in_common[number] * _phase; _phase *= phase_inc; for (vec_ind = 0; vec_ind < num_a_vectors; ++vec_ind) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/kernel_tests.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/kernel_tests.h index 86b20b5e0..f2973a074 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/kernel_tests.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/kernel_tests.h @@ -97,9 +97,9 @@ std::vector init_test_list(volk_gnsssdr_test_params_t QA(VOLK_INIT_PUPP(volk_gnsssdr_16ic_x2_dotprodxnpuppet_16ic, volk_gnsssdr_16ic_x2_dot_prod_16ic_xn, test_params)) QA(VOLK_INIT_PUPP(volk_gnsssdr_16ic_x2_rotator_dotprodxnpuppet_16ic, volk_gnsssdr_16ic_x2_rotator_dot_prod_16ic_xn, test_params_int16)) QA(VOLK_INIT_PUPP(volk_gnsssdr_16ic_16i_rotator_dotprodxnpuppet_16ic, volk_gnsssdr_16ic_16i_rotator_dot_prod_16ic_xn, test_params_int16)) - QA(VOLK_INIT_PUPP(volk_gnsssdr_32fc_x2_rotator_dotprodxnpuppet_32fc, volk_gnsssdr_32fc_x2_rotator_dot_prod_32fc_xn, test_params_int1)) - QA(VOLK_INIT_PUPP(volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc, volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn, test_params_int1)); - QA(VOLK_INIT_PUPP(volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32fc, volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn, test_params_int1)); + QA(VOLK_INIT_PUPP(volk_gnsssdr_32fc_x2_rotator_dotprodxnpuppet_32fc, volk_gnsssdr_32fc_x2_rotator_dot_prod_32fc_xn, test_params_inacc)) + QA(VOLK_INIT_PUPP(volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc, volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn, test_params_inacc)); + QA(VOLK_INIT_PUPP(volk_gnsssdr_32fc_32f_high_dynamic_rotator_dotprodxnpuppet_32fc, volk_gnsssdr_32fc_32f_high_dynamic_rotator_dot_prod_32fc_xn, test_params_inacc)); return test_cases; } diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 5374a6fbf..a8f515aec 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -32,7 +32,7 @@ if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2) message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio") message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio") message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio") - message(FATAL_ERROR "gnuradio-iio is required for building gnss-sdr with this option enabled.") + message(FATAL_ERROR "gnuradio-iio is required for building gnss-sdr with -DENABLE_PLUTOSDR=ON or -DENABLE_FMCOMMS2=ON.") endif() endif() @@ -44,7 +44,7 @@ if(ENABLE_AD9361) message(STATUS " * libiio from https://github.com/analogdevicesinc/libiio") message(STATUS " * libad9361-iio from https://github.com/analogdevicesinc/libad9361-iio") message(STATUS " * gnuradio-iio from https://github.com/analogdevicesinc/gr-iio") - message(FATAL_ERROR "libiio is required for building gnss-sdr with this option enabled.") + message(FATAL_ERROR "libiio is required for building gnss-sdr with -DENABLE_AD9361=ON.") endif() endif() @@ -53,10 +53,8 @@ if(ENABLE_PLUTOSDR) ############################################## # ADALM-PLUTO (Analog Devices Inc.) ############################################## - if(GRIIO_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} plutosdr_signal_source.h) - endif() + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc) + set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} plutosdr_signal_source.h) endif() @@ -64,10 +62,8 @@ if(ENABLE_FMCOMMS2) ############################################### # FMCOMMS2 based SDR Hardware ############################################### - if(GRIIO_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} fmcomms2_signal_source.h) - endif() + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} fmcomms2_signal_source.cc) + set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} fmcomms2_signal_source.h) endif() @@ -75,10 +71,8 @@ if(ENABLE_AD9361) ############################################### # AD9361 DIRECT TO FPGA Hardware ############################################### - if(LIBIIO_FOUND) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ad9361_fpga_signal_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad9361_fpga_signal_source.h) - endif() + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ad9361_fpga_signal_source.cc) + set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad9361_fpga_signal_source.h) endif() @@ -120,18 +114,14 @@ if(ENABLE_OSMOSDR) ################################################################################ # OsmoSDR - http://sdr.osmocom.org/trac/ ################################################################################ - if(NOT GROSMOSDR_FOUND) - if(ENABLE_PACKAGING) - list(REMOVE_ITEM SIGNAL_SOURCE_ADAPTER_HEADERS ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters/osmosdr_signal_source.h) - endif() - else() + if(GROSMOSDR_FOUND) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} osmosdr_signal_source.cc) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} osmosdr_signal_source.h) endif() endif() -if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd) +if(ENABLE_UHD) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} uhd_signal_source.cc) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} uhd_signal_source.h) endif() @@ -162,10 +152,12 @@ set(SIGNAL_SOURCE_ADAPTER_HEADERS if(PC_GNURADIO_RUNTIME_VERSION VERSION_GREATER 3.7.3) set(SIGNAL_SOURCE_ADAPTER_SOURCES ${SIGNAL_SOURCE_ADAPTER_SOURCES} two_bit_cpx_file_signal_source.cc - two_bit_packed_file_signal_source.cc) + two_bit_packed_file_signal_source.cc + ) set(SIGNAL_SOURCE_ADAPTER_HEADERS ${SIGNAL_SOURCE_ADAPTER_HEADERS} two_bit_cpx_file_signal_source.h - two_bit_packed_file_signal_source.h) + two_bit_packed_file_signal_source.h + ) endif() list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS) @@ -205,7 +197,7 @@ if(ENABLE_RAW_UDP AND PCAP_FOUND) ) endif() -if(ENABLE_UHD AND GNURADIO_UHD_LIBRARIES_gnuradio-uhd) +if(ENABLE_UHD) target_link_libraries(signal_source_adapters PUBLIC Gnuradio::uhd diff --git a/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.h index 6df5a9994..f38f6c3b4 100644 --- a/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.h @@ -48,7 +48,7 @@ class BeidouB3iTelemetryDecoder : public TelemetryDecoderInterface { public: BeidouB3iTelemetryDecoder(ConfigurationInterface *configuration, - const std::string& role, unsigned int in_streams, + const std::string &role, unsigned int in_streams, unsigned int out_streams); virtual ~BeidouB3iTelemetryDecoder(); @@ -72,7 +72,11 @@ public: telemetry_decoder_->set_channel(channel); } - inline void reset() override { return; } + inline void reset() override + { + telemetry_decoder_->reset(); + return; + } inline size_t item_size() override { return 0; } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc index 6e65de72a..9f1396b8b 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.cc @@ -56,6 +56,7 @@ beidou_b3i_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, new beidou_b3i_telemetry_decoder_gs(satellite, dump)); } + beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs( const Gnss_Satellite &satellite, bool dump) : gr::block("beidou_b3i_telemetry_decoder_gs", @@ -64,6 +65,9 @@ beidou_b3i_telemetry_decoder_gs::beidou_b3i_telemetry_decoder_gs( { // Ephemeris data port out this->message_port_register_out(pmt::mp("telemetry")); + // Control messages to tracking block + this->message_port_register_out(pmt::mp("telemetry_to_trk")); + // initialize internal vars d_dump = dump; d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); @@ -396,6 +400,7 @@ void beidou_b3i_telemetry_decoder_gs::set_satellite( } } + void beidou_b3i_telemetry_decoder_gs::set_channel(int32_t channel) { d_channel = channel; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h index 746e68895..54bac3adb 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/beidou_b3i_telemetry_decoder_gs.h @@ -60,7 +60,10 @@ public: ~beidou_b3i_telemetry_decoder_gs(); //!< Class destructor void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN void set_channel(int channel); //!< Set receiver's channel - + inline void reset() + { + return; + } /*! * \brief This is where all signal processing takes place */ diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc index 6dba51ede..8bfcbe82f 100644 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc @@ -73,6 +73,49 @@ BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } trk_param.dll_bw_hz = dll_bw_hz; + + int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + trk_param.dll_filter_order = dll_filter_order; + + int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + trk_param.pll_filter_order = pll_filter_order; + + if (pll_filter_order == 2) + { + trk_param.fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + trk_param.fll_filter_order = 2; + } + + bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); + trk_param.enable_fll_pull_in = enable_fll_pull_in; + float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); + trk_param.fll_bw_hz = fll_bw_hz; + float pull_in_time_s = configuration->property(role + ".pull_in_time_s", 2.0); + trk_param.pull_in_time_s = pull_in_time_s; + float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); trk_param.early_late_space_chips = early_late_space_chips; float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc index 6253788e8..49d76417c 100644 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc @@ -68,6 +68,49 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast(FLAGS_dll_bw_hz); trk_param.dll_bw_hz = dll_bw_hz; + + int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + trk_param.dll_filter_order = dll_filter_order; + + int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + trk_param.pll_filter_order = pll_filter_order; + + if (pll_filter_order == 2) + { + trk_param.fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + trk_param.fll_filter_order = 2; + } + + bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); + trk_param.enable_fll_pull_in = enable_fll_pull_in; + float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); + trk_param.fll_bw_hz = fll_bw_hz; + float pull_in_time_s = configuration->property(role + ".pull_in_time_s", 2.0); + trk_param.pull_in_time_s = pull_in_time_s; + float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); trk_param.early_late_space_chips = early_late_space_chips; float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); @@ -141,8 +184,7 @@ BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( } -BeidouB3iDllPllTracking::~BeidouB3iDllPllTracking() -= default; +BeidouB3iDllPllTracking::~BeidouB3iDllPllTracking() = default; void BeidouB3iDllPllTracking::start_tracking() diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc index ec8e95979..1beba6c51 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc @@ -88,6 +88,49 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz; float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 0.25); trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz; + + int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + trk_param.dll_filter_order = dll_filter_order; + + int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + trk_param.pll_filter_order = pll_filter_order; + + if (pll_filter_order == 2) + { + trk_param.fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + trk_param.fll_filter_order = 2; + } + + bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); + trk_param.enable_fll_pull_in = enable_fll_pull_in; + float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); + trk_param.fll_bw_hz = fll_bw_hz; + float pull_in_time_s = configuration->property(role + ".pull_in_time_s", 2.0); + trk_param.pull_in_time_s = pull_in_time_s; + int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.15); trk_param.early_late_space_chips = early_late_space_chips; diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc index aa8b0f998..cdf4d7cad 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -83,6 +83,49 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } trk_param.dll_bw_hz = dll_bw_hz; + + int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + trk_param.dll_filter_order = dll_filter_order; + + int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + trk_param.pll_filter_order = pll_filter_order; + + if (pll_filter_order == 2) + { + trk_param.fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + trk_param.fll_filter_order = 2; + } + + bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); + trk_param.enable_fll_pull_in = enable_fll_pull_in; + float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); + trk_param.fll_bw_hz = fll_bw_hz; + float pull_in_time_s = configuration->property(role + ".pull_in_time_s", 2.0); + trk_param.pull_in_time_s = pull_in_time_s; + float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 5.0); trk_param.pll_bw_narrow_hz = pll_bw_narrow_hz; float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index b8f4815e2..a511503fb 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -89,6 +89,49 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } trk_param.dll_bw_hz = dll_bw_hz; + + int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + trk_param.dll_filter_order = dll_filter_order; + + int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + trk_param.pll_filter_order = pll_filter_order; + + if (pll_filter_order == 2) + { + trk_param.fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + trk_param.fll_filter_order = 2; + } + + bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); + trk_param.enable_fll_pull_in = enable_fll_pull_in; + float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); + trk_param.fll_bw_hz = fll_bw_hz; + float pull_in_time_s = configuration->property(role + ".pull_in_time_s", 2.0); + trk_param.pull_in_time_s = pull_in_time_s; + float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); trk_param.early_late_space_chips = early_late_space_chips; float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc index a1e2c722c..65912ccbf 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc @@ -77,6 +77,49 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); trk_param.early_late_space_chips = early_late_space_chips; trk_param.early_late_space_narrow_chips = 0.0; + + int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + trk_param.dll_filter_order = dll_filter_order; + + int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + trk_param.pll_filter_order = pll_filter_order; + + if (pll_filter_order == 2) + { + trk_param.fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + trk_param.fll_filter_order = 2; + } + + bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); + trk_param.enable_fll_pull_in = enable_fll_pull_in; + float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); + trk_param.fll_bw_hz = fll_bw_hz; + float pull_in_time_s = configuration->property(role + ".pull_in_time_s", 2.0); + trk_param.pull_in_time_s = pull_in_time_s; + int vector_length = std::round(static_cast(fs_in) / (static_cast(GPS_L2_M_CODE_RATE_HZ) / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS))); trk_param.vector_length = vector_length; int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1); diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc index 2066f99be..988f8dccb 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -90,6 +90,49 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( trk_param.dll_bw_narrow_hz = dll_bw_narrow_hz; float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); trk_param.early_late_space_chips = early_late_space_chips; + + int dll_filter_order = configuration->property(role + ".dll_filter_order", 2); + if (dll_filter_order < 1) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 1."; + dll_filter_order = 1; + } + if (dll_filter_order > 3) + { + LOG(WARNING) << "dll_filter_order parameter must be 1, 2 or 3. Set to 3."; + dll_filter_order = 3; + } + trk_param.dll_filter_order = dll_filter_order; + + int pll_filter_order = configuration->property(role + ".pll_filter_order", 3); + if (pll_filter_order < 2) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 2."; + pll_filter_order = 2; + } + if (pll_filter_order > 3) + { + LOG(WARNING) << "pll_filter_order parameter must be 2 or 3. Set to 3."; + pll_filter_order = 3; + } + trk_param.pll_filter_order = pll_filter_order; + + if (pll_filter_order == 2) + { + trk_param.fll_filter_order = 1; + } + if (pll_filter_order == 3) + { + trk_param.fll_filter_order = 2; + } + + bool enable_fll_pull_in = configuration->property(role + ".enable_fll_pull_in", false); + trk_param.enable_fll_pull_in = enable_fll_pull_in; + float fll_bw_hz = configuration->property(role + ".fll_bw_hz", 35.0); + trk_param.fll_bw_hz = fll_bw_hz; + float pull_in_time_s = configuration->property(role + ".pull_in_time_s", 2.0); + trk_param.pull_in_time_s = pull_in_time_s; + int vector_length = std::round(static_cast(fs_in) / (static_cast(GPS_L5I_CODE_RATE_HZ) / static_cast(GPS_L5I_CODE_LENGTH_CHIPS))); trk_param.vector_length = vector_length; int extend_correlation_symbols = configuration->property(role + ".extend_correlation_symbols", 1); diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 33248408a..2159dd307 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -39,6 +39,12 @@ #include "acquisition_interface.h" // for AcquisitionInterface #include "array_signal_conditioner.h" #include "beamformer_filter.h" +#include "beidou_b1i_dll_pll_tracking.h" +#include "beidou_b1i_pcps_acquisition.h" +#include "beidou_b1i_telemetry_decoder.h" +#include "beidou_b3i_dll_pll_tracking.h" +#include "beidou_b3i_pcps_acquisition.h" +#include "beidou_b3i_telemetry_decoder.h" #include "byte_to_short.h" #include "channel.h" #include "configuration_interface.h" @@ -66,12 +72,6 @@ #include "glonass_l2_ca_dll_pll_tracking.h" #include "glonass_l2_ca_pcps_acquisition.h" #include "glonass_l2_ca_telemetry_decoder.h" -#include "beidou_b1i_pcps_acquisition.h" -#include "beidou_b1i_dll_pll_tracking.h" -#include "beidou_b1i_telemetry_decoder.h" -#include "beidou_b3i_pcps_acquisition.h" -#include "beidou_b3i_dll_pll_tracking.h" -#include "beidou_b3i_telemetry_decoder.h" #include "gnss_block_interface.h" #include "gps_l1_ca_dll_pll_c_aid_tracking.h" #include "gps_l1_ca_dll_pll_tracking.h" @@ -289,12 +289,12 @@ std::unique_ptr GNSSBlockFactory::GetObservables(const std:: Galileo_channels + GPS_channels + Glonass_channels + - Beidou_channels + + Beidou_channels + extra_channels, - Galileo_channels + + Galileo_channels + GPS_channels + Glonass_channels + - Beidou_channels); + Beidou_channels); } @@ -313,7 +313,7 @@ std::unique_ptr GNSSBlockFactory::GetPVT(const std::shared_p unsigned int Beidou_channels = configuration->property("Channels_B1.count", 0); Beidou_channels += configuration->property("Channels_B3.count", 0); return GetBlock(configuration, "PVT", implementation, - Galileo_channels + GPS_channels + Glonass_channels + Beidou_channels, 0); + Galileo_channels + GPS_channels + Glonass_channels + Beidou_channels, 0); } @@ -948,7 +948,7 @@ std::unique_ptr>> GNSSBlockFacto Channels_5X_count + Channels_L5_count + Channels_B1_count + - Channels_B3_count; + Channels_B3_count; std::unique_ptr>> channels(new std::vector>(total_channels)); try @@ -1218,7 +1218,6 @@ std::unique_ptr>> GNSSBlockFacto queue); channel_absolute_id++; } - } catch (const std::exception& e) { @@ -1704,8 +1703,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( block = std::move(block_); } else if (implementation == "BEIDOU_B3I_PCPS_Acquisition") - { - std::unique_ptr block_(new BeidouB3iPcpsAcquisition(configuration.get(), role, in_streams, + { + std::unique_ptr block_(new BeidouB3iPcpsAcquisition(configuration.get(), role, in_streams, out_streams)); block = std::move(block_); } @@ -1720,7 +1719,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( else if (implementation == "GPS_L1_CA_KF_Tracking") { std::unique_ptr block_(new GpsL1CaKfTracking(configuration.get(), role, in_streams, - out_streams)); + out_streams)); block = std::move(block_); } else if (implementation == "GPS_L1_CA_DLL_PLL_C_Aid_Tracking") @@ -1844,11 +1843,11 @@ std::unique_ptr GNSSBlockFactory::GetBlock( block = std::move(block_); } else if (implementation == "BEIDOU_B3I_DLL_PLL_Tracking") - { - std::unique_ptr block_(new BeidouB3iDllPllTracking(configuration.get(), role, in_streams, - out_streams)); - block = std::move(block_); - } + { + std::unique_ptr block_(new BeidouB3iDllPllTracking(configuration.get(), role, in_streams, + out_streams)); + block = std::move(block_); + } // TELEMETRY DECODERS ---------------------------------------------------------- else if (implementation == "GPS_L1_CA_Telemetry_Decoder") { @@ -2138,7 +2137,7 @@ std::unique_ptr GNSSBlockFactory::GetTrkBlock( else if (implementation == "GPS_L1_CA_KF_Tracking") { std::unique_ptr block_(new GpsL1CaKfTracking(configuration.get(), role, in_streams, - out_streams)); + out_streams)); block = std::move(block_); } else if (implementation == "GPS_L1_CA_DLL_PLL_C_Aid_Tracking") diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index f9f07b097..026bcf24b 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -309,21 +309,41 @@ endif() if(ENABLE_UNIT_TESTING_EXTRA) add_definitions(-DEXTRA_TESTS) + message(STATUS "Downloading some data files for testing...") if(NOT EXISTS ${CMAKE_SOURCE_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat) - message(STATUS "Downloading some data files for testing...") + message(STATUS "Downloading file: gps_l2c_m_prn7_5msps.dat") file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/gps_l2c_m_prn7_5msps.dat ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat - SHOW_PROGRESS - EXPECTED_HASH MD5=a6fcbefe155137945d3c33c5ef7bd0f9) + SHOW_PROGRESS + EXPECTED_HASH MD5=a6fcbefe155137945d3c33c5ef7bd0f9 + ) endif() if(NOT EXISTS ${CMAKE_SOURCE_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat) - message(STATUS "Downloading some data files for testing...") + message(STATUS "Downloading file: Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat") file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat - SHOW_PROGRESS - EXPECTED_HASH MD5=ffb72fc63c116be58d5e5ccb1daaed3a) + SHOW_PROGRESS + EXPECTED_HASH MD5=ffb72fc63c116be58d5e5ccb1daaed3a + ) endif() + if(NOT EXISTS ${CMAKE_SOURCE_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat) + message(STATUS "Downloading file: BdsB1IStr01_fs25e6_if0_4ms.dat") + file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/BdsB1IStr01_fs25e6_if0_4ms.dat ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat + SHOW_PROGRESS + EXPECTED_HASH MD5=5a4336dad9d80f3313a16dec4fff9233 + ) + endif() + if(NOT EXISTS ${CMAKE_SOURCE_DIR}/thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat) + message(STATUS "Downloading file: BdsB3IStr01_fs50e6_if0_4ms.dat") + file(DOWNLOAD https://sourceforge.net/projects/gnss-sdr/files/data/BdsB3IStr01_fs50e6_if0_4ms.dat ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat + SHOW_PROGRESS + EXPECTED_HASH MD5=066d0d8434a8bc81e161778b7c34cc07 + ) + endif() + message(STATUS "Done.") if(ENABLE_INSTALL_TESTS) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat DESTINATION share/gnss-sdr/signal_samples) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat DESTINATION share/gnss-sdr/signal_samples) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat DESTINATION share/gnss-sdr/signal_samples) endif() endif() diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index c7a8d6304..1aa5e558a 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -92,7 +92,6 @@ DECLARE_string(log_dir); #include "unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc" #include "unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc" // #include "unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc" -// #include "unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc" #if OPENCL_BLOCKS_TEST #include "unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc" @@ -127,6 +126,8 @@ DECLARE_string(log_dir); #if EXTRA_TESTS #include "unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc" +//#include "unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc" +//#include "unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc" #include "unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc" #include "unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc" diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc index 959d73fed..be0214766 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc @@ -3,7 +3,7 @@ * \brief This class implements an acquisition test for * BeidouB1iPcpsAcquisition class based on some input parameters. * \author Sergi Segura, 2018. sergi.segura.munoz(at)gmail.com - * + * \author Damian Miralles, 2019. dmiralles2009(at)gmail.com * * ------------------------------------------------------------------------- * @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -52,12 +51,18 @@ #include #include #include +#include +#ifdef GR_GREATER_38 +#include +#else +#include +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class BeidouB1iPcpsAcquisitionTest_msg_rx; -typedef boost::shared_ptr BeidouB1iPcpsAcquisitionTest_msg_rx_sptr; +using BeidouB1iPcpsAcquisitionTest_msg_rx_sptr = boost::shared_ptr; BeidouB1iPcpsAcquisitionTest_msg_rx_sptr BeidouB1iPcpsAcquisitionTest_msg_rx_make(); @@ -84,7 +89,7 @@ void BeidouB1iPcpsAcquisitionTest_msg_rx::msg_handler_events(pmt::pmt_t msg) { try { - long int message = pmt::to_long(msg); + int64_t message = pmt::to_long(std::move(msg)); rx_message = message; } catch (boost::bad_any_cast &e) @@ -103,9 +108,7 @@ BeidouB1iPcpsAcquisitionTest_msg_rx::BeidouB1iPcpsAcquisitionTest_msg_rx() : gr: } -BeidouB1iPcpsAcquisitionTest_msg_rx::~BeidouB1iPcpsAcquisitionTest_msg_rx() -{ -} +BeidouB1iPcpsAcquisitionTest_msg_rx::~BeidouB1iPcpsAcquisitionTest_msg_rx() = default; // ########################################################### @@ -123,9 +126,7 @@ protected: doppler_step = 100; } - ~BeidouB1iPcpsAcquisitionTest() - { - } + ~BeidouB1iPcpsAcquisitionTest() = default; void init(); void plot_grid(); @@ -133,7 +134,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; - Gnss_Synchro gnss_synchro; + Gnss_Synchro gnss_synchro{}; size_t item_size; unsigned int doppler_max; unsigned int doppler_step; @@ -159,8 +160,9 @@ void BeidouB1iPcpsAcquisitionTest::init() { config->set_property("Acquisition_B1.dump", "false"); } - config->set_property("Acquisition_B1.dump_filename", "./tmp-acq-beidou1/acquisition"); - config->set_property("Acquisition_B1.threshold", "0.00001"); + config->set_property("Acquisition_B1.dump_filename", "./tmp-acq-bds-b1i/acquisition"); + config->set_property("Acquisition_B1.dump_channel", "1"); + config->set_property("Acquisition_B1.threshold", "0.0038"); config->set_property("Acquisition_B1.doppler_max", std::to_string(doppler_max)); config->set_property("Acquisition_B1.doppler_step", std::to_string(doppler_step)); config->set_property("Acquisition_B1.repeat_satellite", "false"); @@ -171,13 +173,16 @@ void BeidouB1iPcpsAcquisitionTest::init() void BeidouB1iPcpsAcquisitionTest::plot_grid() { //load the measured values - std::string basename = "./tmp-acq-beidou1/acquisition_C_B1"; - unsigned int sat = static_cast(gnss_synchro.PRN); + std::string basename = "./tmp-acq-bds-b1i/acquisition_C_B1"; + auto sat = static_cast(gnss_synchro.PRN); - unsigned int samples_per_code = static_cast(round(4000000 / (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS))); // !! - acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code); + auto samples_per_code = static_cast(round(25000000 / (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS))); // !! + Acquisition_Dump_Reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code, 1); - if (!acq_dump.read_binary_acq()) std::cout << "Error reading files" << std::endl; + if (!acq_dump.read_binary_acq()) + { + std::cout << "Error reading files" << std::endl; + } std::vector *doppler = &acq_dump.doppler; std::vector *samples = &acq_dump.samples; @@ -197,26 +202,33 @@ void BeidouB1iPcpsAcquisitionTest::plot_grid() { boost::filesystem::path p(gnuplot_executable); boost::filesystem::path dir = p.parent_path(); - std::string gnuplot_path = dir.native(); + const std::string &gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("lines"); - g1.set_title("BeiDou signal acquisition for satellite PRN #" + std::to_string(gnss_synchro.PRN)); + if (FLAGS_show_plots) + { + g1.showonscreen(); // window output + } + else + { + g1.disablescreen(); + } + g1.set_title("BeiDou B1I 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("BEIDOU_B1I_acq_grid"); - g1.savetopdf("BEIDOU_BI1_acq_grid"); - g1.showonscreen(); + g1.savetops("BeiDou_B1I_acq_grid"); + g1.savetopdf("BeiDou_B1I_acq_grid"); } catch (const GnuplotException &ge) { std::cout << ge.what() << std::endl; } } - std::string data_str = "./tmp-acq-beidou1"; + std::string data_str = "./tmp-acq-bds-b1i"; if (boost::filesystem::exists(data_str)) { boost::filesystem::remove_all(data_str); @@ -234,7 +246,7 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, Instantiate) TEST_F(BeidouB1iPcpsAcquisitionTest, ConnectAndRun) { int fs_in = 25000000; - int nsamples = 4000; + int nsamples = 25000; std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); gr::msg_queue::sptr queue = gr::msg_queue::make(0); @@ -270,14 +282,14 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, ValidationOfResults) std::chrono::duration elapsed_seconds(0.0); top_block = gr::make_top_block("Acquisition test"); - double expected_delay_samples = 524; - double expected_doppler_hz = 1680; + double expected_delay_samples = 22216; + double expected_doppler_hz = 125; init(); if (FLAGS_plot_acq_grid == true) { - std::string data_str = "./tmp-acq-beidou1"; + std::string data_str = "./tmp-acq-bds-b1i"; if (boost::filesystem::exists(data_str)) { boost::filesystem::remove_all(data_str); @@ -297,7 +309,7 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, ValidationOfResults) }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW({ - acquisition->set_threshold(0.001); + acquisition->set_threshold(0.0038); }) << "Failure setting threshold."; ASSERT_NO_THROW({ @@ -314,7 +326,7 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, ValidationOfResults) ASSERT_NO_THROW({ std::string path = std::string(TEST_PATH); - std::string file = path + "signal_samples/BEIDOU_B1I_ID_1_Fs_4Msps_2ms.dat"; + std::string file = path + "signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat"; const char *file_name = file.c_str(); 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); @@ -332,12 +344,12 @@ TEST_F(BeidouB1iPcpsAcquisitionTest, ValidationOfResults) elapsed_seconds = end - start; }) << "Failure running the top_block."; - unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; + uint64_t nsamples = gnss_synchro.Acq_samplestamp_samples; std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); - float delay_error_chips = static_cast(delay_error_samples * 1023 / 4000); + auto delay_error_chips = static_cast(delay_error_samples * BEIDOU_B1I_CODE_LENGTH_CHIPS / 25000); double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc new file mode 100644 index 000000000..d80ca6e66 --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc @@ -0,0 +1,361 @@ +/*! + * \file beidou_b3i_pcps_acquisition_test.cc + * \brief This class implements an acquisition test for + * BeidouB3iPcpsAcquisition class based on some input parameters. + * \author Damian Miralles, 2019. dmiralles2009(at)gmail.com + * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + + +#include "Beidou_B3I.h" +#include "acquisition_dump_reader.h" +#include "gnss_block_factory.h" +#include "gnss_block_interface.h" +#include "gnss_sdr_valve.h" +#include "gnss_synchro.h" +#include "gnuplot_i.h" +#include "beidou_b3i_pcps_acquisition.h" +#include "in_memory_configuration.h" +#include "test_flags.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef GR_GREATER_38 +#include +#else +#include +#endif + + +// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +class BeidouB3iPcpsAcquisitionTest_msg_rx; + +using BeidouB3iPcpsAcquisitionTest_msg_rx_sptr = boost::shared_ptr; + +BeidouB3iPcpsAcquisitionTest_msg_rx_sptr BeidouB3iPcpsAcquisitionTest_msg_rx_make(); + +class BeidouB3iPcpsAcquisitionTest_msg_rx : public gr::block +{ +private: + friend BeidouB3iPcpsAcquisitionTest_msg_rx_sptr BeidouB3iPcpsAcquisitionTest_msg_rx_make(); + void msg_handler_events(pmt::pmt_t msg); + BeidouB3iPcpsAcquisitionTest_msg_rx(); + +public: + int rx_message; + ~BeidouB3iPcpsAcquisitionTest_msg_rx(); //!< Default destructor +}; + + +BeidouB3iPcpsAcquisitionTest_msg_rx_sptr BeidouB3iPcpsAcquisitionTest_msg_rx_make() +{ + return BeidouB3iPcpsAcquisitionTest_msg_rx_sptr(new BeidouB3iPcpsAcquisitionTest_msg_rx()); +} + + +void BeidouB3iPcpsAcquisitionTest_msg_rx::msg_handler_events(pmt::pmt_t msg) +{ + try + { + int64_t message = pmt::to_long(std::move(msg)); + rx_message = message; + } + catch (boost::bad_any_cast &e) + { + LOG(WARNING) << "msg_handler_telemetry Bad any cast!"; + rx_message = 0; + } +} + + +BeidouB3iPcpsAcquisitionTest_msg_rx::BeidouB3iPcpsAcquisitionTest_msg_rx() : gr::block("BeidouB3iPcpsAcquisitionTest_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->set_msg_handler(pmt::mp("events"), boost::bind(&BeidouB3iPcpsAcquisitionTest_msg_rx::msg_handler_events, this, _1)); + rx_message = 0; +} + + +BeidouB3iPcpsAcquisitionTest_msg_rx::~BeidouB3iPcpsAcquisitionTest_msg_rx() = default; + + +// ########################################################### + +class BeidouB3iPcpsAcquisitionTest : public ::testing::Test +{ +protected: + BeidouB3iPcpsAcquisitionTest() + { + factory = std::make_shared(); + config = std::make_shared(); + item_size = sizeof(gr_complex); + gnss_synchro = Gnss_Synchro(); + doppler_max = 5000; + doppler_step = 100; + } + + ~BeidouB3iPcpsAcquisitionTest() = default; + + void init(); + void plot_grid(); + + gr::top_block_sptr top_block; + std::shared_ptr factory; + std::shared_ptr config; + Gnss_Synchro gnss_synchro{}; + size_t item_size; + unsigned int doppler_max; + unsigned int doppler_step; +}; + + +void BeidouB3iPcpsAcquisitionTest::init() +{ + gnss_synchro.Channel_ID = 0; + gnss_synchro.System = 'C'; + std::string signal = "B3"; + signal.copy(gnss_synchro.Signal, 2, 0); + gnss_synchro.PRN = 1; + config->set_property("GNSS-SDR.internal_fs_sps", "50000000"); + config->set_property("Acquisition_B3.implementation", "BEIDOU_B3I_PCPS_Acquisition"); + config->set_property("Acquisition_B3.item_type", "gr_complex"); + config->set_property("Acquisition_B3.coherent_integration_time_ms", "1"); + if (FLAGS_plot_acq_grid == true) + { + config->set_property("Acquisition_B3.dump", "true"); + } + else + { + config->set_property("Acquisition_B3.dump", "false"); + } + config->set_property("Acquisition_B3.dump_filename", "./tmp-acq-bds-b3i/acquisition"); + config->set_property("Acquisition_B3.dump_channel", "1"); + config->set_property("Acquisition_B3.threshold", "0.00001"); + config->set_property("Acquisition_B3.doppler_max", std::to_string(doppler_max)); + config->set_property("Acquisition_B3.doppler_step", std::to_string(doppler_step)); + config->set_property("Acquisition_B3.repeat_satellite", "false"); +} + + +void BeidouB3iPcpsAcquisitionTest::plot_grid() +{ + //load the measured values + std::string basename = "./tmp-acq-bds-b3i/acquisition_C_B3"; + auto sat = static_cast(gnss_synchro.PRN); + + auto samples_per_code = static_cast(round(50000000 / (BEIDOU_B3I_CODE_RATE_HZ / BEIDOU_B3I_CODE_LENGTH_CHIPS))); // !! + Acquisition_Dump_Reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code, 1); + + if (!acq_dump.read_binary_acq()) + { + std::cout << "Error reading files" << std::endl; + } + + std::vector *doppler = &acq_dump.doppler; + std::vector *samples = &acq_dump.samples; + std::vector > *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(); + const std::string &gnuplot_path = dir.native(); + Gnuplot::set_GNUPlotPath(gnuplot_path); + + Gnuplot g1("lines"); + if (FLAGS_show_plots) + { + g1.showonscreen(); // window output + } + else + { + g1.disablescreen(); + } + g1.set_title("BeiDou B3I 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("BDS_B3I_acq_grid"); + g1.savetopdf("BDS_B3I_acq_grid"); + } + catch (const GnuplotException &ge) + { + std::cout << ge.what() << std::endl; + } + } + std::string data_str = "./tmp-acq-bds-b3i"; + if (boost::filesystem::exists(data_str)) + { + boost::filesystem::remove_all(data_str); + } +} + + +TEST_F(BeidouB3iPcpsAcquisitionTest, Instantiate) +{ + init(); + boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_B3", 1, 0); +} + + +TEST_F(BeidouB3iPcpsAcquisitionTest, ConnectAndRun) +{ + int fs_in = 50000000; + int nsamples = 50000; + std::chrono::time_point start, end; + std::chrono::duration elapsed_seconds(0); + gr::msg_queue::sptr queue = gr::msg_queue::make(0); + + top_block = gr::make_top_block("Acquisition test"); + init(); + boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_B3", 1, 0); + boost::shared_ptr msg_rx = BeidouB3iPcpsAcquisitionTest_msg_rx_make(); + + ASSERT_NO_THROW({ + acquisition->connect(top_block); + boost::shared_ptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0)); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + top_block->connect(source, 0, valve, 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")); + }) << "Failure connecting the blocks of acquisition test."; + + 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::cout << "Processed " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; +} + + +TEST_F(BeidouB3iPcpsAcquisitionTest, ValidationOfResults) +{ + std::chrono::time_point start, end; + std::chrono::duration elapsed_seconds(0.0); + top_block = gr::make_top_block("Acquisition test"); + + double expected_delay_samples = 3380; + double expected_doppler_hz = 700; + + init(); + + if (FLAGS_plot_acq_grid == true) + { + std::string data_str = "./tmp-acq-bds-b3i"; + if (boost::filesystem::exists(data_str)) + { + boost::filesystem::remove_all(data_str); + } + boost::filesystem::create_directory(data_str); + } + + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_B3", 1, 0); + boost::shared_ptr msg_rx = BeidouB3iPcpsAcquisitionTest_msg_rx_make(); + + ASSERT_NO_THROW({ + acquisition->set_channel(1); + }) << "Failure setting channel."; + + ASSERT_NO_THROW({ + acquisition->set_gnss_synchro(&gnss_synchro); + }) << "Failure setting gnss_synchro."; + + ASSERT_NO_THROW({ + acquisition->set_threshold(0.0002); + }) << "Failure setting threshold."; + + ASSERT_NO_THROW({ + acquisition->set_doppler_max(doppler_max); + }) << "Failure setting doppler_max."; + + ASSERT_NO_THROW({ + acquisition->set_doppler_step(doppler_step); + }) << "Failure setting doppler_step."; + + ASSERT_NO_THROW({ + acquisition->connect(top_block); + }) << "Failure connecting acquisition to the top_block."; + + ASSERT_NO_THROW({ + std::string path = std::string(TEST_PATH); + std::string file = path + "signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat"; + const char *file_name = file.c_str(); + 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->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); + }) << "Failure connecting the blocks of acquisition test."; + + acquisition->set_local_code(); + acquisition->set_state(1); // Ensure that acquisition starts at the first sample + acquisition->init(); + + 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."; + + uint64_t nsamples = gnss_synchro.Acq_samplestamp_samples; + std::cout << "Acquired " << nsamples << " samples in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; + ASSERT_EQ(1, msg_rx->rx_message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; + + double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); + auto delay_error_chips = static_cast(delay_error_samples * BEIDOU_B3I_CODE_LENGTH_CHIPS / 50000); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + + 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"; + + if (FLAGS_plot_acq_grid == true) + { + plot_grid(); + } +} diff --git a/src/utils/matlab/dll_pll_veml_plot_sample.m b/src/utils/matlab/dll_pll_veml_plot_sample.m index ce4c3d087..2cd61d101 100644 --- a/src/utils/matlab/dll_pll_veml_plot_sample.m +++ b/src/utils/matlab/dll_pll_veml_plot_sample.m @@ -36,7 +36,7 @@ end samplingFreq = 25000000; %[Hz] coherent_integration_time_ms = 1; %[ms] -channels = 10; % Number of channels +channels = 1; % Number of channels first_channel = 0; % Number of the first channel path = '/home/dmiralles/Documents/gnss-sdr/'; %% CHANGE THIS PATH diff --git a/src/utils/matlab/plot_acq_grid.m b/src/utils/matlab/plot_acq_grid.m index 53412376c..e903b0245 100644 --- a/src/utils/matlab/plot_acq_grid.m +++ b/src/utils/matlab/plot_acq_grid.m @@ -26,15 +26,12 @@ % ------------------------------------------------------------------------- % -%%%%%%%%% ?????? CONFIGURE !!! %%%%%%%%%%%%% - -path = '/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/'; %% CHANGE THIS PATH -file = 'bds_b3i_acq'; - -sat = 27; - +%% Configuration +path = '/home/dmiralles/Documents/gnss-sdr/'; +file = 'bds_acq'; +sat = 6; channel = 0; -execution = 6; +execution = 4; % Signal: % 1 GPS L1 % 2 GPS L2M @@ -42,17 +39,21 @@ execution = 6; % 4 Gal. E1B % 5 Gal. E5 % 6 Glo. 1G -% 7 BDS B1 +% 7 Glo. 2G +% 8 BDS. B1 +% 9 BDS. B3 +% 10 BDS. B2a signal_type = 8; -%%% True for light acq_grid representation +%%% True for light grid representation lite_view = true; %%% If lite_view, it sets the number of samples per chip in the graphical representation n_samples_per_chip = 3; +d_samples_per_code = 25000; -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% Load data switch(signal_type) case 1 @@ -80,45 +81,59 @@ switch(signal_type) system = 'R'; signal = '1G'; case 7 - n_chips = 2046; + n_chips = 511; + system = 'R'; + signal = '2G'; + case 8 + n_chips = 2048; system = 'C'; signal = 'B1'; - case 8 + case 9 n_chips = 10230; system = 'C'; - signal = 'B3'; + signal = 'B3'; + case 10 + n_chips = 10230; + system = 'C'; + signal = '5C'; end filename = [path file '_' system '_' signal '_ch_' num2str(channel) '_' num2str(execution) '_sat_' num2str(sat) '.mat']; load(filename); -[n_fft n_dop_bins] = size(acq_grid); -[d_max f_max] = find(acq_grid == max(max(acq_grid))); -freq = (0 : n_dop_bins - 1) * doppler_step - doppler_max; +[n_fft, n_dop_bins] = size(acq_grid); +[d_max, f_max] = find(acq_grid == max(max(acq_grid))); +freq = (0 : n_dop_bins - 1) * double(doppler_step) - double(doppler_max); delay = (0 : n_fft - 1) / n_fft * n_chips; + + +%% Plot data +%--- Acquisition grid (3D) figure(1) if(lite_view == false) surf(freq, delay, acq_grid, 'FaceColor', 'interp', 'LineStyle', 'none') ylim([min(delay) max(delay)]) else delay_interp = (0 : n_samples_per_chip * n_chips - 1) / n_samples_per_chip; - acq_grid_interp = spline(delay, acq_grid', delay_interp)'; - surf(freq, delay_interp, acq_grid_interp, 'FaceColor', 'interp', 'LineStyle', 'none') + grid_interp = spline(delay, acq_grid', delay_interp)'; + surf(freq, delay_interp, grid_interp, 'FaceColor', 'interp', 'LineStyle', 'none') ylim([min(delay_interp) max(delay_interp)]) end -xlabel('Doppler shift / Hz') +xlabel('Doppler shift (Hz)') xlim([min(freq) max(freq)]) -ylabel('Code delay / chips') -zlabel('Test statistics') +ylabel('Code delay (chips)') +zlabel('Test Statistics') + +%--- Acquisition grid (2D) figure(2) subplot(2,1,1) plot(freq, acq_grid(d_max, :)) xlim([min(freq) max(freq)]) -xlabel('Doppler shift / Hz') +xlabel('Doppler shift (Hz)') ylabel('Test statistics') title(['Fixed code delay to ' num2str((d_max - 1) / n_fft * n_chips) ' chips']) subplot(2,1,2) normalization = (d_samples_per_code^4) * input_power; -plot(delay, acq_acq_grid(:, f_max)./normalization) +plot(delay, acq_grid(:, f_max)./normalization) xlim([min(delay) max(delay)]) -xlabel('Code delay / chips') +xlabel('Code delay (chips)') ylabel('Test statistics') title(['Doppler wipe-off = ' num2str((f_max - 1) * doppler_step - doppler_max) ' Hz'])