diff --git a/AUTHORS b/AUTHORS index 0416cfe97..da4b589f9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,56 +1,56 @@ -GNSS-SDR Authorship ------------------------------------------------------------------------------- - -The GNSS-SDR project is hosted and sponsored by the Centre Tecnologic de -Telecomunicacions de Catalunya (CTTC), a non-profit research foundation located -in Castelldefels (40.396764 N, 3.713379 E), 20 km south of Barcelona, Spain. -GNSS-SDR is the by-product of GNSS research conducted at the Communications -Systems Division of CTTC, and it is the combined effort of students, -software engineers and researchers from different institutions around the World. - -Contact Information ------------------------------------------------------------------------------- - GNSS-SDR Homepage - ---------------------------- - https://gnss-sdr.org - - - CTTC Homepage - ---------------------------- - http://www.cttc.cat - - - Mailing Lists - ---------------------------- - gnss-sdr-developers@lists.sourceforge.net - https://lists.sourceforge.net/lists/listinfo/gnss-sdr-developers - - - Email - ---------------------------- - Inquiries beyond the mailing list can be sent to carles.fernandez@cttc.cat - - -List of authors ------------------------------------------------------------------------------- -Carles Fernandez-Prades carles.fernandez@cttc.cat Project manager -Javier Arribas javier.arribas@cttc.es Developer -Luis Esteve Elfau luis@epsilon-formacion.com Developer -Antonio Ramos antonio.ramos@cttc.es Developer -Marc Majoral marc.majoral@cttc.cat Developer -Pau Closas pau.closas@northeastern.edu Consultant -Jordi Vila-Valls jordi.vila@cttc.cat Consultant -Carlos Aviles carlos.avilesr@googlemail.com Contributor -David Pubill david.pubill@cttc.cat Contributor -Mara Branzanti mara.branzanti@gmail.com Contributor -Marc Molina marc.molina.pena@gmail.com Contributor -Daniel Fehr daniel.co@bluewin.ch Contributor -Marc Sales marcsales92@gmail.com Contributor -Damian Miralles dmiralles2009@gmail.com Contributor -Andres Cecilia Luque a.cecilia.luque@gmail.com Contributor -Leonardo Tonetto tonetto.dev@gmail.com Contributor -Anthony Arnold anthony.arnold@uqconnect.edu.au Contributor -Fran Fabra fabra@ice.csic.es Contributor -Cillian O'Driscoll cillian.odriscoll@gmail.com Contributor -Gabriel Araujo gabriel.araujo.5000@gmail.com Contributor -Carlos Paniego carpanie@hotmail.com Artwork +GNSS-SDR Authorship +------------------------------------------------------------------------------ + +The GNSS-SDR project is hosted and sponsored by the Centre Tecnològic de +Telecomunicacions de Catalunya (CTTC), a non-profit research foundation located +in Castelldefels (40.396764 N, 3.713379 E), 20 km south of Barcelona, Spain. +GNSS-SDR is the by-product of GNSS research conducted at the Communications +Systems Division of CTTC, and it is the combined effort of students, +software engineers and researchers from different institutions around the World. + +Contact Information +------------------------------------------------------------------------------ + GNSS-SDR Homepage + ---------------------------- + https://gnss-sdr.org + + + CTTC Homepage + ---------------------------- + http://www.cttc.cat + + + Mailing Lists + ---------------------------- + gnss-sdr-developers@lists.sourceforge.net + https://lists.sourceforge.net/lists/listinfo/gnss-sdr-developers + + + Email + ---------------------------- + Inquiries beyond the mailing list can be sent to carles.fernandez@cttc.cat + + +List of authors +------------------------------------------------------------------------------ +Carles Fernández-Prades carles.fernandez@cttc.cat Project manager +Javier Arribas javier.arribas@cttc.es Developer +Luis Esteve Elfau luis@epsilon-formacion.com Developer +Antonio Ramos antonio.ramosdet@gmail.com Developer +Marc Majoral marc.majoral@cttc.cat Developer +Jordi Vilà-Valls jordi.vila@cttc.cat Consultant +Pau Closas pau.closas@northeastern.edu Consultant +Andres Cecilia Luque a.cecilia.luque@gmail.com Contributor +Anthony Arnold anthony.arnold@uqconnect.edu.au Contributor +Carlos Avilés carlos.avilesr@googlemail.com Contributor +Cillian O'Driscoll cillian.odriscoll@gmail.com Contributor +Damian Miralles dmiralles2009@gmail.com Contributor +Daniel Fehr daniel.co@bluewin.ch Contributor +David Pubill david.pubill@cttc.cat Contributor +Fran Fabra fabra@ice.csic.es Contributor +Gabriel Araujo gabriel.araujo.5000@gmail.com Contributor +Leonardo Tonetto tonetto.dev@gmail.com Contributor +Mara Branzanti mara.branzanti@gmail.com Contributor +Marc Molina marc.molina.pena@gmail.com Contributor +Marc Sales marcsales92@gmail.com Contributor +Carlos Paniego carpanie@hotmail.com Artwork diff --git a/CMakeLists.txt b/CMakeLists.txt index fbdd1fd67..c1f798eb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,8 @@ option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF) option(ENABLE_PLUTOSDR "Enable the use of ADALM-PLUTO Evaluation Boards (Analog Devices Inc.), requires gr-iio" OFF) option(ENABLE_FMCOMMS2 "Enable the use of FMCOMMS4-EBZ + ZedBoard hardware, requires gr-iio" OFF) -option(ENABLE_AD9361 "Enable the use of AD9361 directo to FPGA hardware, requires gr-iio" OFF) +option(ENABLE_AD9361 "Enable the use of AD9361 directo to FPGA hardware, requires libiio" OFF) +option(ENABLE_RAW_UDP "Enable the use of high-optimized custom UDP packet sample source, requires libpcap" OFF) # Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) @@ -825,9 +826,9 @@ ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/c # Ensure that aclocal and libtool are present if(OS_IS_LINUX) if(EXISTS "/usr/bin/libtoolize") - if(EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") + if(EXISTS "/usr/bin/aclocal" OR EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") # Everything ok, we can move on - else(EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") + else(EXISTS "/usr/bin/aclocal" OR EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") message(" aclocal has not been found.") message(" You can try to install it by typing:") if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") @@ -838,7 +839,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/c message(" sudo apt-get install automake") endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") message(FATAL_ERROR "aclocal is required to build glog from source") - endif(EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") + endif(EXISTS "/usr/bin/aclocal" OR EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") else(EXISTS "/usr/bin/libtoolize") message(" libtool has not been found.") message(" You can try to install it by typing:") @@ -989,7 +990,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) ExternalProject_Add( armadillo-${armadillo_RELEASE} PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE} - GIT_REPOSITORY https://github.com/conradsnicta/armadillo-code.git + GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git GIT_TAG ${armadillo_BRANCH} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE} @@ -1002,7 +1003,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) ExternalProject_Add( armadillo-${armadillo_RELEASE} PREFIX ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE} - GIT_REPOSITORY https://github.com/conradsnicta/armadillo-code.git + GIT_REPOSITORY https://gitlab.com/conradsnicta/armadillo-code.git GIT_TAG ${armadillo_BRANCH} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/armadillo/armadillo-${armadillo_RELEASE} BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/armadillo-${armadillo_RELEASE} @@ -1119,9 +1120,9 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") message(FATAL_ERROR "libtool is required to build matio from source") endif(NOT EXISTS "/usr/bin/libtoolize") - if(EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") + if(EXISTS "/usr/bin/aclocal" OR EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") message(STATUS "Automake found.") - else(EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") + else(EXISTS "/usr/bin/aclocal" OR EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") message(" aclocal has not been found.") message(" You can try to install it by typing:") if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") @@ -1132,7 +1133,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS message(" sudo apt-get install automake") endif(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") message(FATAL_ERROR "aclocal is required to build matio from source") - endif(EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") + endif(EXISTS "/usr/bin/aclocal" OR EXISTS "/usr/bin/aclocal-1.16" OR EXISTS "/usr/bin/aclocal-1.15" OR EXISTS "/usr/bin/aclocal-1.14" OR EXISTS "/usr/bin/aclocal-1.13" OR EXISTS "/usr/bin/aclocal-1.11" OR EXISTS "/usr/bin/aclocal-1.10") endif(OS_IS_LINUX) find_package(HDF5) if(HDF5_FOUND) @@ -1321,6 +1322,16 @@ else(ENABLE_CUDA) message(STATUS "Enable it with 'cmake -DENABLE_CUDA=ON ../' to add support for GPU-based acceleration using CUDA." ) endif(ENABLE_CUDA) +############################################################################### +# CUSTOM UDP PACKET SOURCE (OPTIONAL) +############################################################################### +if(ENABLE_RAW_UDP) + message(STATUS "High-optimized custom UDP ip packet source will be enabled." ) + message(STATUS "You can disable it with 'cmake -DENABLE_RAW_UDP=OFF ../'" ) +else(ENABLE_RAW_UDP) + message(STATUS "High-optimized custom UDP ip packet source will be enabled." ) + message(STATUS "You can disable it with 'cmake -DENABLE_RAW_UDP=OFF ../'" ) +endif(ENABLE_RAW_UDP) ############################################################################### @@ -1455,7 +1466,6 @@ if(ENABLE_GPROF) endif(ENABLE_GPROF) - ######################################################################## # Set compiler flags ######################################################################## diff --git a/MANIFEST.md b/MANIFEST.md index ad39cfa7a..d98411e9f 100644 --- a/MANIFEST.md +++ b/MANIFEST.md @@ -5,17 +5,18 @@ tags: - gnss - gps - Galileo + - Glonass author: - Carles Fernandez-Prades - Javier Arribas - et altri (see AUTHORS file for a list of contributors) copyright_owner: - The Authors -dependencies: gnuradio (>= 3.7.3), armadillo, gflags, glog, gnutls +dependencies: gnuradio (>= 3.7.3), armadillo, gflags, glog, gnutls, matio license: GPLv3+ repo: https://github.com/gnss-sdr/gnss-sdr website: https://gnss-sdr.org -icon: https://a.fsdn.com/con/app/proj/gnss-sdr/screenshots/logo400x400.jpg +icon: https://raw.githubusercontent.com/gnss-sdr/gnss-sdr/master/docs/doxygen/images/gnss-sdr_logo.png --- Global Navigation Satellite Systems receiver defined by software. It performs all the signal processing from raw signal samples up to the computation of the Position-Velocity-Time solution, diff --git a/README.md b/README.md index 55eb8d21b..9fe634565 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,20 @@ This program is a software-defined receiver which is able to process (that is, to perform detection, synchronization, demodulation and decoding of the navigation message, computation of observables and, finally, computation of position fixes) the following Global Navigation Satellite System's signals: -In the L1 band (centered at 1575.42 MHz): - - 🛰 GPS L1 C/A :white_check_mark: - - 🛰 Galileo E1b/c :white_check_mark: - - 🛰 GLONASS L1 C/A :white_check_mark: +In the L1 band: + - 🛰 GPS L1 C/A (centered at 1575.42 MHz) :white_check_mark: + - 🛰 Galileo E1b/c (centered at 1575.42 MHz) :white_check_mark: + - 🛰 GLONASS L1 C/A (centered at 1601.72 MHz) :white_check_mark: -In the L2 band (centered at 1227.60 MHz): - - 🛰 GPS L2C :white_check_mark: - - 🛰 GLONASS L2 C/A :white_check_mark: +In the L2 band: + - 🛰 GPS L2C (centered at 1227.60 MHz) :white_check_mark: + - 🛰 GLONASS L2 C/A (centered at 1246 MHz) :white_check_mark: -In the L5 band (centered at 1176.45 MHz): - - 🛰 GPS L5 :white_check_mark: - - 🛰 Galileo E5a :white_check_mark: +In the L5 band: + - 🛰 GPS L5 (centered at 1176.45 MHz) :white_check_mark: + - 🛰 Galileo E5a (centered at 1176.45 MHz) :white_check_mark: -GNSS-SDR provides interfaces for a wide range of radio frequency front-ends, generates processing outputs in standard formats, allows for the full inspection of the whole signal processing chain, and offers a framework for the development of new features. Please visit [https://gnss-sdr.org](https://gnss-sdr.org "GNSS-SDR website") for more information about this open source software-defined GNSS receiver. +GNSS-SDR provides interfaces for a wide range of radio frequency front-ends and raw sample file formats, generates processing outputs in standard formats, allows for the full inspection of the whole signal processing chain, and offers a framework for the development of new features. Please visit [https://gnss-sdr.org](https://gnss-sdr.org "GNSS-SDR website") for more information about this open source software-defined GNSS receiver. @@ -64,7 +64,7 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev \ libboost-serialization-dev liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr \ libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev \ - libgnutls-openssl-dev python-mako python-six libmatio-dev googletest + libgnutls-openssl-dev libpcap-dev python-mako python-six libmatio-dev googletest ~~~~~~ Please note that `googletest` was named `libgtest-dev` in distributions older than Debian 9 "stretch" and Ubuntu 17.04 "zesty". @@ -85,7 +85,7 @@ $ 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 python-mako python-six + glog-devel openssl-devel libpcap-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). @@ -102,7 +102,7 @@ $ sudo yum install make automake gcc gcc-c++ kernel-devel libtool \ hdf5-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 \ - armadillo-devel openssl-devel python-mako python-six + armadillo-devel openssl-devel libpcap-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). @@ -113,15 +113,15 @@ If you are using Arch Linux (with base-devel group installed): ~~~~~~ $ pacman -S cmake git boost boost-libs log4cpp libvolk gnuradio gnuradio-osmosdr \ - blas lapack gflags google-glog gnutls openssl python2-mako python2-six \ - libmatio gtest + blas lapack gflags google-glog openssl python2-mako python2-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). ### 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](http://gnuradio.org/pybombs "Python Build Overlay Managed Bundle System wiki") (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. +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. First of all, install some basic packages: @@ -182,18 +182,19 @@ or manually as explained below, and then please follow instructions on how to [d #### Install [Armadillo](http://arma.sourceforge.net/ "Armadillo's Homepage"), a C++ linear algebra library: ~~~~~~ -$ sudo apt-get install libopenblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint +$ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint $ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE -$ wget http://sourceforge.net/projects/arma/files/armadillo-8.500.0.tar.xz -$ tar xvfz armadillo-8.500.0.tar.xz -$ cd armadillo-8.500.0 +$ sudo pacman -S blas lapack # For Arch Linux +$ wget https://sourceforge.net/projects/arma/files/armadillo-8.500.1.tar.xz +$ tar xvfz armadillo-8.500.1.tar.xz +$ cd armadillo-8.500.1 $ cmake . $ make $ sudo make install ~~~~~~ -The full stop separated from ```cmake``` by a space is important. [CMake](http://www.cmake.org/ "CMake's Homepage") will figure out what other libraries are currently installed and will modify Armadillo's configuration correspondingly. CMake will also generate a run-time armadillo library, which is a combined alias for all the relevant libraries present on your system (eg. BLAS, LAPACK and ATLAS). +The full stop separated from ```cmake``` by a space is important. [CMake](https://cmake.org/ "CMake's Homepage") will figure out what other libraries are currently installed and will modify Armadillo's configuration correspondingly. CMake will also generate a run-time armadillo library, which is a combined alias for all the relevant libraries present on your system (eg. BLAS, LAPACK and ATLAS). @@ -245,11 +246,13 @@ changing `/home/username/googletest-release-1.8.0/googletest` by the actual dire -#### Install the [GnuTLS](http://www.gnutls.org/ "GnuTLS's Homepage") or [OpenSSL](https://www.openssl.org/ "OpenSSL's Homepage") libraries: +#### Install the [GnuTLS](https://www.gnutls.org/ "GnuTLS's Homepage") or [OpenSSL](https://www.openssl.org/ "OpenSSL's Homepage") libraries: ~~~~~~ $ sudo apt-get install libgnutls-openssl-dev # For Debian/Ubuntu/LinuxMint $ sudo yum install openssl-devel # For Fedora/CentOS/RHEL +$ sudo zypper install openssl-devel # For OpenSUSE +$ sudo pacman -S openssl # For Arch Linux ~~~~~~ In case the GnuTLS library with openssl extensions package is not available in your GNU/Linux distribution, GNSS-SDR can also work well with OpenSSL. @@ -516,7 +519,7 @@ More details can be found in our tutorial about [GNSS-SDR configuration options ### macOS 10.13 (High Sierra) and 10.12 (Sierra), Mac OS X 10.11 (El Capitan), 10.10 (Yosemite) and 10.9 (Mavericks). -If you still have not installed [Xcode](http://developer.apple.com/xcode/ "Xcode"), do it now from the App Store (it's free). You will also need the Xcode Command Line Tools. Launch the Terminal, found in /Applications/Utilities/, and type: +If you still have not installed [Xcode](https://developer.apple.com/xcode/ "Xcode"), do it now from the App Store (it's free). You will also need the Xcode Command Line Tools. Launch the Terminal, found in /Applications/Utilities/, and type: ~~~~~~ $ xcode-select --install @@ -532,7 +535,7 @@ Software pre-requisites can be installed using either [Macports](#macports) or [ #### Macports -First, [install Macports](http://www.macports.org/install.php). If you are upgrading from a previous installation, please follow the [migration rules](http://trac.macports.org/wiki/Migration). +First, [install Macports](https://www.macports.org/install.php). If you are upgrading from a previous installation, please follow the [migration rules](https://trac.macports.org/wiki/Migration). In a terminal, type: @@ -625,7 +628,7 @@ GNSS-SDR comes with a library which is a module of the Vector-Optimized Library ###### Other package managers -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](http://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: +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 ../ @@ -646,7 +649,7 @@ Other builds --------- * **Docker container**: A technology providing operating-system-level virtualization to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud. Visit [https://github.com/carlesfernandez/docker-gnsssdr](https://github.com/carlesfernandez/docker-gnsssdr) or [https://github.com/carlesfernandez/docker-pybombs-gnsssdr](https://github.com/carlesfernandez/docker-pybombs-gnsssdr) for instructions. -* **Snap packages**: [Snaps](http://snapcraft.io) are universal Linux packages aimed to work on any distribution or device, from IoT devices to servers, desktops to mobile devices. Visit [https://github.com/carlesfernandez/snapcraft-sandbox](https://github.com/carlesfernandez/snapcraft-sandbox) for instructions. +* **Snap packages**: [Snaps](https://snapcraft.io) are universal Linux packages aimed to work on any distribution or device, from IoT devices to servers, desktops to mobile devices. Visit [https://github.com/carlesfernandez/snapcraft-sandbox](https://github.com/carlesfernandez/snapcraft-sandbox) for instructions. * **GNSS-SDR in embedded platforms**: we provide a Software Development Kit (SDK) based on [OpenEmbedded](http://www.openembedded.org/wiki/Main_Page) for cross-compiling GNSS-SDR in your desktop computer and for producing executables that can run in embedded platforms, such as a Zedboard or a Raspberry Pi 3. Visit [Cross-compiling GNSS-SDR](https://gnss-sdr.org/docs/tutorials/cross-compiling/) for instructions. @@ -694,11 +697,11 @@ Getting started 1. After building the code, you will find the ```gnss-sdr``` executable file at gnss-sdr/install. You can make it available everywhere else by ```sudo make install```. Run the profilers ```volk_profile``` and ```volk_gnsssdr_profile``` for testing all available VOLK kernels for each architecture supported by your processor. This only has to be done once. 2. In post-processing mode, you have to provide a captured GNSS signal file. 1. The signal file can be easily recorded using the GNU Radio file sink in ```gr_complex``` mode. - 2. You will need a GPS active antenna, a [USRP](http://www.ettus.com/product) and a suitable USRP daughter board to receive GPS L1 C/A signals. GNSS-SDR require to have at least 2 MHz of bandwidth in 1.57542 GHz. (remember to enable the DC bias with the daughter board jumper). + 2. You will need a GPS active antenna, a [USRP](https://www.ettus.com/product) and a suitable USRP daughter board to receive GPS L1 C/A signals. GNSS-SDR require to have at least 2 MHz of bandwidth in 1.57542 GHz. (remember to enable the DC bias with the daughter board jumper). We use a [DBSRX2](https://www.ettus.com/product/details/DBSRX2) to do the task, but you can try the newer Ettus' daughter boards as well. 3. The easiest way to capture a signal file is to use the GNU Radio Companion GUI. Only two blocks are needed: a USRP signal source connected to complex float file sink. You need to tune the USRP central frequency and decimation factor using USRP signal source properties box. We suggest using a decimation factor of 20 if you use the USRP2. This will give you 100/20 = 5 MSPS which will be enough to receive GPS L1 C/A signals. The front-end gain should also be configured. In our test with the DBSRX2 we obtained good results with ```G=50```. 4. Capture at least 80 seconds of signal in open sky conditions. During the process, be aware of USRP driver buffer underruns messages. If your hard disk is not fast enough to write data at this speed you can capture to a virtual RAM drive. 80 seconds of signal at 5 MSPS occupies less than 3 Gbytes using ```gr_complex```. - 5. If you have no access to an RF front-end, you can download a sample raw data file (that contains GPS and Galileo signals) from [here](http://sourceforge.net/projects/gnss-sdr/files/data/). + 5. If you have no access to an RF front-end, you can download a sample raw data file (that contains GPS and Galileo signals) from [here](https://sourceforge.net/projects/gnss-sdr/files/data/). 3. You are ready to configure the receiver to use your captured file among other parameters: 1. The default configuration file resides at [/usr/local/share/gnss-sdr/conf/default.conf](./conf/gnss-sdr.conf). 2. You need to review/modify at least the following settings: @@ -764,7 +767,7 @@ The name of these parameters can be anything but one reserved word: implementati SignalConditioner.implementation=Pass_Through ~~~~~~ -Since the configuration is just a set of property names and values without any meaning or syntax, the system is very versatile and easily extendable. Adding new properties to the system only implies modifications in the classes that will make use of these properties. In addition, the configuration files are not checked against any strict syntax so it is always in a correct status (as long as it contains pairs of property names and values in the [INI format](http://en.wikipedia.org/wiki/INI_file)). +Since the configuration is just a set of property names and values without any meaning or syntax, the system is very versatile and easily extendable. Adding new properties to the system only implies modifications in the classes that will make use of these properties. In addition, the configuration files are not checked against any strict syntax so it is always in a correct status (as long as it contains pairs of property names and values in the [INI format](https://en.wikipedia.org/wiki/INI_file)). @@ -875,7 +878,7 @@ SignalSource.big_endian_bytes=false ***Example: UHD Signal Source*** -The user may prefer to use a [UHD](http://code.ettus.com/redmine/ettus/projects/uhd/wiki)-compatible RF front-end and try real-time processing. For instance, for a USRP1 + DBSRX daughterboard, use: +The user may prefer to use a [UHD](https://files.ettus.com/manual/)-compatible RF front-end and try real-time processing. For instance, for a USRP1 + DBSRX daughterboard, use: ~~~~~~ ;######### SIGNAL_SOURCE CONFIG ############ @@ -1031,7 +1034,7 @@ More documentation at the [Data Type Adapter Blocks page](https://gnss-sdr.org/d #### Input filter -This block filters the input data. It can be combined with frequency translation for IF signals. The computation of the filter taps is based on parameters of GNU Radio's function [pm_remez](http://gnuradio.org/doc/doxygen/pm__remez_8h.html), that calculates the optimal (in the Chebyshev/minimax sense) FIR filter impulse response given a set of band edges, the desired response on those bands, and the weight given to the error in those bands. +This block filters the input data. It can be combined with frequency translation for IF signals. The computation of the filter taps is based on parameters of GNU Radio's function [pm_remez](https://gnuradio.org/doc/doxygen/pm__remez_8h.html), that calculates the optimal (in the Chebyshev/minimax sense) FIR filter impulse response given a set of band edges, the desired response on those bands, and the weight given to the error in those bands. The block can be configured like this: @@ -1156,7 +1159,7 @@ More documentation at the [Channels page](https://gnss-sdr.org/docs/sp-blocks/ch #### Acquisition -The first task of a GNSS receiver is to detect the presence or absence of in-view satellites. This is done by the acquisition system process, which also provides a coarse estimation of two signal parameters: the frequency shift with respect to the nominal IF frequency, and a delay term which allows the receiver to create a local code aligned with the incoming code. [AcquisitionInterface](./src/core/interfaces/acquisition_interface.h) is the common interface for all the acquisition algorithms and their corresponding implementations. Algorithms' interface, that may vary depending on the use of information external to the receiver, such as in Assisted GNSS, is defined in classes referred to as *adapters*. These adapters wrap the GNU Radio blocks interface into a compatible interface expected by AcquisitionInterface. This allows the use of existing GNU Radio blocks derived from ```gr::block```, and ensures that newly developed implementations will also be reusable in other GNU Radio-based applications. Moreover, it adds still another layer of abstraction, since each given acquisition algorithm can have different implementations (for instance using different numerical libraries). In such a way, implementations can be continuously improved without having any impact neither on the algorithm interface nor the general acquisition interface. +The first task of a GNSS receiver is to detect the presence or absence of in-view satellites. This is done by the acquisition system process, which also provides a coarse estimation of two signal parameters: the frequency shift with respect to the nominal frequency, and a delay term which allows the receiver to create a local code aligned with the incoming code. [AcquisitionInterface](./src/core/interfaces/acquisition_interface.h) is the common interface for all the acquisition algorithms and their corresponding implementations. Algorithms' interface, that may vary depending on the use of information external to the receiver, such as in Assisted GNSS, is defined in classes referred to as *adapters*. These adapters wrap the GNU Radio blocks interface into a compatible interface expected by AcquisitionInterface. This allows the use of existing GNU Radio blocks derived from ```gr::block```, and ensures that newly developed implementations will also be reusable in other GNU Radio-based applications. Moreover, it adds still another layer of abstraction, since each given acquisition algorithm can have different implementations (for instance using different numerical libraries). In such a way, implementations can be continuously improved without having any impact neither on the algorithm interface nor the general acquisition interface. Check [GpsL1CaPcpsAcquisition](./src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h) and [GalileoE1PcpsAmbiguousAcquisition](./src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h) for examples of adapters from a Parallel Code Phase Search (PCPS) acquisition block, and [pcps_acquisition_cc](./src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.h) for an example of a block implementation. The source code of all the available acquisition algorithms is located at: @@ -1169,14 +1172,13 @@ Check [GpsL1CaPcpsAcquisition](./src/algorithms/acquisition/adapters/gps_l1_ca_p |---------gnuradio_blocks <- Signal processing blocks implementation ~~~~~~ -The user can select a given implementation for the algorithm to be used in each receiver channel, as well as their parameters, in the configuration file. For a GPS l1 C/A receiver: +The user can select a given implementation for the algorithm to be used in each receiver channel, as well as their parameters, in the configuration file. For a GPS L1 C/A receiver: ~~~~~~ ;######### ACQUISITION GLOBAL CONFIG ############ Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition ; Acquisition algorithm selection for this channel Acquisition_1C.item_type=gr_complex -Acquisition_1C.if=0 ; Signal intermediate frequency in [Hz] -Acquisition_1C.sampled_ms=1 ; Signal block duration for the acquisition signal detection [ms] +Acquisition_1C.coherent_integration_time_ms=1 ; Signal block duration for the acquisition signal detection [ms] Acquisition_1C.threshold=0.005 ; Acquisition threshold Acquisition_1C.pfa=0.0001 ; Acquisition false alarm probability. This option overrides the threshold option. ; Only use with implementations: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition] @@ -1192,8 +1194,7 @@ and, for Galileo E1B channels: ;######### GALILEO ACQUISITION CONFIG ############ Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition Acquisition_1B.item_type=gr_complex -Acquisition_1B.if=0 -Acquisition_1B.sampled_ms=4 +Acquisition_1B.coherent_integration_time_ms=4 Acquisition_1B.pfa=0.0000008 Acquisition_1B.doppler_max=15000 Acquisition_1B.doppler_step=125 @@ -1301,7 +1302,7 @@ More documentation at the [Observables Blocks page](https://gnss-sdr.org/docs/sp #### Computation of Position, Velocity and Time -Although data processing for obtaining high-accuracy PVT solutions is out of the scope of GNSS-SDR, we provide a module that can compute simple least square solutions (stored in GIS-friendly formats such as [GeoJSON](http://geojson.org/geojson-spec.html) and [KML](http://www.opengeospatial.org/standards/kml), or transmitted via serial port as [NMEA 0183](https://en.wikipedia.org/wiki/NMEA_0183) messages), and leaves room for more sophisticated positioning methods by storing observables and navigation data in [RINEX](https://en.wikipedia.org/wiki/RINEX) files (v2.11 or v3.02), and generating [RTCM](http://www.rtcm.org "Radio Technical Commission for Maritime Services") 3.2 messages that can be disseminated through the Internet in real time. +Although data processing for obtaining high-accuracy PVT solutions is out of the scope of GNSS-SDR, we provide a module that can compute position fixes (stored in GIS-friendly formats such as [GeoJSON](https://tools.ietf.org/html/rfc7946), [GPX](http://www.topografix.com/gpx.asp) and [KML](http://www.opengeospatial.org/standards/kml), or transmitted via serial port as [NMEA 0183](https://en.wikipedia.org/wiki/NMEA_0183) messages), and leaves room for more sophisticated positioning methods by storing observables and navigation data in [RINEX](https://en.wikipedia.org/wiki/RINEX) files (v2.11 or v3.02), and generating [RTCM](http://www.rtcm.org "Radio Technical Commission for Maritime Services") 3.2 messages that can be disseminated through the Internet in real time. The common interface is [PvtInterface](./src/core/interfaces/pvt_interface.h). @@ -1332,18 +1333,20 @@ PVT.rtcm_MT1077_rate_ms=1000 **Notes on the output formats:** - * **GeoJSON** is a geospatial data interchange format based on JavaScript Object Notation (JSON) supported by numerous mapping and GIS software packages, including [OpenLayers](http://openlayers.org), [Leaflet](http://leafletjs.com), [MapServer](http://www.mapserver.org), [GeoServer](http://geoserver.org), [GeoDjango](https://www.djangoproject.com), [GDAL](http://www.gdal.org), and [CartoDB](https://cartodb.com). It is also possible to use GeoJSON with [PostGIS](http://postgis.net) and [Mapnik](http://mapnik.org), both of which handle the format via the GDAL OGR conversion library. The [Google Maps Javascript API](https://developers.google.com/maps/documentation/javascript/) v3 directly supports the [integration of GeoJSON data layers](https://developers.google.com/maps/documentation/javascript/examples/layer-data-simple), and [GitHub also supports GeoJSON rendering](https://github.com/blog/1528-there-s-a-map-for-that). + * **GeoJSON** is a geospatial data interchange format based on JavaScript Object Notation (JSON) supported by numerous mapping and GIS software packages, including [OpenLayers](https://openlayers.org), [Leaflet](https://leafletjs.com), [MapServer](http://www.mapserver.org), [GeoServer](http://geoserver.org), [GeoDjango](https://www.djangoproject.com), [GDAL](http://www.gdal.org), and [CartoDB](https://cartodb.com). It is also possible to use GeoJSON with [PostGIS](https://postgis.net/) and [Mapnik](http://mapnik.org), both of which handle the format via the GDAL OGR conversion library. The [Google Maps Javascript API](https://developers.google.com/maps/documentation/javascript/) v3 directly supports the [integration of GeoJSON data layers](https://developers.google.com/maps/documentation/javascript/examples/layer-data-simple), and [GitHub also supports GeoJSON rendering](https://github.com/blog/1528-there-s-a-map-for-that). - * **KML** (Keyhole Markup Language) is an XML grammar used to encode and transport representations of geographic data for display in an earth browser. KML is an open standard officially named the OpenGIS KML Encoding Standard (OGC KML), and it is maintained by the Open Geospatial Consortium, Inc. (OGC). KML files can be displayed in geobrowsers such as [Google Earth](https://www.google.com/earth/), [Marble](https://marble.kde.org), [osgEarth](http://osgearth.org), or used with the [NASA World Wind SDK for Java](http://worldwind.arc.nasa.gov/java/). + * **KML** (Keyhole Markup Language) is an XML grammar used to encode and transport representations of geographic data for display in an earth browser. KML is an open standard officially named the OpenGIS KML Encoding Standard (OGC KML), and it is maintained by the Open Geospatial Consortium, Inc. (OGC). KML files can be displayed in geobrowsers such as [Google Earth](https://www.google.com/earth/), [Marble](https://marble.kde.org), [osgEarth](http://osgearth.org), or used with the [NASA World Wind SDK for Java](https://worldwind.arc.nasa.gov/java/). - * **NMEA 0183** is a combined electrical and data specification for communication between marine electronics such as echo sounder, sonars, anemometer, gyrocompass, autopilot, GPS receivers and many other types of instruments. It has been defined by, and is controlled by, the U.S. [National Marine Electronics Association](http://www.nmea.org/). The NMEA 0183 standard uses a simple ASCII, serial communications protocol that defines how data are transmitted in a *sentence* from one *talker* to multiple *listeners* at a time. Through the use of intermediate expanders, a talker can have a unidirectional conversation with a nearly unlimited number of listeners, and using multiplexers, multiple sensors can talk to a single computer port. At the application layer, the standard also defines the contents of each sentence (message) type, so that all listeners can parse messages accurately. Those messages can be sent through the serial port (that could be for instance a Bluetooth link) and be used/displayed by a number of software applications such as [gpsd](http://www.catb.org/gpsd/ "The UNIX GPS daemon"), [JOSM](https://josm.openstreetmap.de/ "The Java OpenStreetMap Editor"), [OpenCPN](http://opencpn.org/ocpn/ "Open Chart Plotter Navigator"), and many others (and maybe running on other devices). + * **GPX** (the GPS Exchange Format) is a light-weight XML data format for the interchange of GPS data (waypoints, routes, and tracks) between applications and Web services on the Internet. The format is open and can be used without the need to pay license fees, and it is supported by a [large list of software tools](http://www.topografix.com/gpx_resources.asp). + + * **NMEA 0183** is a combined electrical and data specification for communication between marine electronics such as echo sounder, sonars, anemometer, gyrocompass, autopilot, GPS receivers and many other types of instruments. It has been defined by, and is controlled by, the U.S. [National Marine Electronics Association](http://www.nmea.org/). The NMEA 0183 standard uses a simple ASCII, serial communications protocol that defines how data are transmitted in a *sentence* from one *talker* to multiple *listeners* at a time. Through the use of intermediate expanders, a talker can have a unidirectional conversation with a nearly unlimited number of listeners, and using multiplexers, multiple sensors can talk to a single computer port. At the application layer, the standard also defines the contents of each sentence (message) type, so that all listeners can parse messages accurately. Those messages can be sent through the serial port (that could be for instance a Bluetooth link) and be used/displayed by a number of software applications such as [gpsd](http://www.catb.org/gpsd/ "The UNIX GPS daemon"), [JOSM](https://josm.openstreetmap.de/ "The Java OpenStreetMap Editor"), [OpenCPN](https://opencpn.org/ "Open Chart Plotter Navigator"), and many others (and maybe running on other devices). * **RINEX** (Receiver Independent Exchange Format) is an interchange format for raw satellite navigation system data, covering observables and the information contained in the navigation message broadcast by GNSS satellites. This allows the user to post-process the received data to produce a more accurate result (usually with other data unknown to the original receiver, such as better models of the atmospheric conditions at time of measurement). RINEX files can be used by software packages such as [GPSTk](http://www.gpstk.org), [RTKLIB](http://www.rtklib.com/) and [gLAB](http://gage14.upc.es/gLAB/). GNSS-SDR by default generates RINEX version [3.02](https://igscb.jpl.nasa.gov/igscb/data/format/rinex302.pdf). If [2.11](https://igscb.jpl.nasa.gov/igscb/data/format/rinex211.txt) is needed, it can be requested through the `rinex_version` parameter in the configuration file: ~~~~~~ PVT.rinex_version=2 ~~~~~~ -* **RTCM SC-104** provides standards that define the data structure for differential GNSS correction information for a variety of differential correction applications. Developed by the Radio Technical Commission for Maritime Services ([RTCM](http://www.rtcm.org/overview.php#Standards "Radio Technical Commission for Maritime Services")), they have become an industry standard for communication of correction information. GNSS-SDR implements RTCM version 3.2, defined in the document *RTCM 10403.2, Differential GNSS (Global Navigation Satellite Systems) Services - Version 3* (February 1, 2013), which can be [purchased online](https://ssl29.pair.com/dmarkle/puborder.php?show=3 "RTCM Online Publication Order Form"). By default, the generated RTCM binary messages are dumped into a text file in hexadecimal format. However, GNSS-SDR is equipped with a TCP/IP server, acting as an NTRIP source that can feed an NTRIP server. NTRIP (Networked Transport of RTCM via Internet Protocol) is an open standard protocol that can be freely downloaded from [BKG](http://igs.bkg.bund.de/root_ftp/NTRIP/documentation/NtripDocumentation.pdf "Networked Transport of RTCM via Internet Protocol (Ntrip) Version 1.0"), and it is designed for disseminating differential correction data (*e.g.* in the RTCM-104 format) or other kinds of GNSS streaming data to stationary or mobile users over the Internet. The TCP/IP server can be enabled by setting ```PVT.flag_rtcm_server=true``` in the configuration file, and will be active during the execution of the software receiver. By default, the server will operate on port 2101 (which is the recommended port for RTCM services according to the Internet Assigned Numbers Authority, [IANA](http://www.iana.org/assignments/service-names-port-numbers "Service Name and Transport Protocol Port Number Registry")), and will identify the Reference Station with ID=1234. This behaviour can be changed in the configuration file: +* **RTCM SC-104** provides standards that define the data structure for differential GNSS correction information for a variety of differential correction applications. Developed by the Radio Technical Commission for Maritime Services ([RTCM](http://www.rtcm.org/differential-global-navigation-satellite--dgnss--standards.html "Radio Technical Commission for Maritime Services")), they have become an industry standard for communication of correction information. GNSS-SDR implements RTCM version 3.2, defined in the document *RTCM 10403.2, Differential GNSS (Global Navigation Satellite Systems) Services - Version 3* (February 1, 2013), which can be [purchased online](https://ssl29.pair.com/dmarkle/puborder.php?show=3 "RTCM Online Publication Order Form"). By default, the generated RTCM binary messages are dumped into a text file in hexadecimal format. However, GNSS-SDR is equipped with a TCP/IP server, acting as an NTRIP source that can feed an NTRIP server. NTRIP (Networked Transport of RTCM via Internet Protocol) is an open standard protocol that can be freely downloaded from [BKG](https://igs.bkg.bund.de/root_ftp/NTRIP/documentation/NtripDocumentation.pdf "Networked Transport of RTCM via Internet Protocol (Ntrip) Version 1.0"), and it is designed for disseminating differential correction data (*e.g.* in the RTCM-104 format) or other kinds of GNSS streaming data to stationary or mobile users over the Internet. The TCP/IP server can be enabled by setting ```PVT.flag_rtcm_server=true``` in the configuration file, and will be active during the execution of the software receiver. By default, the server will operate on port 2101 (which is the recommended port for RTCM services according to the Internet Assigned Numbers Authority, [IANA](https://www.iana.org/assignments/service-names-port-numbers/ "Service Name and Transport Protocol Port Number Registry")), and will identify the Reference Station with ID=1234. This behaviour can be changed in the configuration file: ~~~~~~ PVT.flag_rtcm_server=true PVT.rtcm_tcp_port=2102 @@ -1402,9 +1405,9 @@ Ok, now what? In order to start using GNSS-SDR, you may want to populate ```gnss-sdr/data``` folder (or anywhere else on your system) with raw data files. By "raw data" we mean the output of a Radio Frequency front-end's Analog-to-Digital converter. GNSS-SDR needs signal samples already in baseband or in passband, at a suitable intermediate frequency (on the order of MHz). Prepare your configuration file, and then you are ready for running ```gnss-sdr --config_file=your_configuration.conf```, and seeing how the file is processed. -Another interesting option is working in real-time with an RF front-end. We provide drivers for UHD-compatible hardware such as the [USRP family](http://www.ettus.com/product), for OsmoSDR and other front-ends (HackRF, bladeRF, LimeSDR), for the GN3S v2 USB dongle and for some DVB-T USB dongles. Start with a low number of channels and then increase it in order to test how many channels your processor can handle in real-time. +Another interesting option is working in real-time with an RF front-end. We provide drivers for UHD-compatible hardware such as the [USRP family](https://www.ettus.com/product), for OsmoSDR and other front-ends (HackRF, bladeRF, LimeSDR), for the GN3S v2 USB dongle and for some DVB-T USB dongles. Start with a low number of channels and then increase it in order to test how many channels your processor can handle in real-time. -You can find more information at the [GNSS-SDR Documentation page](https://gnss-sdr.org/docs/) or directly asking to the [GNSS-SDR Developers mailing list](http://lists.sourceforge.net/lists/listinfo/gnss-sdr-developers). +You can find more information at the [GNSS-SDR Documentation page](https://gnss-sdr.org/docs/) or directly asking to the [GNSS-SDR Developers mailing list](https://lists.sourceforge.net/lists/listinfo/gnss-sdr-developers). You are also very welcome to contribute to the project, there are many ways to [participate in GNSS-SDR](https://gnss-sdr.org/contribute/). If you need some special feature not yet implemented, the Developer Team would love to be hired for developing it. Please do not hesitate to [contact them](https://gnss-sdr.org/team/). diff --git a/cmake/Modules/Findiio.cmake b/cmake/Modules/FindGriio.cmake similarity index 100% rename from cmake/Modules/Findiio.cmake rename to cmake/Modules/FindGriio.cmake diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake new file mode 100644 index 000000000..3be89420e --- /dev/null +++ b/cmake/Modules/FindPCAP.cmake @@ -0,0 +1,121 @@ +################################################################### +# +# Copyright (c) 2006 Frederic Heem, +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# +# * Neither the name of the Telsey nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +################################################################### +# - Find pcap +# Find the PCAP includes and library +# http://www.tcpdump.org/ +# +# The environment variable PCAPDIR allows to specficy where to find +# libpcap in non standard location. +# +# PCAP_INCLUDE_DIRS - where to find pcap.h, etc. +# PCAP_LIBRARIES - List of libraries when using pcap. +# PCAP_FOUND - True if pcap found. + + +IF(EXISTS $ENV{PCAPDIR}) + FIND_PATH(PCAP_INCLUDE_DIR + NAMES + pcap/pcap.h + pcap.h + PATHS + $ENV{PCAPDIR} + NO_DEFAULT_PATH + ) + + FIND_LIBRARY(PCAP_LIBRARY + NAMES + pcap + PATHS + $ENV{PCAPDIR} + NO_DEFAULT_PATH + ) + + +ELSE(EXISTS $ENV{PCAPDIR}) + FIND_PATH(PCAP_INCLUDE_DIR + NAMES + pcap/pcap.h + pcap.h + ) + + FIND_LIBRARY(PCAP_LIBRARY + NAMES + pcap + ) + +ENDIF(EXISTS $ENV{PCAPDIR}) + +SET(PCAP_INCLUDE_DIRS ${PCAP_INCLUDE_DIR}) +SET(PCAP_LIBRARIES ${PCAP_LIBRARY}) + +IF(PCAP_INCLUDE_DIRS) + MESSAGE(STATUS "Pcap include dirs set to ${PCAP_INCLUDE_DIRS}") +ELSE(PCAP_INCLUDE_DIRS) + MESSAGE(FATAL " Pcap include dirs cannot be found") +ENDIF(PCAP_INCLUDE_DIRS) + +IF(PCAP_LIBRARIES) + MESSAGE(STATUS "Pcap library set to ${PCAP_LIBRARIES}") +ELSE(PCAP_LIBRARIES) + MESSAGE(FATAL "Pcap library cannot be found") +ENDIF(PCAP_LIBRARIES) + +#Functions +INCLUDE(CheckFunctionExists) +SET(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS}) +SET(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES}) +CHECK_FUNCTION_EXISTS("pcap_breakloop" HAVE_PCAP_BREAKLOOP) +CHECK_FUNCTION_EXISTS("pcap_datalink_name_to_val" HAVE_PCAP_DATALINK_NAME_TO_VAL) +CHECK_FUNCTION_EXISTS("pcap_datalink_val_to_name" HAVE_PCAP_DATALINK_VAL_TO_NAME) +CHECK_FUNCTION_EXISTS("pcap_findalldevs" HAVE_PCAP_FINDALLDEVS) +CHECK_FUNCTION_EXISTS("pcap_freecode" HAVE_PCAP_FREECODE) +CHECK_FUNCTION_EXISTS("pcap_get_selectable_fd" HAVE_PCAP_GET_SELECTABLE_FD) +CHECK_FUNCTION_EXISTS("pcap_lib_version" HAVE_PCAP_LIB_VERSION) +CHECK_FUNCTION_EXISTS("pcap_list_datalinks" HAVE_PCAP_LIST_DATALINKS) +CHECK_FUNCTION_EXISTS("pcap_open_dead" HAVE_PCAP_OPEN_DEAD) +CHECK_FUNCTION_EXISTS("pcap_set_datalink" HAVE_PCAP_SET_DATALINK) + + +#Is pcap found ? +IF(PCAP_INCLUDE_DIRS AND PCAP_LIBRARIES) + SET( PCAP_FOUND true ) +ENDIF(PCAP_INCLUDE_DIRS AND PCAP_LIBRARIES) + + +MARK_AS_ADVANCED( + PCAP_LIBRARIES + PCAP_INCLUDE_DIRS +) diff --git a/conf/front-end-cal.conf b/conf/front-end-cal.conf index 106b8d736..16bf70407 100644 --- a/conf/front-end-cal.conf +++ b/conf/front-end-cal.conf @@ -182,8 +182,6 @@ Resampler.implementation=Pass_Through Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler ;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. Acquisition.item_type=gr_complex -;#if: Signal intermediate frequency in [Hz] -Acquisition.if=0 ;#sampled_ms: Signal block duration for the acquisition signal detection [ms] Acquisition.sampled_ms=1 ;#threshold: Acquisition threshold diff --git a/conf/gnss-sdr_GPS_L1_2ch_udp.conf b/conf/gnss-sdr_GPS_L1_2ch_udp.conf new file mode 100644 index 000000000..6dd703fa6 --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_2ch_udp.conf @@ -0,0 +1,103 @@ +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. +GNSS-SDR.internal_fs_sps=13250000 ;//66.25/5 +;GNSS-SDR.internal_fs_sps=6625000 ;//66.25/10 +;GNSS-SDR.internal_fs_sps=3312500 ;//66.25/20 +;GNSS-SDR.internal_fs_sps=2650000 ;//66.25/25 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Custom_UDP_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.origin_address=0.0.0.0 +SignalSource.capture_device=eth0 +SignalSource.port=1234 +SignalSource.payload_bytes=1472 +;SignalSource.sample_type=cbyte +SignalSource.sample_type=c4bits +SignalSource.IQ_swap=false +SignalSource.RF_channels=1 +SignalSource.channels_in_udp=2 +SignalSource.dump=false +SignalSource.dump_filename=./signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through +;SignalConditioner0.implementation=Pass_Through +;SignalConditioner1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 + +;# CHANNEL CONNECTION +Channel.signal=1C +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + +;Channel0.signal=1C +;Channel1.RF_channel_ID=1 +;Channel1.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=17 +Acquisition_1C.use_CFAR_algorithm=false +Acquisition_1C.blocking=false +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_CA_ibyte.conf b/conf/gnss-sdr_GPS_L1_CA_ibyte.conf index da4b273c2..c4a38223d 100644 --- a/conf/gnss-sdr_GPS_L1_CA_ibyte.conf +++ b/conf/gnss-sdr_GPS_L1_CA_ibyte.conf @@ -52,7 +52,6 @@ Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition Acquisition_1C.item_type=gr_complex Acquisition_1C.threshold=0.01 ;Acquisition_1C.pfa=0.00001 -Acquisition_1C.if=0 Acquisition_1C.doppler_max=10000 Acquisition_1C.doppler_step=250 Acquisition_1C.dump=false; @@ -62,7 +61,6 @@ Acquisition_1C.dump_filename=/archive/gps_acquisition.dat ;######### TRACKING GLOBAL CONFIG ############ Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking Tracking_1C.item_type=gr_complex -Tracking_1C.if=60000 Tracking_1C.early_late_space_chips=0.5 Tracking_1C.pll_bw_hz=25.0; Tracking_1C.dll_bw_hz=3.0; diff --git a/conf/gnss-sdr_GPS_L1_LimeSDR.conf b/conf/gnss-sdr_GPS_L1_LimeSDR.conf index c50572aef..c465a41ca 100644 --- a/conf/gnss-sdr_GPS_L1_LimeSDR.conf +++ b/conf/gnss-sdr_GPS_L1_LimeSDR.conf @@ -65,7 +65,6 @@ Channel.signal=1C ;######### ACQUISITION GLOBAL CONFIG ############ Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler Acquisition_1C.item_type=gr_complex -Acquisition_1C.if=0 Acquisition_1C.sampled_ms=1 Acquisition_1C.threshold=0.015 Acquisition_1C.doppler_max=10000 @@ -78,7 +77,6 @@ Acquisition_1C.dump_filename=./acq_dump.dat ;######### TRACKING GLOBAL CONFIG ############ Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking Tracking_1C.item_type=gr_complex -Tracking_1C.if=0 Tracking_1C.pll_bw_hz=40.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; diff --git a/conf/gnss-sdr_GPS_L1_nsr.conf b/conf/gnss-sdr_GPS_L1_nsr.conf index 2b3d3f5f4..49ae18b56 100644 --- a/conf/gnss-sdr_GPS_L1_nsr.conf +++ b/conf/gnss-sdr_GPS_L1_nsr.conf @@ -2,7 +2,7 @@ ; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ ; Sample configuration file for IFEN SX-NSR software receiver front-end -; http://www.ifen.com/products/sx-scientific-gnss-solutions/nsr-software-receiver.html +; https://www.ifen.com/products/sx3-gnss-software-receiver/ ; This sample configuration is able to process directly .sream binary files ; You can define your own receiver and invoke it by doing ; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf diff --git a/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf b/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf index d31885566..82d382a27 100644 --- a/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf +++ b/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf @@ -2,7 +2,7 @@ ; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ ; Sample configuration file for IFEN SX-NSR software receiver front-end -; http://www.ifen.com/products/sx-scientific-gnss-solutions/nsr-software-receiver.html +; https://www.ifen.com/products/sx3-gnss-software-receiver/ ; This sample configuration is able to process directly .sream binary files ; You can define your own receiver and invoke it by doing ; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf @@ -105,7 +105,6 @@ Channel.signal=1C ;######### GPS ACQUISITION CONFIG ############ Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition Acquisition_1C.item_type=gr_complex -Acquisition_1C.if=0 Acquisition_1C.sampled_ms=1 Acquisition_1C.threshold=0.0075 ;Acquisition_1C.pfa=0.01 @@ -118,7 +117,6 @@ Acquisition_1C.dump_filename=./acq_dump.dat ;######### TRACKING GPS CONFIG ############ Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking Tracking_1C.item_type=gr_complex -Tracking_1C.if=0 Tracking_1C.pll_bw_hz=45.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; diff --git a/conf/gnss-sdr_Hybrid_byte.conf b/conf/gnss-sdr_Hybrid_byte.conf index a70b62820..b7f4e58ff 100644 --- a/conf/gnss-sdr_Hybrid_byte.conf +++ b/conf/gnss-sdr_Hybrid_byte.conf @@ -14,7 +14,7 @@ GNSS-SDR.internal_fs_sps=20000000 ;######### SIGNAL_SOURCE CONFIG ############ SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/Fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE +SignalSource.filename=/media/javier/Extreme 500/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE SignalSource.item_type=byte SignalSource.sampling_frequency=20000000 SignalSource.samples=0 @@ -46,12 +46,20 @@ Resampler.dump_filename=../data/resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_1B.count=8 +Channels_1C.count=10 +Channels_1B.count=10 Channels.in_acquisition=1 ;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + ;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C Channel1.signal=1C Channel2.signal=1C Channel3.signal=1C @@ -67,16 +75,19 @@ Channel12.signal=1B Channel13.signal=1B Channel14.signal=1B Channel15.signal=1B - +Channel16.signal=1B +Channel17.signal=1B +Channel18.signal=1B +Channel19.signal=1B ;######### GPS ACQUISITION CONFIG ############ Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.0060 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 +Acquisition_1C.threshold=18 +Acquisition_1C.use_CFAR_algorithm=false +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 Acquisition_1C.dump=false Acquisition_1C.dump_filename=./acq_dump.dat @@ -84,21 +95,23 @@ Acquisition_1C.dump_filename=./acq_dump.dat ;######### GALILEO ACQUISITION CONFIG ############ Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000008 -Acquisition_1B.doppler_max=15000 +Acquisition_1B.threshold=25 +Acquisition_1B.use_CFAR_algorithm=false +Acquisition_1B.blocking=true +Acquisition_1B.doppler_max=5000 Acquisition_1B.doppler_step=125 Acquisition_1B.dump=false Acquisition_1B.dump_filename=./acq_dump.dat - ;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_C_Aid_Tracking Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; +Tracking_1C.extend_correlation_ms=1 +Tracking_1C.pll_bw_hz=40; +Tracking_1C.pll_bw_narrow_hz=30; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=1.5; +Tracking_1C.order=2; Tracking_1C.dump=false Tracking_1C.dump_filename=../data/epl_tracking_ch_ @@ -107,7 +120,7 @@ Tracking_1C.dump_filename=../data/epl_tracking_ch_ Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking Tracking_1B.item_type=gr_complex Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.dll_bw_hz=3.0; Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; @@ -126,6 +139,7 @@ TelemetryDecoder_1B.dump=false ;######### OBSERVABLES CONFIG ############ +;#implementation: Observables.implementation=Hybrid_Observables Observables.dump=false Observables.dump_filename=./observables.dat @@ -133,13 +147,14 @@ Observables.dump_filename=./observables.dat ;######### PVT CONFIG ############ PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; +PVT.output_rate_ms=10; PVT.display_rate_ms=500; -PVT.dump=false +PVT.elevation_mask=15; PVT.flag_rtcm_server=false PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_Hybrid_nsr.conf b/conf/gnss-sdr_Hybrid_nsr.conf index 934ca2ffd..9f65ead4b 100644 --- a/conf/gnss-sdr_Hybrid_nsr.conf +++ b/conf/gnss-sdr_Hybrid_nsr.conf @@ -14,7 +14,7 @@ GNSS-SDR.internal_fs_sps=2560000 ;######### SIGNAL_SOURCE CONFIG ############ SignalSource.implementation=Nsr_File_Signal_Source -SignalSource.filename=/media/javier/SISTEMA/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE SignalSource.item_type=byte SignalSource.sampling_frequency=20480000 SignalSource.samples=0 @@ -61,8 +61,8 @@ InputFilter.dump_filename=../data/input_filter.dat Resampler.implementation=Pass_Through ;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_1B.count=0 +Channels_1C.count=10 +Channels_1B.count=10 Channels.in_acquisition=1 ;#signal: @@ -82,22 +82,26 @@ Channel4.signal=1C Channel5.signal=1C Channel6.signal=1C Channel7.signal=1C -Channel8.signal=1B -Channel9.signal=1B +Channel8.signal=1C +Channel9.signal=1C Channel10.signal=1B Channel11.signal=1B Channel12.signal=1B Channel13.signal=1B Channel14.signal=1B Channel15.signal=1B +Channel16.signal=1B +Channel17signal=1B +Channel18.signal=1B +Channel19.signal=1B ;######### GPS ACQUISITION CONFIG ############ Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.0075 -;Acquisition_1C.pfa=0.01 +Acquisition_1C.threshold=25 +Acquisition_1C.use_CFAR_algorithm=false +Acquisition_1C.blocking=true Acquisition_1C.doppler_max=5000 Acquisition_1C.doppler_step=250 Acquisition_1C.dump=false @@ -107,32 +111,31 @@ Acquisition_1C.dump_filename=./acq_dump.dat ;######### GALILEO ACQUISITION CONFIG ############ Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 +Acquisition_1B.threshold=25 +Acquisition_1B.use_CFAR_algorithm=false +Acquisition_1B.blocking=true +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=250 Acquisition_1B.dump=false Acquisition_1B.dump_filename=./acq_dump.dat - ;######### TRACKING GPS CONFIG ############ Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_C_Aid_Tracking Tracking_1C.item_type=gr_complex Tracking_1C.extend_correlation_ms=1 Tracking_1C.pll_bw_hz=40; -Tracking_1C.pll_bw_narrow_hz=20; +Tracking_1C.pll_bw_narrow_hz=30; Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=1.0; -Tracking_1C.order=3; -Tracking_1C.dump=true +Tracking_1C.dll_bw_narrow_hz=1.5; +Tracking_1C.order=2; +Tracking_1C.dump=false Tracking_1C.dump_filename=../data/epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.pll_bw_hz=20.0; Tracking_1B.dll_bw_hz=2.0; Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; @@ -165,6 +168,7 @@ PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad PVT.output_rate_ms=10; PVT.display_rate_ms=500; +PVT.elevation_mask=20; PVT.flag_rtcm_server=false PVT.flag_rtcm_tty_port=false PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/gnss-sdr_galileo_E1_extended_correlator_byte.conf b/conf/gnss-sdr_galileo_E1_extended_correlator_byte.conf index aea77c99c..366299f74 100644 --- a/conf/gnss-sdr_galileo_E1_extended_correlator_byte.conf +++ b/conf/gnss-sdr_galileo_E1_extended_correlator_byte.conf @@ -97,7 +97,6 @@ Tracking_1C.dump_filename=../data/epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking Tracking_1B.item_type=gr_complex -Tracking_1B.if=0 Tracking_1B.track_pilot=true Tracking_1B.pll_bw_hz=4.0; Tracking_1B.dll_bw_hz=0.5; diff --git a/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf b/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf index 720c68fa9..d27d98d62 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf +++ b/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf @@ -188,7 +188,6 @@ Acquisition_1C.dump_filename=./acq_dump.dat ;######### TRACKING GLOBAL CONFIG ############ Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking Tracking_1C.item_type=gr_complex -Tracking_1C.if=0 Tracking_1C.dump=false Tracking_1C.dump_filename=../data/epl_tracking_ch_ Tracking_1C.pll_bw_hz=40.0; @@ -199,7 +198,6 @@ Tracking_1C.early_late_space_chips=0.5; ;# GPS L2C M Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition Acquisition_2S.item_type=gr_complex -Acquisition_2S.if=0 Acquisition_2S.threshold=0.0005 ;Acquisition_2S.pfa=0.001 Acquisition_2S.doppler_max=5000 @@ -211,7 +209,6 @@ Acquisition_2S.dump_filename=./acq_dump.dat Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking Tracking_2S.item_type=gr_complex -Tracking_2S.if=0 Tracking_2S.pll_bw_hz=1.5; Tracking_2S.dll_bw_hz=0.3; Tracking_2S.order=3; diff --git a/docs/PULL_REQUEST_TEMPLATE.md b/docs/PULL_REQUEST_TEMPLATE.md index 0ab14dff6..a6cc9eef2 100644 --- a/docs/PULL_REQUEST_TEMPLATE.md +++ b/docs/PULL_REQUEST_TEMPLATE.md @@ -9,4 +9,4 @@ Before submitting your pull request, please make sure the following is done: 6. You have forked the [gnss-sdr upstream repository](https://github.com/gnss-sdr/gnss-sdr) and have created your branch from `next` (or any other currently living branch in the upstream repository). 7. Please include a description of your changes here. -**Please feel free to delete this line and the above text once you have read it and in case you want to go on with your pull request.** +**Please feel free to delete this line and the above text once you have read it and in case you want to go on with your pull request, and explain your intend below.** diff --git a/docs/changelog b/docs/changelog index 6931753ab..dece16401 100644 --- a/docs/changelog +++ b/docs/changelog @@ -1,32 +1,39 @@ ## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next) -Next release will have several improvements, addition of new features and bug fixes in many dimensions: +Next release will have several improvements in different dimensions, addition of new features and bug fixes: ### Improvements in Accuracy: -- Part of the RTKLIB core libraries has been integrated into GNSS-SDR. There is now a single PVT block implementation which makes use of RTKLIB to deliver PVT solutions, including Single and PPP navigation modes. +- Part of the RTKLIB core library has been integrated into GNSS-SDR. There is now a single PVT block implementation which makes use of RTKLIB to deliver PVT solutions, including Single and PPP navigation modes. - Fixed CN0 estimation for other correlation times than 1 ms. +- Improved computation of tracking parameters and GNSS observables. +- Other minor bug fixes. ### Improvements in Availability: - Internal Finite State Machines rewritten for improved continuity in delivering position fixes. This fixes a bug that was stalling the receiver after about six hours of continuous operation. - Redesign of the time counter for enhanced continuity. +- Improved flow graph in multisystem configurations: the receiver does not get stalled anymore if no signal is found from the first system. +- Improved acquisition and tracking sensitivity. +- Other minor bug fixes. ### Improvements in Efficiency: -- Added the possibility of non-blocking acquisition, which works well when using real-time data from a RF front-end. -- Complex codes have been replaced by real codes, alleviating the computational burden. -- New kernels: volk_gnsssdr_16i_xn_resampler_16i_xn.h, volk_gnsssdr_16ic_16i_rotator_dot_prod_16ic_xn.h, volk_gnsssdr_32f_xn_resampler_32f_xn.h, volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h -- Some AVX2 kernels added to the volk_gnsssdr library. -- Several performance improvements. +- Added the possibility of non-blocking acquisition, which works well when using real-time data from an RF front-end. +- Improved flow graph in multiband configurations: satellites acquired in one band are immediately searched in others. +- Complex local codes have been replaced by real codes, alleviating the computational burden. +- New volk_gnsssdr kernels: volk_gnsssdr_16i_xn_resampler_16i_xn.h, volk_gnsssdr_16ic_16i_rotator_dot_prod_16ic_xn.h, volk_gnsssdr_32f_xn_resampler_32f_xn.h, volk_gnsssdr_32fc_32f_rotator_dot_prod_32fc_xn.h +- Some AVX2 implementations added to the volk_gnsssdr library. +- Improvement in C++ usage: Use of const container calls when result is immediately converted to a const iterator. Using these members removes an implicit conversion from iterator to const_iterator. +- A number of code optimizations here and there. ### Improvements in Flexibility: -- A number of new parameters have been exposed in the configuration. -- Possibility to choose Pilot or Data tracking where available. +- A number of new parameters have been exposed to the configuration system. +- Possibility to choose Pilot or Data component for tracking of GPS L5 and Galileo E5a signals. - Enabled extended coherent integration times. - Some configuration parameters can now be overridden by commandline flags for easier use in scripts. @@ -37,78 +44,92 @@ Next release will have several improvements, addition of new features and bug fi - Added the GLONASS L1 SP receiver chain. - Added the GLONASS L2 SP receiver chain. - Improvements in the Galileo E5a and GPS L2C receiver chains. -- Added four more signal sources: "Fmcomms2_Signal_Source", "Plutosdr_Signal Source", "Spir_GSS6450_File_Signal_Source" and "Labsat_Signal_Source". +- Updated list of available GNSS satellites. +- Added five more signal sources: "Fmcomms2_Signal_Source" (requires gr-iio), "Plutosdr_Signal Source" (requires gr-iio), "Spir_GSS6450_File_Signal_Source", "Labsat_Signal_Source" and "Custom_UDP_Signal_Source" (requires libpcap). Documented in https://gnss-sdr.org/docs/sp-blocks/signal-source/ - Improved support for BladeRF, HackRF and RTL-SDR front-ends. - Added tools for the interaction with front-ends based on the AD9361 chipset. - Intermediate results are now saved in .mat binary format, readable from Matlab/Octave and from Python via h5py. - Added the GPX output format. -- Fixed a bug in the format of NMEA sentences when latitude or longitude minutes were >10 -- Improvements in the RTCM server. -- Improvements in the generation of RINEX files. +- Fixed a bug in the format of NMEA sentences when latitude or longitude minutes were >10. +- Improvements in the RTCM server stability. +- Improvements in the correctness of generated RINEX files. ### Improvements in Maintainability: -- C-style casts have been replaced by C++ casts. C-style casts are difficult to search for. C++ casts provide compile time checking ability and express programmers' intent better, so they are safer and clearer. -- The override special identifier is now used when overriding a virtual function. This helps the compiler to check for type changes in the base class. -- Use of const container calls when result is immediately converted to a const iterator. Using these members removes an implicit conversion from iterator to const_iterator. -- Improved control over minimum required versions for core dependencies. -- Automated code formating with clang-format. -- Application of the coding style guide in several source files, improving readability. -- The software builds with C++11, C++14 and C++17 standards. -- Setup of a Continuous Integration system that checks building in a wide range of Linux distributions. +- Setup of a Continuous Integration system that checks building and runs QA code in a wide range of GNU/Linux distributions (ArchLinux, CentOS, Debian, Fedora, OpenSUSE, Ubuntu) and releases. See https://gitlab.com/gnss-sdr/gnss-sdr +- Creation of multi-system processing blocks, drastically reducing code duplication and maintainability time. +- Automated code formatting with clang-format. This tool is widely available and easy to integrate into many code editors, and it also can be used from the command line. It cuts time spent on adhering to the project's code formatting style. +- Improvement in C++ usage: C-style casts have been replaced by C++ casts. C-style casts are difficult to search for. C++ casts provide compile time checking ability and express programmers' intent better, so they are safer and clearer. +- Improvement in C++ usage: The override special identifier is now used when overriding a virtual function. This helps the compiler to check for type changes in the base class, making the detection of errors easier. +- Improvement in C++ usage: A number of unused includes have been removed. Order of includes set to: local (in-source) headers, then library headers, then system headers. This helps to detect missing includes. +- Improvement in C++ usage: Enhanced const correctness. Misuses of those variables are detected by the compiler. ### Improvements in Portability: -- The library has been replaced by the more modern and portable . -- The library has been replaced by the more modern and portable for file handling. -- C++ libraries preferred over C libraries (e.g., instead of ). -- A number of unused includes have been removed. -- The software can now be built using GCC or LLVM/Clang compilers on GNU/Linux. +- Several CMake scripts improvements, more verbose outputs in case of errors. Building configuration has been documented in https://gnss-sdr.org/docs/tutorials/configuration-options-building-time/ +- Improved SDK for cross-compilation in embedded devices. Documented in https://gnss-sdr.org/docs/tutorials/cross-compiling/ +- Improved control over minimum required versions for core dependencies. +- The software builds with C++11, C++14 and C++17 standards. +- The software can now be built using GCC >= 4.7.2 or LLVM/Clang >= 3.4.0 compilers on GNU/Linux, and with Clang/AppleClang on MacOS. - The Ninja build system can be used in replacement of make. - The volk_gnsssdr library can be built using Python 2.7 or Python 3.6. -- Several CMake scripts improvements. -- BLAS and LAPACK libraries are mandatory on ARM devices. +- The volk_gnsssdr library is now ready for AArch64 NEON instructions. +- Ready for GNU Radio 3.8 C++ API (as per current next branch of GNU Radio upstream repository). +- Improved detection of required and optional dependencies in many GNU/Linux distributions and processor architectures. +- Improvement in C++ usage: The library has been replaced by the more modern and portable . +- Improvement in C++ usage: The library has been replaced by the more modern and portable for file handling. +- Improvement in C++ usage: C++ libraries preferred over C libraries (e.g., instead of , instead of ). +- Fixes required by Debian packaging. +- Fixes required by Macports packaging. +- A downside in portability: BLAS and LAPACK libraries are now required even in ARM devices. +- A downside in portability: the matio library >= 1.5.3 is a new required dependency. If not found, it is downloaded and built automatically at building time, but this requires libtool, automake and hdf5 already installed in the system. ### Improvements in Reliability: -- Introduced 3 new Input Filter implementations for pulsed and narrowband interference mitigation: `Pulse_Blanking_Filter`, `Notch_Filter` and `Notch_Filter_Lite`. -- Enhanced const correctness. -- rand() function replaced by library. -- strlen and strncpy have been replaced by safer C++ counterparts. +- Introduced 3 new Input Filter implementations for pulsed and narrowband interference mitigation: `Pulse_Blanking_Filter`, `Notch_Filter` and `Notch_Filter_Lite`. Documented in https://gnss-sdr.org/docs/sp-blocks/input-filter/ +- Improved flow graph stabiliy. +- Introduction of high-integrity C++ practices into the source code and included in the coding style guide. See https://gnss-sdr.org/coding-style/ - Fixed a number of defects detected by Coverity Scan. -- Some destructors have been fixed, avoiding a segmentation fault when exiting the program. -- Introduction of high-integrity C++ practices into the coding style guide. -- Website switched from http to https. Links in source code switched when available. +- Improvement in C++ usage: rand() function replaced by library. +- Improvement in C++ usage: strlen and strncpy have been replaced by safer C++ counterparts. +- Improvement in C++ usage: Some destructors have been fixed, avoiding segmentation faults when exiting the program. +- Website switched from http to https. Links in the source tree switched when available. ### Improvements in Reproducibility: -- Setup of a Continuous Reproducibility system at GitLab for the automatic reproduction of experiments. The concept was introduced in https://ieeexplore.ieee.org/document/8331069/ +- Setup of a Continuous Reproducibility system at GitLab for the automatic reproduction of experiments. The concept was introduced in https://ieeexplore.ieee.org/document/8331069/ Example added in the src/utils/reproducibility/ieee-access18/ folder. - Fixes of Lintian warnings related to build reproducibility. ### Improvements in Scalability: -- Improvements in multi-system, multi-band receiver configurations. The receiver now accepts any number of channels in the three available bands. +- Improvements in multi-system, multi-band receiver configurations. The receiver now accepts any number of channels and systems in the three available bands. +- All possible combinations of signals and integration times are now accepted by the Observables block. ### Improvements in Testability: -- Several Unit Tests added. +- Several Unit Tests added. Documentation of testing concepts and available tests at https://gnss-sdr.org/docs/tutorials/testing-software-receiver/ - Receiver channels can now be fixed to a given satellite. - Improved CTest support in volk_gnsssdr. ### Improvements in Usability: -- All Observables block implementations have been collapsed in a universal implementation for all kinds of GNSS signals, making it easier to configure. -- All PVT block implementations have been collapsed in a universal implementation for all kinds of GNSS signals, making it easier to configure. +- All Observables block implementations have been merged into a single implementation for all kinds of GNSS signals, making it easier to configure. +- All PVT block implementations have been merged into a single implementation for all kinds of GNSS signals, making it easier to configure. - Misleading parameter name GNSS-SDR.internal_fs_hz has been replaced by GNSS-SDR.internal_fs_sps. The old parameter name is still read. If found, a warning is provided to the user. -- Updated and improved documentation. +- Updated and improved documentation of processing blocks at https://gnss-sdr.org/docs/sp-blocks/ +- Improved documentation of required dependency packages in several GNU/Linux distributions. +- Parameter names with the same role have been harmonized within different block implementations. +- Added a changelog, a code of conduct, a contributing guide and a pull-request template in the source tree. - Added colors to the commandline user interface. +- Updated manfiles. + See the definitions of concepts and metrics at https://gnss-sdr.org/design-forces/ diff --git a/docs/doxygen/Doxyfile.in b/docs/doxygen/Doxyfile.in index 9d0978e3f..28b3c9d2a 100644 --- a/docs/doxygen/Doxyfile.in +++ b/docs/doxygen/Doxyfile.in @@ -21,7 +21,7 @@ # that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# https://www.gnu.org/software/libiconv for the list of possible encodings. DOXYFILE_ENCODING = UTF-8 @@ -551,7 +551,7 @@ LAYOUT_FILE = # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -623,7 +623,7 @@ INPUT = @top_srcdir@/src @top_srcdir@/docs/doxygen/other # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is # also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# into libc) for the transcoding. See https://www.gnu.org/software/libiconv for # the list of possible encodings. INPUT_ENCODING = UTF-8 @@ -796,7 +796,7 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You +# tagging system (see https://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO @@ -875,7 +875,7 @@ HTML_STYLESHEET = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. # Doxygen will adjust the colors in the stylesheet and background images # according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. +# see https://en.wikipedia.org/wiki/Hue for more information. # For instance the value 0 represents red, 60 is yellow, 120 is green, # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. @@ -925,8 +925,6 @@ HTML_DYNAMIC_SECTIONS = NO # directory and running "make install" will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find # it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. GENERATE_DOCSET = NO @@ -1123,7 +1121,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the +# (see https://www.mathjax.org) which uses client side Javascript for the # rendering instead of using prerendered bitmaps. Use this if you do not # have LaTeX installed or if you want to formulas look prettier in the HTML # output. When enabled you also need to install MathJax separately and @@ -1133,7 +1131,7 @@ USE_MATHJAX = @GNSSSDR_USE_MATHJAX@ # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1149,7 +1147,7 @@ MATHJAX_FORMAT = HTML-CSS # MathJax, but it is strongly recommended to install a local copy of MathJax # before deployment. -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +MATHJAX_RELPATH = https://cdnjs.com/libraries/mathjax/ # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example @@ -1160,7 +1158,7 @@ MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1194,7 +1192,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1207,7 +1205,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1358,7 +1356,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 39a8ebd3f..24f4c9150 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -94,6 +94,8 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration, { rinex_version = 2; } + int rinexobs_rate_ms = boost::math::lcm(configuration->property(role + ".rinexobs_rate_ms", 1000), output_rate_ms); + int rinexnav_rate_ms = boost::math::lcm(configuration->property(role + ".rinexnav_rate_ms", 6000), output_rate_ms); // RTCM Printer settings bool flag_rtcm_tty_port = configuration->property(role + ".flag_rtcm_tty_port", false); @@ -208,8 +210,8 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration, if ((gps_1C_count != 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count == 0)) type_of_receiver = 21; //if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count = 0)) type_of_receiver = 22; if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0)) type_of_receiver = 23; - if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0)) type_of_receiver = 24; - if( (gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count != 0)) type_of_receiver = 25; + if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count == 0) && (glo_2G_count != 0)) type_of_receiver = 24; + if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count != 0)) type_of_receiver = 25; if ((gps_1C_count != 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0)) type_of_receiver = 26; if ((gps_1C_count == 0) && (gps_2S_count == 0) && (gps_L5_count == 0) && (gal_1B_count != 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0)) type_of_receiver = 27; if ((gps_1C_count == 0) && (gps_2S_count != 0) && (gps_L5_count == 0) && (gal_1B_count == 0) && (gal_E5a_count == 0) && (gal_E5b_count == 0) && (glo_1G_count != 0) && (glo_2G_count == 0)) type_of_receiver = 28; @@ -471,10 +473,10 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration, 0, /* initialize by restart */ 1, /* output single by dgps/float/fix/ppp outage */ {"", ""}, /* char rnxopt[2][256] rinex options {rover,base} */ - {sat_PCV, rec_PCV, phwindup, reject_GPS_IIA, raim_fde}, /* posopt[6] positioning options [0]: satellite and receiver antenna PCV model; [1]: interpolate antenna parameters; [2]: apply phase wind-up correction for PPP modes; [3]: exclude measurements of GPS Block IIA satellites satellite [4]: RAIM FDE (fault detection and exclusion) [5]: handle day-boundary clock jump */ + {sat_PCV, rec_PCV, phwindup, reject_GPS_IIA, raim_fde}, /* posopt[6] positioning options [0]: satellite and receiver antenna PCV model; [1]: interpolate antenna parameters; [2]: apply phase wind-up correction for PPP modes; [3]: exclude measurements of GPS Block IIA satellites satellite [4]: RAIM FDE (fault detection and exclusion) [5]: handle day-boundary clock jump */ 0, /* solution sync mode (0:off,1:on) */ - {{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */ - {{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */ + {{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */ + {{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */ 0, /* disable L2-AR */ {} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */ }; @@ -482,8 +484,12 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration, rtkinit(&rtk, &rtklib_configuration_options); // make PVT object - pvt_ = rtklib_make_pvt_cc(in_streams_, dump_, dump_filename_, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, rinex_version, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_msg_rate_ms, rtcm_dump_devname, type_of_receiver, rtk); + pvt_ = rtklib_make_pvt_cc(in_streams_, dump_, dump_filename_, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, rinex_version, rinexobs_rate_ms, rinexnav_rate_ms, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_msg_rate_ms, rtcm_dump_devname, type_of_receiver, rtk); DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")"; + if (out_streams_ > 0) + { + LOG(ERROR) << "The PVT block does not have an output stream"; + } } diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc index 8bcc49a88..1fc243cb3 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.cc @@ -57,6 +57,8 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int nchannels, std::string nmea_dump_filename, std::string nmea_dump_devname, int rinex_version, + int rinexobs_rate_ms, + int rinexnav_rate_ms, bool flag_rtcm_server, bool flag_rtcm_tty_port, unsigned short rtcm_tcp_port, @@ -75,6 +77,8 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int nchannels, nmea_dump_filename, nmea_dump_devname, rinex_version, + rinexobs_rate_ms, + rinexnav_rate_ms, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, @@ -90,7 +94,7 @@ void rtklib_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg) { try { - //************* GPS telemetry ***************** + // ************* GPS telemetry ***************** if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) { // ### GPS EPHEMERIS ### @@ -146,7 +150,7 @@ void rtklib_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg) DLOG(INFO) << "New CNAV UTC record has arrived "; } - //**************** Galileo telemetry ******************** + // **************** Galileo telemetry ******************** else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) { // ### Galileo EPHEMERIS ### @@ -185,7 +189,7 @@ void rtklib_pvt_cc::msg_handler_telemetry(pmt::pmt_t msg) DLOG(INFO) << "New Galileo Almanac has arrived "; } - //**************** GLONASS GNAV Telemetry ************************** + // **************** GLONASS GNAV Telemetry ************************** else if (pmt::any_ref(msg).type() == typeid(std::shared_ptr)) { // ### GLONASS GNAV EPHEMERIS ### @@ -235,13 +239,27 @@ std::map rtklib_pvt_cc::get_GPS_L1_ephemeris_map() } -rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump_filename, - int output_rate_ms, int display_rate_ms, bool flag_nmea_tty_port, - std::string nmea_dump_filename, std::string nmea_dump_devname, int rinex_version, - bool flag_rtcm_server, bool flag_rtcm_tty_port, unsigned short rtcm_tcp_port, - unsigned short rtcm_station_id, std::map rtcm_msg_rate_ms, std::string rtcm_dump_devname, const unsigned int type_of_receiver, rtk_t& rtk) : gr::sync_block("rtklib_pvt_cc", - gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), - gr::io_signature::make(0, 0, 0)) +rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, + bool dump, + std::string dump_filename, + int output_rate_ms, + int display_rate_ms, + bool flag_nmea_tty_port, + std::string nmea_dump_filename, + std::string nmea_dump_devname, + int rinex_version, + int rinexobs_rate_ms, + int rinexnav_rate_ms, + bool flag_rtcm_server, + bool flag_rtcm_tty_port, + unsigned short rtcm_tcp_port, + unsigned short rtcm_station_id, + std::map rtcm_msg_rate_ms, + std::string rtcm_dump_devname, + const unsigned int type_of_receiver, + rtk_t& rtk) : gr::sync_block("rtklib_pvt_cc", + gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), + gr::io_signature::make(0, 0, 0)) { d_output_rate_ms = output_rate_ms; d_display_rate_ms = display_rate_ms; @@ -255,28 +273,28 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump this->message_port_register_in(pmt::mp("telemetry")); this->set_msg_handler(pmt::mp("telemetry"), boost::bind(&rtklib_pvt_cc::msg_handler_telemetry, this, _1)); - //initialize kml_printer + // initialize kml_printer std::string kml_dump_filename; kml_dump_filename = d_dump_filename; d_kml_dump = std::make_shared(); d_kml_dump->set_headers(kml_dump_filename); - //initialize gpx_printer + // initialize gpx_printer std::string gpx_dump_filename; gpx_dump_filename = d_dump_filename; d_gpx_dump = std::make_shared(); d_gpx_dump->set_headers(gpx_dump_filename); - //initialize geojson_printer + // initialize geojson_printer std::string geojson_dump_filename; geojson_dump_filename = d_dump_filename; d_geojson_printer = std::make_shared(); d_geojson_printer->set_headers(geojson_dump_filename); - //initialize nmea_printer + // initialize nmea_printer d_nmea_printer = std::make_shared(nmea_dump_filename, flag_nmea_tty_port, nmea_dump_devname); - //initialize rtcm_printer + // initialize rtcm_printer std::string rtcm_dump_filename; rtcm_dump_filename = d_dump_filename; d_rtcm_printer = std::make_shared(rtcm_dump_filename, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_dump_devname); @@ -332,6 +350,14 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump } b_rtcm_writing_started = false; + // initialize RINEX printer + b_rinex_header_written = false; + b_rinex_header_updated = false; + d_rinex_version = rinex_version; + rp = std::make_shared(d_rinex_version); + d_rinexobs_rate_ms = rinexobs_rate_ms; + d_rinexnav_rate_ms = rinexnav_rate_ms; + d_dump_filename.append("_raw.dat"); dump_ls_pvt_filename.append("_ls_pvt.dat"); @@ -339,21 +365,6 @@ rtklib_pvt_cc::rtklib_pvt_cc(unsigned int nchannels, bool dump, std::string dump d_ls_pvt->set_averaging_depth(1); d_rx_time = 0.0; - last_pvt_display_T_rx_s = 0.0; - last_RTCM_1019_output_time = 0.0; - last_RTCM_1020_output_time = 0.0; - last_RTCM_1045_output_time = 0.0; - last_RTCM_1077_output_time = 0.0; - last_RTCM_1087_output_time = 0.0; - last_RTCM_1097_output_time = 0.0; - last_RTCM_MSM_output_time = 0.0; - last_RINEX_obs_output_time = 0.0; - last_RINEX_nav_output_time = 0.0; - - b_rinex_header_written = false; - b_rinex_header_updated = false; - d_rinex_version = rinex_version; - rp = std::make_shared(d_rinex_version); d_last_status_print_seg = 0; @@ -392,7 +403,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() { msgctl(sysv_msqid, IPC_RMID, NULL); - //save GPS L2CM ephemeris to XML file + // save GPS L2CM ephemeris to XML file std::string file_name = "eph_GPS_CNAV.xml"; if (d_ls_pvt->gps_cnav_ephemeris_map.size() > 0) @@ -415,7 +426,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() LOG(WARNING) << "Failed to save GPS L2CM or L5 Ephemeris, map is empty"; } - //save GPS L1 CA ephemeris to XML file + // save GPS L1 CA ephemeris to XML file file_name = "eph_GPS_L1CA.xml"; if (d_ls_pvt->gps_ephemeris_map.size() > 0) @@ -438,7 +449,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() LOG(WARNING) << "Failed to save GPS L1 CA Ephemeris, map is empty"; } - //save Galileo E1 ephemeris to XML file + // save Galileo E1 ephemeris to XML file file_name = "eph_Galileo_E1.xml"; if (d_ls_pvt->galileo_ephemeris_map.size() > 0) @@ -461,7 +472,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() LOG(WARNING) << "Failed to save Galileo E1 Ephemeris, map is empty"; } - //save GLONASS GNAV ephemeris to XML file + // save GLONASS GNAV ephemeris to XML file file_name = "eph_GLONASS_GNAV.xml"; if (d_ls_pvt->glonass_gnav_ephemeris_map.size() > 0) @@ -483,6 +494,7 @@ rtklib_pvt_cc::~rtklib_pvt_cc() { LOG(WARNING) << "Failed to save GLONASS GNAV Ephemeris, map is empty"; } + if (d_dump_file.is_open() == true) { try @@ -505,15 +517,15 @@ bool rtklib_pvt_cc::observables_pairCompare_min(const std::pair 0) { double current_RX_time = gnss_observables_map.begin()->second.RX_time; - - if (std::fabs(current_RX_time - d_rx_time) * 1000.0 >= static_cast(d_output_rate_ms)) + unsigned int current_RX_time_ms = static_cast(current_RX_time * 1000.0); + if (current_RX_time_ms % d_output_rate_ms == 0) { flag_compute_pvt_output = true; d_rx_time = current_RX_time; + // std::cout.precision(17); + // std::cout << "current_RX_time: " << current_RX_time << " map time: " << gnss_observables_map.begin()->second.RX_time << std::endl; } // compute on the fly PVT solution if (flag_compute_pvt_output == true) { - if (d_ls_pvt->get_PVT(gnss_observables_map, d_rx_time, false)) + // receiver clock correction is disabled to be coherent with the RINEX and RTCM standard + // std::cout << TEXT_RED << "(internal) accumulated RX clock offset: " << d_ls_pvt->get_time_offset_s() << "[s]" << TEXT_RESET << std::endl; + // for (std::map::iterator it = gnss_observables_map.begin(); it != gnss_observables_map.end(); ++it) + // { + // todo: check if it has effect to correct the receiver time for the internal pvt solution + // take into account that the RINEX obs with the RX time (integer ms) CAN NOT be corrected to keep the coherence in obs time + // it->second.Pseudorange_m = it->second.Pseudorange_m - d_ls_pvt->get_time_offset_s() * GPS_C_m_s; + // } + + if (d_ls_pvt->get_PVT(gnss_observables_map, false)) { - if (std::fabs(current_RX_time - last_pvt_display_T_rx_s) * 1000.0 >= static_cast(d_display_rate_ms)) + if (current_RX_time_ms % d_display_rate_ms == 0) { flag_display_pvt = true; - last_pvt_display_T_rx_s = current_RX_time; } - if ((std::fabs(current_RX_time - last_RTCM_1019_output_time) * 1000.0 >= static_cast(d_rtcm_MT1019_rate_ms)) and (d_rtcm_MT1019_rate_ms != 0)) // allows deactivating messages by setting rate = 0 + if (current_RX_time_ms % d_rtcm_MT1019_rate_ms == 0 and d_rtcm_MT1019_rate_ms != 0) // allows deactivating messages by setting rate = 0 { flag_write_RTCM_1019_output = true; - last_RTCM_1019_output_time = current_RX_time; } - if ((std::fabs(current_RX_time - last_RTCM_1020_output_time) * 1000.0 >= static_cast(d_rtcm_MT1020_rate_ms)) and (d_rtcm_MT1020_rate_ms != 0)) // allows deactivating messages by setting rate = 0 + if (current_RX_time_ms % d_rtcm_MT1020_rate_ms == 0 and d_rtcm_MT1020_rate_ms != 0) // allows deactivating messages by setting rate = 0 { flag_write_RTCM_1020_output = true; - last_RTCM_1020_output_time = current_RX_time; } - if ((std::fabs(current_RX_time - last_RTCM_1045_output_time) * 1000.0 >= static_cast(d_rtcm_MT1045_rate_ms)) and (d_rtcm_MT1045_rate_ms != 0)) + if (current_RX_time_ms % d_rtcm_MT1045_rate_ms == 0 and d_rtcm_MT1045_rate_ms != 0) { flag_write_RTCM_1045_output = true; - last_RTCM_1045_output_time = current_RX_time; } + // TODO: RTCM 1077, 1087 and 1097 are not used, so, disable the output rates + // if (current_RX_time_ms % d_rtcm_MT1077_rate_ms==0 and d_rtcm_MT1077_rate_ms != 0) + // { + // last_RTCM_1077_output_time = current_RX_time; + // } + // if (current_RX_time_ms % d_rtcm_MT1087_rate_ms==0 and d_rtcm_MT1087_rate_ms != 0) + // { + // last_RTCM_1087_output_time = current_RX_time; + // } + // if (current_RX_time_ms % d_rtcm_MT1097_rate_ms==0 and d_rtcm_MT1097_rate_ms != 0) + // { + // last_RTCM_1097_output_time = current_RX_time; + // } - if ((std::fabs(current_RX_time - last_RTCM_1077_output_time) * 1000.0 >= static_cast(d_rtcm_MT1077_rate_ms)) and (d_rtcm_MT1077_rate_ms != 0)) - { - last_RTCM_1077_output_time = current_RX_time; - } - if ((std::fabs(current_RX_time - last_RTCM_1087_output_time) * 1000.0 >= static_cast(d_rtcm_MT1087_rate_ms)) and (d_rtcm_MT1087_rate_ms != 0)) - { - last_RTCM_1087_output_time = current_RX_time; - } - if ((std::fabs(current_RX_time - last_RTCM_1097_output_time) * 1000.0 >= static_cast(d_rtcm_MT1097_rate_ms)) and (d_rtcm_MT1097_rate_ms != 0)) - { - last_RTCM_1097_output_time = current_RX_time; - } - - if ((std::fabs(current_RX_time - last_RTCM_MSM_output_time) * 1000.0 >= static_cast(d_rtcm_MSM_rate_ms)) and (d_rtcm_MSM_rate_ms != 0)) + if (current_RX_time_ms % d_rtcm_MSM_rate_ms == 0 and d_rtcm_MSM_rate_ms != 0) { flag_write_RTCM_MSM_output = true; - last_RTCM_MSM_output_time = current_RX_time; } - if ((std::fabs(current_RX_time - last_RINEX_obs_output_time) >= 1.0)) // TODO: Make it configurable + if (current_RX_time_ms % static_cast(d_rinexobs_rate_ms) == 0) { flag_write_RINEX_obs_output = true; - last_RINEX_obs_output_time = current_RX_time; } - if ((std::fabs(current_RX_time - last_RINEX_nav_output_time) >= 6.0)) // TODO: Make it configurable + if (current_RX_time_ms % static_cast(d_rinexnav_rate_ms) == 0) { flag_write_RINEX_nav_output = true; - last_RINEX_nav_output_time = current_RX_time; } - // correct the observable to account for the receiver clock offset - - for (std::map::iterator it = gnss_observables_map.begin(); it != gnss_observables_map.end(); ++it) - { - it->second.Pseudorange_m = it->second.Pseudorange_m - d_ls_pvt->get_time_offset_s() * GPS_C_m_s; - } if (first_fix == true) { std::cout << "First position fix at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time()) @@ -1523,8 +1533,8 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item } if (flag_write_RTCM_MSM_output == true) { - //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); - //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); + // gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); + // galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); unsigned int i = 0; for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) { @@ -1588,8 +1598,8 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item } if (flag_write_RTCM_MSM_output == true) { - //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); - //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); + // gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); + // galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); unsigned int i = 0; for (gnss_observables_iter = gnss_observables_map.begin(); gnss_observables_iter != gnss_observables_map.end(); gnss_observables_iter++) { @@ -1653,8 +1663,8 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item } if (flag_write_RTCM_MSM_output == true) { - //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); - //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); + // gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); + // galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); unsigned int i = 0; for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) { @@ -1840,8 +1850,8 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item } } - //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); - //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); + // gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); + // galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); unsigned int i = 0; for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) { @@ -1955,8 +1965,8 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item } } - //gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); - //galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); + // gps_ephemeris_iter = d_ls_pvt->gps_ephemeris_map.end(); + // galileo_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.end(); unsigned int i = 0; for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); gnss_observables_iter++) { @@ -2072,18 +2082,36 @@ int rtklib_pvt_cc::work(int noutput_items, gr_vector_const_void_star& input_item // DEBUG MESSAGE: Display position in console output if (d_ls_pvt->is_valid_position() and flag_display_pvt) { - std::cout << TEXT_BOLD_GREEN << "Position at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time()) - << " UTC using " << d_ls_pvt->get_num_valid_observations() << " observations is Lat = " << d_ls_pvt->get_latitude() << " [deg], Long = " << d_ls_pvt->get_longitude() - << " [deg], Height= " << d_ls_pvt->get_height() << " [m]" << TEXT_RESET << std::endl; + std::streamsize ss = std::cout.precision(); // save current precision + std::cout.setf(std::ios::fixed, std::ios::floatfield); + + auto facet = new boost::posix_time::time_facet("%Y-%b-%d %H:%M:%S.%f %z"); + std::cout.imbue(std::locale(std::cout.getloc(), facet)); + + std::cout << TEXT_BOLD_GREEN + << "Position at " << d_ls_pvt->get_position_UTC_time() + << " UTC using " << d_ls_pvt->get_num_valid_observations() + << std::fixed << std::setprecision(9) + << " observations is Lat = " << d_ls_pvt->get_latitude() << " [deg], Long = " << d_ls_pvt->get_longitude() + << std::fixed << std::setprecision(3) + << " [deg], Height = " << d_ls_pvt->get_height() << " [m]" << TEXT_RESET << std::endl; + std::cout << std::setprecision(ss); + LOG(INFO) << "RX clock offset: " << d_ls_pvt->get_time_offset_s() << "[s]"; + + // boost::posix_time::ptime p_time; + // gtime_t rtklib_utc_time = gpst2time(adjgpsweek(d_ls_pvt->gps_ephemeris_map.cbegin()->second.i_GPS_week), d_rx_time); + // p_time = boost::posix_time::from_time_t(rtklib_utc_time.time); + // p_time += boost::posix_time::microseconds(round(rtklib_utc_time.sec * 1e6)); + // std::cout << TEXT_MAGENTA << "Observable RX time (GPST) " << boost::posix_time::to_simple_string(p_time) << TEXT_RESET << std::endl; LOG(INFO) << "Position at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time()) << " UTC using " << d_ls_pvt->get_num_valid_observations() << " observations is Lat = " << d_ls_pvt->get_latitude() << " [deg], Long = " << d_ls_pvt->get_longitude() - << " [deg], Height= " << d_ls_pvt->get_height() << " [m]"; + << " [deg], Height = " << d_ls_pvt->get_height() << " [m]"; /* std::cout << "Dilution of Precision at " << boost::posix_time::to_simple_string(d_ls_pvt->get_position_UTC_time()) - << " UTC using "<< d_ls_pvt->get_num_valid_observations()<<" observations is HDOP = " << d_ls_pvt->get_HDOP() << " VDOP = " - << d_ls_pvt->get_VDOP() <<" TDOP = " << d_ls_pvt->get_TDOP() - << " GDOP = " << d_ls_pvt->get_GDOP() << std::endl; */ + << " UTC using "<< d_ls_pvt->get_num_valid_observations() <<" observations is HDOP = " << d_ls_pvt->get_hdop() << " VDOP = " + << d_ls_pvt->get_vdop() + << " GDOP = " << d_ls_pvt->get_gdop() << std::endl; */ } // MULTIPLEXED FILE RECORDING - Record results to file diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h index b208f4c0c..17b735b12 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_cc.h @@ -62,6 +62,8 @@ rtklib_pvt_cc_sptr rtklib_make_pvt_cc(unsigned int n_channels, std::string nmea_dump_filename, std::string nmea_dump_devname, int rinex_version, + int rinexobs_rate_ms, + int rinexnav_rate_ms, bool flag_rtcm_server, bool flag_rtcm_tty_port, unsigned short rtcm_tcp_port, @@ -86,6 +88,8 @@ private: std::string nmea_dump_filename, std::string nmea_dump_devname, int rinex_version, + int rinexobs_rate_ms, + int rinexnav_rate_ms, bool flag_rtcm_server, bool flag_rtcm_tty_port, unsigned short rtcm_tcp_port, @@ -101,6 +105,9 @@ private: bool b_rinex_header_written; bool b_rinex_header_updated; double d_rinex_version; + int d_rinexobs_rate_ms; + int d_rinexnav_rate_ms; + bool b_rtcm_writing_started; int d_rtcm_MT1045_rate_ms; //!< Galileo Broadcast Ephemeris int d_rtcm_MT1019_rate_ms; //!< GPS Broadcast Ephemeris (orbits) @@ -126,16 +133,7 @@ private: std::shared_ptr d_geojson_printer; std::shared_ptr d_rtcm_printer; double d_rx_time; - double last_pvt_display_T_rx_s; - double last_RTCM_1019_output_time; - double last_RTCM_1020_output_time; - double last_RTCM_1045_output_time; - double last_RTCM_1077_output_time; - double last_RTCM_1087_output_time; - double last_RTCM_1097_output_time; - double last_RTCM_MSM_output_time; - double last_RINEX_obs_output_time; - double last_RINEX_nav_output_time; + std::shared_ptr d_ls_pvt; std::map gnss_observables_map; @@ -163,6 +161,8 @@ public: std::string nmea_dump_filename, std::string nmea_dump_devname, int rinex_version, + int rinexobs_rate_ms, + int rinexnav_rate_ms, bool flag_rtcm_server, bool flag_rtcm_tty_port, unsigned short rtcm_tcp_port, diff --git a/src/algorithms/PVT/libs/gpx_printer.cc b/src/algorithms/PVT/libs/gpx_printer.cc index 3a8661e6d..1949bb7dc 100644 --- a/src/algorithms/PVT/libs/gpx_printer.cc +++ b/src/algorithms/PVT/libs/gpx_printer.cc @@ -1,6 +1,6 @@ /*! * \file gpx_printer.cc - * \brief Interface of a class that prints PVT information to a gpx file + * \brief Implementation of a class that prints PVT information to a gpx file * \author Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com * * diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc index 25898e195..6f269b7c7 100644 --- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc +++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc @@ -33,6 +33,7 @@ #include "Galileo_E1.h" #include "GPS_L1_CA.h" #include "GPS_L2C.h" +#include #include @@ -338,7 +339,7 @@ bool hybrid_ls_pvt::get_PVT(std::map gnss_observables_map, do } // get time string Gregorian calendar - boost::posix_time::time_duration t = boost::posix_time::seconds(utc); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast(utc * 1000.0)); // 22 August 1999 00:00 last Galileo start GST epoch (ICD sec 5.1.2) boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); this->set_position_UTC_time(p_time); diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 859239096..d4a228b4e 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -8247,7 +8247,7 @@ boost::posix_time::ptime Rinex_Printer::compute_UTC_time(const Gps_Navigation_Me // if we are processing a file -> wait to leap second to resolve the ambiguity else take the week from the local system time //: idea resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm const double utc_t = nav_msg.utc_time(nav_msg.d_TOW); - boost::posix_time::time_duration t = boost::posix_time::millisec((utc_t + 604800 * static_cast(nav_msg.i_GPS_week)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((utc_t + 604800 * static_cast(nav_msg.i_GPS_week)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -8260,7 +8260,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf) // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -8273,7 +8273,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeri // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf) // --??? No time correction here, since it will be done in the RINEX processor const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -8285,7 +8285,7 @@ boost::posix_time::ptime Rinex_Printer::compute_Galileo_time(const Galileo_Ephem // (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex301.pdf) // --??? No time correction here, since it will be done in the RINEX processor double galileo_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((galileo_t + 604800 * static_cast(eph.WN_5)) * 1000); // + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((galileo_t + 604800 * static_cast(eph.WN_5)) * 1000)); // boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 8d74aea20..7f3606051 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -70,7 +70,7 @@ rtklib_solver::rtklib_solver(int nchannels, std::string dump_filename, bool flag count_valid_position = 0; this->set_averaging_flag(false); rtk_ = rtk; - for (unsigned int i = 0; i > 4; i++) dop_[i] = 0.0; + for (unsigned int i = 0; i < 4; i++) dop_[i] = 0.0; pvt_sol = {{0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, '0', '0', '0', 0, 0, 0}; // ############# ENABLE DATA FILE LOG ################# @@ -133,7 +133,7 @@ double rtklib_solver::get_vdop() const } -bool rtklib_solver::get_PVT(const std::map& gnss_observables_map, double Rx_time, bool flag_averaging) +bool rtklib_solver::get_PVT(const std::map& gnss_observables_map, bool flag_averaging) { std::map::const_iterator gnss_observables_iter; std::map::const_iterator galileo_ephemeris_iter; @@ -147,16 +147,45 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ // ******************************************************************************** // ****** PREPARE THE DATA (SV EPHEMERIS AND OBSERVATIONS) ************************ // ******************************************************************************** - int valid_obs = 0; //valid observations counter - int glo_valid_obs = 0; //GLONASS L1/L2 valid observations counter + int valid_obs = 0; // valid observations counter + int glo_valid_obs = 0; // GLONASS L1/L2 valid observations counter obsd_t obs_data[MAXOBS]; eph_t eph_data[MAXOBS]; geph_t geph_data[MAXOBS]; + // Workaround for NAV/CNAV clash problem + bool gps_dual_band = false; + bool band1 = false; + bool band2 = false; for (gnss_observables_iter = gnss_observables_map.cbegin(); gnss_observables_iter != gnss_observables_map.cend(); - gnss_observables_iter++) //CHECK INCONSISTENCY when combining GLONASS + other system + ++gnss_observables_iter) + { + switch (gnss_observables_iter->second.System) + { + case 'G': + { + std::string sig_(gnss_observables_iter->second.Signal); + if (sig_.compare("1C") == 0) + { + band1 = true; + } + if (sig_.compare("2S") == 0) + { + band2 = true; + } + } + default: + { + } + } + } + if (band1 == true and band2 == true) gps_dual_band = true; + + for (gnss_observables_iter = gnss_observables_map.cbegin(); + gnss_observables_iter != gnss_observables_map.cend(); + ++gnss_observables_iter) // CHECK INCONSISTENCY when combining GLONASS + other system { switch (gnss_observables_iter->second.System) { @@ -170,9 +199,9 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ galileo_ephemeris_iter = galileo_ephemeris_map.find(gnss_observables_iter->second.PRN); if (galileo_ephemeris_iter != galileo_ephemeris_map.cend()) { - //convert ephemeris from GNSS-SDR class to RTKLIB structure + // convert ephemeris from GNSS-SDR class to RTKLIB structure eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); - //convert observation from GNSS-SDR class to RTKLIB structure + // convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}}; obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, @@ -201,17 +230,17 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs], gnss_observables_iter->second, galileo_ephemeris_iter->second.WN_5, - 2); //Band 3 (L5/E5) + 2); // Band 3 (L5/E5) found_E1_obs = true; break; } } if (!found_E1_obs) { - //insert Galileo E5 obs as new obs and also insert its ephemeris - //convert ephemeris from GNSS-SDR class to RTKLIB structure + // insert Galileo E5 obs as new obs and also insert its ephemeris + // convert ephemeris from GNSS-SDR class to RTKLIB structure eph_data[valid_obs] = eph_to_rtklib(galileo_ephemeris_iter->second); - //convert observation from GNSS-SDR class to RTKLIB structure + // convert observation from GNSS-SDR class to RTKLIB structure unsigned char default_code_ = static_cast(CODE_NONE); obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {default_code_, default_code_, default_code_}, @@ -219,7 +248,7 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, galileo_ephemeris_iter->second.WN_5, - 2); //Band 3 (L5/E5) + 2); // Band 3 (L5/E5) valid_obs++; } } @@ -240,9 +269,9 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ gps_ephemeris_iter = gps_ephemeris_map.find(gnss_observables_iter->second.PRN); if (gps_ephemeris_iter != gps_ephemeris_map.cend()) { - //convert ephemeris from GNSS-SDR class to RTKLIB structure + // convert ephemeris from GNSS-SDR class to RTKLIB structure eph_data[valid_obs] = eph_to_rtklib(gps_ephemeris_iter->second); - //convert observation from GNSS-SDR class to RTKLIB structure + // convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}}; obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, @@ -255,8 +284,8 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ DLOG(INFO) << "No ephemeris data for SV " << gnss_observables_iter->first; } } - //GPS L2 - if (sig_.compare("2S") == 0) + // GPS L2 (todo: solve NAV/CNAV clash) + if ((sig_.compare("2S") == 0) and (gps_dual_band == false)) { gps_cnav_ephemeris_iter = gps_cnav_ephemeris_map.find(gnss_observables_iter->second.PRN); if (gps_cnav_ephemeris_iter != gps_cnav_ephemeris_map.cend()) @@ -276,7 +305,7 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i + glo_valid_obs], gnss_observables_iter->second, eph_data[i].week, - 1); //Band 2 (L2) + 1); // Band 2 (L2) break; } } @@ -285,9 +314,9 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ else { // 3. If not found, insert the GPS L2 ephemeris and the observation - //convert ephemeris from GNSS-SDR class to RTKLIB structure + // convert ephemeris from GNSS-SDR class to RTKLIB structure eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); - //convert observation from GNSS-SDR class to RTKLIB structure + // convert observation from GNSS-SDR class to RTKLIB structure unsigned char default_code_ = static_cast(CODE_NONE); obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {default_code_, default_code_, default_code_}, @@ -295,7 +324,7 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, - 1); //Band 2 (L2) + 1); // Band 2 (L2) valid_obs++; } } @@ -304,7 +333,7 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ DLOG(INFO) << "No ephemeris data for SV " << gnss_observables_iter->second.PRN; } } - //GPS L5 + // GPS L5 if (sig_.compare("L5") == 0) { gps_cnav_ephemeris_iter = gps_cnav_ephemeris_map.find(gnss_observables_iter->second.PRN); @@ -324,7 +353,7 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ obs_data[i + glo_valid_obs] = insert_obs_to_rtklib(obs_data[i], gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, - 2); //Band 3 (L5) + 2); // Band 3 (L5) break; } } @@ -332,9 +361,9 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ else { // 3. If not found, insert the GPS L5 ephemeris and the observation - //convert ephemeris from GNSS-SDR class to RTKLIB structure + // convert ephemeris from GNSS-SDR class to RTKLIB structure eph_data[valid_obs] = eph_to_rtklib(gps_cnav_ephemeris_iter->second); - //convert observation from GNSS-SDR class to RTKLIB structure + // convert observation from GNSS-SDR class to RTKLIB structure unsigned char default_code_ = static_cast(CODE_NONE); obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {default_code_, default_code_, default_code_}, @@ -342,7 +371,7 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, gps_cnav_ephemeris_iter->second.i_GPS_week, - 2); //Band 3 (L5) + 2); // Band 3 (L5) valid_obs++; } } @@ -363,14 +392,14 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ glonass_gnav_ephemeris_iter = glonass_gnav_ephemeris_map.find(gnss_observables_iter->second.PRN); if (glonass_gnav_ephemeris_iter != glonass_gnav_ephemeris_map.cend()) { - //convert ephemeris from GNSS-SDR class to RTKLIB structure + // convert ephemeris from GNSS-SDR class to RTKLIB structure geph_data[glo_valid_obs] = eph_to_rtklib(glonass_gnav_ephemeris_iter->second, gnav_utc); - //convert observation from GNSS-SDR class to RTKLIB structure + // convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}}; obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, glonass_gnav_ephemeris_iter->second.d_WN, - 0); //Band 0 (L1) + 0); // Band 0 (L1) glo_valid_obs++; } else // the ephemeris are not available for this SV @@ -400,15 +429,15 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ } if (!found_L1_obs) { - //insert GLONASS GNAV L2 obs as new obs and also insert its ephemeris - //convert ephemeris from GNSS-SDR class to RTKLIB structure + // insert GLONASS GNAV L2 obs as new obs and also insert its ephemeris + // convert ephemeris from GNSS-SDR class to RTKLIB structure geph_data[glo_valid_obs] = eph_to_rtklib(glonass_gnav_ephemeris_iter->second, gnav_utc); - //convert observation from GNSS-SDR class to RTKLIB structure + // convert observation from GNSS-SDR class to RTKLIB structure obsd_t newobs = {{0, 0}, '0', '0', {}, {}, {}, {}, {}, {}}; obs_data[valid_obs + glo_valid_obs] = insert_obs_to_rtklib(newobs, gnss_observables_iter->second, glonass_gnav_ephemeris_iter->second.d_WN, - 1); //Band 1 (L2) + 1); // Band 1 (L2) glo_valid_obs++; } } @@ -463,14 +492,14 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ unsigned int used_sats = 0; for (unsigned int i = 0; i < MAXSAT; i++) { - if (int vsat = rtk_.ssat[i].vsat[0] == 1) used_sats++; + if (rtk_.ssat[i].vsat[0] == 1) used_sats++; } double azel[used_sats * 2]; unsigned int index_aux = 0; for (unsigned int i = 0; i < MAXSAT; i++) { - if (int vsat = rtk_.ssat[i].vsat[0] == 1) + if (rtk_.ssat[i].vsat[0] == 1) { azel[2 * index_aux] = rtk_.ssat[i].azel[0]; azel[2 * index_aux + 1] = rtk_.ssat[i].azel[1]; @@ -481,19 +510,35 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ this->set_valid_position(true); arma::vec rx_position_and_time(4); - rx_position_and_time(0) = pvt_sol.rr[0]; - rx_position_and_time(1) = pvt_sol.rr[1]; - rx_position_and_time(2) = pvt_sol.rr[2]; - rx_position_and_time(3) = pvt_sol.dtr[0]; + rx_position_and_time(0) = pvt_sol.rr[0]; // [m] + rx_position_and_time(1) = pvt_sol.rr[1]; // [m] + rx_position_and_time(2) = pvt_sol.rr[2]; // [m] + + //todo: fix this ambiguity in the RTKLIB units in receiver clock offset! + if (rtk_.opt.mode == PMODE_SINGLE) + { + rx_position_and_time(3) = pvt_sol.dtr[0]; // if the RTKLIB solver is set to SINGLE, the dtr is already expressed in [s] + } + else + { + rx_position_and_time(3) = pvt_sol.dtr[0] / GPS_C_m_s; // the receiver clock offset is expressed in [meters], so we convert it into [s] + } this->set_rx_pos(rx_position_and_time.rows(0, 2)); // save ECEF position for the next iteration - double offset_s = this->get_time_offset_s(); - this->set_time_offset_s(offset_s + (rx_position_and_time(3) / GPS_C_m_s)); // accumulate the rx time error for the next iteration [meters]->[seconds] - DLOG(INFO) << "RTKLIB Position at TOW=" << Rx_time << " in ECEF (X,Y,Z,t[meters]) = " << rx_position_and_time; + //observable fix: + //double offset_s = this->get_time_offset_s(); + //this->set_time_offset_s(offset_s + (rx_position_and_time(3) / GPS_C_m_s)); // accumulate the rx time error for the next iteration [meters]->[seconds] + this->set_time_offset_s(rx_position_and_time(3)); + + DLOG(INFO) << "RTKLIB Position at RX TOW = " << gnss_observables_map.begin()->second.RX_time + << " in ECEF (X,Y,Z,t[meters]) = " << rx_position_and_time; boost::posix_time::ptime p_time; - gtime_t rtklib_utc_time = gpst2utc(pvt_sol.time); + // gtime_t rtklib_utc_time = gpst2utc(pvt_sol.time); //Corrected RX Time (Non integer multiply of 1 ms of granularity) + // Uncorrected RX Time (integer multiply of 1 ms and the same observables time reported in RTCM and RINEX) + gtime_t rtklib_time = gpst2time(adjgpsweek(nav_data.eph[0].week), gnss_observables_map.begin()->second.RX_time); + gtime_t rtklib_utc_time = gpst2utc(rtklib_time); p_time = boost::posix_time::from_time_t(rtklib_utc_time.time); - p_time += boost::posix_time::microseconds(round(rtklib_utc_time.sec * 1e6)); + p_time += boost::posix_time::microseconds(static_cast(round(rtklib_utc_time.sec * 1e6))); this->set_position_UTC_time(p_time); cart2geo(static_cast(rx_position_and_time(0)), static_cast(rx_position_and_time(1)), static_cast(rx_position_and_time(2)), 4); @@ -509,8 +554,8 @@ bool rtklib_solver::get_PVT(const std::map& gnss_observables_ try { double tmp_double; - // PVT GPS time - tmp_double = Rx_time; + // PVT GPS time + tmp_double = gnss_observables_map.begin()->second.RX_time; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); // ECEF User Position East [m] tmp_double = rx_position_and_time(0); diff --git a/src/algorithms/PVT/libs/rtklib_solver.h b/src/algorithms/PVT/libs/rtklib_solver.h index ac180f617..aa5557606 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.h +++ b/src/algorithms/PVT/libs/rtklib_solver.h @@ -85,12 +85,12 @@ public: rtklib_solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, rtk_t& rtk); ~rtklib_solver(); - bool get_PVT(const std::map& gnss_observables_map, double Rx_time, bool flag_averaging); + bool get_PVT(const std::map& gnss_observables_map, bool flag_averaging); double get_hdop() const; double get_vdop() const; double get_pdop() const; double get_gdop() const; - + std::map galileo_ephemeris_map; //!< Map storing new Galileo_Ephemeris std::map gps_ephemeris_map; //!< Map storing new GPS_Ephemeris std::map gps_cnav_ephemeris_map; //!< Map storing new GPS_CNAV_Ephemeris diff --git a/src/algorithms/acquisition/CMakeLists.txt b/src/algorithms/acquisition/CMakeLists.txt index 0dc31ec9b..96259341c 100644 --- a/src/algorithms/acquisition/CMakeLists.txt +++ b/src/algorithms/acquisition/CMakeLists.txt @@ -18,7 +18,4 @@ add_subdirectory(adapters) add_subdirectory(gnuradio_blocks) -if(ENABLE_FPGA) - add_subdirectory(libs) -endif(ENABLE_FPGA) - +add_subdirectory(libs) diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index 831601796..82b4b33c1 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -65,4 +65,4 @@ file(GLOB ACQ_ADAPTER_HEADERS "*.h") list(SORT ACQ_ADAPTER_HEADERS) add_library(acq_adapters ${ACQ_ADAPTER_SOURCES} ${ACQ_ADAPTER_HEADERS}) source_group(Headers FILES ${ACQ_ADAPTER_HEADERS}) -target_link_libraries(acq_adapters gnss_sp_libs gnss_sdr_flags acq_gr_blocks ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}) +target_link_libraries(acq_adapters acquisition_lib gnss_sp_libs gnss_sdr_flags acq_gr_blocks ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES}) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 58848a9a7..60d19ad08 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -55,7 +55,6 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration_->property(role + ".if", 0); dump_ = configuration_->property(role + ".dump", false); doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -88,7 +87,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( { item_size_ = sizeof(gr_complex); acquisition_cc_ = galileo_pcps_8ms_make_acquisition_cc(sampled_ms_, max_dwells_, - doppler_max_, if_, fs_in_, samples_per_ms, code_length_, + doppler_max_, fs_in_, samples_per_ms, code_length_, dump_, dump_filename_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); DLOG(INFO) << "stream_to_vector(" @@ -106,6 +105,14 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 8cc3f3383..e603665dc 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 @@ -139,7 +139,6 @@ private: unsigned int sampled_ms_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index c58b5b6f2..f377a72c8 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -34,6 +34,7 @@ #include "galileo_e1_signal_processing.h" #include "Galileo_E1.h" #include "gnss_sdr_flags.h" +#include "acq_conf.h" #include #include #include @@ -45,7 +46,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_t acq_parameters; + Acq_Conf acq_parameters; configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./data/acquisition.dat"; @@ -57,10 +58,9 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; - if_ = configuration_->property(role + ".if", 0); - acq_parameters.freq = if_; dump_ = configuration_->property(role + ".dump", false); acq_parameters.dump = dump_; + acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); acq_parameters.blocking = blocking_; doppler_max_ = configuration_->property(role + ".doppler_max", 5000); @@ -104,6 +104,7 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acquisition_ = pcps_make_acquisition(acq_parameters); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; @@ -120,6 +121,14 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 9020cf15f..9dfe42e9d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.h @@ -152,7 +152,6 @@ private: unsigned int sampled_ms_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; bool blocking_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index 12fe08849..625c92396 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -54,7 +54,6 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration_->property(role + ".if", 0); dump_ = configuration_->property(role + ".dump", false); doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -89,7 +88,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition { item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_cccwsr_make_acquisition_cc(sampled_ms_, max_dwells_, - doppler_max_, if_, fs_in_, samples_per_ms, code_length_, + doppler_max_, fs_in_, samples_per_ms, code_length_, dump_, dump_filename_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); DLOG(INFO) << "stream_to_vector(" @@ -107,6 +106,14 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 01e63c256..45888040c 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 @@ -142,7 +142,6 @@ private: unsigned int sampled_ms_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_data_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 519dccc86..34c56ddf9 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -55,7 +55,6 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration_->property(role + ".if", 0); dump_ = configuration_->property(role + ".dump", false); doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -70,7 +69,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui /*Calculate the folding factor value based on the formula described in the paper. This may be a bug, but acquisition also work by variying the folding factor at va- lues different that the expressed in the paper. In adition, it is important to point - out that by making the folding factor smaller we were able to get QuickSync work with + out that by making the folding factor smaller we were able to get QuickSync work with Galileo. Future work should be directed to test this asumption statistically.*/ //folding_factor_ = static_cast(ceil(sqrt(log2(code_length_)))); @@ -120,7 +119,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui { item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_quicksync_make_acquisition_cc(folding_factor_, - sampled_ms_, max_dwells_, doppler_max_, if_, fs_in_, + sampled_ms_, max_dwells_, doppler_max_, fs_in_, samples_per_ms, code_length_, bit_transition_flag_, dump_, dump_filename_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, @@ -140,6 +139,14 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 8c9f0b43a..b46fe2986 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 @@ -146,7 +146,6 @@ private: unsigned int max_dwells_; unsigned int folding_factor_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 757ed5bfc..2e5bd5684 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -55,7 +55,6 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration_->property(role + ".if", 0); dump_ = configuration_->property(role + ".dump", false); doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -91,7 +90,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( { item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_, - if_, fs_in_, samples_per_ms, code_length_, tong_init_val_, + fs_in_, samples_per_ms, code_length_, tong_init_val_, tong_max_val_, tong_max_dwells_, dump_, dump_filename_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); @@ -110,6 +109,14 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 675d79770..ad74c02e8 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 @@ -146,7 +146,6 @@ private: unsigned int tong_max_val_; unsigned int tong_max_dwells_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index 9f23a55f3..78d95d36e 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -60,7 +60,6 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration_->property(role + ".if", 0); dump_ = configuration_->property(role + ".dump", false); doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -102,7 +101,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( { item_size_ = sizeof(gr_complex); acquisition_cc_ = galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(sampled_ms_, max_dwells_, - doppler_max_, if_, fs_in_, code_length_, code_length_, bit_transition_flag_, + doppler_max_, fs_in_, code_length_, code_length_, bit_transition_flag_, dump_, dump_filename_, both_signal_components, CAF_window_hz_, Zero_padding); } else @@ -115,6 +114,14 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 002744426..6b333fbbe 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 @@ -146,7 +146,6 @@ private: unsigned int sampled_ms_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; int Zero_padding; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 1367c0272..85aaee1d3 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -33,6 +33,7 @@ #include "galileo_e5_signal_processing.h" #include "Galileo_E5a.h" #include "gnss_sdr_flags.h" +#include "acq_conf.h" #include #include #include @@ -44,7 +45,7 @@ using google::LogMessage; GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_t acq_parameters; + Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "../data/acquisition.dat"; @@ -56,7 +57,6 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; - acq_parameters.freq = 0; acq_pilot_ = configuration_->property(role + ".acquire_pilot", false); acq_iq_ = configuration_->property(role + ".acquire_iq", false); if (acq_iq_) @@ -65,6 +65,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con } dump_ = configuration_->property(role + ".dump", false); acq_parameters.dump = dump_; + acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; @@ -105,6 +106,7 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acquisition_ = pcps_make_acquisition(acq_parameters); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); @@ -112,6 +114,14 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition(ConfigurationInterface* con threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc index 99d13e2db..b654881d7 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -35,6 +35,7 @@ #include "configuration_interface.h" #include "glonass_l1_signal_processing.h" #include "gnss_sdr_flags.h" +#include "acq_conf.h" #include "GLONASS_L1_L2_CA.h" #include #include @@ -46,7 +47,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_t acq_parameters; + Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./data/acquisition.dat"; @@ -58,10 +59,9 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( long 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_; - if_ = configuration_->property(role + ".if", 0); - acq_parameters.freq = if_; dump_ = configuration_->property(role + ".dump", false); acq_parameters.dump = dump_; + acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); acq_parameters.blocking = blocking_; doppler_max_ = configuration_->property(role + ".doppler_max", 5000); @@ -104,6 +104,7 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acquisition_ = pcps_make_acquisition(acq_parameters); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; @@ -120,6 +121,14 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 8250f9d28..ac8295d09 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h @@ -151,7 +151,6 @@ private: unsigned int sampled_ms_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; bool blocking_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc index ff61a0c2f..1f5d251fb 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc @@ -35,6 +35,7 @@ #include "glonass_l2_signal_processing.h" #include "GLONASS_L1_L2_CA.h" #include "gnss_sdr_flags.h" +#include "acq_conf.h" #include #include @@ -45,7 +46,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_t acq_parameters; + Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./data/acquisition.dat"; @@ -57,10 +58,9 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( long 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_; - if_ = configuration_->property(role + ".if", 0); - acq_parameters.freq = if_; dump_ = configuration_->property(role + ".dump", false); acq_parameters.dump = dump_; + acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); acq_parameters.blocking = blocking_; doppler_max_ = configuration_->property(role + ".doppler_max", 5000); @@ -103,6 +103,7 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acquisition_ = pcps_make_acquisition(acq_parameters); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; @@ -119,6 +120,14 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 bb4e0090f..54b15f5be 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h @@ -150,7 +150,6 @@ private: unsigned int sampled_ms_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; bool blocking_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 01f3f7f62..f5602b1b6 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -38,6 +38,7 @@ #include "gps_sdr_signal_processing.h" #include "GPS_L1_CA.h" #include "gnss_sdr_flags.h" +#include "acq_conf.h" #include #include @@ -48,7 +49,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_t acq_parameters; + Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./data/acquisition.dat"; @@ -59,10 +60,9 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( long 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_; - if_ = configuration_->property(role + ".if", 0); - acq_parameters.freq = if_; dump_ = configuration_->property(role + ".dump", false); acq_parameters.dump = dump_; + acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); acq_parameters.blocking = blocking_; doppler_max_ = configuration_->property(role + ".doppler_max", 5000); @@ -104,6 +104,7 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( acq_parameters.samples_per_ms = code_length_; acq_parameters.samples_per_code = code_length_; acq_parameters.it_size = item_size_; + acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acquisition_ = pcps_make_acquisition(acq_parameters); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; @@ -120,6 +121,14 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 edf79e42c..1ac26a80a 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.h @@ -155,7 +155,6 @@ private: unsigned int sampled_ms_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; bool blocking_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index 05f987b0f..30193cb32 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -53,7 +53,6 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( item_type_ = configuration->property(role + ".item_type", default_item_type); long fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration->property(role + ".if", 0); dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); doppler_max_ = configuration->property(role + ".doppler_max", 5000); @@ -71,7 +70,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( { item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_make_acquisition_fine_doppler_cc(max_dwells_, sampled_ms_, - doppler_max_, doppler_min_, if_, fs_in_, vector_length_, + doppler_max_, doppler_min_, fs_in_, vector_length_, dump_, dump_filename_); } else @@ -84,6 +83,14 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 e0bfcf14e..74bcd28a4 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 @@ -135,7 +135,6 @@ private: unsigned int sampled_ms_; int max_dwells_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_; 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 3cbc81bfa..8480441f7 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 @@ -60,8 +60,6 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); long fs_in = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in; - long ifreq = configuration_->property(role + ".if", 0); - acq_parameters.freq = ifreq; doppler_max_ = configuration_->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; acq_parameters.doppler_max = doppler_max_; @@ -95,7 +93,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( { gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code // fill in zero padding - for (int s = code_length; s < nsamples_total; s++) + for (unsigned int s = code_length; s < nsamples_total; s++) { code[s] = 0; } @@ -136,6 +134,14 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( channel_ = 0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index 513497946..528a9a3f2 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -54,7 +54,6 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( item_type_ = configuration->property(role + ".item_type", default_item_type); long fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration->property(role + ".if", 0); dump_ = configuration->property(role + ".dump", false); doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -72,7 +71,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( { item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_make_assisted_acquisition_cc(max_dwells_, sampled_ms_, - doppler_max_, doppler_min_, if_, fs_in_, vector_length_, + doppler_max_, doppler_min_, fs_in_, vector_length_, dump_, dump_filename_); } else @@ -85,6 +84,14 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 06c7728df..905d3525a 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 @@ -136,7 +136,6 @@ private: unsigned int sampled_ms_; int max_dwells_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc index eb2da7bea..7c5b84f63 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc @@ -55,7 +55,6 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration_->property(role + ".if", 0); dump_ = configuration_->property(role + ".dump", false); doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -86,7 +85,7 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( { item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_make_opencl_acquisition_cc(sampled_ms_, max_dwells_, - doppler_max_, if_, fs_in_, code_length_, code_length_, + doppler_max_, fs_in_, code_length_, code_length_, bit_transition_flag_, dump_, dump_filename_); stream_to_vector_ = gr::blocks::stream_to_vector::make(item_size_, vector_length_); @@ -104,6 +103,14 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 ab7e19c94..854c6c0f6 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 @@ -140,7 +140,6 @@ private: unsigned int sampled_ms_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index 9fa165513..b25be59e0 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -54,7 +54,6 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( item_type_ = configuration_->property(role + ".item_type", default_item_type); long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration_->property(role + ".if", 0); dump_ = configuration_->property(role + ".dump", false); doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -113,7 +112,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( { item_size_ = sizeof(gr_complex); acquisition_cc_ = pcps_quicksync_make_acquisition_cc(folding_factor_, - sampled_ms_, max_dwells_, doppler_max_, if_, fs_in_, + sampled_ms_, max_dwells_, doppler_max_, fs_in_, samples_per_ms, code_length_, bit_transition_flag_, dump_, dump_filename_); @@ -133,6 +132,14 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 17e3da109..590890039 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 @@ -148,7 +148,6 @@ private: unsigned int max_dwells_; unsigned int folding_factor_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index 07dfecfd3..e676d5d9c 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -54,7 +54,6 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( long fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - if_ = configuration_->property(role + ".if", 0); dump_ = configuration_->property(role + ".dump", false); doppler_max_ = configuration->property(role + ".doppler_max", 5000); if (FLAGS_doppler_max != 0) doppler_max_ = FLAGS_doppler_max; @@ -76,7 +75,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( if (item_type_.compare("gr_complex") == 0) { item_size_ = sizeof(gr_complex); - acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_, if_, fs_in_, + acquisition_cc_ = pcps_tong_make_acquisition_cc(sampled_ms_, doppler_max_, fs_in_, code_length_, code_length_, tong_init_val_, tong_max_val_, tong_max_dwells_, dump_, dump_filename_); @@ -95,6 +94,14 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 2514a532e..1e63f5801 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 @@ -146,7 +146,6 @@ private: unsigned int tong_max_val_; unsigned int tong_max_dwells_; long fs_in_; - long if_; bool dump_; std::string dump_filename_; std::complex* code_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index bb5f27bc7..2fbb72252 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -36,6 +36,7 @@ #include "gps_l2c_signal.h" #include "GPS_L2C.h" #include "gnss_sdr_flags.h" +#include "acq_conf.h" #include #include @@ -46,7 +47,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_t acq_parameters; + Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./data/acquisition.dat"; @@ -59,10 +60,9 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( long 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_; - if_ = configuration_->property(role + ".if", 0); - acq_parameters.freq = if_; dump_ = configuration_->property(role + ".dump", false); acq_parameters.dump = dump_; + acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); acq_parameters.blocking = blocking_; doppler_max_ = configuration->property(role + ".doppler_max", 5000); @@ -103,6 +103,7 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", true); + acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acquisition_ = pcps_make_acquisition(acq_parameters); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; @@ -119,6 +120,14 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } 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 c6ad236cf..f0b8a807d 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.h @@ -152,7 +152,6 @@ private: unsigned int doppler_step_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; bool blocking_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 78030bfbc..da30699fa 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -36,6 +36,7 @@ #include "gps_l5_signal.h" #include "GPS_L5.h" #include "gnss_sdr_flags.h" +#include "acq_conf.h" #include #include @@ -46,7 +47,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - pcpsconf_t acq_parameters; + Acq_Conf acq_parameters = Acq_Conf(); configuration_ = configuration; std::string default_item_type = "gr_complex"; std::string default_dump_filename = "./data/acquisition.dat"; @@ -58,10 +59,9 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( long 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_; - if_ = configuration_->property(role + ".if", 0); - acq_parameters.freq = if_; dump_ = configuration_->property(role + ".dump", false); acq_parameters.dump = dump_; + acq_parameters.dump_channel = configuration_->property(role + ".dump_channel", 0); blocking_ = configuration_->property(role + ".blocking", true); acq_parameters.blocking = blocking_; doppler_max_ = configuration->property(role + ".doppler_max", 5000); @@ -102,6 +102,7 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( acq_parameters.num_doppler_bins_step2 = configuration_->property(role + ".second_nbins", 4); acq_parameters.doppler_step2 = configuration_->property(role + ".second_doppler_step", 125.0); acq_parameters.make_2_steps = configuration_->property(role + ".make_two_steps", false); + acq_parameters.blocking_on_standby = configuration_->property(role + ".blocking_on_standby", false); acquisition_ = pcps_make_acquisition(acq_parameters); DLOG(INFO) << "acquisition(" << acquisition_->unique_id() << ")"; @@ -118,6 +119,14 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( threshold_ = 0.0; doppler_step_ = 0; gnss_synchro_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } } diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h index 41b0e347b..4a0f0a571 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.h @@ -152,7 +152,6 @@ private: unsigned int doppler_step_; unsigned int max_dwells_; long fs_in_; - long if_; bool dump_; bool blocking_; std::string dump_filename_; diff --git a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt index fbc33410e..50fc61ae9 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt @@ -26,12 +26,12 @@ set(ACQ_GR_BLOCKS_SOURCES pcps_quicksync_acquisition_cc.cc galileo_pcps_8ms_acquisition_cc.cc galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc -) +) if(ENABLE_FPGA) set(ACQ_GR_BLOCKS_SOURCES ${ACQ_GR_BLOCKS_SOURCES} pcps_acquisition_fpga.cc) endif(ENABLE_FPGA) - + if(OPENCL_FOUND) set(ACQ_GR_BLOCKS_SOURCES ${ACQ_GR_BLOCKS_SOURCES} pcps_opencl_acquisition_cc.cc) endif(OPENCL_FOUND) @@ -64,7 +64,7 @@ endif(OPENCL_FOUND) file(GLOB ACQ_GR_BLOCKS_HEADERS "*.h") list(SORT ACQ_GR_BLOCKS_HEADERS) add_library(acq_gr_blocks ${ACQ_GR_BLOCKS_SOURCES} ${ACQ_GR_BLOCKS_HEADERS}) -source_group(Headers FILES ${ACQ_GR_BLOCKS_HEADERS}) +source_group(Headers FILES ${ACQ_GR_BLOCKS_HEADERS}) if(ENABLE_FPGA) target_link_libraries(acq_gr_blocks acquisition_lib gnss_sp_libs gnss_system_parameters ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FFT_LIBRARIES} ${VOLK_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${OPT_LIBRARIES} ${OPT_ACQUISITION_LIBRARIES}) diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc index 568ca22f0..64b64b193 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.cc @@ -48,7 +48,7 @@ using google::LogMessage; galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -58,7 +58,7 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make int Zero_padding_) { return galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr( - new galileo_e5a_noncoherentIQ_acquisition_caf_cc(sampled_ms, max_dwells, doppler_max, freq, fs_in, samples_per_ms, + new galileo_e5a_noncoherentIQ_acquisition_caf_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms, samples_per_code, bit_transition_flag, dump, dump_filename, both_signal_components_, CAF_window_hz_, Zero_padding_)); } @@ -67,7 +67,6 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit unsigned int sampled_ms, unsigned int max_dwells, unsigned int doppler_max, - long freq, long fs_in, int samples_per_ms, int samples_per_code, @@ -84,7 +83,6 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit d_sample_counter = 0; // SAMPLE COUNTER d_active = false; d_state = 0; - d_freq = freq; d_fs_in = fs_in; d_samples_per_ms = samples_per_ms; d_samples_per_code = samples_per_code; @@ -302,7 +300,7 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init() { d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; - float phase_step_rad = GALILEO_TWO_PI * (d_freq + doppler) / static_cast(d_fs_in); + float phase_step_rad = GALILEO_TWO_PI * doppler / static_cast(d_fs_in); float _phase[1]; _phase[0] = 0; volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h index 58cc608b0..c60b2ac82 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_e5a_noncoherent_iq_acquisition_caf_cc.h @@ -52,7 +52,7 @@ typedef boost::shared_ptr galileo_ galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -74,7 +74,7 @@ private: galileo_e5a_noncoherentIQ_make_acquisition_caf_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -86,7 +86,7 @@ private: galileo_e5a_noncoherentIQ_acquisition_caf_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -100,7 +100,6 @@ private: float estimate_input_power(gr_complex* in); long d_fs_in; - long d_freq; int d_samples_per_ms; int d_sampled_ms; int d_samples_per_code; diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc index a86b27c04..44c809961 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.cc @@ -41,18 +41,18 @@ using google::LogMessage; galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename) { return galileo_pcps_8ms_acquisition_cc_sptr( - new galileo_pcps_8ms_acquisition_cc(sampled_ms, max_dwells, doppler_max, freq, fs_in, samples_per_ms, + new galileo_pcps_8ms_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms, samples_per_code, dump, dump_filename)); } galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename) : gr::block("galileo_pcps_8ms_acquisition_cc", @@ -63,7 +63,6 @@ galileo_pcps_8ms_acquisition_cc::galileo_pcps_8ms_acquisition_cc( d_sample_counter = 0; // SAMPLE COUNTER d_active = false; d_state = 0; - d_freq = freq; d_fs_in = fs_in; d_samples_per_ms = samples_per_ms; d_samples_per_code = samples_per_code; @@ -174,7 +173,7 @@ void galileo_pcps_8ms_acquisition_cc::init() { d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; - float phase_step_rad = static_cast(GALILEO_TWO_PI) * (d_freq + doppler) / static_cast(d_fs_in); + float phase_step_rad = static_cast(GALILEO_TWO_PI) * doppler / static_cast(d_fs_in); float _phase[1]; _phase[0] = 0; volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); diff --git a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h index 62778ca06..c104c3814 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/galileo_pcps_8ms_acquisition_cc.h @@ -45,7 +45,7 @@ typedef boost::shared_ptr galileo_pcps_8ms_acqu galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename); @@ -58,13 +58,13 @@ class galileo_pcps_8ms_acquisition_cc : public gr::block private: friend galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename); galileo_pcps_8ms_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename); @@ -72,7 +72,6 @@ private: int doppler_offset); long d_fs_in; - long d_freq; int d_samples_per_ms; int d_samples_per_code; unsigned int d_doppler_resolution; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index f4aea64d8..6be611de4 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -45,23 +45,24 @@ using google::LogMessage; -pcps_acquisition_sptr pcps_make_acquisition(pcpsconf_t conf_) +pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_) { return pcps_acquisition_sptr(new pcps_acquisition(conf_)); } -pcps_acquisition::pcps_acquisition(pcpsconf_t conf_) : gr::block("pcps_acquisition", - gr::io_signature::make(1, 1, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1)), - gr::io_signature::make(0, 0, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1))) +pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) : gr::block("pcps_acquisition", + gr::io_signature::make(1, 1, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1)), + gr::io_signature::make(0, 0, conf_.it_size * conf_.sampled_ms * conf_.samples_per_ms * (conf_.bit_transition_flag ? 2 : 1))) { this->message_port_register_out(pmt::mp("events")); acq_parameters = conf_; d_sample_counter = 0; // SAMPLE COUNTER d_active = false; + d_positive_acq = 0; d_state = 0; - d_old_freq = conf_.freq; + d_old_freq = 0; d_well_count = 0; d_fft_size = acq_parameters.sampled_ms * acq_parameters.samples_per_ms; d_mag = 0; @@ -121,6 +122,8 @@ pcps_acquisition::pcps_acquisition(pcpsconf_t conf_) : gr::block("pcps_acquisiti } grid_ = arma::fmat(); d_step_two = false; + d_dump_number = 0; + d_dump_channel = acq_parameters.dump_channel; } @@ -157,7 +160,7 @@ pcps_acquisition::~pcps_acquisition() void pcps_acquisition::set_local_code(std::complex* code) { // reset the intermediate frequency - acq_parameters.freq = d_old_freq; + d_old_freq = 0; // This will check if it's fdma, if yes will update the intermediate frequency and the doppler grid if (is_fdma()) { @@ -189,14 +192,14 @@ bool pcps_acquisition::is_fdma() // Dealing with FDMA system if (strcmp(d_gnss_synchro->Signal, "1G") == 0) { - acq_parameters.freq += DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN); - LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << acq_parameters.freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl; + d_old_freq += DFRQ1_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN); + LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl; return true; } else if (strcmp(d_gnss_synchro->Signal, "2G") == 0) { - acq_parameters.freq += DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN); - LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << acq_parameters.freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl; + d_old_freq += DFRQ2_GLO * GLONASS_PRN.at(d_gnss_synchro->PRN); + LOG(INFO) << "Trying to acquire SV PRN " << d_gnss_synchro->PRN << " with freq " << d_old_freq << " in Glonass Channel " << GLONASS_PRN.at(d_gnss_synchro->PRN) << std::endl; return true; } else @@ -245,7 +248,7 @@ void pcps_acquisition::init() { d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int doppler = -static_cast(acq_parameters.doppler_max) + d_doppler_step * doppler_index; - update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, acq_parameters.freq + doppler); + update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_old_freq + doppler); } d_worker_active = false; @@ -262,7 +265,7 @@ void pcps_acquisition::update_grid_doppler_wipeoffs() for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) { int doppler = -static_cast(acq_parameters.doppler_max) + d_doppler_step * doppler_index; - update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, acq_parameters.freq + doppler); + update_local_carrier(d_grid_doppler_wipeoffs[doppler_index], d_fft_size, d_old_freq + doppler); } } @@ -314,7 +317,7 @@ void pcps_acquisition::send_positive_acquisition() << ", doppler " << d_gnss_synchro->Acq_doppler_hz << ", magnitude " << d_mag << ", input signal power " << d_input_power; - + d_positive_acq = 1; this->message_port_pub(pmt::mp("events"), pmt::from_long(1)); } @@ -332,11 +335,90 @@ void pcps_acquisition::send_negative_acquisition() << ", doppler " << d_gnss_synchro->Acq_doppler_hz << ", magnitude " << d_mag << ", input signal power " << d_input_power; - + d_positive_acq = 0; this->message_port_pub(pmt::mp("events"), pmt::from_long(2)); } +void pcps_acquisition::dump_results(int effective_fft_size) +{ + d_dump_number++; + std::string filename = acq_parameters.dump_filename; + filename.append("_"); + filename.append(1, d_gnss_synchro->System); + filename.append("_"); + filename.append(1, d_gnss_synchro->Signal[0]); + filename.append(1, d_gnss_synchro->Signal[1]); + filename.append("_ch_"); + filename.append(std::to_string(d_channel)); + filename.append("_"); + filename.append(std::to_string(d_dump_number)); + filename.append("_sat_"); + filename.append(std::to_string(d_gnss_synchro->PRN)); + filename.append(".mat"); + + mat_t* matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); + if (matfp == NULL) + { + std::cout << "Unable to create or open Acquisition dump file" << std::endl; + acq_parameters.dump = false; + } + else + { + size_t dims[2] = {static_cast(effective_fft_size), static_cast(d_num_doppler_bins)}; + matvar_t* matvar = Mat_VarCreate("acq_grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + dims[0] = static_cast(1); + dims[1] = static_cast(1); + matvar = Mat_VarCreate("doppler_max", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &acq_parameters.doppler_max, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + matvar = Mat_VarCreate("doppler_step", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_doppler_step, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + matvar = Mat_VarCreate("d_positive_acq", MAT_C_INT32, MAT_T_INT32, 1, dims, &d_positive_acq, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + float aux = static_cast(d_gnss_synchro->Acq_doppler_hz); + matvar = Mat_VarCreate("acq_doppler_hz", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + aux = static_cast(d_gnss_synchro->Acq_delay_samples); + matvar = Mat_VarCreate("acq_delay_samples", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &aux, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + matvar = Mat_VarCreate("test_statistic", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_test_statistics, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + matvar = Mat_VarCreate("threshold", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_threshold, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + matvar = Mat_VarCreate("input_power", MAT_C_SINGLE, MAT_T_SINGLE, 1, dims, &d_input_power, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + matvar = Mat_VarCreate("sample_counter", MAT_C_UINT64, MAT_T_UINT64, 1, dims, &d_sample_counter, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + matvar = Mat_VarCreate("PRN", MAT_C_UINT32, MAT_T_UINT32, 1, dims, &d_gnss_synchro->PRN, 0); + Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE + Mat_VarFree(matvar); + + Mat_Close(matfp); + } +} + + void pcps_acquisition::acquisition_core(unsigned long int samp_count) { gr::thread::scoped_lock lk(d_setlock); @@ -344,7 +426,7 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) // initialize acquisition algorithm uint32_t indext = 0; float magt = 0.0; - const gr_complex* in = d_data_buffer; //Get the input samples pointer + const gr_complex* in = d_data_buffer; // Get the input samples pointer int effective_fft_size = (acq_parameters.bit_transition_flag ? d_fft_size / 2 : d_fft_size); if (d_cshort) { @@ -435,46 +517,9 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) } } // Record results to file if required - if (acq_parameters.dump) + if (acq_parameters.dump and d_channel == d_dump_channel) { memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size); - if (doppler_index == (d_num_doppler_bins - 1)) - { - std::string filename = acq_parameters.dump_filename; - filename.append("_"); - filename.append(1, d_gnss_synchro->System); - filename.append("_"); - filename.append(1, d_gnss_synchro->Signal[0]); - filename.append(1, d_gnss_synchro->Signal[1]); - filename.append("_sat_"); - filename.append(std::to_string(d_gnss_synchro->PRN)); - filename.append(".mat"); - mat_t* matfp = Mat_CreateVer(filename.c_str(), NULL, MAT_FT_MAT73); - if (matfp == NULL) - { - std::cout << "Unable to create or open Acquisition dump file" << std::endl; - acq_parameters.dump = false; - } - else - { - size_t dims[2] = {static_cast(effective_fft_size), static_cast(d_num_doppler_bins)}; - matvar_t* matvar = Mat_VarCreate("grid", MAT_C_SINGLE, MAT_T_SINGLE, 2, dims, grid_.memptr(), 0); - Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE - Mat_VarFree(matvar); - - dims[0] = static_cast(1); - dims[1] = static_cast(1); - matvar = Mat_VarCreate("doppler_max", MAT_C_SINGLE, MAT_T_UINT32, 1, dims, &acq_parameters.doppler_max, 0); - Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE - Mat_VarFree(matvar); - - matvar = Mat_VarCreate("doppler_step", MAT_C_SINGLE, MAT_T_UINT32, 1, dims, &d_doppler_step, 0); - Mat_VarWrite(matfp, matvar, MAT_COMPRESSION_ZLIB); // or MAT_COMPRESSION_NONE - Mat_VarFree(matvar); - - Mat_Close(matfp); - } - } } } } @@ -540,6 +585,11 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) d_test_statistics = d_mag / d_input_power; } } + // Record results to file if required + if (acq_parameters.dump and d_channel == d_dump_channel) + { + memcpy(grid_.colptr(doppler_index), d_magnitude, sizeof(float) * effective_fft_size); + } } } lk.lock(); @@ -609,6 +659,11 @@ void pcps_acquisition::acquisition_core(unsigned long int samp_count) } } d_worker_active = false; + // Record results to file if required + if (acq_parameters.dump and d_channel == d_dump_channel) + { + pcps_acquisition::dump_results(effective_fft_size); + } } @@ -630,8 +685,11 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), gr::thread::scoped_lock lk(d_setlock); if (!d_active or d_worker_active) { - d_sample_counter += d_fft_size * ninput_items[0]; - consume_each(ninput_items[0]); + if (!acq_parameters.blocking_on_standby) + { + d_sample_counter += d_fft_size * ninput_items[0]; + consume_each(ninput_items[0]); + } if (d_step_two) { d_doppler_center_step_two = static_cast(d_gnss_synchro->Acq_doppler_hz); @@ -655,8 +713,11 @@ int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), d_input_power = 0.0; d_test_statistics = 0.0; d_state = 1; - d_sample_counter += d_fft_size * ninput_items[0]; // sample counter - consume_each(ninput_items[0]); + if (!acq_parameters.blocking_on_standby) + { + d_sample_counter += d_fft_size * ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + } break; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index e16edd83f..91bfaf112 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -53,39 +53,20 @@ #define GNSS_SDR_PCPS_ACQUISITION_H_ #include "gnss_synchro.h" +#include "acq_conf.h" #include #include #include #include #include -typedef struct -{ - /* pcps acquisition configuration */ - unsigned int sampled_ms; - unsigned int max_dwells; - unsigned int doppler_max; - unsigned int num_doppler_bins_step2; - float doppler_step2; - long freq; - long fs_in; - int samples_per_ms; - int samples_per_code; - bool bit_transition_flag; - bool use_CFAR_algorithm_flag; - bool dump; - bool blocking; - bool make_2_steps; - std::string dump_filename; - size_t it_size; -} pcpsconf_t; class pcps_acquisition; typedef boost::shared_ptr pcps_acquisition_sptr; pcps_acquisition_sptr -pcps_make_acquisition(pcpsconf_t conf_); +pcps_make_acquisition(const Acq_Conf& conf_); /*! * \brief This class implements a Parallel Code Phase Search Acquisition. @@ -97,9 +78,9 @@ class pcps_acquisition : public gr::block { private: friend pcps_acquisition_sptr - pcps_make_acquisition(pcpsconf_t conf_); + pcps_make_acquisition(const Acq_Conf& conf_); - pcps_acquisition(pcpsconf_t conf_); + pcps_acquisition(const Acq_Conf& conf_); void update_local_carrier(gr_complex* carrier_vector, int correlator_length_samples, float freq); void update_grid_doppler_wipeoffs(); @@ -112,11 +93,14 @@ private: void send_positive_acquisition(); - pcpsconf_t acq_parameters; + void dump_results(int effective_fft_size); + + Acq_Conf acq_parameters; bool d_active; bool d_worker_active; bool d_cshort; bool d_step_two; + int d_positive_acq; float d_threshold; float d_mag; float d_input_power; @@ -140,6 +124,8 @@ private: gr::fft::fft_complex* d_ifft; Gnss_Synchro* d_gnss_synchro; arma::fmat grid_; + long int d_dump_number; + unsigned int d_dump_channel; public: ~pcps_acquisition(); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index 90b96acbb..c9b31b134 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc @@ -45,18 +45,18 @@ using google::LogMessage; pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc( - int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, + int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename) { return pcps_acquisition_fine_doppler_cc_sptr( - new pcps_acquisition_fine_doppler_cc(max_dwells, sampled_ms, doppler_max, doppler_min, freq, + new pcps_acquisition_fine_doppler_cc(max_dwells, sampled_ms, doppler_max, doppler_min, fs_in, samples_per_ms, dump, dump_filename)); } pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc( - int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, + int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename) : gr::block("pcps_acquisition_fine_doppler_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), @@ -65,7 +65,6 @@ pcps_acquisition_fine_doppler_cc::pcps_acquisition_fine_doppler_cc( this->message_port_register_out(pmt::mp("events")); d_sample_counter = 0; // SAMPLE COUNTER d_active = false; - d_freq = freq; d_fs_in = fs_in; d_samples_per_ms = samples_per_ms; d_sampled_ms = sampled_ms; @@ -207,7 +206,7 @@ void pcps_acquisition_fine_doppler_cc::update_carrier_wipeoff() doppler_hz = d_config_doppler_min + d_doppler_step * doppler_index; // doppler search steps // compute the carrier doppler wipe-off signal and store it - phase_step_rad = static_cast(GPS_TWO_PI) * (d_freq + doppler_hz) / static_cast(d_fs_in); + phase_step_rad = static_cast(GPS_TWO_PI) * doppler_hz / static_cast(d_fs_in); d_grid_doppler_wipeoffs[doppler_index] = new gr_complex[d_fft_size]; float _phase[1]; _phase[0] = 0; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h index 652250cac..d34121910 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.h @@ -62,7 +62,7 @@ typedef boost::shared_ptr pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(int max_dwells, unsigned int sampled_ms, - int doppler_max, int doppler_min, long freq, long fs_in, int samples_per_ms, + int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename); /*! @@ -77,12 +77,12 @@ class pcps_acquisition_fine_doppler_cc : public gr::block private: friend pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(int max_dwells, unsigned int sampled_ms, - int doppler_max, int doppler_min, long freq, long fs_in, + int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename); pcps_acquisition_fine_doppler_cc(int max_dwells, unsigned int sampled_ms, - int doppler_max, int doppler_min, long freq, long fs_in, + int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename); @@ -98,7 +98,6 @@ private: void free_grid_memory(); long d_fs_in; - long d_freq; int d_samples_per_ms; int d_max_dwells; unsigned int d_doppler_resolution; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index 66d23ba16..9f916c7d7 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -72,7 +72,7 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(pcpsconf_fpga_t conf_) : gr::block( d_gnss_synchro = 0; acquisition_fpga = std::make_shared(acq_parameters.device_name, d_fft_size, acq_parameters.doppler_max, acq_parameters.samples_per_ms, - acq_parameters.fs_in, acq_parameters.freq, acq_parameters.sampled_ms, acq_parameters.select_queue_Fpga, acq_parameters.all_fft_codes); + acq_parameters.fs_in, acq_parameters.sampled_ms, acq_parameters.select_queue_Fpga, acq_parameters.all_fft_codes); } @@ -172,7 +172,6 @@ void pcps_acquisition_fpga::set_active(bool active) // initialize acquisition algorithm uint32_t indext = 0; float magt = 0.0; - float fft_normalization_factor = static_cast(d_fft_size) * static_cast(d_fft_size); d_input_power = 0.0; d_mag = 0.0; @@ -234,7 +233,8 @@ void pcps_acquisition_fpga::set_active(bool active) int pcps_acquisition_fpga::general_work(int noutput_items __attribute__((unused)), - gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, + 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 diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc index 78a82fd8c..002d18138 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -46,18 +46,18 @@ extern concurrent_map global_gps_acq_assist_map; using google::LogMessage; pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc( - int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, + int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename) { return pcps_assisted_acquisition_cc_sptr( - new pcps_assisted_acquisition_cc(max_dwells, sampled_ms, doppler_max, doppler_min, freq, + new pcps_assisted_acquisition_cc(max_dwells, sampled_ms, doppler_max, doppler_min, fs_in, samples_per_ms, dump, dump_filename)); } pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc( - int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long freq, + int max_dwells, unsigned int sampled_ms, int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename) : gr::block("pcps_assisted_acquisition_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)), @@ -66,7 +66,6 @@ pcps_assisted_acquisition_cc::pcps_assisted_acquisition_cc( this->message_port_register_out(pmt::mp("events")); d_sample_counter = 0; // SAMPLE COUNTER d_active = false; - d_freq = freq; d_fs_in = fs_in; d_samples_per_ms = samples_per_ms; d_sampled_ms = sampled_ms; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h index 1b312980e..932cd05e0 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.h @@ -62,7 +62,7 @@ typedef boost::shared_ptr pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, - int doppler_max, int doppler_min, long freq, long fs_in, int samples_per_ms, + int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename); /*! @@ -76,12 +76,12 @@ class pcps_assisted_acquisition_cc : public gr::block private: friend pcps_assisted_acquisition_cc_sptr pcps_make_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, - int doppler_max, int doppler_min, long freq, long fs_in, + int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename); pcps_assisted_acquisition_cc(int max_dwells, unsigned int sampled_ms, - int doppler_max, int doppler_min, long freq, long fs_in, + int doppler_max, int doppler_min, long fs_in, int samples_per_ms, bool dump, std::string dump_filename); @@ -97,7 +97,6 @@ private: void free_grid_memory(); long d_fs_in; - long d_freq; int d_samples_per_ms; int d_max_dwells; unsigned int d_doppler_resolution; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc index 8b7250e67..d5f9df83b 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -48,18 +48,18 @@ using google::LogMessage; pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename) { return pcps_cccwsr_acquisition_cc_sptr( - new pcps_cccwsr_acquisition_cc(sampled_ms, max_dwells, doppler_max, freq, fs_in, + new pcps_cccwsr_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms, samples_per_code, dump, dump_filename)); } pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename) : gr::block("pcps_cccwsr_acquisition_cc", @@ -70,7 +70,6 @@ pcps_cccwsr_acquisition_cc::pcps_cccwsr_acquisition_cc( d_sample_counter = 0; // SAMPLE COUNTER d_active = false; d_state = 0; - d_freq = freq; d_fs_in = fs_in; d_samples_per_ms = samples_per_ms; d_samples_per_code = samples_per_code; @@ -189,7 +188,7 @@ void pcps_cccwsr_acquisition_cc::init() d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; - float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast(d_fs_in); + float phase_step_rad = GPS_TWO_PI * doppler / static_cast(d_fs_in); float _phase[1]; _phase[0] = 0; volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h index 46954e5ca..56a5f6050 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.h @@ -51,7 +51,7 @@ typedef boost::shared_ptr pcps_cccwsr_acquisition_cc pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename); @@ -64,12 +64,12 @@ class pcps_cccwsr_acquisition_cc : public gr::block private: friend pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename); pcps_cccwsr_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool dump, std::string dump_filename); @@ -77,7 +77,6 @@ private: int doppler_offset); long d_fs_in; - long d_freq; int d_samples_per_ms; int d_samples_per_code; unsigned int d_doppler_resolution; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc index af9413158..0f90c2c38 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -67,14 +67,14 @@ using google::LogMessage; pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc( unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, std::string dump_filename) { return pcps_opencl_acquisition_cc_sptr( - new pcps_opencl_acquisition_cc(sampled_ms, max_dwells, doppler_max, freq, fs_in, samples_per_ms, + new pcps_opencl_acquisition_cc(sampled_ms, max_dwells, doppler_max, fs_in, samples_per_ms, samples_per_code, bit_transition_flag, dump, dump_filename)); } @@ -83,7 +83,6 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc( unsigned int sampled_ms, unsigned int max_dwells, unsigned int doppler_max, - long freq, long fs_in, int samples_per_ms, int samples_per_code, @@ -98,7 +97,6 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc( d_active = false; d_state = 0; d_core_working = false; - d_freq = freq; d_fs_in = fs_in; d_samples_per_ms = samples_per_ms; d_samples_per_code = samples_per_code; @@ -320,7 +318,7 @@ void pcps_opencl_acquisition_cc::init() d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; - float phase_step_rad = static_cast(GPS_TWO_PI) * (d_freq + doppler) / static_cast(d_fs_in); + float phase_step_rad = static_cast(GPS_TWO_PI) * doppler / static_cast(d_fs_in); float _phase[1]; _phase[0] = 0; volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h index c4ce11707..e70a8d342 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.h @@ -72,7 +72,7 @@ typedef boost::shared_ptr pcps_opencl_acquisition_cc pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -89,14 +89,14 @@ class pcps_opencl_acquisition_cc : public gr::block private: friend pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, std::string dump_filename); pcps_opencl_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -108,7 +108,6 @@ private: int init_opencl_environment(std::string kernel_filename); long d_fs_in; - long d_freq; int d_samples_per_ms; int d_samples_per_code; unsigned int d_doppler_resolution; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc index 17d06f62b..d3b22d41e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -44,7 +44,7 @@ using google::LogMessage; pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc( unsigned int folding_factor, unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -54,7 +54,7 @@ pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc( new pcps_quicksync_acquisition_cc( folding_factor, sampled_ms, max_dwells, doppler_max, - freq, fs_in, samples_per_ms, + fs_in, samples_per_ms, samples_per_code, bit_transition_flag, dump, dump_filename)); @@ -64,7 +64,7 @@ pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc( pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc( unsigned int folding_factor, unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -76,7 +76,6 @@ pcps_quicksync_acquisition_cc::pcps_quicksync_acquisition_cc( d_sample_counter = 0; // SAMPLE COUNTER d_active = false; d_state = 0; - d_freq = freq; d_fs_in = fs_in; d_samples_per_ms = samples_per_ms; d_samples_per_code = samples_per_code; @@ -221,7 +220,7 @@ void pcps_quicksync_acquisition_cc::init() { d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_samples_per_code * d_folding_factor * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; - float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast(d_fs_in); + float phase_step_rad = GPS_TWO_PI * doppler / static_cast(d_fs_in); float _phase[1]; _phase[0] = 0; volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_samples_per_code * d_folding_factor); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h index 6352cc3bd..8310b90ad 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.h @@ -69,7 +69,7 @@ typedef boost::shared_ptr pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc(unsigned int folding_factor, unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -88,7 +88,7 @@ private: friend pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc(unsigned int folding_factor, unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -96,7 +96,7 @@ private: pcps_quicksync_acquisition_cc(unsigned int folding_factor, unsigned int sampled_ms, unsigned int max_dwells, - unsigned int doppler_max, long freq, long fs_in, + unsigned int doppler_max, long fs_in, int samples_per_ms, int samples_per_code, bool bit_transition_flag, bool dump, @@ -116,7 +116,6 @@ private: float d_noise_floor_power; long d_fs_in; - long d_freq; int d_samples_per_ms; int d_samples_per_code; unsigned int d_doppler_resolution; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc index 44d09b134..9627b2733 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -61,19 +61,19 @@ using google::LogMessage; pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc( unsigned int sampled_ms, unsigned int doppler_max, - long freq, long fs_in, int samples_per_ms, + long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename) { return pcps_tong_acquisition_cc_sptr( - new pcps_tong_acquisition_cc(sampled_ms, doppler_max, freq, fs_in, samples_per_ms, samples_per_code, + new pcps_tong_acquisition_cc(sampled_ms, doppler_max, fs_in, samples_per_ms, samples_per_code, tong_init_val, tong_max_val, tong_max_dwells, dump, dump_filename)); } pcps_tong_acquisition_cc::pcps_tong_acquisition_cc( unsigned int sampled_ms, unsigned int doppler_max, - long freq, long fs_in, int samples_per_ms, + long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, @@ -85,7 +85,6 @@ pcps_tong_acquisition_cc::pcps_tong_acquisition_cc( d_sample_counter = 0; // SAMPLE COUNTER d_active = false; d_state = 0; - d_freq = freq; d_fs_in = fs_in; d_samples_per_ms = samples_per_ms; d_samples_per_code = samples_per_code; @@ -191,7 +190,7 @@ void pcps_tong_acquisition_cc::init() d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; - float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast(d_fs_in); + float phase_step_rad = GPS_TWO_PI * doppler / static_cast(d_fs_in); float _phase[1]; _phase[0] = 0; volk_gnsssdr_s32f_sincos_32fc(d_grid_doppler_wipeoffs[doppler_index], -phase_step_rad, _phase, d_fft_size); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h index 00eba93f5..dc231fac0 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.h @@ -65,7 +65,7 @@ typedef boost::shared_ptr pcps_tong_acquisition_cc_spt pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max, - long freq, long fs_in, int samples_per_ms, + long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename); @@ -79,13 +79,13 @@ class pcps_tong_acquisition_cc : public gr::block private: friend pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max, - long freq, long fs_in, int samples_per_ms, + long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename); pcps_tong_acquisition_cc(unsigned int sampled_ms, unsigned int doppler_max, - long freq, long fs_in, int samples_per_ms, + long fs_in, int samples_per_ms, int samples_per_code, unsigned int tong_init_val, unsigned int tong_max_val, unsigned int tong_max_dwells, bool dump, std::string dump_filename); @@ -94,7 +94,6 @@ private: int doppler_offset); long d_fs_in; - long d_freq; int d_samples_per_ms; int d_samples_per_code; unsigned int d_doppler_resolution; diff --git a/src/algorithms/acquisition/libs/CMakeLists.txt b/src/algorithms/acquisition/libs/CMakeLists.txt index 332d83723..05a116e0f 100644 --- a/src/algorithms/acquisition/libs/CMakeLists.txt +++ b/src/algorithms/acquisition/libs/CMakeLists.txt @@ -16,12 +16,9 @@ # along with GNSS-SDR. If not, see . # - -set(ACQUISITION_LIB_SOURCES - fpga_acquisition.cc -) - -include_directories( +if(ENABLE_FPGA) + set(ACQUISITION_LIB_SOURCES fpga_acquisition.cc ) + include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/interfaces @@ -31,10 +28,16 @@ include_directories( ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} ${VOLK_GNSSSDR_INCLUDE_DIRS} -) + ) -file(GLOB ACQUISITION_LIB_HEADERS "*.h") + file(GLOB ACQUISITION_LIB_HEADERS "*.h") +endif(ENABLE_FPGA) + +set(ACQUISITION_LIB_HEADERS ${ACQUISITION_LIB_HEADERS} acq_conf.h) list(SORT ACQUISITION_LIB_HEADERS) + +set(ACQUISITION_LIB_SOURCES ${ACQUISITION_LIB_SOURCES} acq_conf.cc) + add_library(acquisition_lib ${ACQUISITION_LIB_SOURCES} ${ACQUISITION_LIB_HEADERS}) source_group(Headers FILES ${ACQUISITION_LIB_HEADERS}) target_link_libraries(acquisition_lib ${VOLK_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES}) @@ -43,4 +46,3 @@ if(VOLK_GNSSSDR_FOUND) else(VOLK_GNSSSDR_FOUND) add_dependencies(acquisition_lib glog-${glog_RELEASE} volk_gnsssdr_module) endif() - diff --git a/src/utils/gpstk/gnsspvt/src/kml_printer_gpstk.h b/src/algorithms/acquisition/libs/acq_conf.cc similarity index 58% rename from src/utils/gpstk/gnsspvt/src/kml_printer_gpstk.h rename to src/algorithms/acquisition/libs/acq_conf.cc index dc30ce42b..ed79db2fa 100644 --- a/src/utils/gpstk/gnsspvt/src/kml_printer_gpstk.h +++ b/src/algorithms/acquisition/libs/acq_conf.cc @@ -1,9 +1,8 @@ /*! - * \file kml_printer.h - * \brief Interface of a class that prints PVT information to a kml file - * for GPSTK data structures - * \author Javier Arribas, 2012. jarribas(at)cttc.es - * + * \file acq_conf.cc + * \brief Class that contains all the configuration parameters for generic + * acquisition block based on the PCPS algoritm. + * \author Carles Fernandez, 2018. cfernandez(at)cttc.es * * ------------------------------------------------------------------------- * @@ -30,31 +29,26 @@ * ------------------------------------------------------------------------- */ +#include "acq_conf.h" -#ifndef GNSS_SDR_KML_PRINTER_H_ -#define GNSS_SDR_KML_PRINTER_H_ - -#include -#include -#include "gpstk/Position.hpp" - - -/*! - * \brief Prints PVT information to OGC KML format file (can be viewed with Google Earth) - * - * See http://www.opengeospatial.org/standards/kml - */ -class Kml_Printer_gpstk +Acq_Conf::Acq_Conf() { -private: - std::ofstream kml_file; - -public: - bool set_headers(std::string filename); - bool print_position(gpstk::Position position); - bool close_file(); - Kml_Printer_gpstk(); - ~Kml_Printer_gpstk(); -}; - -#endif + /* PCPS acquisition configuration */ + sampled_ms = 0; + max_dwells = 0; + doppler_max = 0; + num_doppler_bins_step2 = 0; + doppler_step2 = 0.0; + fs_in = 0; + samples_per_ms = 0; + samples_per_code = 0; + bit_transition_flag = false; + use_CFAR_algorithm_flag = false; + dump = false; + blocking = false; + make_2_steps = false; + dump_filename = ""; + dump_channel = 0; + it_size = sizeof(char); + blocking_on_standby = false; +} diff --git a/src/algorithms/acquisition/libs/acq_conf.h b/src/algorithms/acquisition/libs/acq_conf.h new file mode 100644 index 000000000..4707aeba7 --- /dev/null +++ b/src/algorithms/acquisition/libs/acq_conf.h @@ -0,0 +1,63 @@ +/*! + * \file acq_conf.cc + * \brief Class that contains all the configuration parameters for generic + * acquisition block based on the PCPS algoritm. + * \author Carles Fernandez, 2018. cfernandez(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * 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 . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_ACQ_CONF_H_ +#define GNSS_SDR_ACQ_CONF_H_ + +#include +#include + +class Acq_Conf +{ +public: + /* PCPS Acquisition configuration */ + unsigned int sampled_ms; + unsigned int max_dwells; + unsigned int doppler_max; + unsigned int num_doppler_bins_step2; + float doppler_step2; + long fs_in; + int samples_per_ms; + int samples_per_code; + bool bit_transition_flag; + bool use_CFAR_algorithm_flag; + bool dump; + bool blocking; + bool blocking_on_standby; // enable it only for unit testing to avoid sample consume on idle status + bool make_2_steps; + std::string dump_filename; + unsigned int dump_channel; + size_t it_size; + + Acq_Conf(); +}; + +#endif diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index c14452d93..bf2f91c24 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -76,14 +76,13 @@ bool fpga_acquisition::set_local_code(unsigned int PRN) fpga_acquisition::fpga_acquisition(std::string device_name, unsigned int nsamples, unsigned int doppler_max, - unsigned int nsamples_total, long fs_in, long freq, + unsigned int nsamples_total, long fs_in, unsigned int sampled_ms, unsigned select_queue, lv_16sc_t *all_fft_codes) { unsigned int vector_length = nsamples_total * sampled_ms; // initial values d_device_name = device_name; - d_freq = freq; d_fs_in = fs_in; d_vector_length = vector_length; d_nsamples = nsamples; // number of samples not including padding @@ -203,7 +202,7 @@ void fpga_acquisition::set_phase_step(unsigned int doppler_index) float phase_step_rad_int_temp; int32_t phase_step_rad_int; int doppler = static_cast(-d_doppler_max) + d_doppler_step * doppler_index; - float phase_step_rad = GPS_TWO_PI * (d_freq + doppler) / static_cast(d_fs_in); + float phase_step_rad = GPS_TWO_PI * doppler / static_cast(d_fs_in); // The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing // The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi) // The FPGA also expects the phase to be negative since it produces cos(x) -j*sin(x) diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.h b/src/algorithms/acquisition/libs/fpga_acquisition.h index 88e6802b6..e9b1482db 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.h +++ b/src/algorithms/acquisition/libs/fpga_acquisition.h @@ -48,7 +48,7 @@ public: fpga_acquisition(std::string device_name, unsigned int nsamples, unsigned int doppler_max, - unsigned int nsamples_total, long fs_in, long freq, + unsigned int nsamples_total, long fs_in, unsigned int sampled_ms, unsigned select_queue, lv_16sc_t *all_fft_codes); ~fpga_acquisition(); @@ -82,9 +82,7 @@ public: } private: - long d_freq; long d_fs_in; - gr::fft::fft_complex *d_fft_if; // function used to run the fft of the local codes // data related to the hardware module and the driver int d_fd; // driver descriptor volatile unsigned *d_map_base; // driver memory map diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index da842f7b7..7323d617a 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -60,6 +60,14 @@ ByteToShort::ByteToShort(ConfigurationInterface* configuration, std::string role DLOG(INFO) << "Dumping output into file " << dump_filename_; file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc index 1e75bccaa..a34befbd0 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -66,6 +66,14 @@ IbyteToCbyte::IbyteToCbyte(ConfigurationInterface* configuration, std::string ro { conjugate_ic_ = make_conjugate_ic(); } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc index 5862ee71d..0592e8802 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -64,6 +64,14 @@ IbyteToComplex::IbyteToComplex(ConfigurationInterface* configuration, std::strin DLOG(INFO) << "Dumping output into file " << dump_filename_; file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc index 353004f9f..c965abb92 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -67,6 +67,14 @@ IbyteToCshort::IbyteToCshort(ConfigurationInterface* configuration, std::string { conjugate_sc_ = make_conjugate_sc(); } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index af29494c0..31fa7eb48 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -64,6 +64,14 @@ IshortToComplex::IshortToComplex(ConfigurationInterface* configuration, std::str DLOG(INFO) << "Dumping output into file " << dump_filename_; file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc index 225f0d6a9..571b0170f 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -66,6 +66,14 @@ IshortToCshort::IshortToCshort(ConfigurationInterface* configuration, std::strin { conjugate_sc_ = make_conjugate_sc(); } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index f65034325..fb50853ec 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -68,6 +68,14 @@ BeamformerFilter::BeamformerFilter( DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } samples_ = 0; + if (in_stream_ > 8) + { + LOG(ERROR) << "This implementation only supports eight input streams"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index 13775e2a1..8c77856d8 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -131,6 +131,14 @@ FirFilter::FirFilter(ConfigurationInterface* configuration, std::string role, { LOG(ERROR) << " Unknown item type conversion"; } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index 8503b8ce0..4f6088cae 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -111,6 +111,14 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(ConfigurationInterface* configuration std::cout << "Dumping output into file " << dump_filename_ << std::endl; file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc index a83372d17..d483d523b 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.cc +++ b/src/algorithms/input_filter/adapters/notch_filter.cc @@ -81,6 +81,14 @@ NotchFilter::NotchFilter(ConfigurationInterface* configuration, std::string role file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.cc b/src/algorithms/input_filter/adapters/notch_filter_lite.cc index dea6ec7c7..65a816cb6 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.cc +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.cc @@ -88,6 +88,14 @@ NotchFilterLite::NotchFilterLite(ConfigurationInterface* configuration, std::str file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index 031a0a035..7714dd404 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -94,6 +94,14 @@ PulseBlankingFilter::PulseBlankingFilter(ConfigurationInterface* configuration, std::cout << "Dumping output into file " << dump_filename_ << std::endl; file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index 4859af83d..a64663cd3 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -109,6 +109,14 @@ Pass_Through::Pass_Through(ConfigurationInterface* configuration, std::string ro kludge_copy_ = gr::blocks::copy::make(item_size_); DLOG(INFO) << "kludge_copy(" << kludge_copy_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/libs/rtklib/rtklib_pntpos.cc b/src/algorithms/libs/rtklib/rtklib_pntpos.cc index 31b60c8e6..d4a10fe65 100644 --- a/src/algorithms/libs/rtklib/rtklib_pntpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_pntpos.cc @@ -130,11 +130,11 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel, double P1_P2 = 0.0; double P1_C1 = 0.0; double P2_C2 = 0.0; - //Intersignal corrections (m). See GPS IS-200 CNAV message - double ISCl1 = 0.0; + // Intersignal corrections (m). See GPS IS-200 CNAV message + //double ISCl1 = 0.0; double ISCl2 = 0.0; double ISCl5i = 0.0; - double ISCl5q = 0.0; + //double ISCl5q = 0.0; double gamma_ = 0.0; int i = 0; int j = 1; @@ -209,10 +209,10 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel, if (sys == SYS_GPS) { - ISCl1 = getiscl1(obs->sat, nav); + // ISCl1 = getiscl1(obs->sat, nav); ISCl2 = getiscl2(obs->sat, nav); ISCl5i = getiscl5i(obs->sat, nav); - ISCl5q = getiscl5q(obs->sat, nav); + // ISCl5q = getiscl5q(obs->sat, nav); } //CHECK IF IT IS STILL NEEDED diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index 20f939dd4..88cc2ca38 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -54,6 +54,8 @@ //#include #include #include +#include +#include #include #include #include @@ -253,11 +255,12 @@ const unsigned int tbl_CRC24Q[] = { 0x42FA2F, 0xC4B6D4, 0xC82F22, 0x4E63D9, 0xD11CCE, 0x575035, 0x5BC9C3, 0xDD8538}; -extern "C" { -void dgemm_(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); -extern void dgetrf_(int *, int *, double *, int *, int *, int *); -extern void dgetri_(int *, double *, int *, int *, double *, int *, int *); -extern void dgetrs_(char *, int *, int *, double *, int *, int *, double *, int *, int *); +extern "C" +{ + void dgemm_(char *, char *, int *, int *, int *, double *, double *, int *, double *, int *, double *, double *, int *); + extern void dgetrf_(int *, int *, double *, int *, int *, int *); + extern void dgetri_(int *, double *, int *, int *, double *, int *, int *); + extern void dgetrs_(char *, int *, int *, double *, int *, int *, double *, int *, int *); } @@ -2562,7 +2565,8 @@ void readpos(const char *file, const char *rcv, double *pos) if (buff[0] == '%' || buff[0] == '#') continue; if (sscanf(buff, "%lf %lf %lf %s", &poss[np][0], &poss[np][1], &poss[np][2], str) < 4) continue; - strncpy(stas[np], str, 15); + // strncpy(stas[np], str, 15); This line triggers a warning. Replaced by: + memcpy(stas[np], str, 15 * sizeof(stas[np][0])); stas[np++][15] = '\0'; } fclose(fp); @@ -4264,7 +4268,17 @@ int rtk_uncompress(const char *file, char *uncfile) dir = fname; fname = p + 1; } - sprintf(cmd, "tar -C \"%s\" -xf \"%s\"", dir, tmpfile); + // sprintf(cmd, "tar -C \"%s\" -xf \"%s\"", dir, tmpfile); + // NOTE: This sprintf triggers a format overflow warning. Replaced by: + std::ostringstream temp; + std::string s_aux1(dir); + std::string s_aux2(tmpfile); + temp << "tar -C " << s_aux1 << " -xf " << s_aux2; + std::string s_aux = temp.str(); + int n = s_aux.length(); + if (n < 2048) + for (int i = 0; i < n; i++) cmd[i] = s_aux[i]; + if (execcmd(cmd)) { if (stat) diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc index 872e186c2..80c1e0f0c 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc @@ -2145,7 +2145,7 @@ void rtkinit(rtk_t *rtk, const prcopt_t *opt) { sol_t sol0 = {{0, 0}, {}, {}, {}, '0', '0', '0', 0.0, 0.0, 0.0}; ambc_t ambc0 = {{{0, 0}, {0, 0}, {0, 0}, {0, 0}}, {}, {}, {}, 0, {}}; - ssat_t ssat0 = {0, 0, {0.0}, {0.0}, {0.0}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {}, {}, {}, {}, 0.0, 0.0, 0.0, 0.0, {{0, 0}, {0, 0}}, {{}, {}}}; + ssat_t ssat0 = {0, 0, {0.0}, {0.0}, {0.0}, {'0'}, {'0'}, {'0'}, {'0'}, {'0'}, {}, {}, {}, {}, 0.0, 0.0, 0.0, 0.0, {{{0, 0}}, {{0, 0}}}, {{}, {}}}; int i; trace(3, "rtkinit :\n"); diff --git a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc index 6f27b9ca6..052de403b 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtksvr.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtksvr.cc @@ -375,7 +375,7 @@ void decodefile(rtksvr_t *svr, int index) nav_t nav = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, (erpd_t *){0}}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, {0.0}, - {0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0}, {0.0}}, {{0.0}, {0.0}}, {{0.0}, {0.0}, {0.0}}, + {0.0}, {0.0}, {0.0}, {0.0}, 0, {{0.0}, {0.0}}, {{0.0}, {0.0}}, {{{0.0}}, {{0.0}}, {{0.0}}}, {0.0}, {0.0}, {*glo_fcn}, {*pcvt0}, sbssat0, {*sbsion0}, {*dgps0}, {*ssr0}, {*lexeph0}, {{0, 0.0}, 0.0, {0.0}, {{0.0}, {0.0}}}, pppcorr0}; @@ -471,7 +471,7 @@ void *rtksvrthread(void *arg) q = svr->buff[i] + svr->buffsize; /* read receiver raw/rtcm data from input stream */ - if ((n = strread(svr->stream + i, p, q - p)) <= 0) + if ((n = strread(svr->stream + i, p, static_cast(q[0]) - static_cast(p[0]))) <= 0) { continue; } diff --git a/src/algorithms/libs/rtklib/rtklib_solution.cc b/src/algorithms/libs/rtklib/rtklib_solution.cc index f559e9f4d..71a25f105 100644 --- a/src/algorithms/libs/rtklib/rtklib_solution.cc +++ b/src/algorithms/libs/rtklib/rtklib_solution.cc @@ -63,7 +63,6 @@ #define SQRT_SOL(x) ((x) < 0.0 ? 0.0 : sqrt(x)) const int MAXFIELD = 64; /* max number of fields in a record */ -const int MAXNMEA = 256; /* max length of nmea sentence */ const double KNOT2M = 0.514444444; /* m/knot */ diff --git a/src/algorithms/libs/rtklib/rtklib_stream.cc b/src/algorithms/libs/rtklib/rtklib_stream.cc index 6dafde2ac..04ae96e01 100644 --- a/src/algorithms/libs/rtklib/rtklib_stream.cc +++ b/src/algorithms/libs/rtklib/rtklib_stream.cc @@ -64,6 +64,7 @@ #include #include #include +#include /* global options ------------------------------------------------------------*/ @@ -115,7 +116,12 @@ serial_t *openserial(const char *path, int mode, char *msg) } parity = (char)toupper((int)parity); - sprintf(dev, "/dev/%s", port); + // sprintf(dev, "/dev/%s", port); This line triggers a warning. Replaced by: + std::string s_aux = "/dev/" + std::string(port); + s_aux.resize(128, '\0'); + int n = s_aux.length(); + for (int i = 0; i < n; i++) dev[i] = s_aux[i]; + if (n == 0) dev[0] = '\0'; if ((mode & STR_MODE_R) && (mode & STR_MODE_W)) rw = O_RDWR; @@ -779,7 +785,7 @@ tcpsvr_t *opentcpsvr(const char *path, char *msg) { tcpsvr_t *tcpsvr, tcpsvr0; // = {{0}}; char port[256] = ""; - tcpsvr0 = {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}, {0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}}; + tcpsvr0 = {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}, {{0, {0}, 0, {0, 0, 0, {0}}, 0, 0, 0, 0}}}; tracet(3, "opentcpsvr: path=%s\n", path); if (!(tcpsvr = (tcpsvr_t *)malloc(sizeof(tcpsvr_t)))) return NULL; @@ -1224,7 +1230,11 @@ int rspntrip_s(ntrip_t *ntrip, char *msg) else if ((p = strstr((char *)ntrip->buff, NTRIP_RSP_ERROR))) { /* error */ nb = ntrip->nb < MAXSTATMSG ? ntrip->nb : MAXSTATMSG; - strncpy(msg, (char *)ntrip->buff, nb); + // strncpy(msg, (char *)ntrip->buff, nb); This line triggers a warning. Replaced by; + std::string s_aux((char *)ntrip->buff); + s_aux.resize(nb, '\0'); + for (int i = 0; i < nb; i++) msg[i] = s_aux[i]; + msg[nb] = 0; tracet(1, "rspntrip_s: %s nb=%d\n", msg, ntrip->nb); ntrip->nb = 0; @@ -1380,7 +1390,11 @@ ntrip_t *openntrip(const char *path, int type, char *msg) /* ntrip access via proxy server */ if (*proxyaddr) { - sprintf(ntrip->url, "http://%s", tpath); + // sprintf(ntrip->url, "http://%s", tpath); This line triggers a warning. Replaced by: + std::string s_aux = "http://" + std::string(tpath); + int n = s_aux.length(); + if (n < 256) + for (int k = 0; k < n; k++) ntrip->url[k] = s_aux[k]; strcpy(tpath, proxyaddr); } /* open tcp client stream */ @@ -1479,7 +1493,6 @@ void decodeftppath(const char *path, char *addr, char *file, char *user, *q = '\0'; if (passwd) strcpy(passwd, q + 1); } - *q = '\0'; if (user) strcpy(user, buff); } else @@ -1545,8 +1558,17 @@ void *ftpthread(void *arg) p++; else p = remote; - sprintf(local, "%s%c%s", localdir, FILEPATHSEP, p); - sprintf(errfile, "%s.err", local); + // sprintf(local, "%s%c%s", localdir, FILEPATHSEP, p); This line triggers a warning. Replaced by: + std::string s_aux = std::string(localdir) + std::to_string(FILEPATHSEP) + std::string(p); + int n = s_aux.length(); + if (n < 1024) + for (int i = 0; i < n; i++) local[i] = s_aux[i]; + + // sprintf(errfile, "%s.err", local); This line triggers a warning. Replaced by: + std::string s_aux2 = std::string(local) + ".err"; + n = s_aux2.length(); + if (n < 1024) + for (int i = 0; i < n; i++) errfile[i] = s_aux2[i]; /* if local file exist, skip download */ strcpy(tmpfile, local); @@ -1574,16 +1596,35 @@ void *ftpthread(void *arg) /* download command (ref [2]) */ if (ftp->proto == 0) { /* ftp */ - sprintf(opt, "--ftp-user=%s --ftp-password=%s --glob=off --passive-ftp %s-t 1 -T %d -O \"%s\"", - ftp->user, ftp->passwd, proxyopt, FTP_TIMEOUT, local); - sprintf(cmd, "%s%s %s \"ftp://%s/%s\" 2> \"%s\"\n", env, FTP_CMD, opt, ftp->addr, - remote, errfile); + // sprintf(opt, "--ftp-user=%s --ftp-password=%s --glob=off --passive-ftp %s-t 1 -T %d -O \"%s\"", + // ftp->user, ftp->passwd, proxyopt, FTP_TIMEOUT, local); This line triggers a warning. Replaced by: + std::string s_aux = "--ftp-user=" + std::string(ftp->user) + " --ftp-password=" + std::string(ftp->passwd) + + " --glob=off --passive-ftp " + std::string(proxyopt) + "s-t 1 -T " + std::to_string(FTP_TIMEOUT) + + " -O \"" + std::string(local) + "\""; + int k = s_aux.length(); + if (k < 1024) + for (int i = 0; i < k; i++) opt[i] = s_aux[i]; + + // sprintf(cmd, "%s%s %s \"ftp://%s/%s\" 2> \"%s\"\n", env, FTP_CMD, opt, ftp->addr, + // remote, errfile); This line triggers a warning. Replaced by: + std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " + + "\"ftp://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n"; + k = s_aux2.length(); + for (int i = 0; (i < k) && (i < 1024); i++) cmd[i] = s_aux2[i]; } else { /* http */ - sprintf(opt, "%s-t 1 -T %d -O \"%s\"", proxyopt, FTP_TIMEOUT, local); - sprintf(cmd, "%s%s %s \"http://%s/%s\" 2> \"%s\"\n", env, FTP_CMD, opt, ftp->addr, - remote, errfile); + // sprintf(opt, "%s-t 1 -T %d -O \"%s\"", proxyopt, FTP_TIMEOUT, local); This line triggers a warning. Replaced by: + std::string s_aux = std::string(proxyopt) + " -t 1 -T " + std::to_string(FTP_TIMEOUT) + " -O \"" + std::string(local) + "\""; + int l = s_aux.length(); + for (int i = 0; (i < l) && (i < 1024); i++) opt[i] = s_aux[i]; + + // sprintf(cmd, "%s%s %s \"http://%s/%s\" 2> \"%s\"\n", env, FTP_CMD, opt, ftp->addr, + // remote, errfile); This line triggers a warning. Replaced by: + std::string s_aux2 = std::string(env) + std::string(FTP_CMD) + " " + std::string(opt) + " " + + "\"http://" + std::string(ftp->addr) + "/" + std::string(remote) + "\" 2> \"" + std::string(errfile) + "\"\n"; + l = s_aux2.length(); + for (int i = 0; (i < l) && (i < 1024); i++) cmd[i] = s_aux2[i]; } /* execute download command */ if ((ret = execcmd(cmd))) @@ -2049,7 +2090,10 @@ int strstat(stream_t *stream, char *msg) strlock(stream); if (msg) { - strncpy(msg, stream->msg, MAXSTRMSG - 1); + // strncpy(msg, stream->msg, MAXSTRMSG - 1); This line triggers a warning. Replaced by: + std::string aux_s(stream->msg); + aux_s.resize(MAXSTRMSG - 1, '0'); + for (int i = 0; i < MAXSTRMSG - 1; i++) msg[i] = aux_s[i]; msg[MAXSTRMSG - 1] = '\0'; } if (!stream->port) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/Doxyfile.in b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/Doxyfile.in index 8fa50f08d..4d9e579a3 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/Doxyfile.in +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/Doxyfile.in @@ -20,7 +20,7 @@ # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# built into libc) for the transcoding. See https://www.gnu.org/software/libiconv # for the list of possible encodings. # The default value is: UTF-8. @@ -287,7 +287,7 @@ EXTENSION_MAPPING = # If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments # according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. +# documentation. See https://daringfireball.net/projects/markdown/ for details. # The output of markdown processing is further processed by doxygen, so you can # mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in # case of backward compatibilities issues. @@ -320,7 +320,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -679,7 +679,7 @@ LAYOUT_FILE = @PROJECT_SOURCE_DIR@/DoxygenLayout.xml # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. Do not use file names with spaces, bibtex cannot handle them. See @@ -761,7 +761,7 @@ INPUT = @PROJECT_SOURCE_DIR@ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv) for the list of # possible encodings. # The default value is: UTF-8. @@ -994,7 +994,7 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: @@ -1137,7 +1137,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the stylesheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1195,13 +1195,12 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# startup. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1240,7 +1239,7 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on # Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output @@ -1453,7 +1452,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using prerendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1465,7 +1464,7 @@ USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# https://docs.mathjax.org/en/latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1480,11 +1479,11 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.com/libraries/mathjax/. # This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +MATHJAX_RELPATH = https://cdnjs.com/libraries/mathjax/ # The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax # extension names that should be enabled during MathJax rendering. For example @@ -1495,7 +1494,7 @@ MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: https://docs.mathjax.org/en/latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1542,7 +1541,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer ( doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1555,7 +1554,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer ( doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1726,7 +1725,7 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc index cf26c9bea..58db3bac1 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc @@ -539,7 +539,7 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc, vlen = vlen + vlen_twiddle; const float tol_f = tol; - const unsigned int tol_i = static_cast(tol); + const unsigned int tol_i = static_cast(tol); //first let's get a list of available architectures for the test std::vector arch_list = get_arch_list(desc); @@ -565,6 +565,11 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc, std::cerr << " - " << name << std::endl; return false; } + catch (std::string s) + { + std::cerr << "Error: " << s << std::endl; + return false; + } //pull the input scalars into their own vector std::vector inputsc; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/testqa.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/testqa.cc index 4b4ec2a2f..113308e71 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/testqa.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/testqa.cc @@ -25,6 +25,7 @@ #include // for operator<<, basic_ostream, endl, char... #include // IWYU pragma: keep #include // for map, map<>::iterator, _Rb_tree_iterator +#include // for stringstream #include // for string, operator<< #include // for pair #include // for vector @@ -48,15 +49,16 @@ int main(int argc, char* argv[]) std::vector results; if (argc > 1) { - const size_t len = std::char_traits::length(argv[1]); - if (len == 0 || len > 2046) + std::stringstream ss; + ss << argv[1]; + if (ss.fail()) { - std::cerr << "Test name is too long." << std::endl; + std::cerr << "Test name not correctly set." << std::endl; return 0; } for (unsigned int ii = 0; ii < test_cases.size(); ++ii) { - if (std::string(argv[1]) == test_cases[ii].name()) + if (ss.str() == test_cases[ii].name()) { volk_gnsssdr_test_case_t test_case = test_cases[ii]; if (run_volk_gnsssdr_tests(test_case.desc(), test_case.kernel_ptr(), diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/README b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/README index 3820201c2..f0da0f59d 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/README +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/python/volk_gnsssdr_modtool/README @@ -76,8 +76,7 @@ This will put the code for the new kernel into Other kernels must be added by hand. See the following webpages for more information about creating VOLK kernels: - http://gnuradio.org/doc/doxygen/volk_gnsssdr_guide.html - http://gnuradio.org/redmine/projects/gnuradio/wiki/Volk + https://www.gnuradio.org/doc/doxygen/volk_guide.html ====================================================================== diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc index aa7d49cd7..0e84dea54 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.cc @@ -62,9 +62,9 @@ hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels_in, d_nchannels = nchannels_out; d_dump_filename = dump_filename; T_rx_s = 0.0; - T_rx_step_s = 0.001; // 1 ms - max_delta = 1.5; // 1.5 s - d_latency = 0.5; // 300 ms + T_rx_step_ms = 1; // 1 ms + max_delta = 1.5; // 1.5 s + d_latency = 0.5; // 300 ms valid_channels.resize(d_nchannels, false); d_num_valid_channels = 0; d_gnss_synchro_history = new Gnss_circular_deque(static_cast(max_delta * 1000.0), d_nchannels); @@ -87,6 +87,8 @@ hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels_in, } } } + T_rx_TOW_ms = 0; + T_rx_TOW_set = false; } @@ -308,7 +310,10 @@ bool hybrid_observables_cc::interpolate_data(Gnss_Synchro &out, const unsigned i } find_interp_elements(ch, ti); - //Linear interpolation: y(t) = y(t1) + (y(t2) - y(t1)) * (t - t1) / (t2 - t1) + // 1st: copy the nearest gnss_synchro data for that channel + out = d_gnss_synchro_history->at(ch, 0); + + // 2nd: Linear interpolation: y(t) = y(t1) + (y(t2) - y(t1)) * (t - t1) / (t2 - t1) // CARRIER PHASE INTERPOLATION out.Carrier_phase_rads = d_gnss_synchro_history->at(ch, 0).Carrier_phase_rads + (d_gnss_synchro_history->at(ch, 1).Carrier_phase_rads - d_gnss_synchro_history->at(ch, 0).Carrier_phase_rads) * (ti - d_gnss_synchro_history->at(ch, 0).RX_time) / (d_gnss_synchro_history->at(ch, 1).RX_time - d_gnss_synchro_history->at(ch, 0).RX_time); @@ -317,7 +322,7 @@ bool hybrid_observables_cc::interpolate_data(Gnss_Synchro &out, const unsigned i out.Carrier_Doppler_hz = d_gnss_synchro_history->at(ch, 0).Carrier_Doppler_hz + (d_gnss_synchro_history->at(ch, 1).Carrier_Doppler_hz - d_gnss_synchro_history->at(ch, 0).Carrier_Doppler_hz) * (ti - d_gnss_synchro_history->at(ch, 0).RX_time) / (d_gnss_synchro_history->at(ch, 1).RX_time - d_gnss_synchro_history->at(ch, 0).RX_time); // TOW INTERPOLATION - out.TOW_at_current_symbol_s = d_gnss_synchro_history->at(ch, 0).TOW_at_current_symbol_s + (d_gnss_synchro_history->at(ch, 1).TOW_at_current_symbol_s - d_gnss_synchro_history->at(ch, 0).TOW_at_current_symbol_s) * (ti - d_gnss_synchro_history->at(ch, 0).RX_time) / (d_gnss_synchro_history->at(ch, 1).RX_time - d_gnss_synchro_history->at(ch, 0).RX_time); + out.interp_TOW_ms = static_cast(d_gnss_synchro_history->at(ch, 0).TOW_at_current_symbol_ms) + (static_cast(d_gnss_synchro_history->at(ch, 1).TOW_at_current_symbol_ms) - static_cast(d_gnss_synchro_history->at(ch, 0).TOW_at_current_symbol_ms)) * (ti - d_gnss_synchro_history->at(ch, 0).RX_time) / (d_gnss_synchro_history->at(ch, 1).RX_time - d_gnss_synchro_history->at(ch, 0).RX_time); return true; } @@ -335,6 +340,7 @@ double hybrid_observables_cc::compute_T_rx_s(const Gnss_Synchro &a) } } + void hybrid_observables_cc::find_interp_elements(const unsigned int &ch, const double &ti) { unsigned int closest = 0; @@ -402,10 +408,10 @@ void hybrid_observables_cc::correct_TOW_and_compute_prange(std::vector::iterator it; -/////////////////////// DEBUG ////////////////////////// -// Logs if there is a pseudorange difference between -// signals of the same satellite higher than a threshold -//////////////////////////////////////////////////////// + /////////////////////// DEBUG ////////////////////////// + // Logs if there is a pseudorange difference between + // signals of the same satellite higher than a threshold + //////////////////////////////////////////////////////// #ifndef NDEBUG std::vector::iterator it2; double thr_ = 250.0 / SPEED_OF_LIGHT; // Maximum pseudorange difference = 250 meters @@ -415,8 +421,8 @@ void hybrid_observables_cc::correct_TOW_and_compute_prange(std::vectorPRN == it2->PRN and it->System == it2->System) { - double tow_dif_ = std::fabs(it->TOW_at_current_symbol_s - it2->TOW_at_current_symbol_s); - if (tow_dif_ > thr_) + double tow_dif_ = std::fabs(it->TOW_at_current_symbol_ms - it2->TOW_at_current_symbol_ms); + if (tow_dif_ > thr_ * 1000.0) { DLOG(INFO) << "System " << it->System << ". Signals " << it->Signal << " and " << it2->Signal << ". TOW difference in PRN " << it->PRN @@ -431,20 +437,37 @@ void hybrid_observables_cc::correct_TOW_and_compute_prange(std::vector::lowest(); - for (it = data.begin(); it != data.end(); it++) + if (!T_rx_TOW_set) { - if (it->TOW_at_current_symbol_s > TOW_ref) + unsigned int TOW_ref = std::numeric_limits::lowest(); + for (it = data.begin(); it != data.end(); it++) { - TOW_ref = it->TOW_at_current_symbol_s; + if (it->TOW_at_current_symbol_ms > TOW_ref) + { + TOW_ref = it->TOW_at_current_symbol_ms; + } + } + T_rx_TOW_ms = TOW_ref; + T_rx_TOW_set = true; + } + else + { + T_rx_TOW_ms += T_rx_step_ms; + //todo: check what happens during the week rollover + if (T_rx_TOW_ms >= 604800000) + { + T_rx_TOW_ms = T_rx_TOW_ms % 604800000; } } for (it = data.begin(); it != data.end(); it++) { - double traveltime_s = TOW_ref - it->TOW_at_current_symbol_s + GPS_STARTOFFSET_ms / 1000.0; - it->RX_time = TOW_ref + GPS_STARTOFFSET_ms / 1000.0; + double traveltime_s = (static_cast(T_rx_TOW_ms) - it->interp_TOW_ms + GPS_STARTOFFSET_ms) / 1000.0; + + //std::cout.precision(17); + //std::cout << "Diff T_rx_TOW_ms - interp_TOW_ms: " << static_cast(T_rx_TOW_ms) - it->interp_TOW_ms << std::endl; + + it->RX_time = (T_rx_TOW_ms + GPS_STARTOFFSET_ms) / 1000.0; it->Pseudorange_m = traveltime_s * SPEED_OF_LIGHT; } } @@ -466,7 +489,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) } for (int epoch = 0; epoch < ninput_items[d_nchannels]; epoch++) { - T_rx_s += T_rx_step_s; + T_rx_s += (static_cast(T_rx_step_ms) / 1000.0); ////////////////////////////////////////////////////////////////////////// if ((total_input_items == 0) and (d_num_valid_channels == 0)) @@ -503,6 +526,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) } } } + for (i = 0; i < d_nchannels; i++) { if (d_gnss_synchro_history->size(i) > 2) @@ -515,6 +539,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) } } d_num_valid_channels = valid_channels.count(); + // Check if there is any valid channel after reading the new incoming Gnss_Synchro data if (d_num_valid_channels == 0) { @@ -522,7 +547,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) return returned_elements; } - for (i = 0; i < d_nchannels; i++) //Discard observables with T_rx higher than the threshold + for (i = 0; i < d_nchannels; i++) // Discard observables with T_rx higher than the threshold { if (valid_channels[i]) { @@ -548,7 +573,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) { if (valid_channels[i]) { - Gnss_Synchro interpolated_gnss_synchro = d_gnss_synchro_history->back(i); + Gnss_Synchro interpolated_gnss_synchro; // empty set, it is required to COPY the nearest in the interpolation history = d_gnss_synchro_history->back(i); if (interpolate_data(interpolated_gnss_synchro, i, T_rx_s_out)) { epoch_data.push_back(interpolated_gnss_synchro); @@ -560,11 +585,13 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) } } d_num_valid_channels = valid_channels.count(); + if (d_num_valid_channels == 0) { consume(d_nchannels, epoch + 1); return returned_elements; } + correct_TOW_and_compute_prange(epoch_data); std::vector::iterator it = epoch_data.begin(); for (i = 0; i < d_nchannels; i++) @@ -581,6 +608,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) out[i][epoch].Flag_valid_pseudorange = false; } } + if (d_dump) { // MULTIPLEXED FILE RECORDING - Record results to file @@ -591,7 +619,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) { tmp_double = out[i][epoch].RX_time; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); - tmp_double = out[i][epoch].TOW_at_current_symbol_s; + tmp_double = out[i][epoch].interp_TOW_ms / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_double = out[i][epoch].Carrier_Doppler_hz; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); @@ -611,6 +639,7 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused) d_dump = false; } } + returned_elements++; } consume(d_nchannels, ninput_items[d_nchannels]); diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h index 409327d9c..c2008ceaf 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_cc.h @@ -76,7 +76,10 @@ private: Gnss_circular_deque* d_gnss_synchro_history; boost::dynamic_bitset<> valid_channels; double T_rx_s; - double T_rx_step_s; + unsigned int T_rx_step_ms; + //rx time follow GPST + bool T_rx_TOW_set; + unsigned int T_rx_TOW_ms; double max_delta; double d_latency; bool d_dump; diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index c9524bca7..cbbde6a46 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -102,6 +102,14 @@ DirectResamplerConditioner::DirectResamplerConditioner( file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index 382358ce9..696ccefea 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -84,6 +84,14 @@ MmseResamplerConditioner::MmseResamplerConditioner( file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc index e5926468b..1ec54e2fb 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.cc @@ -55,8 +55,7 @@ direct_resampler_conditioner_cb::direct_resampler_conditioner_cb( d_sample_freq_out( sample_freq_out), d_phase(0), - d_lphase(0), - d_history(1) + d_lphase(0) { const double two_32 = 4294967296.0; // Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296 diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.h b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.h index c6f77232c..1db7f374d 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.h +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cb.h @@ -59,7 +59,6 @@ private: uint32_t d_phase; uint32_t d_lphase; uint32_t d_phase_step; - unsigned int d_history; direct_resampler_conditioner_cb(double sample_freq_in, double sample_freq_out); diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc index ca39ff4a1..1cfa47a50 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.cc @@ -54,8 +54,7 @@ direct_resampler_conditioner_cc::direct_resampler_conditioner_cc( d_sample_freq_in(sample_freq_in), d_sample_freq_out(sample_freq_out), d_phase(0), - d_lphase(0), - d_history(1) + d_lphase(0) { // Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296 const double two_32 = 4294967296.0; diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h index 7548a700c..0c477c571 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h @@ -64,7 +64,6 @@ private: uint32_t d_phase; uint32_t d_lphase; uint32_t d_phase_step; - unsigned int d_history; direct_resampler_conditioner_cc(double sample_freq_in, double sample_freq_out); diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc index 6fc2dcf43..c8b01f006 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.cc @@ -53,8 +53,7 @@ direct_resampler_conditioner_cs::direct_resampler_conditioner_cs( d_sample_freq_in(sample_freq_in), d_sample_freq_out(sample_freq_out), d_phase(0), - d_lphase(0), - d_history(1) + d_lphase(0) { const double two_32 = 4294967296.0; // Computes the phase step multiplying the resampling ratio by 2^32 = 4294967296 diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.h b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.h index b57b1b438..40602a68d 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.h +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cs.h @@ -59,7 +59,6 @@ private: uint32_t d_phase; uint32_t d_lphase; uint32_t d_phase_step; - unsigned int d_history; direct_resampler_conditioner_cs(double sample_freq_in, double sample_freq_out); diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index 781738b4c..b5b7552f4 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -138,6 +138,14 @@ SignalGenerator::SignalGenerator(ConfigurationInterface* configuration, { DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index c2fa1de07..4ee93a535 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -21,32 +21,43 @@ list(SORT SIGNAL_SOURCE_ADAPTER_HEADERS) # Optional drivers +if(ENABLE_RAW_UDP) + find_package(PCAP) + if(NOT PCAP_FOUND) + message(FATAL_ERROR "PCAP required to compile custom UDP packet sample source (ENABLE_RAW_UDP)") + endif(NOT PCAP_FOUND) + get_filename_component(PCAP_LIBRARY_DIRS ${PCAP_LIBRARY} DIRECTORY CACHE) + set(OPT_LIBRARIES ${OPT_LIBRARIES} ${PCAP_LIBRARIES}) + set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${PCAP_INCLUDE_DIRS}) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} custom_udp_signal_source.cc) +endif(ENABLE_RAW_UDP) + if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2) - find_package(iio REQUIRED) - if(NOT IIO_FOUND) - message(STATUS "gnuradio-iio not found, its installation is required.") - message(STATUS "Please build and install the following projects:") - 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.") - endif(NOT IIO_FOUND) - set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES}) - set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS}) + find_package(Griio REQUIRED) + if(NOT IIO_FOUND) + message(STATUS "gnuradio-iio not found, its installation is required.") + message(STATUS "Please build and install the following projects:") + 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.") + endif(NOT IIO_FOUND) + set(OPT_LIBRARIES ${OPT_LIBRARIES} ${IIO_LIBRARIES}) + set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${IIO_INCLUDE_DIRS}) endif(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2) if(ENABLE_AD9361) - find_package(libiio REQUIRED) - if(NOT LIBIIO_FOUND) - message(STATUS "libiio not found, its installation is required.") - message(STATUS "Please build and install the following projects:") - 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.") - endif(NOT LIBIIO_FOUND) - set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBIIO_LIBRARIES}) - set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${LIBIIO_INCLUDE_DIRS}) + find_package(libiio REQUIRED) + if(NOT LIBIIO_FOUND) + message(STATUS "libiio not found, its installation is required.") + message(STATUS "Please build and install the following projects:") + 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.") + endif(NOT LIBIIO_FOUND) + set(OPT_LIBRARIES ${OPT_LIBRARIES} ${LIBIIO_LIBRARIES}) + set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${LIBIIO_INCLUDE_DIRS}) endif(ENABLE_AD9361) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc index 4c95cf547..e34103561 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -36,6 +36,7 @@ #include "GPS_L1_CA.h" #include "GPS_L2C.h" #include +#include #include // for cout, endl #ifdef __APPLE__ @@ -110,6 +111,14 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(ConfigurationInterface* configura int switch_position = configuration->property(role + ".switch_position", 0); switch_fpga = std::make_shared(device_name); switch_fpga->set_switch_position(switch_position); + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } @@ -122,7 +131,14 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() if (enable_dds_lo_) { - ad9361_disable_lo_local(); + try + { + ad9361_disable_lo_local(); + } + catch (const std::exception& e) + { + LOG(WARNING) << "Problem closing the Ad9361FpgaSignalSource: " << e.what(); + } } // std::cout<<"* AD9361 Destroying context\n"; @@ -132,12 +148,18 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() void Ad9361FpgaSignalSource::connect(gr::top_block_sptr top_block) { + if (top_block) + { /* top_block is not null */ + }; DLOG(INFO) << "AD9361 FPGA source nothing to connect"; } void Ad9361FpgaSignalSource::disconnect(gr::top_block_sptr top_block) { + if (top_block) + { /* top_block is not null */ + }; DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; } diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc new file mode 100644 index 000000000..440a17252 --- /dev/null +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -0,0 +1,175 @@ +/*! + * \file udp_signal_source.cc + * + * \brief Receives ip frames containing samples in UDP frame encapsulation + * using a high performance packet capture library (libpcap) + * \author Javier Arribas jarribas (at) cttc.es + * ------------------------------------------------------------------------- + * + * 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 "custom_udp_signal_source.h" +#include "configuration_interface.h" +#include "GPS_L1_CA.h" +#include +#include +#include + + +using google::LogMessage; + + +CustomUDPSignalSource::CustomUDPSignalSource(ConfigurationInterface* configuration, + std::string role, unsigned int in_stream, unsigned int out_stream, + boost::shared_ptr queue) : role_(role), in_stream_(in_stream), out_stream_(out_stream), queue_(queue) +{ + // DUMP PARAMETERS + std::string empty = ""; + std::string default_dump_file = "./data/signal_source.dat"; + std::string default_item_type = "gr_complex"; + dump_ = configuration->property(role + ".dump", false); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + + // network PARAMETERS + std::string default_capture_device = "eth0"; + std::string default_address = "127.0.0.1"; + int default_port = 1234; + std::string address = configuration->property(role + ".origin_address", default_address); + std::string capture_device = configuration->property(role + ".capture_device", default_capture_device); + int port = configuration->property(role + ".port", default_port); + int payload_bytes = configuration->property(role + ".payload_bytes", 1024); + + RF_channels_ = configuration->property(role + ".RF_channels", 1); + channels_in_udp_ = configuration->property(role + ".channels_in_udp", 1); + IQ_swap_ = configuration->property(role + ".IQ_swap", false); + + std::string default_sample_type = "cbyte"; + std::string sample_type = configuration->property(role + ".sample_type", default_sample_type); + item_type_ = configuration->property(role + ".item_type", default_item_type); + // output item size is always gr_complex + item_size_ = sizeof(gr_complex); + + udp_gnss_rx_source_ = gr_complex_ip_packet_source::make(capture_device, + address, + port, + payload_bytes, + channels_in_udp_, + sample_type, + item_size_, + IQ_swap_); + + if (channels_in_udp_ >= RF_channels_) + { + for (int n = 0; n < channels_in_udp_; n++) + { + null_sinks_.push_back(gr::blocks::null_sink::make(sizeof(gr_complex))); + } + } + else + { + std::cout << "Configuration error: RF_channels 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + + +CustomUDPSignalSource::~CustomUDPSignalSource() +{ +} + + +void CustomUDPSignalSource::connect(gr::top_block_sptr top_block) +{ + // connect null sinks to unused streams + for (int n = 0; n < channels_in_udp_; n++) + { + top_block->connect(udp_gnss_rx_source_, n, null_sinks_.at(n), 0); + } + DLOG(INFO) << "connected udp_source to null_sinks to enable the use of spare channels" << std::endl; + + if (dump_) + { + for (int n = 0; n < channels_in_udp_; n++) + { + top_block->connect(udp_gnss_rx_source_, n, file_sink_.at(n), 0); + DLOG(INFO) << "connected source to file sink"; + } + } +} + + +void CustomUDPSignalSource::disconnect(gr::top_block_sptr top_block) +{ + // disconnect null sinks to unused streams + for (int n = 0; n < channels_in_udp_; n++) + { + top_block->disconnect(udp_gnss_rx_source_, n, null_sinks_.at(n), 0); + } + if (dump_) + { + for (int n = 0; n < channels_in_udp_; n++) + { + top_block->disconnect(udp_gnss_rx_source_, n, file_sink_.at(n), 0); + DLOG(INFO) << "disconnected source to file sink"; + } + } + DLOG(INFO) << "disconnected udp_source" << std::endl; +} + + +gr::basic_block_sptr CustomUDPSignalSource::get_left_block() +{ + LOG(WARNING) << "Left block of a signal source should not be retrieved"; + return gr::block_sptr(); +} + + +gr::basic_block_sptr CustomUDPSignalSource::get_right_block() +{ + return udp_gnss_rx_source_; +} + + +gr::basic_block_sptr CustomUDPSignalSource::get_right_block(__attribute__((unused)) int RF_channel) +{ + return udp_gnss_rx_source_; +} diff --git a/src/algorithms/signal_source/adapters/custom_udp_signal_source.h b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h new file mode 100644 index 000000000..fcd42071d --- /dev/null +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.h @@ -0,0 +1,105 @@ +/*! + * \file udp_signal_source.h + * + * \brief Receives ip frames containing samples in UDP frame encapsulation + * using a high performance packet capture library (libpcap) + * \author Javier Arribas jarribas (at) cttc.es + * ------------------------------------------------------------------------- + * + * 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 . + * + * ------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H +#define GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H + +#include "gnss_block_interface.h" +#include "gr_complex_ip_packet_source.h" +#include +#include +#include +#include +#include +#include +#include + + +class ConfigurationInterface; + +/*! + * \brief This class reads from UDP packets, which streams interleaved + * I/Q samples over a network. + */ +class CustomUDPSignalSource : public GNSSBlockInterface +{ +public: + CustomUDPSignalSource(ConfigurationInterface* configuration, + std::string role, unsigned int in_stream, + unsigned int out_stream, boost::shared_ptr queue); + + virtual ~CustomUDPSignalSource(); + + inline std::string role() override + { + return role_; + } + + /*! + * \brief Returns "UDP_Signal_Source" + */ + inline std::string implementation() override + { + return "Custom_UDP_Signal_Source"; + } + + inline size_t item_size() override + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + gr::basic_block_sptr get_right_block(int RF_channel) override; + +private: + std::string role_; + + bool IQ_swap_; + int RF_channels_; + int channels_in_udp_; + unsigned int in_stream_; + unsigned int out_stream_; + + std::string item_type_; + size_t item_size_; + bool dump_; + std::string dump_filename_; + std::vector> null_sinks_; + gr_complex_ip_packet_source::sptr udp_gnss_rx_source_; + std::vector> file_sink_; + boost::shared_ptr queue_; +}; + +#endif /*GNSS_SDR_CUSTOM_UDP_SIGNAL_SOURCE_H */ diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index 188d5ff16..c20f85664 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -240,6 +240,14 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration, DLOG(INFO) << "Repeat " << repeat_; DLOG(INFO) << "Dump " << dump_; DLOG(INFO) << "Dump filename " << dump_filename_; + if (in_streams_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc index 83ee0faee..082d45973 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc @@ -85,6 +85,14 @@ FlexibandSignalSource::FlexibandSignalSource(ConfigurationInterface* configurati LOG(WARNING) << item_type_ << " unrecognized item type for flexiband_source_"; item_size_ = sizeof(gr_complex); } + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index fbbb8a972..da3b39148 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -1,6 +1,6 @@ /*! - * \filei fmcomms2_signal_source.cc - * \brief signal source for sdr hardware from analog devices based on + * \file fmcomms2_signal_source.cc + * \brief Signal source for SDR hardware from Analog Devices based on * fmcomms2 evaluation board. * \author Rodrigo Muñoz, 2017, rmunozl(at)inacap.cl * @@ -36,6 +36,7 @@ #include "GPS_L1_CA.h" #include "GPS_L2C.h" #include +#include #include @@ -70,7 +71,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration dump_ = configuration->property(role + ".dump", false); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - //AD9361 Local Oscillator generation for dual band operation + // AD9361 Local Oscillator generation for dual band operation enable_dds_lo_ = configuration->property(role + ".enable_dds_lo", false); freq_rf_tx_hz_ = configuration->property(role + ".freq_rf_tx_hz", GPS_L1_FREQ_HZ - GPS_L2_FREQ_HZ - 1000); freq_dds_tx_hz_ = configuration->property(role + ".freq_dds_tx_hz", 1000); @@ -104,7 +105,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration rf_port_select_.c_str(), filter_file_.c_str(), filter_auto_); - //configure LO + // configure LO if (enable_dds_lo_ == true) { std::cout << "Enabling Local Oscillator generator in FMCOMMS2\n"; @@ -135,7 +136,7 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration gain_mode_rx2_.c_str(), rf_gain_rx2_, rf_port_select_.c_str(), filter_file_.c_str(), filter_auto_); - //configure LO + // configure LO if (enable_dds_lo_ == true) { std::cout << "Enabling Local Oscillator generator in FMCOMMS2\n"; @@ -179,7 +180,14 @@ Fmcomms2SignalSource::~Fmcomms2SignalSource() { if (enable_dds_lo_ == true) { - ad9361_disable_lo_remote(uri_); + try + { + ad9361_disable_lo_remote(uri_); + } + catch (const std::exception& e) + { + LOG(WARNING) << "Exception thrown in Fmcomms2SignalSource destructor: " << e.what(); + } } } diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 69f7f393e..3fa0644a0 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -72,6 +72,14 @@ LabsatSignalSource::LabsatSignalSource(ConfigurationInterface* configuration, { DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc index bcf24343b..f8f73103b 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -166,6 +166,14 @@ NsrFileSignalSource::NsrFileSignalSource(ConfigurationInterface* configuration, DLOG(INFO) << "Repeat " << repeat_; DLOG(INFO) << "Dump " << dump_; DLOG(INFO) << "Dump filename " << dump_filename_; + if (in_streams_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 57b32fbaa..982847f1b 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -146,6 +146,14 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index f77241ded..748760ac6 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -94,6 +94,14 @@ PlutosdrSignalSource::PlutosdrSignalSource(ConfigurationInterface* configuration file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc index a0f9880fd..5718067d7 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -128,6 +128,14 @@ RtlTcpSignalSource::RtlTcpSignalSource(ConfigurationInterface* configuration, file_sink_ = gr::blocks::file_sink::make(item_size_, dump_filename_.c_str()); DLOG(INFO) << "file_sink(" << file_sink_->unique_id() << ")"; } + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc index d49ce9aca..6ddeca2c3 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc @@ -165,6 +165,14 @@ SpirFileSignalSource::SpirFileSignalSource(ConfigurationInterface* configuration DLOG(INFO) << "Repeat " << repeat_; DLOG(INFO) << "Dump " << dump_; DLOG(INFO) << "Dump filename " << dump_filename_; + if (in_streams_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc index 24d97369b..758f3ff7b 100644 --- a/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_gss6450_file_signal_source.cc @@ -167,6 +167,14 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(ConfigurationInterface* DLOG(INFO) << "Repeat " << repeat_; DLOG(INFO) << "Dump " << dump_; DLOG(INFO) << "Dump filename " << dump_filename_; + if (in_streams_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc index d6d10e59e..78a08500c 100644 --- a/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_cpx_file_signal_source.cc @@ -166,6 +166,14 @@ TwoBitCpxFileSignalSource::TwoBitCpxFileSignalSource(ConfigurationInterface* con DLOG(INFO) << "Repeat " << repeat_; DLOG(INFO) << "Dump " << dump_; DLOG(INFO) << "Dump filename " << dump_filename_; + if (in_streams_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc index 5dbc6a5a5..cdde62a3b 100644 --- a/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/two_bit_packed_file_signal_source.cc @@ -230,6 +230,14 @@ TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource(ConfigurationInterfac DLOG(INFO) << "Repeat " << repeat_; DLOG(INFO) << "Dump " << dump_; DLOG(INFO) << "Dump filename " << dump_filename_; + if (in_streams_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index f0c9fcb12..eaa5f078b 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -228,6 +228,14 @@ UhdSignalSource::UhdSignalSource(ConfigurationInterface* configuration, DLOG(INFO) << "file_sink(" << file_sink_.at(i)->unique_id() << ")"; } } + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 7469b6192..4108bed58 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -17,14 +17,27 @@ # +if(ENABLE_RAW_UDP) + find_package(PCAP) + if(NOT PCAP_FOUND) + message(FATAL_ERROR "PCAP required to compile custom UDP packet sample source (ENABLE_RAW_UDP)") + endif(NOT PCAP_FOUND) + get_filename_component(PCAP_LIBRARY_DIRS ${PCAP_LIBRARY} DIRECTORY CACHE) + set(OPT_LIBRARIES ${OPT_LIBRARIES} ${PCAP_LIBRARIES}) + set(OPT_DRIVER_INCLUDE_DIRS ${OPT_DRIVER_INCLUDE_DIRS} ${PCAP_INCLUDE_DIRS}) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} gr_complex_ip_packet_source.cc) +endif(ENABLE_RAW_UDP) + set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES unpack_byte_2bit_samples.cc unpack_byte_2bit_cpx_samples.cc + unpack_byte_4bit_samples.cc unpack_intspir_1bit_samples.cc rtl_tcp_signal_source_c.cc unpack_2bit_samples.cc unpack_spir_gss6450_samples.cc labsat23_source.cc + ${OPT_DRIVER_SOURCES} ) include_directories( @@ -34,11 +47,17 @@ include_directories( ${GFlags_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} + ${OPT_DRIVER_INCLUDE_DIRS} ) file(GLOB SIGNAL_SOURCE_GR_BLOCKS_HEADERS "*.h") list(SORT SIGNAL_SOURCE_GR_BLOCKS_HEADERS) add_library(signal_source_gr_blocks ${SIGNAL_SOURCE_GR_BLOCKS_SOURCES} ${SIGNAL_SOURCE_GR_BLOCKS_HEADERS}) source_group(Headers FILES ${SIGNAL_SOURCE_GR_BLOCKS_HEADERS}) -target_link_libraries(signal_source_gr_blocks signal_source_lib ${GNURADIO_RUNTIME_LIBRARIES} ${Boost_LIBRARIES}) +target_link_libraries(signal_source_gr_blocks + signal_source_lib + ${GNURADIO_RUNTIME_LIBRARIES} + ${Boost_LIBRARIES} + ${OPT_LIBRARIES} +) add_dependencies(signal_source_gr_blocks glog-${glog_RELEASE}) diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc new file mode 100644 index 000000000..034d2b488 --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -0,0 +1,447 @@ +/*! + * \file gr_complex_ip_packet_source.cc + * + * \brief Receives ip frames containing samples in UDP frame encapsulation + * using a high performance packet capture library (libpcap) + * \author Javier Arribas jarribas (at) cttc.es + * ------------------------------------------------------------------------- + * + * 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 "gr_complex_ip_packet_source.h" +#include + + +const int FIFO_SIZE = 1472000; + + +/* 4 bytes IP address */ +typedef struct gr_ip_address +{ + u_char byte1; + u_char byte2; + u_char byte3; + u_char byte4; +} gr_ip_address; + + +/* IPv4 header */ +typedef struct gr_ip_header +{ + u_char ver_ihl; // Version (4 bits) + Internet header length (4 bits) + u_char tos; // Type of service + u_short tlen; // Total length + u_short identification; // Identification + u_short flags_fo; // Flags (3 bits) + Fragment offset (13 bits) + u_char ttl; // Time to live + u_char proto; // Protocol + u_short crc; // Header checksum + gr_ip_address saddr; // Source address + gr_ip_address daddr; // Destination address + u_int op_pad; // Option + Padding +} gr_ip_header; + + +/* UDP header*/ +typedef struct gr_udp_header +{ + u_short sport; // Source port + u_short dport; // Destination port + u_short len; // Datagram length + u_short crc; // Checksum +} gr_udp_header; + + +gr_complex_ip_packet_source::sptr +gr_complex_ip_packet_source::make(std::string src_device, + std::string origin_address, + int udp_port, + int udp_packet_size, + int n_baseband_channels, + std::string wire_sample_type, + size_t item_size, + bool IQ_swap_) +{ + return gnuradio::get_initial_sptr(new gr_complex_ip_packet_source(src_device, + origin_address, + udp_port, + udp_packet_size, + n_baseband_channels, + wire_sample_type, + item_size, + IQ_swap_)); +} + + +/* + * The private constructor + */ +gr_complex_ip_packet_source::gr_complex_ip_packet_source(std::string src_device, + __attribute__((unused)) std::string origin_address, + int udp_port, + int udp_packet_size, + int n_baseband_channels, + std::string wire_sample_type, + size_t item_size, + bool IQ_swap_) + : gr::sync_block("gr_complex_ip_packet_source", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(1, 4, item_size)) // 1 to 4 baseband complex channels +{ + std::cout << "Start Ethernet packet capture\n"; + + d_n_baseband_channels = n_baseband_channels; + if (wire_sample_type.compare("cbyte") == 0) + { + d_wire_sample_type = 1; + d_bytes_per_sample = d_n_baseband_channels * 2; + } + else if (wire_sample_type.compare("c4bits") == 0) + { + d_wire_sample_type = 2; + d_bytes_per_sample = d_n_baseband_channels; + } + else + { + std::cout << "Unknown wire sample type\n"; + exit(0); + } + std::cout << "d_wire_sample_type:" << d_wire_sample_type << std::endl; + d_src_device = src_device; + d_udp_port = udp_port; + d_udp_payload_size = udp_packet_size; + d_fifo_full = false; + + // allocate signal samples buffer + fifo_buff = new char[FIFO_SIZE]; + fifo_read_ptr = 0; + fifo_write_ptr = 0; + fifo_items = 0; + d_item_size = item_size; + d_IQ_swap = IQ_swap_; + d_sock_raw = 0; + d_pcap_thread = NULL; + descr = NULL; + + memset(reinterpret_cast(&si_me), 0, sizeof(si_me)); +} + + +// Called by gnuradio to enable drivers, etc for i/o devices. +bool gr_complex_ip_packet_source::start() +{ + std::cout << "gr_complex_ip_packet_source START\n"; + // open the ethernet device + if (open() == true) + { + // start pcap capture thread + d_pcap_thread = new boost::thread(boost::bind(&gr_complex_ip_packet_source::my_pcap_loop_thread, this, descr)); + return true; + } + else + { + return false; + } +} + + +// Called by gnuradio to disable drivers, etc for i/o devices. +bool gr_complex_ip_packet_source::stop() +{ + std::cout << "gr_complex_ip_packet_source STOP\n"; + if (descr != NULL) + { + pcap_breakloop(descr); + d_pcap_thread->join(); + pcap_close(descr); + } + return true; +} + + +bool gr_complex_ip_packet_source::open() +{ + char errbuf[PCAP_ERRBUF_SIZE]; + boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function + // open device for reading + descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf); + if (descr == NULL) + { + std::cout << "Error opening Ethernet device " << d_src_device << std::endl; + std::cout << "Fatal Error in pcap_open_live(): " << std::string(errbuf) << std::endl; + return false; + } + // bind UDP port to avoid automatic reply with ICMP port unreachable packets from kernel + d_sock_raw = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (d_sock_raw == -1) + { + std::cout << "Error opening UDP socket" << std::endl; + return false; + } + + // zero out the structure + memset(reinterpret_cast(&si_me), 0, sizeof(si_me)); + + si_me.sin_family = AF_INET; + si_me.sin_port = htons(d_udp_port); + si_me.sin_addr.s_addr = htonl(INADDR_ANY); + + // bind socket to port + if (bind(d_sock_raw, reinterpret_cast(&si_me), sizeof(si_me)) == -1) + { + std::cout << "Error opening UDP socket" << std::endl; + return false; + } + return true; +} + + +gr_complex_ip_packet_source::~gr_complex_ip_packet_source() +{ + if (d_pcap_thread != NULL) + { + delete d_pcap_thread; + } + delete fifo_buff; + std::cout << "Stop Ethernet packet capture\n"; +} + + +void gr_complex_ip_packet_source::static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, + const u_char *packet) +{ + gr_complex_ip_packet_source *bridge = reinterpret_cast(args); + bridge->pcap_callback(args, pkthdr, packet); +} + + +void gr_complex_ip_packet_source::pcap_callback(__attribute__((unused)) u_char *args, __attribute__((unused)) const struct pcap_pkthdr *pkthdr, + const u_char *packet) +{ + boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function + + const gr_ip_header *ih; + const gr_udp_header *uh; + + // eth frame parameters + // **** UDP RAW PACKET DECODER **** + if ((packet[12] == 0x08) & (packet[13] == 0x00)) // IP FRAME + { + // retrieve the position of the ip header + ih = reinterpret_cast(packet + 14); // length of ethernet header + + // retrieve the position of the udp header + u_int ip_len; + ip_len = (ih->ver_ihl & 0xf) * 4; + uh = reinterpret_cast(reinterpret_cast(ih) + ip_len); + + // convert from network byte order to host byte order + //u_short sport; + u_short dport; + dport = ntohs(uh->dport); + //sport = ntohs(uh->sport); + if (dport == d_udp_port) + { + // print ip addresses and udp ports + // printf("%d.%d.%d.%d.%d -> %d.%d.%d.%d.%d\n", + // ih->saddr.byte1, + // ih->saddr.byte2, + // ih->saddr.byte3, + // ih->saddr.byte4, + // sport, + // ih->daddr.byte1, + // ih->daddr.byte2, + // ih->daddr.byte3, + // ih->daddr.byte4, + // dport); + // std::cout<<"uh->len:"<len)<len) - 8; // total udp packet length minus the header length + // read the payload bytes and insert them into the shared circular buffer + const u_char *udp_payload = (reinterpret_cast(uh) + sizeof(gr_udp_header)); + if (fifo_items <= (FIFO_SIZE - payload_length_bytes)) + { + int aligned_write_items = FIFO_SIZE - fifo_write_ptr; + if (aligned_write_items >= payload_length_bytes) + { + // write all in a single memcpy + memcpy(&fifo_buff[fifo_write_ptr], &udp_payload[0], payload_length_bytes); // size in bytes + fifo_write_ptr += payload_length_bytes; + if (fifo_write_ptr == FIFO_SIZE) fifo_write_ptr = 0; + fifo_items += payload_length_bytes; + } + else + { + // two step wrap write + memcpy(&fifo_buff[fifo_write_ptr], &udp_payload[0], aligned_write_items); // size in bytes + fifo_write_ptr = payload_length_bytes - aligned_write_items; + memcpy(&fifo_buff[0], &udp_payload[aligned_write_items], fifo_write_ptr); // size in bytes + fifo_items += payload_length_bytes; + } + } + else + { + // notify overflow + std::cout << "O" << std::flush; + } + } + } +} + + +void gr_complex_ip_packet_source::my_pcap_loop_thread(pcap_t *pcap_handle) +{ + pcap_loop(pcap_handle, -1, gr_complex_ip_packet_source::static_pcap_callback, reinterpret_cast(this)); +} + + +void gr_complex_ip_packet_source::demux_samples(gr_vector_void_star output_items, int num_samples_readed) +{ + int8_t real; + int8_t imag; + uint8_t tmp_char2; + for (int n = 0; n < num_samples_readed; n++) + { + switch (d_wire_sample_type) + { + case 1: // interleaved byte samples + for (long unsigned int i = 0; i < output_items.size(); i++) + { + real = fifo_buff[fifo_read_ptr++]; + imag = fifo_buff[fifo_read_ptr++]; + if (d_IQ_swap) + { + static_cast(output_items[i])[n] = gr_complex(real, imag); + } + else + { + static_cast(output_items[i])[n] = gr_complex(imag, real); + } + } + break; + case 2: // 4-bit samples + for (long unsigned int i = 0; i < output_items.size(); i++) + { + tmp_char2 = fifo_buff[fifo_read_ptr] & 0x0F; + if (tmp_char2 >= 8) + { + real = 2 * (tmp_char2 - 16) + 1; + } + else + { + real = 2 * tmp_char2 + 1; + } + tmp_char2 = fifo_buff[fifo_read_ptr++] >> 4; + tmp_char2 = tmp_char2 & 0x0F; + if (tmp_char2 >= 8) + { + imag = 2 * (tmp_char2 - 16) + 1; + } + else + { + imag = 2 * tmp_char2 + 1; + } + if (d_IQ_swap) + { + static_cast(output_items[i])[n] = gr_complex(imag, real); + } + else + { + static_cast(output_items[i])[n] = gr_complex(real, imag); + } + } + break; + default: + std::cout << "Unknown wire sample type\n"; + exit(0); + } + if (fifo_read_ptr == FIFO_SIZE) fifo_read_ptr = 0; + } +} + + +int gr_complex_ip_packet_source::work(int noutput_items, + __attribute__((unused)) gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + // send samples to next GNU Radio block + boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function + if (fifo_items == 0) return 0; + + if (output_items.size() > static_cast(d_n_baseband_channels)) + { + std::cout << "Configuration error: more baseband channels connected than the available in the UDP source\n"; + exit(0); + } + int num_samples_readed; + int bytes_requested; + switch (d_wire_sample_type) + { + case 1: // complex byte samples + bytes_requested = noutput_items * d_bytes_per_sample; + if (bytes_requested < fifo_items) + { + num_samples_readed = noutput_items; // read all + } + else + { + num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have + } + break; + case 2: // complex 4 bits samples + bytes_requested = noutput_items * d_bytes_per_sample; + if (bytes_requested < fifo_items) + { + num_samples_readed = noutput_items; // read all + } + else + { + num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have + } + break; + default: // complex byte samples + bytes_requested = noutput_items * d_bytes_per_sample; + if (bytes_requested < fifo_items) + { + num_samples_readed = noutput_items; // read all + } + else + { + num_samples_readed = fifo_items / d_bytes_per_sample; // read what we have + } + } + + bytes_requested = num_samples_readed * d_bytes_per_sample; + // read all in a single loop + demux_samples(output_items, num_samples_readed); // it also increases the fifo read pointer + // update fifo items + fifo_items = fifo_items - bytes_requested; + + for (long unsigned int n = 0; n < output_items.size(); n++) + { + produce(static_cast(n), num_samples_readed); + } + return this->WORK_CALLED_PRODUCE; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h new file mode 100644 index 000000000..0661e0911 --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h @@ -0,0 +1,115 @@ +/*! + * \file gr_complex_ip_packet_source.h + * + * \brief Receives ip frames containing samples in UDP frame encapsulation + * using a high performance packet capture library (libpcap) + * \author Javier Arribas jarribas (at) cttc.es + * ------------------------------------------------------------------------- + * + * 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 . + * + * ------------------------------------------------------------------------- + */ + + +#ifndef INCLUDED_GR_COMPLEX_IP_PACKET_SOURCE_H +#define INCLUDED_GR_COMPLEX_IP_PACKET_SOURCE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class gr_complex_ip_packet_source : virtual public gr::sync_block +{ +private: + boost::mutex d_mutex; + pcap_t *descr; //ethernet pcap device descriptor + + char *fifo_buff; + + int fifo_read_ptr; + int fifo_write_ptr; + int fifo_items; + int d_sock_raw; + int d_udp_port; + struct sockaddr_in si_me; + std::string d_src_device; + std::string d_origin_address; + int d_udp_payload_size; + bool d_fifo_full; + + int d_n_baseband_channels; + int d_wire_sample_type; + int d_bytes_per_sample; + size_t d_item_size; + bool d_IQ_swap; + + boost::thread *d_pcap_thread; + /*! + * \brief + * Opens the ethernet device using libpcap raw capture mode + * If any of these fail, the fuction retuns the error and exits. + */ + bool open(); + + void demux_samples(gr_vector_void_star output_items, int num_samples_readed); + void my_pcap_loop_thread(pcap_t *pcap_handle); + void pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet); + static void static_pcap_callback(u_char *args, const struct pcap_pkthdr *pkthdr, const u_char *packet); + +public: + typedef boost::shared_ptr sptr; + static sptr make(std::string src_device, + std::string origin_address, + int udp_port, + int udp_packet_size, + int n_baseband_channels, + std::string wire_sample_type, + size_t item_size, + bool IQ_swap_); + gr_complex_ip_packet_source(std::string src_device, + std::string origin_address, + int udp_port, + int udp_packet_size, + int n_baseband_channels, + std::string wire_sample_type, + size_t item_size, + bool IQ_swap_); + ~gr_complex_ip_packet_source(); + + // Where all the action really happens + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + // Called by gnuradio to enable drivers, etc for i/o devices. + bool start(); + // Called by gnuradio to disable drivers, etc for i/o devices. + bool stop(); +}; + +#endif /* INCLUDED_GR_COMPLEX_IP_PACKET_SOURCE_H */ diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index c956f4f4c..71c09a8c8 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -154,7 +154,7 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address, rtl_tcp_signal_source_c::~rtl_tcp_signal_source_c() { - boost::mutex::scoped_lock lock(mutex_); + mutex_.unlock(); io_service_.stop(); not_empty_.notify_one(); not_full_.notify_one(); diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.cc b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.cc new file mode 100644 index 000000000..b3a1d61f7 --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.cc @@ -0,0 +1,86 @@ +/*! + * \file unpack_byte_4bit_samples.cc + * + * \brief Unpacks byte samples to 4 bits samples. + * Packing Order + * Packing order in Nibble I0 I1 I2 I3 I0 I1 I2 I3 + * \author Javier Arribas jarribas (at) cttc.es + * ------------------------------------------------------------------------- + * + * 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 "unpack_byte_4bit_samples.h" +#include + +unpack_byte_4bit_samples_sptr make_unpack_byte_4bit_samples() +{ + return unpack_byte_4bit_samples_sptr(new unpack_byte_4bit_samples()); +} + + +unpack_byte_4bit_samples::unpack_byte_4bit_samples() : sync_interpolator("unpack_byte_4bit_samples", + gr::io_signature::make(1, 1, sizeof(signed char)), + gr::io_signature::make(1, 1, sizeof(signed char)), + 2) +{ +} + + +unpack_byte_4bit_samples::~unpack_byte_4bit_samples() +{ +} + + +int unpack_byte_4bit_samples::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const signed char *in = reinterpret_cast(input_items[0]); + signed char *out = reinterpret_cast(output_items[0]); + int n = 0; + unsigned char tmp_char2; + for (int i = 0; i < noutput_items / 2; i++) + { + tmp_char2 = in[i] & 0x0F; + if (tmp_char2 >= 8) + { + out[n++] = 2 * (tmp_char2 - 16) + 1; + } + else + { + out[n++] = 2 * tmp_char2 + 1; + } + tmp_char2 = in[i] >> 4; + tmp_char2 = tmp_char2 & 0x0F; + if (tmp_char2 >= 8) + { + out[n++] = 2 * (tmp_char2 - 16) + 1; + } + else + { + out[n++] = 2 * tmp_char2 + 1; + } + } + return noutput_items; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.h b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.h new file mode 100644 index 000000000..0a48bcb5f --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/unpack_byte_4bit_samples.h @@ -0,0 +1,61 @@ +/*! + * \file unpack_byte_4bit_samples.h + * + * \brief Unpacks byte samples to 4 bits samples. + * Packing Order + * Packing order in Nibble I0 I1 I2 I3 I0 I1 I2 I3 + * \author Javier Arribas jarribas (at) cttc.es + * ------------------------------------------------------------------------- + * + * 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 . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_unpack_byte_4bit_samples_H +#define GNSS_SDR_unpack_byte_4bit_samples_H + +#include + +class unpack_byte_4bit_samples; + +typedef boost::shared_ptr unpack_byte_4bit_samples_sptr; + +unpack_byte_4bit_samples_sptr make_unpack_byte_4bit_samples(); + +/*! + * \brief This class implements conversion between byte packet samples to 4bit_cpx samples + * 1 byte = 1 x complex 4bit I, + 4bit Q samples + */ +class unpack_byte_4bit_samples : public gr::sync_interpolator +{ +private: + friend unpack_byte_4bit_samples_sptr make_unpack_byte_4bit_samples_sptr(); + +public: + unpack_byte_4bit_samples(); + ~unpack_byte_4bit_samples(); + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); +}; + +#endif diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index f37684525..8ace0c109 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -17,7 +17,7 @@ # if(ENABLE_PLUTOSDR OR ENABLE_FMCOMMS2) - find_package(iio REQUIRED) + find_package(Griio REQUIRED) if(NOT IIO_FOUND) message(STATUS "gnuradio-iio not found, its installation is required.") message(STATUS "Please build and install the following projects:") diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc index a7f0f3470..ab20cab1d 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc @@ -58,6 +58,14 @@ GalileoE1BTelemetryDecoder::GalileoE1BTelemetryDecoder(ConfigurationInterface* c telemetry_decoder_ = galileo_e1b_make_telemetry_decoder_cc(satellite_, dump_); // TODO fix me DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc index 6470e2783..48ed8b216 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc @@ -61,6 +61,14 @@ GalileoE5aTelemetryDecoder::GalileoE5aTelemetryDecoder(ConfigurationInterface* c telemetry_decoder_ = galileo_e5a_make_telemetry_decoder_cc(satellite_, dump_); // TODO fix me DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc index 3d6555157..9c991349f 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc @@ -57,6 +57,14 @@ GlonassL1CaTelemetryDecoder::GlonassL1CaTelemetryDecoder(ConfigurationInterface* telemetry_decoder_ = glonass_l1_ca_make_telemetry_decoder_cc(satellite_, dump_); DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc index 8376cc27b..8c409316b 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc @@ -56,6 +56,14 @@ GlonassL2CaTelemetryDecoder::GlonassL2CaTelemetryDecoder(ConfigurationInterface* telemetry_decoder_ = glonass_l2_ca_make_telemetry_decoder_cc(satellite_, dump_); DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc index 98b4e6d79..5a41d6c3d 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc @@ -57,6 +57,14 @@ GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder(ConfigurationInterface* configu telemetry_decoder_ = gps_l1_ca_make_telemetry_decoder_cc(satellite_, dump_); // TODO fix me DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc index 5e1f9c6b2..fabb55fe9 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc @@ -57,6 +57,14 @@ GpsL2CTelemetryDecoder::GpsL2CTelemetryDecoder(ConfigurationInterface* configura telemetry_decoder_ = gps_l2c_make_telemetry_decoder_cc(satellite_, dump_); // TODO fix me DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc index f86cedf55..172139563 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc @@ -53,6 +53,14 @@ GpsL5TelemetryDecoder::GpsL5TelemetryDecoder(ConfigurationInterface* configurati telemetry_decoder_ = gps_l5_make_telemetry_decoder_cc(satellite_, dump_); DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc index d695f0861..4309b28d8 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc @@ -55,6 +55,14 @@ SbasL1TelemetryDecoder::SbasL1TelemetryDecoder(ConfigurationInterface* configura telemetry_decoder_ = sbas_l1_make_telemetry_decoder_cc(satellite_, dump_); // TODO fix me channel_ = 0; DLOG(INFO) << "telemetry_decoder(" << telemetry_decoder_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc index 264646524..9e1dc3394 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/galileo_e1b_telemetry_decoder_cc.cc @@ -303,11 +303,11 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute Gnss_Synchro **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer const Gnss_Synchro **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer - Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block - //1. Copy the current tracking output + Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block + // 1. Copy the current tracking output current_symbol = in[0][0]; - d_symbol_history.push_back(current_symbol); //add new symbol to the symbol queue - d_sample_counter++; //count for the processed samples + d_symbol_history.push_back(current_symbol); // add new symbol to the symbol queue + d_sample_counter++; // count for the processed samples consume_each(1); d_flag_preamble = false; @@ -316,7 +316,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute if (d_symbol_history.size() > required_symbols) { // TODO Optimize me! - //******* preamble correlation ******** + // ******* preamble correlation ******** for (int i = 0; i < d_symbols_per_preamble; i++) { if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping @@ -330,12 +330,12 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute } } - //******* frame sync ****************** - if (d_stat == 0) //no preamble information + // ******* frame sync ****************** + if (d_stat == 0) // no preamble information { if (abs(corr_value) >= d_symbols_per_preamble) { - d_preamble_index = d_sample_counter; //record the preamble sample stamp + d_preamble_index = d_sample_counter; // record the preamble sample stamp LOG(INFO) << "Preamble detection for Galileo satellite " << this->d_satellite; d_stat = 1; // enter into frame pre-detection status } @@ -344,13 +344,13 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute { if (abs(corr_value) >= d_symbols_per_preamble) { - //check preamble separation + // check preamble separation preamble_diff = d_sample_counter - d_preamble_index; if (abs(preamble_diff - GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS) == 0) { - //try to decode frame + // try to decode frame LOG(INFO) << "Starting page decoder for Galileo satellite " << this->d_satellite; - d_preamble_index = d_sample_counter; //record the preamble sample stamp + d_preamble_index = d_sample_counter; // record the preamble sample stamp d_stat = 2; } else @@ -383,13 +383,13 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute } } - //call the decoder + // call the decoder decode_word(page_part_symbols, frame_length); if (d_nav.flag_CRC_test == true) { d_CRC_error_counter = 0; - d_flag_preamble = true; //valid preamble indicator (initialized to false every work()) - d_preamble_index = d_sample_counter; //record the preamble sample stamp (t_P) + d_flag_preamble = true; // valid preamble indicator (initialized to false every work()) + d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P) if (!d_flag_frame_sync) { d_flag_frame_sync = true; @@ -400,7 +400,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute else { d_CRC_error_counter++; - d_preamble_index = d_sample_counter; //record the preamble sample stamp + d_preamble_index = d_sample_counter; // record the preamble sample stamp if (d_CRC_error_counter > CRC_ERROR_LIMIT) { LOG(INFO) << "Lost of frame sync SAT " << this->d_satellite; @@ -412,37 +412,37 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute } // UPDATE GNSS SYNCHRO DATA - //2. Add the telemetry decoder information + // 2. Add the telemetry decoder information if (this->d_flag_preamble == true and d_nav.flag_TOW_set == true) - //update TOW at the preamble instant + // update TOW at the preamble instant { - if (d_nav.flag_TOW_5 == true) //page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec) + if (d_nav.flag_TOW_5 == true) // page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec) { - //TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay - d_TOW_at_current_symbol = d_nav.TOW_5 + static_cast(GALILEO_INAV_PAGE_PART_SECONDS) + static_cast(required_symbols - 1) * GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND; + // TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay + d_TOW_at_current_symbol = d_nav.TOW_5 + static_cast(GALILEO_INAV_PAGE_PART_SECONDS) + static_cast(required_symbols + 1) * GALILEO_E1_CODE_PERIOD; d_nav.flag_TOW_5 = false; } - else if (d_nav.flag_TOW_6 == true) //page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec) + else if (d_nav.flag_TOW_6 == true) // page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec) { - //TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay - d_TOW_at_current_symbol = d_nav.TOW_6 + static_cast(GALILEO_INAV_PAGE_PART_SECONDS) + static_cast(required_symbols - 1) * GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND; + // TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay + d_TOW_at_current_symbol = d_nav.TOW_6 + static_cast(GALILEO_INAV_PAGE_PART_SECONDS) + static_cast(required_symbols + 1) * GALILEO_E1_CODE_PERIOD; d_nav.flag_TOW_6 = false; } else { - //this page has no timing information + // this page has no timing information d_TOW_at_current_symbol += GALILEO_E1_CODE_PERIOD; // + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD; } } - else //if there is not a new preamble, we define the TOW of the current symbol + else // if there is not a new preamble, we define the TOW of the current symbol { d_TOW_at_current_symbol += GALILEO_E1_CODE_PERIOD; } - //if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true) + // if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true) - if (d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) //all GGTO parameters arrived + if (d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) // all GGTO parameters arrived { delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64.0))); } @@ -456,8 +456,9 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute current_symbol.Flag_valid_word = false; } - current_symbol.TOW_at_current_symbol_s = floor(d_TOW_at_current_symbol * 1000.0) / 1000.0; - current_symbol.TOW_at_current_symbol_s -= delta_t; //Galileo to GPS TOW + current_symbol.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0); + // todo: Galileo to GPS time conversion should be moved to observable block. + // current_symbol.TOW_at_current_symbol_ms -= delta_t; //Galileo to GPS TOW if (d_dump == true) { @@ -484,8 +485,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute { d_symbol_history.pop_front(); } - //3. Make the output (copy the object contents to the GNURadio reserved memory) + // 3. Make the output (copy the object contents to the GNURadio reserved memory) *out[0] = current_symbol; - //std::cout<<"GPS L1 TLM output on CH="<d_channel << " SAMPLE STAMP="<(&output_items[0]); // Get the output buffer pointer const Gnss_Synchro **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer - Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block - //1. Copy the current tracking output + Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block + // 1. Copy the current tracking output current_symbol = in[0][0]; - d_symbol_history.push_back(current_symbol); //add new symbol to the symbol queue - d_sample_counter++; //count for the processed samples + d_symbol_history.push_back(current_symbol); // add new symbol to the symbol queue + d_sample_counter++; // count for the processed samples consume_each(1); d_flag_preamble = false; @@ -280,7 +280,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu if (d_symbol_history.size() > required_symbols) { - //******* preamble correlation ******** + // ******* preamble correlation ******** for (int i = 0; i < d_symbols_per_preamble; i++) { if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping @@ -294,8 +294,8 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu } } - //******* frame sync ****************** - if (d_stat == 0) //no preamble information + // ******* frame sync ****************** + if (d_stat == 0) // no preamble information { if (abs(corr_value) >= d_symbols_per_preamble) { @@ -311,15 +311,15 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu { if (abs(corr_value) >= d_symbols_per_preamble) { - //check preamble separation + // check preamble separation preamble_diff = d_sample_counter - d_preamble_index; // Record the PRN start sample index associated to the preamble d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; if (abs(preamble_diff - GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS) == 0) { - //try to decode frame + // try to decode frame LOG(INFO) << "Starting string decoder for GLONASS L1 C/A SAT " << this->d_satellite; - d_preamble_index = d_sample_counter; //record the preamble sample stamp + d_preamble_index = d_sample_counter; // record the preamble sample stamp d_stat = 2; } else @@ -342,7 +342,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu int string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble; double string_symbols[GLONASS_GNAV_DATA_SYMBOLS] = {0}; - //******* SYMBOL TO BIT ******* + // ******* SYMBOL TO BIT ******* for (int i = 0; i < string_length; i++) { if (corr_value > 0) @@ -355,13 +355,13 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu } } - //call the decoder + // call the decoder decode_string(string_symbols, string_length); if (d_nav.flag_CRC_test == true) { d_CRC_error_counter = 0; - d_flag_preamble = true; //valid preamble indicator (initialized to false every work()) - d_preamble_index = d_sample_counter; //record the preamble sample stamp (t_P) + d_flag_preamble = true; // valid preamble indicator (initialized to false every work()) + d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P) if (!d_flag_frame_sync) { d_flag_frame_sync = true; @@ -372,7 +372,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu else { d_CRC_error_counter++; - d_preamble_index = d_sample_counter; //record the preamble sample stamp + d_preamble_index = d_sample_counter; // record the preamble sample stamp if (d_CRC_error_counter > CRC_ERROR_LIMIT) { LOG(INFO) << "Lost of frame sync SAT " << this->d_satellite; @@ -384,21 +384,21 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu } // UPDATE GNSS SYNCHRO DATA - //2. Add the telemetry decoder information + // 2. Add the telemetry decoder information if (this->d_flag_preamble == true and d_nav.flag_TOW_new == true) - //update TOW at the preamble instant + // update TOW at the preamble instant { d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S) * 1000) / 1000; d_nav.flag_TOW_new = false; } - else //if there is not a new preamble, we define the TOW of the current symbol + else // if there is not a new preamble, we define the TOW of the current symbol { d_TOW_at_current_symbol = d_TOW_at_current_symbol + GLONASS_L1_CA_CODE_PERIOD; } - //if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true) + // if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true) - // if(d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) //all GGTO parameters arrived + // if(d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) // all GGTO parameters arrived // { // delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64))); // } @@ -413,8 +413,9 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu } current_symbol.PRN = this->d_satellite.get_PRN(); - current_symbol.TOW_at_current_symbol_s = d_TOW_at_current_symbol; - current_symbol.TOW_at_current_symbol_s -= delta_t; // Galileo to GPS TOW + current_symbol.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0); + // todo: glonass time to gps time should be done in observables block + // current_symbol.TOW_at_current_symbol_ms -= -= static_cast(delta_t) * 1000; // Galileo to GPS TOW if (d_dump == true) { @@ -441,7 +442,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu { d_symbol_history.pop_front(); } - //3. Make the output (copy the object contents to the GNURadio reserved memory) + // 3. Make the output (copy the object contents to the GNURadio reserved memory) *out[0] = current_symbol; return 1; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc index 0c8813694..bf4181fb9 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/glonass_l2_ca_telemetry_decoder_cc.cc @@ -61,7 +61,7 @@ glonass_l2_ca_telemetry_decoder_cc::glonass_l2_ca_telemetry_decoder_cc( d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN()); LOG(INFO) << "Initializing GLONASS L2 CA TELEMETRY DECODING"; // Define the number of sampes per symbol. Notice that GLONASS has 2 rates, - //one for the navigation data and the other for the preamble information + // one for the navigation data and the other for the preamble information d_samples_per_symbol = (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS) / GLONASS_L2_CA_SYMBOL_RATE_BPS; // Set the preamble information @@ -268,11 +268,11 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu Gnss_Synchro **out = reinterpret_cast(&output_items[0]); // Get the output buffer pointer const Gnss_Synchro **in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer - Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block - //1. Copy the current tracking output + Gnss_Synchro current_symbol; // structure to save the synchronization information and send the output object to the next block + // 1. Copy the current tracking output current_symbol = in[0][0]; - d_symbol_history.push_back(current_symbol); //add new symbol to the symbol queue - d_sample_counter++; //count for the processed samples + d_symbol_history.push_back(current_symbol); // add new symbol to the symbol queue + d_sample_counter++; // count for the processed samples consume_each(1); d_flag_preamble = false; @@ -280,7 +280,7 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu if (d_symbol_history.size() > required_symbols) { - //******* preamble correlation ******** + // ******* preamble correlation ******** for (int i = 0; i < d_symbols_per_preamble; i++) { if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping @@ -294,8 +294,8 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu } } - //******* frame sync ****************** - if (d_stat == 0) //no preamble information + // ******* frame sync ****************** + if (d_stat == 0) // no preamble information { if (abs(corr_value) >= d_symbols_per_preamble) { @@ -311,15 +311,15 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu { if (abs(corr_value) >= d_symbols_per_preamble) { - //check preamble separation + // check preamble separation preamble_diff = d_sample_counter - d_preamble_index; // Record the PRN start sample index associated to the preamble d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; if (abs(preamble_diff - GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS) == 0) { - //try to decode frame + // try to decode frame LOG(INFO) << "Starting string decoder for GLONASS L2 C/A SAT " << this->d_satellite; - d_preamble_index = d_sample_counter; //record the preamble sample stamp + d_preamble_index = d_sample_counter; // record the preamble sample stamp d_stat = 2; } else @@ -342,7 +342,7 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu int string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble; double string_symbols[GLONASS_GNAV_DATA_SYMBOLS] = {0}; - //******* SYMBOL TO BIT ******* + // ******* SYMBOL TO BIT ******* for (int i = 0; i < string_length; i++) { if (corr_value > 0) @@ -355,13 +355,13 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu } } - //call the decoder + // call the decoder decode_string(string_symbols, string_length); if (d_nav.flag_CRC_test == true) { d_CRC_error_counter = 0; - d_flag_preamble = true; //valid preamble indicator (initialized to false every work()) - d_preamble_index = d_sample_counter; //record the preamble sample stamp (t_P) + d_flag_preamble = true; // valid preamble indicator (initialized to false every work()) + d_preamble_index = d_sample_counter; // record the preamble sample stamp (t_P) if (!d_flag_frame_sync) { d_flag_frame_sync = true; @@ -372,7 +372,7 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu else { d_CRC_error_counter++; - d_preamble_index = d_sample_counter; //record the preamble sample stamp + d_preamble_index = d_sample_counter; // record the preamble sample stamp if (d_CRC_error_counter > CRC_ERROR_LIMIT) { LOG(INFO) << "Lost of frame sync SAT " << this->d_satellite; @@ -384,21 +384,21 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu } // UPDATE GNSS SYNCHRO DATA - //2. Add the telemetry decoder information + // 2. Add the telemetry decoder information if (this->d_flag_preamble == true and d_nav.flag_TOW_new == true) - //update TOW at the preamble instant + // update TOW at the preamble instant { d_TOW_at_current_symbol = floor((d_nav.gnav_ephemeris.d_TOW - GLONASS_GNAV_PREAMBLE_DURATION_S) * 1000) / 1000; d_nav.flag_TOW_new = false; } - else //if there is not a new preamble, we define the TOW of the current symbol + else // if there is not a new preamble, we define the TOW of the current symbol { d_TOW_at_current_symbol = d_TOW_at_current_symbol + GLONASS_L2_CA_CODE_PERIOD; } - //if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true) + // if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true) - // if(d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) //all GGTO parameters arrived + // if(d_nav.flag_GGTO_1 == true and d_nav.flag_GGTO_2 == true and d_nav.flag_GGTO_3 == true and d_nav.flag_GGTO_4 == true) // all GGTO parameters arrived // { // delta_t = d_nav.A_0G_10 + d_nav.A_1G_10 * (d_TOW_at_current_symbol - d_nav.t_0G_10 + 604800.0 * (fmod((d_nav.WN_0 - d_nav.WN_0G_10), 64))); // } @@ -413,8 +413,9 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu } current_symbol.PRN = this->d_satellite.get_PRN(); - current_symbol.TOW_at_current_symbol_s = d_TOW_at_current_symbol; - current_symbol.TOW_at_current_symbol_s -= delta_t; // Galileo to GPS TOW + current_symbol.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0); + // todo: glonass time to gps time should be done in observables block + // current_symbol.TOW_at_current_symbol_ms -= static_cast(delta_t) * 1000; if (d_dump == true) { @@ -441,7 +442,7 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu { d_symbol_history.pop_front(); } - //3. Make the output (copy the object contents to the GNURadio reserved memory) + // 3. Make the output (copy the object contents to the GNURadio reserved memory) *out[0] = current_symbol; return 1; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc index 1621eef58..78ff3aaa9 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.cc @@ -90,14 +90,11 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc( d_GPS_frame_4bytes = 0; d_prev_GPS_frame_4bytes = 0; d_flag_parity = false; - d_TOW_at_Preamble = 0.0; - d_TOW_at_current_symbol = 0.0; + d_TOW_at_Preamble_ms = 0; flag_TOW_set = false; - d_average_count = 0; d_flag_preamble = false; d_flag_new_tow_available = false; d_word_number = 0; - d_decimation_output_factor = 1; d_channel = 0; flag_PLL_180_deg_phase_locked = false; d_preamble_time_samples = 0; @@ -396,25 +393,17 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__ //2. Add the telemetry decoder information if (this->d_flag_preamble == true and d_flag_new_tow_available == true) { - //double decoder_latency_ms=(double)(current_symbol.Tracking_sample_counter-d_symbol_history.at(0).Tracking_sample_counter) - // /(double)current_symbol.fs; - // update TOW at the preamble instant (account with decoder latency) - - d_TOW_at_Preamble = d_GPS_FSM.d_nav.d_TOW + 2.0 * GPS_L1_CA_CODE_PERIOD + GPS_CA_PREAMBLE_DURATION_S; - d_TOW_at_current_symbol_ms = static_cast(d_GPS_FSM.d_nav.d_TOW) * 1000 + 161; - //d_TOW_at_current_symbol = floor(d_TOW_at_Preamble * 1000.0) / 1000.0; - d_TOW_at_current_symbol = d_TOW_at_Preamble; + d_TOW_at_current_symbol_ms = static_cast(d_GPS_FSM.d_nav.d_TOW) * 1000 + GPS_L1_CA_CODE_PERIOD_MS + GPS_CA_PREAMBLE_DURATION_MS; + d_TOW_at_Preamble_ms = d_TOW_at_current_symbol_ms; flag_TOW_set = true; d_flag_new_tow_available = false; } else { - d_TOW_at_current_symbol += GPS_L1_CA_CODE_PERIOD; d_TOW_at_current_symbol_ms += GPS_L1_CA_CODE_PERIOD_MS; } - current_symbol.TOW_at_current_symbol_s = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; - //current_symbol.TOW_at_current_symbol_s = d_TOW_at_current_symbol; + current_symbol.TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms; current_symbol.Flag_valid_word = flag_TOW_set; if (flag_PLL_180_deg_phase_locked == true) @@ -430,11 +419,11 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__ { double tmp_double; unsigned long int tmp_ulong_int; - tmp_double = d_TOW_at_current_symbol; + tmp_double = static_cast(d_TOW_at_current_symbol_ms) / 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); tmp_ulong_int = current_symbol.Tracking_sample_counter; d_dump_file.write(reinterpret_cast(&tmp_ulong_int), sizeof(unsigned long int)); - tmp_double = d_TOW_at_Preamble; + tmp_double = static_cast(d_TOW_at_Preamble_ms) * 1000.0; d_dump_file.write(reinterpret_cast(&tmp_double), sizeof(double)); } catch (const std::ifstream::failure &e) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h index 5a6c4c7db..52f1f1049 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l1_ca_telemetry_decoder_cc.h @@ -97,10 +97,6 @@ private: bool d_flag_new_tow_available; int d_word_number; - // output averaging and decimation - int d_average_count; - int d_decimation_output_factor; - // navigation message vars Gps_Navigation_Message d_nav; GpsL1CaSubframeFsm d_GPS_FSM; @@ -111,8 +107,7 @@ private: unsigned long int d_preamble_time_samples; - double d_TOW_at_Preamble; - double d_TOW_at_current_symbol; + unsigned int d_TOW_at_Preamble_ms; unsigned int d_TOW_at_current_symbol_ms; bool flag_TOW_set; diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc index 5c4e34184..5cc385207 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l2c_telemetry_decoder_cc.cc @@ -201,7 +201,7 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__(( d_flag_valid_word = false; } } - current_synchro_data.TOW_at_current_symbol_s = d_TOW_at_current_symbol; + current_synchro_data.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0); current_synchro_data.Flag_valid_word = d_flag_valid_word; if (d_dump == true) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc index 56ba9267f..87412096e 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/gps_l5_telemetry_decoder_cc.cc @@ -253,7 +253,7 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u d_flag_valid_word = false; } } - current_synchro_data.TOW_at_current_symbol_s = d_TOW_at_current_symbol; + current_synchro_data.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0); current_synchro_data.Flag_valid_word = d_flag_valid_word; if (d_dump == true) 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 377b913e3..48e821674 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 @@ -34,6 +34,7 @@ * ------------------------------------------------------------------------- */ +#include "dll_pll_conf.h" #include "galileo_e1_dll_pll_veml_tracking.h" #include "configuration_interface.h" #include "Galileo_E1.h" @@ -48,7 +49,7 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - dllpllconf_t trk_param; + Dll_Pll_Conf trk_param = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## std::string default_item_type = "gr_complex"; @@ -129,6 +130,14 @@ GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc index 6a9d4000f..51e526173 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc @@ -52,7 +52,6 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( //################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; - int f_if; bool dump; std::string dump_filename; std::string item_type; @@ -65,7 +64,6 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( item_type = configuration->property(role + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); @@ -83,7 +81,6 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( { item_size_ = sizeof(gr_complex); tracking_ = galileo_e1_tcp_connector_make_tracking_cc( - f_if, fs_in, vector_length, dump, @@ -101,6 +98,14 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } 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 1ee9ede0a..fe6f4a7d6 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -35,7 +35,7 @@ * * ------------------------------------------------------------------------- */ - +#include "dll_pll_conf.h" #include "galileo_e5a_dll_pll_tracking.h" #include "configuration_interface.h" #include "Galileo_E5a.h" @@ -49,7 +49,7 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - dllpllconf_t trk_param; + Dll_Pll_Conf trk_param = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## std::string default_item_type = "gr_complex"; @@ -127,6 +127,14 @@ GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index 789cc6695..16e212a9c 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -54,7 +54,6 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( //################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; - int f_if; bool dump; std::string dump_filename; std::string default_item_type = "gr_complex"; @@ -67,7 +66,6 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( //vector_length = configuration->property(role + ".vector_length", 2048); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); @@ -88,7 +86,6 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( { item_size_ = sizeof(gr_complex); tracking_cc = glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( - f_if, fs_in, vector_length, dump, @@ -105,7 +102,6 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( { item_size_ = sizeof(lv_16sc_t); tracking_sc = glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( - f_if, fs_in, vector_length, dump, @@ -124,6 +120,14 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( LOG(WARNING) << item_type_ << " unknown tracking item type."; } channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc index 7ab511b0c..c616595d5 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc @@ -53,7 +53,6 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( //################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; - int f_if; bool dump; std::string dump_filename; std::string item_type; @@ -64,7 +63,6 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( item_type = configuration->property(role + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); @@ -80,7 +78,6 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( { item_size_ = sizeof(gr_complex); tracking_ = glonass_l1_ca_dll_pll_make_tracking_cc( - f_if, fs_in, vector_length, dump, @@ -96,6 +93,14 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index 0219ca05d..be2bb41d3 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -52,7 +52,6 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( //################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; - int f_if; bool dump; std::string dump_filename; std::string default_item_type = "gr_complex"; @@ -65,7 +64,6 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( //vector_length = configuration->property(role + ".vector_length", 2048); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); @@ -86,7 +84,6 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( { item_size_ = sizeof(gr_complex); tracking_cc = glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( - f_if, fs_in, vector_length, dump, @@ -103,7 +100,6 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( { item_size_ = sizeof(lv_16sc_t); tracking_sc = glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( - f_if, fs_in, vector_length, dump, @@ -122,6 +118,14 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( LOG(WARNING) << item_type_ << " unknown tracking item type."; } channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc index 814bb19d6..6d9a9f1ea 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc @@ -51,7 +51,6 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( //################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; - int f_if; bool dump; std::string dump_filename; std::string item_type; @@ -62,7 +61,6 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( item_type = configuration->property(role + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); @@ -78,7 +76,6 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( { item_size_ = sizeof(gr_complex); tracking_ = glonass_l2_ca_dll_pll_make_tracking_cc( - f_if, fs_in, vector_length, dump, @@ -94,6 +91,14 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc index 2d429329e..9ce706ef3 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_c_aid_tracking.cc @@ -53,7 +53,6 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( //################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; - int f_if; bool dump; std::string dump_filename; std::string default_item_type = "gr_complex"; @@ -66,7 +65,6 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( //vector_length = configuration->property(role + ".vector_length", 2048); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); @@ -87,7 +85,6 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( { item_size_ = sizeof(gr_complex); tracking_cc = gps_l1_ca_dll_pll_c_aid_make_tracking_cc( - f_if, fs_in, vector_length, dump, @@ -104,7 +101,6 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( { item_size_ = sizeof(lv_16sc_t); tracking_sc = gps_l1_ca_dll_pll_c_aid_make_tracking_sc( - f_if, fs_in, vector_length, dump, @@ -123,6 +119,14 @@ GpsL1CaDllPllCAidTracking::GpsL1CaDllPllCAidTracking( LOG(WARNING) << item_type_ << " unknown tracking item type."; } channel_ = 0; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } 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 3c0cade84..ffa6e1000 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 @@ -35,7 +35,7 @@ * ------------------------------------------------------------------------- */ - +#include "dll_pll_conf.h" #include "gps_l1_ca_dll_pll_tracking.h" #include "configuration_interface.h" #include "GPS_L1_CA.h" @@ -49,7 +49,7 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - dllpllconf_t trk_param; + Dll_Pll_Conf trk_param = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## std::string default_item_type = "gr_complex"; @@ -108,13 +108,13 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( int cn0_samples = configuration->property(role + ".cn0_samples", 20); if (FLAGS_cn0_samples != 20) cn0_samples = FLAGS_cn0_samples; trk_param.cn0_samples = cn0_samples; - int cn0_min = configuration->property(role + ".cn0_min", 25); + int cn0_min = configuration->property(role + ".cn0_min", 30); if (FLAGS_cn0_min != 25) cn0_min = FLAGS_cn0_min; trk_param.cn0_min = cn0_min; int max_lock_fail = configuration->property(role + ".max_lock_fail", 50); if (FLAGS_max_lock_fail != 50) max_lock_fail = FLAGS_max_lock_fail; trk_param.max_lock_fail = max_lock_fail; - double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.85); + double carrier_lock_th = configuration->property(role + ".carrier_lock_th", 0.80); if (FLAGS_carrier_lock_th != 0.85) carrier_lock_th = FLAGS_carrier_lock_th; trk_param.carrier_lock_th = carrier_lock_th; @@ -131,6 +131,14 @@ GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index d7becc755..f9d3aa587 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -141,6 +141,14 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); channel_ = 0; DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc index b2a9e84ec..0cccd8e26 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc @@ -52,7 +52,6 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( //################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; - int f_if; bool dump; std::string dump_filename; std::string item_type; @@ -64,7 +63,6 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( //vector_length = configuration->property(role + ".vector_length", 2048); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); @@ -80,7 +78,6 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( { item_size_ = sizeof(gr_complex); tracking_ = gps_l1_ca_dll_pll_make_tracking_gpu_cc( - f_if, fs_in, vector_length, dump, @@ -96,6 +93,14 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index c7cd025a4..d0303867c 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -51,7 +51,6 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( //################# CONFIGURATION PARAMETERS ######################## int fs_in; int vector_length; - int f_if; bool dump; std::string dump_filename; std::string item_type; @@ -62,7 +61,6 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( //vector_length = configuration->property(role + ".vector_length", 2048); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - f_if = configuration->property(role + ".if", 0); dump = configuration->property(role + ".dump", false); early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); port_ch0 = configuration->property(role + ".port_ch0", 2060); @@ -75,7 +73,6 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( { item_size_ = sizeof(gr_complex); tracking_ = gps_l1_ca_tcp_connector_make_tracking_cc( - f_if, fs_in, vector_length, dump, @@ -91,6 +88,14 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } 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 2de8eb7cf..499427dfa 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 @@ -34,7 +34,7 @@ * ------------------------------------------------------------------------- */ - +#include "dll_pll_conf.h" #include "gps_l2_m_dll_pll_tracking.h" #include "configuration_interface.h" #include "GPS_L2C.h" @@ -49,7 +49,7 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - dllpllconf_t trk_param; + Dll_Pll_Conf trk_param = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## std::string default_item_type = "gr_complex"; @@ -118,6 +118,14 @@ GpsL2MDllPllTracking::GpsL2MDllPllTracking( } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } 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 e3aa382d8..8fbd56531 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -34,7 +34,7 @@ * ------------------------------------------------------------------------- */ - +#include "dll_pll_conf.h" #include "gps_l5_dll_pll_tracking.h" #include "configuration_interface.h" #include "GPS_L5.h" @@ -49,7 +49,7 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( ConfigurationInterface* configuration, std::string role, unsigned int in_streams, unsigned int out_streams) : role_(role), in_streams_(in_streams), out_streams_(out_streams) { - dllpllconf_t trk_param; + Dll_Pll_Conf trk_param = Dll_Pll_Conf(); DLOG(INFO) << "role " << role; //################# CONFIGURATION PARAMETERS ######################## std::string default_item_type = "gr_complex"; @@ -127,6 +127,14 @@ GpsL5DllPllTracking::GpsL5DllPllTracking( } channel_ = 0; DLOG(INFO) << "tracking(" << tracking_->unique_id() << ")"; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } } diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc index f18c0fc90..bd822c74c 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -60,7 +60,7 @@ using google::LogMessage; -dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(dllpllconf_t conf_) +dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_) { return dll_pll_veml_tracking_sptr(new dll_pll_veml_tracking(conf_)); } @@ -76,8 +76,8 @@ void dll_pll_veml_tracking::forecast(int noutput_items, } -dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dll_pll_veml_tracking", gr::io_signature::make(1, 1, sizeof(gr_complex)), - gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) +dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_) : gr::block("dll_pll_veml_tracking", gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) { trk_parameters = conf_; // Telemetry bit synchronization message port input @@ -281,7 +281,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl d_correlator_outs = static_cast(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_local_code_shift_chips = static_cast(volk_gnsssdr_malloc(d_n_correlator_taps * sizeof(float), volk_gnsssdr_get_alignment())); - std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0)); + // map memory pointers of correlator outputs if (d_veml) @@ -328,17 +328,14 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl { // Extra correlator for the data component correlator_data_cpu.init(2 * trk_parameters.vector_length, 1); - d_Prompt_Data = static_cast(volk_gnsssdr_malloc(sizeof(gr_complex), volk_gnsssdr_get_alignment())); - d_Prompt_Data[0] = gr_complex(0.0, 0.0); d_data_code = static_cast(volk_gnsssdr_malloc(2 * d_code_length_chips * sizeof(float), volk_gnsssdr_get_alignment())); } else { - d_Prompt_Data = nullptr; d_data_code = nullptr; } - //--- Initializations ---// + // --- Initializations --- // Initial code frequency basis of NCO d_code_freq_chips = d_code_chip_rate; // Residual code phase (in chips) @@ -359,8 +356,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl d_CN0_SNV_dB_Hz = 0.0; d_carrier_lock_fail_counter = 0; d_carrier_lock_threshold = trk_parameters.carrier_lock_th; - - clear_tracking_vars(); + d_Prompt_Data = static_cast(volk_gnsssdr_malloc(sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_acquisition_gnss_synchro = nullptr; d_channel = 0; @@ -377,15 +373,15 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl d_code_phase_samples = 0.0; d_last_prompt = gr_complex(0.0, 0.0); d_state = 0; // initial state: standby + clear_tracking_vars(); } void dll_pll_veml_tracking::start_tracking() { gr::thread::scoped_lock l(d_setlock); - /* - * correct the code phase according to the delay between acq and trk - */ + + // correct the code phase according to the delay between acq and trk d_acq_code_phase_samples = d_acquisition_gnss_synchro->Acq_delay_samples; d_acq_carrier_doppler_hz = d_acquisition_gnss_synchro->Acq_doppler_hz; d_acq_sample_stamp = d_acquisition_gnss_synchro->Acq_samplestamp_samples; @@ -396,7 +392,7 @@ void dll_pll_veml_tracking::start_tracking() DLOG(INFO) << "Number of seconds between Acquisition and Tracking = " << acq_trk_diff_seconds; // Doppler effect Fd = (C / (C + Vr)) * F double radial_velocity = (d_signal_carrier_freq + d_acq_carrier_doppler_hz) / d_signal_carrier_freq; - // new chip and prn sequence periods based on acq Doppler + // new chip and PRN sequence periods based on acq Doppler d_code_freq_chips = radial_velocity * d_code_chip_rate; d_code_phase_step_chips = d_code_freq_chips / trk_parameters.fs_in; double T_chip_mod_seconds = 1.0 / d_code_freq_chips; @@ -564,9 +560,9 @@ dll_pll_veml_tracking::~dll_pll_veml_tracking() volk_gnsssdr_free(d_local_code_shift_chips); volk_gnsssdr_free(d_correlator_outs); volk_gnsssdr_free(d_tracking_code); + volk_gnsssdr_free(d_Prompt_Data); if (trk_parameters.track_pilot) { - volk_gnsssdr_free(d_Prompt_Data); volk_gnsssdr_free(d_data_code); correlator_data_cpu.free(); } @@ -610,7 +606,7 @@ bool dll_pll_veml_tracking::acquire_secondary() } } - if (abs(corr_value) == d_secondary_code_length) + if (abs(corr_value) == static_cast(d_secondary_code_length)) { return true; } @@ -735,7 +731,7 @@ void dll_pll_veml_tracking::run_dll_pll() void dll_pll_veml_tracking::clear_tracking_vars() { std::fill_n(d_correlator_outs, d_n_correlator_taps, gr_complex(0.0, 0.0)); - if (trk_parameters.track_pilot) *d_Prompt_Data = gr_complex(0.0, 0.0); + if (trk_parameters.track_pilot) d_Prompt_Data[0] = gr_complex(0.0, 0.0); d_carr_error_hz = 0.0; d_carr_error_filt_hz = 0.0; d_code_error_chips = 0.0; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h index 9444c6ccb..0437e8a35 100755 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.h @@ -31,6 +31,7 @@ #ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_H #define GNSS_SDR_DLL_PLL_VEML_TRACKING_H +#include "dll_pll_conf.h" #include "gnss_synchro.h" #include "tracking_2nd_DLL_filter.h" #include "tracking_2nd_PLL_filter.h" @@ -39,37 +40,13 @@ #include #include #include - -typedef struct -{ - /* DLL/PLL tracking configuration */ - double fs_in; - unsigned int vector_length; - bool dump; - std::string dump_filename; - float pll_bw_hz; - float dll_bw_hz; - float pll_bw_narrow_hz; - float dll_bw_narrow_hz; - float early_late_space_chips; - float very_early_late_space_chips; - float early_late_space_narrow_chips; - float very_early_late_space_narrow_chips; - int extend_correlation_symbols; - int cn0_samples; - int cn0_min; - int max_lock_fail; - double carrier_lock_th; - bool track_pilot; - char system; - char signal[3]; -} dllpllconf_t; +#include class dll_pll_veml_tracking; typedef boost::shared_ptr dll_pll_veml_tracking_sptr; -dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(dllpllconf_t conf_); +dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_); /*! * \brief This class implements a code DLL + carrier PLL tracking block. @@ -89,9 +66,9 @@ public: void forecast(int noutput_items, gr_vector_int &ninput_items_required); private: - friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(dllpllconf_t conf_); + friend dll_pll_veml_tracking_sptr dll_pll_veml_make_tracking(const Dll_Pll_Conf &conf_); - dll_pll_veml_tracking(dllpllconf_t conf_); + dll_pll_veml_tracking(const Dll_Pll_Conf &conf_); bool cn0_and_tracking_lock_status(double coh_integration_time_s); bool acquire_secondary(); @@ -104,7 +81,7 @@ private: int save_matfile(); // tracking configuration vars - dllpllconf_t trk_parameters; + Dll_Pll_Conf trk_parameters; bool d_veml; bool d_cloop; unsigned int d_channel; @@ -201,6 +178,7 @@ private: // CN0 estimation and lock detector int d_cn0_estimation_counter; int d_carrier_lock_fail_counter; + std::deque d_carrier_lock_detector_queue; double d_carrier_lock_test; double d_CN0_SNV_dB_Hz; double d_carrier_lock_threshold; diff --git a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc index 2b74c274c..6dd2af0f7 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc @@ -433,7 +433,6 @@ void dll_pll_veml_tracking_fpga::start_tracking() { if (trk_parameters.track_pilot) { - char pilot_signal[3] = "1C"; d_Prompt_Data[0] = gr_complex(0.0, 0.0); } else @@ -581,7 +580,7 @@ bool dll_pll_veml_tracking_fpga::acquire_secondary() } } - if (abs(corr_value) == d_secondary_code_length) + if (abs(corr_value) == static_cast(d_secondary_code_length)) { return true; } @@ -1146,7 +1145,7 @@ void dll_pll_veml_tracking_fpga::reset(void) int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), - gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) + gr_vector_const_void_star &input_items __attribute__((unused)), gr_vector_void_star &output_items) { // Block input data and block output stream pointers Gnss_Synchro **out = reinterpret_cast(&output_items[0]); diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc index 384e40765..acb0021c0 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.cc @@ -60,7 +60,6 @@ using google::LogMessage; galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -71,7 +70,7 @@ galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking float very_early_late_space_chips, size_t port_ch0) { - return galileo_e1_tcp_connector_tracking_cc_sptr(new Galileo_E1_Tcp_Connector_Tracking_cc(if_freq, + return galileo_e1_tcp_connector_tracking_cc_sptr(new Galileo_E1_Tcp_Connector_Tracking_cc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips, very_early_late_space_chips, port_ch0)); } @@ -87,7 +86,6 @@ void Galileo_E1_Tcp_Connector_Tracking_cc::forecast(int noutput_items, Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -103,7 +101,6 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( this->set_relative_rate(1.0 / vector_length); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h index 6a7e3c728..1e92e711a 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_tcp_connector_tracking_cc.h @@ -54,7 +54,7 @@ class Galileo_E1_Tcp_Connector_Tracking_cc; typedef boost::shared_ptr galileo_e1_tcp_connector_tracking_cc_sptr; galileo_e1_tcp_connector_tracking_cc_sptr -galileo_e1_tcp_connector_make_tracking_cc(long if_freq, +galileo_e1_tcp_connector_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -84,7 +84,7 @@ public: private: friend galileo_e1_tcp_connector_tracking_cc_sptr - galileo_e1_tcp_connector_make_tracking_cc(long if_freq, + galileo_e1_tcp_connector_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -94,7 +94,7 @@ private: float very_early_late_space_chips, size_t port_ch0); - Galileo_E1_Tcp_Connector_Tracking_cc(long if_freq, + Galileo_E1_Tcp_Connector_Tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -115,7 +115,6 @@ private: Gnss_Synchro *d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; int d_correlation_length_samples; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index f822ae6af..7e71810f9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -62,7 +62,6 @@ using google::LogMessage; glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -74,7 +73,7 @@ glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( int extend_correlation_ms, float early_late_space_chips) { - return glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_cc(if_freq, + return glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_cc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -103,7 +102,6 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -125,7 +123,6 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc this->message_port_register_out(pmt::mp("events")); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; @@ -262,10 +259,10 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_acq_code_phase_samples = corrected_acq_phase_samples; - // d_carrier_doppler_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); + // d_carrier_doppler_hz = d_acq_carrier_doppler_hz + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); // d_carrier_doppler_hz = d_acq_carrier_doppler_hz; // d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); - d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * static_cast(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN))); + d_carrier_frequency_hz = d_acq_carrier_doppler_hz + (DFRQ1_GLO * static_cast(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN))); d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h index e1ef7cacf..9c692d726 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.h @@ -57,7 +57,7 @@ typedef boost::shared_ptr glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr; glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr -glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(long if_freq, +glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -88,7 +88,7 @@ public: private: friend glonass_l1_ca_dll_pll_c_aid_tracking_cc_sptr - glonass_l1_ca_dll_pll_c_aid_make_tracking_cc(long if_freq, + glonass_l1_ca_dll_pll_c_aid_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -99,7 +99,7 @@ private: int extend_correlation_ms, float early_late_space_chips); - glonass_l1_ca_dll_pll_c_aid_tracking_cc(long if_freq, + glonass_l1_ca_dll_pll_c_aid_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -117,7 +117,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; double d_glonass_freq_ch; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 8b66a3605..c00de2486 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -61,7 +61,6 @@ using google::LogMessage; glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -73,7 +72,7 @@ glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( int extend_correlation_ms, float early_late_space_chips) { - return glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_sc(if_freq, + return glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l1_ca_dll_pll_c_aid_tracking_sc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -101,7 +100,6 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm } glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -121,7 +119,6 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc this->message_port_register_out(pmt::mp("events")); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; @@ -259,7 +256,7 @@ void glonass_l1_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_acq_code_phase_samples = corrected_acq_phase_samples; - d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * static_cast(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN))); + d_carrier_frequency_hz = d_acq_carrier_doppler_hz + (DFRQ1_GLO * static_cast(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN))); ; d_carrier_doppler_hz = d_acq_carrier_doppler_hz; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h index f585cb3e1..d91066ab5 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.h @@ -58,7 +58,7 @@ typedef boost::shared_ptr glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr; glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr -glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(long if_freq, +glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -89,7 +89,7 @@ public: private: friend glonass_l1_ca_dll_pll_c_aid_tracking_sc_sptr - glonass_l1_ca_dll_pll_c_aid_make_tracking_sc(long if_freq, + glonass_l1_ca_dll_pll_c_aid_make_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -100,7 +100,7 @@ private: int extend_correlation_ms, float early_late_space_chips); - glonass_l1_ca_dll_pll_c_aid_tracking_sc(long if_freq, + glonass_l1_ca_dll_pll_c_aid_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -118,7 +118,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; long d_glonass_freq_ch; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 1bad82419..2d25c448e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -59,7 +59,6 @@ using google::LogMessage; glonass_l1_ca_dll_pll_tracking_cc_sptr glonass_l1_ca_dll_pll_make_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -68,7 +67,7 @@ glonass_l1_ca_dll_pll_make_tracking_cc( float dll_bw_hz, float early_late_space_chips) { - return glonass_l1_ca_dll_pll_tracking_cc_sptr(new Glonass_L1_Ca_Dll_Pll_Tracking_cc(if_freq, + return glonass_l1_ca_dll_pll_tracking_cc_sptr(new Glonass_L1_Ca_Dll_Pll_Tracking_cc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips)); } @@ -84,7 +83,6 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::forecast(int noutput_items, Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -98,7 +96,6 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; @@ -220,7 +217,7 @@ void Glonass_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() d_acq_code_phase_samples = corrected_acq_phase_samples; - d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); + d_carrier_frequency_hz = d_acq_carrier_doppler_hz + (DFRQ1_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); d_carrier_doppler_phase_step_rad = GLONASS_TWO_PI * (d_carrier_doppler_hz) / static_cast(d_fs_in); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h index 7a81c64a5..26adc852a 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.h @@ -54,7 +54,7 @@ typedef boost::shared_ptr glonass_l1_ca_dll_pll_tracking_cc_sptr; glonass_l1_ca_dll_pll_tracking_cc_sptr -glonass_l1_ca_dll_pll_make_tracking_cc(long if_freq, +glonass_l1_ca_dll_pll_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -82,7 +82,7 @@ public: private: friend glonass_l1_ca_dll_pll_tracking_cc_sptr - glonass_l1_ca_dll_pll_make_tracking_cc(long if_freq, + glonass_l1_ca_dll_pll_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -90,7 +90,7 @@ private: float dll_bw_hz, float early_late_space_chips); - Glonass_L1_Ca_Dll_Pll_Tracking_cc(long if_freq, + Glonass_L1_Ca_Dll_Pll_Tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -105,7 +105,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; long d_glonass_freq_ch; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index e6c9414b8..370366ed4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -59,7 +59,6 @@ using google::LogMessage; glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -71,7 +70,7 @@ glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( int extend_correlation_ms, float early_late_space_chips) { - return glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_cc(if_freq, + return glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_cc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -100,7 +99,6 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pm glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -122,7 +120,6 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc this->message_port_register_out(pmt::mp("events")); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; @@ -259,10 +256,10 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_cc::start_tracking() d_acq_code_phase_samples = corrected_acq_phase_samples; - // d_carrier_doppler_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ2_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); + // d_carrier_doppler_hz = d_acq_carrier_doppler_hz + (DFRQ2_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); // d_carrier_doppler_hz = d_acq_carrier_doppler_hz; // d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_doppler_hz / static_cast(d_fs_in); - d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ2_GLO * static_cast(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN))); + d_carrier_frequency_hz = d_acq_carrier_doppler_hz + (DFRQ2_GLO * static_cast(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN))); d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h index 0d29e0ffc..c5cf8403f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.h @@ -55,7 +55,7 @@ typedef boost::shared_ptr glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr; glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr -glonass_l2_ca_dll_pll_c_aid_make_tracking_cc(long if_freq, +glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -86,7 +86,7 @@ public: private: friend glonass_l2_ca_dll_pll_c_aid_tracking_cc_sptr - glonass_l2_ca_dll_pll_c_aid_make_tracking_cc(long if_freq, + glonass_l2_ca_dll_pll_c_aid_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -97,7 +97,7 @@ private: int extend_correlation_ms, float early_late_space_chips); - glonass_l2_ca_dll_pll_c_aid_tracking_cc(long if_freq, + glonass_l2_ca_dll_pll_c_aid_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -115,7 +115,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; double d_glonass_freq_ch; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index c809a1038..dd3032eac 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -59,7 +59,6 @@ using google::LogMessage; glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -71,7 +70,7 @@ glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( int extend_correlation_ms, float early_late_space_chips) { - return glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_sc(if_freq, + return glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr(new glonass_l2_ca_dll_pll_c_aid_tracking_sc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -99,7 +98,6 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pm } glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -119,7 +117,6 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc this->message_port_register_out(pmt::mp("events")); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; @@ -257,7 +254,7 @@ void glonass_l2_ca_dll_pll_c_aid_tracking_sc::start_tracking() d_acq_code_phase_samples = corrected_acq_phase_samples; - d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ2_GLO * static_cast(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN))); + d_carrier_frequency_hz = d_acq_carrier_doppler_hz + (DFRQ2_GLO * static_cast(GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN))); ; d_carrier_doppler_hz = d_acq_carrier_doppler_hz; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h index 17f875cf4..f986ccd4c 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.h @@ -56,7 +56,7 @@ typedef boost::shared_ptr glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr; glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr -glonass_l2_ca_dll_pll_c_aid_make_tracking_sc(long if_freq, +glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -87,7 +87,7 @@ public: private: friend glonass_l2_ca_dll_pll_c_aid_tracking_sc_sptr - glonass_l2_ca_dll_pll_c_aid_make_tracking_sc(long if_freq, + glonass_l2_ca_dll_pll_c_aid_make_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -98,7 +98,7 @@ private: int extend_correlation_ms, float early_late_space_chips); - glonass_l2_ca_dll_pll_c_aid_tracking_sc(long if_freq, + glonass_l2_ca_dll_pll_c_aid_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -116,7 +116,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; long d_glonass_freq_ch; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index 4fb82650d..bb6adb024 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -59,7 +59,6 @@ using google::LogMessage; glonass_l2_ca_dll_pll_tracking_cc_sptr glonass_l2_ca_dll_pll_make_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -68,7 +67,7 @@ glonass_l2_ca_dll_pll_make_tracking_cc( float dll_bw_hz, float early_late_space_chips) { - return glonass_l2_ca_dll_pll_tracking_cc_sptr(new Glonass_L2_Ca_Dll_Pll_Tracking_cc(if_freq, + return glonass_l2_ca_dll_pll_tracking_cc_sptr(new Glonass_L2_Ca_Dll_Pll_Tracking_cc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips)); } @@ -84,7 +83,6 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::forecast(int noutput_items, Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -98,7 +96,6 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; @@ -220,7 +217,7 @@ void Glonass_L2_Ca_Dll_Pll_Tracking_cc::start_tracking() d_acq_code_phase_samples = corrected_acq_phase_samples; - d_carrier_frequency_hz = d_acq_carrier_doppler_hz + d_if_freq + (DFRQ2_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); + d_carrier_frequency_hz = d_acq_carrier_doppler_hz + (DFRQ2_GLO * GLONASS_PRN.at(d_acquisition_gnss_synchro->PRN)); d_carrier_doppler_hz = d_acq_carrier_doppler_hz; d_carrier_phase_step_rad = GLONASS_TWO_PI * d_carrier_frequency_hz / static_cast(d_fs_in); d_carrier_doppler_phase_step_rad = GLONASS_TWO_PI * (d_carrier_doppler_hz) / static_cast(d_fs_in); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h index cac8625d5..63598dfd0 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.h @@ -52,7 +52,7 @@ typedef boost::shared_ptr glonass_l2_ca_dll_pll_tracking_cc_sptr; glonass_l2_ca_dll_pll_tracking_cc_sptr -glonass_l2_ca_dll_pll_make_tracking_cc(long if_freq, +glonass_l2_ca_dll_pll_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -80,7 +80,7 @@ public: private: friend glonass_l2_ca_dll_pll_tracking_cc_sptr - glonass_l2_ca_dll_pll_make_tracking_cc(long if_freq, + glonass_l2_ca_dll_pll_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -88,7 +88,7 @@ private: float dll_bw_hz, float early_late_space_chips); - Glonass_L2_Ca_Dll_Pll_Tracking_cc(long if_freq, + Glonass_L2_Ca_Dll_Pll_Tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -103,7 +103,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; long d_glonass_freq_ch; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc index f38ea3ccf..7407c792e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -51,7 +51,6 @@ using google::LogMessage; gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -63,7 +62,7 @@ gps_l1_ca_dll_pll_c_aid_make_tracking_cc( int extend_correlation_ms, float early_late_space_chips) { - return gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_cc(if_freq, + return gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_cc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -92,7 +91,6 @@ void gps_l1_ca_dll_pll_c_aid_tracking_cc::msg_handler_preamble_index(pmt::pmt_t gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -114,7 +112,6 @@ gps_l1_ca_dll_pll_c_aid_tracking_cc::gps_l1_ca_dll_pll_c_aid_tracking_cc( this->message_port_register_out(pmt::mp("events")); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h index 40b7c60c8..1b6d9e12e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_cc.h @@ -55,7 +55,7 @@ typedef boost::shared_ptr gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr; gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr -gps_l1_ca_dll_pll_c_aid_make_tracking_cc(long if_freq, +gps_l1_ca_dll_pll_c_aid_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -86,7 +86,7 @@ public: private: friend gps_l1_ca_dll_pll_c_aid_tracking_cc_sptr - gps_l1_ca_dll_pll_c_aid_make_tracking_cc(long if_freq, + gps_l1_ca_dll_pll_c_aid_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -97,7 +97,7 @@ private: int extend_correlation_ms, float early_late_space_chips); - gps_l1_ca_dll_pll_c_aid_tracking_cc(long if_freq, + gps_l1_ca_dll_pll_c_aid_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -114,7 +114,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; double d_early_late_spc_chips; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc index 8c942aaeb..644616b28 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -52,7 +52,6 @@ using google::LogMessage; gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr gps_l1_ca_dll_pll_c_aid_make_tracking_sc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -64,7 +63,7 @@ gps_l1_ca_dll_pll_c_aid_make_tracking_sc( int extend_correlation_ms, float early_late_space_chips) { - return gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_sc(if_freq, + return gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr(new gps_l1_ca_dll_pll_c_aid_tracking_sc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, pll_bw_narrow_hz, dll_bw_narrow_hz, extend_correlation_ms, early_late_space_chips)); } @@ -92,7 +91,6 @@ void gps_l1_ca_dll_pll_c_aid_tracking_sc::msg_handler_preamble_index(pmt::pmt_t } gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -112,7 +110,6 @@ gps_l1_ca_dll_pll_c_aid_tracking_sc::gps_l1_ca_dll_pll_c_aid_tracking_sc( this->message_port_register_out(pmt::mp("events")); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h index 3ae42edab..5da13feb4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_c_aid_tracking_sc.h @@ -56,7 +56,7 @@ typedef boost::shared_ptr gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr; gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr -gps_l1_ca_dll_pll_c_aid_make_tracking_sc(long if_freq, +gps_l1_ca_dll_pll_c_aid_make_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -87,7 +87,7 @@ public: private: friend gps_l1_ca_dll_pll_c_aid_tracking_sc_sptr - gps_l1_ca_dll_pll_c_aid_make_tracking_sc(long if_freq, + gps_l1_ca_dll_pll_c_aid_make_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -98,7 +98,7 @@ private: int extend_correlation_ms, float early_late_space_chips); - gps_l1_ca_dll_pll_c_aid_tracking_sc(long if_freq, + gps_l1_ca_dll_pll_c_aid_tracking_sc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -116,7 +116,6 @@ private: Gnss_Synchro* d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; double d_early_late_spc_chips; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index dc9d69948..77ac57a0e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -49,7 +49,6 @@ using google::LogMessage; gps_l1_ca_dll_pll_tracking_gpu_cc_sptr gps_l1_ca_dll_pll_make_tracking_gpu_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -58,7 +57,7 @@ gps_l1_ca_dll_pll_make_tracking_gpu_cc( float dll_bw_hz, float early_late_space_chips) { - return gps_l1_ca_dll_pll_tracking_gpu_cc_sptr(new Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(if_freq, + return gps_l1_ca_dll_pll_tracking_gpu_cc_sptr(new Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips)); } @@ -74,7 +73,6 @@ void Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::forecast(int noutput_items, Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -89,7 +87,6 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( this->message_port_register_out(pmt::mp("events")); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h index 96ecc6c58..85c07a1b4 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.h @@ -52,7 +52,7 @@ typedef boost::shared_ptr gps_l1_ca_dll_pll_tracking_gpu_cc_sptr; gps_l1_ca_dll_pll_tracking_gpu_cc_sptr -gps_l1_ca_dll_pll_make_tracking_gpu_cc(long if_freq, +gps_l1_ca_dll_pll_make_tracking_gpu_cc( long fs_in, unsigned int vector_length, bool dump, @@ -81,7 +81,7 @@ public: private: friend gps_l1_ca_dll_pll_tracking_gpu_cc_sptr - gps_l1_ca_dll_pll_make_tracking_gpu_cc(long if_freq, + gps_l1_ca_dll_pll_make_tracking_gpu_cc( long fs_in, unsigned int vector_length, bool dump, @@ -90,7 +90,7 @@ private: float dll_bw_hz, float early_late_space_chips); - Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(long if_freq, + Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( long fs_in, unsigned int vector_length, bool dump, diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index 41697da8d..c99990cfc 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -58,7 +58,6 @@ using google::LogMessage; gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -66,7 +65,7 @@ gps_l1_ca_tcp_connector_make_tracking_cc( float early_late_space_chips, size_t port_ch0) { - return gps_l1_ca_tcp_connector_tracking_cc_sptr(new Gps_L1_Ca_Tcp_Connector_Tracking_cc(if_freq, + return gps_l1_ca_tcp_connector_tracking_cc_sptr(new Gps_L1_Ca_Tcp_Connector_Tracking_cc( fs_in, vector_length, dump, dump_filename, early_late_space_chips, port_ch0)); } @@ -82,7 +81,6 @@ void Gps_L1_Ca_Tcp_Connector_Tracking_cc::forecast(int noutput_items, Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( - long if_freq, long fs_in, unsigned int vector_length, bool dump, @@ -94,7 +92,6 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( this->message_port_register_out(pmt::mp("events")); // initialize internal vars d_dump = dump; - d_if_freq = if_freq; d_fs_in = fs_in; d_vector_length = vector_length; d_dump_filename = dump_filename; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h index 298203e2f..089df2be2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.h @@ -51,7 +51,7 @@ class Gps_L1_Ca_Tcp_Connector_Tracking_cc; typedef boost::shared_ptr gps_l1_ca_tcp_connector_tracking_cc_sptr; gps_l1_ca_tcp_connector_tracking_cc_sptr -gps_l1_ca_tcp_connector_make_tracking_cc(long if_freq, +gps_l1_ca_tcp_connector_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -83,14 +83,14 @@ public: private: friend gps_l1_ca_tcp_connector_tracking_cc_sptr - gps_l1_ca_tcp_connector_make_tracking_cc(long if_freq, + gps_l1_ca_tcp_connector_make_tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, float early_late_space_chips, size_t port_ch0); - Gps_L1_Ca_Tcp_Connector_Tracking_cc(long if_freq, + Gps_L1_Ca_Tcp_Connector_Tracking_cc( long fs_in, unsigned int vector_length, bool dump, std::string dump_filename, @@ -104,7 +104,6 @@ private: Gnss_Synchro *d_acquisition_gnss_synchro; unsigned int d_channel; - long d_if_freq; long d_fs_in; int d_correlation_length_samples; int d_n_correlator_taps; diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 9c5051ea2..fdb35a4e9 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -43,6 +43,7 @@ set(TRACKING_LIB_SOURCES tracking_discriminators.cc tracking_FLL_PLL_filter.cc tracking_loop_filter.cc + dll_pll_conf.cc ) if(ENABLE_FPGA) diff --git a/src/algorithms/tracking/libs/dll_pll_conf.cc b/src/algorithms/tracking/libs/dll_pll_conf.cc new file mode 100644 index 000000000..89c6a1256 --- /dev/null +++ b/src/algorithms/tracking/libs/dll_pll_conf.cc @@ -0,0 +1,61 @@ +/*! + * \file dll_pll_conf.cc + * \brief Class that contains all the configuration parameters for generic + * tracking block based on a DLL and a PLL. + * \author Javier Arribas, 2018. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * 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 "dll_pll_conf.h" +#include + +Dll_Pll_Conf::Dll_Pll_Conf() +{ + /* DLL/PLL tracking configuration */ + fs_in = 0.0; + vector_length = 0; + dump = false; + dump_filename = "./dll_pll_dump.dat"; + pll_bw_hz = 40.0; + dll_bw_hz = 2.0; + pll_bw_narrow_hz = 5.0; + dll_bw_narrow_hz = 0.75; + early_late_space_chips = 0.5; + very_early_late_space_chips = 0.5; + early_late_space_narrow_chips = 0.1; + very_early_late_space_narrow_chips = 0.1; + extend_correlation_symbols = 5; + cn0_samples = 20; + carrier_lock_det_mav_samples = 20; + cn0_min = 25; + max_lock_fail = 50; + carrier_lock_th = 0.85; + track_pilot = false; + system = 'G'; + char sig_[3] = "1C"; + std::memcpy(signal, sig_, 3); +} diff --git a/src/algorithms/tracking/libs/dll_pll_conf.h b/src/algorithms/tracking/libs/dll_pll_conf.h new file mode 100644 index 000000000..2cee8c405 --- /dev/null +++ b/src/algorithms/tracking/libs/dll_pll_conf.h @@ -0,0 +1,68 @@ +/*! + * \file dll_pll_conf.h + * \brief Class that contains all the configuration parameters for generic tracking block based on a DLL and a PLL. + * \author Javier Arribas, 2018. jarribas(at)cttc.es + * + * Class that contains all the configuration parameters for generic tracking block based on a DLL and a PLL. + * + * ------------------------------------------------------------------------- + * + * 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 . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_DLL_PLL_CONF_H_ +#define GNSS_SDR_DLL_PLL_CONF_H_ + +#include + +class Dll_Pll_Conf +{ +private: +public: + /* DLL/PLL tracking configuration */ + double fs_in; + unsigned int vector_length; + bool dump; + std::string dump_filename; + float pll_bw_hz; + float dll_bw_hz; + float pll_bw_narrow_hz; + float dll_bw_narrow_hz; + float early_late_space_chips; + float very_early_late_space_chips; + float early_late_space_narrow_chips; + float very_early_late_space_narrow_chips; + int extend_correlation_symbols; + int cn0_samples; + int carrier_lock_det_mav_samples; + int cn0_min; + int max_lock_fail; + double carrier_lock_th; + bool track_pilot; + char system; + char signal[3]; + + Dll_Pll_Conf(); +}; + +#endif diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.h b/src/algorithms/tracking/libs/fpga_multicorrelator.h index d255ace9f..3a56acfde 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.h +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.h @@ -49,46 +49,46 @@ class fpga_multicorrelator_8sc { public: fpga_multicorrelator_8sc(int n_correlators, std::string device_name, - unsigned int device_base, int *ca_codes, unsigned int code_length); + unsigned int device_base, int *ca_codes, unsigned int code_length); ~fpga_multicorrelator_8sc(); - //bool set_output_vectors(gr_complex* corr_out); - void set_output_vectors(gr_complex* corr_out); -// bool set_local_code_and_taps( -// int code_length_chips, const int* local_code_in, -// float *shifts_chips, int PRN); + //bool set_output_vectors(gr_complex* corr_out); + void set_output_vectors(gr_complex *corr_out); + // bool set_local_code_and_taps( + // int code_length_chips, const int* local_code_in, + // float *shifts_chips, int PRN); //bool set_local_code_and_taps( void set_local_code_and_taps( - int code_length_chips, - float *shifts_chips, int PRN); + int code_length_chips, + float *shifts_chips, int PRN); //bool set_output_vectors(lv_16sc_t* corr_out); void update_local_code(float rem_code_phase_chips); //bool Carrier_wipeoff_multicorrelator_resampler( void Carrier_wipeoff_multicorrelator_resampler( - float rem_carrier_phase_in_rad, float phase_step_rad, - float rem_code_phase_chips, float code_phase_step_chips, - int signal_length_samples);bool free(); + float rem_carrier_phase_in_rad, float phase_step_rad, + float rem_code_phase_chips, float code_phase_step_chips, + int signal_length_samples); + bool free(); void set_channel(unsigned int channel); void set_initial_sample(int samples_offset); int read_sample_counter(); void lock_channel(void); void unlock_channel(void); - void read_sample_counters(int *sample_counter, int *secondary_sample_counter, int *counter_corr_0_in, int *counter_corr_0_out); // debug - - + void read_sample_counters(int *sample_counter, int *secondary_sample_counter, int *counter_corr_0_in, int *counter_corr_0_out); // debug + + private: //const int *d_local_code_in; - gr_complex * d_corr_out; + gr_complex *d_corr_out; float *d_shifts_chips; int d_code_length_chips; int d_n_correlators; // data related to the hardware module and the driver - int d_device_descriptor; // driver descriptor - volatile unsigned *d_map_base; // driver memory map + int d_device_descriptor; // driver descriptor + volatile unsigned *d_map_base; // driver memory map // configuration data received from the interface - unsigned int d_channel; // channel number - unsigned d_ncorrelators; // number of correlators + unsigned int d_channel; // channel number unsigned d_correlator_length_samples; float d_rem_code_phase_chips; float d_code_phase_step_chips; @@ -108,9 +108,9 @@ private: unsigned int d_device_base; - int* d_ca_codes; + int *d_ca_codes; - unsigned int d_code_length; // nominal number of chips + unsigned int d_code_length; // nominal number of chips // private functions unsigned fpga_acquisition_test_register(unsigned writeval); @@ -121,11 +121,11 @@ private: void fpga_configure_signal_parameters_in_fpga(void); void fpga_launch_multicorrelator_fpga(void); void read_tracking_gps_results(void); - void reset_multicorrelator(void); - void close_device(void); - - // debug - //unsigned int first_time = 1; + void reset_multicorrelator(void); + void close_device(void); + + // debug + //unsigned int first_time = 1; }; #endif /* GNSS_SDR_FPGA_MULTICORRELATOR_H_ */ diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 4eebaa950..62d75f86c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -19,4 +19,4 @@ add_subdirectory(system_parameters) add_subdirectory(libs) add_subdirectory(receiver) - +add_subdirectory(monitor) diff --git a/src/core/monitor/CMakeLists.txt b/src/core/monitor/CMakeLists.txt new file mode 100644 index 000000000..545e8641e --- /dev/null +++ b/src/core/monitor/CMakeLists.txt @@ -0,0 +1,37 @@ +# Copyright (C) 2012-2018 (see AUTHORS file for a list of contributors) +# +# This file is part of GNSS-SDR. +# +# GNSS-SDR is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GNSS-SDR is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNSS-SDR. If not, see . +# + + +set(CORE_MONITOR_LIBS_SOURCES + gnss_synchro_monitor.cc + gnss_synchro_udp_sink.cc +) + +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/src/core/system_parameters + ${GLOG_INCLUDE_DIRS} + ${GFlags_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} +) + +file(GLOB CORE_MONITOR_LIBS_HEADERS "*.h") +list(SORT CORE_MONITOR_LIBS_HEADERS) +add_library(core_monitor_lib ${CORE_MONITOR_LIBS_SOURCES} ${CORE_MONITOR_LIBS_HEADERS}) +source_group(Headers FILES ${CORE_MONITOR_LIBS_HEADERS}) +target_link_libraries(core_monitor_lib ${Boost_LIBRARIES}) diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc new file mode 100644 index 000000000..bde09ef69 --- /dev/null +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -0,0 +1,92 @@ +/*! + * \file gnss_synchro_monitor.cc + * \brief Interface of a Position Velocity and Time computation block + * \author Álvaro Cebrián Juan, 2018. acebrianjuan(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 "gnss_synchro_monitor.h" +#include "gnss_synchro.h" +#include +#include +#include + + +using google::LogMessage; + + +gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels, + int output_rate_ms, + int udp_port, + std::vector udp_addresses) +{ + return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels, + output_rate_ms, + udp_port, + udp_addresses)); +} + + +gnss_synchro_monitor::gnss_synchro_monitor(unsigned int n_channels, + int output_rate_ms, + int udp_port, + std::vector udp_addresses) : gr::sync_block("gnss_synchro_monitor", + gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), + gr::io_signature::make(0, 0, 0)) +{ + d_output_rate_ms = output_rate_ms; + d_nchannels = n_channels; + + udp_sink_ptr = std::unique_ptr(new Gnss_Synchro_Udp_Sink(udp_addresses, udp_port)); +} + + +gnss_synchro_monitor::~gnss_synchro_monitor() +{ +} + + +int gnss_synchro_monitor::work(int noutput_items, gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items __attribute__((unused))) +{ + const Gnss_Synchro** in = reinterpret_cast(&input_items[0]); // Get the input buffer pointer + for (int epoch = 0; epoch < noutput_items; epoch++) + { + // ############ 1. READ PSEUDORANGES #### + for (unsigned int i = 0; i < d_nchannels; i++) + { + //if (in[i][epoch].Flag_valid_pseudorange) + // { + // } + //todo: send the gnss_synchro objects + + std::vector stocks; + stocks.push_back(in[i][epoch]); + udp_sink_ptr->write_gnss_synchro(stocks); + } + } + return noutput_items; +} diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h new file mode 100644 index 000000000..36b6f1e3a --- /dev/null +++ b/src/core/monitor/gnss_synchro_monitor.h @@ -0,0 +1,81 @@ +/*! + * \file gnss_synchro_monitor.h + * \brief Interface of a Position Velocity and Time computation block + * \author Álvaro Cebrián Juan, 2018. acebrianjuan(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 . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_GNSS_SYNCHRO_MONITOR_H +#define GNSS_SDR_GNSS_SYNCHRO_MONITOR_H + + +#include "gnss_synchro_udp_sink.h" +#include +#include +#include +#include + + +class gnss_synchro_monitor; + +typedef boost::shared_ptr gnss_synchro_monitor_sptr; + +gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int n_channels, + int output_rate_ms, + int udp_port, + std::vector udp_addresses); + +/*! + * \brief This class implements a block that computes the PVT solution with Galileo E1 signals + */ +class gnss_synchro_monitor : public gr::sync_block +{ +private: + friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(unsigned int nchannels, + int output_rate_ms, + int udp_port, + std::vector udp_addresses); + + unsigned int d_nchannels; + + int d_output_rate_ms; + + std::unique_ptr udp_sink_ptr; + + +public: + gnss_synchro_monitor(unsigned int nchannels, + int output_rate_ms, + int udp_port, + std::vector udp_addresses); + + ~gnss_synchro_monitor(); //!< Default destructor + + int work(int noutput_items, gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items); +}; + +#endif diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc new file mode 100644 index 000000000..52b53b260 --- /dev/null +++ b/src/core/monitor/gnss_synchro_udp_sink.cc @@ -0,0 +1,69 @@ +/*! + * \file gnss_synchro_udp_sink.cc + * \brief Implementation of a class that sends serialized Gnss_Synchro + * objects over udp to one or multiple endponits + * \author Álvaro Cebrián Juan, 2018. acebrianjuan(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 "gnss_synchro_udp_sink.h" +#include +#include +#include +#include + +Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(std::vector addresses, const unsigned short& port) : socket{io_service} +{ + for (auto address : addresses) + { + boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port); + endpoints.push_back(endpoint); + } +} + +bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(std::vector stocks) +{ + std::ostringstream archive_stream; + boost::archive::binary_oarchive oa{archive_stream}; + oa << stocks; + std::string outbound_data = archive_stream.str(); + + for (auto endpoint : endpoints) + { + socket.open(endpoint.protocol(), error); + socket.connect(endpoint, error); + + try + { + socket.send(boost::asio::buffer(outbound_data)); + } + catch (boost::system::system_error const& e) + { + return false; + } + } + return true; +} diff --git a/src/core/monitor/gnss_synchro_udp_sink.h b/src/core/monitor/gnss_synchro_udp_sink.h new file mode 100644 index 000000000..cf3cfc91d --- /dev/null +++ b/src/core/monitor/gnss_synchro_udp_sink.h @@ -0,0 +1,53 @@ +/*! + * \file gnss_synchro_udp_sink.h + * \brief Interface of a class that sends serialized Gnss_Synchro objects + * over udp to one or multiple endponits + * \author Álvaro Cebrián Juan, 2018. acebrianjuan(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 . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SYNCHRO_UDP_SINK_H_ +#define GNSS_SYNCHRO_UDP_SINK_H_ + +#include +#include "gnss_synchro.h" + +class Gnss_Synchro_Udp_Sink +{ +public: + Gnss_Synchro_Udp_Sink(std::vector addresses, const unsigned short &port); + bool write_gnss_synchro(std::vector stocks); + +private: + boost::asio::io_service io_service; + boost::asio::ip::udp::socket socket; + boost::system::error_code error; + std::vector endpoints; + std::vector stocks; +}; + + +#endif /* GNSS_SYNCHRO_UDP_SINK_H_ */ diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 09b24de96..46a13614e 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -40,6 +40,9 @@ if(ENABLE_FPGA) add_definitions(-DENABLE_FPGA=1) endif(ENABLE_FPGA) +if(ENABLE_RAW_UDP) + add_definitions(-DRAW_UDP=1) +endif(ENABLE_RAW_UDP) if(Boost_VERSION LESS 105000) add_definitions(-DOLD_BOOST=1) @@ -108,6 +111,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs/supl ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl + ${CMAKE_SOURCE_DIR}/src/core/monitor ${CMAKE_SOURCE_DIR}/src/algorithms/libs ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/libs ${CMAKE_SOURCE_DIR}/src/algorithms/signal_source/adapters @@ -175,4 +179,5 @@ target_link_libraries(gnss_rx ${Boost_LIBRARIES} pvt_adapters pvt_lib rx_core_lib + core_monitor_lib ) diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 0710da730..8eb49563c 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -114,7 +114,7 @@ void ControlThread::run() { flowgraph_->connect(); } - catch (const std::exception e) + catch (const std::exception &e) { LOG(ERROR) << e.what(); return; diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 0bb6330a9..001e3aff4 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -35,6 +35,7 @@ #include "gnss_block_factory.h" + #include "configuration_interface.h" #include "in_memory_configuration.h" #include "gnss_block_interface.h" @@ -104,6 +105,10 @@ #include "rtklib_pvt.h" #include "gps_l1_ca_kf_tracking.h" +#if RAW_UDP +#include "custom_udp_signal_source.h" +#endif + #if ENABLE_FPGA #include "gps_l1_ca_pcps_acquisition_fpga.h" #include "gps_l1_ca_dll_pll_tracking_fpga.h" @@ -159,11 +164,7 @@ using google::LogMessage; GNSSBlockFactory::GNSSBlockFactory() {} - - GNSSBlockFactory::~GNSSBlockFactory() {} - - std::unique_ptr GNSSBlockFactory::GetSignalSource( std::shared_ptr configuration, gr::msg_queue::sptr queue, int ID) { @@ -236,9 +237,9 @@ std::unique_ptr GNSSBlockFactory::GetSignalConditioner( { //instantiate the array version std::unique_ptr conditioner_(new ArraySignalConditioner(configuration.get(), - std::move(GetBlock(configuration, role_datatypeadapter, data_type_adapter, 1, 1)), - std::move(GetBlock(configuration, role_inputfilter, input_filter, 1, 1)), - std::move(GetBlock(configuration, role_resampler, resampler, 1, 1)), + GetBlock(configuration, role_datatypeadapter, data_type_adapter, 1, 1), + GetBlock(configuration, role_inputfilter, input_filter, 1, 1), + GetBlock(configuration, role_resampler, resampler, 1, 1), role_conditioner, "Signal_Conditioner")); return conditioner_; } @@ -246,9 +247,9 @@ std::unique_ptr GNSSBlockFactory::GetSignalConditioner( { //single-antenna version std::unique_ptr conditioner_(new SignalConditioner(configuration.get(), - std::move(GetBlock(configuration, role_datatypeadapter, data_type_adapter, 1, 1)), - std::move(GetBlock(configuration, role_inputfilter, input_filter, 1, 1)), - std::move(GetBlock(configuration, role_resampler, resampler, 1, 1)), + GetBlock(configuration, role_datatypeadapter, data_type_adapter, 1, 1), + GetBlock(configuration, role_inputfilter, input_filter, 1, 1), + GetBlock(configuration, role_resampler, resampler, 1, 1), role_conditioner, "Signal_Conditioner")); return conditioner_; } @@ -819,12 +820,12 @@ std::unique_ptr>> GNSSBlockFacto telemetry_decoder_implementation); // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_1C(configuration, + channels->at(channel_absolute_id) = GetChannel_1C(configuration, acquisition_implementation_specific, tracking_implementation_specific, telemetry_decoder_implementation_specific, channel_absolute_id, - queue)); + queue); channel_absolute_id++; } @@ -848,12 +849,12 @@ std::unique_ptr>> GNSSBlockFacto telemetry_decoder_implementation); // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_2S(configuration, + channels->at(channel_absolute_id) = GetChannel_2S(configuration, acquisition_implementation_specific, tracking_implementation_specific, telemetry_decoder_implementation_specific, channel_absolute_id, - queue)); + queue); channel_absolute_id++; } @@ -877,12 +878,12 @@ std::unique_ptr>> GNSSBlockFacto telemetry_decoder_implementation); // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_L5(configuration, + channels->at(channel_absolute_id) = GetChannel_L5(configuration, acquisition_implementation_specific, tracking_implementation_specific, telemetry_decoder_implementation_specific, channel_absolute_id, - queue)); + queue); channel_absolute_id++; } @@ -906,12 +907,12 @@ std::unique_ptr>> GNSSBlockFacto telemetry_decoder_implementation); // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_1B(configuration, + channels->at(channel_absolute_id) = GetChannel_1B(configuration, acquisition_implementation_specific, tracking_implementation_specific, telemetry_decoder_implementation_specific, channel_absolute_id, - queue)); + queue); channel_absolute_id++; } @@ -935,12 +936,12 @@ std::unique_ptr>> GNSSBlockFacto telemetry_decoder_implementation); // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_5X(configuration, + channels->at(channel_absolute_id) = GetChannel_5X(configuration, acquisition_implementation_specific, tracking_implementation_specific, telemetry_decoder_implementation_specific, channel_absolute_id, - queue)); + queue); channel_absolute_id++; } @@ -965,12 +966,12 @@ std::unique_ptr>> GNSSBlockFacto telemetry_decoder_implementation); // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_1G(configuration, + channels->at(channel_absolute_id) = GetChannel_1G(configuration, acquisition_implementation_specific, tracking_implementation_specific, telemetry_decoder_implementation_specific, channel_absolute_id, - queue)); + queue); channel_absolute_id++; } @@ -995,12 +996,12 @@ std::unique_ptr>> GNSSBlockFacto telemetry_decoder_implementation); // Push back the channel to the vector of channels - channels->at(channel_absolute_id) = std::move(GetChannel_2G(configuration, + channels->at(channel_absolute_id) = GetChannel_2G(configuration, acquisition_implementation_specific, tracking_implementation_specific, telemetry_decoder_implementation_specific, channel_absolute_id, - queue)); + queue); channel_absolute_id++; } } @@ -1053,6 +1054,23 @@ std::unique_ptr GNSSBlockFactory::GetBlock( exit(1); } } +#if RAW_UDP + else if (implementation.compare("Custom_UDP_Signal_Source") == 0) + { + try + { + std::unique_ptr block_(new CustomUDPSignalSource(configuration.get(), role, in_streams, + out_streams, queue)); + block = std::move(block_); + } + + catch (const std::exception &e) + { + std::cout << "GNSS-SDR program ended." << std::endl; + exit(1); + } + } +#endif else if (implementation.compare("Nsr_File_Signal_Source") == 0) { try @@ -1597,7 +1615,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( // Log fatal. This causes execution to stop. LOG(ERROR) << role << "." << implementation << ": Undefined implementation for block"; } - return std::move(block); + return block; } @@ -1737,7 +1755,7 @@ std::unique_ptr GNSSBlockFactory::GetAcqBlock( // Log fatal. This causes execution to stop. LOG(ERROR) << role << "." << implementation << ": Undefined implementation for block"; } - return std::move(block); + return block; } @@ -1849,7 +1867,7 @@ std::unique_ptr GNSSBlockFactory::GetTrkBlock( // Log fatal. This causes execution to stop. LOG(ERROR) << role << "." << implementation << ": Undefined implementation for block"; } - return std::move(block); + return block; } @@ -1915,5 +1933,5 @@ std::unique_ptr GNSSBlockFactory::GetTlmBlock( // Log fatal. This causes execution to stop. LOG(ERROR) << role << "." << implementation << ": Undefined implementation for block"; } - return std::move(block); + return block; } diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 83ad6807a..b5b978d9f 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -4,6 +4,7 @@ * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * Luis Esteve, 2012. luis(at)epsilon-formacion.com * Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es + * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com * * ------------------------------------------------------------------------- * @@ -422,11 +423,59 @@ void GNSSFlowgraph::connect() else { std::string gnss_system; - if ((gnss_signal.compare("1C") == 0) or (gnss_signal.compare("2S") == 0) or (gnss_signal.compare("L5") == 0)) gnss_system = "GPS"; - if ((gnss_signal.compare("1B") == 0) or (gnss_signal.compare("5X") == 0)) gnss_system = "Galileo"; - if ((gnss_signal.compare("1G") == 0) or (gnss_signal.compare("2G") == 0)) gnss_system = "Glonass"; - Gnss_Signal signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); - available_GNSS_signals_.remove(signal_value); + Gnss_Signal signal_value; + switch (mapStringValues_[gnss_signal]) + { + case evGPS_1C: + gnss_system = "GPS"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GPS_1C_signals_.remove(signal_value); + break; + + case evGPS_2S: + gnss_system = "GPS"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GPS_2S_signals_.remove(signal_value); + break; + + case evGPS_L5: + gnss_system = "GPS"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GPS_L5_signals_.remove(signal_value); + break; + + case evGAL_1B: + gnss_system = "Galileo"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GAL_1B_signals_.remove(signal_value); + break; + + case evGAL_5X: + gnss_system = "Galileo"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GAL_5X_signals_.remove(signal_value); + break; + + case evGLO_1G: + gnss_system = "Glonass"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GLO_1G_signals_.remove(signal_value); + break; + + case evGLO_2G: + gnss_system = "Glonass"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GLO_2G_signals_.remove(signal_value); + break; + + default: + LOG(ERROR) << "This should not happen :-("; + gnss_system = "GPS"; + signal_value = Gnss_Signal(Gnss_Satellite(gnss_system, sat), gnss_signal); + available_GPS_1C_signals_.remove(signal_value); + break; + } + channels_.at(i)->set_signal(signal_value); } } @@ -448,6 +497,25 @@ void GNSSFlowgraph::connect() return; } + // GNSS SYNCHRO MONITOR + if (enable_monitor_) + { + try + { + for (unsigned int i = 0; i < channels_count_; i++) + { + top_block_->connect(observables_->get_right_block(), i, GnssSynchroMonitor_, i); + } + } + catch (const std::exception& e) + { + LOG(WARNING) << "Can't connect observables to Monitor block"; + LOG(ERROR) << e.what(); + top_block_->disconnect_all(); + return; + } + } + // Activate acquisition in enabled channels for (unsigned int i = 0; i < channels_count_; i++) { @@ -755,18 +823,75 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { LOG(WARNING) << e.what(); } + std::lock_guard lock(signal_list_mutex); switch (what) { case 0: DLOG(INFO) << "Channel " << who << " ACQ FAILED satellite " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str(); if (sat == 0) { - std::lock_guard lock(signal_list_mutex); - available_GNSS_signals_.push_back(channels_[who]->get_signal()); - channels_[who]->set_signal(search_next_signal(channels_[who]->get_signal().get_signal_str(), true)); + switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) + { + case evGPS_1C: + available_GPS_1C_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGPS_2S: + available_GPS_2S_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGPS_L5: + available_GPS_L5_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGAL_1B: + available_GAL_1B_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGAL_5X: + available_GAL_5X_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGLO_1G: + available_GLO_1G_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGLO_2G: + available_GLO_2G_signals_.push_back(channels_[who]->get_signal()); + break; + + default: + LOG(ERROR) << "This should not happen :-("; + break; + } + } + channels_state_[who] = 0; + acq_channels_count_--; + for (unsigned int i = 0; i < channels_count_; i++) + { + unsigned int ch_index = (who + i + 1) % channels_count_; + unsigned int sat_ = 0; + try + { + sat_ = configuration_->property("Channel" + std::to_string(ch_index) + ".satellite", 0); + } + catch (const std::exception& e) + { + LOG(WARNING) << e.what(); + } + if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[ch_index] == 0)) + { + channels_state_[ch_index] = 1; + if (sat_ == 0) + { + channels_[ch_index]->set_signal(search_next_signal(channels_[ch_index]->get_signal().get_signal_str(), true)); + } + acq_channels_count_++; + DLOG(INFO) << "Channel " << ch_index << " Starting acquisition " << channels_[ch_index]->get_signal().get_satellite() << ", Signal " << channels_[ch_index]->get_signal().get_signal_str(); + channels_[ch_index]->start_acquisition(); + } + DLOG(INFO) << "Channel " << ch_index << " in state " << channels_state_[ch_index]; } - DLOG(INFO) << "Channel " << who << " Starting acquisition " << channels_[who]->get_signal().get_satellite() << ", Signal " << channels_[who]->get_signal().get_signal_str(); - channels_[who]->start_acquisition(); break; case 1: @@ -784,13 +909,12 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { LOG(WARNING) << e.what(); } - if (!available_GNSS_signals_.empty() && (acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) + if ((acq_channels_count_ < max_acq_channels_) && (channels_state_[i] == 0)) { channels_state_[i] = 1; if (sat_ == 0) { - std::lock_guard lock(signal_list_mutex); - channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true)); + channels_[i]->set_signal(search_next_signal(channels_[i]->get_signal().get_signal_str(), true, true)); } acq_channels_count_++; DLOG(INFO) << "Channel " << i << " Starting acquisition " << channels_[i]->get_signal().get_satellite() << ", Signal " << channels_[i]->get_signal().get_signal_str(); @@ -817,8 +941,40 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) LOG(INFO) << "Channel " << who << " Idle state"; if (sat == 0) { - std::lock_guard lock(signal_list_mutex); - available_GNSS_signals_.push_back(channels_[who]->get_signal()); + switch (mapStringValues_[channels_[who]->get_signal().get_signal_str()]) + { + case evGPS_1C: + available_GPS_1C_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGPS_2S: + available_GPS_2S_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGPS_L5: + available_GPS_L5_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGAL_1B: + available_GAL_1B_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGAL_5X: + available_GAL_5X_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGLO_1G: + available_GLO_1G_signals_.push_back(channels_[who]->get_signal()); + break; + + case evGLO_2G: + available_GLO_2G_signals_.push_back(channels_[who]->get_signal()); + break; + + default: + LOG(ERROR) << "This should not happen :-("; + break; + } } } break; @@ -826,7 +982,6 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) default: break; } - DLOG(INFO) << "Number of available signals: " << available_GNSS_signals_.size(); applied_actions_++; } @@ -943,11 +1098,38 @@ void GNSSFlowgraph::init() top_block_ = gr::make_top_block("GNSSFlowgraph"); - // fill the available_GNSS_signals_ queue with the satellites ID's to be searched by the acquisition + mapStringValues_["1C"] = evGPS_1C; + mapStringValues_["2S"] = evGPS_2S; + mapStringValues_["L5"] = evGPS_L5; + mapStringValues_["1B"] = evGAL_1B; + mapStringValues_["5X"] = evGAL_5X; + mapStringValues_["1G"] = evGLO_1G; + mapStringValues_["2G"] = evGLO_2G; + + // fill the signals queue with the satellites ID's to be searched by the acquisition set_signals_list(); set_channels_state(); applied_actions_ = 0; DLOG(INFO) << "Blocks instantiated. " << channels_count_ << " channels."; + + /* + * Instantiate the receiver monitor block, if required + */ + enable_monitor_ = configuration_->property("Monitor.enable_monitor", false); + + std::vector udp_addr_vec; + + std::string address_string = configuration_->property("Monitor.client_addresses", std::string("127.0.0.1")); + //todo: split the string in substrings using the separator and fill the address vector. + udp_addr_vec.push_back(address_string); + + if (enable_monitor_) + { + GnssSynchroMonitor_ = gr::basic_block_sptr(new gnss_synchro_monitor(channels_count_, + configuration_->property("Monitor.output_rate_ms", 1), + configuration_->property("Monitor.udp_port", 1234), + udp_addr_vec)); + } } @@ -1036,14 +1218,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_1C.count", 0) > 0) { - /* - * Loop to create GPS L1 C/A signals - */ + // Loop to create GPS L1 C/A signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); available_gnss_prn_iter != available_gps_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GPS_1C_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), std::string("1C"))); } @@ -1051,14 +1231,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_2S.count", 0) > 0) { - /* - * Loop to create GPS L2C M signals - */ + // Loop to create GPS L2C M signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); available_gnss_prn_iter != available_gps_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GPS_2S_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), std::string("2S"))); } @@ -1066,14 +1244,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_L5.count", 0) > 0) { - /* - * Loop to create GPS L5 signals - */ + // Loop to create GPS L5 signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); available_gnss_prn_iter != available_gps_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GPS_L5_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), std::string("L5"))); } @@ -1081,14 +1257,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_SBAS.count", 0) > 0) { - /* - * Loop to create SBAS L1 C/A signals - */ + // Loop to create SBAS L1 C/A signals for (available_gnss_prn_iter = available_sbas_prn.cbegin(); available_gnss_prn_iter != available_sbas_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_SBAS_1C_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("SBAS"), *available_gnss_prn_iter), std::string("1C"))); } @@ -1096,14 +1270,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_1B.count", 0) > 0) { - /* - * Loop to create the list of Galileo E1B signals - */ + // Loop to create the list of Galileo E1B signals for (available_gnss_prn_iter = available_galileo_prn.cbegin(); available_gnss_prn_iter != available_galileo_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GAL_1B_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter), std::string("1B"))); } @@ -1111,14 +1283,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_5X.count", 0) > 0) { - /* - * Loop to create the list of Galileo E5a signals - */ + // Loop to create the list of Galileo E5a signals for (available_gnss_prn_iter = available_galileo_prn.cbegin(); available_gnss_prn_iter != available_galileo_prn.cend(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GAL_5X_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter), std::string("5X"))); } @@ -1126,14 +1296,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_1G.count", 0) > 0) { - /* - * Loop to create the list of GLONASS L1 C/A signals - */ + // Loop to create the list of GLONASS L1 C/A signals for (available_gnss_prn_iter = available_glonass_prn.begin(); available_gnss_prn_iter != available_glonass_prn.end(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GLO_1G_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter), std::string("1G"))); } @@ -1141,14 +1309,12 @@ void GNSSFlowgraph::set_signals_list() if (configuration_->property("Channels_2G.count", 0) > 0) { - /* - * Loop to create the list of GLONASS L2 C/A signals - */ + // Loop to create the list of GLONASS L2 C/A signals for (available_gnss_prn_iter = available_glonass_prn.begin(); available_gnss_prn_iter != available_glonass_prn.end(); available_gnss_prn_iter++) { - available_GNSS_signals_.push_back(Gnss_Signal( + available_GLO_2G_signals_.push_back(Gnss_Signal( Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter), std::string("2G"))); } @@ -1177,22 +1343,212 @@ void GNSSFlowgraph::set_channels_state() } DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; } + std::lock_guard lock(signal_list_mutex); acq_channels_count_ = max_acq_channels_; DLOG(INFO) << acq_channels_count_ << " channels in acquisition state"; } -Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool pop) +Gnss_Signal GNSSFlowgraph::search_next_signal(std::string searched_signal, bool pop, bool tracked) { - while (searched_signal.compare(available_GNSS_signals_.front().get_signal_str()) != 0) + Gnss_Signal result; + bool untracked_satellite = true; + switch (mapStringValues_[searched_signal]) { - available_GNSS_signals_.push_back(available_GNSS_signals_.front()); - available_GNSS_signals_.pop_front(); - } - Gnss_Signal result = available_GNSS_signals_.front(); - if (pop) - { - available_GNSS_signals_.pop_front(); + case evGPS_1C: + result = available_GPS_1C_signals_.front(); + if (pop) + { + available_GPS_1C_signals_.pop_front(); + } + if (tracked) + { + if ((configuration_->property("Channels_2S.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1C") != 0)) untracked_satellite = false; + } + if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); + available_GPS_2S_signals_.remove(gs); + available_GPS_2S_signals_.push_front(gs); + } + if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); + available_GPS_L5_signals_.remove(gs); + available_GPS_L5_signals_.push_front(gs); + } + } + } + break; + + case evGPS_2S: + result = available_GPS_2S_signals_.front(); + if (pop) + { + available_GPS_2S_signals_.pop_front(); + } + if (tracked) + { + if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_L5.count", 0) > 0)) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("2S") != 0)) untracked_satellite = false; + } + if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); + available_GPS_1C_signals_.remove(gs); + available_GPS_1C_signals_.push_front(gs); + } + if (untracked_satellite and configuration_->property("Channels_L5.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "L5"); + available_GPS_L5_signals_.remove(gs); + available_GPS_L5_signals_.push_front(gs); + } + } + } + break; + + case evGPS_L5: + result = available_GPS_L5_signals_.front(); + if (pop) + { + available_GPS_L5_signals_.pop_front(); + } + if (tracked) + { + if ((configuration_->property("Channels_1C.count", 0) > 0) or (configuration_->property("Channels_2S.count", 0) > 0)) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("L5") != 0)) untracked_satellite = false; + } + if (untracked_satellite and configuration_->property("Channels_1C.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1C"); + available_GPS_1C_signals_.remove(gs); + available_GPS_1C_signals_.push_front(gs); + } + if (untracked_satellite and configuration_->property("Channels_2S.count", 0) > 0) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2S"); + available_GPS_2S_signals_.remove(gs); + available_GPS_2S_signals_.push_front(gs); + } + } + } + break; + + case evGAL_1B: + result = available_GAL_1B_signals_.front(); + if (pop) + { + available_GAL_1B_signals_.pop_front(); + } + if (tracked) + { + if (configuration_->property("Channels_5X.count", 0) > 0) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1B") != 0)) untracked_satellite = false; + } + if (untracked_satellite) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "5X"); + available_GAL_5X_signals_.remove(gs); + available_GAL_5X_signals_.push_front(gs); + } + } + } + break; + + case evGAL_5X: + result = available_GAL_5X_signals_.front(); + if (pop) + { + available_GAL_5X_signals_.pop_front(); + } + if (tracked) + { + if (configuration_->property("Channels_1B.count", 0) > 0) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("5X") != 0)) untracked_satellite = false; + } + if (untracked_satellite) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1B"); + available_GAL_1B_signals_.remove(gs); + available_GAL_1B_signals_.push_front(gs); + } + } + } + break; + + case evGLO_1G: + result = available_GLO_1G_signals_.front(); + if (pop) + { + available_GLO_1G_signals_.pop_front(); + } + if (tracked) + { + if (configuration_->property("Channels_2G.count", 0) > 0) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("1G") != 0)) untracked_satellite = false; + } + if (untracked_satellite) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "2G"); + available_GLO_2G_signals_.remove(gs); + available_GLO_2G_signals_.push_front(gs); + } + } + } + break; + + case evGLO_2G: + result = available_GLO_2G_signals_.front(); + if (pop) + { + available_GLO_2G_signals_.pop_front(); + } + if (tracked) + { + if (configuration_->property("Channels_1G.count", 0) > 0) + { + for (unsigned int ch = 0; ch < channels_count_; ch++) + { + if ((channels_[ch]->get_signal().get_satellite() == result.get_satellite()) and (channels_[ch]->get_signal().get_signal_str().compare("2G") != 0)) untracked_satellite = false; + } + if (untracked_satellite) + { + Gnss_Signal gs = Gnss_Signal(result.get_satellite(), "1G"); + available_GLO_1G_signals_.remove(gs); + available_GLO_1G_signals_.push_front(gs); + } + } + } + break; + + default: + LOG(ERROR) << "This should not happen :-("; + result = available_GPS_1C_signals_.front(); + if (pop) + { + available_GPS_1C_signals_.pop_front(); + } + break; } return result; } diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index ff72eda88..00a6ced4e 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -4,6 +4,7 @@ * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com * Luis Esteve, 2011. luis(at)epsilon-formacion.com * Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es + * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com * * It contains a signal source, * a signal conditioner, a set of channels, an observables block and a pvt. @@ -39,11 +40,13 @@ #include "GPS_L1_CA.h" #include "gnss_signal.h" #include "gnss_sdr_sample_counter.h" +#include "gnss_synchro_monitor.h" #include #include #include #include #include +#include #include #include #include @@ -106,17 +109,17 @@ public: void set_configuration(std::shared_ptr configuration); - unsigned int applied_actions() + unsigned int applied_actions() const { return applied_actions_; } - bool connected() + bool connected() const { return connected_; } - bool running() + bool running() const { return running_; } @@ -133,7 +136,7 @@ private: void set_signals_list(); void set_channels_state(); // Initializes the channels state (start acquisition or keep standby) // using the configuration parameters (number of channels and max channels in acquisition) - Gnss_Signal search_next_signal(std::string searched_signal, bool pop); + Gnss_Signal search_next_signal(std::string searched_signal, bool pop, bool tracked = false); bool connected_; bool running_; int sources_count_; @@ -160,9 +163,33 @@ private: gr::blocks::throttle::sptr throttle_; gr::top_block_sptr top_block_; gr::msg_queue::sptr queue_; - std::list available_GNSS_signals_; + + std::list available_GPS_1C_signals_; + std::list available_GPS_2S_signals_; + std::list available_GPS_L5_signals_; + std::list available_SBAS_1C_signals_; + std::list available_GAL_1B_signals_; + std::list available_GAL_5X_signals_; + std::list available_GLO_1G_signals_; + std::list available_GLO_2G_signals_; + enum StringValue + { + evGPS_1C, + evGPS_2S, + evGPS_L5, + evSBAS_1C, + evGAL_1B, + evGAL_5X, + evGLO_1G, + evGLO_2G + }; + std::map mapStringValues_; + std::vector channels_state_; std::mutex signal_list_mutex; + + bool enable_monitor_; + gr::basic_block_sptr GnssSynchroMonitor_; }; #endif /*GNSS_SDR_GNSS_FLOWGRAPH_H_*/ diff --git a/src/core/receiver/in_memory_configuration.cc b/src/core/receiver/in_memory_configuration.cc index 6a2ce8bf8..75b520362 100644 --- a/src/core/receiver/in_memory_configuration.cc +++ b/src/core/receiver/in_memory_configuration.cc @@ -117,6 +117,13 @@ void InMemoryConfiguration::set_property(std::string property_name, std::string } +void InMemoryConfiguration::supersede_property(std::string property_name, std::string value) +{ + properties_.erase(property_name); + properties_.insert(std::make_pair(property_name, value)); +} + + bool InMemoryConfiguration::is_present(std::string property_name) { return (properties_.find(property_name) != properties_.end()); diff --git a/src/core/receiver/in_memory_configuration.h b/src/core/receiver/in_memory_configuration.h index 1850a9d41..59c1f1baf 100644 --- a/src/core/receiver/in_memory_configuration.h +++ b/src/core/receiver/in_memory_configuration.h @@ -63,6 +63,7 @@ public: float property(std::string property_name, float default_value); double property(std::string property_name, double default_value); void set_property(std::string property_name, std::string value); + void supersede_property(std::string property_name, std::string value); bool is_present(std::string property_name); private: diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index d8d3971f6..2d7c10f23 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -20,29 +20,29 @@ set(SYSTEM_PARAMETERS_SOURCES gnss_satellite.cc gnss_signal.cc gps_navigation_message.cc - gps_ephemeris.cc - gps_iono.cc - gps_almanac.cc - gps_utc_model.cc - gps_acq_assist.cc - gps_ref_time.cc - gps_ref_location.cc - galileo_utc_model.cc - galileo_ephemeris.cc - galileo_almanac.cc - galileo_iono.cc - galileo_navigation_message.cc - sbas_ephemeris.cc - galileo_fnav_message.cc - gps_cnav_ephemeris.cc - gps_cnav_navigation_message.cc - gps_cnav_iono.cc - gps_cnav_utc_model.cc - rtcm.cc - glonass_gnav_ephemeris.cc - glonass_gnav_almanac.cc - glonass_gnav_utc_model.cc - glonass_gnav_navigation_message.cc + gps_ephemeris.cc + gps_iono.cc + gps_almanac.cc + gps_utc_model.cc + gps_acq_assist.cc + gps_ref_time.cc + gps_ref_location.cc + galileo_utc_model.cc + galileo_ephemeris.cc + galileo_almanac.cc + galileo_iono.cc + galileo_navigation_message.cc + sbas_ephemeris.cc + galileo_fnav_message.cc + gps_cnav_ephemeris.cc + gps_cnav_navigation_message.cc + gps_cnav_iono.cc + gps_cnav_utc_model.cc + rtcm.cc + glonass_gnav_ephemeris.cc + glonass_gnav_almanac.cc + glonass_gnav_utc_model.cc + glonass_gnav_navigation_message.cc ) diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index f26e92f59..be6192795 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -67,8 +67,8 @@ const double GPS_L1_CA_CHIP_PERIOD = 9.7752e-07; //!< GPS L1 C/A chip period const double MAX_TOA_DELAY_MS = 20; //#define NAVIGATION_SOLUTION_RATE_MS 1000 // this cannot go here -const double GPS_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here) - +//const double GPS_STARTOFFSET_ms = 68.802; //[ms] Initial sign. travel time (this cannot go here) +const double GPS_STARTOFFSET_ms = 69.0; // OBSERVABLE HISTORY DEEP FOR INTERPOLATION const int GPS_L1_CA_HISTORY_DEEP = 100; @@ -82,6 +82,7 @@ const int GPS_L1_CA_HISTORY_DEEP = 100; const int GPS_CA_PREAMBLE_LENGTH_BITS = 8; const int GPS_CA_PREAMBLE_LENGTH_SYMBOLS = 160; const double GPS_CA_PREAMBLE_DURATION_S = 0.160; +const int GPS_CA_PREAMBLE_DURATION_MS = 160; const int GPS_CA_TELEMETRY_RATE_BITS_SECOND = 50; //!< NAV message bit rate [bits/s] const int GPS_CA_TELEMETRY_SYMBOLS_PER_BIT = 20; const int GPS_CA_TELEMETRY_RATE_SYMBOLS_SECOND = GPS_CA_TELEMETRY_RATE_BITS_SECOND * GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; //!< NAV message bit rate [symbols/s] diff --git a/src/core/system_parameters/gnss_synchro.h b/src/core/system_parameters/gnss_synchro.h index 90dd378d3..5d4afde8a 100644 --- a/src/core/system_parameters/gnss_synchro.h +++ b/src/core/system_parameters/gnss_synchro.h @@ -4,6 +4,7 @@ * \author * Luis Esteve, 2012. luis(at)epsilon-formacion.com * Javier Arribas, 2012. jarribas(at)cttc.es + * Álvaro Cebrián Juan, 2018. acebrianjuan(at)gmail.com * ------------------------------------------------------------------------- * * Copyright (C) 2010-2018 (see AUTHORS file for a list of contributors) @@ -66,13 +67,52 @@ public: int correlation_length_ms; //!< Set by Tracking processing block //Telemetry Decoder - bool Flag_valid_word; //!< Set by Telemetry Decoder processing block - double TOW_at_current_symbol_s; //!< Set by Telemetry Decoder processing block + bool Flag_valid_word; //!< Set by Telemetry Decoder processing block + unsigned int TOW_at_current_symbol_ms; //!< Set by Telemetry Decoder processing block // Observables double Pseudorange_m; //!< Set by Observables processing block double RX_time; //!< Set by Observables processing block bool Flag_valid_pseudorange; //!< Set by Observables processing block + double interp_TOW_ms; //!< Set by Observables processing block + + + /*! + * \brief This member function is necessary to serialize and restore + * Gnss_Synchro objects from a byte stream. + */ + template + void serialize(Archive& ar, const unsigned int version) + { + // Satellite and signal info + ar& System; + ar& Signal; + ar& PRN; + ar& Channel_ID; + ar& Acq_delay_samples; + ar& Acq_doppler_hz; + ar& Acq_samplestamp_samples; + ar& Flag_valid_acquisition; + //Tracking + ar& fs; + ar& Prompt_I; + ar& Prompt_Q; + ar& CN0_dB_hz; + ar& Carrier_Doppler_hz; + ar& Carrier_phase_rads; + ar& Code_phase_samples; + ar& Tracking_sample_counter; + ar& Flag_valid_symbol_output; + ar& correlation_length_ms; + //Telemetry Decoder + ar& Flag_valid_word; + ar& TOW_at_current_symbol_ms; + // Observables + ar& Pseudorange_m; + ar& RX_time; + ar& Flag_valid_pseudorange; + ar& interp_TOW_ms; + } }; #endif diff --git a/src/core/system_parameters/rtcm.cc b/src/core/system_parameters/rtcm.cc index 6fb5666bf..8f337f802 100644 --- a/src/core/system_parameters/rtcm.cc +++ b/src/core/system_parameters/rtcm.cc @@ -53,7 +53,7 @@ Rtcm::Rtcm(unsigned short port) reserved_field = std::bitset<6>("000000"); rtcm_message_queue = std::make_shared >(); boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::tcp::v4(), RTCM_port); - servers.emplace_back(io_service, endpoint); + servers.emplace_back(io_context, endpoint); server_is_running = false; } @@ -85,13 +85,13 @@ Rtcm::~Rtcm() // ***************************************************************************************************** void Rtcm::run_server() { - std::cout << "Starting a TCP Server on port " << RTCM_port << std::endl; + std::cout << "Starting a TCP/IP server of RTCM messages on port " << RTCM_port << std::endl; try { - std::thread tq([&] { std::make_shared(io_service, rtcm_message_queue, RTCM_port)->do_read_queue(); }); + std::thread tq([&] { std::make_shared(io_context, rtcm_message_queue, RTCM_port)->do_read_queue(); }); tq.detach(); - std::thread t([&] { io_service.run(); }); + std::thread t([&] { io_context.run(); }); server_is_running = true; t.detach(); } @@ -104,13 +104,13 @@ void Rtcm::run_server() void Rtcm::stop_service() { - io_service.stop(); + io_context.stop(); } void Rtcm::stop_server() { - std::cout << "Stopping TCP Server on port " << RTCM_port << std::endl; + std::cout << "Stopping TCP/IP server on port " << RTCM_port << std::endl; rtcm_message_queue->push("Goodbye"); // this terminates tq Rtcm::stop_service(); servers.front().close_server(); @@ -3313,7 +3313,7 @@ std::map Rtcm::galileo_signal_map = [] { boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double obs_time) const { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -3322,7 +3322,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_Ephemeris& eph, double boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, double obs_time) const { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -3331,7 +3331,7 @@ boost::posix_time::ptime Rtcm::compute_GPS_time(const Gps_CNAV_Ephemeris& eph, d boost::posix_time::ptime Rtcm::compute_Galileo_time(const Galileo_Ephemeris& eph, double obs_time) const { double galileo_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((galileo_t + 604800 * static_cast(eph.WN_5)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((galileo_t + 604800 * static_cast(eph.WN_5)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); return p_time; } @@ -4058,7 +4058,7 @@ int Rtcm::set_DF050(const Gnss_Synchro& gnss_synchro) int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time) { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); std::string now_ptime = to_iso_string(p_time); std::string today_ptime = now_ptime.substr(0, 8); @@ -4072,7 +4072,7 @@ int Rtcm::set_DF051(const Gps_Ephemeris& gps_eph, double obs_time) int Rtcm::set_DF052(const Gps_Ephemeris& gps_eph, double obs_time) { const double gps_t = obs_time; - boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000); + boost::posix_time::time_duration t = boost::posix_time::milliseconds(static_cast((gps_t + 604800 * static_cast(gps_eph.i_GPS_week % 1024)) * 1000)); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); std::string now_ptime = to_iso_string(p_time); std::string hours = now_ptime.substr(9, 2); diff --git a/src/core/system_parameters/rtcm.h b/src/core/system_parameters/rtcm.h index 735d21343..d97ed6e24 100644 --- a/src/core/system_parameters/rtcm.h +++ b/src/core/system_parameters/rtcm.h @@ -677,10 +677,10 @@ private: { if (first == true) { - std::cout << "Client from " << socket_.remote_endpoint().address() << " says "; + LOG(INFO) << "Client says:"; first = false; } - std::cout << client_says.substr(0, 80) << std::endl; + LOG(INFO) << client_says; client_says = client_says.substr(80, client_says.length() - 80); } do_read_message_header(); @@ -749,21 +749,21 @@ private: : public std::enable_shared_from_this { public: - Tcp_Internal_Client(boost::asio::io_service& io_service, + Tcp_Internal_Client(boost::asio::io_service& io_context, boost::asio::ip::tcp::resolver::iterator endpoint_iterator) - : io_service_(io_service), socket_(io_service) + : io_context_(io_context), socket_(io_context) { do_connect(endpoint_iterator); } inline void close() { - io_service_.post([this]() { socket_.close(); }); + io_context_.post([this]() { socket_.close(); }); } inline void write(const Rtcm_Message& msg) { - io_service_.post( + io_context_.post( [this, msg]() { bool write_in_progress = !write_msgs_.empty(); write_msgs_.push_back(msg); @@ -827,7 +827,7 @@ private: }); } - boost::asio::io_service& io_service_; + boost::asio::io_service& io_context_; boost::asio::ip::tcp::socket socket_; Rtcm_Message read_msg_; std::deque write_msgs_; @@ -837,13 +837,13 @@ private: class Queue_Reader { public: - Queue_Reader(boost::asio::io_service& io_service, std::shared_ptr >& queue, int port) : queue_(queue) + Queue_Reader(boost::asio::io_service& io_context, std::shared_ptr >& queue, int port) : queue_(queue) { - boost::asio::ip::tcp::resolver resolver(io_service); + boost::asio::ip::tcp::resolver resolver(io_context); std::string host("localhost"); std::string port_str = std::to_string(port); auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()}); - c = std::make_shared(io_service, queue_endpoint_iterator); + c = std::make_shared(io_context, queue_endpoint_iterator); } inline void do_read_queue() @@ -871,8 +871,8 @@ private: class Tcp_Server { public: - Tcp_Server(boost::asio::io_service& io_service, const boost::asio::ip::tcp::endpoint& endpoint) - : io_service_(io_service), acceptor_(io_service), socket_(io_service) + Tcp_Server(boost::asio::io_service& io_context, const boost::asio::ip::tcp::endpoint& endpoint) + : acceptor_(io_context), socket_(io_context) { acceptor_.open(endpoint.protocol()); acceptor_.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true)); @@ -895,33 +895,47 @@ private: { if (first_client) { - std::cout << "The TCP Server is up and running. Accepting connections ..." << std::endl; + std::cout << "The TCP/IP server of RTCM messages is up and running. Accepting connections ..." << std::endl; first_client = false; } else { - std::cout << "Starting RTCM TCP server session..." << std::endl; - std::cout << "Serving client from " << socket_.remote_endpoint().address() << std::endl; - LOG(INFO) << "Serving client from " << socket_.remote_endpoint().address(); + std::cout << "Starting RTCM TCP/IP server session..." << std::endl; + boost::system::error_code ec2; + boost::asio::ip::tcp::endpoint endpoint = socket_.remote_endpoint(ec2); + if (ec2) + { + // Error creating remote_endpoint + std::cout << "Error getting remote IP address, closing session." << std::endl; + LOG(INFO) << "Error getting remote IP address"; + start_session = false; + } + else + { + std::string remote_addr = endpoint.address().to_string(); + std::cout << "Serving client from " << remote_addr << std::endl; + LOG(INFO) << "Serving client from " << remote_addr; + } } - std::make_shared(std::move(socket_), room_)->start(); + if (start_session) std::make_shared(std::move(socket_), room_)->start(); } else { std::cout << "Error when invoking a RTCM session. " << ec << std::endl; } + start_session = true; do_accept(); }); } - boost::asio::io_service& io_service_; boost::asio::ip::tcp::acceptor acceptor_; boost::asio::ip::tcp::socket socket_; Rtcm_Listener_Room room_; bool first_client = true; + bool start_session = true; }; - boost::asio::io_service io_service; + boost::asio::io_service io_context; std::shared_ptr > rtcm_message_queue; std::thread t; std::thread tq; diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index b97a62458..7b41ccfbd 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -16,13 +16,11 @@ # along with GNSS-SDR. If not, see . # - set(GNSS_SDR_OPTIONAL_LIBS "") set(GNSS_SDR_OPTIONAL_HEADERS "") if(ENABLE_GPERFTOOLS) if(GPERFTOOLS_FOUND) - #set(GNSS_SDR_OPTIONAL_LIBS "${GNSS_SDR_OPTIONAL_LIBS};${GPERFTOOLS_LIBRARIES}") set(GNSS_SDR_OPTIONAL_LIBS "${GNSS_SDR_OPTIONAL_LIBS};${GPERFTOOLS_PROFILER};${GPERFTOOLS_TCMALLOC}") set(GNSS_SDR_OPTIONAL_HEADERS "${GNSS_SDR_OPTIONAL_HEADERS};${GPERFTOOLS_INCLUDE_DIR}") endif(GPERFTOOLS_FOUND) @@ -48,7 +46,6 @@ if(ORC_FOUND) set(GNSS_SDR_OPTIONAL_HEADERS ${GNSS_SDR_OPTIONAL_HEADERS} ${ORC_INCLUDE_DIRS}) endif(ORC_FOUND) - include_directories( ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/interfaces @@ -76,13 +73,11 @@ if(OS_IS_MACOSX) endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif(OS_IS_MACOSX) - add_executable(gnss-sdr ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) add_custom_command(TARGET gnss-sdr POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ - ${CMAKE_SOURCE_DIR}/install/$ - ) + ${CMAKE_SOURCE_DIR}/install/$ ) target_link_libraries(gnss-sdr ${MAC_LIBRARIES} ${Boost_LIBRARIES} @@ -97,18 +92,14 @@ target_link_libraries(gnss-sdr ${MAC_LIBRARIES} ${GNSS_SDR_OPTIONAL_LIBS} gnss_sp_libs gnss_sdr_flags - gnss_rx - ) - + gnss_rx ) install(TARGETS gnss-sdr RUNTIME DESTINATION bin - COMPONENT "gnss-sdr" - ) + COMPONENT "gnss-sdr" ) install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf DESTINATION share/gnss-sdr - FILES_MATCHING PATTERN "*.conf" - ) + FILES_MATCHING PATTERN "*.conf" ) install(FILES ${CMAKE_SOURCE_DIR}/conf/gnss-sdr.conf DESTINATION share/gnss-sdr/conf RENAME default.conf) @@ -118,7 +109,6 @@ if(NOT VOLK_GNSSSDR_FOUND) install(PROGRAMS ${CMAKE_BINARY_DIR}/volk_gnsssdr_module/build/apps/volk_gnsssdr-config-info DESTINATION bin COMPONENT "volk_gnsssdr") endif(NOT VOLK_GNSSSDR_FOUND) - find_program(GZIP gzip /bin @@ -127,6 +117,7 @@ find_program(GZIP /opt/local/bin /sbin ) + if(NOT GZIP_NOTFOUND) execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/manpage/gnss-sdr-manpage WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/gnss-sdr.1.gz") diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index f2b14aa0f..54b3ac685 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -298,7 +298,7 @@ else(ENABLE_INSTALL_TESTS) add_definitions(-DTEST_PATH="${CMAKE_SOURCE_DIR}/thirdparty/") endif(ENABLE_INSTALL_TESTS) -include_directories( +set(LIST_INCLUDE_DIRS ${GTEST_INCLUDE_DIRECTORIES} ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/interfaces @@ -307,6 +307,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs/supl ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-rrlp ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl + ${CMAKE_SOURCE_DIR}/src/core/monitor ${CMAKE_SOURCE_DIR}/src/algorithms/libs ${CMAKE_SOURCE_DIR}/src/algorithms/libs/rtklib ${CMAKE_SOURCE_DIR}/src/algorithms/data_type_adapter/adapters @@ -346,7 +347,7 @@ include_directories( ${GNSS_SDR_TEST_OPTIONAL_HEADERS} ) - +include_directories(${LIST_INCLUDE_DIRS}) ################################################################################ # Unit testing @@ -423,6 +424,38 @@ endif(ENABLE_FPGA) ################################################################################ # System testing ################################################################################ +function(add_system_test executable) + ## Please call this function with variables OPT_INCLUDES_ and OPT_LIBS_ + ## already defined. + set(SYSTEM_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/${executable}.cc) + # Ensure that executable is rebuilt if it was previously built and then removed + if(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/${executable}) + execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${SYSTEM_TEST_SOURCES}) + endif(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/${executable}) + add_executable(${executable} ${SYSTEM_TEST_SOURCES}) + + if(NOT ${GTEST_DIR_LOCAL}) + add_dependencies(${executable} gtest-${GNSSSDR_GTEST_LOCAL_VERSION} ) + else(NOT ${GTEST_DIR_LOCAL}) + add_dependencies(${executable} gtest) + endif(NOT ${GTEST_DIR_LOCAL}) + + include_directories(${OPT_INCLUDES_}) + target_link_libraries(${executable} ${OPT_LIBS_} ) + + if(ENABLE_INSTALL_TESTS) + if(EXISTS ${CMAKE_SOURCE_DIR}/install/${executable}) + file(REMOVE ${CMAKE_SOURCE_DIR}/install/${executable}) + endif(EXISTS ${CMAKE_SOURCE_DIR}/install/${executable}) + install(TARGETS ${executable} RUNTIME DESTINATION bin COMPONENT "${executable}_test") + else(ENABLE_INSTALL_TESTS) + add_custom_command(TARGET ${executable} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ + ${CMAKE_SOURCE_DIR}/install/$ ) + endif(ENABLE_INSTALL_TESTS) +endfunction(add_system_test) + + if(ENABLE_SYSTEM_TESTING) set(HOST_SYSTEM "Unknown") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") @@ -433,140 +466,33 @@ if(ENABLE_SYSTEM_TESTING) set(HOST_SYSTEM "MacOS") endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") add_definitions(-DHOST_SYSTEM="${HOST_SYSTEM}") - set(TTFF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/ttff_gps_l1.cc) - # Ensure that ttff is rebuilt if it was previously built and then removed - if(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/ttff) - execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${TTFF_SOURCES}) - endif(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/ttff) + #### TTFF + set(OPT_LIBS_ ${Boost_LIBRARIES} ${GFlags_LIBS} ${GLOG_LIBRARIES} + ${GNURADIO_RUNTIME_LIBRARIES} ${GTEST_LIBRARIES} + ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} + ${GNURADIO_ANALOG_LIBRARIES} gnss_sp_libs + gnss_rx gnss_system_parameters ) - add_executable(ttff ${TTFF_SOURCES} ) - if(NOT ${GTEST_DIR_LOCAL}) - add_dependencies(ttff gtest-${GNSSSDR_GTEST_LOCAL_VERSION}) - else(NOT ${GTEST_DIR_LOCAL}) - add_dependencies(ttff gtest) - endif(NOT ${GTEST_DIR_LOCAL}) - - target_link_libraries(ttff - ${Boost_LIBRARIES} - ${GFlags_LIBS} - ${GLOG_LIBRARIES} - ${GTEST_LIBRARIES} - ${GNURADIO_RUNTIME_LIBRARIES} - ${GNURADIO_BLOCKS_LIBRARIES} - ${GNURADIO_FILTER_LIBRARIES} - ${GNURADIO_ANALOG_LIBRARIES} - ${VOLK_GNSSSDR_LIBRARIES} - gnss_sp_libs - gnss_rx - gnss_system_parameters - ) - - if(ENABLE_INSTALL_TESTS) - if(EXISTS ${CMAKE_SOURCE_DIR}/install/ttff) - file(REMOVE ${CMAKE_SOURCE_DIR}/install/ttff) - endif(EXISTS ${CMAKE_SOURCE_DIR}/install/ttff) - install(TARGETS ttff RUNTIME DESTINATION bin COMPONENT "ttff") - else(ENABLE_INSTALL_TESTS) - add_custom_command(TARGET ttff POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ - ${CMAKE_SOURCE_DIR}/install/$ ) - endif(ENABLE_INSTALL_TESTS) + add_system_test(ttff) if(ENABLE_SYSTEM_TESTING_EXTRA) - set(POSITION_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/position_test.cc) - # Ensure that position_test is rebuilt if it was previously built and then removed - if(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/position_test) - execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${POSITION_TEST_SOURCES}) - endif(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/position_test) - add_executable(position_test ${POSITION_TEST_SOURCES}) - if(NOT ${GTEST_DIR_LOCAL}) - add_dependencies(position_test gtest-${GNSSSDR_GTEST_LOCAL_VERSION}) - else(NOT ${GTEST_DIR_LOCAL}) - add_dependencies(position_test gtest) - endif(NOT ${GTEST_DIR_LOCAL}) - target_link_libraries(position_test - ${Boost_LIBRARIES} - ${GFlags_LIBS} - ${GLOG_LIBRARIES} - ${GTEST_LIBRARIES} - ${GNURADIO_RUNTIME_LIBRARIES} - ${GNURADIO_BLOCKS_LIBRARIES} - ${GNURADIO_FILTER_LIBRARIES} - ${GNURADIO_ANALOG_LIBRARIES} - ${VOLK_GNSSSDR_LIBRARIES} - gnss_sp_libs - gnss_rx - gnss_system_parameters - ) + #### POSITION_TEST + set(OPT_LIBS_ ${Boost_LIBRARIES} ${GFlags_LIBS} ${GLOG_LIBRARIES} + ${GTEST_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} + ${GNURADIO_BLOCKS_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} + ${GNURADIO_ANALOG_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} + gnss_sp_libs gnss_rx gnss_system_parameters ) - if(ENABLE_INSTALL_TESTS) - if(EXISTS ${CMAKE_SOURCE_DIR}/install/position_test) - file(REMOVE ${CMAKE_SOURCE_DIR}/install/position_test) - endif(EXISTS ${CMAKE_SOURCE_DIR}/install/position_test) - install(TARGETS position_test RUNTIME DESTINATION bin COMPONENT "position_test") - else(ENABLE_INSTALL_TESTS) - add_custom_command(TARGET position_test POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ - ${CMAKE_SOURCE_DIR}/install/$ ) - endif(ENABLE_INSTALL_TESTS) + add_system_test(position_test) if(GPSTK_FOUND OR OWN_GPSTK) - set(OBS_GPS_L1_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/obs_gps_l1_system_test.cc) - # Ensure that obs_gps_l1_system_test is rebuilt if it was previously built and then removed - if(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/obs_gps_l1_system_test) - execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${OBS_GPS_L1_TEST_SOURCES}) - endif(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/obs_gps_l1_system_test) - add_executable(obs_gps_l1_system_test ${OBS_GPS_L1_TEST_SOURCES}) - - set(OBS_SYSTEM_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/obs_system_test.cc) - # Ensure that obs_system_test is rebuilt if it was previously built and then removed - if(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/obs_system_test) - execute_process(COMMAND ${CMAKE_COMMAND} -E touch ${OBS_SYSTEM_TEST_SOURCES}) - endif(NOT EXISTS ${CMAKE_SOURCE_DIR}/install/obs_system_test) - add_executable(obs_system_test ${OBS_SYSTEM_TEST_SOURCES}) - - if(NOT ${GTEST_DIR_LOCAL}) - add_dependencies(obs_gps_l1_system_test gtest-${GNSSSDR_GTEST_LOCAL_VERSION} ) - add_dependencies(obs_system_test gtest-${GNSSSDR_GTEST_LOCAL_VERSION} ) - else(NOT ${GTEST_DIR_LOCAL}) - add_dependencies(obs_gps_l1_system_test gtest) - add_dependencies(obs_system_test gtest) - endif(NOT ${GTEST_DIR_LOCAL}) - include_directories(${GPSTK_INCLUDE_DIRS} ${GPSTK_INCLUDE_DIRS}/gpstk) - target_link_libraries(obs_gps_l1_system_test ${GFlags_LIBS} - ${GLOG_LIBRARIES} - ${GTEST_LIBRARIES} - gnss_sp_libs - gnss_rx - ${gpstk_libs}) - - target_link_libraries(obs_system_test ${GFlags_LIBS} - ${GLOG_LIBRARIES} - ${GTEST_LIBRARIES} - gnss_sp_libs - gnss_rx - ${gpstk_libs}) - - if(ENABLE_INSTALL_TESTS) - if(EXISTS ${CMAKE_SOURCE_DIR}/install/obs_gps_l1_system_test) - file(REMOVE ${CMAKE_SOURCE_DIR}/install/obs_gps_l1_system_test) - endif(EXISTS ${CMAKE_SOURCE_DIR}/install/obs_gps_l1_system_test) - install(TARGETS obs_gps_l1_system_test RUNTIME DESTINATION bin COMPONENT "obs_gps_l1_system_test") - - if(EXISTS ${CMAKE_SOURCE_DIR}/install/obs_system_test) - file(REMOVE ${CMAKE_SOURCE_DIR}/install/obs_system_test) - endif(EXISTS ${CMAKE_SOURCE_DIR}/install/obs_system_test) - install(TARGETS obs_system_test RUNTIME DESTINATION bin COMPONENT "obs_system_test") - else(ENABLE_INSTALL_TESTS) - add_custom_command(TARGET obs_gps_l1_system_test POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ - ${CMAKE_SOURCE_DIR}/install/$ ) - add_custom_command(TARGET obs_system_test POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy $ - ${CMAKE_SOURCE_DIR}/install/$ ) - - endif(ENABLE_INSTALL_TESTS) + ## OBS_SYSTEM_TEST and OBS_GPS_L1_SYSTEM_TEST + set(OPT_LIBS_ ${GFlags_LIBS} ${GLOG_LIBRARIES} ${GTEST_LIBRARIES} + gnss_sp_libs gnss_rx ${gpstk_libs} ) + set(OPT_INCLUDES_ ${GPSTK_INCLUDE_DIRS} ${GPSTK_INCLUDE_DIRS}/gpstk) + add_system_test(obs_gps_l1_system_test) + add_system_test(obs_system_test) endif(GPSTK_FOUND OR OWN_GPSTK) else(ENABLE_SYSTEM_TESTING_EXTRA) # Avoid working with old executables if they were switched ON and then OFF diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 0c9e282a7..7d8b58106 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -47,7 +47,7 @@ #ifndef GNSS_SDR_GNUPLOT_I_H_ #define GNSS_SDR_GNUPLOT_I_H_ - +#include #include #include #include @@ -56,9 +56,12 @@ #include #include #include // for getenv() +#include // for strncpy #include #include // for std::list +#include +DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive testing."); #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) //defined for 32 and 64-bit environments @@ -67,7 +70,7 @@ #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) //all UNIX-like OSs (Linux, *BSD, MacOSX, Solaris, ...) #include // for access(), mkstemp() -#define GP_MAX_TMP_FILES 64 +#define GP_MAX_TMP_FILES 1024 #else #error unsupported or unknown operating system #endif @@ -215,6 +218,7 @@ public: const std::string &labely = "y", const std::string &labelz = "z"); + /// destructor: needed to delete temporary files ~Gnuplot(); @@ -243,6 +247,9 @@ public: /// sets terminal type to terminal_std Gnuplot &showonscreen(); // window output is set by default (win/x11/aqua) + /// sets terminal type to unknown (disable the screen output) + Gnuplot &disablescreen(); + /// saves a gnuplot session to a postscript file, filename without extension Gnuplot &savetops(const std::string &filename = "gnuplot_output"); @@ -300,9 +307,9 @@ public: /// /// \return <-- reference to the gnuplot object // ----------------------------------------------- - inline Gnuplot &set_multiplot() + inline Gnuplot &set_multiplot(int rows, int cols) { - cmd("set multiplot"); + cmd("set multiplot layout " + std::to_string(rows) + "," + std::to_string(cols)); //+ " rowfirst"); return *this; }; @@ -1192,6 +1199,17 @@ Gnuplot &Gnuplot::set_smooth(const std::string &stylestr) } +//------------------------------------------------------------------------------ +// +// Disable screen output +// +Gnuplot &Gnuplot::disablescreen() +{ + cmd("set output"); + cmd("set terminal unknown"); + return *this; +} + //------------------------------------------------------------------------------ // // sets terminal type to windows / x11 @@ -1904,11 +1922,11 @@ void Gnuplot::init() std::string tmp = Gnuplot::m_sGNUPlotPath + "/" + Gnuplot::m_sGNUPlotFileName; - // FILE *popen(const char *command, const char *mode); - // The popen() function shall execute the command specified by the string - // command, create a pipe between the calling program and the executed - // command, and return a pointer to a stream that can be used to either read - // from or write to the pipe. +// FILE *popen(const char *command, const char *mode); +// The popen() function shall execute the command specified by the string +// command, create a pipe between the calling program and the executed +// command, and return a pointer to a stream that can be used to either read +// from or write to the pipe. #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) gnucmd = _popen(tmp.c_str(), "w"); #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) @@ -1959,47 +1977,46 @@ bool Gnuplot::get_program_path() // // second look in PATH for Gnuplot // - char *path; + const char *path; // Retrieves a C string containing the value of environment variable PATH path = std::getenv("PATH"); - - if (path == NULL || std::char_traits::length(path) > 4096 * sizeof(char)) + std::stringstream s; + s << path; + if (s.fail()) { throw GnuplotException("Path is not set"); } - else + std::string path_str = s.str(); + + std::list ls; + +//split path (one long string) into list ls of strings +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) + stringtok(ls, path_str, ";"); +#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) + stringtok(ls, path_str, ":"); +#endif + + // scan list for Gnuplot program files + for (std::list::const_iterator i = ls.begin(); + i != ls.end(); ++i) { - std::list ls; - std::string path_str(path); - - //split path (one long string) into list ls of strings + tmp = (*i) + "/" + Gnuplot::m_sGNUPlotFileName; #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) - stringtok(ls, path_str, ";"); + if (Gnuplot::file_exists(tmp, 0)) // check existence #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) - stringtok(ls, path_str, ":"); + if (Gnuplot::file_exists(tmp, 1)) // check existence and execution permission #endif - - // scan list for Gnuplot program files - for (std::list::const_iterator i = ls.begin(); - i != ls.end(); ++i) { - tmp = (*i) + "/" + Gnuplot::m_sGNUPlotFileName; -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) - if (Gnuplot::file_exists(tmp, 0)) // check existence -#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) - if (Gnuplot::file_exists(tmp, 1)) // check existence and execution permission -#endif - { - Gnuplot::m_sGNUPlotPath = *i; // set m_sGNUPlotPath - return true; - } + Gnuplot::m_sGNUPlotPath = *i; // set m_sGNUPlotPath + return true; } - - tmp = "Can't find gnuplot neither in PATH nor in \"" + - Gnuplot::m_sGNUPlotPath + "\""; - Gnuplot::m_sGNUPlotPath = ""; - throw GnuplotException(tmp); } + + tmp = "Can't find gnuplot neither in PATH nor in \"" + + Gnuplot::m_sGNUPlotPath + "\""; + Gnuplot::m_sGNUPlotPath = ""; + throw GnuplotException(tmp); } @@ -2017,16 +2034,16 @@ bool Gnuplot::file_exists(const std::string &filename, int mode) return false; } - // int _access(const char *path, int mode); - // returns 0 if the file has the given mode, - // it returns -1 if the named file does not exist or is not accessible in - // the given mode - // mode = 0 (F_OK) (default): checks file for existence only - // mode = 1 (X_OK): execution permission - // mode = 2 (W_OK): write permission - // mode = 4 (R_OK): read permission - // mode = 6 : read and write permission - // mode = 7 : read, write and execution permission +// int _access(const char *path, int mode); +// returns 0 if the file has the given mode, +// it returns -1 if the named file does not exist or is not accessible in +// the given mode +// mode = 0 (F_OK) (default): checks file for existence only +// mode = 1 (X_OK): execution permission +// mode = 2 (W_OK): write permission +// mode = 4 (R_OK): read permission +// mode = 6 : read and write permission +// mode = 7 : read, write and execution permission #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) if (_access(filename.c_str(), mode) == 0) #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) @@ -2088,30 +2105,37 @@ std::string Gnuplot::create_tmpfile(std::ofstream &tmp) throw GnuplotException(except.str()); } - // int mkstemp(char *name); - // shall replace the contents of the string pointed to by "name" by a unique - // filename, and return a file descriptor for the file open for reading and - // writing. Otherwise, -1 shall be returned if no suitable file could be - // created. The string in template should look like a filename with six - // trailing 'X' s; mkstemp() replaces each 'X' with a character from the - // portable filename character set. The characters are chosen such that the - // resulting name does not duplicate the name of an existing file at the - // time of a call to mkstemp() +// int mkstemp(char *name); +// shall replace the contents of the string pointed to by "name" by a unique +// filename, and return a file descriptor for the file open for reading and +// writing. Otherwise, -1 shall be returned if no suitable file could be +// created. The string in template should look like a filename with six +// trailing 'X' s; mkstemp() replaces each 'X' with a character from the +// portable filename character set. The characters are chosen such that the +// resulting name does not duplicate the name of an existing file at the +// time of a call to mkstemp() + +// +// open temporary files for output +// - // - // open temporary files for output - // #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) if (_mktemp(name) == NULL) #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) + mode_t mask = umask(S_IXUSR | S_IRWXG | S_IRWXO); if (mkstemp(name) == -1) #endif { std::ostringstream except; except << "Cannot create temporary file \"" << name << "\""; +#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) + umask(mask); +#endif throw GnuplotException(except.str()); } - +#if defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) + umask(mask); +#endif tmp.open(name); if (tmp.bad()) { diff --git a/src/tests/common-files/signal_generator_flags.h b/src/tests/common-files/signal_generator_flags.h index cfc93b8d0..e65e98846 100644 --- a/src/tests/common-files/signal_generator_flags.h +++ b/src/tests/common-files/signal_generator_flags.h @@ -32,6 +32,7 @@ #define GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H_ #include +#include DEFINE_bool(disable_generator, false, "Disable the signal generator (a external signal file must be available for the test)"); DEFINE_string(generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary"); @@ -44,5 +45,6 @@ DEFINE_string(filename_raw_data, "signal_out.bin", "Filename of output raw data DEFINE_int32(fs_gen_sps, 2600000, "Sampling frequency [sps]"); DEFINE_int32(test_satellite_PRN, 1, "PRN of the satellite under test (must be visible during the observation time)"); DEFINE_int32(test_satellite_PRN2, 2, "PRN of the satellite under test (must be visible during the observation time)"); +DEFINE_double(CN0_dBHz, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 [dB-Hz]"); #endif diff --git a/src/tests/common-files/tracking_tests_flags.h b/src/tests/common-files/tracking_tests_flags.h new file mode 100644 index 000000000..a536af996 --- /dev/null +++ b/src/tests/common-files/tracking_tests_flags.h @@ -0,0 +1,75 @@ +/*! + * \file tracking_tests_flags.h + * \brief Helper file for unit testing + * \author Javier Arribas, 2018. jarribas(at)cttc.es + * + * ------------------------------------------------------------------------- + * + * 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 . + * + * ------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_TRACKING_TESTS_FLAGS_H_ +#define GNSS_SDR_TRACKING_TESTS_FLAGS_H_ + +#include +#include + +// Input signal configuration +DEFINE_bool(enable_external_signal_file, false, "Use an external signal file capture instead of the software-defined signal generator"); +DEFINE_string(signal_file, std::string("signal_out.bin"), "Path of the external signal capture file"); +DEFINE_double(CN0_dBHz_start, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 start sweep value [dB-Hz]"); +DEFINE_double(CN0_dBHz_stop, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 stop sweep value [dB-Hz]"); +DEFINE_double(CN0_dB_step, 3.0, "Noise generator CN0 sweep step value [dB]"); + +DEFINE_double(PLL_bw_hz_start, 40.0, "PLL Wide configuration start sweep value [Hz]"); +DEFINE_double(PLL_bw_hz_stop, 40.0, "PLL Wide configuration stop sweep value [Hz]"); +DEFINE_double(PLL_bw_hz_step, 5.0, "PLL Wide configuration sweep step value [Hz]"); + +DEFINE_double(DLL_bw_hz_start, 1.5, "DLL Wide configuration start sweep value [Hz]"); +DEFINE_double(DLL_bw_hz_stop, 1.5, "DLL Wide configuration stop sweep value [Hz]"); +DEFINE_double(DLL_bw_hz_step, 0.25, "DLL Wide configuration sweep step value [Hz]"); + +DEFINE_double(PLL_narrow_bw_hz, 5.0, "PLL Narrow configuration value [Hz]"); +DEFINE_double(DLL_narrow_bw_hz, 0.75, "DLL Narrow configuration value [Hz]"); + +DEFINE_double(acq_Doppler_error_hz_start, 1000.0, "Acquisition Doppler error start sweep value [Hz]"); +DEFINE_double(acq_Doppler_error_hz_stop, -1000.0, "Acquisition Doppler error stop sweep value [Hz]"); +DEFINE_double(acq_Doppler_error_hz_step, -50.0, "Acquisition Doppler error sweep step value [Hz]"); + +DEFINE_double(acq_Delay_error_chips_start, 2.0, "Acquisition Code Delay error start sweep value [Chips]"); +DEFINE_double(acq_Delay_error_chips_stop, -2.0, "Acquisition Code Delay error stop sweep value [Chips]"); +DEFINE_double(acq_Delay_error_chips_step, -0.1, "Acquisition Code Delay error sweep step value [Chips]"); + + +DEFINE_int32(plot_detail_level, 0, "Specify the desired plot detail (0,1,2): 0 - Minimum plots (default) 2 - Plot all tracking parameters"); + +//Emulated acquisition configuration + +//Tracking configuration +DEFINE_int32(extend_correlation_symbols, 1, "Set the tracking coherent correlation to N symbols (up to 20 for GPS L1 C/A)"); + +//Test output configuration +DEFINE_bool(plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot"); + + +#endif diff --git a/src/tests/system-tests/obs_gps_l1_system_test.cc b/src/tests/system-tests/obs_gps_l1_system_test.cc index 2cace8a00..7af66e15d 100644 --- a/src/tests/system-tests/obs_gps_l1_system_test.cc +++ b/src/tests/system-tests/obs_gps_l1_system_test.cc @@ -181,7 +181,6 @@ int ObsGpsL1SystemTest::configure_receiver() const float band1_error = 1.0; const float band2_error = 1.0; const int grid_density = 16; - const int decimation_factor = 1; const float zero = 0.0; const int number_of_channels = 8; @@ -204,7 +203,7 @@ int ObsGpsL1SystemTest::configure_receiver() const int extend_correlation_ms = 1; const int display_rate_ms = 500; - const int output_rate_ms = 100; + const int output_rate_ms = 10; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal)); @@ -265,7 +264,6 @@ int ObsGpsL1SystemTest::configure_receiver() // Set Acquisition config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); config->set_property("Acquisition_1C.item_type", "gr_complex"); - config->set_property("Acquisition_1C.if", std::to_string(zero)); config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); config->set_property("Acquisition_1C.threshold", std::to_string(threshold)); config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max)); @@ -280,7 +278,6 @@ int ObsGpsL1SystemTest::configure_receiver() config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); //config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking"); config->set_property("Tracking_1C.item_type", "gr_complex"); - config->set_property("Tracking_1C.if", std::to_string(zero)); config->set_property("Tracking_1C.dump", "false"); config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); config->set_property("Tracking_1C.pll_bw_hz", std::to_string(pll_bw_hz)); @@ -294,7 +291,6 @@ int ObsGpsL1SystemTest::configure_receiver() // Set Telemetry config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder"); config->set_property("TelemetryDecoder_1C.dump", "false"); - config->set_property("TelemetryDecoder_1C.decimation_factor", std::to_string(decimation_factor)); // Set Observables config->set_property("Observables.implementation", "Hybrid_Observables"); @@ -304,6 +300,7 @@ int ObsGpsL1SystemTest::configure_receiver() // Set PVT config->set_property("PVT.implementation", "RTKLIB_PVT"); + config->set_property("PVT.positioning_mode", "Single"); config->set_property("PVT.output_rate_ms", std::to_string(output_rate_ms)); config->set_property("PVT.display_rate_ms", std::to_string(display_rate_ms)); config->set_property("PVT.dump_filename", "./PVT"); diff --git a/src/tests/system-tests/obs_system_test.cc b/src/tests/system-tests/obs_system_test.cc index 2ce3bea48..391c2a969 100644 --- a/src/tests/system-tests/obs_system_test.cc +++ b/src/tests/system-tests/obs_system_test.cc @@ -620,7 +620,7 @@ void ObsSystemTest::compute_pseudorange_error( } g1.savetops("Pseudorange_error_" + signal_name); g1.savetopdf("Pseudorange_error_" + signal_name, 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output } catch (const GnuplotException& ge) { @@ -711,7 +711,7 @@ void ObsSystemTest::compute_carrierphase_error( } g1.savetops("Carrier_phase_error_" + signal_name); g1.savetopdf("Carrier_phase_error_" + signal_name, 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output } catch (const GnuplotException& ge) { @@ -802,7 +802,7 @@ void ObsSystemTest::compute_doppler_error( } g1.savetops("Doppler_error_" + signal_name); g1.savetopdf("Doppler_error_" + signal_name, 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output } catch (const GnuplotException& ge) { diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index b17f4de9d..00e64ccad 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -255,7 +255,6 @@ int StaticPositionSystemTest::configure_receiver() const float band1_error = 1.0; const float band2_error = 1.0; const int grid_density = 16; - const int decimation_factor = 1; const float zero = 0.0; const int number_of_channels = 8; @@ -278,7 +277,7 @@ int StaticPositionSystemTest::configure_receiver() const int extend_correlation_ms = 1; const int display_rate_ms = 500; - const int output_rate_ms = 500; + const int output_rate_ms = 100; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal)); @@ -337,7 +336,7 @@ int StaticPositionSystemTest::configure_receiver() config->set_property("Channel.signal", "1C"); // Set Acquisition - config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); + config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); config->set_property("Acquisition_1C.item_type", "gr_complex"); config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); config->set_property("Acquisition_1C.threshold", std::to_string(threshold)); @@ -348,6 +347,9 @@ int StaticPositionSystemTest::configure_receiver() config->set_property("Acquisition_1C.tong_init_val", std::to_string(tong_init_val)); config->set_property("Acquisition_1C.tong_max_val", std::to_string(tong_max_val)); config->set_property("Acquisition_1C.tong_max_dwells", std::to_string(tong_max_dwells)); + config->set_property("Acquisition_1C.dump", "false"); + config->set_property("Acquisition_1C.dump_filename", "./acquisition"); + config->set_property("Acquisition_1C.dump_channel", "1"); // Set Tracking config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); @@ -374,6 +376,7 @@ int StaticPositionSystemTest::configure_receiver() // Set PVT config->set_property("PVT.implementation", "RTKLIB_PVT"); + config->set_property("PVT.positioning_mode", "PPP_Static"); config->set_property("PVT.output_rate_ms", std::to_string(output_rate_ms)); config->set_property("PVT.display_rate_ms", std::to_string(display_rate_ms)); config->set_property("PVT.dump_filename", "./PVT"); @@ -385,7 +388,6 @@ int StaticPositionSystemTest::configure_receiver() config->set_property("PVT.rtcm_dump_devname", "/dev/pts/1"); config->set_property("PVT.dump", "false"); config->set_property("PVT.rinex_version", std::to_string(2)); - config->set_property("PVT.positioning_mode", "PPP_Static"); config->set_property("PVT.iono_model", "OFF"); config->set_property("PVT.trop_model", "OFF"); config->set_property("PVT.AR_GPS", "PPP-AR"); @@ -633,7 +635,7 @@ void StaticPositionSystemTest::print_results(const std::vector& east, g1.savetops("Position_test_2D"); g1.savetopdf("Position_test_2D", 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output Gnuplot g2("points"); g2.set_title("3D precision"); @@ -654,7 +656,7 @@ void StaticPositionSystemTest::print_results(const std::vector& east, g2.savetops("Position_test_3D"); g2.savetopdf("Position_test_3D"); - g2.showonscreen(); // window output + if (FLAGS_show_plots) g2.showonscreen(); // window output } catch (const GnuplotException& ge) { diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff.cc similarity index 97% rename from src/tests/system-tests/ttff_gps_l1.cc rename to src/tests/system-tests/ttff.cc index 2aaa39dee..2d5dbba44 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff.cc @@ -1,5 +1,5 @@ /*! - * \file ttff_gps_l1.cc + * \file ttff.cc * \brief This class implements a test for measuring * the Time-To-First-Fix * \author Carles Fernandez-Prades, 2016. cfernandez(at)cttc.es @@ -66,7 +66,6 @@ concurrent_queue global_gps_acq_assist_queue; concurrent_map global_gps_acq_assist_map; std::vector TTFF_v; -const int decimation_factor = 1; typedef struct { @@ -75,7 +74,7 @@ typedef struct } ttff_msgbuf; -class TfttGpsL1CATest : public ::testing::Test +class TtffTest : public ::testing::Test { public: void config_1(); @@ -124,7 +123,7 @@ public: }; -void TfttGpsL1CATest::config_1() +void TtffTest::config_1() { config = std::make_shared(); @@ -189,7 +188,6 @@ void TfttGpsL1CATest::config_1() // Set Acquisition config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Tong_Acquisition"); config->set_property("Acquisition_1C.item_type", "gr_complex"); - config->set_property("Acquisition_1C.if", std::to_string(zero)); config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); config->set_property("Acquisition_1C.threshold", std::to_string(threshold)); config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max)); @@ -203,7 +201,6 @@ void TfttGpsL1CATest::config_1() // Set Tracking config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); config->set_property("Tracking_1C.item_type", "gr_complex"); - config->set_property("Tracking_1C.if", std::to_string(zero)); config->set_property("Tracking_1C.dump", "false"); config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); config->set_property("Tracking_1C.pll_bw_hz", std::to_string(pll_bw_hz)); @@ -213,7 +210,6 @@ void TfttGpsL1CATest::config_1() // Set Telemetry config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder"); config->set_property("TelemetryDecoder_1C.dump", "false"); - config->set_property("TelemetryDecoder_1C.decimation_factor", std::to_string(decimation_factor)); // Set Observables config->set_property("Observables.implementation", "Hybrid_Observables"); @@ -222,6 +218,7 @@ void TfttGpsL1CATest::config_1() // Set PVT config->set_property("PVT.implementation", "RTKLIB_PVT"); + config->set_property("PVT.positioning_mode", "Single"); config->set_property("PVT.output_rate_ms", std::to_string(output_rate_ms)); config->set_property("PVT.display_rate_ms", std::to_string(display_rate_ms)); config->set_property("PVT.dump_filename", "./PVT"); @@ -235,7 +232,7 @@ void TfttGpsL1CATest::config_1() } -void TfttGpsL1CATest::config_2() +void TtffTest::config_2() { if (FLAGS_config_file_ttff.empty()) { @@ -300,7 +297,7 @@ void receive_msg() } -void TfttGpsL1CATest::print_TTFF_report(const std::vector &ttff_v, std::shared_ptr config_) +void TtffTest::print_TTFF_report(const std::vector &ttff_v, std::shared_ptr config_) { std::ofstream ttff_report_file; std::string filename = "ttff_report"; @@ -420,7 +417,7 @@ void TfttGpsL1CATest::print_TTFF_report(const std::vector &ttff_v, std:: } -TEST_F(TfttGpsL1CATest, ColdStart) +TEST_F(TtffTest, ColdStart) { unsigned int num_measurements = 0; @@ -503,7 +500,7 @@ TEST_F(TfttGpsL1CATest, ColdStart) } -TEST_F(TfttGpsL1CATest, HotStart) +TEST_F(TtffTest, HotStart) { unsigned int num_measurements = 0; TTFF_v.clear(); diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index beb94ef83..d8ba4cc6f 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -145,6 +145,7 @@ DECLARE_string(log_dir); #if EXTRA_TESTS #include "unit-tests/signal-processing-blocks/acquisition/gps_l2_m_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_l1_acq_performance_test.cc" #include "unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc" #include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc" #include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_kf_tracking_test.cc" diff --git a/src/tests/unit-tests/arithmetic/fft_length_test.cc b/src/tests/unit-tests/arithmetic/fft_length_test.cc index 7cf674c24..78961dd2b 100644 --- a/src/tests/unit-tests/arithmetic/fft_length_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_length_test.cc @@ -124,7 +124,7 @@ TEST(FFTLengthTest, MeasureExecutionTime) g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g1.savetops("FFT_execution_times_extended"); g1.savetopdf("FFT_execution_times_extended", 18); - g1.showonscreen(); // window output + if (FLAGS_show_plots) g1.showonscreen(); // window output Gnuplot g2("linespoints"); g2.set_title("FFT execution times for different lengths (up to 2^{14}=16384)"); @@ -136,7 +136,7 @@ TEST(FFTLengthTest, MeasureExecutionTime) g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g2.savetops("FFT_execution_times"); g2.savetopdf("FFT_execution_times", 18); - g2.showonscreen(); // window output + if (FLAGS_show_plots) g2.showonscreen(); // window output } catch (const GnuplotException& ge) { diff --git a/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc b/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc index 97a6524c9..1dfa028cf 100644 --- a/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc +++ b/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc @@ -209,7 +209,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaPcpsAcquisition) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); std::unique_ptr factory; - std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("GPS_L1_CA_PCPS_Acquisition", acquisition->implementation().c_str()); @@ -221,7 +221,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGpsL1CaPcpsQuickSyncAcquisition) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_QuickSync_Acquisition"); std::shared_ptr factory = std::make_shared(); - std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "GPS_L1_CA_PCPS_QuickSync_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("GPS_L1_CA_PCPS_QuickSync_Acquisition", acquisition->implementation().c_str()); @@ -232,7 +232,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1PcpsQuickSyncAmbiguousAcquisition std::shared_ptr configuration = std::make_shared(); configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition"); std::shared_ptr factory = std::make_shared(); - std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", acquisition->implementation().c_str()); @@ -244,7 +244,7 @@ TEST(GNSSBlockFactoryTest, InstantiateGalileoE1PcpsAmbiguousAcquisition) std::shared_ptr configuration = std::make_shared(); configuration->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition"); std::unique_ptr factory; - std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(configuration, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Acquisition", acquisition->role().c_str()); EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); @@ -323,7 +323,7 @@ TEST(GNSSBlockFactoryTest, InstantiateChannels) configuration->set_property("Channel1.item_type", "gr_complex"); gr::msg_queue::sptr queue = gr::msg_queue::make(0); std::unique_ptr factory; - std::unique_ptr>> channels = std::move(factory->GetChannels(configuration, queue)); + std::unique_ptr>> channels = factory->GetChannels(configuration, queue); EXPECT_EQ(static_cast(2), channels->size()); channels->erase(channels->begin(), channels->end()); } diff --git a/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc b/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc index c16c6361f..bca21b629 100644 --- a/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc +++ b/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc @@ -233,38 +233,22 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStopHybrid) config->set_property("Tracking_1B15.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking"); config->set_property("TelemetryDecoder_1C0.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1C0.decimation_factor", "4"); config->set_property("TelemetryDecoder_1C1.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1C1.decimation_factor", "4"); config->set_property("TelemetryDecoder_1C2.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1C2.decimation_factor", "4"); config->set_property("TelemetryDecoder_1C3.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1C3.decimation_factor", "4"); config->set_property("TelemetryDecoder_1C4.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1C4.decimation_factor", "4"); config->set_property("TelemetryDecoder_1C5.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1C5.decimation_factor", "4"); config->set_property("TelemetryDecoder_1C6.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1C6.decimation_factor", "4"); config->set_property("TelemetryDecoder_1C7.implementation", "GPS_L1_CA_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1C7.decimation_factor", "4"); config->set_property("TelemetryDecoder_1B8.implementation", "Galileo_E1B_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1B8.decimation_factor", "1"); config->set_property("TelemetryDecoder_1B9.implementation", "Galileo_E1B_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1B9.decimation_factor", "1"); config->set_property("TelemetryDecoder_1B10.implementation", "Galileo_E1B_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1B10.decimation_factor", "1"); config->set_property("TelemetryDecoder_1B11.implementation", "Galileo_E1B_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1B11.decimation_factor", "1"); config->set_property("TelemetryDecoder_1B12.implementation", "Galileo_E1B_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1B12.decimation_factor", "1"); config->set_property("TelemetryDecoder_1B13.implementation", "Galileo_E1B_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1B13.decimation_factor", "1"); config->set_property("TelemetryDecoder_1B14.implementation", "Galileo_E1B_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1B14.decimation_factor", "1"); config->set_property("TelemetryDecoder_1B15.implementation", "Galileo_E1B_Telemetry_Decoder"); - config->set_property("TelemetryDecoder_1B15.decimation_factor", "1"); config->set_property("Observables.implementation", "Hybrid_Observables"); config->set_property("PVT.implementation", "RTKLIB_PVT"); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index ebff28d0b..b2784c69f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -420,7 +420,7 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); } @@ -434,7 +434,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -484,7 +484,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1, queue); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0, queue); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -572,7 +572,7 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb config_2(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_8ms_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index efc44fa62..18ef7b8dc 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -423,7 +423,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); } @@ -437,7 +437,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) queue = gr::msg_queue::make(0); config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -466,7 +466,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -551,7 +551,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 3748c37cf..df03b85b7 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -204,7 +204,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoCTest::stop_queue() TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, Instantiate) { init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); EXPECT_STREQ("Galileo_E1_PCPS_Ambiguous_Acquisition", acquisition->implementation().c_str()); } @@ -220,7 +220,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue); @@ -251,7 +251,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) top_block = gr::make_top_block("Acquisition test"); init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc index 28d37556a..d4477ee8d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -209,7 +209,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() g1.savetops("Galileo_E1_acq_grid"); g1.savetopdf("Galileo_E1_acq_grid"); - g1.showonscreen(); + if (FLAGS_show_plots) g1.showonscreen(); } catch (const GnuplotException& ge) { @@ -227,7 +227,7 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate) { init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); } @@ -241,7 +241,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); gr::msg_queue::sptr queue = gr::msg_queue::make(0); init(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make(); @@ -283,7 +283,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) double expected_doppler_hz = -632; init(); top_block = gr::make_top_block("Acquisition test"); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 0); std::shared_ptr acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make(); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc index a193c8c4d..a2489cfe1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc @@ -243,7 +243,6 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::config_1() config->set_property("InputFilter.grid_density", "16"); config->set_property("Acquisition_1B.item_type", "gr_complex"); - config->set_property("Acquisition_1B.if", "0"); config->set_property("Acquisition_1B.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition_1B.max_dwells", "1"); @@ -424,7 +423,7 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::stop_queue() TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); } @@ -439,7 +438,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); @@ -468,7 +467,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); @@ -567,7 +566,7 @@ TEST_F(GalileoE1PcpsCccwsrAmbiguousAcquisitionTest, ValidationOfResultsProbabili config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_CCCWSR_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index 13b86aa6a..a8177c1a6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -548,7 +548,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::stop_queue() TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); } @@ -564,7 +564,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ConnectAndRun) config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); @@ -599,7 +599,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); @@ -690,7 +690,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); @@ -778,7 +778,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index 4f7bbea08..326b44f48 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -426,7 +426,7 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::stop_queue() TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, Instantiate) { config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); } @@ -439,7 +439,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); config_1(); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); ASSERT_NO_THROW({ @@ -466,7 +466,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); @@ -555,7 +555,7 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 1); + std::shared_ptr acq_ = factory->GetBlock(config, "Acquisition_1B", "Galileo_E1_PCPS_Tong_Ambiguous_Acquisition", 1, 0); acquisition = std::dynamic_pointer_cast(acq_); boost::shared_ptr msg_rx = GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index 52bafb284..2423257b6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -409,7 +409,6 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3() config->set_property("InputFilter.grid_density", "16"); config->set_property("Acquisition_5X.item_type", "gr_complex"); - config->set_property("Acquisition_5X.if", "0"); config->set_property("Acquisition_5X.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition_5X.max_dwells", "1"); @@ -528,7 +527,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::stop_queue() TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, Instantiate) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 0); } @@ -539,7 +538,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ConnectAndRun) int nsamples = 21000 * 3; std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 0); boost::shared_ptr msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); @@ -569,7 +568,7 @@ TEST_F(GalileoE5aPcpsAcquisitionGSoC2014GensourceTest, ValidationOfSIM) config_1(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_5X", 1, 0); boost::shared_ptr msg_rx = GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc index 4822dcccb..2f7c23a2c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc @@ -46,7 +46,7 @@ #include "glonass_l1_ca_pcps_acquisition.h" #include "signal_generator.h" #include "signal_generator_c.h" -#include "fir_filter.h" +#include "freq_xlating_fir_filter.h" #include "gen_signal_source.h" #include "gnss_sdr_valve.h" #include "boost/shared_ptr.hpp" @@ -226,7 +226,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_1() config->set_property("SignalSource.data_flag", "false"); config->set_property("SignalSource.BW_BB", "0.97"); - config->set_property("InputFilter.implementation", "Fir_Filter"); + config->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter"); config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); config->set_property("InputFilter.taps_item_type", "float"); @@ -244,9 +244,10 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_1() config->set_property("InputFilter.band2_error", "1.0"); config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); + config->set_property("InputFilter.sampling_frequency", std::to_string(fs_in)); + config->set_property("InputFilter.IF", "4000000"); config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "4000000"); config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition.max_dwells", "1"); @@ -314,7 +315,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_2() config->set_property("SignalSource.data_flag", "true"); config->set_property("SignalSource.BW_BB", "0.97"); - config->set_property("InputFilter.implementation", "Fir_Filter"); + config->set_property("InputFilter.implementation", "Freq_Xlating_Fir_Filter"); config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); config->set_property("InputFilter.taps_item_type", "float"); @@ -332,9 +333,10 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::config_2() config->set_property("InputFilter.band2_error", "1.0"); config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", "16"); + config->set_property("InputFilter.sampling_frequency", std::to_string(fs_in)); + config->set_property("InputFilter.IF", "4000000"); config->set_property("Acquisition.item_type", "gr_complex"); - config->set_property("Acquisition.if", "4000000"); config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition.max_dwells", "1"); @@ -429,7 +431,7 @@ void GlonassL1CaPcpsAcquisitionGSoC2017Test::stop_queue() TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, Instantiate) { config_1(); - acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); delete acquisition; } @@ -443,7 +445,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); config_1(); - acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); boost::shared_ptr msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -474,7 +476,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults) queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); boost::shared_ptr msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -505,12 +507,11 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResults) acquisition->init(); ASSERT_NO_THROW({ - boost::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); - signal_source->connect(top_block); - top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + signal_generator->connect(top_block); + top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0); + top_block->connect(filter->get_right_block(), 0, acquisition->get_left_block(), 0); }) << "Failure connecting the blocks of acquisition test."; // i = 0 --> satellite in acquisition is visible @@ -569,51 +570,43 @@ TEST_F(GlonassL1CaPcpsAcquisitionGSoC2017Test, ValidationOfResultsProbabilities) config_2(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GlonassL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); boost::shared_ptr msg_rx = GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ acquisition->set_channel(1); - }) << "Failure setting channel." - << std::endl; + }) << "Failure setting channel."; ASSERT_NO_THROW({ acquisition->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro." - << std::endl; + }) << "Failure setting gnss_synchro."; ASSERT_NO_THROW({ acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); - }) << "Failure setting doppler_max." - << std::endl; + }) << "Failure setting doppler_max."; ASSERT_NO_THROW({ acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); - }) << "Failure setting doppler_step." - << std::endl; + }) << "Failure setting doppler_step."; ASSERT_NO_THROW({ acquisition->set_threshold(config->property("Acquisition.threshold", 0.0)); - }) << "Failure setting threshold." - << std::endl; + }) << "Failure setting threshold."; ASSERT_NO_THROW({ acquisition->connect(top_block); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); - }) << "Failure connecting acquisition to the top_block." - << std::endl; + }) << "Failure connecting acquisition to the top_block."; acquisition->init(); ASSERT_NO_THROW({ - boost::shared_ptr signal_source; - SignalGenerator* signal_generator = new SignalGenerator(config.get(), "SignalSource", 0, 1, queue); - FirFilter* filter = new FirFilter(config.get(), "InputFilter", 1, 1); - signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); - signal_source->connect(top_block); - top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); - }) << "Failure connecting the blocks of acquisition test." - << std::endl; + std::shared_ptr signal_generator = std::make_shared(config.get(), "SignalSource", 0, 1, queue); + std::shared_ptr filter = std::make_shared(config.get(), "InputFilter", 1, 1); + signal_generator->connect(top_block); + top_block->connect(signal_generator->get_right_block(), 0, filter->get_left_block(), 0); + top_block->connect(filter->get_right_block(), 0, acquisition->get_left_block(), 0); + }) << "Failure connecting the blocks of acquisition test."; std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc index 04d37af1a..928bef457 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc @@ -46,6 +46,7 @@ #include "in_memory_configuration.h" #include "gnss_sdr_valve.h" #include "gnss_synchro.h" +#include "freq_xlating_fir_filter.h" #include "glonass_l1_ca_pcps_acquisition.h" @@ -138,8 +139,26 @@ void GlonassL1CaPcpsAcquisitionTest::init() signal.copy(gnss_synchro.Signal, 2, 0); gnss_synchro.PRN = 1; config->set_property("GNSS-SDR.internal_fs_sps", "62314000"); + config->set_property("InputFilter.IF", "9540000"); + config->set_property("InputFilter.input_item_type", "gr_complex"); + config->set_property("InputFilter.output_item_type", "gr_complex"); + config->set_property("InputFilter.taps_item_type", "float"); + config->set_property("InputFilter.number_of_taps", "11"); + config->set_property("InputFilter.number_of_bands", "2"); + config->set_property("InputFilter.band1_begin", "0.0"); + config->set_property("InputFilter.band1_end", "0.97"); + config->set_property("InputFilter.band2_begin", "0.98"); + config->set_property("InputFilter.band2_end", "1.0"); + config->set_property("InputFilter.ampl1_begin", "1.0"); + config->set_property("InputFilter.ampl1_end", "1.0"); + config->set_property("InputFilter.ampl2_begin", "0.0"); + config->set_property("InputFilter.ampl2_end", "0.0"); + config->set_property("InputFilter.band1_error", "1.0"); + config->set_property("InputFilter.band2_error", "1.0"); + config->set_property("InputFilter.filter_type", "bandpass"); + config->set_property("InputFilter.grid_density", "16"); + config->set_property("InputFilter.sampling_frequency", "62314000"); config->set_property("Acquisition_1G.item_type", "gr_complex"); - config->set_property("Acquisition_1G.if", "9540000"); config->set_property("Acquisition_1G.coherent_integration_time_ms", "1"); config->set_property("Acquisition_1G.dump", "true"); config->set_property("Acquisition_1G.dump_filename", "./acquisition"); @@ -155,7 +174,7 @@ void GlonassL1CaPcpsAcquisitionTest::init() TEST_F(GlonassL1CaPcpsAcquisitionTest, Instantiate) { init(); - boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1G", 1, 1); + boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1G", 1, 0); } @@ -169,7 +188,7 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); init(); - boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1G", 1, 1); + boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1G", 1, 0); boost::shared_ptr msg_rx = GlonassL1CaPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW({ @@ -201,8 +220,8 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ValidationOfResults) double expected_delay_samples = 31874; double expected_doppler_hz = -9500; init(); - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_1G", 1, 1); - + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_1G", 1, 0); + std::shared_ptr input_filter = std::make_shared(config.get(), "InputFilter", 1, 1); boost::shared_ptr msg_rx = GlonassL1CaPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW({ @@ -238,7 +257,8 @@ TEST_F(GlonassL1CaPcpsAcquisitionTest, ValidationOfResults) std::string file = path + "signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_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->connect(file_source, 0, input_filter->get_left_block(), 0); + top_block->connect(input_filter->get_right_block(), 0, acquisition->get_left_block(), 0); top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); }) << "Failure connecting the blocks of acquisition test."; diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc index f19aeceb0..c02f40558 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc @@ -245,7 +245,6 @@ void GlonassL2CaPcpsAcquisitionTest::config_1() config->set_property("InputFilter.grid_density", "16"); config->set_property("Acquisition_2G.item_type", "gr_complex"); - config->set_property("Acquisition_2G.if", "4000000"); config->set_property("Acquisition_2G.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition_2G.max_dwells", "1"); @@ -333,7 +332,6 @@ void GlonassL2CaPcpsAcquisitionTest::config_2() config->set_property("InputFilter.grid_density", "16"); config->set_property("Acquisition_2G.item_type", "gr_complex"); - config->set_property("Acquisition_2G.if", "4000000"); config->set_property("Acquisition_2G.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition_2G.max_dwells", "1"); @@ -428,7 +426,7 @@ void GlonassL2CaPcpsAcquisitionTest::stop_queue() TEST_F(GlonassL2CaPcpsAcquisitionTest, Instantiate) { config_1(); - acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); delete acquisition; } @@ -442,7 +440,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); config_1(); - acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 1); + acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0); boost::shared_ptr msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -473,7 +471,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResults) queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 1); + acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0); boost::shared_ptr msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -568,7 +566,7 @@ TEST_F(GlonassL2CaPcpsAcquisitionTest, ValidationOfResultsProbabilities) config_2(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 1); + acquisition = new GlonassL2CaPcpsAcquisition(config.get(), "Acquisition_2G", 1, 0); boost::shared_ptr msg_rx = GlonassL2CaPcpsAcquisitionTest_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc new file mode 100644 index 000000000..a92c228b9 --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_acq_performance_test.cc @@ -0,0 +1,900 @@ +/*! + * \file gps_l1_acq_performance_test.cc + * \brief This class implements an acquisition performance test + * \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.cat + * + * + * ------------------------------------------------------------------------- + * + * 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 "test_flags.h" +#include "signal_generator_flags.h" +#include "tracking_true_obs_reader.h" +#include "true_observables_reader.h" +#include "display.h" +#include "gnuplot_i.h" +#include +#include +#include +#include + +DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test."); +DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used."); + +DEFINE_int32(acq_test_doppler_max, 5000, "Maximum Doppler, in Hz"); +DEFINE_int32(acq_test_doppler_step, 125, "Doppler step, in Hz."); +DEFINE_int32(acq_test_coherent_time_ms, 1, "Acquisition coherent time, in ms"); +DEFINE_int32(acq_test_max_dwells, 1, "Number of non-coherent integrations"); +DEFINE_bool(acq_test_use_CFAR_algorithm, true, "Use CFAR algorithm"); +DEFINE_bool(acq_test_bit_transition_flag, false, "Bit transition flag"); + +DEFINE_int32(acq_test_signal_duration_s, 2, "Generated signal duration, in s"); +DEFINE_int32(acq_test_num_meas, 0, "Number of measurements per run. 0 means the complete file."); +DEFINE_double(acq_test_cn0_init, 33.0, "Initial CN0, in dBHz."); +DEFINE_double(acq_test_cn0_final, 45.0, "Final CN0, in dBHz."); +DEFINE_double(acq_test_cn0_step, 3.0, "CN0 step, in dB."); + +DEFINE_double(acq_test_threshold_init, 11.0, "Initial acquisition threshold"); +DEFINE_double(acq_test_threshold_final, 16.0, "Final acquisition threshold"); +DEFINE_double(acq_test_threshold_step, 1.0, "Acquisition threshold step"); + +DEFINE_double(acq_test_pfa_init, 1e-5, "Set initial threshold via probability of false alarm. Disable with -1.0"); + +DEFINE_int32(acq_test_PRN, 1, "PRN number of a present satellite"); +DEFINE_int32(acq_test_fake_PRN, 33, "PRN number of a non-present satellite"); + +DEFINE_int32(acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)"); +DEFINE_bool(plot_acq_test, false, "Plots results with gnuplot, if available"); + +// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +class AcqPerfTest_msg_rx; + +typedef boost::shared_ptr AcqPerfTest_msg_rx_sptr; + +AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue& queue); + +class AcqPerfTest_msg_rx : public gr::block +{ +private: + friend AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue& queue); + void msg_handler_events(pmt::pmt_t msg); + AcqPerfTest_msg_rx(concurrent_queue& queue); + concurrent_queue& channel_internal_queue; + +public: + int rx_message; + ~AcqPerfTest_msg_rx(); +}; + + +AcqPerfTest_msg_rx_sptr AcqPerfTest_msg_rx_make(concurrent_queue& queue) +{ + return AcqPerfTest_msg_rx_sptr(new AcqPerfTest_msg_rx(queue)); +} + + +void AcqPerfTest_msg_rx::msg_handler_events(pmt::pmt_t msg) +{ + try + { + long int message = pmt::to_long(msg); + rx_message = message; + channel_internal_queue.push(rx_message); + } + catch (boost::bad_any_cast& e) + { + LOG(WARNING) << "msg_handler_telemetry Bad any cast!"; + rx_message = 0; + } +} + + +AcqPerfTest_msg_rx::AcqPerfTest_msg_rx(concurrent_queue& queue) : gr::block("AcqPerfTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), channel_internal_queue(queue) +{ + this->message_port_register_in(pmt::mp("events")); + this->set_msg_handler(pmt::mp("events"), boost::bind(&AcqPerfTest_msg_rx::msg_handler_events, this, _1)); + rx_message = 0; +} + + +AcqPerfTest_msg_rx::~AcqPerfTest_msg_rx() +{ +} + +// ----------------------------------------- + + +class AcquisitionPerformanceTest : public ::testing::Test +{ +protected: + AcquisitionPerformanceTest() + { + config = std::make_shared(); + item_size = sizeof(gr_complex); + gnss_synchro = Gnss_Synchro(); + doppler_max = static_cast(FLAGS_acq_test_doppler_max); + doppler_step = static_cast(FLAGS_acq_test_doppler_step); + stop = false; + if (FLAGS_acq_test_input_file.empty()) + { + cn0_vector.push_back(FLAGS_acq_test_cn0_init); + double aux = FLAGS_acq_test_cn0_init + FLAGS_acq_test_cn0_step; + while (aux <= FLAGS_acq_test_cn0_final) + { + cn0_vector.push_back(aux); + aux = aux + FLAGS_acq_test_cn0_step; + } + } + else + { + cn0_vector = {0.0}; + } + init(); + + if (FLAGS_acq_test_pfa_init > 0.0) + { + pfa_vector.push_back(FLAGS_acq_test_pfa_init); + float aux = 1.0; + while ((FLAGS_acq_test_pfa_init * std::pow(10, aux)) < 1) + { + pfa_vector.push_back(FLAGS_acq_test_pfa_init * std::pow(10, aux)); + aux = aux + 1.0; + } + pfa_vector.push_back(1.0); + } + else + { + float aux = static_cast(FLAGS_acq_test_threshold_init); + pfa_vector.push_back(aux); + aux = aux + static_cast(FLAGS_acq_test_threshold_step); + while (aux <= static_cast(FLAGS_acq_test_threshold_final)) + { + pfa_vector.push_back(aux); + aux = aux + static_cast(FLAGS_acq_test_threshold_step); + } + } + + num_thresholds = pfa_vector.size(); + + int aux2 = ((generated_signal_duration_s * 1000 - FLAGS_acq_test_coherent_time_ms) / FLAGS_acq_test_coherent_time_ms); + if ((FLAGS_acq_test_num_meas > 0) and (FLAGS_acq_test_num_meas < aux2)) + { + num_of_measurements = static_cast(FLAGS_acq_test_num_meas); + } + else + { + num_of_measurements = static_cast(aux2); + } + + Pd.resize(cn0_vector.size()); + for (int i = 0; i < static_cast(cn0_vector.size()); i++) Pd[i].reserve(num_thresholds); + Pfa.resize(cn0_vector.size()); + for (int i = 0; i < static_cast(cn0_vector.size()); i++) Pfa[i].reserve(num_thresholds); + Pd_correct.resize(cn0_vector.size()); + for (int i = 0; i < static_cast(cn0_vector.size()); i++) Pd_correct[i].reserve(num_thresholds); + } + + ~AcquisitionPerformanceTest() + { + } + + + std::vector cn0_vector; + std::vector pfa_vector; + + int N_iterations = FLAGS_acq_test_iterations; + void init(); + + int configure_generator(double cn0); + int generate_signal(); + int configure_receiver(double cn0, float pfa, unsigned int iter); + void start_queue(); + void wait_message(); + void process_message(); + void stop_queue(); + int run_receiver(); + int count_executions(const std::string& basename, unsigned int sat); + void check_results(); + void plot_results(); + + concurrent_queue channel_internal_queue; + + gr::msg_queue::sptr queue; + gr::top_block_sptr top_block; + std::shared_ptr acquisition; + std::shared_ptr config; + std::shared_ptr config_f; + Gnss_Synchro gnss_synchro; + size_t item_size; + unsigned int doppler_max; + unsigned int doppler_step; + bool stop; + + int message; + boost::thread ch_thread; + + std::string implementation = "GPS_L1_CA_PCPS_Acquisition"; + + const double baseband_sampling_freq = static_cast(FLAGS_fs_gen_sps); + const int coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; + const int in_acquisition = 1; + const int dump_channel = 0; + + int generated_signal_duration_s = FLAGS_acq_test_signal_duration_s; + unsigned int num_of_measurements; + unsigned int measurement_counter = 0; + + unsigned int observed_satellite = FLAGS_acq_test_PRN; + std::string path_str = "./acq-perf-test"; + + int num_thresholds; + + std::vector> Pd; + std::vector> Pfa; + std::vector> Pd_correct; + +private: + std::string generator_binary; + std::string p1; + std::string p2; + std::string p3; + std::string p4; + std::string p5; + std::string p6; + + std::string filename_rinex_obs = FLAGS_filename_rinex_obs; + std::string filename_raw_data = FLAGS_filename_raw_data; + + double compute_stdev_precision(const std::vector& vec); + double compute_stdev_accuracy(const std::vector& vec, double ref); +}; + + +void AcquisitionPerformanceTest::init() +{ + gnss_synchro.Channel_ID = 0; + gnss_synchro.System = 'G'; + std::string signal = "1C"; + signal.copy(gnss_synchro.Signal, 2, 0); + gnss_synchro.PRN = observed_satellite; + message = 0; + measurement_counter = 0; +} + + +void AcquisitionPerformanceTest::start_queue() +{ + stop = false; + ch_thread = boost::thread(&AcquisitionPerformanceTest::wait_message, this); +} + + +void AcquisitionPerformanceTest::wait_message() +{ + while (!stop) + { + channel_internal_queue.wait_and_pop(message); + process_message(); + } +} + + +void AcquisitionPerformanceTest::process_message() +{ + measurement_counter++; + acquisition->reset(); + acquisition->set_state(1); + std::cout << "Progress: " << round(static_cast(measurement_counter) / static_cast(num_of_measurements) * 100.0) << "% \r" << std::flush; + if (measurement_counter == num_of_measurements) + { + stop_queue(); + top_block->stop(); + } +} + + +void AcquisitionPerformanceTest::stop_queue() +{ + stop = true; +} + + +int AcquisitionPerformanceTest::configure_generator(double cn0) +{ + // Configure signal generator + generator_binary = FLAGS_generator_binary; + + p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file; + if (FLAGS_dynamic_position.empty()) + { + p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(std::min(generated_signal_duration_s * 10, 3000)); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position); + } + p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(cn0); + return 0; +} + + +int AcquisitionPerformanceTest::generate_signal() +{ + pid_t wait_result; + int child_status; + std::cout << "Generating signal for " << p6 << "..." << std::endl; + char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], &p6[0], NULL}; + + int pid; + if ((pid = fork()) == -1) + perror("fork error"); + else if (pid == 0) + { + execv(&generator_binary[0], parmList); + std::cout << "Return not expected. Must be an execv error." << std::endl; + std::terminate(); + } + + wait_result = waitpid(pid, &child_status, 0); + if (wait_result == -1) perror("waitpid error"); + return 0; +} + + +int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsigned int iter) +{ + if (FLAGS_config_file_ptest.empty()) + { + config = std::make_shared(); + const int sampling_rate_internal = baseband_sampling_freq; + + config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal)); + + // Set Acquisition + config->set_property("Acquisition_1C.implementation", implementation); + config->set_property("Acquisition_1C.item_type", "gr_complex"); + config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max)); + config->set_property("Acquisition_1C.doppler_step", std::to_string(doppler_step)); + + config->set_property("Acquisition_1C.threshold", std::to_string(pfa)); + //if (FLAGS_acq_test_pfa_init > 0.0) config->supersede_property("Acquisition_1C.pfa", std::to_string(pfa)); + if (FLAGS_acq_test_pfa_init > 0.0) + { + config->supersede_property("Acquisition_1C.pfa", std::to_string(pfa)); + } + if (FLAGS_acq_test_use_CFAR_algorithm) + { + config->set_property("Acquisition_1C.use_CFAR_algorithm", "true"); + } + else + { + config->set_property("Acquisition_1C.use_CFAR_algorithm", "false"); + } + + config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); + if (FLAGS_acq_test_bit_transition_flag) + { + config->set_property("Acquisition_1C.bit_transition_flag", "true"); + } + else + { + config->set_property("Acquisition_1C.bit_transition_flag", "false"); + } + + config->set_property("Acquisition_1C.max_dwells", std::to_string(FLAGS_acq_test_max_dwells)); + + config->set_property("Acquisition_1C.repeat_satellite", "true"); + + config->set_property("Acquisition_1C.blocking", "true"); + config->set_property("Acquisition_1C.make_two_steps", "false"); + config->set_property("Acquisition_1C.second_nbins", std::to_string(4)); + config->set_property("Acquisition_1C.second_doppler_step", std::to_string(125)); + + config->set_property("Acquisition_1C.dump", "true"); + std::string dump_file = path_str + std::string("/acquisition_") + std::to_string(cn0) + "_" + std::to_string(iter) + "_" + std::to_string(pfa); + config->set_property("Acquisition_1C.dump_filename", dump_file); + config->set_property("Acquisition_1C.dump_channel", std::to_string(dump_channel)); + config->set_property("Acquisition_1C.blocking_on_standby", "true"); + + config_f = 0; + } + else + { + config_f = std::make_shared(FLAGS_config_file_ptest); + config = 0; + } + return 0; +} + + +int AcquisitionPerformanceTest::run_receiver() +{ + std::string file; + if (FLAGS_acq_test_input_file.empty()) + { + file = "./" + filename_raw_data; + } + else + { + file = FLAGS_acq_test_input_file; + } + const char* file_name = file.c_str(); + gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); + + gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); + + top_block = gr::make_top_block("Acquisition test"); + boost::shared_ptr msg_rx = AcqPerfTest_msg_rx_make(channel_internal_queue); + + queue = gr::msg_queue::make(0); + gnss_synchro = Gnss_Synchro(); + init(); + + int nsamples = floor(config->property("GNSS-SDR.internal_fs_sps", 2000000) * generated_signal_duration_s); + boost::shared_ptr valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue); + + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); + acquisition->set_gnss_synchro(&gnss_synchro); + acquisition->set_channel(0); + acquisition->set_local_code(); + acquisition->set_doppler_max(config->property("Acquisition_1C.doppler_max", 10000)); + acquisition->set_doppler_step(config->property("Acquisition_1C.doppler_step", 500)); + acquisition->set_threshold(config->property("Acquisition_1C.threshold", 0.0)); + acquisition->set_state(1); // Ensure that acquisition starts at the first sample + acquisition->connect(top_block); + top_block->msg_connect(acquisition->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); + + acquisition->init(); + + top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); + top_block->connect(gr_interleaved_char_to_complex, 0, valve, 0); + top_block->connect(valve, 0, acquisition->get_left_block(), 0); + + start_queue(); + + top_block->run(); // Start threads and wait + +#ifdef OLD_BOOST + ch_thread.timed_join(boost::posix_time::seconds(1)); +#endif +#ifndef OLD_BOOST + ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); +#endif + + return 0; +} + + +int AcquisitionPerformanceTest::count_executions(const std::string& basename, unsigned int sat) +{ + FILE* fp; + std::string argum2 = std::string("/usr/bin/find ") + path_str + std::string(" -maxdepth 1 -name ") + basename.substr(path_str.length() + 1, basename.length() - path_str.length()) + std::string("* | grep sat_") + std::to_string(sat) + std::string(" | wc -l"); + char buffer[1024]; + fp = popen(&argum2[0], "r"); + int num_executions = 1; + if (fp == NULL) + { + std::cout << "Failed to run command: " << argum2 << std::endl; + return 0; + } + while (fgets(buffer, sizeof(buffer), fp) != NULL) + { + std::string aux = std::string(buffer); + EXPECT_EQ(aux.empty(), false); + num_executions = std::stoi(aux); + } + pclose(fp); + return num_executions; +} + + +void AcquisitionPerformanceTest::plot_results() +{ + if (FLAGS_plot_acq_test == true) + { + const std::string gnuplot_executable(FLAGS_gnuplot_executable); + if (gnuplot_executable.empty()) + { + std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE," << std::endl; + std::cout << "gnuplot has not been found in your system." << std::endl; + std::cout << "Test results will not be plotted." << std::endl; + } + else + { + try + { + boost::filesystem::path p(gnuplot_executable); + boost::filesystem::path dir = p.parent_path(); + std::string gnuplot_path = dir.native(); + Gnuplot::set_GNUPlotPath(gnuplot_path); + + Gnuplot g1("linespoints"); + g1.cmd("set font \"Times,18\""); + g1.set_title("Receiver Operating Characteristic for GPS L1 C/A acquisition"); + g1.cmd("set label 1 \"" + std::string("Coherent integration time: ") + std::to_string(config->property("Acquisition_1C.coherent_integration_time_ms", 1)) + " ms, Non-coherent integrations: " + std::to_string(config->property("Acquisition_1C.max_dwells", 1)) + " \" at screen 0.12, 0.83 font \"Times,16\""); + g1.cmd("set logscale x"); + g1.cmd("set yrange [0:1]"); + g1.cmd("set xrange[0.0001:1]"); + g1.cmd("set grid mxtics"); + g1.cmd("set grid ytics"); + g1.set_xlabel("Pfa"); + g1.set_ylabel("Pd"); + g1.set_grid(); + g1.cmd("show grid"); + for (int i = 0; i < static_cast(cn0_vector.size()); i++) + { + std::vector Pd_i; + std::vector Pfa_i; + for (int k = 0; k < num_thresholds; k++) + { + Pd_i.push_back(Pd[i][k]); + Pfa_i.push_back(Pfa[i][k]); + } + g1.plot_xy(Pfa_i, Pd_i, "CN0 = " + std::to_string(static_cast(cn0_vector[i])) + " dBHz"); + } + g1.set_legend(); + g1.savetops("ROC"); + g1.savetopdf("ROC", 18); + if (FLAGS_show_plots) g1.showonscreen(); // window output + + Gnuplot g2("linespoints"); + g2.cmd("set font \"Times,18\""); + g2.set_title("Receiver Operating Characteristic for GPS L1 C/A valid acquisition"); + g2.cmd("set label 1 \"" + std::string("Coherent integration time: ") + std::to_string(config->property("Acquisition_1C.coherent_integration_time_ms", 1)) + " ms, Non-coherent integrations: " + std::to_string(config->property("Acquisition_1C.max_dwells", 1)) + " \" at screen 0.12, 0.83 font \"Times,16\""); + g2.cmd("set logscale x"); + g2.cmd("set yrange [0:1]"); + g2.cmd("set xrange[0.0001:1]"); + g2.cmd("set grid mxtics"); + g2.cmd("set grid ytics"); + g2.set_xlabel("Pfa"); + g2.set_ylabel("Valid Pd"); + g2.set_grid(); + g2.cmd("show grid"); + for (int i = 0; i < static_cast(cn0_vector.size()); i++) + { + std::vector Pd_i_correct; + std::vector Pfa_i; + for (int k = 0; k < num_thresholds; k++) + { + Pd_i_correct.push_back(Pd_correct[i][k]); + Pfa_i.push_back(Pfa[i][k]); + } + g2.plot_xy(Pfa_i, Pd_i_correct, "CN0 = " + std::to_string(static_cast(cn0_vector[i])) + " dBHz"); + } + g2.set_legend(); + g2.savetops("ROC-valid-detection"); + g2.savetopdf("ROC-valid-detection", 18); + if (FLAGS_show_plots) g2.showonscreen(); // window output + } + catch (const GnuplotException& ge) + { + std::cout << ge.what() << std::endl; + } + } + } +} + + +TEST_F(AcquisitionPerformanceTest, ROC) +{ + tracking_true_obs_reader true_trk_data; + + if (boost::filesystem::exists(path_str)) + { + boost::filesystem::remove_all(path_str); + } + boost::system::error_code ec; + ASSERT_TRUE(boost::filesystem::create_directory(path_str, ec)) << "Could not create the " << path_str << " folder."; + + unsigned int cn0_index = 0; + for (std::vector::const_iterator it = cn0_vector.cbegin(); it != cn0_vector.cend(); ++it) + { + std::vector meas_Pd_; + std::vector meas_Pd_correct_; + std::vector meas_Pfa_; + + if (FLAGS_acq_test_input_file.empty()) std::cout << "Execution for CN0 = " << *it << " dB-Hz" << std::endl; + + // Do N_iterations of the experiment + for (int pfa_iter = 0; pfa_iter < static_cast(pfa_vector.size()); pfa_iter++) + { + if (FLAGS_acq_test_pfa_init > 0.0) + { + std::cout << "Setting threshold for Pfa = " << pfa_vector[pfa_iter] << std::endl; + } + else + { + std::cout << "Setting threshold to " << pfa_vector[pfa_iter] << std::endl; + } + + // Configure the signal generator + if (FLAGS_acq_test_input_file.empty()) configure_generator(*it); + + for (int iter = 0; iter < N_iterations; iter++) + { + // Generate signal raw signal samples and observations RINEX file + if (FLAGS_acq_test_input_file.empty()) generate_signal(); + + for (unsigned k = 0; k < 2; k++) + { + if (k == 0) + { + observed_satellite = FLAGS_acq_test_PRN; + } + else + { + observed_satellite = FLAGS_acq_test_fake_PRN; + } + init(); + + // Configure the receiver + configure_receiver(*it, pfa_vector[pfa_iter], iter); + + // Run it + run_receiver(); + + // count executions + std::string basename = path_str + std::string("/acquisition_") + std::to_string(*it) + "_" + std::to_string(iter) + "_" + std::to_string(pfa_vector[pfa_iter]) + "_" + gnss_synchro.System + "_1C"; + int num_executions = count_executions(basename, observed_satellite); + + // Read measured data + int ch = config->property("Acquisition_1C.dump_channel", 0); + arma::vec meas_timestamp_s = arma::zeros(num_executions, 1); + arma::vec meas_doppler = arma::zeros(num_executions, 1); + arma::vec positive_acq = arma::zeros(num_executions, 1); + arma::vec meas_acq_delay_chips = arma::zeros(num_executions, 1); + + double coh_time_ms = config->property("Acquisition_1C.coherent_integration_time_ms", 1); + + std::cout << "Num executions: " << num_executions << std::endl; + for (int execution = 1; execution <= num_executions; execution++) + { + acquisition_dump_reader acq_dump(basename, observed_satellite, config->property("Acquisition_1C.doppler_max", 0), config->property("Acquisition_1C.doppler_step", 0), config->property("GNSS-SDR.internal_fs_sps", 0) * GPS_L1_CA_CODE_PERIOD * static_cast(coh_time_ms), ch, execution); + acq_dump.read_binary_acq(); + if (acq_dump.positive_acq) + { + //std::cout << "Meas acq_delay_samples: " << acq_dump.acq_delay_samples << " chips: " << acq_dump.acq_delay_samples / (baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD / GPS_L1_CA_CODE_LENGTH_CHIPS) << std::endl; + meas_timestamp_s(execution - 1) = acq_dump.sample_counter / baseband_sampling_freq; + meas_doppler(execution - 1) = acq_dump.acq_doppler_hz; + meas_acq_delay_chips(execution - 1) = acq_dump.acq_delay_samples / (baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD / GPS_L1_CA_CODE_LENGTH_CHIPS); + positive_acq(execution - 1) = acq_dump.positive_acq; + } + else + { + //std::cout << "Failed acquisition." << std::endl; + meas_timestamp_s(execution - 1) = arma::datum::inf; + meas_doppler(execution - 1) = arma::datum::inf; + meas_acq_delay_chips(execution - 1) = arma::datum::inf; + positive_acq(execution - 1) = acq_dump.positive_acq; + } + } + + // Read reference data + std::string true_trk_file = std::string("./gps_l1_ca_obs_prn"); + true_trk_file.append(std::to_string(observed_satellite)); + true_trk_file.append(".dat"); + true_trk_data.close_obs_file(); + true_trk_data.open_obs_file(true_trk_file); + + // load the true values + long int n_true_epochs = true_trk_data.num_epochs(); + arma::vec true_timestamp_s = arma::zeros(n_true_epochs, 1); + arma::vec true_acc_carrier_phase_cycles = arma::zeros(n_true_epochs, 1); + arma::vec true_Doppler_Hz = arma::zeros(n_true_epochs, 1); + arma::vec true_prn_delay_chips = arma::zeros(n_true_epochs, 1); + arma::vec true_tow_s = arma::zeros(n_true_epochs, 1); + + long int epoch_counter = 0; + int num_clean_executions = 0; + while (true_trk_data.read_binary_obs()) + { + true_timestamp_s(epoch_counter) = true_trk_data.signal_timestamp_s; + true_acc_carrier_phase_cycles(epoch_counter) = true_trk_data.acc_carrier_phase_cycles; + true_Doppler_Hz(epoch_counter) = true_trk_data.doppler_l1_hz; + true_prn_delay_chips(epoch_counter) = GPS_L1_CA_CODE_LENGTH_CHIPS - true_trk_data.prn_delay_chips; + true_tow_s(epoch_counter) = true_trk_data.tow; + epoch_counter++; + //std::cout << "True PRN_Delay chips = " << GPS_L1_CA_CODE_LENGTH_CHIPS - true_trk_data.prn_delay_chips << " at " << true_trk_data.signal_timestamp_s << std::endl; + } + + // Process results + arma::vec clean_doppler_estimation_error; + arma::vec clean_delay_estimation_error; + + if (epoch_counter > 2) + { + arma::vec true_interpolated_doppler = arma::zeros(num_executions, 1); + arma::vec true_interpolated_prn_delay_chips = arma::zeros(num_executions, 1); + interp1(true_timestamp_s, true_Doppler_Hz, meas_timestamp_s, true_interpolated_doppler); + interp1(true_timestamp_s, true_prn_delay_chips, meas_timestamp_s, true_interpolated_prn_delay_chips); + + arma::vec doppler_estimation_error = true_interpolated_doppler - meas_doppler; + arma::vec delay_estimation_error = true_interpolated_prn_delay_chips - (meas_acq_delay_chips - ((1.0 / baseband_sampling_freq) / GPS_L1_CA_CHIP_PERIOD)); // compensate 1 sample delay + + // Cut measurements without reference + for (int i = 0; i < num_executions; i++) + { + if (!std::isnan(doppler_estimation_error(i)) and !std::isnan(delay_estimation_error(i))) + { + num_clean_executions++; + } + } + clean_doppler_estimation_error = arma::zeros(num_clean_executions, 1); + clean_delay_estimation_error = arma::zeros(num_clean_executions, 1); + num_clean_executions = 0; + for (int i = 0; i < num_executions; i++) + { + if (!std::isnan(doppler_estimation_error(i)) and !std::isnan(delay_estimation_error(i))) + { + clean_doppler_estimation_error(num_clean_executions) = doppler_estimation_error(i); + clean_delay_estimation_error(num_clean_executions) = delay_estimation_error(i); + num_clean_executions++; + } + } + + /* std::cout << "Doppler estimation error [Hz]: "; + for (int i = 0; i < num_executions - 1; i++) + { + std::cout << doppler_estimation_error(i) << " "; + } + std::cout << std::endl; + + std::cout << "Delay estimation error [chips]: "; + for (int i = 0; i < num_executions - 1; i++) + { + std::cout << delay_estimation_error(i) << " "; + + } + std::cout << std::endl; */ + } + if (k == 0) + { + double detected = arma::accu(positive_acq); + double computed_Pd = detected / static_cast(num_executions); + if (num_executions > 0) + { + meas_Pd_.push_back(computed_Pd); + } + else + { + meas_Pd_.push_back(0.0); + } + std::cout << TEXT_BOLD_BLACK << "Probability of detection for channel=" << ch << ", CN0=" << *it << " dBHz" + << ": " << (num_executions > 0 ? computed_Pd : 0.0) << TEXT_RESET << std::endl; + } + if (num_clean_executions > 0) + { + arma::vec correct_acq = arma::zeros(num_executions, 1); + double correctly_detected = 0.0; + for (int i = 0; i < num_clean_executions - 1; i++) + + { + if (abs(clean_delay_estimation_error(i)) < 0.5 and abs(clean_doppler_estimation_error(i)) < static_cast(config->property("Acquisition_1C.doppler_step", 1)) / 2.0) + { + correctly_detected = correctly_detected + 1.0; + } + } + double computed_Pd_correct = correctly_detected / static_cast(num_clean_executions); + meas_Pd_correct_.push_back(computed_Pd_correct); + std::cout << TEXT_BOLD_BLACK << "Probability of correct detection for channel=" << ch << ", CN0=" << *it << " dBHz" + << ": " << computed_Pd_correct << TEXT_RESET << std::endl; + } + else + { + //std::cout << "No reference data has been found. Maybe a non-present satellite?" << num_executions << std::endl; + if (k == 1) + { + double wrongly_detected = arma::accu(positive_acq); + double computed_Pfa = wrongly_detected / static_cast(num_executions); + if (num_executions > 0) + { + meas_Pfa_.push_back(computed_Pfa); + } + else + { + meas_Pfa_.push_back(0.0); + } + std::cout << TEXT_BOLD_BLACK << "Probability of false alarm for channel=" << ch << ", CN0=" << *it << " dBHz" + << ": " << (num_executions > 0 ? computed_Pfa : 0.0) << TEXT_RESET << std::endl; + } + } + true_trk_data.restart(); + } + } + true_trk_data.close_obs_file(); + float sum_pd = static_cast(std::accumulate(meas_Pd_.begin(), meas_Pd_.end(), 0.0)); + float sum_pd_correct = static_cast(std::accumulate(meas_Pd_correct_.begin(), meas_Pd_correct_.end(), 0.0)); + float sum_pfa = static_cast(std::accumulate(meas_Pfa_.begin(), meas_Pfa_.end(), 0.0)); + if (meas_Pd_.size() > 0 and meas_Pfa_.size() > 0) + { + Pd[cn0_index][pfa_iter] = sum_pd / static_cast(meas_Pd_.size()); + Pfa[cn0_index][pfa_iter] = sum_pfa / static_cast(meas_Pfa_.size()); + } + else + { + if (meas_Pd_.size() > 0) + { + Pd[cn0_index][pfa_iter] = sum_pd / static_cast(meas_Pd_.size()); + } + else + { + Pd[cn0_index][pfa_iter] = 0.0; + } + if (meas_Pfa_.size() > 0) + { + Pfa[cn0_index][pfa_iter] = sum_pfa / static_cast(meas_Pfa_.size()); + } + else + { + Pfa[cn0_index][pfa_iter] = 0.0; + } + } + if (meas_Pd_correct_.size() > 0) + { + Pd_correct[cn0_index][pfa_iter] = sum_pd_correct / static_cast(meas_Pd_correct_.size()); + } + else + { + Pd_correct[cn0_index][pfa_iter] = 0.0; + } + meas_Pd_.clear(); + meas_Pfa_.clear(); + meas_Pd_correct_.clear(); + } + cn0_index++; + } + + // Compute results + unsigned int aux_index = 0; + for (std::vector::const_iterator it = cn0_vector.cbegin(); it != cn0_vector.cend(); ++it) + { + std::cout << "Results for CN0 = " << *it << " dBHz:" << std::endl; + std::cout << "Pd = "; + for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++) + { + std::cout << Pd[aux_index][pfa_iter] << " "; + } + std::cout << std::endl; + std::cout << "Pd_correct = "; + for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++) + { + std::cout << Pd_correct[aux_index][pfa_iter] << " "; + } + std::cout << std::endl; + std::cout << "Pfa = "; + for (int pfa_iter = 0; pfa_iter < num_thresholds; pfa_iter++) + { + std::cout << Pfa[aux_index][pfa_iter] << " "; + } + std::cout << std::endl; + + aux_index++; + } + + plot_results(); +} diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc index bb00e62bf..419538dcd 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc @@ -423,7 +423,7 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::stop_queue() TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, Instantiate) { config_1(); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 1); + acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition", 1, 0); delete acquisition; } @@ -437,7 +437,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); config_1(); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1); + acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -468,7 +468,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResults) queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1); + acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -563,7 +563,7 @@ TEST_F(GpsL1CaPcpsAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) config_2(); queue = gr::msg_queue::make(0); top_block = gr::make_top_block("Acquisition test"); - acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 1); + acquisition = new GpsL1CaPcpsAcquisition(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index b2b2ca866..e9ee38210 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -160,6 +160,7 @@ void GpsL1CaPcpsAcquisitionTest::init() config->set_property("Acquisition_1C.dump", "false"); } config->set_property("Acquisition_1C.dump_filename", "./tmp-acq-gps1/acquisition"); + config->set_property("Acquisition_1C.dump_channel", "1"); config->set_property("Acquisition_1C.threshold", "0.00001"); config->set_property("Acquisition_1C.doppler_max", std::to_string(doppler_max)); config->set_property("Acquisition_1C.doppler_step", std::to_string(doppler_step)); @@ -175,7 +176,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() unsigned int sat = static_cast(gnss_synchro.PRN); unsigned int samples_per_code = static_cast(round(4000000 / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS))); // !! - acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code); + 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; @@ -209,7 +210,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() g1.savetops("GPS_L1_acq_grid"); g1.savetopdf("GPS_L1_acq_grid"); - g1.showonscreen(); + if (FLAGS_show_plots) g1.showonscreen(); } catch (const GnuplotException &ge) { @@ -227,7 +228,7 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() TEST_F(GpsL1CaPcpsAcquisitionTest, Instantiate) { init(); - boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1C", 1, 1); + boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1C", 1, 0); } @@ -241,7 +242,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ConnectAndRun) top_block = gr::make_top_block("Acquisition test"); init(); - boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1C", 1, 1); + boost::shared_ptr acquisition = boost::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW({ @@ -285,7 +286,7 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) boost::filesystem::create_directory(data_str); } - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW({ diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc index 0f319a208..f2ee949dc 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc @@ -422,7 +422,7 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::stop_queue() TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, Instantiate) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); } @@ -433,7 +433,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ConnectAndRun) std::chrono::duration elapsed_seconds(0); config_1(); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -460,7 +460,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -542,7 +542,7 @@ TEST_F(GpsL1CaPcpsOpenClAcquisitionGSoC2013Test, ValidationOfResultsProbabilitie { config_2(); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index 5e1d072cd..faf3f433f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -534,7 +534,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::stop_queue() TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, Instantiate) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); } @@ -548,7 +548,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ConnectAndRun) boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); config_1(); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); ASSERT_NO_THROW({ acquisition->connect(top_block); @@ -575,7 +575,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResults) config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -669,7 +669,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsWithNoise config_1(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -760,7 +760,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc index ef1502cd5..d5383e16c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc @@ -419,7 +419,7 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::stop_queue() TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, Instantiate) { config_1(); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); } @@ -432,7 +432,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ConnectAndRun) queue = gr::msg_queue::make(0); config_1(); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -461,7 +461,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResults) top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ @@ -549,7 +549,7 @@ TEST_F(GpsL1CaPcpsTongAcquisitionGSoC2013Test, ValidationOfResultsProbabilities) config_2(); top_block = gr::make_top_block("Acquisition test"); queue = gr::msg_queue::make(0); - acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 1); + acquisition = std::make_shared(config.get(), "Acquisition_1C", 1, 0); boost::shared_ptr msg_rx = GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_make(channel_internal_queue); ASSERT_NO_THROW({ diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc index 952ed26a2..7092fac26 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc @@ -163,7 +163,8 @@ void GpsL2MPcpsAcquisitionTest::init() { config->set_property("Acquisition_2S.dump", "false"); } - config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition"); + config->set_property("Acquisition_2S.dump_filename", "./tmp-acq-gps2/acquisition_test"); + config->set_property("Acquisition_2S.dump_channel", "1"); config->set_property("Acquisition_2S.threshold", "0.001"); config->set_property("Acquisition_2S.doppler_max", std::to_string(doppler_max)); config->set_property("Acquisition_2S.doppler_step", std::to_string(doppler_step)); @@ -175,11 +176,11 @@ void GpsL2MPcpsAcquisitionTest::init() void GpsL2MPcpsAcquisitionTest::plot_grid() { //load the measured values - std::string basename = "./tmp-acq-gps2/acquisition_G_2S"; + std::string basename = "./tmp-acq-gps2/acquisition_test_G_2S"; unsigned int sat = static_cast(gnss_synchro.PRN); unsigned int samples_per_code = static_cast(floor(static_cast(sampling_frequency_hz) / (GPS_L2_M_CODE_RATE_HZ / static_cast(GPS_L2_M_CODE_LENGTH_CHIPS)))); - acquisition_dump_reader acq_dump(basename, sat, doppler_max, doppler_step, samples_per_code); + 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; @@ -212,7 +213,7 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() g1.savetops("GPS_L2CM_acq_grid"); g1.savetopdf("GPS_L2CM_acq_grid"); - g1.showonscreen(); + if (FLAGS_show_plots) g1.showonscreen(); } catch (const GnuplotException &ge) { @@ -231,7 +232,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, Instantiate) { init(); queue = gr::msg_queue::make(0); - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 1); + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 0); } @@ -243,7 +244,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun) queue = gr::msg_queue::make(0); init(); - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 1); + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 0); ASSERT_NO_THROW({ acquisition->connect(top_block); @@ -285,7 +286,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) } init(); - std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 1); + std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition_2S", 1, 0); boost::shared_ptr msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make(); ASSERT_NO_THROW({ diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc index 9095f93df..51181dd2f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc @@ -227,7 +227,7 @@ TEST_F(FirFilterTest, ConnectAndRunGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue)); + boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); source->connect(top_block); boost::shared_ptr null_sink = gr::blocks::null_sink::make(item_size); @@ -268,7 +268,7 @@ TEST_F(FirFilterTest, ConnectAndRunCshorts) ASSERT_NO_THROW({ filter->connect(top_block); - boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue)); + boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); source->connect(top_block); interleaved_short_to_complex_short_sptr ishort_to_cshort_ = make_interleaved_short_to_complex_short(); @@ -312,7 +312,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbytes) ASSERT_NO_THROW({ filter->connect(top_block); - boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue)); + boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); source->connect(top_block); interleaved_byte_to_complex_byte_sptr ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte(); @@ -356,7 +356,7 @@ TEST_F(FirFilterTest, ConnectAndRunCbyteGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue)); + boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); source->connect(top_block); interleaved_byte_to_complex_byte_sptr ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte(); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc index e2be9358a..8c5e02dbb 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc @@ -150,7 +150,7 @@ TEST_F(NotchFilterLiteTest, ConnectAndRunGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue)); + boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); source->connect(top_block); boost::shared_ptr null_sink = gr::blocks::null_sink::make(item_size); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc index c879a2b75..9db3593a6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc @@ -150,7 +150,7 @@ TEST_F(NotchFilterTest, ConnectAndRunGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue)); + boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); source->connect(top_block); boost::shared_ptr null_sink = gr::blocks::null_sink::make(item_size); diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc b/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc index a23bb4385..0ca1840aa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc @@ -149,7 +149,7 @@ TEST_F(PulseBlankingFilterTest, ConnectAndRunGrcomplex) ASSERT_NO_THROW({ filter->connect(top_block); - boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 1, 1, queue)); + boost::shared_ptr source(new FileSignalSource(config2.get(), "Test_Source", 0, 1, queue)); source->connect(top_block); boost::shared_ptr null_sink = gr::blocks::null_sink::make(item_size); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc index 32b6de6e2..8cb81718b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc @@ -43,7 +43,7 @@ bool acquisition_dump_reader::read_binary_acq() std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl; return false; } - matvar_t* var_ = Mat_VarRead(matfile, "grid"); + matvar_t* var_ = Mat_VarRead(matfile, "acq_grid"); if (var_ == NULL) { std::cout << "¡¡¡Unreachable grid variable into Acquisition dump file!!!" << std::endl; @@ -73,16 +73,56 @@ bool acquisition_dump_reader::read_binary_acq() Mat_Close(matfile); return false; } + matvar_t* var2_ = Mat_VarRead(matfile, "doppler_max"); + d_doppler_max = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "doppler_step"); + d_doppler_step = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "input_power"); + input_power = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "acq_doppler_hz"); + acq_doppler_hz = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "acq_delay_samples"); + acq_delay_samples = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "test_statistic"); + test_statistic = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "threshold"); + threshold = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "sample_counter"); + sample_counter = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "d_positive_acq"); + positive_acq = *static_cast(var2_->data); + Mat_VarFree(var2_); + + var2_ = Mat_VarRead(matfile, "PRN"); + PRN = *static_cast(var2_->data); + Mat_VarFree(var2_); + std::vector >::iterator it1; std::vector::iterator it2; float* aux = static_cast(var_->data); int k = 0; - float normalization_factor = std::pow(d_samples_per_code, 2); + float normalization_factor = std::pow(d_samples_per_code, 4) * input_power; for (it1 = mag.begin(); it1 != mag.end(); it1++) { for (it2 = it1->begin(); it2 != it1->end(); it2++) { - *it2 = static_cast(std::sqrt(aux[k])) / normalization_factor; + *it2 = static_cast(aux[k]) / normalization_factor; k++; } } @@ -93,17 +133,74 @@ bool acquisition_dump_reader::read_binary_acq() } -acquisition_dump_reader::acquisition_dump_reader(const std::string& basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code) +acquisition_dump_reader::acquisition_dump_reader(const std::string& basename, + int channel, + int execution) +{ + unsigned int sat_ = 0; + unsigned int doppler_max_ = 0; + unsigned int doppler_step_ = 0; + unsigned int samples_per_code_ = 0; + + mat_t* matfile = Mat_Open(d_dump_filename.c_str(), MAT_ACC_RDONLY); + if (matfile != NULL) + { + matvar_t* var_ = Mat_VarRead(matfile, "doppler_max"); + doppler_max_ = *static_cast(var_->data); + Mat_VarFree(var_); + + var_ = Mat_VarRead(matfile, "doppler_step"); + doppler_step_ = *static_cast(var_->data); + Mat_VarFree(var_); + + var_ = Mat_VarRead(matfile, "PRN"); + sat_ = *static_cast(var_->data); + Mat_VarFree(var_); + + var_ = Mat_VarRead(matfile, "grid"); + samples_per_code_ = var_->dims[0]; + Mat_VarFree(var_); + + Mat_Close(matfile); + } + else + { + std::cout << "¡¡¡Unreachable Acquisition dump file!!!" << std::endl; + } + acquisition_dump_reader(basename, + sat_, + doppler_max_, + doppler_step_, + samples_per_code_, + channel, + execution); +} + +acquisition_dump_reader::acquisition_dump_reader(const std::string& basename, + unsigned int sat, + unsigned int doppler_max, + unsigned int doppler_step, + unsigned int samples_per_code, + int channel, + int execution) { d_basename = basename; d_sat = sat; d_doppler_max = doppler_max; d_doppler_step = doppler_step; d_samples_per_code = samples_per_code; + acq_doppler_hz = 0.0; + acq_delay_samples = 0.0; + test_statistic = 0.0; + input_power = 0.0; + threshold = 0.0; + positive_acq = 0; + sample_counter = 0; + PRN = 0; d_num_doppler_bins = static_cast(ceil(static_cast(static_cast(d_doppler_max) - static_cast(-d_doppler_max)) / static_cast(d_doppler_step))); std::vector > mag_aux(d_num_doppler_bins, std::vector(d_samples_per_code)); mag = mag_aux; - d_dump_filename = d_basename + "_sat_" + std::to_string(d_sat) + ".mat"; + d_dump_filename = d_basename + "_ch_" + std::to_string(channel) + "_" + std::to_string(execution) + "_sat_" + std::to_string(d_sat) + ".mat"; for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) { doppler.push_back(-static_cast(d_doppler_max) + d_doppler_step * doppler_index); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h index 7dd8ee44b..3958b98b2 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h @@ -38,13 +38,33 @@ class acquisition_dump_reader { public: - acquisition_dump_reader(const std::string& basename, unsigned int sat, unsigned int doppler_max, unsigned int doppler_step, unsigned int samples_per_code); + acquisition_dump_reader(const std::string& basename, + unsigned int sat, + unsigned int doppler_max, + unsigned int doppler_step, + unsigned int samples_per_code, + int channel = 0, + int execution = 1); + + acquisition_dump_reader(const std::string& basename, + int channel = 0, + int execution = 1); + ~acquisition_dump_reader(); + bool read_binary_acq(); std::vector doppler; std::vector samples; std::vector > mag; + float acq_doppler_hz; + float acq_delay_samples; + float test_statistic; + float input_power; + float threshold; + int positive_acq; + unsigned int PRN; + long unsigned int sample_counter; private: std::string d_basename; diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc index 72a40389d..eb0cb8fac 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc @@ -97,7 +97,6 @@ bool observables_dump_reader::open_obs_file(std::string out_file) d_dump_filename = out_file; d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); - std::cout << "Observables sum file opened, Log file: " << d_dump_filename.c_str() << std::endl; return true; } catch (const std::ifstream::failure &e) @@ -112,6 +111,13 @@ bool observables_dump_reader::open_obs_file(std::string out_file) } } +void observables_dump_reader::close_obs_file() +{ + if (d_dump_file.is_open() == false) + { + d_dump_file.close(); + } +} observables_dump_reader::observables_dump_reader(int n_channels_) { diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h index 41c7a60f2..c87062eaf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h +++ b/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h @@ -44,6 +44,7 @@ public: bool restart(); long int num_epochs(); bool open_obs_file(std::string out_file); + void close_obs_file(); //dump variables diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc index 502c99ea5..ff82a6a01 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc @@ -109,7 +109,6 @@ bool tracking_dump_reader::open_obs_file(std::string out_file) d_dump_filename = out_file; d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); - std::cout << "Tracking dump enabled, Log file: " << d_dump_filename.c_str() << std::endl; return true; } catch (const std::ifstream::failure &e) diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc index 8b1f91c65..b2e00a1e8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc @@ -89,15 +89,15 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file) { try { + d_dump_file.clear(); d_dump_filename = out_file; d_dump_file.exceptions(std::ifstream::failbit | std::ifstream::badbit); d_dump_file.open(d_dump_filename.c_str(), std::ios::in | std::ios::binary); - std::cout << "Observables dump enabled, Log file: " << d_dump_filename.c_str() << std::endl; return true; } catch (const std::ifstream::failure &e) { - std::cout << "Problem opening Observables dump Log file: " << d_dump_filename.c_str() << std::endl; + std::cout << "Problem opening Tracking dump Log file: " << d_dump_filename.c_str() << " Error: " << e.what() << std::endl; return false; } } @@ -107,6 +107,13 @@ bool tracking_true_obs_reader::open_obs_file(std::string out_file) } } +void tracking_true_obs_reader::close_obs_file() +{ + if (d_dump_file.is_open() == true) + { + d_dump_file.close(); + } +} tracking_true_obs_reader::~tracking_true_obs_reader() { diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h index 9c4a5db7c..84bd2d7b0 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h +++ b/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h @@ -43,6 +43,7 @@ public: bool restart(); long int num_epochs(); bool open_obs_file(std::string out_file); + void close_obs_file(); bool d_dump; double signal_timestamp_s; diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc b/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc index 445f6a91a..a08b401c2 100644 --- a/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc @@ -35,12 +35,128 @@ #include "nmea_printer.h" -TEST(NmeaPrinterTest, PrintLine) +class NmeaPrinterTest : public ::testing::Test +{ +protected: + NmeaPrinterTest() + { + this->conf(); + } + ~NmeaPrinterTest() + { + } + void conf(); + rtk_t rtk; +}; + +void NmeaPrinterTest::conf() +{ + snrmask_t snrmask = {{}, {{}, {}}}; + int positioning_mode = 0; // Single + int number_of_frequencies = 1; + double elevation_mask = 5; + int navigation_system = 1; // GPS + int integer_ambiguity_resolution_gps = 0; + int integer_ambiguity_resolution_glo = 0; + int integer_ambiguity_resolution_bds = 0; + int outage_reset_ambiguity = 5; + int min_lock_to_fix_ambiguity = 0; + int iono_model = 0; + int trop_model = 0; + int dynamics_model = 0; + int earth_tide = 0; + int number_filter_iter = 1; + double code_phase_error_ratio_l1 = 100.0; + double code_phase_error_ratio_l2 = 100.0; + double code_phase_error_ratio_l5 = 100.0; + double carrier_phase_error_factor_a = 0.003; + double carrier_phase_error_factor_b = 0.003; + double bias_0 = 30.0; + double iono_0 = 0.03; + double trop_0 = 0.3; + double sigma_bias = 1e-4; + double sigma_iono = 1e-3; + double sigma_trop = 1e-4; + double sigma_acch = 1e-1; + double sigma_accv = 1e-2; + double sigma_pos = 0.0; + double min_ratio_to_fix_ambiguity = 3.0; + double min_elevation_to_fix_ambiguity = 0.0; + double slip_threshold = 0.05; + double threshold_reject_innovation = 30.0; + double threshold_reject_gdop = 30.0; + int sat_PCV = 0; + int rec_PCV = 0; + int phwindup = 0; + int reject_GPS_IIA = 0; + int raim_fde = 0; + + prcopt_t rtklib_configuration_options = { + positioning_mode, /* positioning mode (PMODE_XXX) see src/algorithms/libs/rtklib/rtklib.h */ + 0, /* solution type (0:forward,1:backward,2:combined) */ + number_of_frequencies, /* number of frequencies (1:L1, 2:L1+L2, 3:L1+L2+L5)*/ + navigation_system, /* navigation system */ + elevation_mask * D2R, /* elevation mask angle (degrees) */ + snrmask, /* snrmask_t snrmask SNR mask */ + 0, /* satellite ephemeris/clock (EPHOPT_XXX) */ + integer_ambiguity_resolution_gps, /* AR mode (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */ + integer_ambiguity_resolution_glo, /* GLONASS AR mode (0:off,1:on,2:auto cal,3:ext cal) */ + integer_ambiguity_resolution_bds, /* BeiDou AR mode (0:off,1:on) */ + outage_reset_ambiguity, /* obs outage count to reset bias */ + min_lock_to_fix_ambiguity, /* min lock count to fix ambiguity */ + 10, /* min fix count to hold ambiguity */ + 1, /* max iteration to resolve ambiguity */ + iono_model, /* ionosphere option (IONOOPT_XXX) */ + trop_model, /* troposphere option (TROPOPT_XXX) */ + dynamics_model, /* dynamics model (0:none, 1:velocity, 2:accel) */ + earth_tide, /* earth tide correction (0:off,1:solid,2:solid+otl+pole) */ + number_filter_iter, /* number of filter iteration */ + 0, /* code smoothing window size (0:none) */ + 0, /* interpolate reference obs (for post mission) */ + 0, /* sbssat_t sbssat SBAS correction options */ + 0, /* sbsion_t sbsion[MAXBAND+1] SBAS satellite selection (0:all) */ + 0, /* rover position for fixed mode */ + 0, /* base position for relative mode */ + /* 0:pos in prcopt, 1:average of single pos, */ + /* 2:read from file, 3:rinex header, 4:rtcm pos */ + {code_phase_error_ratio_l1, code_phase_error_ratio_l2, code_phase_error_ratio_l5}, /* eratio[NFREQ] code/phase error ratio */ + {100.0, carrier_phase_error_factor_a, carrier_phase_error_factor_b, 0.0, 1.0}, /* err[5]: measurement error factor [0]:reserved, [1-3]:error factor a/b/c of phase (m) , [4]:doppler frequency (hz) */ + {bias_0, iono_0, trop_0}, /* std[3]: initial-state std [0]bias,[1]iono [2]trop*/ + {sigma_bias, sigma_iono, sigma_trop, sigma_acch, sigma_accv, sigma_pos}, /* prn[6] process-noise std */ + 5e-12, /* sclkstab: satellite clock stability (sec/sec) */ + {min_ratio_to_fix_ambiguity, 0.9999, 0.25, 0.1, 0.05, 0.0, 0.0, 0.0}, /* thresar[8]: AR validation threshold */ + min_elevation_to_fix_ambiguity, /* elevation mask of AR for rising satellite (deg) */ + 0.0, /* elevation mask to hold ambiguity (deg) */ + slip_threshold, /* slip threshold of geometry-free phase (m) */ + 30.0, /* max difference of time (sec) */ + threshold_reject_innovation, /* reject threshold of innovation (m) */ + threshold_reject_gdop, /* reject threshold of gdop */ + {}, /* double baseline[2] baseline length constraint {const,sigma} (m) */ + {}, /* double ru[3] rover position for fixed mode {x,y,z} (ecef) (m) */ + {}, /* double rb[3] base position for relative mode {x,y,z} (ecef) (m) */ + {"", ""}, /* char anttype[2][MAXANT] antenna types {rover,base} */ + {{}, {}}, /* double antdel[2][3] antenna delta {{rov_e,rov_n,rov_u},{ref_e,ref_n,ref_u}} */ + {}, /* pcv_t pcvr[2] receiver antenna parameters {rov,base} */ + {}, /* unsigned char exsats[MAXSAT] excluded satellites (1:excluded, 2:included) */ + 0, /* max averaging epoches */ + 0, /* initialize by restart */ + 1, /* output single by dgps/float/fix/ppp outage */ + {"", ""}, /* char rnxopt[2][256] rinex options {rover,base} */ + {sat_PCV, rec_PCV, phwindup, reject_GPS_IIA, raim_fde}, /* posopt[6] positioning options [0]: satellite and receiver antenna PCV model; [1]: interpolate antenna parameters; [2]: apply phase wind-up correction for PPP modes; [3]: exclude measurements of GPS Block IIA satellites satellite [4]: RAIM FDE (fault detection and exclusion) [5]: handle day-boundary clock jump */ + 0, /* solution sync mode (0:off,1:on) */ + {{}, {}}, /* odisp[2][6*11] ocean tide loading parameters {rov,base} */ + {{}, {{}, {}}, {{}, {}}, {}, {}}, /* exterr_t exterr extended receiver error model */ + 0, /* disable L2-AR */ + {} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */ + }; + + rtkinit(&rtk, &rtklib_configuration_options); +} + + +TEST_F(NmeaPrinterTest, PrintLine) { std::string filename("nmea_test.nmea"); - rtk_t rtk; - prcopt_t rtklib_configuration_options; - rtkinit(&rtk, &rtklib_configuration_options); std::shared_ptr pvt_solution = std::make_shared(12, "filename", false, rtk); boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19), @@ -76,12 +192,9 @@ TEST(NmeaPrinterTest, PrintLine) } -TEST(NmeaPrinterTest, PrintLineLessthan10min) +TEST_F(NmeaPrinterTest, PrintLineLessthan10min) { std::string filename("nmea_test.nmea"); - rtk_t rtk; - prcopt_t rtklib_configuration_options; - rtkinit(&rtk, &rtklib_configuration_options); std::shared_ptr pvt_solution = std::make_shared(12, "filename", false, rtk); boost::posix_time::ptime pt(boost::gregorian::date(1994, boost::date_time::Nov, 19), diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc b/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc index 5b62bdfe7..8634d72bc 100644 --- a/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc @@ -50,7 +50,7 @@ TEST(FileSignalSource, Instantiate) config->set_property("Test.item_type", "gr_complex"); config->set_property("Test.repeat", "false"); - std::unique_ptr signal_source(new FileSignalSource(config.get(), "Test", 1, 1, queue)); + std::unique_ptr signal_source(new FileSignalSource(config.get(), "Test", 0, 1, queue)); EXPECT_STREQ("gr_complex", signal_source->item_type().c_str()); EXPECT_TRUE(signal_source->repeat() == false); @@ -67,5 +67,5 @@ TEST(FileSignalSource, InstantiateFileNotExists) config->set_property("Test.item_type", "gr_complex"); config->set_property("Test.repeat", "false"); - EXPECT_THROW({ auto uptr = std::make_shared(config.get(), "Test", 1, 1, queue); }, std::exception); + EXPECT_THROW({ auto uptr = std::make_shared(config.get(), "Test", 0, 1, queue); }, std::exception); } diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index 184ad30c0..fb502d71b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -293,7 +293,7 @@ void GpsL1CATelemetryDecoderTest::check_results(arma::vec& true_time_s, //2. RMSE //arma::vec err = meas_value - true_value_interp + 0.001; - arma::vec err = meas_value - true_value_interp - 0.001; + arma::vec err = meas_value - true_value_interp; // - 0.001; arma::vec err2 = arma::square(err); double rmse = sqrt(arma::mean(err2)); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc index 3aadcba51..a8210f19a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc @@ -137,11 +137,10 @@ void GlonassL1CaDllPllCAidTrackingTest::init() gnss_synchro.PRN = 11; config->set_property("GNSS-SDR.internal_fs_sps", "6625000"); + config->set_property("Tracking_1G.implementation", "GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking"); config->set_property("Tracking_1G.item_type", "gr_complex"); config->set_property("Tracking_1G.dump", "false"); - config->set_property("Tracking_1G.if", "0.0"); config->set_property("Tracking_1G.dump_filename", "./tracking_ch_"); - config->set_property("Tracking_1G.implementation", "GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking"); config->set_property("Tracking_1G.early_late_space_chips", "0.5"); config->set_property("Tracking_1G.order", "2"); config->set_property("Tracking_1G.pll_bw_hz", "2"); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc index 65a4e9797..bd1ec45f0 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc @@ -137,11 +137,10 @@ void GlonassL1CaDllPllTrackingTest::init() gnss_synchro.PRN = 11; config->set_property("GNSS-SDR.internal_fs_sps", "6625000"); + config->set_property("Tracking_1G.implementation", "GLONASS_L1_CA_DLL_PLL_Tracking"); config->set_property("Tracking_1G.item_type", "gr_complex"); config->set_property("Tracking_1G.dump", "false"); - config->set_property("Tracking_1G.if", "0.0"); config->set_property("Tracking_1G.dump_filename", "./tracking_ch_"); - config->set_property("Tracking_1G.implementation", "GLONASS_L1_CA_DLL_PLL_Tracking"); config->set_property("Tracking_1G.early_late_space_chips", "0.5"); config->set_property("Tracking_1G.order", "2"); config->set_property("Tracking_1G.pll_bw_hz", "2"); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_pull-in_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_pull-in_test.cc new file mode 100644 index 000000000..296e927ba --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_pull-in_test.cc @@ -0,0 +1,813 @@ +/*! + * \file gps_l1_ca_dll_pll_tracking_test.cc + * \brief This class implements a tracking Pull-In test for GPS_L1_CA_DLL_PLL_Tracking + * implementation based on some input parameters. + * \author Javier Arribas, 2018. jarribas(at)cttc.es + * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2012-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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "GPS_L1_CA.h" +#include "gnss_block_factory.h" +#include "tracking_interface.h" +#include "gps_l1_ca_pcps_acquisition_fine_doppler.h" +#include "in_memory_configuration.h" +#include "tracking_true_obs_reader.h" +#include "tracking_dump_reader.h" +#include "signal_generator_flags.h" +#include "gnuplot_i.h" +#include "test_flags.h" +#include "tracking_tests_flags.h" + + +// ######## GNURADIO ACQUISITION BLOCK MESSAGE RECEVER ######### +class Acquisition_msg_rx; + +typedef boost::shared_ptr Acquisition_msg_rx_sptr; + +Acquisition_msg_rx_sptr Acquisition_msg_rx_make(); + + +class Acquisition_msg_rx : public gr::block +{ +private: + friend Acquisition_msg_rx_sptr Acquisition_msg_rx_make(); + void msg_handler_events(pmt::pmt_t msg); + Acquisition_msg_rx(); + +public: + int rx_message; + ~Acquisition_msg_rx(); //!< Default destructor +}; + + +Acquisition_msg_rx_sptr Acquisition_msg_rx_make() +{ + return Acquisition_msg_rx_sptr(new Acquisition_msg_rx()); +} + + +void Acquisition_msg_rx::msg_handler_events(pmt::pmt_t msg) +{ + try + { + long int message = pmt::to_long(msg); + rx_message = message; + } + catch (boost::bad_any_cast& e) + { + LOG(WARNING) << "msg_handler_acquisition Bad cast!\n"; + rx_message = 0; + } +} + + +Acquisition_msg_rx::Acquisition_msg_rx() : gr::block("Acquisition_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(&Acquisition_msg_rx::msg_handler_events, this, _1)); + rx_message = 0; +} + + +Acquisition_msg_rx::~Acquisition_msg_rx() {} +// ######## GNURADIO TRACKING BLOCK MESSAGE RECEVER ######### +class GpsL1CADllPllTrackingPullInTest_msg_rx; + +typedef boost::shared_ptr GpsL1CADllPllTrackingPullInTest_msg_rx_sptr; + +GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make(); + +class GpsL1CADllPllTrackingPullInTest_msg_rx : public gr::block +{ +private: + friend GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make(); + void msg_handler_events(pmt::pmt_t msg); + GpsL1CADllPllTrackingPullInTest_msg_rx(); + +public: + int rx_message; + ~GpsL1CADllPllTrackingPullInTest_msg_rx(); //!< Default destructor +}; + + +GpsL1CADllPllTrackingPullInTest_msg_rx_sptr GpsL1CADllPllTrackingPullInTest_msg_rx_make() +{ + return GpsL1CADllPllTrackingPullInTest_msg_rx_sptr(new GpsL1CADllPllTrackingPullInTest_msg_rx()); +} + + +void GpsL1CADllPllTrackingPullInTest_msg_rx::msg_handler_events(pmt::pmt_t msg) +{ + try + { + long int message = pmt::to_long(msg); + rx_message = message; //3 -> loss of lock + //std::cout << "Received trk message: " << rx_message << std::endl; + } + catch (boost::bad_any_cast& e) + { + LOG(WARNING) << "msg_handler_tracking Bad cast!"; + rx_message = 0; + } +} + + +GpsL1CADllPllTrackingPullInTest_msg_rx::GpsL1CADllPllTrackingPullInTest_msg_rx() : gr::block("GpsL1CADllPllTrackingPullInTest_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(&GpsL1CADllPllTrackingPullInTest_msg_rx::msg_handler_events, this, _1)); + rx_message = 0; +} + + +GpsL1CADllPllTrackingPullInTest_msg_rx::~GpsL1CADllPllTrackingPullInTest_msg_rx() +{ +} + + +// ########################################################### + +class GpsL1CADllPllTrackingPullInTest : public ::testing::Test +{ +public: + std::string generator_binary; + std::string p1; + std::string p2; + std::string p3; + std::string p4; + std::string p5; + std::string p6; + std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; //"GPS_L1_CA_DLL_PLL_C_Aid_Tracking"; + + const int baseband_sampling_freq = FLAGS_fs_gen_sps; + + std::string filename_rinex_obs = FLAGS_filename_rinex_obs; + std::string filename_raw_data = FLAGS_signal_file; + + std::map doppler_measurements_map; + std::map code_delay_measurements_map; + std::map acq_samplestamp_map; + + int configure_generator(double CN0_dBHz, int file_idx); + int generate_signal(); + std::vector check_results_doppler(arma::vec& true_time_s, + arma::vec& true_value, + arma::vec& meas_time_s, + arma::vec& meas_value, + double& mean_error, + double& std_dev_error); + std::vector check_results_acc_carrier_phase(arma::vec& true_time_s, + arma::vec& true_value, + arma::vec& meas_time_s, + arma::vec& meas_value, + double& mean_error, + double& std_dev_error); + std::vector check_results_codephase(arma::vec& true_time_s, + arma::vec& true_value, + arma::vec& meas_time_s, + arma::vec& meas_value, + double& mean_error, + double& std_dev_error); + + GpsL1CADllPllTrackingPullInTest() + { + factory = std::make_shared(); + config = std::make_shared(); + item_size = sizeof(gr_complex); + gnss_synchro = Gnss_Synchro(); + } + + ~GpsL1CADllPllTrackingPullInTest() + { + } + + void configure_receiver(double PLL_wide_bw_hz, + double DLL_wide_bw_hz, + double PLL_narrow_bw_hz, + double DLL_narrow_bw_hz, + int extend_correlation_symbols); + + bool acquire_GPS_L1CA_signal(int SV_ID); + gr::top_block_sptr top_block; + std::shared_ptr factory; + std::shared_ptr config; + Gnss_Synchro gnss_synchro; + size_t item_size; +}; + + +int GpsL1CADllPllTrackingPullInTest::configure_generator(double CN0_dBHz, int file_idx) +{ + // Configure signal generator + generator_binary = FLAGS_generator_binary; + + p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file; + if (FLAGS_dynamic_position.empty()) + { + p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(FLAGS_duration * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position); + } + p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + FLAGS_signal_file + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 + return 0; +} + + +int GpsL1CADllPllTrackingPullInTest::generate_signal() +{ + int child_status; + + char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], &p6[0], NULL}; + + int pid; + if ((pid = fork()) == -1) + perror("fork err"); + else if (pid == 0) + { + execv(&generator_binary[0], parmList); + std::cout << "Return not expected. Must be an execv err." << std::endl; + std::terminate(); + } + + waitpid(pid, &child_status, 0); + + std::cout << "Signal and Observables RINEX and RAW files created." << std::endl; + return 0; +} + + +void GpsL1CADllPllTrackingPullInTest::configure_receiver( + double PLL_wide_bw_hz, + double DLL_wide_bw_hz, + double PLL_narrow_bw_hz, + double DLL_narrow_bw_hz, + int extend_correlation_symbols) +{ + gnss_synchro.Channel_ID = 0; + gnss_synchro.System = 'G'; + std::string signal = "1C"; + signal.copy(gnss_synchro.Signal, 2, 0); + gnss_synchro.PRN = FLAGS_test_satellite_PRN; + + config = std::make_shared(); + config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); + // Set Tracking + config->set_property("Tracking_1C.implementation", implementation); + config->set_property("Tracking_1C.item_type", "gr_complex"); + config->set_property("Tracking_1C.pll_bw_hz", std::to_string(PLL_wide_bw_hz)); + config->set_property("Tracking_1C.dll_bw_hz", std::to_string(DLL_wide_bw_hz)); + config->set_property("Tracking_1C.early_late_space_chips", "0.5"); + config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); + config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); + config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); + config->set_property("Tracking_1C.early_late_space_narrow_chips", "0.5"); + config->set_property("Tracking_1C.dump", "true"); + config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); + + std::cout << "*****************************************\n"; + std::cout << "*** Tracking configuration parameters ***\n"; + std::cout << "*****************************************\n"; + std::cout << "pll_bw_hz: " << config->property("Tracking_1C.pll_bw_hz", 0.0) << " Hz\n"; + std::cout << "dll_bw_hz: " << config->property("Tracking_1C.dll_bw_hz", 0.0) << " Hz\n"; + std::cout << "pll_bw_narrow_hz: " << config->property("Tracking_1C.pll_bw_narrow_hz", 0.0) << " Hz\n"; + std::cout << "dll_bw_narrow_hz: " << config->property("Tracking_1C.dll_bw_narrow_hz", 0.0) << " Hz\n"; + std::cout << "extend_correlation_symbols: " << config->property("Tracking_1C.extend_correlation_symbols", 0) << " Symbols\n"; + std::cout << "*****************************************\n"; + std::cout << "*****************************************\n"; +} + + +bool GpsL1CADllPllTrackingPullInTest::acquire_GPS_L1CA_signal(int SV_ID) +{ + // 1. Setup GNU Radio flowgraph (file_source -> Acquisition_10m) + gr::top_block_sptr top_block; + top_block = gr::make_top_block("Acquisition test"); + + // Satellite signal definition + Gnss_Synchro tmp_gnss_synchro; + tmp_gnss_synchro.Channel_ID = 0; + tmp_gnss_synchro.System = 'G'; + std::string signal = "1C"; + signal.copy(tmp_gnss_synchro.Signal, 2, 0); + tmp_gnss_synchro.PRN = SV_ID; + + config = std::make_shared(); + config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); + + GNSSBlockFactory block_factory; + GpsL1CaPcpsAcquisitionFineDoppler* acquisition; + acquisition = new GpsL1CaPcpsAcquisitionFineDoppler(config.get(), "Acquisition", 1, 1); + + acquisition->set_channel(1); + acquisition->set_gnss_synchro(&tmp_gnss_synchro); + acquisition->set_threshold(config->property("Acquisition.threshold", 0.005)); + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 250)); + + boost::shared_ptr msg_rx; + try + { + msg_rx = Acquisition_msg_rx_make(); + } + catch (const std::exception& e) + { + std::cout << "Failure connecting the message port system: " << e.what() << std::endl; + exit(0); + } + + gr::blocks::file_source::sptr file_source; + std::string file = FLAGS_signal_file; + const char* file_name = file.c_str(); + file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); + gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); + gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); + top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); + top_block->connect(gr_interleaved_char_to_complex, 0, acquisition->get_left_block(), 0); + top_block->msg_connect(acquisition->get_left_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); + + // 5. Run the flowgraph + // Get visible GPS satellites (positive acquisitions with Doppler measurements) + // record startup time + std::chrono::time_point start, end; + std::chrono::duration elapsed_seconds; + start = std::chrono::system_clock::now(); + + bool start_msg = true; + + doppler_measurements_map.clear(); + code_delay_measurements_map.clear(); + acq_samplestamp_map.clear(); + + for (unsigned int PRN = 1; PRN < 33; PRN++) + { + tmp_gnss_synchro.PRN = PRN; + acquisition->set_gnss_synchro(&tmp_gnss_synchro); + acquisition->init(); + acquisition->set_local_code(); + acquisition->reset(); + msg_rx->rx_message = 0; + top_block->run(); + if (start_msg == true) + { + std::cout << "Reading external signal file: " << FLAGS_signal_file << std::endl; + std::cout << "Searching for GPS Satellites in L1 band..." << std::endl; + std::cout << "["; + start_msg = false; + } + while (msg_rx->rx_message == 0) + { + usleep(100000); + } + if (msg_rx->rx_message == 1) + { + std::cout << " " << PRN << " "; + doppler_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_doppler_hz)); + code_delay_measurements_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_delay_samples)); + acq_samplestamp_map.insert(std::pair(PRN, tmp_gnss_synchro.Acq_samplestamp_samples)); + } + else + { + std::cout << " . "; + } + top_block->stop(); + file_source->seek(0, 0); + std::cout.flush(); + } + std::cout << "]" << std::endl; + + // report the elapsed time + end = std::chrono::system_clock::now(); + elapsed_seconds = end - start; + std::cout << "Total signal acquisition run time " + << elapsed_seconds.count() + << " [seconds]" << std::endl; + return true; +} + +TEST_F(GpsL1CADllPllTrackingPullInTest, ValidationOfResults) +{ + //************************************************* + //***** STEP 1: Prepare the parameters sweep ****** + //************************************************* + std::vector + acq_doppler_error_hz_values; + std::vector> acq_delay_error_chips_values; //vector of vector + + for (double doppler_hz = FLAGS_acq_Doppler_error_hz_start; doppler_hz >= FLAGS_acq_Doppler_error_hz_stop; doppler_hz = doppler_hz + FLAGS_acq_Doppler_error_hz_step) + { + acq_doppler_error_hz_values.push_back(doppler_hz); + std::vector tmp_vector; + //Code Delay Sweep + for (double code_delay_chips = FLAGS_acq_Delay_error_chips_start; code_delay_chips >= FLAGS_acq_Delay_error_chips_stop; code_delay_chips = code_delay_chips + FLAGS_acq_Delay_error_chips_step) + { + tmp_vector.push_back(code_delay_chips); + } + acq_delay_error_chips_values.push_back(tmp_vector); + } + + + //*********************************************************** + //***** STEP 2: Generate the input signal (if required) ***** + //*********************************************************** + std::vector generator_CN0_values; + if (FLAGS_enable_external_signal_file) + { + generator_CN0_values.push_back(999); // an external input signal capture is selected, no CN0 information available + } + else + { + if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop) + { + generator_CN0_values.push_back(FLAGS_CN0_dBHz_start); + } + else + { + for (double cn0 = FLAGS_CN0_dBHz_start; cn0 > FLAGS_CN0_dBHz_stop; cn0 = cn0 - FLAGS_CN0_dB_step) + { + generator_CN0_values.push_back(cn0); + } + } + } + + // use generator or use an external capture file + if (FLAGS_enable_external_signal_file) + { + //create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters + ASSERT_EQ(acquire_GPS_L1CA_signal(FLAGS_test_satellite_PRN), true); + bool found_satellite = doppler_measurements_map.find(FLAGS_test_satellite_PRN) != doppler_measurements_map.end(); + EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << FLAGS_test_satellite_PRN << " is not acquired"; + if (!found_satellite) return; + } + else + { + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) + { + // Configure the signal generator + configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx); + // Generate signal raw signal samples and observations RINEX file + if (FLAGS_disable_generator == false) + { + generate_signal(); + } + } + } + + + configure_receiver(FLAGS_PLL_bw_hz_start, + FLAGS_DLL_bw_hz_start, + FLAGS_PLL_narrow_bw_hz, + FLAGS_DLL_narrow_bw_hz, + FLAGS_extend_correlation_symbols); + + //****************************************************************************************** + //***** Obtain the initial signal sinchronization parameters (emulating an acquisition) **** + //****************************************************************************************** + int test_satellite_PRN = 0; + double true_acq_doppler_hz = 0.0; + double true_acq_delay_samples = 0.0; + unsigned long int acq_samplestamp_samples = 0; + + tracking_true_obs_reader true_obs_data; + if (!FLAGS_enable_external_signal_file) + { + test_satellite_PRN = FLAGS_test_satellite_PRN; + std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); + true_obs_file.append(std::to_string(test_satellite_PRN)); + true_obs_file.append(".dat"); + true_obs_data.close_obs_file(); + ASSERT_EQ(true_obs_data.open_obs_file(true_obs_file), true) << "Failure opening true observables file"; + // load acquisition data based on the first epoch of the true observations + ASSERT_EQ(true_obs_data.read_binary_obs(), true) + << "Failure reading true tracking dump file." << std::endl + << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + + " is not available?"; + std::cout << "Testing satellite PRN=" << test_satellite_PRN << std::endl; + std::cout << "True Initial Doppler " << true_obs_data.doppler_l1_hz << "[Hz], true Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << "[Chips]" << std::endl; + true_acq_doppler_hz = true_obs_data.doppler_l1_hz; + true_acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) * static_cast(baseband_sampling_freq) * GPS_L1_CA_CODE_PERIOD; + acq_samplestamp_samples = 0; + } + else + { + true_acq_doppler_hz = doppler_measurements_map.find(FLAGS_test_satellite_PRN)->second; + true_acq_delay_samples = code_delay_measurements_map.find(FLAGS_test_satellite_PRN)->second; + acq_samplestamp_samples = 0; //acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second; + std::cout << "Estimated Initial Doppler " << true_acq_doppler_hz << "[Hz], estimated Initial code delay " << true_acq_delay_samples << " [Samples]" << std::endl; + } + //CN0 LOOP + std::vector> pull_in_results_v_v; + + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) + { + std::vector pull_in_results_v; + for (unsigned int current_acq_doppler_error_idx = 0; current_acq_doppler_error_idx < acq_doppler_error_hz_values.size(); current_acq_doppler_error_idx++) + { + for (unsigned int current_acq_code_error_idx = 0; current_acq_code_error_idx < acq_delay_error_chips_values.at(current_acq_doppler_error_idx).size(); current_acq_code_error_idx++) + { + gnss_synchro.Acq_samplestamp_samples = acq_samplestamp_samples; + //simulate a Doppler error in acquisition + gnss_synchro.Acq_doppler_hz = true_acq_doppler_hz + acq_doppler_error_hz_values.at(current_acq_doppler_error_idx); + //simulate Code Delay error in acquisition + gnss_synchro.Acq_delay_samples = true_acq_delay_samples + (acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx) / GPS_L1_CA_CODE_RATE_HZ) * static_cast(baseband_sampling_freq); + + //create flowgraph + top_block = gr::make_top_block("Tracking test"); + std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1); + std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); + boost::shared_ptr msg_rx = GpsL1CADllPllTrackingPullInTest_msg_rx_make(); + + + ASSERT_NO_THROW({ + tracking->set_channel(gnss_synchro.Channel_ID); + }) << "Failure setting channel."; + + ASSERT_NO_THROW({ + tracking->set_gnss_synchro(&gnss_synchro); + }) << "Failure setting gnss_synchro."; + + ASSERT_NO_THROW({ + tracking->connect(top_block); + }) << "Failure connecting tracking to the top_block."; + + std::string file; + ASSERT_NO_THROW({ + if (!FLAGS_enable_external_signal_file) + { + file = "./" + filename_raw_data + std::to_string(current_cn0_idx); + } + else + { + file = FLAGS_signal_file; + } + const char* file_name = file.c_str(); + gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); + gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); + gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); + top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); + top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 0); + top_block->connect(tracking->get_right_block(), 0, sink, 0); + top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); + + file_source->seek(acq_samplestamp_samples, 0); + }) << "Failure connecting the blocks of tracking test."; + + + //******************************************************************** + //***** STEP 5: Perform the signal tracking and read the results ***** + //******************************************************************** + std::cout << "------------ START TRACKING -------------" << std::endl; + tracking->start_tracking(); + std::chrono::time_point start, end; + EXPECT_NO_THROW({ + start = std::chrono::system_clock::now(); + top_block->run(); // Start threads and wait + end = std::chrono::system_clock::now(); + }) << "Failure running the top_block."; + + std::chrono::duration elapsed_seconds = end - start; + std::cout << "Signal tracking completed in " << elapsed_seconds.count() << " seconds" << std::endl; + + + pull_in_results_v.push_back(msg_rx->rx_message != 3); //save last asynchronous tracking message in order to detect a loss of lock + + //******************************** + //***** STEP 7: Plot results ***** + //******************************** + if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) + { + //load the measured values + tracking_dump_reader trk_dump; + ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true) + << "Failure opening tracking dump file"; + + long int n_measured_epochs = trk_dump.num_epochs(); + //todo: use vectors instead + arma::vec trk_timestamp_s = arma::zeros(n_measured_epochs, 1); + arma::vec trk_acc_carrier_phase_cycles = arma::zeros(n_measured_epochs, 1); + arma::vec trk_Doppler_Hz = arma::zeros(n_measured_epochs, 1); + arma::vec trk_prn_delay_chips = arma::zeros(n_measured_epochs, 1); + std::vector timestamp_s; + std::vector prompt; + std::vector early; + std::vector late; + std::vector promptI; + std::vector promptQ; + std::vector CN0_dBHz; + long int epoch_counter = 0; + while (trk_dump.read_binary_obs()) + { + trk_timestamp_s(epoch_counter) = static_cast(trk_dump.PRN_start_sample_count) / static_cast(baseband_sampling_freq); + trk_acc_carrier_phase_cycles(epoch_counter) = trk_dump.acc_carrier_phase_rad / GPS_TWO_PI; + trk_Doppler_Hz(epoch_counter) = trk_dump.carrier_doppler_hz; + double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS * (fmod((static_cast(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast(baseband_sampling_freq), 1.0e-3) / 1.0e-3); + + trk_prn_delay_chips(epoch_counter) = delay_chips; + + timestamp_s.push_back(trk_timestamp_s(epoch_counter)); + prompt.push_back(trk_dump.abs_P); + early.push_back(trk_dump.abs_E); + late.push_back(trk_dump.abs_L); + promptI.push_back(trk_dump.prompt_I); + promptQ.push_back(trk_dump.prompt_Q); + CN0_dBHz.push_back(trk_dump.CN0_SNV_dB_Hz); + + epoch_counter++; + } + + + const std::string gnuplot_executable(FLAGS_gnuplot_executable); + if (gnuplot_executable.empty()) + { + std::cout << "WARNING: Although the flag show_plots has been set to TRUE," << std::endl; + std::cout << "gnuplot has not been found in your system." << std::endl; + std::cout << "Test results will not be plotted." << std::endl; + } + else + { + try + { + boost::filesystem::path p(gnuplot_executable); + boost::filesystem::path dir = p.parent_path(); + std::string gnuplot_path = dir.native(); + Gnuplot::set_GNUPlotPath(gnuplot_path); + unsigned int decimate = static_cast(FLAGS_plot_decimate); + + if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) + { + Gnuplot g1("linespoints"); + g1.showonscreen(); // window output + if (!FLAGS_enable_external_signal_file) + { + g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + } + else + { + g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + } + + g1.set_grid(); + g1.set_xlabel("Time [s]"); + g1.set_ylabel("Correlators' output"); + //g1.cmd("set key box opaque"); + g1.plot_xy(trk_timestamp_s, prompt, "Prompt", decimate); + g1.plot_xy(trk_timestamp_s, early, "Early", decimate); + g1.plot_xy(trk_timestamp_s, late, "Late", decimate); + g1.set_legend(); + //g1.savetops("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx))); + //g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18); + + Gnuplot g2("points"); + g2.showonscreen(); // window output + if (!FLAGS_enable_external_signal_file) + { + g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + } + else + { + g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + } + + g2.set_grid(); + g2.set_xlabel("Inphase"); + g2.set_ylabel("Quadrature"); + //g2.cmd("set size ratio -1"); + g2.plot_xy(promptI, promptQ); + //g2.savetops("Constellation"); + //g2.savetopdf("Constellation", 18); + + Gnuplot g3("linespoints"); + if (!FLAGS_enable_external_signal_file) + { + g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + } + else + { + g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + } + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Reported CN0 [dB-Hz]"); + g3.cmd("set key box opaque"); + + g3.plot_xy(trk_timestamp_s, CN0_dBHz, + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate); + + g3.set_legend(); + //g3.savetops("CN0_output"); + //g3.savetopdf("CN0_output", 18); + g3.showonscreen(); // window output + } + } + catch (const GnuplotException& ge) + { + std::cout << ge.what() << std::endl; + } + } + } //end plot + + } //end acquisition Delay errors loop + } //end acquisition Doppler errors loop + pull_in_results_v_v.push_back(pull_in_results_v); + + + } //end CN0 LOOP + //build the mesh grid + std::vector doppler_error_mesh; + std::vector code_delay_error_mesh; + for (unsigned int current_acq_doppler_error_idx = 0; current_acq_doppler_error_idx < acq_doppler_error_hz_values.size(); current_acq_doppler_error_idx++) + { + for (unsigned int current_acq_code_error_idx = 0; current_acq_code_error_idx < acq_delay_error_chips_values.at(current_acq_doppler_error_idx).size(); current_acq_code_error_idx++) + { + doppler_error_mesh.push_back(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)); + code_delay_error_mesh.push_back(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)); + } + } + + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) + { + std::vector pull_in_result_mesh; + pull_in_result_mesh = pull_in_results_v_v.at(current_cn0_idx); + //plot grid + Gnuplot g4("points palette pointsize 2 pointtype 7"); + if (FLAGS_show_plots) + { + g4.showonscreen(); // window output + } + else + { + g4.disablescreen(); + } + g4.cmd("set palette defined ( 0 \"black\", 1 \"green\" )"); + g4.cmd("set key off"); + g4.cmd("set view map"); + std::string title; + if (!FLAGS_enable_external_signal_file) + { + title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz]."); + } + else + { + title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + } + + g4.set_title(title); + g4.set_grid(); + g4.set_xlabel("Acquisition Doppler error [Hz]"); + g4.set_ylabel("Acquisition Code Delay error [Chips]"); + g4.cmd("set cbrange[0:1]"); + g4.plot_xyz(doppler_error_mesh, + code_delay_error_mesh, + pull_in_result_mesh); + g4.set_legend(); + if (!FLAGS_enable_external_signal_file) + { + g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx))))); + g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))), 12); + } + else + { + g4.savetops("trk_pull_in_grid_external_file"); + g4.savetopdf("trk_pull_in_grid_external_file", 12); + } + } +} diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc index 884e7ed7f..523be87a3 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc @@ -1,6 +1,6 @@ /*! * \file gps_l1_ca_dll_pll_tracking_test.cc - * \brief This class implements a tracking test for Galileo_E5a_DLL_PLL_Tracking + * \brief This class implements a tracking test for GPS_L1_CA_DLL_PLL_Tracking * implementation based on some input parameters. * \author Javier Arribas, 2017. jarribas(at)cttc.es * @@ -51,12 +51,9 @@ #include "tracking_dump_reader.h" #include "signal_generator_flags.h" #include "gnuplot_i.h" -#include "gnss_sdr_flags.h" #include "test_flags.h" +#include "tracking_tests_flags.h" -DEFINE_bool(plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot"); -DEFINE_double(CN0_dBHz, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 [dB-Hz]"); -DEFINE_int32(extend_correlation_symbols, 1, "Set the tracking coherent correlation to N symbols (up to 20 for GPS L1 C/A)"); // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GpsL1CADllPllTrackingTest_msg_rx; @@ -89,7 +86,8 @@ void GpsL1CADllPllTrackingTest_msg_rx::msg_handler_events(pmt::pmt_t msg) try { long int message = pmt::to_long(msg); - rx_message = message; + rx_message = message; //3 -> loss of lock + //std::cout << "Received trk message: " << rx_message << std::endl; } catch (boost::bad_any_cast& e) { @@ -131,20 +129,26 @@ public: std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - int configure_generator(); + int configure_generator(double CN0_dBHz, int file_idx); int generate_signal(); - void check_results_doppler(arma::vec& true_time_s, + std::vector check_results_doppler(arma::vec& true_time_s, arma::vec& true_value, arma::vec& meas_time_s, - arma::vec& meas_value); - void check_results_acc_carrier_phase(arma::vec& true_time_s, + arma::vec& meas_value, + double& mean_error, + double& std_dev_error); + std::vector check_results_acc_carrier_phase(arma::vec& true_time_s, arma::vec& true_value, arma::vec& meas_time_s, - arma::vec& meas_value); - void check_results_codephase(arma::vec& true_time_s, + arma::vec& meas_value, + double& mean_error, + double& std_dev_error); + std::vector check_results_codephase(arma::vec& true_time_s, arma::vec& true_value, arma::vec& meas_time_s, - arma::vec& meas_value); + arma::vec& meas_value, + double& mean_error, + double& std_dev_error); GpsL1CADllPllTrackingTest() { @@ -158,7 +162,11 @@ public: { } - void configure_receiver(); + void configure_receiver(double PLL_wide_bw_hz, + double DLL_wide_bw_hz, + double PLL_narrow_bw_hz, + double DLL_narrow_bw_hz, + int extend_correlation_symbols); gr::top_block_sptr top_block; std::shared_ptr factory; @@ -168,7 +176,7 @@ public: }; -int GpsL1CADllPllTrackingTest::configure_generator() +int GpsL1CADllPllTrackingTest::configure_generator(double CN0_dBHz, int file_idx) { // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -182,10 +190,10 @@ int GpsL1CADllPllTrackingTest::configure_generator() { p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position); } - p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output - p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples - p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps] - p6 = std::string("-CN0_dBHz=") + std::to_string(FLAGS_CN0_dBHz); // Signal generator CN0 + p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 return 0; } @@ -194,7 +202,7 @@ int GpsL1CADllPllTrackingTest::generate_signal() { int child_status; - char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0],&p6[0], NULL}; + char* const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], &p4[0], &p5[0], &p6[0], NULL}; int pid; if ((pid = fork()) == -1) @@ -213,7 +221,12 @@ int GpsL1CADllPllTrackingTest::generate_signal() } -void GpsL1CADllPllTrackingTest::configure_receiver() +void GpsL1CADllPllTrackingTest::configure_receiver( + double PLL_wide_bw_hz, + double DLL_wide_bw_hz, + double PLL_narrow_bw_hz, + double DLL_narrow_bw_hz, + int extend_correlation_symbols) { gnss_synchro.Channel_ID = 0; gnss_synchro.System = 'G'; @@ -221,40 +234,40 @@ void GpsL1CADllPllTrackingTest::configure_receiver() signal.copy(gnss_synchro.Signal, 2, 0); gnss_synchro.PRN = FLAGS_test_satellite_PRN; + config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); // Set Tracking config->set_property("Tracking_1C.implementation", implementation); config->set_property("Tracking_1C.item_type", "gr_complex"); - if (FLAGS_pll_bw_hz != 0.0) - { - config->set_property("Tracking_1C.pll_bw_hz", std::to_string(FLAGS_pll_bw_hz)); - } - else - { - config->set_property("Tracking_1C.pll_bw_hz", "20.0"); - } - if (FLAGS_dll_bw_hz != 0.0) - { - config->set_property("Tracking_1C.dll_bw_hz", std::to_string(FLAGS_dll_bw_hz)); - } - else - { - config->set_property("Tracking_1C.dll_bw_hz", "2.0"); - } + config->set_property("Tracking_1C.pll_bw_hz", std::to_string(PLL_wide_bw_hz)); + config->set_property("Tracking_1C.dll_bw_hz", std::to_string(DLL_wide_bw_hz)); config->set_property("Tracking_1C.early_late_space_chips", "0.5"); - config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(FLAGS_extend_correlation_symbols)); - config->set_property("Tracking_1C.pll_bw_narrow_hz", "2.0"); - config->set_property("Tracking_1C.dll_bw_narrow_hz", "1.0"); + config->set_property("Tracking_1C.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); + config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); + config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); config->set_property("Tracking_1C.early_late_space_narrow_chips", "0.5"); config->set_property("Tracking_1C.dump", "true"); config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); + + std::cout << "*****************************************\n"; + std::cout << "*** Tracking configuration parameters ***\n"; + std::cout << "*****************************************\n"; + std::cout << "pll_bw_hz: " << config->property("Tracking_1C.pll_bw_hz", 0.0) << " Hz\n"; + std::cout << "dll_bw_hz: " << config->property("Tracking_1C.dll_bw_hz", 0.0) << " Hz\n"; + std::cout << "pll_bw_narrow_hz: " << config->property("Tracking_1C.pll_bw_narrow_hz", 0.0) << " Hz\n"; + std::cout << "dll_bw_narrow_hz: " << config->property("Tracking_1C.dll_bw_narrow_hz", 0.0) << " Hz\n"; + std::cout << "extend_correlation_symbols: " << config->property("Tracking_1C.extend_correlation_symbols", 0) << " Symbols\n"; + std::cout << "*****************************************\n"; + std::cout << "*****************************************\n"; } -void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec& true_time_s, +std::vector GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec& true_time_s, arma::vec& true_value, arma::vec& meas_time_s, - arma::vec& meas_value) + arma::vec& meas_value, + double& mean_error, + double& std_dev_error) { // 1. True value interpolation to match the measurement times arma::vec true_value_interp; @@ -271,6 +284,10 @@ void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec& true_time_s, arma::vec err; err = meas_value - true_value_interp; + + //conversion between arma::vec and std:vector + std::vector err_std_vector(err.colptr(0), err.colptr(0) + err.n_rows); + arma::vec err2 = arma::square(err); double rmse = sqrt(arma::mean(err2)); @@ -278,6 +295,9 @@ void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec& true_time_s, double error_mean = arma::mean(err); double error_var = arma::var(err); + mean_error = error_mean; + std_dev_error = sqrt(error_var); + // 4. Peaks double max_error = arma::max(err); double min_error = arma::min(err); @@ -288,13 +308,16 @@ void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec& true_time_s, << ", mean=" << error_mean << ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Hz]" << std::endl; std::cout.precision(ss); + return err_std_vector; } -void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec& true_time_s, +std::vector GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec& true_time_s, arma::vec& true_value, arma::vec& meas_time_s, - arma::vec& meas_value) + arma::vec& meas_value, + double& mean_error, + double& std_dev_error) { // 1. True value interpolation to match the measurement times arma::vec true_value_interp; @@ -311,12 +334,17 @@ void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec& true_ arma::vec err; err = meas_value - true_value_interp; arma::vec err2 = arma::square(err); + //conversion between arma::vec and std:vector + std::vector err_std_vector(err.colptr(0), err.colptr(0) + err.n_rows); + double rmse = sqrt(arma::mean(err2)); // 3. Mean err and variance double error_mean = arma::mean(err); double error_var = arma::var(err); + mean_error = error_mean; + std_dev_error = sqrt(error_var); // 4. Peaks double max_error = arma::max(err); double min_error = arma::min(err); @@ -327,13 +355,16 @@ void GpsL1CADllPllTrackingTest::check_results_acc_carrier_phase(arma::vec& true_ << ", mean=" << error_mean << ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Hz]" << std::endl; std::cout.precision(ss); + return err_std_vector; } -void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec& true_time_s, +std::vector GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec& true_time_s, arma::vec& true_value, arma::vec& meas_time_s, - arma::vec& meas_value) + arma::vec& meas_value, + double& mean_error, + double& std_dev_error) { // 1. True value interpolation to match the measurement times arma::vec true_value_interp; @@ -350,6 +381,9 @@ void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec& true_time_s, arma::vec err; err = meas_value - true_value_interp; + //conversion between arma::vec and std:vector + std::vector err_std_vector(err.colptr(0), err.colptr(0) + err.n_rows); + arma::vec err2 = arma::square(err); double rmse = sqrt(arma::mean(err2)); @@ -357,6 +391,9 @@ void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec& true_time_s, double error_mean = arma::mean(err); double error_var = arma::var(err); + mean_error = error_mean; + std_dev_error = sqrt(error_var); + // 4. Peaks double max_error = arma::max(err); double min_error = arma::min(err); @@ -367,229 +404,605 @@ void GpsL1CADllPllTrackingTest::check_results_codephase(arma::vec& true_time_s, << ", mean=" << error_mean << ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Chips]" << std::endl; std::cout.precision(ss); + return err_std_vector; } TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { - // Configure the signal generator - configure_generator(); + //************************************************* + //***** STEP 2: Prepare the parameters sweep ****** + //************************************************* - // Generate signal raw signal samples and observations RINEX file - if (FLAGS_disable_generator == false) - { - generate_signal(); - } + std::vector generator_CN0_values; - std::chrono::time_point start, end; - configure_receiver(); + //data containers for config param sweep + std::vector> mean_doppler_error_sweep; //swep config param and cn0 sweep + std::vector> std_dev_doppler_error_sweep; //swep config param and cn0 sweep - // open true observables log file written by the simulator + std::vector> mean_code_phase_error_sweep; //swep config param and cn0 sweep + std::vector> std_dev_code_phase_error_sweep; //swep config param and cn0 sweep + + std::vector> mean_carrier_phase_error_sweep; //swep config param and cn0 sweep + std::vector> std_dev_carrier_phase_error_sweep; //swep config param and cn0 sweep + + std::vector> trk_valid_timestamp_s_sweep; + std::vector> generator_CN0_values_sweep_copy; + + int test_satellite_PRN = 0; + double acq_delay_samples = 0.0; + double acq_doppler_hz = 0.0; tracking_true_obs_reader true_obs_data; - int test_satellite_PRN = FLAGS_test_satellite_PRN; - std::cout << "Testing satellite PRN=" << test_satellite_PRN << std::endl; - std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); - true_obs_file.append(std::to_string(test_satellite_PRN)); - true_obs_file.append(".dat"); - ASSERT_EQ(true_obs_data.open_obs_file(true_obs_file), true) << "Failure opening true observables file"; - top_block = gr::make_top_block("Tracking test"); - std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1); - std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); //std::make_shared(config.get(), "Tracking_1C", 1, 1); + // CONFIG PARAM SWEEP LOOP + std::vector PLL_wide_bw_values; + std::vector DLL_wide_bw_values; - boost::shared_ptr msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make(); - // load acquisition data based on the first epoch of the true observations - ASSERT_EQ(true_obs_data.read_binary_obs(), true) - << "Failure reading true tracking dump file." << std::endl - << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + - " is not available?"; + //*********************************************************** + //***** STEP 2: Tracking configuration parameters sweep ***** + //*********************************************************** - // restart the epoch counter - true_obs_data.restart(); - - std::cout << "Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << std::endl; - gnss_synchro.Acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) * static_cast(baseband_sampling_freq) * GPS_L1_CA_CODE_PERIOD; - gnss_synchro.Acq_doppler_hz = true_obs_data.doppler_l1_hz; - gnss_synchro.Acq_samplestamp_samples = 0; - - ASSERT_NO_THROW({ - tracking->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel."; - - ASSERT_NO_THROW({ - tracking->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."; - - ASSERT_NO_THROW({ - tracking->connect(top_block); - }) << "Failure connecting tracking to the top_block."; - - ASSERT_NO_THROW({ - std::string file = "./" + filename_raw_data; - const char* file_name = file.c_str(); - gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); - gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); - gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); - top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); - top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 0); - top_block->connect(tracking->get_right_block(), 0, sink, 0); - top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); - }) << "Failure connecting the blocks of tracking test."; - - tracking->start_tracking(); - - EXPECT_NO_THROW({ - start = std::chrono::system_clock::now(); - top_block->run(); // Start threads and wait - end = std::chrono::system_clock::now(); - }) << "Failure running the top_block."; - - // check results - // load the true values - long int nepoch = true_obs_data.num_epochs(); - std::cout << "True observation epochs=" << nepoch << std::endl; - - arma::vec true_timestamp_s = arma::zeros(nepoch, 1); - arma::vec true_acc_carrier_phase_cycles = arma::zeros(nepoch, 1); - arma::vec true_Doppler_Hz = arma::zeros(nepoch, 1); - arma::vec true_prn_delay_chips = arma::zeros(nepoch, 1); - arma::vec true_tow_s = arma::zeros(nepoch, 1); - - long int epoch_counter = 0; - while (true_obs_data.read_binary_obs()) + if (FLAGS_PLL_bw_hz_start == FLAGS_PLL_bw_hz_stop) { - true_timestamp_s(epoch_counter) = true_obs_data.signal_timestamp_s; - true_acc_carrier_phase_cycles(epoch_counter) = true_obs_data.acc_carrier_phase_cycles; - true_Doppler_Hz(epoch_counter) = true_obs_data.doppler_l1_hz; - true_prn_delay_chips(epoch_counter) = true_obs_data.prn_delay_chips; - true_tow_s(epoch_counter) = true_obs_data.tow; - epoch_counter++; - } - - //load the measured values - tracking_dump_reader trk_dump; - - ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true) - << "Failure opening tracking dump file"; - - nepoch = trk_dump.num_epochs(); - std::cout << "Measured observation epochs=" << nepoch << std::endl; - - arma::vec trk_timestamp_s = arma::zeros(nepoch, 1); - arma::vec trk_acc_carrier_phase_cycles = arma::zeros(nepoch, 1); - arma::vec trk_Doppler_Hz = arma::zeros(nepoch, 1); - arma::vec trk_prn_delay_chips = arma::zeros(nepoch, 1); - - std::vector prompt; - std::vector early; - std::vector late; - std::vector promptI; - std::vector promptQ; - std::vector CN0_dBHz; - - epoch_counter = 0; - while (trk_dump.read_binary_obs()) - { - trk_timestamp_s(epoch_counter) = static_cast(trk_dump.PRN_start_sample_count) / static_cast(baseband_sampling_freq); - trk_acc_carrier_phase_cycles(epoch_counter) = trk_dump.acc_carrier_phase_rad / GPS_TWO_PI; - trk_Doppler_Hz(epoch_counter) = trk_dump.carrier_doppler_hz; - - double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS * (fmod((static_cast(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast(baseband_sampling_freq), 1.0e-3) / 1.0e-3); - - trk_prn_delay_chips(epoch_counter) = delay_chips; - epoch_counter++; - prompt.push_back(trk_dump.abs_P); - early.push_back(trk_dump.abs_E); - late.push_back(trk_dump.abs_L); - promptI.push_back(trk_dump.prompt_I); - promptQ.push_back(trk_dump.prompt_Q); - CN0_dBHz.push_back(trk_dump.CN0_SNV_dB_Hz); - } - - // Align initial measurements and cut the tracking pull-in transitory - double pull_in_offset_s = 1.0; - arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first"); - - trk_timestamp_s = trk_timestamp_s.subvec(initial_meas_point(0), trk_timestamp_s.size() - 1); - trk_acc_carrier_phase_cycles = trk_acc_carrier_phase_cycles.subvec(initial_meas_point(0), trk_acc_carrier_phase_cycles.size() - 1); - trk_Doppler_Hz = trk_Doppler_Hz.subvec(initial_meas_point(0), trk_Doppler_Hz.size() - 1); - trk_prn_delay_chips = trk_prn_delay_chips.subvec(initial_meas_point(0), trk_prn_delay_chips.size() - 1); - - check_results_doppler(true_timestamp_s, true_Doppler_Hz, trk_timestamp_s, trk_Doppler_Hz); - check_results_codephase(true_timestamp_s, true_prn_delay_chips, trk_timestamp_s, trk_prn_delay_chips); - check_results_acc_carrier_phase(true_timestamp_s, true_acc_carrier_phase_cycles, trk_timestamp_s, trk_acc_carrier_phase_cycles); - - std::chrono::duration elapsed_seconds = end - start; - std::cout << "Signal tracking completed in " << elapsed_seconds.count() << " seconds." << std::endl; - - if (FLAGS_plot_gps_l1_tracking_test == true) - { - const std::string gnuplot_executable(FLAGS_gnuplot_executable); - if (gnuplot_executable.empty()) + if (FLAGS_DLL_bw_hz_start == FLAGS_DLL_bw_hz_stop) { - std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE," << std::endl; - std::cout << "gnuplot has not been found in your system." << std::endl; - std::cout << "Test results will not be plotted." << std::endl; + //NO PLL/DLL BW sweep + PLL_wide_bw_values.push_back(FLAGS_PLL_bw_hz_start); + DLL_wide_bw_values.push_back(FLAGS_DLL_bw_hz_start); } else { - try + //DLL BW Sweep + for (double dll_bw = FLAGS_DLL_bw_hz_start; dll_bw >= FLAGS_DLL_bw_hz_stop; dll_bw = dll_bw - FLAGS_DLL_bw_hz_step) { - boost::filesystem::path p(gnuplot_executable); - boost::filesystem::path dir = p.parent_path(); - std::string gnuplot_path = dir.native(); - Gnuplot::set_GNUPlotPath(gnuplot_path); - - std::vector timevec; - double t = 0.0; - for (auto it = prompt.begin(); it != prompt.end(); it++) - { - timevec.push_back(t); - t = t + GPS_L1_CA_CODE_PERIOD; - } - Gnuplot g1("linespoints"); - g1.set_title("GPS L1 C/A signal tracking correlators' output (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); - g1.set_grid(); - g1.set_xlabel("Time [s]"); - g1.set_ylabel("Correlators' output"); - g1.cmd("set key box opaque"); - unsigned int decimate = static_cast(FLAGS_plot_decimate); - g1.plot_xy(timevec, prompt, "Prompt", decimate); - g1.plot_xy(timevec, early, "Early", decimate); - g1.plot_xy(timevec, late, "Late", decimate); - g1.savetops("Correlators_outputs"); - g1.savetopdf("Correlators_outputs", 18); - g1.showonscreen(); // window output - - Gnuplot g2("points"); - g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); - g2.set_grid(); - g2.set_xlabel("Inphase"); - g2.set_ylabel("Quadrature"); - g2.cmd("set size ratio -1"); - g2.plot_xy(promptI, promptQ); - g2.savetops("Constellation"); - g2.savetopdf("Constellation", 18); - g2.showonscreen(); // window output - - Gnuplot g3("linespoints"); - g3.set_title("GPS L1 C/A tracking CN0 output (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); - g3.set_grid(); - g3.set_xlabel("Time [s]"); - g3.set_ylabel("Reported CN0 [dB-Hz]"); - g3.cmd("set key box opaque"); - g3.plot_xy(timevec, CN0_dBHz, "Prompt", decimate); - g3.savetops("CN0_output"); - g3.savetopdf("CN0_output", 18); - g3.showonscreen(); // window output - } - catch (const GnuplotException& ge) - { - std::cout << ge.what() << std::endl; + PLL_wide_bw_values.push_back(FLAGS_PLL_bw_hz_start); + DLL_wide_bw_values.push_back(dll_bw); } } } + else + { + //PLL BW Sweep + for (double pll_bw = FLAGS_PLL_bw_hz_start; pll_bw >= FLAGS_PLL_bw_hz_stop; pll_bw = pll_bw - FLAGS_PLL_bw_hz_step) + { + PLL_wide_bw_values.push_back(pll_bw); + DLL_wide_bw_values.push_back(FLAGS_DLL_bw_hz_start); + } + } + + //********************************************* + //***** STEP 3: Generate the input signal ***** + //********************************************* + + + std::vector cno_vector; + if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop) + { + generator_CN0_values.push_back(FLAGS_CN0_dBHz_start); + } + else + { + for (double cn0 = FLAGS_CN0_dBHz_start; cn0 > FLAGS_CN0_dBHz_stop; cn0 = cn0 - FLAGS_CN0_dB_step) + { + generator_CN0_values.push_back(cn0); + } + } + + // use generator or use an external capture file + if (FLAGS_enable_external_signal_file) + { + //todo: create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters + } + else + { + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) + { + // Configure the signal generator + configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx); + // Generate signal raw signal samples and observations RINEX file + if (FLAGS_disable_generator == false) + { + generate_signal(); + } + // open true observables log file written by the simulator + } + } + + //************************************************************ + //***** STEP 4: Configure the signal tracking parameters ***** + //************************************************************ + for (unsigned int config_idx = 0; config_idx < PLL_wide_bw_values.size(); config_idx++) + { + //CN0 LOOP + // data containers for CN0 sweep + std::vector> prompt_sweep; + std::vector> early_sweep; + std::vector> late_sweep; + std::vector> promptI_sweep; + std::vector> promptQ_sweep; + std::vector> CN0_dBHz_sweep; + std::vector> trk_timestamp_s_sweep; + + std::vector> doppler_error_sweep; + std::vector> code_phase_error_sweep; + std::vector> acc_carrier_phase_error_sweep; + + std::vector mean_doppler_error; + std::vector std_dev_doppler_error; + std::vector mean_code_phase_error; + std::vector std_dev_code_phase_error; + std::vector mean_carrier_phase_error; + std::vector std_dev_carrier_phase_error; + std::vector valid_CN0_values; + + configure_receiver(PLL_wide_bw_values.at(config_idx), + DLL_wide_bw_values.at(config_idx), + FLAGS_PLL_narrow_bw_hz, + FLAGS_DLL_narrow_bw_hz, + FLAGS_extend_correlation_symbols); + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) + { + //****************************************************************************************** + //***** Obtain the initial signal sinchronization parameters (emulating an acquisition) **** + //****************************************************************************************** + if (!FLAGS_enable_external_signal_file) + { + test_satellite_PRN = FLAGS_test_satellite_PRN; + std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); + true_obs_file.append(std::to_string(test_satellite_PRN)); + true_obs_file.append(".dat"); + true_obs_data.close_obs_file(); + ASSERT_EQ(true_obs_data.open_obs_file(true_obs_file), true) << "Failure opening true observables file"; + // load acquisition data based on the first epoch of the true observations + ASSERT_EQ(true_obs_data.read_binary_obs(), true) + << "Failure reading true tracking dump file." << std::endl + << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + + " is not available?"; + std::cout << "Testing satellite PRN=" << test_satellite_PRN << std::endl; + std::cout << "Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << std::endl; + acq_doppler_hz = true_obs_data.doppler_l1_hz; + acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) * static_cast(baseband_sampling_freq) * GPS_L1_CA_CODE_PERIOD; + // restart the epoch counter + true_obs_data.restart(); + } + + + std::chrono::time_point start, end; + + top_block = gr::make_top_block("Tracking test"); + + std::shared_ptr trk_ = factory->GetBlock(config, "Tracking_1C", implementation, 1, 1); + std::shared_ptr tracking = std::dynamic_pointer_cast(trk_); + + boost::shared_ptr msg_rx = GpsL1CADllPllTrackingTest_msg_rx_make(); + + gnss_synchro.Acq_delay_samples = acq_delay_samples; + gnss_synchro.Acq_doppler_hz = acq_doppler_hz; + gnss_synchro.Acq_samplestamp_samples = 0; + + ASSERT_NO_THROW({ + tracking->set_channel(gnss_synchro.Channel_ID); + }) << "Failure setting channel."; + + ASSERT_NO_THROW({ + tracking->set_gnss_synchro(&gnss_synchro); + }) << "Failure setting gnss_synchro."; + + ASSERT_NO_THROW({ + tracking->connect(top_block); + }) << "Failure connecting tracking to the top_block."; + + ASSERT_NO_THROW({ + std::string file = "./" + filename_raw_data + std::to_string(current_cn0_idx); + const char* file_name = file.c_str(); + gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); + gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); + gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); + top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0); + top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 0); + top_block->connect(tracking->get_right_block(), 0, sink, 0); + top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); + }) << "Failure connecting the blocks of tracking test."; + + + //******************************************************************** + //***** STEP 5: Perform the signal tracking and read the results ***** + //******************************************************************** + std::cout << "------------ START TRACKING -------------" << std::endl; + tracking->start_tracking(); + + EXPECT_NO_THROW({ + start = std::chrono::system_clock::now(); + top_block->run(); // Start threads and wait + end = std::chrono::system_clock::now(); + }) << "Failure running the top_block."; + + std::chrono::duration elapsed_seconds = end - start; + std::cout << "Signal tracking completed in " << elapsed_seconds.count() << " seconds" << std::endl; + + int tracking_last_msg = msg_rx->rx_message; //save last aasynchronous tracking message in order to detect a loss of lock + + //check results + //load the measured values + tracking_dump_reader trk_dump; + ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true) + << "Failure opening tracking dump file"; + + long int n_measured_epochs = trk_dump.num_epochs(); + //std::cout << "Measured observation epochs=" << n_measured_epochs << std::endl; + + arma::vec trk_timestamp_s = arma::zeros(n_measured_epochs, 1); + arma::vec trk_acc_carrier_phase_cycles = arma::zeros(n_measured_epochs, 1); + arma::vec trk_Doppler_Hz = arma::zeros(n_measured_epochs, 1); + arma::vec trk_prn_delay_chips = arma::zeros(n_measured_epochs, 1); + + long int epoch_counter = 0; + + std::vector timestamp_s; + std::vector prompt; + std::vector early; + std::vector late; + std::vector promptI; + std::vector promptQ; + std::vector CN0_dBHz; + while (trk_dump.read_binary_obs()) + { + trk_timestamp_s(epoch_counter) = static_cast(trk_dump.PRN_start_sample_count) / static_cast(baseband_sampling_freq); + trk_acc_carrier_phase_cycles(epoch_counter) = trk_dump.acc_carrier_phase_rad / GPS_TWO_PI; + trk_Doppler_Hz(epoch_counter) = trk_dump.carrier_doppler_hz; + double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS * (fmod((static_cast(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast(baseband_sampling_freq), 1.0e-3) / 1.0e-3); + + trk_prn_delay_chips(epoch_counter) = delay_chips; + + timestamp_s.push_back(trk_timestamp_s(epoch_counter)); + prompt.push_back(trk_dump.abs_P); + early.push_back(trk_dump.abs_E); + late.push_back(trk_dump.abs_L); + promptI.push_back(trk_dump.prompt_I); + promptQ.push_back(trk_dump.prompt_Q); + CN0_dBHz.push_back(trk_dump.CN0_SNV_dB_Hz); + + epoch_counter++; + } + trk_timestamp_s_sweep.push_back(timestamp_s); + prompt_sweep.push_back(prompt); + early_sweep.push_back(early); + late_sweep.push_back(late); + promptI_sweep.push_back(promptI); + promptQ_sweep.push_back(promptQ); + CN0_dBHz_sweep.push_back(CN0_dBHz); + + //*********************************************************** + //***** STEP 6: Compare with true values (if available) ***** + //*********************************************************** + if (!FLAGS_enable_external_signal_file) + { + std::vector doppler_error_hz; + std::vector code_phase_error_chips; + std::vector acc_carrier_phase_hz; + + try + { + // load the true values + long int n_true_epochs = true_obs_data.num_epochs(); + //std::cout << "True observation epochs=" << n_true_epochs << std::endl; + + arma::vec true_timestamp_s = arma::zeros(n_true_epochs, 1); + arma::vec true_acc_carrier_phase_cycles = arma::zeros(n_true_epochs, 1); + arma::vec true_Doppler_Hz = arma::zeros(n_true_epochs, 1); + arma::vec true_prn_delay_chips = arma::zeros(n_true_epochs, 1); + arma::vec true_tow_s = arma::zeros(n_true_epochs, 1); + + long int epoch_counter = 0; + while (true_obs_data.read_binary_obs()) + { + true_timestamp_s(epoch_counter) = true_obs_data.signal_timestamp_s; + true_acc_carrier_phase_cycles(epoch_counter) = true_obs_data.acc_carrier_phase_cycles; + true_Doppler_Hz(epoch_counter) = true_obs_data.doppler_l1_hz; + true_prn_delay_chips(epoch_counter) = true_obs_data.prn_delay_chips; + true_tow_s(epoch_counter) = true_obs_data.tow; + epoch_counter++; + } + // Align initial measurements and cut the tracking pull-in transitory + double pull_in_offset_s = 1.0; + + arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first"); + if (initial_meas_point.size() > 0 and tracking_last_msg != 3) + { + trk_timestamp_s = trk_timestamp_s.subvec(initial_meas_point(0), trk_timestamp_s.size() - 1); + trk_acc_carrier_phase_cycles = trk_acc_carrier_phase_cycles.subvec(initial_meas_point(0), trk_acc_carrier_phase_cycles.size() - 1); + trk_Doppler_Hz = trk_Doppler_Hz.subvec(initial_meas_point(0), trk_Doppler_Hz.size() - 1); + trk_prn_delay_chips = trk_prn_delay_chips.subvec(initial_meas_point(0), trk_prn_delay_chips.size() - 1); + + + double mean_error; + double std_dev_error; + + valid_CN0_values.push_back(generator_CN0_values.at(current_cn0_idx)); //save the current cn0 value (valid tracking) + + doppler_error_hz = check_results_doppler(true_timestamp_s, true_Doppler_Hz, trk_timestamp_s, trk_Doppler_Hz, mean_error, std_dev_error); + mean_doppler_error.push_back(mean_error); + std_dev_doppler_error.push_back(std_dev_error); + + code_phase_error_chips = check_results_codephase(true_timestamp_s, true_prn_delay_chips, trk_timestamp_s, trk_prn_delay_chips, mean_error, std_dev_error); + mean_code_phase_error.push_back(mean_error); + std_dev_code_phase_error.push_back(std_dev_error); + + acc_carrier_phase_hz = check_results_acc_carrier_phase(true_timestamp_s, true_acc_carrier_phase_cycles, trk_timestamp_s, trk_acc_carrier_phase_cycles, mean_error, std_dev_error); + mean_carrier_phase_error.push_back(mean_error); + std_dev_carrier_phase_error.push_back(std_dev_error); + + //save tracking measurement timestamps to std::vector + std::vector vector_trk_timestamp_s(trk_timestamp_s.colptr(0), trk_timestamp_s.colptr(0) + trk_timestamp_s.n_rows); + trk_valid_timestamp_s_sweep.push_back(vector_trk_timestamp_s); + + doppler_error_sweep.push_back(doppler_error_hz); + code_phase_error_sweep.push_back(code_phase_error_chips); + acc_carrier_phase_error_sweep.push_back(acc_carrier_phase_hz); + } + else + { + std::cout << "Tracking output could not be used, possible loss of lock " << std::endl; + } + } + catch (const std::exception& ex) + { + std::cout << "Tracking output could not be used, possible loss of lock " << ex.what() << std::endl; + } + } + + } //CN0 LOOP + + if (!FLAGS_enable_external_signal_file) + { + mean_doppler_error_sweep.push_back(mean_doppler_error); + std_dev_doppler_error_sweep.push_back(std_dev_doppler_error); + mean_code_phase_error_sweep.push_back(mean_code_phase_error); + std_dev_code_phase_error_sweep.push_back(std_dev_code_phase_error); + mean_carrier_phase_error_sweep.push_back(mean_carrier_phase_error); + std_dev_carrier_phase_error_sweep.push_back(std_dev_carrier_phase_error); + //make a copy of the CN0 vector for each configuration parameter in order to filter the loss of lock events + generator_CN0_values_sweep_copy.push_back(valid_CN0_values); + } + + //******************************** + //***** STEP 7: Plot results ***** + //******************************** + if (FLAGS_plot_gps_l1_tracking_test == true) + { + const std::string gnuplot_executable(FLAGS_gnuplot_executable); + if (gnuplot_executable.empty()) + { + std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE," << std::endl; + std::cout << "gnuplot has not been found in your system." << std::endl; + std::cout << "Test results will not be plotted." << std::endl; + } + else + { + try + { + boost::filesystem::path p(gnuplot_executable); + boost::filesystem::path dir = p.parent_path(); + std::string gnuplot_path = dir.native(); + Gnuplot::set_GNUPlotPath(gnuplot_path); + unsigned int decimate = static_cast(FLAGS_plot_decimate); + + if (FLAGS_plot_detail_level >= 2) + { + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) + { + Gnuplot g1("linespoints"); + if (FLAGS_show_plots) g1.showonscreen(); // window output + g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g1.set_grid(); + g1.set_xlabel("Time [s]"); + g1.set_ylabel("Correlators' output"); + //g1.cmd("set key box opaque"); + g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), prompt_sweep.at(current_cn0_idx), "Prompt", decimate); + g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), early_sweep.at(current_cn0_idx), "Early", decimate); + g1.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), late_sweep.at(current_cn0_idx), "Late", decimate); + g1.set_legend(); + g1.savetops("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx))); + g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18); + } + Gnuplot g2("points"); + if (FLAGS_show_plots) g2.showonscreen(); // window output + g2.set_multiplot(ceil(static_cast(generator_CN0_values.size()) / 2.0), + ceil(static_cast(generator_CN0_values.size()) / 2)); + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) + { + g2.reset_plot(); + g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g2.set_grid(); + g2.set_xlabel("Inphase"); + g2.set_ylabel("Quadrature"); + //g2.cmd("set size ratio -1"); + g2.plot_xy(promptI_sweep.at(current_cn0_idx), promptQ_sweep.at(current_cn0_idx)); + } + g2.unset_multiplot(); + g2.savetops("Constellation"); + g2.savetopdf("Constellation", 18); + + Gnuplot g3("linespoints"); + g3.set_title("GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g3.set_grid(); + g3.set_xlabel("Time [s]"); + g3.set_ylabel("Reported CN0 [dB-Hz]"); + g3.cmd("set key box opaque"); + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) + { + g3.plot_xy(trk_timestamp_s_sweep.at(current_cn0_idx), CN0_dBHz_sweep.at(current_cn0_idx), + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + "[dB-Hz]", decimate); + } + g3.set_legend(); + g3.savetops("CN0_output"); + g3.savetopdf("CN0_output", 18); + if (FLAGS_show_plots) g3.showonscreen(); // window output + } + + //PLOT ERROR FIGURES (only if it is used the signal generator) + if (!FLAGS_enable_external_signal_file) + { + if (FLAGS_plot_detail_level >= 1) + { + Gnuplot g5("points"); + if (FLAGS_show_plots) g5.showonscreen(); // window output + g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g5.set_grid(); + g5.set_xlabel("Time [s]"); + g5.set_ylabel("Code delay error [Chips]"); + + + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values_sweep_copy.at(config_idx).size(); current_cn0_idx++) + { + try + { + g5.plot_xy(trk_valid_timestamp_s_sweep.at(current_cn0_idx), code_phase_error_sweep.at(current_cn0_idx), + std::to_string(static_cast(round(generator_CN0_values_sweep_copy.at(config_idx).at(current_cn0_idx)))) + "[dB-Hz]", decimate); + } + catch (const GnuplotException& ge) + { + } + } + g5.set_legend(); + g5.set_legend(); + g5.savetops("Code_error_output"); + g5.savetopdf("Code_error_output", 18); + + + Gnuplot g6("points"); + if (FLAGS_show_plots) g6.showonscreen(); // window output + g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g6.set_grid(); + g6.set_xlabel("Time [s]"); + g6.set_ylabel("Accumulated carrier phase error [Cycles]"); + + + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values_sweep_copy.at(config_idx).size(); current_cn0_idx++) + { + try + { + g6.plot_xy(trk_valid_timestamp_s_sweep.at(current_cn0_idx), acc_carrier_phase_error_sweep.at(current_cn0_idx), + std::to_string(static_cast(round(generator_CN0_values_sweep_copy.at(config_idx).at(current_cn0_idx)))) + "[dB-Hz]", decimate); + } + catch (const GnuplotException& ge) + { + } + } + g6.set_legend(); + g6.set_legend(); + g6.savetops("Carrier_phase_error_output"); + g6.savetopdf("Carrier_phase_error_output", 18); + + Gnuplot g4("points"); + if (FLAGS_show_plots) g4.showonscreen(); // window output + g4.set_multiplot(ceil(static_cast(generator_CN0_values.size()) / 2.0), + ceil(static_cast(generator_CN0_values.size()) / 2)); + for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values_sweep_copy.at(config_idx).size(); current_cn0_idx++) + { + g4.reset_plot(); + g4.set_title(std::to_string(static_cast(round(generator_CN0_values_sweep_copy.at(config_idx).at(current_cn0_idx)))) + "[dB-Hz], PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g4.set_grid(); + //g4.cmd("set key box opaque"); + g4.set_xlabel("Time [s]"); + g4.set_ylabel("Dopper error [Hz]"); + try + { + g4.plot_xy(trk_valid_timestamp_s_sweep.at(current_cn0_idx), doppler_error_sweep.at(current_cn0_idx), + std::to_string(static_cast(round(generator_CN0_values_sweep_copy.at(config_idx).at(current_cn0_idx)))) + "[dB-Hz]", decimate); + } + catch (const GnuplotException& ge) + { + } + } + g4.unset_multiplot(); + g4.savetops("Doppler_error_output"); + g4.savetopdf("Doppler_error_output", 18); + } + } + } + catch (const GnuplotException& ge) + { + std::cout << ge.what() << std::endl; + } + } + } + } + + if (FLAGS_plot_gps_l1_tracking_test == true) + { + std::cout << "Ploting performance metrics..." << std::endl; + try + { + if (generator_CN0_values.size() > 1) + { + //plot metrics + + Gnuplot g7("linespoints"); + if (FLAGS_show_plots) g7.showonscreen(); // window output + g7.set_title("Doppler error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g7.set_grid(); + g7.set_xlabel("CN0 [dB-Hz]"); + g7.set_ylabel("Doppler error [Hz]"); + g7.set_pointsize(2); + g7.cmd("set termoption lw 2"); + g7.cmd("set key box opaque"); + for (unsigned int config_sweep_idx = 0; config_sweep_idx < mean_doppler_error_sweep.size(); config_sweep_idx++) + { + g7.plot_xy_err(generator_CN0_values_sweep_copy.at(config_sweep_idx), + mean_doppler_error_sweep.at(config_sweep_idx), + std_dev_doppler_error_sweep.at(config_sweep_idx), + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_sweep_idx)) + + +"," + std::to_string(DLL_wide_bw_values.at(config_sweep_idx)) + " Hz"); + } + g7.savetops("Doppler_error_metrics"); + g7.savetopdf("Doppler_error_metrics", 18); + + Gnuplot g8("linespoints"); + g8.set_title("Accumulated carrier phase error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g8.set_grid(); + g8.set_xlabel("CN0 [dB-Hz]"); + g8.set_ylabel("Accumulated Carrier Phase error [Cycles]"); + g8.cmd("set key box opaque"); + g8.cmd("set termoption lw 2"); + g8.set_pointsize(2); + for (unsigned int config_sweep_idx = 0; config_sweep_idx < mean_doppler_error_sweep.size(); config_sweep_idx++) + { + g8.plot_xy_err(generator_CN0_values_sweep_copy.at(config_sweep_idx), + mean_carrier_phase_error_sweep.at(config_sweep_idx), + std_dev_carrier_phase_error_sweep.at(config_sweep_idx), + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_sweep_idx)) + + +"," + std::to_string(DLL_wide_bw_values.at(config_sweep_idx)) + " Hz"); + } + g8.savetops("Carrier_error_metrics"); + g8.savetopdf("Carrier_error_metrics", 18); + + Gnuplot g9("linespoints"); + g9.set_title("Code Phase error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); + g9.set_grid(); + g9.set_xlabel("CN0 [dB-Hz]"); + g9.set_ylabel("Code Phase error [Chips]"); + g9.cmd("set key box opaque"); + g9.cmd("set termoption lw 2"); + g9.set_pointsize(2); + for (unsigned int config_sweep_idx = 0; config_sweep_idx < mean_doppler_error_sweep.size(); config_sweep_idx++) + { + g9.plot_xy_err(generator_CN0_values_sweep_copy.at(config_sweep_idx), + mean_code_phase_error_sweep.at(config_sweep_idx), + std_dev_code_phase_error_sweep.at(config_sweep_idx), + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_sweep_idx)) + + +"," + std::to_string(DLL_wide_bw_values.at(config_sweep_idx)) + " Hz"); + } + g9.savetops("Code_error_metrics"); + g9.savetopdf("Code_error_metrics", 18); + } + } + catch (const GnuplotException& ge) + { + std::cout << ge.what() << std::endl; + } + } } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 7b7275eb0..328068dd1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -36,8 +36,8 @@ #include #include #include -#include // to test the FPGA we have to create a simultaneous task to send the samples using the DMA and stop the test -#include // FPGA read input file +#include // to test the FPGA we have to create a simultaneous task to send the samples using the DMA and stop the test +#include // FPGA read input file #include #include #include @@ -61,17 +61,17 @@ #include "signal_generator_flags.h" #include "interleaved_byte_to_complex_short.h" -#define DMA_TRACK_TRANSFER_SIZE 2046 // DMA transfer size for tracking -#define MIN_SAMPLES_REMAINING 20000 // number of remaining samples in the DMA that causes the CPU to stop the flowgraph (it has to be a bit alrger than 2x max packet size) -#define FIVE_SECONDS 5000000 // five seconds in microseconds +#define DMA_TRACK_TRANSFER_SIZE 2046 // DMA transfer size for tracking +#define MIN_SAMPLES_REMAINING 20000 // number of remaining samples in the DMA that causes the CPU to stop the flowgraph (it has to be a bit alrger than 2x max packet size) +#define FIVE_SECONDS 5000000 // five seconds in microseconds void send_tracking_gps_input_samples(FILE *rx_signal_file, - int num_remaining_samples, gr::top_block_sptr top_block) + int num_remaining_samples, gr::top_block_sptr top_block) { - int num_samples_transferred = 0; // number of samples that have been transferred to the DMA so far - static int flowgraph_stopped = 0; // flag to indicate if the flowgraph is stopped already - char *buffer_DMA; // temporary buffer to store the samples to be sent to the DMA - int dma_descr; // DMA descriptor + int num_samples_transferred = 0; // number of samples that have been transferred to the DMA so far + static int flowgraph_stopped = 0; // flag to indicate if the flowgraph is stopped already + char *buffer_DMA; // temporary buffer to store the samples to be sent to the DMA + int dma_descr; // DMA descriptor dma_descr = open("/dev/loop_tx", O_WRONLY); if (dma_descr < 0) { @@ -79,7 +79,7 @@ void send_tracking_gps_input_samples(FILE *rx_signal_file, exit(1); } - buffer_DMA = (char *) malloc(DMA_TRACK_TRANSFER_SIZE); + buffer_DMA = (char *)malloc(DMA_TRACK_TRANSFER_SIZE); if (!buffer_DMA) { fprintf(stderr, "Memory error!"); @@ -98,8 +98,7 @@ void send_tracking_gps_input_samples(FILE *rx_signal_file, } if (num_remaining_samples > DMA_TRACK_TRANSFER_SIZE) { - - fread(buffer_DMA, DMA_TRACK_TRANSFER_SIZE, 1,rx_signal_file); + fread(buffer_DMA, DMA_TRACK_TRANSFER_SIZE, 1, rx_signal_file); assert(DMA_TRACK_TRANSFER_SIZE == write(dma_descr, &buffer_DMA[0], DMA_TRACK_TRANSFER_SIZE)); num_remaining_samples = num_remaining_samples - DMA_TRACK_TRANSFER_SIZE; @@ -121,11 +120,11 @@ void send_tracking_gps_input_samples(FILE *rx_signal_file, // thread that sends the samples to the FPGA -void thread(gr::top_block_sptr top_block, const char * file_name) +void sending_thread(gr::top_block_sptr top_block, const char *file_name) { // file descriptor - FILE *rx_signal_file; // file descriptor - int file_length; // length of the file containing the received samples + FILE *rx_signal_file; // file descriptor + int file_length; // length of the file containing the received samples rx_signal_file = fopen(file_name, "rb"); if (!rx_signal_file) @@ -137,7 +136,7 @@ void thread(gr::top_block_sptr top_block, const char * file_name) file_length = ftell(rx_signal_file); fseek(rx_signal_file, 0, SEEK_SET); - usleep(FIVE_SECONDS); // wait for some time to give time to the other thread to program the device + usleep(FIVE_SECONDS); // wait for some time to give time to the other thread to program the device //send_tracking_gps_input_samples(dma_descr, rx_signal_file, file_length); send_tracking_gps_input_samples(rx_signal_file, file_length, top_block); @@ -163,14 +162,14 @@ private: public: int rx_message; - ~GpsL1CADllPllTrackingTestFpga_msg_rx(); //!< Default destructor + ~GpsL1CADllPllTrackingTestFpga_msg_rx(); //!< Default destructor }; GpsL1CADllPllTrackingTestFpga_msg_rx_sptr GpsL1CADllPllTrackingTestFpga_msg_rx_make() { return GpsL1CADllPllTrackingTestFpga_msg_rx_sptr( - new GpsL1CADllPllTrackingTestFpga_msg_rx()); + new GpsL1CADllPllTrackingTestFpga_msg_rx()); } @@ -181,7 +180,7 @@ void GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg) long int message = pmt::to_long(msg); rx_message = message; } - catch (boost::bad_any_cast& e) + catch (boost::bad_any_cast &e) { LOG(WARNING) << "msg_handler_telemetry Bad any cast!"; rx_message = 0; @@ -189,22 +188,22 @@ void GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events(pmt::pmt_t msg) } -GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() : - gr::block("GpsL1CADllPllTrackingTestFpga_msg_rx", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(0, 0, 0)) +GpsL1CADllPllTrackingTestFpga_msg_rx::GpsL1CADllPllTrackingTestFpga_msg_rx() : gr::block("GpsL1CADllPllTrackingTestFpga_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( - &GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events, - this, _1)); + boost::bind( + &GpsL1CADllPllTrackingTestFpga_msg_rx::msg_handler_events, + this, _1)); rx_message = 0; } GpsL1CADllPllTrackingTestFpga_msg_rx::~GpsL1CADllPllTrackingTestFpga_msg_rx() -{} +{ +} // ########################################################### @@ -226,12 +225,12 @@ public: int configure_generator(); int generate_signal(); - void check_results_doppler(arma::vec & true_time_s, arma::vec & true_value, - arma::vec & meas_time_s, arma::vec & meas_value); - void check_results_acc_carrier_phase(arma::vec & true_time_s, - arma::vec & true_value, arma::vec & meas_time_s, arma::vec & meas_value); - void check_results_codephase(arma::vec & true_time_s, arma::vec & true_value, - arma::vec & meas_time_s, arma::vec & meas_value); + void check_results_doppler(arma::vec &true_time_s, arma::vec &true_value, + arma::vec &meas_time_s, arma::vec &meas_value); + void check_results_acc_carrier_phase(arma::vec &true_time_s, + arma::vec &true_value, arma::vec &meas_time_s, arma::vec &meas_value); + void check_results_codephase(arma::vec &true_time_s, arma::vec &true_value, + arma::vec &meas_time_s, arma::vec &meas_value); GpsL1CADllPllTrackingTestFpga() { @@ -263,16 +262,15 @@ int GpsL1CADllPllTrackingTestFpga::configure_generator() p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file; if (FLAGS_dynamic_position.empty()) { - p2 = std::string("-static_position=") + FLAGS_static_position - + std::string(",") + std::to_string(FLAGS_duration * 10); + p2 = std::string("-static_position=") + FLAGS_static_position + std::string(",") + std::to_string(FLAGS_duration * 10); } else { p2 = std::string("-obs_pos_file=") + std::string(FLAGS_dynamic_position); } - p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output - p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples - p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps] + p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); //Baseband sampling frequency [MSps] return 0; } @@ -281,8 +279,8 @@ int GpsL1CADllPllTrackingTestFpga::generate_signal() { int child_status; - char * const parmList[] = { &generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], - &p4[0], &p5[0], NULL }; + char *const parmList[] = {&generator_binary[0], &generator_binary[0], &p1[0], &p2[0], &p3[0], + &p4[0], &p5[0], NULL}; int pid; if ((pid = fork()) == -1) @@ -310,14 +308,13 @@ void GpsL1CADllPllTrackingTestFpga::configure_receiver() gnss_synchro.PRN = FLAGS_test_satellite_PRN; config->set_property("GNSS-SDR.internal_fs_sps", - std::to_string(baseband_sampling_freq)); + std::to_string(baseband_sampling_freq)); // Set Tracking //config->set_property("Tracking_1C.implementation", // "GPS_L1_CA_DLL_PLL_C_Aid_Tracking_Fpga"); config->set_property("Tracking_1C.implementation", - "GPS_L1_CA_DLL_PLL_Tracking_Fpga"); + "GPS_L1_CA_DLL_PLL_Tracking_Fpga"); config->set_property("Tracking_1C.item_type", "cshort"); - config->set_property("Tracking_1C.if", "0"); config->set_property("Tracking_1C.dump", "true"); config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); config->set_property("Tracking_1C.pll_bw_hz", "30.0"); @@ -328,8 +325,8 @@ void GpsL1CADllPllTrackingTestFpga::configure_receiver() } -void GpsL1CADllPllTrackingTestFpga::check_results_doppler(arma::vec & true_time_s, - arma::vec & true_value, arma::vec & meas_time_s, arma::vec & meas_value) +void GpsL1CADllPllTrackingTestFpga::check_results_doppler(arma::vec &true_time_s, + arma::vec &true_value, arma::vec &meas_time_s, arma::vec &meas_value) { //1. True value interpolation to match the measurement times arma::vec true_value_interp; @@ -362,13 +359,13 @@ void GpsL1CADllPllTrackingTestFpga::check_results_doppler(arma::vec & true_time_ << ", mean=" << error_mean << ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Hz]" << std::endl; - std::cout.precision (ss); + std::cout.precision(ss); } void GpsL1CADllPllTrackingTestFpga::check_results_acc_carrier_phase( - arma::vec & true_time_s, arma::vec & true_value, arma::vec & meas_time_s, - arma::vec & meas_value) + arma::vec &true_time_s, arma::vec &true_value, arma::vec &meas_time_s, + arma::vec &meas_value) { //1. True value interpolation to match the measurement times arma::vec true_value_interp; @@ -401,13 +398,13 @@ void GpsL1CADllPllTrackingTestFpga::check_results_acc_carrier_phase( << ", mean=" << error_mean << ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Hz]" << std::endl; - std::cout.precision (ss); + std::cout.precision(ss); } void GpsL1CADllPllTrackingTestFpga::check_results_codephase( - arma::vec & true_time_s, arma::vec & true_value, arma::vec & meas_time_s, - arma::vec & meas_value) + arma::vec &true_time_s, arma::vec &true_value, arma::vec &meas_time_s, + arma::vec &meas_value) { //1. True value interpolation to match the measurement times arma::vec true_value_interp; @@ -439,7 +436,7 @@ void GpsL1CADllPllTrackingTestFpga::check_results_codephase( << ", mean=" << error_mean << ", stdev=" << sqrt(error_var) << " (max,min)=" << max_error << "," << min_error << " [Chips]" << std::endl; - std::cout.precision (ss); + std::cout.precision(ss); } @@ -463,27 +460,29 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) true_obs_file.append(std::to_string(test_satellite_PRN)); true_obs_file.append(".dat"); ASSERT_NO_THROW( + { + if (true_obs_data.open_obs_file(true_obs_file) == false) { - if (true_obs_data.open_obs_file(true_obs_file) == false) - { - throw std::exception(); - }; - }) << "Failure opening true observables file"; + throw std::exception(); + }; + }) + << "Failure opening true observables file"; top_block = gr::make_top_block("Tracking test"); //std::shared_ptr tracking = std::make_shared (config.get(), "Tracking_1C", 1, 1); - std::shared_ptr tracking = std::make_shared (config.get(), "Tracking_1C", 1, 1); + std::shared_ptr tracking = std::make_shared(config.get(), "Tracking_1C", 1, 1); boost::shared_ptr msg_rx = GpsL1CADllPllTrackingTestFpga_msg_rx_make(); // load acquisition data based on the first epoch of the true observations ASSERT_NO_THROW( + { + if (true_obs_data.read_binary_obs() == false) { - if (true_obs_data.read_binary_obs() == false) - { - throw std::exception(); - }; - }) << "Failure reading true observables file"; + throw std::exception(); + }; + }) + << "Failure reading true observables file"; //restart the epoch counter true_obs_data.restart(); @@ -492,52 +491,54 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << std::endl; - gnss_synchro.Acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) - * baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD; + gnss_synchro.Acq_delay_samples = (GPS_L1_CA_CODE_LENGTH_CHIPS - true_obs_data.prn_delay_chips / GPS_L1_CA_CODE_LENGTH_CHIPS) * baseband_sampling_freq * GPS_L1_CA_CODE_PERIOD; gnss_synchro.Acq_doppler_hz = true_obs_data.doppler_l1_hz; gnss_synchro.Acq_samplestamp_samples = 0; ASSERT_NO_THROW( - { - tracking->set_channel(gnss_synchro.Channel_ID); - }) << "Failure setting channel."; + { + tracking->set_channel(gnss_synchro.Channel_ID); + }) + << "Failure setting channel."; ASSERT_NO_THROW( - { - tracking->set_gnss_synchro(&gnss_synchro); - }) << "Failure setting gnss_synchro."; + { + tracking->set_gnss_synchro(&gnss_synchro); + }) + << "Failure setting gnss_synchro."; ASSERT_NO_THROW( - { - tracking->connect(top_block); - }) << "Failure connecting tracking to the top_block."; + { + tracking->connect(top_block); + }) + << "Failure connecting tracking to the top_block."; ASSERT_NO_THROW( - { - gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); - top_block->connect(tracking->get_right_block(), 0, sink, 0); - top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); - }) << "Failure connecting the blocks of tracking test."; + { + gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); + top_block->connect(tracking->get_right_block(), 0, sink, 0); + top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); + }) + << "Failure connecting the blocks of tracking test."; tracking->start_tracking(); // assemble again the file name in a null terminated string (not available by default in the main program flow) std::string file = "./" + filename_raw_data; - const char * file_name = file.c_str(); + const char *file_name = file.c_str(); // start thread that sends the DMA samples to the FPGA - boost::thread t - { thread, top_block, file_name }; + boost::thread t{sending_thread, top_block, file_name}; EXPECT_NO_THROW( - { - start = std::chrono::system_clock::now(); - top_block->run(); // Start threads and wait - //tracking->reset();// unlock the channel - end = std::chrono::system_clock::now(); - elapsed_seconds = end - start; - }) << "Failure running the top_block."; + { + start = std::chrono::system_clock::now(); + top_block->run(); // Start threads and wait + //tracking->reset();// unlock the channel + end = std::chrono::system_clock::now(); + elapsed_seconds = end - start; + }) + << "Failure running the top_block."; // wait until child thread terminates t.join(); @@ -567,12 +568,13 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) //load the measured values tracking_dump_reader trk_dump; ASSERT_NO_THROW( + { + if (trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")) == false) { - if (trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")) == false) - { - throw std::exception(); - }; - }) << "Failure opening tracking dump file"; + throw std::exception(); + }; + }) + << "Failure opening tracking dump file"; nepoch = trk_dump.num_epochs(); std::cout << "Measured observation epochs=" << nepoch << std::endl; @@ -585,14 +587,11 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) epoch_counter = 0; while (trk_dump.read_binary_obs()) { - trk_timestamp_s(epoch_counter) = static_cast(trk_dump.PRN_start_sample_count) - / static_cast(baseband_sampling_freq); + trk_timestamp_s(epoch_counter) = static_cast(trk_dump.PRN_start_sample_count) / static_cast(baseband_sampling_freq); trk_acc_carrier_phase_cycles(epoch_counter) = trk_dump.acc_carrier_phase_rad / GPS_TWO_PI; trk_Doppler_Hz(epoch_counter) = trk_dump.carrier_doppler_hz; - double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS - * (fmod( (static_cast(trk_dump.PRN_start_sample_count) + trk_dump.aux1) - / static_cast(baseband_sampling_freq), 1.0e-3) / 1.0e-3); + double delay_chips = GPS_L1_CA_CODE_LENGTH_CHIPS - GPS_L1_CA_CODE_LENGTH_CHIPS * (fmod((static_cast(trk_dump.PRN_start_sample_count) + trk_dump.aux1) / static_cast(baseband_sampling_freq), 1.0e-3) / 1.0e-3); trk_prn_delay_chips(epoch_counter) = delay_chips; epoch_counter++; @@ -600,7 +599,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) //Align initial measurements and cut the tracking pull-in transitory double pull_in_offset_s = 1.0; - arma::uvec initial_meas_point = arma::find( trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first"); + arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first"); trk_timestamp_s = trk_timestamp_s.subvec(initial_meas_point(0), trk_timestamp_s.size() - 1); trk_acc_carrier_phase_cycles = trk_acc_carrier_phase_cycles.subvec(initial_meas_point(0), trk_acc_carrier_phase_cycles.size() - 1); @@ -610,8 +609,8 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) check_results_doppler(true_timestamp_s, true_Doppler_Hz, trk_timestamp_s, trk_Doppler_Hz); check_results_codephase(true_timestamp_s, true_prn_delay_chips, trk_timestamp_s, trk_prn_delay_chips); check_results_acc_carrier_phase(true_timestamp_s, - true_acc_carrier_phase_cycles, trk_timestamp_s, - trk_acc_carrier_phase_cycles); + true_acc_carrier_phase_cycles, trk_timestamp_s, + trk_acc_carrier_phase_cycles); std::cout << "Signal tracking completed in " << elapsed_seconds.count() * 1e6 << " microseconds" << std::endl; } diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index cbdb6d28b..52ab62218 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -146,8 +146,6 @@ FrontEndCal_msg_rx::FrontEndCal_msg_rx() : gr::block("FrontEndCal_msg_rx", gr::i FrontEndCal_msg_rx::~FrontEndCal_msg_rx() {} -// ########################################################### - void wait_message() { while (!stop) @@ -234,8 +232,6 @@ bool front_end_capture(std::shared_ptr configuration) return false; } - //delete conditioner; - //delete source; return true; } @@ -275,7 +271,6 @@ int main(int argc, char** argv) if (FLAGS_log_dir.empty()) { std::cout << "Logging will be done at " - << "/tmp" << std::endl << "Use front-end-cal --log_dir=/path/to/log to change that." @@ -296,23 +291,26 @@ int main(int argc, char** argv) << FLAGS_log_dir << std::endl; } - // 0. Instantiate the FrontEnd Calibration class FrontEndCal front_end_cal; // 1. Load configuration parameters from config file - std::shared_ptr configuration = std::make_shared(FLAGS_config_file); - front_end_cal.set_configuration(configuration); - // 2. Get SUPL information from server: Ephemeris record, assistance info and TOW - if (front_end_cal.get_ephemeris() == true) + try { - std::cout << "SUPL data received OK!" << std::endl; + if (front_end_cal.get_ephemeris() == true) + { + std::cout << "SUPL data received OK!" << std::endl; + } + else + { + std::cout << "Failure connecting to SUPL server" << std::endl; + } } - else + catch (const boost::exception& e) { std::cout << "Failure connecting to SUPL server" << std::endl; } @@ -378,11 +376,6 @@ int main(int argc, char** argv) exit(0); } - //gr_basic_block_sptr head = gr_make_head(sizeof(gr_complex), nsamples); - //gr_head_sptr head_sptr = boost::dynamic_pointer_cast(head); - //head_sptr->set_length(nsamples); - //head_sptr->reset(); - try { acquisition->connect(top_block); @@ -449,7 +442,14 @@ int main(int argc, char** argv) { std::cout << " . "; } - channel_internal_queue.push(3); + try + { + channel_internal_queue.push(3); + } + catch (const boost::exception& e) + { + LOG(INFO) << "Exception caught while pushing to he internal queue."; + } try { ch_thread.join(); @@ -471,26 +471,37 @@ int main(int argc, char** argv) << elapsed_seconds.count() << " [seconds]" << std::endl; - //6. find TOW from SUPL assistance - + // 6. find TOW from SUPL assistance double current_TOW = 0; - if (global_gps_ephemeris_map.size() > 0) + try { - std::map Eph_map; - Eph_map = global_gps_ephemeris_map.get_map_copy(); - current_TOW = Eph_map.begin()->second.d_TOW; + if (global_gps_ephemeris_map.size() > 0) + { + std::map Eph_map; + Eph_map = global_gps_ephemeris_map.get_map_copy(); + current_TOW = Eph_map.begin()->second.d_TOW; - time_t t = utc_time(Eph_map.begin()->second.i_GPS_week, (long int)current_TOW); + time_t t = utc_time(Eph_map.begin()->second.i_GPS_week, (long int)current_TOW); - fprintf(stdout, "Reference Time:\n"); - fprintf(stdout, " GPS Week: %d\n", Eph_map.begin()->second.i_GPS_week); - fprintf(stdout, " GPS TOW: %ld %lf\n", (long int)current_TOW, (long int)current_TOW * 0.08); - fprintf(stdout, " ~ UTC: %s", ctime(&t)); - std::cout << "Current TOW obtained from SUPL assistance = " << current_TOW << std::endl; + fprintf(stdout, "Reference Time:\n"); + fprintf(stdout, " GPS Week: %d\n", Eph_map.begin()->second.i_GPS_week); + fprintf(stdout, " GPS TOW: %ld %lf\n", (long int)current_TOW, (long int)current_TOW * 0.08); + fprintf(stdout, " ~ UTC: %s", ctime(&t)); + std::cout << "Current TOW obtained from SUPL assistance = " << current_TOW << std::endl; + } + else + { + std::cout << "Unable to get Ephemeris SUPL assistance. TOW is unknown!" << std::endl; + delete acquisition; + delete gnss_synchro; + google::ShutDownCommandLineFlags(); + std::cout << "GNSS-SDR Front-end calibration program ended." << std::endl; + return 0; + } } - else + catch (const boost::exception& e) { - std::cout << "Unable to get Ephemeris SUPL assistance. TOW is unknown!" << std::endl; + std::cout << "Exception in getting Global ephemeris map" << std::endl; delete acquisition; delete gnss_synchro; google::ShutDownCommandLineFlags(); @@ -498,15 +509,15 @@ int main(int argc, char** argv) return 0; } - //Get user position from config file (or from SUPL using GSM Cell ID) + // Get user position from config file (or from SUPL using GSM Cell ID) double lat_deg = configuration->property("GNSS-SDR.init_latitude_deg", 41.0); double lon_deg = configuration->property("GNSS-SDR.init_longitude_deg", 2.0); double altitude_m = configuration->property("GNSS-SDR.init_altitude_m", 100); std::cout << "Reference location (defined in config file):" << std::endl; - std::cout << "Latitude=" << lat_deg << " [�]" << std::endl; - std::cout << "Longitude=" << lon_deg << " [�]" << std::endl; + std::cout << "Latitude=" << lat_deg << " [º]" << std::endl; + std::cout << "Longitude=" << lon_deg << " [º]" << std::endl; std::cout << "Altitude=" << altitude_m << " [m]" << std::endl; if (doppler_measurements_map.size() == 0) diff --git a/src/utils/gpstk/gnsspvt/CMakeLists.txt b/src/utils/gpstk/gnsspvt/CMakeLists.txt deleted file mode 100644 index b7255c413..000000000 --- a/src/utils/gpstk/gnsspvt/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -# CMAKE for GPSTK by Javier Arribas 2012 -cmake_minimum_required (VERSION 2.6) -project (gnsspvt_project) - -include_directories(${gnsspvt_project_SOURCE_DIR}/src) - -add_library (kml_printer_gpstk ${gnsspvt_project_SOURCE_DIR}/src/kml_printer_gpstk.cpp) -add_executable(gnsspvt ${gnsspvt_project_SOURCE_DIR}/src/gnsspvt.cpp) - -target_link_libraries (gnsspvt kml_printer_gpstk) - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules/") - -find_package(GPSTK REQUIRED) - -if ( NOT GPSTK_FOUND ) - message(FATAL_ERROR "GPSTK library not found!") -endif( NOT GPSTK_FOUND ) - -find_package(GLOG REQUIRED) -if ( NOT GLOG_FOUND ) - message(FATAL_ERROR "GLOG library not found!") -endif( NOT GLOG_FOUND ) - -include_directories(${GLOG_INCLUDE_DIRS}) - -# IMPORTANT NOTICE: The GPSTK linking order is critical. First it is required to link agains libprocframe to avoid vtable errors -include_directories(${GPSTK_INCLUDE_DIR}/gpstk ${GEOMATICS_INCLUDE_DIR} ${PROCFRAME_INCLUDE_DIR} ${VDRAW_INCLUDE_DIR} ${VPLOT_INCLUDE_DIR} ${RXIO_INCLUDE_DIR}) -# set(LIBS ${LIBS} ${GPSTK_LIBRARIES} ${GEOMATICS_LIBRARIES} ${VDRAW_LIBRARIES} ${VPLOT_LIBRARIES} ${RXIO_LIBRARIES}) -set(LIBS ${LIBS} ${PROCFRAME_LIBRARIES} ${GPSTK_LIBRARIES} ${GEOMATICS_LIBRARIES} ${GLOG_LIBRARIES}) - - -target_link_libraries(gnsspvt ${LIBS}) - -message(STATUS "GPSTK_INCLUDE_DIR="${GLOG_LIBRARIES}) -#message(STATUS "GPSTK_LIBRARIES=${GPSTK_LIBRARIES}") -#message(STATUS "LIBS=${LIBS}") - -# debug info: print all variables -#get_cmake_property(_variableNames VARIABLES) -#foreach (_variableName ${_variableNames}) -# message(STATUS "${_variableName}=${${_variableName}}") -#endforeach() - -#get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) -#foreach(dir ${dirs}) -# message(STATUS "INCLUDE_DIRECTORIES='${dir}'") -#endforeach() - diff --git a/src/utils/gpstk/gnsspvt/CMakeModules/FindGLOG.cmake b/src/utils/gpstk/gnsspvt/CMakeModules/FindGLOG.cmake deleted file mode 100644 index c4ddbe28a..000000000 --- a/src/utils/gpstk/gnsspvt/CMakeModules/FindGLOG.cmake +++ /dev/null @@ -1,103 +0,0 @@ -# - Try to find the Google Glog library -# -# This module defines the following variables -# -# GLOG_FOUND - Was Glog found -# GLOG_INCLUDE_DIRS - the Glog include directories -# GLOG_LIBRARIES - Link to this -# -# This module accepts the following variables -# -# GLOG_ROOT - Can be set to Glog install path or Windows build path -# -#============================================================================= -# FindGlog.cmake, adapted from FindBullet.cmake which has the following -# copyright - -#----------------------------------------------------------------------------- -# Copyright 2009 Kitware, Inc. -# Copyright 2009 Philip Lowman -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -if (NOT DEFINED GLOG_ROOT) -set (GLOG_ROOT /usr /usr/local) -endif (NOT DEFINED GLOG_ROOT) - -if(MSVC) -set(LIB_PATHS ${GLOG_ROOT} ${GLOG_ROOT}/Release) -else(MSVC) -set (LIB_PATHS ${GLOG_ROOT} ${GLOG_ROOT}/lib) -endif(MSVC) - -macro(_FIND_GLOG_LIBRARIES _var) -find_library(${_var} -NAMES -${ARGN} -PATHS -${LIB_PATHS} -PATH_SUFFIXES lib -) -mark_as_advanced(${_var}) -endmacro() - -macro(_GLOG_APPEND_LIBRARIES _list _release) -set(_debug ${_release}_DEBUG) -if(${_debug}) -set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}}) -else() -set(${_list} ${${_list}} ${${_release}}) -endif() -endmacro() - -if(MSVC) -find_path(GLOG_INCLUDE_DIR NAMES raw_logging.h -PATHS -${GLOG_ROOT}/src/windows -${GLOG_ROOT}/src/windows/glog -) -else(MSVC) -# Linux/OS X builds -find_path(GLOG_INCLUDE_DIR NAMES raw_logging.h -PATHS -${GLOG_ROOT}/include/glog -) -endif(MSVC) - -# Find the libraries -if(MSVC) -_FIND_GLOG_LIBRARIES(GLOG_LIBRARIES libglog.lib) -else(MSVC) -# Linux/OS X builds -_FIND_GLOG_LIBRARIES(GLOG_LIBRARIES libglog.so) -endif(MSVC) - -message("glog library = " ${GLOG_LIBRARIES}) - -# handle the QUIETLY and REQUIRED arguments and set GLOG_FOUND to TRUE if -# all listed variables are TRUE -include("${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake") -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glog DEFAULT_MSG -GLOG_LIBRARIES) - -if(MSVC) -string(REGEX REPLACE "/glog$" "" VAR_WITHOUT ${GLOG_INCLUDE_DIR}) -string(REGEX REPLACE "/windows$" "" VAR_WITHOUT ${VAR_WITHOUT}) -set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS} "${VAR_WITHOUT}") -string(REGEX REPLACE "/libglog.lib" "" GLOG_LIBRARIES_DIR ${GLOG_LIBRARIES}) -else(MSVC) -# Linux/OS X builds -set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR}) -string(REGEX REPLACE "/libglog.so" "" GLOG_LIBRARIES_DIR ${GLOG_LIBRARIES}) -endif(MSVC) - -if(GLOG_FOUND) -# _GLOG_APPEND_LIBRARIES(GLOG GLOG_LIBRARIES) -endif() diff --git a/src/utils/gpstk/gnsspvt/CMakeModules/FindGPSTK.cmake b/src/utils/gpstk/gnsspvt/CMakeModules/FindGPSTK.cmake deleted file mode 100644 index 9529154f9..000000000 --- a/src/utils/gpstk/gnsspvt/CMakeModules/FindGPSTK.cmake +++ /dev/null @@ -1,87 +0,0 @@ -# - Find gpstk library -# Find the native gpstk includes and library -# This module defines -# GPSTK_INCLUDE_DIR, where to find tiff.h, etc. -# GPSTK_LIBRARIES, libraries to link against to use GPSTK. -# GPSTK_FOUND, If false, do not try to use GPSTK. -# also defined, but not for general use are -# GPSTK_LIBRARY, where to find the GPSTK library. - -FIND_PATH(GPSTK_INCLUDE_DIR gpstk/Matrix.hpp) -FIND_PATH(GEOMATICS_INCLUDE_DIR gpstk/random.hpp) -FIND_PATH(PROCFRAME_INCLUDE_DIR gpstk/SolverWMS.hpp) -FIND_PATH(VDRAW_INCLUDE_DIR gpstk/Layout.hpp) -FIND_PATH(VPLOT_INCLUDE_DIR gpstk/ScatterPlot.hpp) -FIND_PATH(RXIO_INCLUDE_DIR gpstk/EphReader.hpp) - -SET(GPSTK_NAMES ${GPSTK_NAMES} gpstk libgpstk) -FIND_LIBRARY(GPSTK_LIBRARY NAMES ${GPSTK_NAMES} ) - -SET(GEOMATICS_NAMES ${GEOMATICS_NAMES} geomatics libgeomatics) -FIND_LIBRARY(GEOMATICS_LIBRARY NAMES ${GEOMATICS_NAMES} ) - -SET(PROCFRAME_NAMES ${PROCFRAME_NAMES} procframe libprocframe) -FIND_LIBRARY(PROCFRAME_LIBRARY NAMES ${PROCFRAME_NAMES} ) - -SET(VDRAW_NAMES ${VDRAW_NAMES} vdraw libvdraw) -FIND_LIBRARY(VDRAW_LIBRARY NAMES ${VDRAW_NAMES} ) - -SET(VPLOT_NAMES ${VPLOT_NAMES} vplot libvplot) -FIND_LIBRARY(VPLOT_LIBRARY NAMES ${VPLOT_NAMES} ) - -SET(RXIO_NAMES ${RXIO_NAMES} rxio librxio) -FIND_LIBRARY(RXIO_LIBRARY NAMES ${RXIO_NAMES} ) - -# handle the QUIETLY and REQUIRED arguments and set GPSTK_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GPSTK DEFAULT_MSG GPSTK_LIBRARY GPSTK_INCLUDE_DIR) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GEOMATICS DEFAULT_MSG GEOMATICS_LIBRARY GEOMATICS_INCLUDE_DIR) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROCFRAME DEFAULT_MSG PROCFRAME_LIBRARY PROCFRAME_INCLUDE_DIR) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(VDRAW DEFAULT_MSG VDRAW_LIBRARY VDRAW_INCLUDE_DIR) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(VPLOT DEFAULT_MSG VPLOT_LIBRARY VPLOT_INCLUDE_DIR) - -FIND_PACKAGE_HANDLE_STANDARD_ARGS(RXIO DEFAULT_MSG RXIO_LIBRARY RXIO_INCLUDE_DIR) - -IF(GPSTK_FOUND) - SET( GPSTK_LIBRARIES ${GPSTK_LIBRARY} ) -ENDIF(GPSTK_FOUND) - -IF(GEOMATICS_FOUND) - SET( GEOMATICS_LIBRARIES ${GEOMATICS_LIBRARY} ) -ENDIF(GEOMATICS_FOUND) - -IF(PROCFRAME_FOUND) - SET( PROCFRAME_LIBRARIES ${PROCFRAME_LIBRARY} ) -ENDIF(PROCFRAME_FOUND) - -IF(VDRAW_FOUND) - SET( VDRAW_LIBRARIES ${VDRAW_LIBRARY} ) -ENDIF(VDRAW_FOUND) - -IF(VPLOT_FOUND) - SET( VPLOT_LIBRARIES ${VPLOT_LIBRARY} ) -ENDIF(VPLOT_FOUND) - -IF(RXIO_FOUND) - SET( RXIO_LIBRARIES ${RXIO_LIBRARY} ) -ENDIF(RXIO_FOUND) - -MARK_AS_ADVANCED(GPSTK_INCLUDE_DIR GPSTK_LIBRARY) - -MARK_AS_ADVANCED(GEOMATICS_INCLUDE_DIR GEOMATICS_LIBRARY) - -MARK_AS_ADVANCED(PROCFRAME_INCLUDE_DIR PROCFRAME_LIBRARY) - -MARK_AS_ADVANCED(VDRAW_INCLUDE_DIR VDRAW_LIBRARY) - -MARK_AS_ADVANCED(VPLOT_INCLUDE_DIR VPLOT_LIBRARY) - -MARK_AS_ADVANCED(RXIO_INCLUDE_DIR RXIO_LIBRARY) - - diff --git a/src/utils/gpstk/gnsspvt/README b/src/utils/gpstk/gnsspvt/README deleted file mode 100644 index 6360ac4be..000000000 --- a/src/utils/gpstk/gnsspvt/README +++ /dev/null @@ -1,62 +0,0 @@ -ABOUT GNSSPVT ----------------------- -This program uses the high level GpsTk classes to implement a simple PVT solver -that uses RINEX files as an input. -The output is written both in the console and in a Google Earth KML file. - -HOW TO BUILD GNSSPVT ----------------------- - -Installation in Ubuntu 11.04, 11.10, 12.04 (32 and 64 bits) ------------------------------------------------------------ - -- Install CMake through your OS's package manager or by some other means. - -- Install GpsTk: - - The following procedure will build and install the GPSTk. - - Ensure that prerequisites such as jam have been installed. - Download the GPSTk source distribution from http://www.gpstk.org/bin/view/Documentation/GPSTkDownloads - Extract the GPSTk tarball. For example, using GNU tar - - tar xvzf gpstk.tar.gz - - Change into the gpstk/dev directory (if using Subversion) or the gpstk/ directory (if using the tarball)and type - - jam - - To build the source documentation using doxygen: - - doxygen - - To install GPSTk as a system library in /usr/local, assume root privileges then execute - - jam install - - To install to a different directory, define the environment variable PREFIX to point to the root of the installation - - -- Download, unzip, configure, build and install glog, a Google's library that implements application-level logging: - -$ wget http://google-glog.googlecode.com/files/glog-0.3.2.tar.gz -$ tar xvfz glog-0.3.2.tar.gz -$ cd glog-0.3.2 -$ ./configure -$ make -$ sudo make install - -- Go to GNSSPVT root directory and compile the gnsspvt: - -$ cd gnss-sdr/src/utils/gpstk/gnsspvt/ -$ mkdir build -$ cd build -$ cmake ../ -$ make - -If everything goes well, the executable file is available in the build directory. - -USAGE ----------------------- - -./gnsspvt -i path_to_rinex_observable_file -n path_to_rinex_navigation_file -k path_to_kml_output_file diff --git a/src/utils/gpstk/gnsspvt/src/gnsspvt.cpp b/src/utils/gpstk/gnsspvt/src/gnsspvt.cpp deleted file mode 100644 index e571e3138..000000000 --- a/src/utils/gpstk/gnsspvt/src/gnsspvt.cpp +++ /dev/null @@ -1,593 +0,0 @@ -/*! - * \file gnsspvt.cpp - * \brief Adapted version of high level gpstk PVT solver to read RINEX files, - * compute the position, velocity and time solution, and write Google Earth KML output file. - * The input Observables and Navigation files can be RINEX 2.10 or RINEX 3.00. - * It is a modified version of the example5.cpp code provided in gpstk source code. - * - * \author Javier Arribas, 2012. jarribas(at)cttc.es - * - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2012 (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 . - * - * ------------------------------------------------------------------------- - */ - -// Modified Example program Nro 5 for GPSTk -// This program shows how to use some high-level GPSTk classes - - // Basic input/output C++ class -#include - - // Classes for handling observations RINEX files (data) -#include "gpstk/Rinex3ObsData.hpp" -#include "gpstk/Rinex3ObsStream.hpp" - - // Class to easily extract data from Rinex3ObsData objects -#include "gpstk/ExtractData.hpp" - - // Classes for handling satellite navigation parameters RINEX files - // (Broadcast ephemerides) -#include "gpstk/Rinex3NavHeader.hpp" -#include "gpstk/Rinex3NavData.hpp" -#include "gpstk/Rinex3NavStream.hpp" - - // Class to store satellite broadcast navigation data -#include "gpstk/GPSEphemerisStore.hpp" - - // Class to model GPS data for a mobile receiver -#include "gpstk/ModeledPR.hpp" - -#include "gpstk/GNSSconstants.hpp" -#include "gpstk/CommonTime.hpp" -#include "gpstk/SatID.hpp" -#include "gpstk/Matrix.hpp" -#include "gpstk/XvtStore.hpp" -#include "gpstk/TropModel.hpp" - - // Class to model the tropospheric delays -#include "gpstk/TropModel.hpp" - - // Classes to model ans store ionospheric delays -#include "gpstk/IonoModel.hpp" -#include "gpstk/IonoModelStore.hpp" - - // Class to solve the equations system using a Weighted Least Mean Square method -#include "gpstk/SolverWMS.hpp" - - // Class to compute the weights to be used for each satellite -#include "gpstk/MOPSWeight.hpp" - - // Basic framework for programs in the GPSTk. The 'process()' method MUST - // be implemented -#include "gpstk/BasicFramework.hpp" - -#include "gpstk/geometry.hpp" // DEG_TO_RAD - - // Time-class year-day-second -#include "gpstk/YDSTime.hpp" - -#include "kml_printer_gpstk.h" - -using namespace std; -using namespace gpstk; - - - // A new class is declared that will handle program behaviour - // This class inherits from BasicFramework -class gpstk_solver : public BasicFramework -{ -public: - - // Constructor declaration - gpstk_solver(char* arg0); - ~gpstk_solver(); - -protected: - - // Method that will take care of processing - virtual void process(); - - // Method that hold code to be run BEFORE processing - virtual void spinUp(); - - virtual int Prepare( const CommonTime& Tr, - std::vector& Satellite, - std::vector& Pseudorange, - const XvtStore& Eph ); - virtual int Prepare2( const CommonTime& Tr, - const Vector& Satellite, - const Vector& Pseudorange, - const XvtStore& Eph ); - -private: - - // These field represent options at command line interface (CLI) - CommandOptionWithArg dataFile; - CommandOptionWithArg navFile; - CommandOptionWithArg kmlFile; - - Kml_Printer_gpstk kml_printer; - - // If you want to share objects and variables among methods, you'd - // better declare them here - Rinex3ObsStream rObsFile; // Object to read Rinex observation data files - Rinex3ObsData rData; // Object to store Rinex observation data - Rinex3NavStream rNavFile; // Object to read Rinex navigation data files - Rinex3NavData rNavData; // Object to store Rinex navigation data - Rinex3NavHeader rNavHeader; // Object to read the header of Rinex - // navigation data files - IonoModelStore ionoStore; // Object to store ionospheric models - GPSEphemerisStore bceStore; // Object to store ephemeris - ModeledPR modelPR; // Declare a ModeledReferencePR object - MOPSTropModel mopsTM; // Declare a MOPSTropModel object - ExtractData obsC1; // Declare an ExtractData object - int indexC1; // Index to "C1" observation - bool useFormerPos; // Flag indicating if we have an a priori - // position - Position formerPosition; // Object to store the former position - IonoModel ioModel; // Declare a Ionospheric Model object - SolverWMS solver; // Declare an object to apply WMS method - MOPSWeight mopsWeights; // Object to compute satellites' weights - -}; - - - // Let's implement constructor details -gpstk_solver::gpstk_solver(char* arg0) - : BasicFramework(arg0, "\nProgram to print the position solution in ECEF " - "and longitude, latitude, height, based in C1 and " - "given a RINEX observations file and a RINEX " - "broadcast navigation file.\n\n" - "The output is: \n" - " Time(sec) X(m) Y(m) Z(m) Lon(deg) " - " Lat(deg) Height(m)\n"), - // Option initialization. "true" means a mandatory option - dataFile(CommandOption::stdType, 'i', "datainput", - " [-i|--datainput] Name of RINEX observations file.", true), - navFile(CommandOption::stdType, 'n', "navinput", - " [-n|--navinput] Name of RINEX broadcast navigation file.", true), - kmlFile(CommandOption::stdType, 'k', "kmloutput", - " [-n|--navinput] Name of KML output file.", true) -{ - // These options may appear just once at CLI - dataFile.setMaxCount(1); - navFile.setMaxCount(1); - kmlFile.setMaxCount(1); -} // End of constructor details - - - - /* Method to set an a priori position of receiver using - * Bancroft's method. - * - * @param Tr Time of observation - * @param Satellite std::vector of satellites in view - * @param Pseudorange std::vector of pseudoranges measured from - * rover station to satellites - * @param Eph Satellites Ephemeris - * - * @return - * 0 if OK - * -1 if problems arose - */ - int gpstk_solver::Prepare( const CommonTime& Tr, - std::vector& Satellite, - std::vector& Pseudorange, - const XvtStore& Eph ) - { - - Matrix SVP; - Bancroft Ban; - Vector vPos; - PRSolution2 raimObj; - - try - { - cerr << "Tr=" <::iterator it = Satellite.begin() ; it != Satellite.end(); ++it) - { - cerr << "SatID=" << *it<& Satellite, - const Vector& Pseudorange, - const XvtStore& Eph ) - { - - int i; - std::vector vSat; - std::vector vPR; - - // Convert from gpstk::Vector to std::vector - for (i = 0; i < (int)Satellite.size(); i++) - { - vSat.push_back(Satellite[i]); - } - - for (i = 0; i < (int)Pseudorange.size(); i++) - { - vPR.push_back(Pseudorange[i]); - } - - return Prepare(Tr, vSat, vPR, Eph); - - } // End of method 'ModeledPR::Prepare()' - - - // Method that will be executed AFTER initialization but BEFORE processing -void gpstk_solver::spinUp() -{ - - - //open KML output file - if (kml_printer.set_headers(kmlFile.getValue()[0].c_str())!=true) - { - cerr << "Problem creating the kml file "<> roh; - - // We need the index pointing to C1-type observations - try - { - indexC1 = roh.getObsIndex( "C1" ); - } - catch(...) - { - cerr << "The observation file doesn't have C1 pseudoranges." << endl; - exit(1); - } - - - // Activate failbit to enable exceptions - rNavFile.exceptions(ios::failbit); - - // Read nav file and store unique list of ephemerides - try - { - rNavFile.open(navFile.getValue()[0].c_str(), std::ios::in); - } - catch(...) - { - cerr << "Problem opening file " << navFile.getValue()[0].c_str() << endl; - cerr << "Maybe it doesn't exist or you don't have proper read " - << "permissions." << endl; - - exit (-1); - } - - // We will need to read ionospheric parameters (Klobuchar model) from - // the file header - rNavFile >> rNavHeader; - - // Let's feed the ionospheric model (Klobuchar type) from data in the - // navigation (ephemeris) file header. First, we must check if there are - // valid ionospheric correction parameters in the header - if(rNavHeader.valid & Rinex3NavHeader::validIonoCorrGPS) - { - // Extract the Alpha and Beta parameters from the header - double* ionAlpha = rNavHeader.mapIonoCorr["GPSA"].param; - double* ionBeta = rNavHeader.mapIonoCorr["GPSB"].param; - - // Feed the ionospheric model with the parameters - ioModel.setModel(ionAlpha, ionBeta); - } - else - { - cerr << "WARNING: Navigation file " << navFile.getValue()[0].c_str() - << " doesn't have valid ionospheric correction parameters." << endl; - } - - // WARNING-WARNING-WARNING: In this case, the same model will be used - // for the full data span - ionoStore.addIonoModel(CommonTime::BEGINNING_OF_TIME, ioModel); - - // Storing the ephemeris in "bceStore" - while (rNavFile >> rNavData) - { - bceStore.addEphemeris(rNavData); - rNavData.dump(cerr); - cerr<> rData ) - { - - // Begin usable data with enough number of satellites - if( (rData.epochFlag == 0 || rData.epochFlag == 1) && - (rData.numSVs > 3) ) - { - - // Number of satellites with valid data in this epoch - int validSats = 0; - int prepareResult; - double rxAltitude; // Receiver altitude for tropospheric model - double rxLatitude; // Receiver latitude for tropospheric model - - // We need to extract C1 data from this epoch. Skip epoch if not - // enough data (4 SV at least) is available - if( obsC1.getData(rData, indexC1) < 4 ) - { - // The former position will not be valid next time - useFormerPos = false; - continue; - } - - - // If possible, use former position as a priori - if( useFormerPos ) - { - - prepareResult = modelPR.Prepare(formerPosition); - - // We need to seed this kind of tropospheric model with - // receiver altitude - rxAltitude = formerPosition.getAltitude(); - rxLatitude = formerPosition.getGeodeticLatitude(); - - } - else - { - // Use Bancroft method is no a priori position is available - cerr << "Bancroft method was used at epoch " - << static_cast(rData.time).sod << endl; - - Prepare2( rData.time,obsC1.availableSV,obsC1.obsData,bceStore ); - prepareResult = modelPR.Prepare( rData.time, - obsC1.availableSV, - obsC1.obsData, - bceStore ); - - // We need to seed this kind of tropospheric model with - // receiver altitude - rxAltitude = modelPR.rxPos.getAltitude(); - rxLatitude = modelPR.rxPos.getGeodeticLatitude(); - } - - // If there were problems with Prepare(), skip this epoch - if( prepareResult ) - { - // The former position will not be valid next time - useFormerPos = false; - continue; - } - - // If there were no problems, let's feed the tropospheric model - mopsTM.setReceiverHeight(rxAltitude); - mopsTM.setReceiverLatitude(rxLatitude); - mopsTM.setDayOfYear(static_cast(rData.time).doy); - - - // Now, let's compute the GPS model for our observable (C1) - validSats = modelPR.Compute( rData.time, - obsC1.availableSV, - obsC1.obsData, - bceStore, - &mopsTM, - &ionoStore ); - - // Only get into further computations if there are enough - // satellites - if( validSats >= 4 ) - { - - // Now let's solve the navigation equations using the WMS method - try - { - // First, compute the satellites' weights - int goodSv = mopsWeights.getWeights( rData.time, - modelPR.availableSV, - bceStore, - modelPR.ionoCorrections, - modelPR.elevationSV, - modelPR.azimuthSV, - modelPR.rxPos ); - - // Some minimum checking is in order - if ( goodSv != (int)modelPR.prefitResiduals.size() ) continue; - - // Then, solve the system - solver.Compute( modelPR.prefitResiduals, - modelPR.geoMatrix, - mopsWeights.weightsVector ); - - } - catch( InvalidSolver& e ) - { - cerr << "Couldn't solve equations system at epoch " - << static_cast(rData.time).sod << endl; - cerr << e << endl; - - // The former position will not be valid next time - useFormerPos = false; - continue; - } - - // With "solver", we got the difference vector between the - // a priori position and the computed, 'real' position. Then, - // let's convert the solution to a Position object - Position solPos( (modelPR.rxPos.X() + solver.solution[0]), - (modelPR.rxPos.Y() + solver.solution[1]), - (modelPR.rxPos.Z() + solver.solution[2]) ); - - // Print results - cout << static_cast(rData.time).sod - << " "; // Output field #1 - cout << "X="<= 4 )' - else - { - // The former position will not be valid next time - useFormerPos = false; - } - - } // End of 'if( (rData.epochFlag == 0 || rData.epochFlag == 1) &&...' - else - { - // The former position will not be valid next time - useFormerPos = false; - } - - } // End of 'while( rObsFile >> rData )' - - return; - -} // End of 'gpstk_solver::process()' - -gpstk_solver::~gpstk_solver() -{ - kml_printer.close_file(); -} - // Main function -int main(int argc, char* argv[]) -{ - - try - { - gpstk_solver program(argv[0]); - if (!program.initialize(argc, argv)) - return 0; - if (!program.run()) - return 1; - - return 0; - } - catch(Exception& e) - { - cout << "Problem: " << e << endl; - return 1; - } - catch(...) - { - cout << "Unknown error." << endl; - return 1; - } - - return 0; - -} // End of 'main()' diff --git a/src/utils/gpstk/gnsspvt/src/kml_printer_gpstk.cpp b/src/utils/gpstk/gnsspvt/src/kml_printer_gpstk.cpp deleted file mode 100644 index 7778c1dfe..000000000 --- a/src/utils/gpstk/gnsspvt/src/kml_printer_gpstk.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/*! - * \file kml_printer.cc - * \brief Implementation of a class that prints PVT information to a kml file - * for GPSTK data structures - * \author Javier Arribas, 2012. jarribas(at)cttc.es - * - * - * ------------------------------------------------------------------------- - * - * Copyright (C) 2010-2012 (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 "kml_printer_gpstk.h" -#include -#include -#include - -bool Kml_Printer_gpstk::set_headers(std::string filename) -{ - time_t rawtime; - struct tm * timeinfo; - time ( &rawtime ); - timeinfo = localtime ( &rawtime ); - kml_file.open(filename.c_str()); - if (kml_file.is_open()) - { - DLOG(INFO) << "KML printer writing on " << filename.c_str(); - // Set iostream numeric format and precision - kml_file.setf(kml_file.fixed,kml_file.floatfield); - kml_file << std::setprecision(14); - kml_file << "" << std::endl - << "" << std::endl - << " " << std::endl - << " GNSS Track" << std::endl - << " GNSS-SDR Receiver position log file created at " << asctime (timeinfo) - << " " << std::endl - << "" << std::endl - << "" << std::endl - << "GNSS-SDR PVT" << std::endl - << "GNSS-SDR position log" << std::endl - << "#yellowLineGreenPoly" << std::endl - << "" << std::endl - << "0" << std::endl - << "1" << std::endl - << "absolute" << std::endl - << "" << std::endl; - return true; - } - else - { - return false; - } -} - - - -bool Kml_Printer_gpstk::print_position(gpstk::Position position) -{ - double latitude; - double longitude; - double height; - latitude = position.geodeticLatitude(); - longitude = position.getLongitude(); - if (longitude>190) - { - longitude=longitude-360; - } - height = position.getHeight(); - - if (kml_file.is_open()) - { - kml_file << longitude << "," << latitude << "," << height << std::endl; - return true; - } - else - { - return false; - } -} - - - -bool Kml_Printer_gpstk::close_file() -{ - if (kml_file.is_open()) - { - kml_file << "" << std::endl - << "" << std::endl - << "" << std::endl - << "" << std::endl - << ""; - kml_file.close(); - return true; - } - else - { - return false; - } -} - - - -Kml_Printer_gpstk::Kml_Printer_gpstk () {} - - - -Kml_Printer_gpstk::~Kml_Printer_gpstk () {} - diff --git a/src/utils/matlab/libs/read_hybrid_observables_dump.m b/src/utils/matlab/libs/read_hybrid_observables_dump.m index 3ccfe9b67..f8dccdd41 100644 --- a/src/utils/matlab/libs/read_hybrid_observables_dump.m +++ b/src/utils/matlab/libs/read_hybrid_observables_dump.m @@ -79,7 +79,7 @@ else % { % tmp_double = current_gnss_synchro[i].RX_time; % d_dump_file.write((char*)&tmp_double, sizeof(double)); - % tmp_double = current_gnss_synchro[i].TOW_at_current_symbol_s; + % tmp_double = current_gnss_synchro[i].TOW_at_current_symbol_ms; % d_dump_file.write((char*)&tmp_double, sizeof(double)); % tmp_double = current_gnss_synchro[i].Carrier_Doppler_hz; % d_dump_file.write((char*)&tmp_double, sizeof(double)); diff --git a/src/utils/matlab/plot_acq_grid.m b/src/utils/matlab/plot_acq_grid.m index c18e44556..86a710e76 100644 --- a/src/utils/matlab/plot_acq_grid.m +++ b/src/utils/matlab/plot_acq_grid.m @@ -33,6 +33,8 @@ file = 'acq'; sat = 7; +channel = 0; +execution = 1; % Signal: % 1 GPS L1 % 2 GPS L2M @@ -77,7 +79,7 @@ switch(signal_type) system = 'R'; signal = '1G'; end -filename = [path file '_' system '_' signal '_sat_' num2str(sat) '.mat']; +filename = [path file '_' system '_' signal '_ch_' num2str(channel) '_' num2str(execution) '_sat_' num2str(sat) '.mat']; load(filename); [n_fft n_dop_bins] = size(grid); [d_max f_max] = find(grid == max(max(grid))); @@ -105,7 +107,8 @@ 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) -plot(delay, grid(:, f_max)) +normalization = (d_samples_per_code^4) * input_power; +plot(delay, acq_grid(:, f_max)./normalization) xlim([min(delay) max(delay)]) xlabel('Code delay / chips') ylabel('Test statistics') diff --git a/src/utils/matlab/plot_tracking_quality_indicators.m b/src/utils/matlab/plot_tracking_quality_indicators.m new file mode 100644 index 000000000..a1c263aa3 --- /dev/null +++ b/src/utils/matlab/plot_tracking_quality_indicators.m @@ -0,0 +1,18 @@ +%plot tracking quality indicators +figure; +hold on; +title('Carrier lock test output for all the channels'); +for n=1:1:length(GNSS_tracking) + plot(GNSS_tracking(n).carrier_lock_test) + plotnames{n}=['SV ' num2str(round(mean(GNSS_tracking(n).PRN)))]; +end +legend(plotnames); + +figure; +hold on; +title('Carrier CN0 output for all the channels'); +for n=1:1:length(GNSS_tracking) + plot(GNSS_tracking(n).CN0_SNV_dB_Hz) + plotnames{n}=['SV ' num2str(round(mean(GNSS_tracking(n).PRN)))]; +end +legend(plotnames); \ No newline at end of file diff --git a/src/utils/reproducibility/ieee-access18/README.md b/src/utils/reproducibility/ieee-access18/README.md index 62098afaa..58a2350ff 100644 --- a/src/utils/reproducibility/ieee-access18/README.md +++ b/src/utils/reproducibility/ieee-access18/README.md @@ -4,7 +4,7 @@ Continuous Reproducibility in GNSS Signal Processing This folder contains files required for the reproduction of the experiment proposed in: -C. Fernández-Prades, J. Vilà-Valls, J. Arribas and A. Ramos, [*Continuous Reproducibility in GNSS Signal Processing*](http://ieeexplore.ieee.org/document/8331069/), IEEE Access, accepted for publication, April 2018. DOI: 10.1109/ACCESS.2018.2822835 +C. Fernández-Prades, J. Vilà-Valls, J. Arribas and A. Ramos, [*Continuous Reproducibility in GNSS Signal Processing*](https://ieeexplore.ieee.org/document/8331069/), IEEE Access, Vol. 6, No. 1, pp. 20451-20463, April 2018. DOI: [10.1109/ACCESS.2018.2822835](https://doi.org/10.1109/ACCESS.2018.2822835) The data set used in this paper is available at https://zenodo.org/record/1184601