From faeeed68a1f06e047a806e6228f11b0f192e214d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Apr 2015 19:39:45 +0200 Subject: [PATCH 01/25] small fix --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0335f60a2..de6d41eaf 100644 --- a/README.md +++ b/README.md @@ -21,9 +21,9 @@ GNU/Linux * Supported microprocessor architectures: * i386: Intel x86 instruction set (32-bit microprocessors). * amd64: also known as x86-64, the 64-bit version of the x86 instruction set, originally created by AMD and implemented by AMD, Intel, VIA and others. - * armel: ARM embedded ABI, supported on ARM v4t and higher (for Debian only). - * armhf: ARM hard float, ARMv7 + VFP3-D16 floating-point hardware extension + Thumb-2 instruction set and above (for Debian only). - * arm64: ARM 64 bits or ARMv8 (for Debian only). + * armel: ARM embedded ABI, supported on ARM v4t and higher. + * armhf: ARM hard float, ARMv7 + VFP3-D16 floating-point hardware extension + Thumb-2 instruction set and above. + * arm64: ARM 64 bits or ARMv8. Older distribution releases might work as well, but you will need GCC 4.7 or newer. From f250e08652488d4010f96842906f343160ab3abc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Apr 2015 19:47:15 +0200 Subject: [PATCH 02/25] adding ref to Ubuntu 15.04 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index de6d41eaf..e5cbc8365 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This section describes how to set up the compilation environment in GNU/Linux or GNU/Linux ---------- - * Tested distributions: Ubuntu 14.04 LTS and 14.10, Debian 8.0 "jessie". + * Tested distributions: Ubuntu 14.04 LTS, 14.10 and 15.04, Debian 8.0 "jessie", Linaro 15.03 * Known to work but not continually tested: Fedora 19 and 20, and openSUSE 13.1 * Supported microprocessor architectures: * i386: Intel x86 instruction set (32-bit microprocessors). @@ -27,7 +27,7 @@ GNU/Linux Older distribution releases might work as well, but you will need GCC 4.7 or newer. -Before building GNSS-SDR, you need to install all the required dependencies. If you are using Debian 8 or Ubuntu 14.10, this can be done by copying and pasting the following line in a terminal: +Before building GNSS-SDR, you need to install all the required dependencies. If you are using Debian 8, Ubuntu 14.10 or above, this can be done by copying and pasting the following line in a terminal: ~~~~~~ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time-dev \ From 64b069f50d26b5ecd4ad6a50d7c20e413fb3987e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Apr 2015 00:33:13 +0200 Subject: [PATCH 03/25] Try to get the Volk version --- cmake/Modules/FindVolk.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindVolk.cmake b/cmake/Modules/FindVolk.cmake index 58da7edd9..a8e82a467 100644 --- a/cmake/Modules/FindVolk.cmake +++ b/cmake/Modules/FindVolk.cmake @@ -27,6 +27,8 @@ FIND_LIBRARY( ${GNURADIO_INSTALL_PREFIX}/lib ) +set(VOLK_VERSION ${PC_VOLK_VERSION}) + INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(VOLK DEFAULT_MSG VOLK_LIBRARIES VOLK_INCLUDE_DIRS) -MARK_AS_ADVANCED(VOLK_LIBRARIES VOLK_INCLUDE_DIRS) +MARK_AS_ADVANCED(VOLK_LIBRARIES VOLK_INCLUDE_DIRS VOLK_VERSION) From 9b4435ac67dfbc218e060b9c06d29d446cbf2820 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Apr 2015 00:36:45 +0200 Subject: [PATCH 04/25] Pointer safety, code cleaning --- .../volk_gnsssdr/lib/volk_gnsssdr_malloc.c | 35 ++++--------------- .../volk_gnsssdr/lib/volk_gnsssdr_prefs.c | 8 ++--- 2 files changed, 9 insertions(+), 34 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_malloc.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_malloc.c index 602bc0efa..6e48815b3 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_malloc.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_malloc.c @@ -18,7 +18,7 @@ */ #include "volk_gnsssdr/volk_gnsssdr_malloc.h" -#include +#include #include #include @@ -27,29 +27,6 @@ * see: http://linux.die.net/man/3/aligned_alloc */ -// Disabling use of aligned_alloc. This function requires that size be -// a multiple of alignment, which is too restrictive for many uses of -// VOLK. - -//// If we are using C11 standard, use the aligned_alloc -//#ifdef _ISOC11_SOURCE -// -//void *volk_gnsssdr_malloc(size_t size, size_t alignment) -//{ -// void *ptr = aligned_alloc(alignment, size); -// if(ptr == NULL) { -// fprintf(stderr, "VOLK: Error allocating memory (aligned_alloc)\n"); -// } -// return ptr; -//} -// -//void volk_gnsssdr_free(void *ptr) -//{ -// free(ptr); -//} -// -//#else // _ISOC11_SOURCE - // Otherwise, test if we are a POSIX or X/Open system // This only has a restriction that alignment be a power of 2and a // multiple of sizeof(void *). @@ -59,11 +36,11 @@ void *volk_gnsssdr_malloc(size_t size, size_t alignment) { void *ptr; - // quoting posix_memalign() man page: - // "alignment must be a power of two and a multiple of sizeof(void *)" - // volk_get_alignment() could return 1 for some machines (e.g. generic_orc) - if (alignment == 1) - return malloc(size); + // quoting posix_memalign() man page: + // "alignment must be a power of two and a multiple of sizeof(void *)" + // volk_get_alignment() could return 1 for some machines (e.g. generic_orc) + if (alignment == 1) + return malloc(size); int err = posix_memalign(&ptr, alignment, size); if(err == 0) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_prefs.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_prefs.c index ea4cb430b..ef75e17ec 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_prefs.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_prefs.c @@ -21,19 +21,17 @@ #include #include -//#if defined(_WIN32) -//#include -//#endif void volk_gnsssdr_get_config_path(char *path) { + if (!path) return; const char *suffix = "/.volk_gnsssdr/volk_gnsssdr_config"; char *home = NULL; if (home == NULL) home = getenv("HOME"); if (home == NULL) home = getenv("APPDATA"); if (home == NULL) { - path = NULL; + path[0] = 0; return; } strcpy(path, home); @@ -49,7 +47,7 @@ size_t volk_gnsssdr_load_preferences(volk_gnsssdr_arch_pref_t **prefs_res) //get the config path volk_gnsssdr_get_config_path(path); - if (path == NULL) return n_arch_prefs; //no prefs found + if (!path[0]) return n_arch_prefs; //no prefs found config_file = fopen(path, "r"); if(!config_file) return n_arch_prefs; //no prefs found From 7163d8502a479f74a0a25f938dd086438f06cb05 Mon Sep 17 00:00:00 2001 From: Johannes Pillmann Date: Tue, 28 Apr 2015 17:07:28 +0200 Subject: [PATCH 05/25] Added PRN 24 to available_gps_prn (was missing) --- src/core/receiver/gnss_flowgraph.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 7f9d28707..0f5def09c 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -578,7 +578,7 @@ void GNSSFlowgraph::set_signals_list() * Loop to create GPS L1 C/A signals */ std::set available_gps_prn = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 }; for (available_gnss_prn_iter = available_gps_prn.begin(); From 9ecf17a602fdf38a0d07eda1a729a196fa80740f Mon Sep 17 00:00:00 2001 From: Anthony Arnold Date: Thu, 30 Apr 2015 17:18:15 +1000 Subject: [PATCH 06/25] Link dependencies --- CMakeLists.txt | 6 +-- src/algorithms/libs/CMakeLists.txt | 16 +++--- .../gnuradio_blocks/CMakeLists.txt | 10 ++-- .../tracking/gnuradio_blocks/CMakeLists.txt | 6 +-- src/main/CMakeLists.txt | 24 ++++----- src/utils/front-end-cal/CMakeLists.txt | 49 ++++++++++--------- 6 files changed, 55 insertions(+), 56 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 53d874c3e..8da02b08a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -394,7 +394,7 @@ set(VOLK_GNSSSDR_BUILD_COMMAND "make") if(OS_IS_MACOSX) set(USE_MACPORTS_PYTHON "-DPYTHON_EXECUTABLE=/opt/local/bin/python") if(CMAKE_GENERATOR STREQUAL Xcode) - set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" "-configuration" "Debug" "-target") + set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" "-configuration" "Debug" "-target") endif(CMAKE_GENERATOR STREQUAL Xcode) endif(OS_IS_MACOSX) if(NOT VOLK_GNSSSDR_FOUND) @@ -440,11 +440,11 @@ if (NOT GFlags_FOUND) message (STATUS " gflags library has not been found.") message (STATUS " gflags will be downloaded and built automatically ") message (STATUS " when doing 'make'. ") - + ExternalProject_Add( gflags-${gflags_RELEASE} PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE} - GIT_REPOSITORY git://github.com/gflags/gflags.git + GIT_REPOSITORY https://github.com/gflags/gflags GIT_TAG v${gflags_RELEASE} DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/download/gflags-${gflags_RELEASE} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags/gflags-${gflags_RELEASE} diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index 90ce61d97..45259111d 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -31,8 +31,8 @@ set(GNSS_SPLIBS_SOURCES short_x2_to_cshort.cc complex_float_to_complex_byte.cc ) - - + + if(OPENCL_FOUND) set(GNSS_SPLIBS_SOURCES ${GNSS_SPLIBS_SOURCES} fft_execute.cc # Needs OpenCL @@ -69,12 +69,12 @@ add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES} ${GNSS_SPLIBS_HEADERS}) source_group(Headers FILES ${GNSS_SPLIBS_HEADERS}) target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES} - ${VOLK_LIBRARIES} - ${VOLK_GNSSSDR_LIBRARIES} - ${GNURADIO_BLOCKS_LIBRARIES} - ${GNURADIO_FFT_LIBRARIES} - ${GNURADIO_FILTER_LIBRARIES} - ${OPT_LIBRARIES} + ${VOLK_LIBRARIES} ${ORC_LIBRARIES} + ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} + ${GNURADIO_BLOCKS_LIBRARIES} + ${GNURADIO_FFT_LIBRARIES} + ${GNURADIO_FILTER_LIBRARIES} + ${OPT_LIBRARIES} gnss_rx ) diff --git a/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt index 2d2537bc0..375a0141d 100644 --- a/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_generator/gnuradio_blocks/CMakeLists.txt @@ -32,10 +32,8 @@ include_directories( file(GLOB SIGNAL_GENERATOR_BLOCK_HEADERS "*.h") add_library(signal_generator_blocks ${SIGNAL_GENERATOR_BLOCK_SOURCES} ${SIGNAL_GENERATOR_BLOCK_HEADERS}) source_group(Headers FILES ${SIGNAL_GENERATOR_BLOCK_HEADERS}) -target_link_libraries(signal_generator_blocks gnss_system_parameters - ${GNURADIO_RUNTIME_LIBRARIES} - ${GNURADIO_FFT_LIBRARIES} - ${VOLK_LIBRARIES} +target_link_libraries(signal_generator_blocks gnss_system_parameters + ${GNURADIO_RUNTIME_LIBRARIES} + ${GNURADIO_FFT_LIBRARIES} + ${VOLK_LIBRARIES} ${ORC_LIBRARIES} ) - - diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index 17635bebe..eec2ce09e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -16,7 +16,7 @@ # along with GNSS-SDR. If not, see . # -set(TRACKING_GR_BLOCKS_SOURCES +set(TRACKING_GR_BLOCKS_SOURCES galileo_e1_dll_pll_veml_tracking_cc.cc galileo_volk_e1_dll_pll_veml_tracking_cc.cc galileo_e1_tcp_connector_tracking_cc.cc @@ -26,7 +26,7 @@ set(TRACKING_GR_BLOCKS_SOURCES gps_l1_ca_tcp_connector_tracking_cc.cc galileo_e5a_dll_pll_tracking_cc.cc ) - + include_directories( $(CMAKE_CURRENT_SOURCE_DIR) ${CMAKE_SOURCE_DIR}/src/core/system_parameters @@ -48,7 +48,7 @@ endif(ENABLE_GENERIC_ARCH) file(GLOB TRACKING_GR_BLOCKS_HEADERS "*.h") add_library(tracking_gr_blocks ${TRACKING_GR_BLOCKS_SOURCES} ${TRACKING_GR_BLOCKS_HEADERS}) source_group(Headers FILES ${TRACKING_GR_BLOCKS_HEADERS}) -target_link_libraries(tracking_gr_blocks tracking_lib ${GNURADIO_RUNTIME_LIBRARIES} gnss_sp_libs ${Boost_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ) +target_link_libraries(tracking_gr_blocks tracking_lib ${GNURADIO_RUNTIME_LIBRARIES} gnss_sp_libs ${Boost_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ) if(NOT VOLK_GNSSSDR_FOUND) add_dependencies(tracking_gr_blocks volk_gnsssdr_module) endif(NOT VOLK_GNSSSDR_FOUND) \ No newline at end of file diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 9ac9c8923..af8e7bcd0 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -29,7 +29,7 @@ endif(ENABLE_GPERFTOOLS) if(ENABLE_UHD) set(GNSS_SDR_OPTIONAL_LIBS ${GNSS_SDR_OPTIONAL_LIBS} ${UHD_LIBRARIES} ${GNURADIO_UHD_LIBRARIES}) - set(GNSS_SDR_OPTIONAL_HEADERS ${GNSS_SDR_OPTIONAL_HEADERS} ${UHD_INCLUDE_DIRS}) + set(GNSS_SDR_OPTIONAL_HEADERS ${GNSS_SDR_OPTIONAL_HEADERS} ${UHD_INCLUDE_DIRS}) endif(ENABLE_UHD) include_directories( @@ -42,7 +42,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/core/libs/supl/asn-supl ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} - ${ARMADILLO_INCLUDE_DIRS} + ${ARMADILLO_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} ${GNSS_SDR_OPTIONAL_HEADERS} @@ -65,18 +65,18 @@ add_custom_command(TARGET gnss-sdr POST_BUILD ${CMAKE_SOURCE_DIR}/install/$ ) -target_link_libraries(gnss-sdr ${MAC_LIBRARIES} +target_link_libraries(gnss-sdr ${MAC_LIBRARIES} ${Boost_LIBRARIES} - ${GNURADIO_RUNTIME_LIBRARIES} - ${GNURADIO_BLOCKS_LIBRARIES} - ${GNURADIO_FFT_LIBRARIES} - ${GNURADIO_FILTER_LIBRARIES} - ${GFlags_LIBS} - ${GLOG_LIBRARIES} - ${ARMADILLO_LIBRARIES} + ${GNURADIO_RUNTIME_LIBRARIES} + ${GNURADIO_BLOCKS_LIBRARIES} + ${GNURADIO_FFT_LIBRARIES} + ${GNURADIO_FILTER_LIBRARIES} + ${GFlags_LIBS} + ${GLOG_LIBRARIES} + ${ARMADILLO_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ${GNSS_SDR_OPTIONAL_LIBS} - gnss_sp_libs + gnss_sp_libs gnss_rx ) @@ -85,7 +85,7 @@ install(TARGETS gnss-sdr RUNTIME DESTINATION bin COMPONENT "gnss-sdr" ) - + install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf DESTINATION share/gnss-sdr FILES_MATCHING PATTERN "*.conf" ) diff --git a/src/utils/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index a68ec0cd1..c3b462a23 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -24,7 +24,7 @@ if(ENABLE_OSMOSDR) ${CMAKE_SOURCE_DIR}/src/core/system_parameters ${CMAKE_SOURCE_DIR}/src/core/interfaces ${CMAKE_SOURCE_DIR}/src/core/receiver - ${CMAKE_SOURCE_DIR}/src/core/libs + ${CMAKE_SOURCE_DIR}/src/core/libs ${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 @@ -35,7 +35,7 @@ if(ENABLE_OSMOSDR) ${GFlags_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} ${GNURADIO_BLOCKS_INCLUDE_DIRS} - ${ARMADILLO_INCLUDE_DIRS} + ${ARMADILLO_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${VOLK_GNSSSDR_INCLUDE_DIRS} ) @@ -43,15 +43,15 @@ if(ENABLE_OSMOSDR) file(GLOB FRONT_END_CAL_HEADERS "*.h") add_library(front_end_cal_lib ${FRONT_END_CAL_SOURCES} ${FRONT_END_CAL_HEADERS}) source_group(Headers FILES ${FRONT_END_CAL_HEADERS}) - - target_link_libraries(front_end_cal_lib ${Boost_LIBRARIES} - ${GNURADIO_RUNTIME_LIBRARIES} - ${GNURADIO_BLOCKS_LIBRARIES} - ${GFlags_LIBS} - ${GLOG_LIBRARIES} - ${ARMADILLO_LIBRARIES} + + target_link_libraries(front_end_cal_lib ${Boost_LIBRARIES} + ${GNURADIO_RUNTIME_LIBRARIES} + ${GNURADIO_BLOCKS_LIBRARIES} + ${GFlags_LIBS} + ${GLOG_LIBRARIES} + ${ARMADILLO_LIBRARIES} ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} - gnss_rx + gnss_rx gnss_sp_libs ) @@ -63,24 +63,25 @@ if(ENABLE_OSMOSDR) add_custom_command(TARGET front-end-cal POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_SOURCE_DIR}/install/$) - - - target_link_libraries(front-end-cal ${GNURADIO_RUNTIME_LIBRARIES} - ${GNURADIO_BLOCKS_LIBRARIES} - ${Boost_LIBRARIES} - ${GFlags_LIBS} - ${GLOG_LIBRARIES} - ${ARMADILLO_LIBRARIES} - gnss_rx - gnss_sp_libs + + + target_link_libraries(front-end-cal ${GNURADIO_RUNTIME_LIBRARIES} + ${GNURADIO_BLOCKS_LIBRARIES} + ${Boost_LIBRARIES} + ${GFlags_LIBS} + ${GLOG_LIBRARIES} + ${ARMADILLO_LIBRARIES} + gnss_rx + gnss_sp_libs front_end_cal_lib + ${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES} ) - install(TARGETS front-end-cal + install(TARGETS front-end-cal RUNTIME DESTINATION bin COMPONENT "front-end-cal" ) - + find_program(GZIP gzip /bin /usr/bin @@ -93,7 +94,7 @@ if(ENABLE_OSMOSDR) execute_process(COMMAND gzip -9 -c ${CMAKE_SOURCE_DIR}/docs/manpage/front-end-cal-manpage WORKING_DIRECTORY ${CMAKE_BINARY_DIR} OUTPUT_FILE "${CMAKE_BINARY_DIR}/front-end-cal.1.gz") - install(FILES ${CMAKE_BINARY_DIR}/front-end-cal.1.gz DESTINATION share/man/man1) + install(FILES ${CMAKE_BINARY_DIR}/front-end-cal.1.gz DESTINATION share/man/man1) endif(NOT GZIP_NOTFOUND) - + endif(ENABLE_OSMOSDR) From a9c77939df67107799f30460ec1466ef9fa436e3 Mon Sep 17 00:00:00 2001 From: Anthony Arnold Date: Thu, 30 Apr 2015 17:25:03 +1000 Subject: [PATCH 07/25] OsmoSdr args --- src/algorithms/signal_source/adapters/osmosdr_signal_source.cc | 3 ++- src/algorithms/signal_source/adapters/osmosdr_signal_source.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 80e6ab4e5..28b7c4a0f 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -65,6 +65,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, if_gain_ = configuration->property(role + ".if_gain", (double)40.0); sample_rate_ = configuration->property(role + ".sampling_frequency", (double)2.0e6); item_type_ = configuration->property(role + ".item_type", default_item_type); + osmosdr_args_ = configuration->property(role + ".osmosdr_args", std::string( )); if (item_type_.compare("short") == 0) { @@ -76,7 +77,7 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, // 1. Make the driver instance try { - osmosdr_source_ = osmosdr::source::make(); + osmosdr_source_ = osmosdr::source::make(osmosdr_args_); } catch( boost::exception & e ) { diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h index 6204a0ac0..0fffe7b18 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.h @@ -100,6 +100,7 @@ private: std::string dump_filename_; osmosdr::source::sptr osmosdr_source_; + std::string osmosdr_args_; boost::shared_ptr valve_; gr::blocks::file_sink::sptr file_sink_; From 9a3980c8d9512114759a2ca47d36d5d88909ae91 Mon Sep 17 00:00:00 2001 From: Anthony Arnold Date: Thu, 30 Apr 2015 23:16:44 +1000 Subject: [PATCH 08/25] Reset gflags URL --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8da02b08a..5c94d8d79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -444,7 +444,7 @@ if (NOT GFlags_FOUND) ExternalProject_Add( gflags-${gflags_RELEASE} PREFIX ${CMAKE_CURRENT_BINARY_DIR}/gflags-${gflags_RELEASE} - GIT_REPOSITORY https://github.com/gflags/gflags + GIT_REPOSITORY git://github.com/gflags/gflags.git GIT_TAG v${gflags_RELEASE} DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/download/gflags-${gflags_RELEASE} SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/gflags/gflags-${gflags_RELEASE} From b059d5a648648daa326fd083ec72dd9248d08e9c Mon Sep 17 00:00:00 2001 From: Anthony Arnold Date: Thu, 30 Apr 2015 23:36:36 +1000 Subject: [PATCH 09/25] Print args --- .../signal_source/adapters/osmosdr_signal_source.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index 28b7c4a0f..4365b1bbc 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -77,6 +77,11 @@ OsmosdrSignalSource::OsmosdrSignalSource(ConfigurationInterface* configuration, // 1. Make the driver instance try { + if (!osmosdr_args_.empty()) + { + std::cout << "OsmoSdr arguments: " << osmosdr_args_ << std::endl; + LOG(INFO) << "OsmoSdr arguments: " << osmosdr_args_; + } osmosdr_source_ = osmosdr::source::make(osmosdr_args_); } catch( boost::exception & e ) From 9d61617769a5a0c40a69c52ede078ecd72316bae Mon Sep 17 00:00:00 2001 From: Anthony Arnold Date: Thu, 30 Apr 2015 23:36:47 +1000 Subject: [PATCH 10/25] Example config --- conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf | 308 +++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf diff --git a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf b/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf new file mode 100644 index 000000000..9e867cfa4 --- /dev/null +++ b/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf @@ -0,0 +1,308 @@ +; Default configuration file +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_hz: Internal signal sampling frequency after the signal conditioning stage [Hz]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ +GNSS-SDR.internal_fs_hz=1999898 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SUPL RRLP GPS assistance configuration ##### +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNS=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation: Use [File_Signal_Source] or [UHD_Signal_Source] or [GN3S_Signal_Source] [Osmosdr_Signal_Source] +SignalSource.implementation=Osmosdr_Signal_Source + +;#filename: path to file with the captured GNSS signal samples to be processed +SignalSource.filename=/media/DATALOGGER_/signals/RTL-SDR/geo/pmt4.dat + +;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. +SignalSource.item_type=gr_complex + +;#sampling_frequency: Original Signal sampling frequency in [Hz] +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ +SignalSource.sampling_frequency=2000000 + +;#freq: RF front-end center frequency in [Hz] +SignalSource.freq=1575420000 + +;#gain: Front-end overall gain Gain in [dB] +SignalSource.gain=40 + +;#rf_gain: Front-end RF stage gain in [dB] +SignalSource.rf_gain=40 + +;#rf_gain: Front-end IF stage gain in [dB] +SignalSource.if_gain=30 + +;#AGC_enabled: Front-end AGC enabled or disabled +SignalSource.AGC_enabled = false + +;#samples: Number of samples to be processed. Notice that 0 indicates the entire file. +SignalSource.samples=0 + +;#repeat: Repeat the processing file. Disable this option in this version +SignalSource.repeat=false + +;#dump: Dump the Signal source data to a file. Disable this option in this version +SignalSource.dump=false + +SignalSource.dump_filename=../data/signal_source.dat + + +;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing. +; it helps to not overload the CPU, but the processing time will be longer. +SignalSource.enable_throttle_control=false + +;#Send optional arguments to the OsmoSdr Gnuradio block +;#Arguments are comma-delimited. See http://sdr.osmocom.org/trac/wiki/GrOsmoSDR for documentation. +SignalSource.osmosdr_args=rtl_tcp,offset_tune=1 + +;######### SIGNAL_CONDITIONER CONFIG ############ +;## It holds blocks to change data type, filter and resample input data. + +;#implementation: Use [Pass_Through] or [Signal_Conditioner] +;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks +;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +;## Changes the type of input data. Please disable it in this version. +;#implementation: [Pass_Through] disables this block +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +;## Filter the input data. Can be combined with frequency translation for IF signals + +;#implementation: Use [Pass_Through] or [Fir_Filter] or [Freq_Xlating_Fir_Filter] +;#[Pass_Through] disables this block +;#[Fir_Filter] enables a FIR Filter +;#[Freq_Xlating_Fir_Filter] enables FIR filter and a composite frequency translation that shifts IF down to zero Hz. + +InputFilter.implementation=Freq_Xlating_Fir_Filter + +;#dump: Dump the filtered data to a file. +InputFilter.dump=false + +;#dump_filename: Log path and filename. +InputFilter.dump_filename=../data/input_filter.dat + +;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation. +;#These options are based on parameters of gnuradio's function: gr_remez. +;#These function calculates the optimal (in the Chebyshev/minimax sense) FIR filter inpulse reponse given a set of band edges, the desired reponse on those bands, and the weight given to the error in those bands. + +;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version. +InputFilter.input_item_type=gr_complex + +;#outut_item_type: Type and resolution for output filtered signal samples. Use only gr_complex in this version. +InputFilter.output_item_type=gr_complex + +;#taps_item_type: Type and resolution for the taps of the filter. Use only float in this version. +InputFilter.taps_item_type=float + +;#number_of_taps: Number of taps in the filter. Increasing this parameter increases the processing time +InputFilter.number_of_taps=5 + +;#number_of _bands: Number of frequency bands in the filter. +InputFilter.number_of_bands=2 + +;#bands: frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]. +;#Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2) +;#The number of band_begin and band_end elements must match the number of bands + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +;#ampl: desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]. +;#The number of ampl_begin and ampl_end elements must match the number of bands + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +;#band_error: weighting applied to each band (usually 1). +;#The number of band_error elements must match the number of bands +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +;#filter_type: one of "bandpass", "hilbert" or "differentiator" +InputFilter.filter_type=bandpass + +;#grid_density: determines how accurately the filter will be constructed. +;The minimum value is 16; higher values are slower to compute the filter. +InputFilter.grid_density=16 + +;#The following options are used only in Freq_Xlating_Fir_Filter implementation. +;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here:http://www.cttc.es/publication/turning-a-television-into-a-gnss-receiver/ +InputFilter.sampling_frequency=1999898 +;# IF deviation due to front-end LO inaccuracies [HZ] +InputFilter.IF=80558 + +;######### RESAMPLER CONFIG ############ +;## Resamples the input data. +;# DISABLED IN THE RTL-SDR REALTIME +;#implementation: Use [Pass_Through] or [Direct_Resampler] +;#[Pass_Through] disables this block +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +;#count: Number of available GPS satellite channels. +Channels_GPS.count=4 +;#count: Number of available Galileo satellite channels. +Channels_Galileo.count=0 +;#in_acquisition: Number of channels simultaneously acquiring for the whole receiver +Channels.in_acquisition=1 +;#system: GPS, GLONASS, GALILEO, SBAS or COMPASS +;#if the option is disabled by default is assigned GPS +Channel.system=GPS + +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel.signal=1C +Channel0.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ + +;#dump: Enable or disable the acquisition internal data file logging [true] or [false] +Acquisition_GPS.dump=false +;#filename: Log path and filename +Acquisition_GPS.dump_filename=./acq_dump.dat +;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. +Acquisition_GPS.item_type=gr_complex +;#if: Signal intermediate frequency in [Hz] +Acquisition_GPS.if=0 +;#sampled_ms: Signal block duration for the acquisition signal detection [ms] +Acquisition_GPS.sampled_ms=1 +;#implementation: Acquisition algorithm selection for this channel: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition] +Acquisition_GPS.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +;#threshold: Acquisition threshold +Acquisition_GPS.threshold=0.015 +;#pfa: Acquisition false alarm probability. This option overrides the threshold option. Only use with implementations: [GPS_L1_CA_PCPS_Acquisition] or [Galileo_E1_PCPS_Ambiguous_Acquisition] +;Acquisition_GPS.pfa=0.0001 +;#doppler_max: Maximum expected Doppler shift [Hz] +Acquisition_GPS.doppler_max=10000 +;#doppler_max: Maximum expected Doppler shift [Hz] +Acquisition_GPS.doppler_min=-10000 +;#doppler_step Doppler step in the grid search [Hz] +Acquisition_GPS.doppler_step=500 +;#maximum dwells +Acquisition_GPS.max_dwells=15 + +;######### ACQUISITION CHANNELS CONFIG ###### +;#The following options are specific to each channel and overwrite the generic options + +;#repeat_satellite: Use only jointly with the satellite PRN ID option. The default value is false +;Acquisition0.repeat_satellite = false + +;######### TRACKING GLOBAL CONFIG ############ + +;#implementation: Selected tracking algorithm: [GPS_L1_CA_DLL_PLL_Tracking] or [GPS_L1_CA_DLL_FLL_PLL_Tracking] [GPS_L1_CA_DLL_PLL_Optim_Tracking] +Tracking_GPS.implementation=GPS_L1_CA_DLL_PLL_Optim_Tracking +;#item_type: Type and resolution for each of the signal samples. Use only [gr_complex] in this version. +Tracking_GPS.item_type=gr_complex + +;#sampling_frequency: Signal Intermediate Frequency in [Hz] +Tracking_GPS.if=0 + +;#dump: Enable or disable the Tracking internal binary data file logging [true] or [false] +Tracking_GPS.dump=false + +;#dump_filename: Log path and filename. Notice that the tracking channel will add "x.dat" where x is the channel number. +Tracking_GPS.dump_filename=./tracking_ch_ + +;#pll_bw_hz: PLL loop filter bandwidth [Hz] +Tracking_GPS.pll_bw_hz=40.0; + +;#dll_bw_hz: DLL loop filter bandwidth [Hz] +Tracking_GPS.dll_bw_hz=2.0; + +;#fll_bw_hz: FLL loop filter bandwidth [Hz] +Tracking_GPS.fll_bw_hz=10.0; + +;#order: PLL/DLL loop filter order [2] or [3] +Tracking_GPS.order=3; + +;#early_late_space_chips: correlator early-late space [chips]. Use [0.5] +Tracking_GPS.early_late_space_chips=0.5; + +;######### TELEMETRY DECODER GPS CONFIG ############ +;#implementation: Use [GPS_L1_CA_Telemetry_Decoder] for GPS L1 C/A +TelemetryDecoder_GPS.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_GPS.dump=false +;#decimation factor +TelemetryDecoder_GPS.decimation_factor=1; + +;######### OBSERVABLES CONFIG ############ +;#implementation: Use [GPS_L1_CA_Observables] for GPS L1 C/A. +Observables.implementation=GPS_L1_CA_Observables + +;#dump: Enable or disable the Observables internal binary data file logging [true] or [false] +Observables.dump=false + +;#dump_filename: Log path and filename. +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +;#implementation: Position Velocity and Time (PVT) implementation algorithm: Use [GPS_L1_CA_PVT] in this version. +PVT.implementation=GPS_L1_CA_PVT + +;#averaging_depth: Number of PVT observations in the moving average algorithm +PVT.averaging_depth=10 + +;#flag_average: Enables the PVT averaging between output intervals (arithmetic mean) [true] or [false] +PVT.flag_averaging=true + +;#output_rate_ms: Period between two PVT outputs. Notice that the minimum period is equal to the tracking integration time (for GPS CA L1 is 1ms) [ms] +PVT.output_rate_ms=100 + +;#display_rate_ms: Position console print (std::out) interval [ms]. Notice that output_rate_ms<=display_rate_ms. +PVT.display_rate_ms=500 + +;# RINEX, KML, and NMEA output configuration + +;#dump_filename: Log path and filename without extension. Notice that PVT will add ".dat" to the binary dump and ".kml" to GoogleEarth dump. +PVT.dump_filename=./PVT + +;#nmea_dump_filename: NMEA log path and filename +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; + +;#flag_nmea_tty_port: Enable or disable the NMEA log to a serial TTY port (Can be used with real hardware or virtual one) +PVT.flag_nmea_tty_port=false; + +;#nmea_dump_devname: serial device descriptor for NMEA logging +PVT.nmea_dump_devname=/dev/pts/4 + + +;#dump: Enable or disable the PVT internal binary data file logging [true] or [false] +PVT.dump=true + +;######### OUTPUT_FILTER CONFIG ############ +;# Receiver output filter: Leave this block disabled in this version +OutputFilter.implementation=Null_Sink_Output_Filter +OutputFilter.filename=data/gnss-sdr.dat +OutputFilter.item_type=gr_complex \ No newline at end of file From 4fb3ec2af3fe15fdf0f3d727c2ab73114fbc45ad Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 30 Apr 2015 20:15:06 +0200 Subject: [PATCH 11/25] small fix for packaging --- conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf b/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf index 9e867cfa4..930b554c6 100644 --- a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf +++ b/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf @@ -305,4 +305,4 @@ PVT.dump=true ;# Receiver output filter: Leave this block disabled in this version OutputFilter.implementation=Null_Sink_Output_Filter OutputFilter.filename=data/gnss-sdr.dat -OutputFilter.item_type=gr_complex \ No newline at end of file +OutputFilter.item_type=gr_complex From 7cbc0a6efaa0cada7b252785b4a7ab1d295b746f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 1 May 2015 09:28:45 +0200 Subject: [PATCH 12/25] changing integer absolute value function 'abs' when argument is of floating point type by std::abs --- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 974 +++++++++--------- .../pcps_acquisition_fine_doppler_cc.cc | 4 +- .../galileo_e1b_telemetry_decoder_cc.cc | 2 +- .../gps_l1_ca_telemetry_decoder_cc.cc | 2 +- .../galileo_navigation_message.cc | 4 +- .../system_parameters/galileo_utc_model.cc | 3 +- .../gps_navigation_message.cc | 3 +- src/core/system_parameters/gps_utc_model.cc | 3 +- .../system_parameters/sbas_telemetry_data.cc | 7 +- ...8ms_ambiguous_acquisition_gsoc2013_test.cc | 4 +- ...cps_ambiguous_acquisition_gsoc2013_test.cc | 4 +- ...ileo_e1_pcps_ambiguous_acquisition_test.cc | 4 +- ...wsr_ambiguous_acquisition_gsoc2013_test.cc | 4 +- ...ync_ambiguous_acquisition_gsoc2014_test.cc | 4 +- ...ong_ambiguous_acquisition_gsoc2013_test.cc | 4 +- ...cps_acquisition_gsoc2014_gensource_test.cc | 16 +- ...ps_l1_ca_pcps_acquisition_gsoc2013_test.cc | 4 +- ...s_multithread_acquisition_gsoc2013_test.cc | 4 +- ...a_pcps_opencl_acquisition_gsoc2013_test.cc | 4 +- ...cps_quicksync_acquisition_gsoc2014_test.cc | 4 +- ..._ca_pcps_tong_acquisition_gsoc2013_test.cc | 4 +- src/tests/single_test_main.cc | 1 + src/tests/test_main.cc | 4 +- 23 files changed, 534 insertions(+), 533 deletions(-) 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 efb27d868..eb4aa4b18 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 @@ -47,37 +47,37 @@ 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, - int samples_per_ms, int samples_per_code, - bool bit_transition_flag, - gr::msg_queue::sptr queue, bool dump, - std::string dump_filename, - bool both_signal_components_, - int CAF_window_hz_, - int Zero_padding_) + 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, + bool bit_transition_flag, + gr::msg_queue::sptr queue, bool dump, + std::string dump_filename, + bool both_signal_components_, + int CAF_window_hz_, + 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, - samples_per_code, bit_transition_flag, queue, dump, dump_filename, both_signal_components_, CAF_window_hz_, Zero_padding_)); + samples_per_code, bit_transition_flag, queue, dump, dump_filename, both_signal_components_, CAF_window_hz_, Zero_padding_)); } galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisition_caf_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, - bool bit_transition_flag, - gr::msg_queue::sptr queue, bool dump, - std::string dump_filename, - bool both_signal_components_, - int CAF_window_hz_, - int Zero_padding_) : - gr::block("galileo_e5a_noncoherentIQ_acquisition_caf_cc", - gr::io_signature::make(1, 1, sizeof(gr_complex)), - gr::io_signature::make(0, 0, sizeof(gr_complex))) + 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, + bool bit_transition_flag, + gr::msg_queue::sptr queue, bool dump, + std::string dump_filename, + bool both_signal_components_, + int CAF_window_hz_, + int Zero_padding_) : + gr::block("galileo_e5a_noncoherentIQ_acquisition_caf_cc", + gr::io_signature::make(1, 1, sizeof(gr_complex)), + gr::io_signature::make(0, 0, sizeof(gr_complex))) { d_sample_counter = 0; // SAMPLE COUNTER d_active = false; @@ -91,13 +91,13 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit d_well_count = 0; d_doppler_max = doppler_max; if (Zero_padding_ > 0) - { - d_sampled_ms = 1; - } + { + d_sampled_ms = 1; + } else - { - d_sampled_ms = sampled_ms; - } + { + d_sampled_ms = sampled_ms; + } d_fft_size = sampled_ms * d_samples_per_ms; d_mag = 0; d_input_power = 0.0; @@ -112,21 +112,21 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::galileo_e5a_noncoherentIQ_acquisit d_magnitudeIA = static_cast(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); if (d_both_signal_components == true) - { - d_fft_code_Q_A = static_cast(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); - d_magnitudeQA = static_cast(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); - } + { + d_fft_code_Q_A = static_cast(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); + d_magnitudeQA = static_cast(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); + } // IF COHERENT INTEGRATION TIME > 1 if (d_sampled_ms > 1) - { - d_fft_code_I_B = static_cast(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); - d_magnitudeIB = static_cast(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); - if (d_both_signal_components == true) - { - d_fft_code_Q_B = static_cast(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); - d_magnitudeQB = static_cast(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); - } - } + { + d_fft_code_I_B = static_cast(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); + d_magnitudeIB = static_cast(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); + if (d_both_signal_components == true) + { + d_fft_code_Q_B = static_cast(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); + d_magnitudeQB = static_cast(volk_malloc(d_fft_size * sizeof(float), volk_get_alignment())); + } + } // Direct FFT d_fft_if = new gr::fft::fft_complex(d_fft_size, true); @@ -154,21 +154,21 @@ galileo_e5a_noncoherentIQ_acquisition_caf_cc::~galileo_e5a_noncoherentIQ_acquisi volk_free(d_fft_code_I_A); volk_free(d_magnitudeIA); if (d_both_signal_components == true) - { - volk_free(d_fft_code_Q_A); - volk_free(d_magnitudeQA); - } + { + volk_free(d_fft_code_Q_A); + volk_free(d_magnitudeQA); + } // IF INTEGRATION TIME > 1 if (d_sampled_ms > 1) - { - volk_free(d_fft_code_I_B); - volk_free(d_magnitudeIB); - if (d_both_signal_components == true) - { - volk_free(d_fft_code_Q_B); - volk_free(d_magnitudeQB); - } - } + { + volk_free(d_fft_code_I_B); + volk_free(d_magnitudeIB); + if (d_both_signal_components == true) + { + volk_free(d_fft_code_Q_B); + volk_free(d_magnitudeQB); + } + } if (d_CAF_window_hz > 0) { volk_free(d_CAF_vector); @@ -250,11 +250,11 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init() // Count the number of bins d_num_doppler_bins = 0; for (int doppler = static_cast(-d_doppler_max); - doppler <= static_cast(d_doppler_max); - doppler += d_doppler_step) - { - d_num_doppler_bins++; - } + doppler <= static_cast(d_doppler_max); + doppler += d_doppler_step) + { + d_num_doppler_bins++; + } // Create the carrier Doppler wipeoff signals d_grid_doppler_wipeoffs = new gr_complex*[d_num_doppler_bins]; @@ -262,22 +262,21 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init() { d_grid_doppler_wipeoffs[doppler_index] = static_cast(volk_malloc(d_fft_size * sizeof(gr_complex), volk_get_alignment())); int doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; - complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], - d_freq + doppler, d_fs_in, d_fft_size); + complex_exp_gen_conj(d_grid_doppler_wipeoffs[doppler_index], d_freq + doppler, d_fs_in, d_fft_size); } /* CAF Filtering to resolve doppler ambiguity. Phase and quadrature must be processed * separately before non-coherent integration */ -// if (d_CAF_filter) + // if (d_CAF_filter) if (d_CAF_window_hz > 0) - { - d_CAF_vector = static_cast(volk_malloc(d_num_doppler_bins * sizeof(float), volk_get_alignment())); - d_CAF_vector_I = static_cast(volk_malloc(d_num_doppler_bins * sizeof(float), volk_get_alignment())); - if (d_both_signal_components == true) - { - d_CAF_vector_Q = static_cast(volk_malloc(d_num_doppler_bins * sizeof(float), volk_get_alignment())); - } - } + { + d_CAF_vector = static_cast(volk_malloc(d_num_doppler_bins * sizeof(float), volk_get_alignment())); + d_CAF_vector_I = static_cast(volk_malloc(d_num_doppler_bins * sizeof(float), volk_get_alignment())); + if (d_both_signal_components == true) + { + d_CAF_vector_Q = static_cast(volk_malloc(d_num_doppler_bins * sizeof(float), volk_get_alignment())); + } + } } @@ -331,446 +330,445 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items */ switch (d_state) { - case 0: - { - if (d_active) - { - //restart acquisition variables - d_gnss_synchro->Acq_delay_samples = 0.0; - d_gnss_synchro->Acq_doppler_hz = 0.0; - d_gnss_synchro->Acq_samplestamp_samples = 0; - d_well_count = 0; - d_mag = 0.0; - d_input_power = 0.0; - d_test_statistics = 0.0; - d_state = 1; - } - d_sample_counter += ninput_items[0]; // sample counter - consume_each(ninput_items[0]); + case 0: + { + if (d_active) + { + //restart acquisition variables + d_gnss_synchro->Acq_delay_samples = 0.0; + d_gnss_synchro->Acq_doppler_hz = 0.0; + d_gnss_synchro->Acq_samplestamp_samples = 0; + d_well_count = 0; + d_mag = 0.0; + d_input_power = 0.0; + d_test_statistics = 0.0; + d_state = 1; + } + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); - break; - } - case 1: - { - const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer - unsigned int buff_increment; - if (ninput_items[0] + d_buffer_count <= d_fft_size) - { - buff_increment = ninput_items[0]; - } - else - { - buff_increment = (d_fft_size - d_buffer_count); - } - memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * buff_increment); - // If buffer will be full in next iteration - if (d_buffer_count >= d_fft_size - d_gr_stream_buffer) - { - d_state=2; - } - d_buffer_count += buff_increment; - d_sample_counter += buff_increment; // sample counter - consume_each(buff_increment); - break; - } - case 2: - { - // Fill last part of the buffer and reset counter - const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer - if (d_buffer_count < d_fft_size) - { - memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex)*(d_fft_size-d_buffer_count)); - } - d_sample_counter += d_fft_size-d_buffer_count; // sample counter + break; + } + case 1: + { + const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer + unsigned int buff_increment; + if (ninput_items[0] + d_buffer_count <= d_fft_size) + { + buff_increment = ninput_items[0]; + } + else + { + buff_increment = (d_fft_size - d_buffer_count); + } + memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex) * buff_increment); + // If buffer will be full in next iteration + if (d_buffer_count >= d_fft_size - d_gr_stream_buffer) + { + d_state=2; + } + d_buffer_count += buff_increment; + d_sample_counter += buff_increment; // sample counter + consume_each(buff_increment); + break; + } + case 2: + { + // Fill last part of the buffer and reset counter + const gr_complex *in = (const gr_complex *)input_items[0]; //Get the input samples pointer + if (d_buffer_count < d_fft_size) + { + memcpy(&d_inbuffer[d_buffer_count], in, sizeof(gr_complex)*(d_fft_size-d_buffer_count)); + } + d_sample_counter += d_fft_size-d_buffer_count; // sample counter - // initialize acquisition algorithm - int doppler; - unsigned int indext = 0; - unsigned int indext_IA = 0; - unsigned int indext_IB = 0; - unsigned int indext_QA = 0; - unsigned int indext_QB = 0; - float magt = 0.0; - float magt_IA = 0.0; - float magt_IB = 0.0; - float magt_QA = 0.0; - float magt_QB = 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; - d_well_count++; + // initialize acquisition algorithm + int doppler; + unsigned int indext = 0; + unsigned int indext_IA = 0; + unsigned int indext_IB = 0; + unsigned int indext_QA = 0; + unsigned int indext_QB = 0; + float magt = 0.0; + float magt_IA = 0.0; + float magt_IB = 0.0; + float magt_QA = 0.0; + float magt_QB = 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; + d_well_count++; - DLOG(INFO) << "Channel: " << d_channel - << " , doing acquisition of satellite: " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN - << " ,sample stamp: " << d_sample_counter << ", threshold: " - << d_threshold << ", doppler_max: " << d_doppler_max - << ", doppler_step: " << d_doppler_step; + DLOG(INFO) << "Channel: " << d_channel + << " , doing acquisition of satellite: " << d_gnss_synchro->System << " "<< d_gnss_synchro->PRN + << " ,sample stamp: " << d_sample_counter << ", threshold: " + << d_threshold << ", doppler_max: " << d_doppler_max + << ", doppler_step: " << d_doppler_step; - // 1- Compute the input signal power estimation - volk_32fc_magnitude_squared_32f(d_magnitudeIA, d_inbuffer, d_fft_size); - volk_32f_accumulator_s32f(&d_input_power, d_magnitudeIA, d_fft_size); - d_input_power /= static_cast(d_fft_size); + // 1- Compute the input signal power estimation + volk_32fc_magnitude_squared_32f(d_magnitudeIA, d_inbuffer, d_fft_size); + volk_32f_accumulator_s32f(&d_input_power, d_magnitudeIA, d_fft_size); + d_input_power /= static_cast(d_fft_size); - // 2- Doppler frequency search loop - for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) - { - // doppler search steps + // 2- Doppler frequency search loop + for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) + { + // doppler search steps - doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; + doppler = -static_cast(d_doppler_max) + d_doppler_step * doppler_index; - volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), d_inbuffer, - d_grid_doppler_wipeoffs[doppler_index], d_fft_size); + volk_32fc_x2_multiply_32fc(d_fft_if->get_inbuf(), d_inbuffer, + d_grid_doppler_wipeoffs[doppler_index], d_fft_size); - // 3- Perform the FFT-based convolution (parallel time search) - // Compute the FFT of the carrier wiped--off incoming signal - d_fft_if->execute(); + // 3- Perform the FFT-based convolution (parallel time search) + // Compute the FFT of the carrier wiped--off incoming signal + d_fft_if->execute(); - // CODE IA - // Multiply carrier wiped--off, Fourier transformed incoming signal - // with the local FFT'd code reference using SIMD operations with VOLK library - volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), - d_fft_if->get_outbuf(), d_fft_code_I_A, d_fft_size); + // CODE IA + // Multiply carrier wiped--off, Fourier transformed incoming signal + // with the local FFT'd code reference using SIMD operations with VOLK library + volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), + d_fft_if->get_outbuf(), d_fft_code_I_A, d_fft_size); - // compute the inverse FFT - d_ifft->execute(); + // compute the inverse FFT + d_ifft->execute(); - // Search maximum - volk_32fc_magnitude_squared_32f(d_magnitudeIA, d_ifft->get_outbuf(), d_fft_size); - volk_32f_index_max_16u(&indext_IA, d_magnitudeIA, d_fft_size); - // Normalize the maximum value to correct the scale factor introduced by FFTW - magt_IA = d_magnitudeIA[indext_IA] / (fft_normalization_factor * fft_normalization_factor); + // Search maximum + volk_32fc_magnitude_squared_32f(d_magnitudeIA, d_ifft->get_outbuf(), d_fft_size); + volk_32f_index_max_16u(&indext_IA, d_magnitudeIA, d_fft_size); + // Normalize the maximum value to correct the scale factor introduced by FFTW + magt_IA = d_magnitudeIA[indext_IA] / (fft_normalization_factor * fft_normalization_factor); - if (d_both_signal_components == true) - { - // REPEAT FOR ALL CODES. CODE_QA - volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), - d_fft_if->get_outbuf(), d_fft_code_Q_A, d_fft_size); - d_ifft->execute(); - volk_32fc_magnitude_squared_32f(d_magnitudeQA, d_ifft->get_outbuf(), d_fft_size); - volk_32f_index_max_16u(&indext_QA, d_magnitudeQA, d_fft_size); - magt_QA = d_magnitudeQA[indext_QA] / (fft_normalization_factor * fft_normalization_factor); - } - if (d_sampled_ms > 1) // If Integration time > 1 code - { - // REPEAT FOR ALL CODES. CODE_IB - volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), - d_fft_if->get_outbuf(), d_fft_code_I_B, d_fft_size); - d_ifft->execute(); - volk_32fc_magnitude_squared_32f(d_magnitudeIB, d_ifft->get_outbuf(), d_fft_size); - volk_32f_index_max_16u(&indext_IB, d_magnitudeIB, d_fft_size); - magt_IB = d_magnitudeIB[indext_IB] / (fft_normalization_factor * fft_normalization_factor); + if (d_both_signal_components == true) + { + // REPEAT FOR ALL CODES. CODE_QA + volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), + d_fft_if->get_outbuf(), d_fft_code_Q_A, d_fft_size); + d_ifft->execute(); + volk_32fc_magnitude_squared_32f(d_magnitudeQA, d_ifft->get_outbuf(), d_fft_size); + volk_32f_index_max_16u(&indext_QA, d_magnitudeQA, d_fft_size); + magt_QA = d_magnitudeQA[indext_QA] / (fft_normalization_factor * fft_normalization_factor); + } + if (d_sampled_ms > 1) // If Integration time > 1 code + { + // REPEAT FOR ALL CODES. CODE_IB + volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), + d_fft_if->get_outbuf(), d_fft_code_I_B, d_fft_size); + d_ifft->execute(); + volk_32fc_magnitude_squared_32f(d_magnitudeIB, d_ifft->get_outbuf(), d_fft_size); + volk_32f_index_max_16u(&indext_IB, d_magnitudeIB, d_fft_size); + magt_IB = d_magnitudeIB[indext_IB] / (fft_normalization_factor * fft_normalization_factor); - if (d_both_signal_components == true) - { - // REPEAT FOR ALL CODES. CODE_QB - volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), - d_fft_if->get_outbuf(), d_fft_code_Q_B, d_fft_size); - d_ifft->execute(); - volk_32fc_magnitude_squared_32f(d_magnitudeQB, d_ifft->get_outbuf(), d_fft_size); - volk_32f_index_max_16u(&indext_QB, d_magnitudeQB, d_fft_size); - magt_QB = d_magnitudeIB[indext_QB] / (fft_normalization_factor * fft_normalization_factor); - } - } + if (d_both_signal_components == true) + { + // REPEAT FOR ALL CODES. CODE_QB + volk_32fc_x2_multiply_32fc(d_ifft->get_inbuf(), + d_fft_if->get_outbuf(), d_fft_code_Q_B, d_fft_size); + d_ifft->execute(); + volk_32fc_magnitude_squared_32f(d_magnitudeQB, d_ifft->get_outbuf(), d_fft_size); + volk_32f_index_max_16u(&indext_QB, d_magnitudeQB, d_fft_size); + magt_QB = d_magnitudeIB[indext_QB] / (fft_normalization_factor * fft_normalization_factor); + } + } - // Integrate noncoherently the two best combinations (I² + Q²) - // and store the result in the I channel. - // If CAF filter to resolve doppler ambiguity is needed, - // peak is stored before non-coherent integration. - if (d_sampled_ms > 1) // T_integration > 1 code - { - if (magt_IA >= magt_IB) - { -// if (d_CAF_filter) {d_CAF_vector_I[doppler_index] = magt_IA;} - if (d_CAF_window_hz > 0) {d_CAF_vector_I[doppler_index] = d_magnitudeIA[indext_IA];} - if (d_both_signal_components) - { - // Integrate non-coherently I+Q - if (magt_QA >= magt_QB) - { -// if (d_CAF_filter) {d_CAF_vector_Q[doppler_index] = magt_QA;} - if (d_CAF_window_hz > 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];} - for (unsigned int i=0; i 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQB[indext_QB];} - for (unsigned int i=0; i 0) {d_CAF_vector_I[doppler_index] = d_magnitudeIB[indext_IB];} - if (d_both_signal_components) - { - // Integrate non-coherently I+Q - if (magt_QA >= magt_QB) - { - //if (d_CAF_filter) {d_CAF_vector_Q[doppler_index] = magt_QA;} - if (d_CAF_window_hz > 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];} - for (unsigned int i=0; i 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQB[indext_QB];} - for (unsigned int i=0; i 0) {d_CAF_vector_I[doppler_index] = d_magnitudeIA[indext_IA];} - if (d_both_signal_components) - { -// if (d_CAF_filter) {d_CAF_vector_Q[doppler_index] = magt_QA;} - if (d_CAF_window_hz > 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];} - // NON-Coherent integration of only 1 code - for (unsigned int i=0; i 1) // T_integration > 1 code + { + if (magt_IA >= magt_IB) + { + // if (d_CAF_filter) {d_CAF_vector_I[doppler_index] = magt_IA;} + if (d_CAF_window_hz > 0) {d_CAF_vector_I[doppler_index] = d_magnitudeIA[indext_IA];} + if (d_both_signal_components) + { + // Integrate non-coherently I+Q + if (magt_QA >= magt_QB) + { + // if (d_CAF_filter) {d_CAF_vector_Q[doppler_index] = magt_QA;} + if (d_CAF_window_hz > 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];} + for (unsigned int i=0; i 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQB[indext_QB];} + for (unsigned int i=0; i 0) {d_CAF_vector_I[doppler_index] = d_magnitudeIB[indext_IB];} + if (d_both_signal_components) + { + // Integrate non-coherently I+Q + if (magt_QA >= magt_QB) + { + //if (d_CAF_filter) {d_CAF_vector_Q[doppler_index] = magt_QA;} + if (d_CAF_window_hz > 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];} + for (unsigned int i=0; i 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQB[indext_QB];} + for (unsigned int i=0; i 0) {d_CAF_vector_I[doppler_index] = d_magnitudeIA[indext_IA];} + if (d_both_signal_components) + { + // if (d_CAF_filter) {d_CAF_vector_Q[doppler_index] = magt_QA;} + if (d_CAF_window_hz > 0) {d_CAF_vector_Q[doppler_index] = d_magnitudeQA[indext_QA];} + // NON-Coherent integration of only 1 code + for (unsigned int i=0; iAcq_delay_samples = static_cast(indext % d_samples_per_code); - d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); - d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; + // 4- record the maximum peak and the associated synchronization parameters + if (d_mag < magt) + { + d_mag = magt; + // In case that d_bit_transition_flag = true, we compare the potentially + // new maximum test statistics (d_mag/d_input_power) with the value in + // d_test_statistics. When the second dwell is being processed, the value + // of d_mag/d_input_power could be lower than d_test_statistics (i.e, + // the maximum test statistics in the previous dwell is greater than + // current d_mag/d_input_power). Note that d_test_statistics is not + // restarted between consecutive dwells in multidwell operation. + if (d_test_statistics < (d_mag / d_input_power) || !d_bit_transition_flag) + { + d_gnss_synchro->Acq_delay_samples = static_cast(indext % d_samples_per_code); + d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); + d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; - // 5- Compute the test statistics and compare to the threshold - d_test_statistics = d_mag / d_input_power; - } - } + // 5- Compute the test statistics and compare to the threshold + d_test_statistics = d_mag / d_input_power; + } + } - // Record results to file if required - if (d_dump) - { - std::stringstream filename; - std::streamsize n = sizeof(float) * (d_fft_size); // noncomplex file write - filename.str(""); - filename << "../data/test_statistics_E5a_sat_" - << d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat"; - d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); - if (d_sampled_ms > 1) // If integration time > 1 code - { - if (magt_IA >= magt_IB) - { - d_dump_file.write((char*)d_magnitudeIA, n); - } - else - { - d_dump_file.write((char*)d_magnitudeIB, n); - } - } - else - { - d_dump_file.write((char*)d_magnitudeIA, n); - } - d_dump_file.close(); - } - } -// std::cout << "d_mag " << d_mag << ".d_sample_counter " << d_sample_counter << ". acq delay " << d_gnss_synchro->Acq_delay_samples<< " indext "<< indext << std::endl; - // 6 OPTIONAL: CAF filter to avoid Doppler ambiguity in bit transition. - if (d_CAF_window_hz > 0) - { - int CAF_bins_half; - float* accum = static_cast(volk_malloc(sizeof(float), volk_get_alignment())); - CAF_bins_half = d_CAF_window_hz / (2 * d_doppler_step); - float weighting_factor; - weighting_factor = 0.5 / static_cast(CAF_bins_half); - // weighting_factor = 0; - // std::cout << "weighting_factor " << weighting_factor << std::endl; - // Initialize first iterations - for (int doppler_index=0; doppler_index < CAF_bins_half; doppler_index++) - { - d_CAF_vector[doppler_index] = 0; - // volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], d_CAF_vector_I, CAF_bins_half+doppler_index+1); - for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++) - { - d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast(abs(doppler_index - i))); - } - // d_CAF_vector[doppler_index] /= CAF_bins_half+doppler_index+1; - d_CAF_vector[doppler_index] /= 1 + CAF_bins_half+doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2] - if (d_both_signal_components) - { - accum[0] = 0; - // volk_32f_accumulator_s32f_a(&accum[0], d_CAF_vector_Q, CAF_bins_half+doppler_index+1); - for (int i = 0; i < CAF_bins_half+doppler_index+1; i++) - { - accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast(abs(doppler_index - i))); - } - // accum[0] /= CAF_bins_half+doppler_index+1; - accum[0] /= 1+CAF_bins_half+doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * doppler_index * (doppler_index + 1) / 2; // triangles = [n*(n+1)/2] - d_CAF_vector[doppler_index] += accum[0]; - } - } - // Body loop - for (unsigned int doppler_index = CAF_bins_half;doppler_index(abs(doppler_index - i))); - } - // d_CAF_vector[doppler_index] /= 2*CAF_bins_half+1; - d_CAF_vector[doppler_index] /= 1 + 2 * CAF_bins_half - 2 *weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2; - if (d_both_signal_components) - { - accum[0] = 0; - // volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], 2*CAF_bins_half); - for (int i = doppler_index-CAF_bins_half; i < doppler_index+CAF_bins_half+1; i++) - { - accum[0] += d_CAF_vector_Q[i] * (1 -weighting_factor * static_cast(abs(doppler_index - i))); - } - // accum[0] /= 2*CAF_bins_half+1; - accum[0] /= 1+2*CAF_bins_half - 2*weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2; - d_CAF_vector[doppler_index] += accum[0]; - } - } - // Final iterations - for (unsigned int doppler_index = d_num_doppler_bins - CAF_bins_half;doppler_indexPRN << "_doppler_" << doppler << ".dat"; + d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); + if (d_sampled_ms > 1) // If integration time > 1 code + { + if (magt_IA >= magt_IB) + { + d_dump_file.write((char*)d_magnitudeIA, n); + } + else + { + d_dump_file.write((char*)d_magnitudeIB, n); + } + } + else + { + d_dump_file.write((char*)d_magnitudeIA, n); + } + d_dump_file.close(); + } + } + // std::cout << "d_mag " << d_mag << ".d_sample_counter " << d_sample_counter << ". acq delay " << d_gnss_synchro->Acq_delay_samples<< " indext "<< indext << std::endl; + // 6 OPTIONAL: CAF filter to avoid Doppler ambiguity in bit transition. + if (d_CAF_window_hz > 0) + { + int CAF_bins_half; + float* accum = static_cast(volk_malloc(sizeof(float), volk_get_alignment())); + CAF_bins_half = d_CAF_window_hz / (2 * d_doppler_step); + float weighting_factor; + weighting_factor = 0.5 / static_cast(CAF_bins_half); + // weighting_factor = 0; + // std::cout << "weighting_factor " << weighting_factor << std::endl; + // Initialize first iterations + for (int doppler_index=0; doppler_index < CAF_bins_half; doppler_index++) + { + d_CAF_vector[doppler_index] = 0; + // volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], d_CAF_vector_I, CAF_bins_half+doppler_index+1); + for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++) + { + d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * static_cast((doppler_index - i))); + } + // d_CAF_vector[doppler_index] /= CAF_bins_half+doppler_index+1; + d_CAF_vector[doppler_index] /= 1 + CAF_bins_half+doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor*doppler_index*(doppler_index+1)/2; // triangles = [n*(n+1)/2] + if (d_both_signal_components) + { + accum[0] = 0; + // volk_32f_accumulator_s32f_a(&accum[0], d_CAF_vector_Q, CAF_bins_half+doppler_index+1); + for (int i = 0; i < CAF_bins_half + doppler_index + 1; i++) + { + accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast(abs(doppler_index - i))); + } + // accum[0] /= CAF_bins_half+doppler_index+1; + accum[0] /= 1 + CAF_bins_half + doppler_index - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * doppler_index * (doppler_index + 1) / 2; // triangles = [n*(n+1)/2] + d_CAF_vector[doppler_index] += accum[0]; + } + } + // Body loop + for (unsigned int doppler_index = CAF_bins_half;doppler_index((doppler_index - i))); + } + // d_CAF_vector[doppler_index] /= 2*CAF_bins_half+1; + d_CAF_vector[doppler_index] /= 1 + 2 * CAF_bins_half - 2 * weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2; + if (d_both_signal_components) + { + accum[0] = 0; + // volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], 2*CAF_bins_half); + for (int i = doppler_index-CAF_bins_half; i < doppler_index + CAF_bins_half + 1; i++) + { + accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * static_cast((doppler_index - i))); + } + // accum[0] /= 2*CAF_bins_half+1; + accum[0] /= 1 + 2 * CAF_bins_half - 2 * weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2; + d_CAF_vector[doppler_index] += accum[0]; + } + } + // Final iterations + for (int doppler_index = d_num_doppler_bins - CAF_bins_half; doppler_index < d_num_doppler_bins; doppler_index++) + { + d_CAF_vector[doppler_index] = 0; + // volk_32f_accumulator_s32f_a(&d_CAF_vector[doppler_index], &d_CAF_vector_I[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index)); + for (int i = doppler_index - CAF_bins_half; i < d_num_doppler_bins; i++) + { + d_CAF_vector[doppler_index] += d_CAF_vector_I[i] * (1 - weighting_factor * (abs(doppler_index - i))); + } + // d_CAF_vector[doppler_index] /= CAF_bins_half+(d_num_doppler_bins-doppler_index); + d_CAF_vector[doppler_index] /= 1 + CAF_bins_half + (d_num_doppler_bins - doppler_index - 1) - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * (d_num_doppler_bins - doppler_index) / 2; + if (d_both_signal_components) + { + accum[0] = 0; + // volk_32f_accumulator_s32f_a(&accum[0], &d_CAF_vector_Q[doppler_index-CAF_bins_half], CAF_bins_half + (d_num_doppler_bins-doppler_index)); + for (int i = doppler_index-CAF_bins_half; i < d_num_doppler_bins; i++) + { + accum[0] += d_CAF_vector_Q[i] * (1 - weighting_factor * (abs(doppler_index - i))); + } + // accum[0] /= CAF_bins_half+(d_num_doppler_bins-doppler_index); + accum[0] /= 1 + CAF_bins_half + (d_num_doppler_bins - doppler_index - 1) - weighting_factor * CAF_bins_half * (CAF_bins_half + 1) / 2 - weighting_factor * (d_num_doppler_bins - doppler_index - 1) * (d_num_doppler_bins - doppler_index) / 2; + d_CAF_vector[doppler_index] += accum[0]; + } + } - // Recompute the maximum doppler peak - volk_32f_index_max_16u(&indext, d_CAF_vector, d_num_doppler_bins); - doppler = -static_cast(d_doppler_max) + d_doppler_step * indext; - d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); - // Dump if required, appended at the end of the file - if (d_dump) - { - std::stringstream filename; - std::streamsize n = sizeof(float) * (d_num_doppler_bins); // noncomplex file write - filename.str(""); - filename << "../data/test_statistics_E5a_sat_" - << d_gnss_synchro->PRN << "_CAF.dat"; - d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); - d_dump_file.write((char*)d_CAF_vector, n); - d_dump_file.close(); - } - volk_free(accum); - } + // Recompute the maximum doppler peak + volk_32f_index_max_16u(&indext, d_CAF_vector, d_num_doppler_bins); + doppler = -static_cast(d_doppler_max) + d_doppler_step * indext; + d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); + // Dump if required, appended at the end of the file + if (d_dump) + { + std::stringstream filename; + std::streamsize n = sizeof(float) * (d_num_doppler_bins); // noncomplex file write + filename.str(""); + filename << "../data/test_statistics_E5a_sat_" << d_gnss_synchro->PRN << "_CAF.dat"; + d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); + d_dump_file.write((char*)d_CAF_vector, n); + d_dump_file.close(); + } + volk_free(accum); + } - if (d_well_count == d_max_dwells) - { - if (d_test_statistics > d_threshold) - { - d_state = 3; // Positive acquisition - } - else - { - d_state = 4; // Negative acquisition - } - } - else - { - d_state = 1; - } + if (d_well_count == d_max_dwells) + { + if (d_test_statistics > d_threshold) + { + d_state = 3; // Positive acquisition + } + else + { + d_state = 4; // Negative acquisition + } + } + else + { + d_state = 1; + } - consume_each(d_fft_size - d_buffer_count); - d_buffer_count = 0; - break; - } - case 3: - { - // 7.1- Declare positive acquisition using a message queue - DLOG(INFO) << "positive acquisition"; - DLOG(INFO) << "satellite " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN; - DLOG(INFO) << "sample_stamp " << d_sample_counter; - DLOG(INFO) << "test statistics value " << d_test_statistics; - DLOG(INFO) << "test statistics threshold " << d_threshold; - DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; - DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; - DLOG(INFO) << "magnitude " << d_mag; - DLOG(INFO) << "input signal power " << d_input_power; + consume_each(d_fft_size - d_buffer_count); + d_buffer_count = 0; + break; + } + case 3: + { + // 7.1- Declare positive acquisition using a message queue + DLOG(INFO) << "positive acquisition"; + DLOG(INFO) << "satellite " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN; + DLOG(INFO) << "sample_stamp " << d_sample_counter; + DLOG(INFO) << "test statistics value " << d_test_statistics; + DLOG(INFO) << "test statistics threshold " << d_threshold; + DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; + DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; + DLOG(INFO) << "magnitude " << d_mag; + DLOG(INFO) << "input signal power " << d_input_power; - d_active = false; - d_state = 0; + d_active = false; + d_state = 0; - acquisition_message = 1; - d_channel_internal_queue->push(acquisition_message); - d_sample_counter += ninput_items[0]; // sample counter - consume_each(ninput_items[0]); - break; - } - case 4: - { - // 7.2- Declare negative acquisition using a message queue - DLOG(INFO) << "negative acquisition"; - DLOG(INFO) << "satellite " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN; - DLOG(INFO) << "sample_stamp " << d_sample_counter; - DLOG(INFO) << "test statistics value " << d_test_statistics; - DLOG(INFO) << "test statistics threshold " << d_threshold; - DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; - DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; - DLOG(INFO) << "magnitude " << d_mag; - DLOG(INFO) << "input signal power " << d_input_power; + acquisition_message = 1; + d_channel_internal_queue->push(acquisition_message); + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + break; + } + case 4: + { + // 7.2- Declare negative acquisition using a message queue + DLOG(INFO) << "negative acquisition"; + DLOG(INFO) << "satellite " << d_gnss_synchro->System << " " << d_gnss_synchro->PRN; + DLOG(INFO) << "sample_stamp " << d_sample_counter; + DLOG(INFO) << "test statistics value " << d_test_statistics; + DLOG(INFO) << "test statistics threshold " << d_threshold; + DLOG(INFO) << "code phase " << d_gnss_synchro->Acq_delay_samples; + DLOG(INFO) << "doppler " << d_gnss_synchro->Acq_doppler_hz; + DLOG(INFO) << "magnitude " << d_mag; + DLOG(INFO) << "input signal power " << d_input_power; - d_active = false; - d_state = 0; + d_active = false; + d_state = 0; - d_sample_counter += ninput_items[0]; // sample counter - consume_each(ninput_items[0]); - acquisition_message = 2; - d_channel_internal_queue->push(acquisition_message); - break; - } + d_sample_counter += ninput_items[0]; // sample counter + consume_each(ninput_items[0]); + acquisition_message = 2; + d_channel_internal_queue->push(acquisition_message); + break; + } } return noutput_items; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fine_doppler_cc.cc index fa5460a5a..4fd148d2e 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 @@ -356,14 +356,14 @@ int pcps_acquisition_fine_doppler_cc::estimate_Doppler(gr_vector_const_void_star } // 5. Update the Doppler estimation in Hz - if (abs(fftFreqBins[tmp_index_freq] - d_gnss_synchro->Acq_doppler_hz) < 1000) + if (std::abs(fftFreqBins[tmp_index_freq] - d_gnss_synchro->Acq_doppler_hz) < 1000) { d_gnss_synchro->Acq_doppler_hz = static_cast(fftFreqBins[tmp_index_freq]); //std::cout<<"FFT maximum present at "<= d_symbols_per_preamble) { //check preamble separation - preamble_diff = abs(d_sample_counter - d_preamble_index); + preamble_diff = d_sample_counter - d_preamble_index; if (abs(preamble_diff - GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS) == 0) { //try to decode frame 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 d800373f0..f5e9864c6 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 @@ -209,7 +209,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work (int noutput_items, gr_vector_i } else if (d_stat == 1) //check 6 seconds of preamble separation { - preamble_diff = abs(d_sample_counter - d_preamble_index); + preamble_diff = d_sample_counter - d_preamble_index; if (abs(preamble_diff - 6000) < 1) { d_GPS_FSM.Event_gps_word_preamble(); diff --git a/src/core/system_parameters/galileo_navigation_message.cc b/src/core/system_parameters/galileo_navigation_message.cc index fcb74e0a3..d4e7dfe23 100644 --- a/src/core/system_parameters/galileo_navigation_message.cc +++ b/src/core/system_parameters/galileo_navigation_message.cc @@ -1,6 +1,6 @@ /*! - * \file Galileo_Navigation_Message.cc - * \brief Implementation of a Galileo I/NAV Data message + * \file galileo_navigation_message.cc + * \brief Implementation of a Galileo I/NAV Data message * as described in Galileo OS SIS ICD Issue 1.1 (Sept. 2010) * \author Mara Branzanti 2013. mara.branzanti(at)gmail.com * \author Javier Arribas, 2013. jarribas(at)cttc.es diff --git a/src/core/system_parameters/galileo_utc_model.cc b/src/core/system_parameters/galileo_utc_model.cc index abf63be98..06d69752b 100644 --- a/src/core/system_parameters/galileo_utc_model.cc +++ b/src/core/system_parameters/galileo_utc_model.cc @@ -29,6 +29,7 @@ */ #include "galileo_utc_model.h" +#include Galileo_Utc_Model::Galileo_Utc_Model() { @@ -57,7 +58,7 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int WN) { //Detect if the effectivity time and user's time is within six hours = 6 * 60 *60 = 21600 s int secondOfLeapSecondEvent = DN_6 * 24 * 60 * 60; - if (abs(t_e - secondOfLeapSecondEvent) > 21600) + if (std::abs(t_e - secondOfLeapSecondEvent) > 21600) { /* 5.1.7a GST->UTC case a * Whenever the leap second adjusted time indicated by the WN_LSF and the DN values diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index a5b58b050..d75ff3069 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -31,6 +31,7 @@ */ #include "gps_navigation_message.h" +#include #include "boost/date_time/posix_time/posix_time.hpp" @@ -697,7 +698,7 @@ double Gps_Navigation_Message::utc_time(const double gpstime_corrected) const } else //we are in the same week than the leap second event { - if (abs(gpstime_corrected - secondOfLeapSecondEvent) > 21600) + if (std::abs(gpstime_corrected - secondOfLeapSecondEvent) > 21600) { /* 20.3.3.5.2.4a * Whenever the effectivity time indicated by the WN_LSF and the DN values diff --git a/src/core/system_parameters/gps_utc_model.cc b/src/core/system_parameters/gps_utc_model.cc index 64a8b0758..2548b5ab9 100644 --- a/src/core/system_parameters/gps_utc_model.cc +++ b/src/core/system_parameters/gps_utc_model.cc @@ -29,6 +29,7 @@ */ #include "gps_utc_model.h" +#include Gps_Utc_Model::Gps_Utc_Model() { @@ -62,7 +63,7 @@ double Gps_Utc_Model::utc_time(double gpstime_corrected, int i_GPS_week) } else //we are in the same week than the leap second event { - if (abs(gpstime_corrected - secondOfLeapSecondEvent) > 21600) + if (std::abs(gpstime_corrected - secondOfLeapSecondEvent) > 21600) { /* 20.3.3.5.2.4a * Whenever the effectivity time indicated by the WN_LSF and the DN values diff --git a/src/core/system_parameters/sbas_telemetry_data.cc b/src/core/system_parameters/sbas_telemetry_data.cc index 22f7f88b5..2e6475a40 100644 --- a/src/core/system_parameters/sbas_telemetry_data.cc +++ b/src/core/system_parameters/sbas_telemetry_data.cc @@ -28,10 +28,11 @@ * ------------------------------------------------------------------------- */ -#include -#include +#include #include #include +#include +#include #include #include "sbas_telemetry_data.h" #include "sbas_ionospheric_correction.h" @@ -722,7 +723,7 @@ int Sbas_Telemetry_Data::decode_sbstype9(const sbsmsg_t *msg, nav_t *nav) seph.af1 = getbits(msg->msg, 218, 8)*P2_39/2.0; i = msg->prn-MINPRNSBS; - if (!nav->seph || fabs(nav->seph[i].t0 - seph.t0) < 1E-3) + if (!nav->seph || std::abs(nav->seph[i].t0 - seph.t0) < 1E-3) { /* not change */ VLOG(FLOW) << "<> no change in ephemeris -> won't parse"; return 0; diff --git a/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index 4c0261b4f..0e67f110c 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -320,8 +320,8 @@ void GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index c8cb55cfd..37826556c 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -323,8 +323,8 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc index 7c147a582..88fe3a141 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -240,9 +240,9 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) std::cout << "Delay: " << gnss_synchro.Acq_delay_samples << std::endl; std::cout << "Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl; - double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); + double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); float delay_error_chips = (float)(delay_error_samples * 1023 / 4000000); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips"; diff --git a/src/tests/gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc index 1154cadfc..807620869 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc @@ -321,8 +321,8 @@ void GalileoE1PcpsCccwsrAmbiguousAcquisitionTest::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/src/tests/gnss_block/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index edb4f1062..b333a1218 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -436,8 +436,8 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / ((double)fs_in * 1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples - 5) * 1023.0 / ((double)fs_in * 1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index e4eb6b1ec..2fa325624 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -328,8 +328,8 @@ void GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index 065bd5542..0da42fed8 100644 --- a/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/src/tests/gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -446,20 +446,20 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::process_message() switch (sat) { case 0: - delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); - doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); + doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); break; case 1: - delay_error_chips = abs((double)expected_delay_chips1 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); - doppler_error_hz = abs(expected_doppler_hz1 - gnss_synchro.Acq_doppler_hz); + delay_error_chips = std::abs((double)expected_delay_chips1 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); + doppler_error_hz = std::abs(expected_doppler_hz1 - gnss_synchro.Acq_doppler_hz); break; case 2: - delay_error_chips = abs((double)expected_delay_chips2 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); - doppler_error_hz = abs(expected_doppler_hz2 - gnss_synchro.Acq_doppler_hz); + delay_error_chips = std::abs((double)expected_delay_chips2 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); + doppler_error_hz = std::abs(expected_doppler_hz2 - gnss_synchro.Acq_doppler_hz); break; case 3: - delay_error_chips = abs((double)expected_delay_chips3 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); - doppler_error_hz = abs(expected_doppler_hz3 - gnss_synchro.Acq_doppler_hz); + delay_error_chips = std::abs((double)expected_delay_chips3 - (double)(gnss_synchro.Acq_delay_samples-5)*10230.0/((double)fs_in*1e-3)); + doppler_error_hz = std::abs(expected_doppler_hz3 - gnss_synchro.Acq_doppler_hz); break; default: // case 3 std::cout << "Error: message from unexpected acquisition channel" << std::endl; diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc index 63c392055..bb7b2170f 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc @@ -318,8 +318,8 @@ void GpsL1CaPcpsAcquisitionGSoC2013Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc index cca1782b4..b2d60a4fc 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc @@ -322,8 +322,8 @@ void GpsL1CaPcpsMultithreadAcquisitionGSoC2013Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc index 6fb536372..c8294a86b 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc @@ -317,8 +317,8 @@ void GpsL1CaPcpsOpenClAcquisitionGSoC2013Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples- 5 )*1023.0/((double)fs_in*1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples- 5 )*1023.0/((double)fs_in*1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index f1366a13d..859bacf9e 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -429,8 +429,8 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples - 5) * 1023.0/ ((double)fs_in * 1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples - 5) * 1023.0/ ((double)fs_in * 1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc index 693aaf648..55ea5a64b 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc @@ -319,8 +319,8 @@ void GpsL1CaPcpsTongAcquisitionGSoC2013Test::process_message() detection_counter++; // The term -5 is here to correct the additional delay introduced by the FIR filter - double delay_error_chips = abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double delay_error_chips = std::abs((double)expected_delay_chips - (double)(gnss_synchro.Acq_delay_samples-5)*1023.0/((double)fs_in*1e-3)); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); mse_delay += std::pow(delay_error_chips, 2); mse_doppler += std::pow(doppler_error_hz, 2); diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index ad92eea99..98b7ae570 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -29,6 +29,7 @@ * ------------------------------------------------------------------------- */ +#include #include #include #include diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index c6c662206..ffa7e2064 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -29,9 +29,7 @@ * ------------------------------------------------------------------------- */ - - - +#include #include #include #include From 28c8ff8121c0772171640e0da6a97df0b199547e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 1 May 2015 18:31:31 +0200 Subject: [PATCH 13/25] Improve instructions for Ubuntu 14.04 LTS users. Updated Armadillo version --- CMakeLists.txt | 4 ++-- README.md | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c94d8d79..1961e0882 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -696,8 +696,8 @@ if(NOT ARMADILLO_FOUND) message(STATUS " Armadillo will be downloaded and built automatically ") message(STATUS " when doing 'make'. ") - set(armadillo_RELEASE 4.650.4) - set(armadillo_MD5 "e575dc01cf60e290a467c7c6d3171ef3") + set(armadillo_RELEASE 5.100.1) + set(armadillo_MD5 "6926fbf81bde99d777e3d09d034b308a") ExternalProject_Add( armadillo-${armadillo_RELEASE} diff --git a/README.md b/README.md index e5cbc8365..24a4b9f98 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time Once you have installed these packages, you can jump directly to [how to download the source code and build GNSS-SDR](#download-and-build-linux). Alternatively, if you need to manually install those libraries, please keep reading. -Note for Ubuntu 14.04 LTS "trusty" users: you will need to build from source and install GNU Radio manually, as explained below, since GNSS-SDR requires gnuradio-dev >= 3.7.3, and Ubuntu 14.04 came with 3.7.2. +Note for Ubuntu 14.04 LTS "trusty" users: you will need to build from source and install GNU Radio manually, as explained below, since GNSS-SDR requires gnuradio-dev >= 3.7.3, and Ubuntu 14.04 came with 3.7.2. Install all the packages above BUT EXCEPT ```libuhd-dev```, ```gnuradio-dev``` and ```gr-osmosdr``` (and remove them if they are already installed in your machine), and install those dependencies using PyBOMBS. ### Manual installation of GNU Radio @@ -94,9 +94,9 @@ In case you do not want to use PyBOMBS and prefer to build and install GNU Radio $ sudo apt-get install libopenblas-dev liblapack-dev gfortran # For Debian/Ubuntu/LinuxMint $ sudo yum install lapack-devel blas-devel gcc-fortran # For Fedora/CentOS/RHEL $ sudo zypper install lapack-devel blas-devel gcc-fortran # For OpenSUSE -$ wget http://sourceforge.net/projects/arma/files/armadillo-4.650.4.tar.gz -$ tar xvfz armadillo-4.650.4.tar.gz -$ cd armadillo-4.650.4 +$ wget http://sourceforge.net/projects/arma/files/armadillo-5.100.1.tar.gz +$ tar xvfz armadillo-5.100.1.tar.gz +$ cd armadillo-5.100.1 $ cmake . $ make $ sudo make install From 00d29412672fb8640ce6453600631c4f9d3bcf88 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 May 2015 10:15:51 +0200 Subject: [PATCH 14/25] Adding an option for using gprof --- CMakeLists.txt | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1961e0882..f9d9a2d8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,16 +35,23 @@ file(RELATIVE_PATH RELATIVE_CMAKE_CALL ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRE # Enable them here or at the command line by doing 'cmake -DENABLE_XXX=ON ../' ######################################################################## -option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF) -option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF) -option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNURadio driver" OFF) +# Support of optional RF front-ends option(ENABLE_OSMOSDR "Enable the use of OsmoSDR and other front-ends (RTL-based dongles, HackRF, bladeRF, etc.) as signal source (experimental)" OFF) -option(ENABLE_OPENCL "Enable building of processing blocks implemented with OpenCL (experimental)" OFF) +option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNURadio driver" OFF) +option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal source (experimental)" OFF) +option(ENABLE_GN3S "Enable the use of the GN3S dongle as signal source (experimental)" OFF) + +# Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) +option(ENABLE_GPROF "Enable the use of the GNU profiler tool 'gprof'" OFF) + +# Acceleration +option(ENABLE_OPENCL "Enable building of processing blocks implemented with OpenCL (experimental)" OFF) + +# Building and packaging options option(ENABLE_GENERIC_ARCH "Builds a portable binary" OFF) option(ENABLE_PACKAGING "Enable software packaging" OFF) option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF) - if(ENABLE_PACKAGING) set(ENABLE_GENERIC_ARCH ON) endif(ENABLE_PACKAGING) @@ -212,13 +219,15 @@ endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") #select the release build type by default to get optimization flags if(NOT CMAKE_BUILD_TYPE) - if(ENABLE_GPERFTOOLS) - set(CMAKE_BUILD_TYPE "RelWithDebInfo") - message(STATUS "Build type not specified: defaulting to RelWithDebInfo.") - else(ENABLE_GPERFTOOLS) - set(CMAKE_BUILD_TYPE "Release") - message(STATUS "Build type not specified: defaulting to Release.") - endif(ENABLE_GPERFTOOLS) + if(ENABLE_GPERFTOOLS OR ENABLE_GPROF) + set(CMAKE_BUILD_TYPE "RelWithDebInfo") + message(STATUS "Build type not specified: defaulting to RelWithDebInfo.") + else(ENABLE_GPERFTOOLS OR ENABLE_GPROF) + set(CMAKE_BUILD_TYPE "Release") + message(STATUS "Build type not specified: defaulting to Release.") + endif(ENABLE_GPERFTOOLS OR ENABLE_GPROF) +else(NOT CMAKE_BUILD_TYPE) + message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.") endif(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "") @@ -1017,6 +1026,15 @@ if(ENABLE_GPERFTOOLS) endif(GPERFTOOLS_FOUND) endif(ENABLE_GPERFTOOLS) +if(ENABLE_GPROF) + if(CMAKE_COMPILER_IS_GNUCXX) + set(MY_CXX_FLAGS "${MY_CXX_FLAGS} -pg") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") + endif(CMAKE_COMPILER_IS_GNUCXX) +endif(ENABLE_GPROF) + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_FLAGS}") if(OS_IS_LINUX) From b7c14696163cff9d2dbb10be9bacbccac0817af8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 May 2015 10:50:57 +0200 Subject: [PATCH 15/25] 20% of performance improvement --- .../libs/gps_sdr_signal_processing.cc | 23 ++++-- src/tests/arithmetic/code_generation_test.cc | 80 +++++++++++++++++++ src/tests/test_main.cc | 1 + 3 files changed, 96 insertions(+), 8 deletions(-) create mode 100644 src/tests/arithmetic/code_generation_test.cc diff --git a/src/algorithms/libs/gps_sdr_signal_processing.cc b/src/algorithms/libs/gps_sdr_signal_processing.cc index 9037fc414..5ac0c19b5 100644 --- a/src/algorithms/libs/gps_sdr_signal_processing.cc +++ b/src/algorithms/libs/gps_sdr_signal_processing.cc @@ -37,10 +37,11 @@ void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, unsigned int _chip_shift) { - unsigned int G1[1023]; - unsigned int G2[1023]; - unsigned int G1_register[10], G2_register[10]; - unsigned int feedback1, feedback2; + bool G1[1023]; + bool G2[1023]; + bool G1_register[10], G2_register[10]; + bool feedback1, feedback2; + bool aux; unsigned int lcv, lcv2; unsigned int delay; signed int prn_idx; @@ -58,7 +59,7 @@ void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, uns } else { - prn_idx = _prn-1; + prn_idx = _prn - 1; } /* A simple error check */ @@ -94,13 +95,18 @@ void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, uns delay = 1023 - delays[prn_idx]; delay += _chip_shift; delay %= 1023; + /* Generate PRN from G1 and G2 Registers */ for(lcv = 0; lcv < 1023; lcv++) { - _dest[lcv] = std::complex(G1[(lcv + _chip_shift)%1023]^G2[delay], 0); - if(_dest[lcv].real() == 0.0) //javi + aux = G1[(lcv + _chip_shift) % 1023]^G2[delay]; + if(aux == true) { - _dest[lcv].real(-1.0); + _dest[lcv] = std::complex(1, 0); + } + else + { + _dest[lcv] = std::complex(-1, 0); } delay++; delay %= 1023; @@ -108,6 +114,7 @@ void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, uns } + /* * Generates complex GPS L1 C/A code for the desired SV ID and sampled to specific sampling frequency */ diff --git a/src/tests/arithmetic/code_generation_test.cc b/src/tests/arithmetic/code_generation_test.cc new file mode 100644 index 000000000..0813cadb4 --- /dev/null +++ b/src/tests/arithmetic/code_generation_test.cc @@ -0,0 +1,80 @@ +/*! + * \file code_generation_test.cc + * \brief This file implements tests for the generation of complex exponentials. + * \author Carles Fernandez-Prades, 2014. cfernandez(at)cttc.es + * + * + * ------------------------------------------------------------------------- + * + * Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors) + * + * GNSS-SDR is a software defined Global Navigation + * Satellite Systems receiver + * + * This file is part of GNSS-SDR. + * + * GNSS-SDR is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNSS-SDR is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNSS-SDR. If not, see . + * + * ------------------------------------------------------------------------- + */ + + +#include +#include +#include "gps_sdr_signal_processing.h" + + + +TEST(CodeGenGPSL1_Test, CodeGeneration) +{ + std::complex* _dest = new std::complex[1023]; + signed int _prn = 1; + unsigned int _chip_shift = 4; + + int iterations = 100; + + struct timeval tv; + gettimeofday(&tv, NULL); + long long int begin = tv.tv_sec * 1000000 + tv.tv_usec; + + for(int i = 0; i < iterations; i++) + { + gps_l1_ca_code_gen_complex( _dest, _prn, _chip_shift); + } + + gettimeofday(&tv, NULL); + long long int end = tv.tv_sec * 1000000 + tv.tv_usec; + ASSERT_LE(0, end - begin); + std::cout << "Generation completed in " << (end - begin) << " microseconds" << std::endl; + delete[] _dest; + + + /* std::complex* _dest2 = new std::complex[1023];gettimeofday(&tv, NULL); + long long int begin2 = tv.tv_sec * 1000000 + tv.tv_usec; + + for(int i = 0; i < iterations; i++) + { + gps_l1_ca_code_gen_complex2( _dest2, _prn, _chip_shift); + } + + gettimeofday(&tv, NULL); + long long int end2 = tv.tv_sec * 1000000 + tv.tv_usec; + std::cout << "Generation 2 completed in " << (end2 - begin2) << " microseconds" << std::endl; + + for (int j=0; j<1023;j++) + { + if(_dest[j] != _dest2[j]) std::cout << "Error!" << std::endl; + } + delete _dest2; */ +} diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index ffa7e2064..7e523d89f 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -70,6 +70,7 @@ DECLARE_string(log_dir); #include "arithmetic/conjugate_test.cc" #include "arithmetic/magnitude_squared_test.cc" #include "arithmetic/multiply_test.cc" +#include "arithmetic/code_generation_test.cc" #include "configuration/file_configuration_test.cc" #include "configuration/in_memory_configuration_test.cc" #include "control_thread/control_message_factory_test.cc" From 09e86c275095ae61edc371108a0360fceddc7051 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 May 2015 12:33:51 +0200 Subject: [PATCH 16/25] faster update --- .../gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc index c78e6daa5..97c92225b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc @@ -281,14 +281,16 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_code() void Gps_L1_Ca_Dll_Pll_Tracking_cc::update_local_carrier() { - float phase_rad, phase_step_rad; + float sin_f, cos_f; + float phase_step_rad = static_cast(GPS_TWO_PI) * d_carrier_doppler_hz / static_cast(d_fs_in); + int phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad); + int phase_rad_i = gr::fxpt::float_to_fixed(d_rem_carr_phase_rad); - phase_step_rad = static_cast(GPS_TWO_PI) * d_carrier_doppler_hz / static_cast(d_fs_in); - phase_rad = d_rem_carr_phase_rad; for(int i = 0; i < d_current_prn_length_samples; i++) { - d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad)); - phase_rad += phase_step_rad; + gr::fxpt::sincos(phase_rad_i, &sin_f, &cos_f); + d_carr_sign[i] = std::complex(cos_f, -sin_f); + phase_rad_i += phase_step_rad_i; } //d_rem_carr_phase_rad = fmod(phase_rad, GPS_TWO_PI); //d_acc_carrier_phase_rad = d_acc_carrier_phase_rad + d_rem_carr_phase_rad; From caa10a583fa5ccfa249fb92358792b34fa7b13cc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 May 2015 12:35:37 +0200 Subject: [PATCH 17/25] adding missing include --- .../tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc index 97c92225b..2b2a02ed1 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc @@ -41,6 +41,7 @@ #include #include #include +#include // fixed point sine and cosine #include #include "gnss_synchro.h" #include "gps_sdr_signal_processing.h" From 1011bb086367f99a02bf0b7e41066be79d3ef183 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 May 2015 13:15:17 +0200 Subject: [PATCH 18/25] Faster local carrier update (25% of improvement) --- .../galileo_e1_dll_pll_veml_tracking_cc.cc | 16 +++++++++------- .../galileo_e5a_dll_pll_tracking_cc.cc | 15 ++++++++++----- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc index becfcf9fc..06f0267b5 100755 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc @@ -259,17 +259,19 @@ void galileo_e1_dll_pll_veml_tracking_cc::update_local_code() memcpy(d_very_late_code, &d_very_early_code[2 * very_early_late_spc_samples], d_current_prn_length_samples * sizeof(gr_complex)); } + void galileo_e1_dll_pll_veml_tracking_cc::update_local_carrier() { - float phase_rad, phase_step_rad; - // Compute the carrier phase step for the K-1 carrier doppler estimation - phase_step_rad = static_cast(GPS_TWO_PI) * d_carrier_doppler_hz / static_cast(d_fs_in); - // Initialize the carrier phase with the remanent carrier phase of the K-2 loop - phase_rad = d_rem_carr_phase_rad; + float sin_f, cos_f; + float phase_step_rad = static_cast(2 * GALILEO_PI) * d_carrier_doppler_hz / static_cast(d_fs_in); + int phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad); + int phase_rad_i = gr::fxpt::float_to_fixed(d_rem_carr_phase_rad); + for(int i = 0; i < d_current_prn_length_samples; i++) { - d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad)); - phase_rad += phase_step_rad; + gr::fxpt::sincos(phase_rad_i, &sin_f, &cos_f); + d_carr_sign[i] = std::complex(cos_f, -sin_f); + phase_rad_i += phase_step_rad_i; } } diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc index ea7eb5a35..88c499e8d 100644 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e5a_dll_pll_tracking_cc.cc @@ -40,6 +40,7 @@ #include #include #include +#include // fixed point sine and cosine #include #include "gnss_synchro.h" #include "galileo_e5_signal_processing.h" @@ -364,19 +365,23 @@ void Galileo_E5a_Dll_Pll_Tracking_cc::update_local_code() } + void Galileo_E5a_Dll_Pll_Tracking_cc::update_local_carrier() { - float phase_rad, phase_step_rad; + float sin_f, cos_f; + float phase_step_rad = static_cast(2 * GALILEO_PI) * d_carrier_doppler_hz / static_cast(d_fs_in); + int phase_step_rad_i = gr::fxpt::float_to_fixed(phase_step_rad); + int phase_rad_i = gr::fxpt::float_to_fixed(d_rem_carr_phase_rad); - phase_step_rad = 2 * static_cast(GALILEO_PI) * d_carrier_doppler_hz / static_cast(d_fs_in); - phase_rad = d_rem_carr_phase_rad; for(int i = 0; i < d_current_prn_length_samples; i++) { - d_carr_sign[i] = gr_complex(cos(phase_rad), -sin(phase_rad)); - phase_rad += phase_step_rad; + gr::fxpt::sincos(phase_rad_i, &sin_f, &cos_f); + d_carr_sign[i] = std::complex(cos_f, -sin_f); + phase_rad_i += phase_step_rad_i; } } + int Galileo_E5a_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { From c9300c45a0e7773b274b3bc4e75134ae5b92ca4e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 May 2015 13:17:21 +0200 Subject: [PATCH 19/25] adding missing include --- .../gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc index 06f0267b5..3e7e1427c 100755 --- a/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/galileo_e1_dll_pll_veml_tracking_cc.cc @@ -41,6 +41,7 @@ #include #include #include +#include // fixed point sine and cosine #include #include "gnss_synchro.h" #include "galileo_e1_signal_processing.h" From e354b1ce53a6e615e4b0066f829861a6cb5082ac Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 4 May 2015 22:16:26 +0200 Subject: [PATCH 20/25] less verbose logging in Release --- src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc | 4 ++-- src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc | 10 ++++----- src/algorithms/PVT/libs/hybrid_ls_pvt.cc | 6 ++--- .../gps_l1_ca_dll_pll_tracking_cc.cc | 7 +++--- src/core/receiver/gnss_flowgraph.cc | 22 +++++++------------ 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc b/src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc index e793b7ea0..a13c3b561 100644 --- a/src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc +++ b/src/algorithms/PVT/libs/galileo_e1_ls_pvt.cc @@ -308,7 +308,7 @@ bool galileo_e1_ls_pvt::get_PVT(std::map gnss_pseudoranges_map //end debug // SV ECEF DEBUG OUTPUT - LOG(INFO) << "ECEF satellite SV ID=" << galileo_ephemeris_iter->second.i_satellite_PRN + DLOG(INFO) << "ECEF satellite SV ID=" << galileo_ephemeris_iter->second.i_satellite_PRN << " X=" << galileo_ephemeris_iter->second.d_satpos_X << " [m] Y=" << galileo_ephemeris_iter->second.d_satpos_Y << " [m] Z=" << galileo_ephemeris_iter->second.d_satpos_Z @@ -345,7 +345,7 @@ bool galileo_e1_ls_pvt::get_PVT(std::map gnss_pseudoranges_map // 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); d_position_UTC_time = p_time; - LOG(INFO) << "Galileo Position at TOW=" << galileo_current_time << " in ECEF (X,Y,Z) = " << mypos; + DLOG(INFO) << "Galileo Position at TOW=" << galileo_current_time << " in ECEF (X,Y,Z) = " << mypos; cart2geo(static_cast(mypos(0)), static_cast(mypos(1)), static_cast(mypos(2)), 4); //ToDo: Find an Observables/PVT random bug with some satellite configurations that gives an erratic PVT solution (i.e. height>50 km) diff --git a/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc b/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc index 4323ae504..d58cc73df 100644 --- a/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc +++ b/src/algorithms/PVT/libs/gps_l1_ca_ls_pvt.cc @@ -289,7 +289,7 @@ bool gps_l1_ca_ls_pvt::get_PVT(std::map gnss_pseudoranges_map, valid_obs++; // SV ECEF DEBUG OUTPUT - LOG(INFO) << "(new)ECEF satellite SV ID=" << gps_ephemeris_iter->second.i_satellite_PRN + DLOG(INFO) << "(new)ECEF satellite SV ID=" << gps_ephemeris_iter->second.i_satellite_PRN << " X=" << gps_ephemeris_iter->second.d_satpos_X << " [m] Y=" << gps_ephemeris_iter->second.d_satpos_Y << " [m] Z=" << gps_ephemeris_iter->second.d_satpos_Z @@ -318,11 +318,11 @@ bool gps_l1_ca_ls_pvt::get_PVT(std::map gnss_pseudoranges_map, if (valid_obs >= 4) { arma::vec mypos; - LOG(INFO) << "satpos=" << satpos; - LOG(INFO) << "obs=" << obs; - LOG(INFO) << "W=" << W; + DLOG(INFO) << "satpos=" << satpos; + DLOG(INFO) << "obs=" << obs; + DLOG(INFO) << "W=" << W; mypos = leastSquarePos(satpos, obs, W); - LOG(INFO) << "(new)Position at TOW=" << GPS_current_time << " in ECEF (X,Y,Z) = " << mypos; + DLOG(INFO) << "(new)Position at TOW=" << GPS_current_time << " in ECEF (X,Y,Z) = " << mypos; gps_l1_ca_ls_pvt::cart2geo(mypos(0), mypos(1), mypos(2), 4); //ToDo: Find an Observables/PVT random bug with some satellite configurations that gives an erratic PVT solution (i.e. height>50 km) if (d_height_m > 50000) diff --git a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc index ca81f2aa4..cd644c0fe 100644 --- a/src/algorithms/PVT/libs/hybrid_ls_pvt.cc +++ b/src/algorithms/PVT/libs/hybrid_ls_pvt.cc @@ -318,7 +318,7 @@ bool hybrid_ls_pvt::get_PVT(std::map gnss_pseudoranges_map, do //end debug // SV ECEF DEBUG OUTPUT - LOG(INFO) << "ECEF satellite SV ID=" << galileo_ephemeris_iter->second.i_satellite_PRN + DLOG(INFO) << "ECEF satellite SV ID=" << galileo_ephemeris_iter->second.i_satellite_PRN << " X=" << galileo_ephemeris_iter->second.d_satpos_X << " [m] Y=" << galileo_ephemeris_iter->second.d_satpos_Y << " [m] Z=" << galileo_ephemeris_iter->second.d_satpos_Z @@ -369,7 +369,7 @@ bool hybrid_ls_pvt::get_PVT(std::map gnss_pseudoranges_map, do valid_obs++; valid_obs_GPS_counter++; // SV ECEF DEBUG OUTPUT - LOG(INFO) << "(new)ECEF satellite SV ID=" << gps_ephemeris_iter->second.i_satellite_PRN + DLOG(INFO) << "(new)ECEF satellite SV ID=" << gps_ephemeris_iter->second.i_satellite_PRN << " X=" << gps_ephemeris_iter->second.d_satpos_X << " [m] Y=" << gps_ephemeris_iter->second.d_satpos_Y << " [m] Z=" << gps_ephemeris_iter->second.d_satpos_Z @@ -414,7 +414,7 @@ bool hybrid_ls_pvt::get_PVT(std::map gnss_pseudoranges_map, do // 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); d_position_UTC_time = p_time; - LOG(INFO) << "HYBRID Position at TOW=" << hybrid_current_time << " in ECEF (X,Y,Z) = " << mypos; + DLOG(INFO) << "HYBRID Position at TOW=" << hybrid_current_time << " in ECEF (X,Y,Z) = " << mypos; cart2geo(static_cast(mypos(0)), static_cast(mypos(1)), static_cast(mypos(2)), 4); //ToDo: Find an Observables/PVT random bug with some satellite configurations that gives an erratic PVT solution (i.e. height>50 km) diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc index 2b2a02ed1..ccea190d2 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_cc.cc @@ -178,7 +178,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_cc::start_tracking() long int acq_trk_diff_samples; float acq_trk_diff_seconds; acq_trk_diff_samples = static_cast(d_sample_counter) - static_cast(d_acq_sample_stamp);//-d_vector_length; - LOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; + DLOG(INFO) << "Number of samples between Acquisition and Tracking =" << acq_trk_diff_samples; acq_trk_diff_seconds = static_cast(acq_trk_diff_samples) / static_cast(d_fs_in); //doppler effect // Fd=(C/(C+Vr))*F @@ -513,9 +513,8 @@ int Gps_L1_Ca_Dll_Pll_Tracking_cc::general_work (int noutput_items, gr_vector_in if (floor(d_sample_counter / d_fs_in) != d_last_seg) { d_last_seg = floor(d_sample_counter / d_fs_in); - LOG(INFO) << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN) - << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; - //std::cout<<"TRK CH "<PRN) + << ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]"; } } } diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 0f5def09c..704479b1e 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -383,7 +383,7 @@ void GNSSFlowgraph::wait() */ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) { - LOG(INFO) << "received " << what << " from " << who; + DLOG(INFO) << "received " << what << " from " << who; switch (what) { @@ -418,13 +418,10 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) channels_.at(i)->start_acquisition(); break; } + DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; } } - for (unsigned int i = 0; i < channels_count_; i++) - { - LOG(INFO) << "Channel " << i << " in state " << channels_state_[i] << std::endl; - } break; case 2: @@ -441,16 +438,16 @@ void GNSSFlowgraph::apply_action(unsigned int who, unsigned int what) channels_.at(who)->standby(); } - for (unsigned int i = 0; i < channels_count_; i++) - { - LOG(INFO) << "Channel " << i << " in state " << channels_state_[i] << std::endl; - } + // for (unsigned int i = 0; i < channels_count_; i++) + // { + // LOG(INFO) << "Channel " << i << " in state " << channels_state_[i] << std::endl; + // } break; default: break; } - LOG(INFO) << "Number of available satellites: " << available_GNSS_signals_.size(); + DLOG(INFO) << "Number of available satellites: " << available_GNSS_signals_.size(); } @@ -694,11 +691,8 @@ void GNSSFlowgraph::set_channels_state() } else channels_state_.push_back(0); + DLOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; } acq_channels_count_ = max_acq_channels_; DLOG(INFO) << acq_channels_count_ << " channels in acquisition state"; - for (unsigned int i = 0; i < channels_count_; i++) - { - LOG(INFO) << "Channel " << i << " in state " << channels_state_[i]; - } } From b4cfef1a449c5de56d3c0f49389a3cfd1d640864 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 5 May 2015 13:00:24 +0200 Subject: [PATCH 21/25] Faster resampler --- .../libs/gps_sdr_signal_processing.cc | 30 ++++++----- src/tests/arithmetic/code_generation_test.cc | 50 +++++++++++++++++++ 2 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/algorithms/libs/gps_sdr_signal_processing.cc b/src/algorithms/libs/gps_sdr_signal_processing.cc index 5ac0c19b5..714c2dce1 100644 --- a/src/algorithms/libs/gps_sdr_signal_processing.cc +++ b/src/algorithms/libs/gps_sdr_signal_processing.cc @@ -34,11 +34,15 @@ #include #include +auto auxCeil = [](float x){ return static_cast(static_cast((x)+1)); }; void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, unsigned int _chip_shift) { - bool G1[1023]; - bool G2[1023]; + + + const unsigned int _code_length = 1023; + bool G1[_code_length]; + bool G2[_code_length]; bool G1_register[10], G2_register[10]; bool feedback1, feedback2; bool aux; @@ -47,7 +51,7 @@ void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, uns signed int prn_idx; /* G2 Delays as defined in GPS-ISD-200D */ - signed int delays[51] = {5 /*PRN1*/, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254 ,255, 256, 257, 258, 469, 470, 471, 472, + const signed int delays[51] = {5 /*PRN1*/, 6, 7, 8, 17, 18, 139, 140, 141, 251, 252, 254 ,255, 256, 257, 258, 469, 470, 471, 472, 473, 474, 509, 512, 513, 514, 515, 516, 859, 860, 861, 862 /*PRN32*/, 145 /*PRN120*/, 175, 52, 21, 237, 235, 886, 657, 634, 762, 355, 1012, 176, 603, 130, 359, 595, 68, 386 /*PRN138*/}; @@ -73,7 +77,7 @@ void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, uns } /* Generate G1 & G2 Register */ - for(lcv = 0; lcv < 1023; lcv++) + for(lcv = 0; lcv < _code_length; lcv++) { G1[lcv] = G1_register[0]; G2[lcv] = G2_register[0]; @@ -92,14 +96,14 @@ void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, uns } /* Set the delay */ - delay = 1023 - delays[prn_idx]; + delay = _code_length - delays[prn_idx]; delay += _chip_shift; - delay %= 1023; + delay %= _code_length; /* Generate PRN from G1 and G2 Registers */ - for(lcv = 0; lcv < 1023; lcv++) + for(lcv = 0; lcv < _code_length; lcv++) { - aux = G1[(lcv + _chip_shift) % 1023]^G2[delay]; + aux = G1[(lcv + _chip_shift) % _code_length]^G2[delay]; if(aux == true) { _dest[lcv] = std::complex(1, 0); @@ -109,7 +113,7 @@ void gps_l1_ca_code_gen_complex(std::complex* _dest, signed int _prn, uns _dest[lcv] = std::complex(-1, 0); } delay++; - delay %= 1023; + delay %= _code_length; } } @@ -125,6 +129,7 @@ void gps_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int signed int _samplesPerCode, _codeValueIndex; float _ts; float _tc; + float aux; const signed int _codeFreqBasis = 1023000; //Hz const signed int _codeLength = 1023; @@ -145,7 +150,9 @@ void gps_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int // number of samples per millisecond (because one C/A code period is one // millisecond). - _codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1; + // _codeValueIndex = ceil((_ts * ((float)i + 1)) / _tc) - 1; + aux = (_ts * (i + 1)) / _tc; + _codeValueIndex = auxCeil( aux ) - 1; //--- Make the digitized version of the C/A code ----------------------- // The "upsampled" code is made by selecting values form the CA code @@ -163,6 +170,3 @@ void gps_l1_ca_code_gen_complex_sampled(std::complex* _dest, unsigned int } } - - - diff --git a/src/tests/arithmetic/code_generation_test.cc b/src/tests/arithmetic/code_generation_test.cc index 0813cadb4..aea2f5079 100644 --- a/src/tests/arithmetic/code_generation_test.cc +++ b/src/tests/arithmetic/code_generation_test.cc @@ -78,3 +78,53 @@ TEST(CodeGenGPSL1_Test, CodeGeneration) } delete _dest2; */ } + + + + +TEST(CodeGenGPSL1Sampled_Test, CodeGeneration) +{ + signed int _prn = 1; + unsigned int _chip_shift = 4; + int _fs = 8000000; + const signed int _codeFreqBasis = 1023000; //Hz + const signed int _codeLength = 1023; + int _samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength)); + std::complex* _dest = new std::complex[_samplesPerCode]; + + int iterations = 10000; + + struct timeval tv; + gettimeofday(&tv, NULL); + long long int begin = tv.tv_sec * 1000000 + tv.tv_usec; + + for(int i = 0; i < iterations; i++) + { + gps_l1_ca_code_gen_complex_sampled( _dest, _prn, _fs, _chip_shift); + } + + gettimeofday(&tv, NULL); + long long int end = tv.tv_sec * 1000000 + tv.tv_usec; + ASSERT_LE(0, end - begin); + std::cout << "Generation completed in " << (end - begin) << " microseconds" << std::endl; + delete[] _dest; + + /* std::complex* _dest2 = new std::complex[_samplesPerCode]; + gettimeofday(&tv, NULL); + long long int begin2 = tv.tv_sec * 1000000 + tv.tv_usec; + + for(int i = 0; i < iterations; i++) + { + gps_l1_ca_code_gen_complex_sampled2( _dest2, _prn, _fs, _chip_shift); + } + + gettimeofday(&tv, NULL); + long long int end2 = tv.tv_sec * 1000000 + tv.tv_usec; + std::cout << "Generation completed in " << (end2 - begin2) << " microseconds (New)" << std::endl; + + for (int j=0; j<_samplesPerCode;j++) + { + if(_dest[j] != _dest2[j]) std::cout << "Error!" << std::endl; + } + delete[] _dest2; */ +} From 90ae04ee196e67411f82262b2033956a20b6f627 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 5 May 2015 16:14:46 +0200 Subject: [PATCH 22/25] Faster local carrier generation --- src/algorithms/libs/gnss_signal_processing.cc | 33 +++-------- src/tests/arithmetic/code_generation_test.cc | 55 ++++++++++++++++++- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/algorithms/libs/gnss_signal_processing.cc b/src/algorithms/libs/gnss_signal_processing.cc index 9de66ca81..8c505fec4 100644 --- a/src/algorithms/libs/gnss_signal_processing.cc +++ b/src/algorithms/libs/gnss_signal_processing.cc @@ -32,43 +32,24 @@ */ #include "gnss_signal_processing.h" -#include // fixed point sine and cosine +#include void complex_exp_gen(std::complex* _dest, double _f, double _fs, unsigned int _samps) { - int phase_i = 0; - int phase_step_i; - float phase_step_f = (float)((GPS_TWO_PI * _f) / _fs); - phase_step_i = gr::fxpt::float_to_fixed(phase_step_f); - float sin_f, cos_f; - - for(unsigned int i = 0; i < _samps; i++) - { - gr::fxpt::sincos(phase_i, &sin_f, &cos_f); - _dest[i] = std::complex(cos_f, sin_f); - phase_i += phase_step_i; - } + gr::fxpt_nco d_nco; + d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs); + d_nco.sincos(_dest, _samps, 1); } void complex_exp_gen_conj(std::complex* _dest, double _f, double _fs, unsigned int _samps) { - int phase_i = 0; - int phase_step_i; - float phase_step_f = (float)((GPS_TWO_PI * _f) / _fs); - phase_step_i = gr::fxpt::float_to_fixed(phase_step_f); - float sin_f, cos_f; - - for(unsigned int i = 0; i < _samps; i++) - { - gr::fxpt::sincos(phase_i, &sin_f, &cos_f); - _dest[i] = std::complex(cos_f, -sin_f); - phase_i += phase_step_i; - } + gr::fxpt_nco d_nco; + d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs); + d_nco.sincos(_dest, _samps, 1); } - void hex_to_binary_converter(int * _dest, char _from) { switch(_from) diff --git a/src/tests/arithmetic/code_generation_test.cc b/src/tests/arithmetic/code_generation_test.cc index aea2f5079..e8f87ab40 100644 --- a/src/tests/arithmetic/code_generation_test.cc +++ b/src/tests/arithmetic/code_generation_test.cc @@ -33,6 +33,7 @@ #include #include #include "gps_sdr_signal_processing.h" +#include "gnss_signal_processing.h" @@ -42,7 +43,7 @@ TEST(CodeGenGPSL1_Test, CodeGeneration) signed int _prn = 1; unsigned int _chip_shift = 4; - int iterations = 100; + int iterations = 100000; struct timeval tv; gettimeofday(&tv, NULL); @@ -128,3 +129,55 @@ TEST(CodeGenGPSL1Sampled_Test, CodeGeneration) } delete[] _dest2; */ } + + +TEST(ComplexCarrier_Test, CodeGeneration) +{ + //signed int _prn = 1; + //unsigned int _chip_shift = 4; + double _fs = 8000000; + double _f = 4000; + const signed int _codeFreqBasis = 1023000; //Hz + const signed int _codeLength = 1023; + int _samplesPerCode = round(_fs / (_codeFreqBasis / _codeLength)); + std::complex* _dest = new std::complex[_samplesPerCode]; + + int iterations = 100000; + + struct timeval tv; + gettimeofday(&tv, NULL); + long long int begin = tv.tv_sec * 1000000 + tv.tv_usec; + + for(int i = 0; i < iterations; i++) + { + //gps_l1_ca_code_gen_complex_sampled( _dest, _prn, _fs, _chip_shift); + complex_exp_gen_conj( _dest, _f, _fs, _samplesPerCode); + } + + gettimeofday(&tv, NULL); + long long int end = tv.tv_sec * 1000000 + tv.tv_usec; + ASSERT_LE(0, end - begin); + std::cout << "Carrier generation completed in " << (end - begin) << " microseconds" << std::endl; + + /* std::complex* _dest2 = new std::complex[_samplesPerCode]; + gettimeofday(&tv, NULL); + long long int begin2 = tv.tv_sec * 1000000 + tv.tv_usec; + + for(int i = 0; i < iterations; i++) + { + complex_exp_gen_conj2( _dest2, _f, _fs, _samplesPerCode); + } + + gettimeofday(&tv, NULL); + long long int end2 = tv.tv_sec * 1000000 + tv.tv_usec; + std::cout << "Carrier generation completed in " << (end2 - begin2) << " microseconds (New)" << std::endl; + + for (int j=0; j<_samplesPerCode;j++) + { + if(std::abs(_dest[j] - _dest2[j]) > 0.1) std::cout << "Error!" << std::endl; + } + + std::cout << _dest[10] << "and " << _dest2[10] << std::endl; + delete[] _dest2;*/ + delete[] _dest; +} From 454d0c0208e29ec67ad6f72f27600efcaccbbcd0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 5 May 2015 16:59:34 +0200 Subject: [PATCH 23/25] Fixing phase --- src/algorithms/libs/gnss_signal_processing.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/libs/gnss_signal_processing.cc b/src/algorithms/libs/gnss_signal_processing.cc index 8c505fec4..3208c8c6b 100644 --- a/src/algorithms/libs/gnss_signal_processing.cc +++ b/src/algorithms/libs/gnss_signal_processing.cc @@ -38,7 +38,7 @@ void complex_exp_gen(std::complex* _dest, double _f, double _fs, unsigned int _samps) { gr::fxpt_nco d_nco; - d_nco.set_freq(-(GPS_TWO_PI * _f) / _fs); + d_nco.set_freq((GPS_TWO_PI * _f) / _fs); d_nco.sincos(_dest, _samps, 1); } From cace34dffb34db5051dd2cb2afafaa02b8b55a2d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 6 May 2015 10:53:27 +0200 Subject: [PATCH 24/25] making the resampler faster --- src/algorithms/libs/gnss_signal_processing.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/algorithms/libs/gnss_signal_processing.cc b/src/algorithms/libs/gnss_signal_processing.cc index 3208c8c6b..ce1439bcf 100644 --- a/src/algorithms/libs/gnss_signal_processing.cc +++ b/src/algorithms/libs/gnss_signal_processing.cc @@ -35,6 +35,8 @@ #include +auto auxCeil2 = [](float x){ return static_cast(static_cast((x)+1)); }; + void complex_exp_gen(std::complex* _dest, double _f, double _fs, unsigned int _samps) { gr::fxpt_nco d_nco; @@ -158,6 +160,7 @@ void resampler(std::complex* _from, std::complex* _dest, float _fs float _fs_out, unsigned int _length_in, unsigned int _length_out) { unsigned int _codeValueIndex; + float aux; //--- Find time constants -------------------------------------------------- const float _t_in = 1 / _fs_in; // Incoming sampling period in sec const float _t_out = 1 / _fs_out; // Out sampling period in sec @@ -165,7 +168,10 @@ void resampler(std::complex* _from, std::complex* _dest, float _fs { //=== Digitizing ======================================================= //--- compute index array to read sampled values ------------------------- - _codeValueIndex = ceil((_t_out * ((float)i + 1)) / _t_in) - 1; + //_codeValueIndex = ceil((_t_out * ((float)i + 1)) / _t_in) - 1; + aux = (_t_out * (i + 1)) / _t_in; + _codeValueIndex = auxCeil2(aux) - 1; + //if repeat the chip -> upsample by nearest neighborhood interpolation _dest[i] = _from[_codeValueIndex]; } From ec7c514a8400baaba1bec2cec70b5f99ee252ad9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 6 May 2015 12:40:21 +0200 Subject: [PATCH 25/25] adding missing end of line in terminal output --- src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc index de484914a..d9d31b5d6 100644 --- a/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc +++ b/src/algorithms/PVT/gnuradio_blocks/hybrid_pvt_cc.cc @@ -340,7 +340,7 @@ int hybrid_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_items, std::cout << "Dilution of Precision at " << boost::posix_time::to_simple_string(d_ls_pvt->d_position_UTC_time) << " UTC using "<< d_ls_pvt->d_valid_observations<<" observations is HDOP = " << d_ls_pvt->d_HDOP << " VDOP = " << d_ls_pvt->d_VDOP <<" TDOP = " << d_ls_pvt->d_TDOP - << " GDOP = " << d_ls_pvt->d_GDOP; + << " GDOP = " << d_ls_pvt->d_GDOP << std::endl; } // MULTIPLEXED FILE RECORDING - Record results to file