From ba73218747f711a3f803be6bf4c30507e803bef2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 2 Oct 2016 21:14:58 +0200 Subject: [PATCH 1/7] Improve TTFF report --- src/tests/CMakeLists.txt | 8 +++++++ src/tests/system-tests/ttff_gps_l1.cc | 31 +++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d755ef93a..5739b7def 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -376,6 +376,14 @@ add_dependencies(check control_thread_test flowgraph_test gnss_block_test # Addition of System Tests if(ENABLE_SYSTEM_TESTING) + set(HOST_SYSTEM "Unknown") + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(HOST_SYSTEM "GNU/LINUX ${LINUX_DISTRIBUTION} ${LINUX_VER} ${ARCH_}") + endif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(HOST_SYSTEM "MacOS") + endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + add_definitions(-DHOST_SYSTEM="${HOST_SYSTEM}") add_executable(ttff ${CMAKE_CURRENT_SOURCE_DIR}/system-tests/ttff_gps_l1.cc ) if(NOT ${GTEST_DIR_LOCAL}) diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index 00d8988b0..3f3ea8baf 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -76,7 +76,7 @@ class TTFF_GPS_L1_CA_Test: public ::testing::Test public: void config_1(); void config_2(); - void print_TTFF_report(const std::vector & ttff_v); + void print_TTFF_report(const std::vector & ttff_v, std::shared_ptr config_); std::shared_ptr config; std::shared_ptr config2; @@ -267,9 +267,13 @@ void receive_msg() } -void TTFF_GPS_L1_CA_Test::print_TTFF_report(const std::vector & ttff_v) +void TTFF_GPS_L1_CA_Test::print_TTFF_report(const std::vector & ttff_v, std::shared_ptr config_) { std::vector ttff = ttff_v; + bool read_ephemeris; + read_ephemeris = config->property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); + bool agnss; + agnss = config->property("GNSS-SDR.SUPL_gps_enabled", "false"); double sum = std::accumulate(ttff.begin(), ttff.end(), 0.0); double mean = sum / ttff.size(); double sq_sum = std::inner_product(ttff.begin(), ttff.end(), ttff.begin(), 0.0); @@ -279,6 +283,24 @@ void TTFF_GPS_L1_CA_Test::print_TTFF_report(const std::vector & ttff_v) std::cout << "---------------------------" << std::endl; std::cout << " Time-To-First-Fix Report" << std::endl; std::cout << "---------------------------" << std::endl; + std::cout << "Initial receiver status: "; + if (read_ephemeris) + { + std::cout << "Hot start." << std::endl; + } + else + { + std::cout << "Cold start." << std::endl; + } + std::cout << "AGNSS: "; + if (agnss && read_ephemeris) + { + std::cout << "Enabled." << std::endl; + } + else + { + std::cout << "Disabled." << std::endl; + } std::cout << "Valid measurements (" << ttff.size() << "/" << FLAGS_num_measurements << "): "; for(double ttff_ : ttff) std::cout << ttff_ << " "; std::cout << std::endl; @@ -289,6 +311,7 @@ void TTFF_GPS_L1_CA_Test::print_TTFF_report(const std::vector & ttff_v) std::cout << "TTFF min: " << *min_ttff << " [s]" << std::endl; } std::cout << "TTFF stdev: " << stdev << " [s]" << std::endl; + std::cout << "Operating System: " << std::string(HOST_SYSTEM) << std::endl; std::cout << "---------------------------" << std::endl; } @@ -304,7 +327,7 @@ TEST_F(TTFF_GPS_L1_CA_Test, ColdStart) config_2(); // Ensure Cold Start - config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); + config2->set_property("GNSS-SDR.SUPL_gps_enabled", "false"); config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); config2->set_property("PVT.flag_rtcm_server", "false"); @@ -357,7 +380,7 @@ TEST_F(TTFF_GPS_L1_CA_Test, ColdStart) } // Print TTFF report - print_TTFF_report(TTFF_v); + print_TTFF_report(TTFF_v, config); } From f61c6fddd8ea944edeff05aa979f833a5b18464d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 2 Oct 2016 21:19:09 +0200 Subject: [PATCH 2/7] Fix --- src/tests/system-tests/ttff_gps_l1.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index 3f3ea8baf..2dd76c73d 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -271,9 +271,9 @@ void TTFF_GPS_L1_CA_Test::print_TTFF_report(const std::vector & ttff_v, { std::vector ttff = ttff_v; bool read_ephemeris; - read_ephemeris = config->property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); + read_ephemeris = config_->property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); bool agnss; - agnss = config->property("GNSS-SDR.SUPL_gps_enabled", "false"); + agnss = config_->property("GNSS-SDR.SUPL_gps_enabled", "false"); double sum = std::accumulate(ttff.begin(), ttff.end(), 0.0); double mean = sum / ttff.size(); double sq_sum = std::inner_product(ttff.begin(), ttff.end(), ttff.begin(), 0.0); @@ -312,6 +312,7 @@ void TTFF_GPS_L1_CA_Test::print_TTFF_report(const std::vector & ttff_v, } std::cout << "TTFF stdev: " << stdev << " [s]" << std::endl; std::cout << "Operating System: " << std::string(HOST_SYSTEM) << std::endl; + std::cout << "Navigation mode: " << "3D" << std::endl; std::cout << "---------------------------" << std::endl; } From b3eab47604e77925e64bb9bbf83023838b1a1e0c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 2 Oct 2016 21:24:46 +0200 Subject: [PATCH 3/7] Add hot start TTFF --- src/tests/system-tests/ttff_gps_l1.cc | 66 ++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index 2dd76c73d..aa88d6345 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -63,13 +63,13 @@ concurrent_queue global_gps_acq_assist_queue; concurrent_map global_gps_acq_assist_map; std::vector TTFF_v; +const int decimation_factor = 1; typedef struct { long mtype; // required by SysV message double ttff; } ttff_msgbuf; -const int decimation_factor = 1; class TTFF_GPS_L1_CA_Test: public ::testing::Test { @@ -385,6 +385,69 @@ TEST_F(TTFF_GPS_L1_CA_Test, ColdStart) } +TEST_F(TTFF_GPS_L1_CA_Test, HotStart) +{ + unsigned int num_measurements = 0; + TTFF_v.clear(); + + config_2(); + // Ensure Hot Start + config2->set_property("GNSS-SDR.SUPL_gps_enabled", "true"); + config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "true"); + config2->set_property("PVT.flag_rtcm_server", "false"); + + for(int n = 0; n < FLAGS_num_measurements; n++) + { + // Create a new ControlThread object with a smart pointer + std::unique_ptr control_thread(new ControlThread(config2)); + + // record startup time + struct timeval tv; + gettimeofday(&tv, NULL); + long long int begin = tv.tv_sec * 1000000 + tv.tv_usec; + + std::cout << "Starting measurement " << num_measurements + 1 << " / " << FLAGS_num_measurements << std::endl; + + // start receiver + try + { + control_thread->run(); + } + catch( boost::exception & e ) + { + std::cout << "Boost exception: " << boost::diagnostic_information(e); + } + catch(std::exception const& ex) + { + std::cout << "STD exception: " << ex.what(); + } + + // stop clock + gettimeofday(&tv, NULL); + long long int end = tv.tv_sec * 1000000 + tv.tv_usec; + double ttff = static_cast(end - begin) / 1000000.0; + + std::shared_ptr flowgraph = control_thread->flowgraph(); + EXPECT_FALSE(flowgraph->running()); + + num_measurements = num_measurements + 1; + std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds." << std::endl; + if(n < FLAGS_num_measurements - 1) + { + std::srand(std::time(0)); // use current time as seed for random generator + int random_variable = std::rand(); + float random_variable_0_1 = static_cast(random_variable) / static_cast( RAND_MAX ); + int random_delay_s = static_cast(random_variable_0_1 * 25.0); + std::cout << "Waiting a random amount of time (from 5 to 30 s) to start new measurement... " << std::endl; + std::cout << "This time will wait " << random_delay_s + 5 << " s." << std::endl << std::endl; + std::this_thread::sleep_until(std::chrono::system_clock::now() + std::chrono::seconds(5) + std::chrono::seconds(random_delay_s)); + } + } + + // Print TTFF report + print_TTFF_report(TTFF_v, config); +} + int main(int argc, char **argv) { @@ -406,7 +469,6 @@ int main(int argc, char **argv) throw new std::exception(); } - // Start queue thread std::thread receive_msg_thread(receive_msg); From e89b54c682b4bb00d7d2ef147b643d378be44fe0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 2 Oct 2016 21:41:37 +0200 Subject: [PATCH 4/7] Add AGNSS configuration to TTFF test --- src/tests/system-tests/ttff_gps_l1.cc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index aa88d6345..579f987c7 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -123,8 +123,22 @@ public: void TTFF_GPS_L1_CA_Test::config_1() { config = std::make_shared(); - // Set the Signal Source + config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(FLAGS_fs_in)); + + // Set the assistance system + config->set_property("GNSS-SDR.SUPL_gps_enabled", "false"); + config->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); + config->set_property("GNSS-SDR.SUPL_gps_ephemeris_server", "supl.google.com"); + config->set_property("GNSS-SDR.SUPL_gps_ephemeris_port", std::to_string(7275)); + config->set_property("GNSS-SDR.SUPL_gps_acquisition_server", "supl.google.com"); + config->set_property("GNSS-SDR.SUPL_gps_acquisition_port", std::to_string(7275)); + config->set_property("GNSS-SDR.SUPL_MCC", std::to_string(244)); + config->set_property("GNSS-SDR.SUPL_MNS", std::to_string(5)); + config->set_property("GNSS-SDR.SUPL_LAC", "0x59e2"); + config->set_property("GNSS-SDR.SUPL_CI", "0x31b0"); + + // Set the Signal Source config->set_property("SignalSource.item_type", "cshort"); config->set_property("SignalSource.implementation", "UHD_Signal_Source"); config->set_property("SignalSource.freq", std::to_string(central_freq)); @@ -390,11 +404,10 @@ TEST_F(TTFF_GPS_L1_CA_Test, HotStart) unsigned int num_measurements = 0; TTFF_v.clear(); - config_2(); + config_1(); // Ensure Hot Start - config2->set_property("GNSS-SDR.SUPL_gps_enabled", "true"); - config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "true"); - config2->set_property("PVT.flag_rtcm_server", "false"); + config->set_property("GNSS-SDR.SUPL_gps_enabled", "true"); + config->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "true"); for(int n = 0; n < FLAGS_num_measurements; n++) { From a9e881c8bd38926b970ae7ffc09c687ebe68fe91 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 2 Oct 2016 21:47:10 +0200 Subject: [PATCH 5/7] Fix --- src/tests/system-tests/ttff_gps_l1.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index 579f987c7..32559b92b 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -412,7 +412,7 @@ TEST_F(TTFF_GPS_L1_CA_Test, HotStart) for(int n = 0; n < FLAGS_num_measurements; n++) { // Create a new ControlThread object with a smart pointer - std::unique_ptr control_thread(new ControlThread(config2)); + std::unique_ptr control_thread(new ControlThread(config)); // record startup time struct timeval tv; From e976b8cd0c82719f4605b2acc94855b44b411579 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 2 Oct 2016 21:55:58 +0200 Subject: [PATCH 6/7] Fix --- src/tests/system-tests/ttff_gps_l1.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index 32559b92b..d3d42417d 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -306,7 +306,7 @@ void TTFF_GPS_L1_CA_Test::print_TTFF_report(const std::vector & ttff_v, { std::cout << "Cold start." << std::endl; } - std::cout << "AGNSS: "; + std::cout << "A-GNSS: "; if (agnss && read_ephemeris) { std::cout << "Enabled." << std::endl; From 8a50cccd1809ba44f2c43dd34e05928f9437907d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 2 Oct 2016 22:09:23 +0200 Subject: [PATCH 7/7] Fix --- src/tests/system-tests/ttff_gps_l1.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tests/system-tests/ttff_gps_l1.cc b/src/tests/system-tests/ttff_gps_l1.cc index d3d42417d..1c59fd7ce 100644 --- a/src/tests/system-tests/ttff_gps_l1.cc +++ b/src/tests/system-tests/ttff_gps_l1.cc @@ -126,9 +126,7 @@ void TTFF_GPS_L1_CA_Test::config_1() config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(FLAGS_fs_in)); - // Set the assistance system - config->set_property("GNSS-SDR.SUPL_gps_enabled", "false"); - config->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); + // Set the assistance system parameters config->set_property("GNSS-SDR.SUPL_gps_ephemeris_server", "supl.google.com"); config->set_property("GNSS-SDR.SUPL_gps_ephemeris_port", std::to_string(7275)); config->set_property("GNSS-SDR.SUPL_gps_acquisition_server", "supl.google.com");