From 758a13c554aa52d94045c91af4fe5bad5cb47f59 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 20 Jan 2017 15:33:29 +0100 Subject: [PATCH] Add more info if test fails --- .../system-tests/obs_gps_l1_system_test.cc | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/tests/system-tests/obs_gps_l1_system_test.cc b/src/tests/system-tests/obs_gps_l1_system_test.cc index 06c606320..2f25d875e 100644 --- a/src/tests/system-tests/obs_gps_l1_system_test.cc +++ b/src/tests/system-tests/obs_gps_l1_system_test.cc @@ -75,7 +75,7 @@ public: std::string p4; std::string p5; - const int baseband_sampling_freq = 2.6e6; + const double baseband_sampling_freq = 2.6e6; std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; @@ -208,6 +208,9 @@ int Obs_Gps_L1_System_Test::configure_receiver() const float pll_bw_hz = 30.0; const float dll_bw_hz = 4.0; const float early_late_space_chips = 0.5; + const float pll_bw_narrow_hz = 20.0; + const float dll_bw_narrow_hz = 2.0; + const int extend_correlation_ms = 1; const int display_rate_ms = 500; const int output_rate_ms = 1000; @@ -287,6 +290,7 @@ int Obs_Gps_L1_System_Test::configure_receiver() // Set Tracking config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); + //config->set_property("Tracking_1C.implementation", "GPS_L1_CA_DLL_PLL_C_Aid_Tracking"); config->set_property("Tracking_1C.item_type", "gr_complex"); config->set_property("Tracking_1C.if", std::to_string(zero)); config->set_property("Tracking_1C.dump", "false"); @@ -295,6 +299,10 @@ int Obs_Gps_L1_System_Test::configure_receiver() config->set_property("Tracking_1C.dll_bw_hz", std::to_string(dll_bw_hz)); config->set_property("Tracking_1C.early_late_space_chips", std::to_string(early_late_space_chips)); + config->set_property("Tracking_1C.pll_bw_narrow_hz", std::to_string(pll_bw_narrow_hz)); + config->set_property("Tracking_1C.dll_bw_narrow_hz", std::to_string(dll_bw_narrow_hz)); + config->set_property("Tracking_1C.extend_correlation_ms", std::to_string(extend_correlation_ms)); + // Set Telemetry config->set_property("TelemetryDecoder_1C.implementation", "GPS_L1_CA_Telemetry_Decoder"); config->set_property("TelemetryDecoder_1C.dump", "false"); @@ -304,6 +312,7 @@ int Obs_Gps_L1_System_Test::configure_receiver() config->set_property("Observables.implementation", "GPS_L1_CA_Observables"); config->set_property("Observables.dump", "false"); config->set_property("Observables.dump_filename", "./observables.dat"); + config->set_property("Observables.averaging_depth", std::to_string(100)); // Set PVT config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); @@ -344,12 +353,13 @@ int Obs_Gps_L1_System_Test::run_receiver() } // Get the name of the RINEX obs file generated by the receiver FILE *fp; - std::string argum2 = std::string("/bin/ls *O | tail -1"); + std::string argum2 = std::string("/bin/ls *O | grep GSDR | tail -1"); char buffer[1035]; fp = popen(&argum2[0], "r"); if (fp == NULL) { std::cout << "Failed to run command: " << argum2 << std::endl; + return -1; } char * without_trailing; while (fgets(buffer, sizeof(buffer), fp) != NULL) @@ -519,10 +529,11 @@ void Obs_Gps_L1_System_Test::check_results() // If a measure exists for this sow, store it for(it2 = pseudorange_meas.at(prn_id).begin(); it2 != pseudorange_meas.at(prn_id).end(); it2++) { - if(std::abs(it->first - it2->first) < 0.001) // store measures closer than 1 ms. + if(std::abs(it->first - it2->first) < 0.01) // store measures closer than 10 ms. { pseudorange_ref_aligned.at(prn_id).push_back(*it); pr_diff.at(prn_id).push_back(it->second - it2->second ); + //std::cout << "Sat " << prn_id << ": " << "PR_ref=" << it->second << " PR_meas=" << it2->second << " Diff:" << it->second - it2->second << std::endl; } } } @@ -537,7 +548,7 @@ void Obs_Gps_L1_System_Test::check_results() // If a measure exists for this sow, store it for(it2 = carrierphase_meas.at(prn_id).begin(); it2 != carrierphase_meas.at(prn_id).end(); it2++) { - if(std::abs(it->first - it2->first) < 0.001) // store measures closer than 1 ms. + if(std::abs(it->first - it2->first) < 0.01) // store measures closer than 10 ms. { carrierphase_ref_aligned.at(prn_id).push_back(*it); cp_diff.at(prn_id).push_back(it->second - it2->second ); @@ -555,7 +566,7 @@ void Obs_Gps_L1_System_Test::check_results() // If a measure exists for this sow, store it for(it2 = doppler_meas.at(prn_id).begin(); it2 != doppler_meas.at(prn_id).end(); it2++) { - if(std::abs(it->first - it2->first) < 0.001) // store measures closer than 1 ms. + if(std::abs(it->first - it2->first) < 0.01) // store measures closer than 10 ms. { doppler_ref_aligned.at(prn_id).push_back(*it); doppler_diff.at(prn_id).push_back(it->second - it2->second ); @@ -582,7 +593,10 @@ void Obs_Gps_L1_System_Test::check_results() { mean_diff = mean_diff / number_obs; mean_pr_diff_v.push_back(mean_diff); - std::cout << "-- Mean pseudorange difference for sat " << prn_id << ": " << mean_diff << " [m]" << std::endl; + std::cout << "-- Mean pseudorange difference for sat " << prn_id << ": " << mean_diff; + // double stdev_ = compute_stdev(*iter_diff); + // std::cout << " +/- " << stdev_ ; + std::cout << " [m]" << std::endl; } else { @@ -662,7 +676,7 @@ TEST_F(Obs_Gps_L1_System_Test, Observables_system_test) { std::cout << "Validating input RINEX nav file: " << FLAGS_rinex_nav_file << " ..." << std::endl; bool is_rinex_nav_valid = check_valid_rinex_nav(FLAGS_rinex_nav_file); - ASSERT_EQ(true, is_rinex_nav_valid); + EXPECT_EQ(true, is_rinex_nav_valid) << "The RINEX navigation file " << FLAGS_rinex_nav_file << " is not well formed."; std::cout << "The file is valid." << std::endl; // Configure the signal generator @@ -673,18 +687,18 @@ TEST_F(Obs_Gps_L1_System_Test, Observables_system_test) std::cout << "Validating generated reference RINEX obs file: " << FLAGS_filename_rinex_obs << " ..." << std::endl; bool is_gen_rinex_obs_valid = check_valid_rinex_obs( "./" + FLAGS_filename_rinex_obs); - ASSERT_EQ(true, is_gen_rinex_obs_valid); + EXPECT_EQ(true, is_gen_rinex_obs_valid) << "The RINEX observation file " << FLAGS_filename_rinex_obs << ", generated by gnss-sim, is not well formed."; std::cout << "The file is valid." << std::endl; // Configure receiver configure_receiver(); // Run the receiver - run_receiver(); + EXPECT_EQ( run_receiver(), 0) << "Problem executing the software-defined signal generator"; std::cout << "Validating RINEX obs file obtained by GNSS-SDR: " << generated_rinex_obs << " ..." << std::endl; is_gen_rinex_obs_valid = check_valid_rinex_obs( "./" + generated_rinex_obs); - ASSERT_EQ(true, is_gen_rinex_obs_valid); + EXPECT_EQ(true, is_gen_rinex_obs_valid) << "The RINEX observation file " << generated_rinex_obs << ", generated by GNSS-SDR, is not well formed."; std::cout << "The file is valid." << std::endl; // Check results